Language: C++

// AtCoder-Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define FORREV(i,N,_cnt) for(auto i=N-1,cnt=_cnt; cnt > 0; --i, --cnt)
#define ALL(x) x.begin(), x.end()

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T& a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T& a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
	ifstream ifs("in.txt");
	cin.rdbuf(ifs.rdbuf());
#endif
	ll N; cin >> N;
	vector<ll> X(N), Y(N);
	vector<pair<ll, ll> > Z(N);
	FOR(i, N) {
		cin >> X[i] >> Y[i];
		Z[i] = make_pair(X[i], Y[i]);
	}
	sort(ALL(Z), [](auto i, auto j) {
		Z[i].first < Z[i].second;
		});;

	ll ans = numeric_limits<ll>::max();
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			// i -> j のときのA,Bを求める。
			auto a = Z[j].first  - Z[i].first;
			auto b = Z[j].second - Z[i].second;
			ll ans_tmp = 0; // aが必ず
			set< pair<ll, ll> > S;
			for (int z = 0; z < N; ++z) {
				if (!S.count(make_pair(
					Z[z].first - a, Z[z].second - b))) {
					ans_tmp += 1;				
				}
				S.insert(make_pair(Z[z].first, Z[z].second));

			}
			chmin(ans, ans_tmp);
			
		}
	}


	////////// y axis
	sort(ALL(Z), [](auto i, auto j) {
		Z[i].second < Z[i].second;
		});;

	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			// i -> j のときのA,Bを求める。
			auto a = Z[j].first - Z[i].first;
			auto b = Z[j].second - Z[i].second;
			ll ans_tmp = 0; // aが必ず
			set< pair<ll, ll> > S;
			for (int z = 0; z < N; ++z) {
				if (!S.count(make_pair(
					Z[z].first - a, Z[z].second - b))) {
					ans_tmp += 1;
				}
				S.insert(make_pair(Z[z].first, Z[z].second));

			}
			chmin(ans, ans_tmp);

		}
	}


	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:53:17: error: 'Z' is not captured
   53 |                 Z[i].first < Z[i].second;
      |                 ^
a.cc:52:23: note: the lambda has no capture-default
   52 |         sort(ALL(Z), [](auto i, auto j) {
      |                       ^
a.cc:47:31: note: 'std::vector<std::pair<long long int, long long int> > Z' declared here
   47 |         vector<pair<ll, ll> > Z(N);
      |                               ^
a.cc:53:30: error: 'Z' is not captured
   53 |                 Z[i].first < Z[i].second;
      |                              ^
a.cc:52:23: note: the lambda has no capture-default
   52 |         sort(ALL(Z), [](auto i, auto j) {
      |                       ^
a.cc:47:31: note: 'std::vector<std::pair<long long int, long long int> > Z' declared here
   47 |         vector<pair<ll, ll> > Z(N);
      |                               ^
a.cc: In lambda function:
a.cc:80:17: error: 'Z' is not captured
   80 |                 Z[i].second < Z[i].second;
      |                 ^
a.cc:79:23: note: the lambda has no capture-default
   79 |         sort(ALL(Z), [](auto i, auto j) {
      |                       ^
a.cc:47:31: note: 'std::vector<std::pair<long long int, long long int> > Z' declared here
   47 |         vector<pair<ll, ll> > Z(N);
      |                               ^
a.cc:80:31: error: 'Z' is not captured
   80 |                 Z[i].second < Z[i].second;
      |                               ^
a.cc:79:23: note: the lambda has no capture-default
   79 |         sort(ALL(Z), [](auto i, auto j) {
      |                       ^
a.cc:47:31: note: 'std::vector<std::pair<long long int, long long int> > Z' declared here
   47 |         vector<pair<ll, ll> > Z(N);
      |                               ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 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:4:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Compare = main()::<lambda(auto:1, auto:2)>]':
/usr/include/c++/14/bits/stl_algo.h:1777:14:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(auto:1, auto:2)> >]'
 1777 |           if (__comp(__i, __first))
      |               ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(auto:1, auto:2)> >]'
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(auto:1, auto:2)> >]'
 1908 |           std::__final_insertion_sort(__first, __last, __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = main()::<lambda(auto:1, auto:2)>]'
 4805 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:52:6:   required from here
   52 |         sort(ALL(Z), [](auto i, auto j) {
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   53 |                 Z[i].first < Z[i].second;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~
   54 |                 });;
      |                 ~~
/usr/include/c++/14/bits/predefined_ops.h:158:30: error: void value not ignored as it ought to be
  158 |         { return bool(_M_comp(*__it1, *__it2)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Compare = main()::<lambda(auto:3, auto:4)>]':
/usr/include/c++/14/bits/stl_algo.h:1777:14:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(auto:3, auto:4)> >]'
 1777 |           if (__comp(__i, __first))
      |               ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(auto:3, auto:4)> >]'
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(auto:3, auto:4)> >]'
 1908 |           std::__final_insertion_sort(__first, __last, __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = main()::<lambda(auto:3, auto:4)>]'
 4805 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:79:6:   required from here
   79 |         sort(ALL(Z), [](auto i, auto j) {
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   80 |                 Z[i].second < Z[i].second;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~
   81 |                 });;
      |                 ~~
/usr/include/c++/14/bits/predefined_ops.h:158:30: error: void value not ignored as it ought to be
  158 |         { return bool(_M_comp(*__it1, *__it2)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_comp_iter<_Compare>::operator()(_Value&, _Iterator) [with _Value = std::pair<long long int, long long int>; _Iterator = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Compare = main()::<lambda(auto:1, auto:2)>]':
/usr/include/c++/14/bits/stl_algo.h:1757:20:   required from 'void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Val_comp_iter<main()::<lambda(auto:1, auto:2)> >]'
 1757 |       while (__comp(__val, __next))
      |              ~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1785:36:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(auto:1, auto:2)> >]'
 1785 |             std::__unguarded_linear_insert(__i,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
 1786 |                                 __gnu_cxx::__ops::__val_comp_iter(__comp));
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(auto:1, auto:2)> >]'
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31:   required from 'void std::__sort(_RandomAcc