Language: C++

#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<bitset>
#include<utility>
#include<sstream>
#include<iomanip>
using namespace std;

#define ll long long
#define MP make_pair



int main(void) {
	ll n,x[50],y[50],c=1,maxnx=0,maxny=0,ans;

	vector<pair<ll,ll>> p(50);
	vector<pair<ll,ll>> sx(50);
	vector<pair<ll,ll>> sy(50);
	vector<pair<ll,ll>> tx(50);
	vector<pair<ll,ll>> ty(50);
	cin>>n;
	for (int i = 0; i < n; i++) {
		cin>>x[i]>>y[i];
		p[i]=MP(x[i],y[i]);
	}

	sort(p.begin(),p.begin()+n);

	/*cout<<"\n";
	for (int i = 0; i < n; i++) {
		printf("%lld %lld\n",p[i].first,p[i].second);
	}
	cout<<"\n";*/
	ll cur=0,tmp;
	bool exi=false;

	for (int i = 0; i < n; i++) {
		exi=false;
		if(i>0){
			tmp=p[i].first-p[i-1].first;
			for (int ser = 0; ser < cur; ser++) {
				if(tmp==sx[ser].first){
					exi=true;
					sx[ser].second++;
				}
			}
			if(exi==false){
				sx[cur]=MP(tmp,1);
				cur++;
			}
		}
	}
	for (int i = 0; i < cur; i++) {
		maxnx=max(maxnx,sx[i].second);
	}

	cur=0;
	for (int i = 0; i < n; i++) {
		exi=false;
		if(i>0){
			tmp=p[i].second-p[i-1].second;
			for (int ser = 0; ser < cur; ser++) {
				if(tmp==sy[ser].first){
					exi=true;
					sy[ser].second++;
				}
			}
			if(exi==false){
				sy[cur]=MP(tmp,1);
				cur++;
			}
		}
	}
	for (int i = 0; i < cur; i++) {
		maxny=max(maxny,sy[i].second);
	}

	//printf("maxnx%lld maxny%lld\n",maxnx,maxny);

	int num=min(n-maxnx,n-maxny);
	ans=num;
	//cout<<ans<<"\n\n";


/****************************************************************/



	for (int i = 0; i < n; i++) {
		p[i]=MP(y[i],x[i]);

	}

	sort(p.begin(),p.begin()+n);
	/*for (int i = 0; i < n; i++) {
		printf("%lld %lld\n",p[i].first,p[i].second);
	}*/
	//cout<<"\n";
	maxnx=0;
	maxny=0;

	for (int i = 0; i < n; i++) {
		exi=false;

		if(i>0){
			tmp=p[i].first-p[i-1].first;
			for (int ser = 0; ser < cur; ser++) {
				if(tmp==sx[ser].first){
					exi=true;
					sx[ser].second++;
				}
			}
			if(exi==false){
				sx[cur]=MP(tmp,1);
				cur++;
			}
		}
	}
	for (int i = 0; i < cur; i++) {
		maxnx=max(maxnx,sx[i].second);
	}

	cur=0;
	for (int i = 0; i < n; i++) {
		exi=false;

		if(i>0){
			tmp=p[i].second-p[i-1].second;
			for (int ser = 0; ser < cur; ser++) {
				if(tmp==sy[ser].first){
					exi=true;
					sy[ser].second++;
				}
			}
			if(exi==false){
				sy[cur]=MP(tmp,1);
				cur++;
			}
		}
	}
	for (int i = 0; i < cur; i++) {
		maxny=max(maxny,sy[i].second);
	}
	num=min(n-maxnx,n-maxny);
	ans=min(ans,num);
	cout<<ans<<"\n";


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:151:16: error: no matching function for call to 'min(long long int&, int&)'
  151 |         ans=min(ans,num);
      |             ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:151:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  151 |         ans=min(ans,num);
      |             ~~~^~~~~~~~~
/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,
                 from a.cc:4:
/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:151:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  151 |         ans=min(ans,num);
      |             ~~~^~~~~~~~~