Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
  if(n==1)cout<<1<<endl;
  else{
    vector<pair<long long ,long long > > d(0),d2(0),xy(n);
    for(int i=0;i<n;i++){
        cin >> xy[i].first>>xy[i].second;
    }
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
          if((xy[i].first-xy[j].first)*(xy[i].second-xy[j].second)>=0)
            d.push_back({abs(xy[i].first-xy[j].first),abs(xy[i].second-xy[j].second)});
          else
            d2.push_back({xy[i].first-xy[j].first,xy[i].second-xy[j].second});
        }
    }
    int ma=1,ma2=1;
    if(d.size()>0){
      sort(d.begin(),d.end());
      long long a=d[0].first,b=d[0].second,count=1;
      for(int i=1;i<d.size();i++){
        if(a==d[i].first&&b==d[i].second){
            count++;
        }
        else{
            ma=max(ma,count);
            count=1;
            a=d[i].first,b=d[i].second;
        }
      }
    }
    if(d2.size()>0){
      sort(d2.begin(),d2.end());
      long long a=d2[0].first,b=d2[0].second,count=1;
      for(int i=1;i<d2.size();i++){
        if(a==d2[i].first&&b==d2[i].second){
            count++;
        }
        else{
            ma2=max(ma2,count);
            count=1;
            a=d2[i].first,b=d2[i].second;
        }
      }
    }
    cout<<n-max(ma,ma2)<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:19: error: no matching function for call to 'max(int&, long long int&)'
   28 |             ma=max(ma,count);
      |                ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:28:19: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   28 |             ma=max(ma,count);
      |                ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:28:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |             ma=max(ma,count);
      |                ~~~^~~~~~~~~~
a.cc:42:20: error: no matching function for call to 'max(int&, long long int&)'
   42 |             ma2=max(ma2,count);
      |                 ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:42:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   42 |             ma2=max(ma2,count);
      |                 ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:42:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   42 |             ma2=max(ma2,count);
      |                 ~~~^~~~~~~~~~~