Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
  int n,x,y,l[20100],r[20100];
  const int lim = 10000;

  for(int i=0;i<=20000;i++){
    l[i] = lim+1; r[i] = -lim-1;
  }
  
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d%d",&x,&y);
    l[x+lim] = min(l[x+lim],y); r[x+lim] = max(r[x+lim],y);
  }

  long long ans = 10LL*lim*lim;

  for(int i=0;i<=20000;i++){
    if(l[i] == lim+1)continue;
    for(int j=i+1;j<=20000;j++){
      if((j-i)*(j-i) > ans)break;
      if(l[j] == lim+1)continue;
      ans = min(ans,(r[i]-l[j])*(r[i]-l[j]) + (j-i)*(j-i));
      ans = min(ans,(l[i]-r[j])*(l[i]-r[j]) + (j-i)*(j-i));
    }
  }
  printf("%d\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: no matching function for call to 'min(long long int&, int)'
   26 |       ans = min(ans,(r[i]-l[j])*(r[i]-l[j]) + (j-i)*(j-i));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:26:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   26 |       ans = min(ans,(r[i]-l[j])*(r[i]-l[j]) + (j-i)*(j-i));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:26:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |       ans = min(ans,(r[i]-l[j])*(r[i]-l[j]) + (j-i)*(j-i));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:27:16: error: no matching function for call to 'min(long long int&, int)'
   27 |       ans = min(ans,(l[i]-r[j])*(l[i]-r[j]) + (j-i)*(j-i));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:27:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |       ans = min(ans,(l[i]-r[j])*(l[i]-r[j]) + (j-i)*(j-i));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:27:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |       ans = min(ans,(l[i]-r[j])*(l[i]-r[j]) + (j-i)*(j-i));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~