What is wrong with my solution ?
i thought that Priority_sum_A +Priority_sum_B = N*(N+1)/2 and then Priority_sum_A - Priority_sum_B = M.Using this i got the value of Priority_sum_A = M+ Priority_sum_B and Priority_sum_B = ( N*(N+1)/2 - M)/2. So if Priority_sum_A and Priority_sum_B will have gcd==1 then “yes” else “no”.
…
import java.util.*;

public class Main {

static long gcd(long a,long b){
if(a == 0){
return b;
}
return gcd(b%a,a);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-- > 0){
long n = sc.nextLong();
long m = sc.nextLong();
long sum = (n*(n+1))/2;
if((sum+m) % 2 == 0){
long a = (sum+m)/2;;
long b = sum - a;
if(gcd(a,b) == 1){
System.out.println("Yes");
}else{
System.out.println("No");
}
}else{
System.out.println("No");
}
}
}