Problem: 2050B - Transfusion
Language: Java 21

Previous submission (verdict: Wrong answer on test 3):
 import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Scanner sc= new Scanner(System.in);
        int t = sc.nextInt();
        for(int i=0;i<t;i++){
            int n = sc.nextInt();
            int ceve = 0;
            int codd = 0;
            int eve = 0;
            int odd = 0;
            for(int j =0;j<n;j++){
                int num = sc.nextInt();
                if(j%2==0){
                    odd = odd + num;
                    codd++;
                } 
                else{
                    eve = eve + num; 
                    ceve++;
                }
            }
            if(eve%ceve == 0 && odd%codd==0){
            int m = eve/ceve;
            int l = odd/codd;
            if(m==l){
                System.out.println("YES");
            }
            else{
                System.out.println("NO");
            }
        }
        else{
            System.out.println("NO");
        }
        }
    }
}
class Scanner {
  StringTokenizer st;
  BufferedReader br;

  public Scanner(InputStream s) {
      br = new BufferedReader(new InputStreamReader(s));
  }

  public Scanner(File s) throws FileNotFoundException {
      br = new BufferedReader(new FileReader(s));
  }

  public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
      return st.nextToken();
  }

  public int nextInt() throws IOException {
      return Integer.parseInt(next());
  }

  public long nextLong() throws IOException {
      return Long.parseLong(next());
  }

  public String nextLine() throws IOException {
      return br.readLine();
  }
  public int[] nextArr(int n) throws IOException {
      int[] a = new int[n];
      for (int i = 0; i < n; i++) {
          a[i] = nextInt();
      }
      return a;
  }

  public double nextDouble() throws IOException {
      String x = next();
      StringBuilder sb = new StringBuilder("0");
      double res = 0, f = 1;
      boolean dec = false, neg = false;
      int start = 0;
      if (x.charAt(0) == '-') {
          neg = true;
          start++;
      }
      for (int i = start; i < x.length(); i++)
          if (x.charAt(i) == '.') {
              res = Long.parseLong(sb.toString());
              sb = new StringBuilder("0");
              dec = true;
          } else {
              sb.append(x.charAt(i));
              if (dec) f *= 10;
          }
      res += Long.parseLong(sb.toString()) / f;
      return res * (neg ? -1 : 1);
  }

  public boolean ready() throws IOException {
      return br.ready();
  }


}
class Pair implements Comparable{
    long a;
    long b;
    public Pair(long a,long b){
        this.a = a;
        this.b = b;
    }
    public int compareTo(Object o) {
        if(((Pair)o).a > a){
            return -1;
        }
        else if(((Pair)o).a < a){
            return 1;
        }
        else{
            if(((Pair)o).b > b){
                return 1;
            }
            else if(((Pair)o).b < b){
                return -1;
            }
            else{
                return 0;
            }

        }
    }
    public String toString(){
        return a + " " + b;
    }
}

Submission (verdict: Accepted):
 import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Scanner sc= new Scanner(System.in);
        int t = sc.nextInt();
        for(int i=0;i<t;i++){
            int n = sc.nextInt();
            long ceve = 0;
            long codd = 0;
            long eve = 0;
            long odd = 0;
            for(int j =0;j<n;j++){
                long num = sc.nextLong();
                if(j%2==0){
                    odd = odd + num;
                    codd++;
                } 
                else{
                    eve = eve + num; 
                    ceve++;
                }
            }
            if(eve%ceve == 0 && odd%codd==0){
            long m = eve/ceve;
            long l = odd/codd;
            if(m==l){
                System.out.println("YES");
            }
            else{
                System.out.println("NO");
            }
        }
        else{
            System.out.println("NO");
        }
        }
    }
}
class Scanner {
  StringTokenizer st;
  BufferedReader br;

  public Scanner(InputStream s) {
      br = new BufferedReader(new InputStreamReader(s));
  }

  public Scanner(File s) throws FileNotFoundException {
      br = new BufferedReader(new FileReader(s));
  }

  public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
      return st.nextToken();
  }

  public int nextInt() throws IOException {
      return Integer.parseInt(next());
  }

  public long nextLong() throws IOException {
      return Long.parseLong(next());
  }

  public String nextLine() throws IOException {
      return br.readLine();
  }
  public int[] nextArr(int n) throws IOException {
      int[] a = new int[n];
      for (int i = 0; i < n; i++) {
          a[i] = nextInt();
      }
      return a;
  }

  public double nextDouble() throws IOException {
      String x = next();
      StringBuilder sb = new StringBuilder("0");
      double res = 0, f = 1;
      boolean dec = false, neg = false;
      int start = 0;
      if (x.charAt(0) == '-') {
          neg = true;
          start++;
      }
      for (int i = start; i < x.length(); i++)
          if (x.charAt(i) == '.') {
              res = Long.parseLong(sb.toString());
              sb = new StringBuilder("0");
              dec = true;
          } else {
              sb.append(x.charAt(i));
              if (dec) f *= 10;
          }
      res += Long.parseLong(sb.toString()) / f;
      return res * (neg ? -1 : 1);
  }

  public boolean ready() throws IOException {
      return br.ready();
  }


}
class Pair implements Comparable{
    long a;
    long b;
    public Pair(long a,long b){
        this.a = a;
        this.b = b;
    }
    public int compareTo(Object o) {
        if(((Pair)o).a > a){
            return -1;
        }
        else if(((Pair)o).a < a){
            return 1;
        }
        else{
            if(((Pair)o).b > b){
                return 1;
            }
            else if(((Pair)o).b < b){
                return -1;
            }
            else{
                return 0;
            }

        }
    }
    public String toString(){
        return a + " " + b;
    }
}