I am writing this code in java. I don’t know why this code is giving me error in this portal while I am running the same code in my system it is executed properly.
import java.util.;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int q = scan.nextInt();
int k = scan.nextInt();
ArrayList a = new ArrayList();
int b = 0;
while(q>0){
int c = scan.nextInt();
if(c == 1){
int x = scan.nextInt();
int y = scan.nextInt();
int value = (xx)+(y*y);
a.add(value);
}else if(c == 2){
Collections.sort(a);
System.out.println(a.get(k-1));
}
q–;
}
}
}