title: Implementation of lower_bound on vector pairs
body: <p>I know we need to include some compare function in order to achieve this.</p>
  
  <p>But not able to write for this one.</p>
  
  <p>For example:</p>
  
  <p>Elements of vector=<code>{(2,4),(4,2),(5,1),(5,3)}</code></p>
  
  <p>to find=5</p>
  
  <p>lower_bound() should return 2</p>
  
  <p><strong>code-></strong></p>
  
  <pre><code>#define pp pair&lt;int,int&gt;
  
  bool cmp(const pp &amp;l,const pp &amp;r) {
      return l.first &lt; r.first;
  }
  
  int main() {
     vector&lt;pp&gt; v;
     sort(v.begin(), v.end(), cmp);
     int id=(int)(lower_bound(v.begin(), v.end(), ??) - v.begin());
  }
  </code></pre>