Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

int main(){

	int n;
	while(cin>>n&&n!=0){
		int S = 0;

		// _ÌÀWði[
		pair<int,int> dots[3001];
		// _ª éÀWÉ¶Ý·é©Ç¤©
		bool points[5001][5001];

		//for(int i = 0; i < 5001; i++)
		//	fill(points[i],points[i]+5001,false);
		memset(points,0,sizeof(points));

		for(int i = 0; i < n; i++){
			cin>>dots[i].second>>dots[i].first;
			points[dots[i].first][dots[i].second]=true;
		}
		// ñ_ðIñÅA»Ìñ_Å³û`ªìêé©Ç¤©
		for(int i = 0; i < n; i++){
			for(int j = i+1; j < n; j++){
				if(i==j)
					continue;
				// ñ_ÌìéxNg
				P v(dots[i].second-dots[j].second,dots[i].first-dots[j].first);
				// »Ì@üxNg
				P nv(-v.imag(),v.real());
				// @üxNgÌPÊxNg
				if(EQ(abs(nv),0.0))
					continue;
				P nve(nv.real()/abs(nv),nv.imag()/abs(nv));
				// ãLÌPÊxNgðabs(v){·é
				P nveABSV(nve.real()*abs(v),nve.imag()*abs(v));
				// ãÌxNgðgÁÄ³û`ð\¬µ»¤È_ð©Â¯é
				P p1[2];
				P p2[2];
				
				p1[0] = P(nveABSV.real()+dots[i].second,nveABSV.imag()+dots[i].first);
				p1[1] = P(-nveABSV.real()+dots[i].second,-nveABSV.imag()+dots[i].first);
				p2[0] = P(nveABSV.real()+dots[j].second,nveABSV.imag()+dots[j].first);
				p2[1] = P(-nveABSV.real()+dots[j].second,-nveABSV.imag()+dots[j].first);

				// _ÌyAðìé
				pair<P,P> rec1,rec2;
				if(EQ(abs(p1[0]-p2[0]),abs(v))){
					rec1.first = p1[0];
					rec1.second = p2[0];
					rec2.first = p1[1];
					rec2.second = p2[1];
				}
				else{
					rec1.first = p1[0];
					rec1.second = p2[1];
					rec2.first = p1[1];
					rec2.second = p2[0];
				}
				
				// ±±Åmèµ½_ª¶Ý·êÎAÊÏðvZ
				if((int)(rec1.first.imag()+EPS)>=0&&(int)(rec1.first.imag()+EPS)<=5000
					&&(int)(rec1.second.imag()+EPS)>=0&&(int)(rec1.second.imag()+EPS)<=5000
					&&(int)(rec1.first.real()+EPS)>=0&&(int)(rec1.first.real()+EPS)<=5000
					&&(int)(rec1.second.real()+EPS)>=0&&(int)(rec1.second.real()+EPS)<=5000){
						if(points[(int)(rec1.first.imag()+EPS)][(int)(rec1.first.real()+EPS)]
						&&points[(int)(rec1.second.imag()+EPS)][(int)(rec1.second.real()+EPS)]){
							S = max(S,(int)(abs(v)*abs(v)));
						}
				}
				if((int)(rec2.first.imag()+EPS)>=0&&(int)(rec2.first.imag()+EPS)<=5000
					&&(int)(rec2.second.imag()+EPS)>=0&&(int)(rec2.second.imag()+EPS)<=5000
					&&(int)(rec2.first.real()+EPS)>=0&&(int)(rec2.first.real()+EPS)<=5000
					&&(int)(rec2.second.real()+EPS)>=0&&(int)(rec2.second.real()+EPS)<=5000){
						if(points[(int)(rec2.first.imag()+EPS)][(int)(rec2.first.real()+EPS)]
						&&points[(int)(rec2.second.imag()+EPS)][(int)(rec2.second.real()+EPS)]){
							S = max(S,(int)(abs(v)*abs(v)));
						}
				}
			}
		}
		cout<<S<<endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:17: error: 'memset' was not declared in this scope
   41 |                 memset(points,0,sizeof(points));
      |                 ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include <cstdlib>
  +++ |+#include <cstring>
   15 | #include <sstream>