title: Getting WA, created own test cases too but not getting approved answers
body: <ul>
  <li><strong>Link of Question :</strong>  <a href="https://www.codechef.com/JULY20B/problems/PTMSSNG" rel="nofollow noreferrer">https://www.codechef.com/JULY20B/problems/PTMSSNG</a></li>
  </ul>
  <p><strong>Question Statement</strong></p>
  <p>Chef has N axis-parallel rectangles in a 2D Cartesian coordinate system. These rectangles may intersect, but it is guaranteed that all their 4N vertices are pairwise distinct.</p>
  <p>Unfortunately, Chef lost one vertex, and up until now, none of his fixes have worked (although putting an image of a point on a milk carton might not have been the greatest idea after all…). Therefore, he gave you the task of finding it! You are given the remaining 4N−1 points and you should find the missing one.</p>
  <p><em><strong>Can anyone suggest where I'm going wrong or update my code or share a few test cases.</strong></em></p>
  <pre><code>    #include &lt;iostream&gt;
      #include &lt;vector&gt;
      #include &lt;algorithm&gt;
      #include &lt;utility&gt;
      
      #define ll long long
      
      using namespace std;
      
      int main()
      {
          int t;
          cin &gt;&gt; t;
          for (int i = 0; i &lt; t; i++)
          {
              vector&lt;pair&lt;ll, ll&gt;&gt; v;
              ll n, m, a;
              bool checkx = false;
              cin &gt;&gt; n;
              m = 4 * n - 1;
              ll x[m], y[m];
              ll c, d;
              a = (m - 1) / 2;
              for (ll i = 0; i &lt; m; i++)
              {
                  cin &gt;&gt; x[i] &gt;&gt; y[i];
                  v.push_back(make_pair(x[i], y[i]));
              }
              sort(v.begin(), v.end());
      
              for (ll i = a; i &gt;= 1; --i)
              {
                  if (v[2 * i].first != v[2 * i - 1].first)
                  {
                      c = v[2 * i].first;
                      checkx = true;
                      if ((2 * i) % 4 == 0 &amp;&amp; i &gt;= 2)
                      {
                          if (v[2 * i].second == v[2 * i + 1].second)
                          {
                              d = v[2 * i + 2].second;
                          }
                          else
                          {
                              d = v[2 * i + 1].second;
                          }
                      }
                      else
                      {
                          if (v[2 * i].second != v[2 * i - 1].second)
                          {
                              d = v[2 * i - 1].second;
                          }
                          else
                          {
                              d = v[2 * i - 2].second;
                          }
                      }
                      break;
                  }
              }
              if (checkx)
              {
                  cout &lt;&lt; c &lt;&lt; &quot; &quot; &lt;&lt; d;
              }
              else
              {
                  if (v[0].second == v[1].second)
                  {
                      d = v[2].second;
                  }
                  else
                  {
                      d = v[1].second;
                  }
                  cout &lt;&lt; v[0].first &lt;&lt; &quot; &quot; &lt;&lt; d;
              }
              cout &lt;&lt; endl;
          }
          return 0;
      }
  </code></pre>