Nie wiem czemu kod mi się nie kompiluje
na komputerze mi wszystko działa a na SPOJu nie. Ma ktoś jakiś pomysł? 
import java.util.*;
import java.lang.Math.*;
public class Test {
public static void main(String[] args)
{
int d; //number of sets
int numberOfPoints;
int[] x,y;
Scanner scan=new Scanner(System.in);
d= scan.nextInt();
for (int i=0; i<d; i++) //loop for each set
{
ArrayList<Integer> usedIndex=new ArrayList<>();
ArrayList<Integer> pointsInOrder=new ArrayList<>();
scan=new Scanner(System.in);
numberOfPoints=scan.nextInt();
x=new int[numberOfPoints];
y=new int[numberOfPoints];
for (int j=0; j<numberOfPoints;j++) //set x and y of points
{
scan= new Scanner(System.in);
x[j]=scan.nextInt();
scan= new Scanner(System.in);
y[j]=scan.nextInt();
}
for(int j=0; j<x.length/3; j++)
{
int j1=founingMostDistsntPonitFromCenter(x,y,usedIndex);
usedIndex.add(j1);
int j2=foundingMostDistantPointFromPoint(x, y, j1, usedIndex);
usedIndex.add(j2);
int j3=foundingThirdPoint(x,y,j1,j2,usedIndex);
usedIndex.add(j3);
int[] index= {j1,j2,j3};
Arrays.sort(index);
pointsInOrder.add(index[0]);
pointsInOrder.add(index[1]);
pointsInOrder.add(index[2]);
}
for(int j=0; j<numberOfPoints/3; j++)
{
int[] output= {pointsInOrder.get(3*j)+1,pointsInOrder.get(3*j+1)+1,pointsInOrder.get(3*j+2)+1 };
System.out.print(output[0]);
System.out.print(output[1]);
System.out.println(output[2]);
}
System.out.println();
}
}
public static int founingMostDistsntPonitFromCenter(int[] x, int[] y, ArrayList<Integer> used)
{
double d2=-1;
int counter=-1;
for (int j=0; j<x.length;j++) //founds the most distant point
{
double d1= Math.sqrt(Math.pow(x[j],2)+Math.pow(y[j],2));
if (d1>d2 && !used.contains(j))
counter=j;
d2=d1;
}
return counter;
}
public static int foundingMostDistantPointFromPoint(int[] x,int[] y, int index, ArrayList<Integer> used)
{
double d2=-1;
int counter=-1;
for (int j=0; j<x.length;j++) //founds the most distant point
{
double d1= Math.sqrt(Math.pow(x[j]-x[index],2)+Math.pow(y[j]-y[index],2));
if (d1>d2 && !used.contains(j))
{
counter=j;
d2=d1;
}
}
return counter;
}
public static int foundingThirdPoint(int[] x,int[] y, int i1,int i2, ArrayList<Integer> used)
{
double d1,d2=0;
int counter=-1;
for(int j=0; j<x.length;j++)
{
d1=Math.sqrt(Math.pow(x[j]-x[i1],2)+Math.pow(y[j]-y[i1],2))+Math.sqrt(Math.pow(x[j]-x[i2],2)+Math.pow(y[j]-y[i2],2));
if(d1>d2 && !used.contains(j))
{
counter=j;
d2=d1;
}
}
return counter;
}
}