title: Runtime Error in C++
body: <p>I am running this program on codeblocks where it runs fine but in an online judge it gives a Runtime error for the input same input.
  I cannot figure out what could be the cause of this error.</p>
  
  <pre><code>    vector&lt;int&gt; twoSum(vector&lt;int&gt; &amp;numbers, int target)
      {
  
       vector&lt;int&gt; c ;
  
      sort(numbers.begin(),numbers.end()-1);
  
      vector&lt;int&gt;::iterator i = numbers.begin();
      vector&lt;int&gt;::iterator j = numbers.end()-1;
  
      while(i&lt;=j)
      {
          int sum = *i + *j;
          if(sum==target)
                             { c.push_back(i-numbers.begin());
                               c.push_back(j-numbers.begin());
                               //cout&lt;&lt;*i&lt;&lt;" "&lt;&lt;*j&lt;&lt;endl;
                               break;
  
                             }
          else if(sum&lt;target) i++;
          else j--;
      }
      return c;
  }
  </code></pre>