square sum


"Everyone knows what a square looks like. Mathematically, a square is a regular quadrilateral. This means that it has four equal sides and four equal angles (90 degree angles). One beautiful day, Johnny eagerly examined the interesting properties of squares. He did not forget you, his best friend and a talented programmer and thus made a problem about squares to challenge your programming ability. The problem is: given a set of N points in the plane, how many squares are there such that all their corners belong to this set? Now let's show Johnny your skill! Input The first line contains t, the number of test cases (about 10). Then t test cases follow. Each test case has the following form: The first line contains an integer N, the number of points in the given set (4 <= N <= 500). Then N lines follow, each line contains two integers X, Y describing coordinates of a point (-50,= X, Y <= 50). Output For each test case, print in a single line the number of squares that have vertices belong to the given set." Test Case 1 Input (stdin) 1 7 0 0 0 1 1 0 1 1 1 2 2 1 2 2 Expected Output 3 Test Case 2 Input (stdin) 1 4 1 1 1 2 2 1 2 2 Expected Output 1

Program :

#include <stdio.h>

int main() {


    int numcase,I,i,j,n,count,x[500],y[500],point[101][101];

    int x1,x2,x3,x4,y1,y2,y3,y4;



    for(I=0;I<numcase;I++) {



            for(j=0;j<=100;j++) point[i][j]=0;

        for(i=0;i<n;i++) {







        for(i=0;i<n;i++) {

            for(j=0;j<n;j++) {

                if(i!=j) {















   return 0;