Problem: 2050B - Transfusion
Language: Java 21

Previous submission (verdict: Wrong answer on test 3):
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        List<String> inputs = new ArrayList<>();
        String line;

        int t = Integer.parseInt(reader.readLine());

        while((line = reader.readLine()) != null) {
            inputs.add(line);
        }

        String[] result = new String[t];

        int j = 0;

        for(int i = 0; i < t; i++){
            int n = Integer.parseInt(inputs.get(j));
            String[] strings = inputs.get(j+1).split(" ");
            j += 2;

            int[] data = new int[n];

            for(int k = 0; k < n; k++){
                data[k] = Integer.parseInt(strings[k]);
            }

            result[i] = solution(data);
        }

        for(String r: result){
            System.out.println(r);
        }
    }

    public static String solution(int[] nums){
        int oddT = 0;
        int o = 0;

        int evenT = 0;
        int e = 0;

        for(int i = 0; i < nums.length; i++){
            if(i%2 == 0){
                evenT += nums[i];
                e += 1;
            }
            else{
                oddT += nums[i];
                o += 1;
            }
        }




        if((oddT+evenT) % nums.length != 0){
            return "NO";
        }



        int target = (oddT+evenT)/nums.length;
        boolean ans = oddT/o == target && evenT/e == target;


        if(ans){
            return "YES";
        }
        return "NO";


    }


}


Submission (verdict: Wrong answer on test 3):
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        List<String> inputs = new ArrayList<>();
        String line;

        int t = Integer.parseInt(reader.readLine());

        while((line = reader.readLine()) != null) {
            inputs.add(line);
        }

        String[] result = new String[t];

        int j = 0;

        for(int i = 0; i < t; i++){
            int n = Integer.parseInt(inputs.get(j));
            String[] strings = inputs.get(j+1).split(" ");
            j += 2;

            int[] data = new int[n];

            for(int k = 0; k < n; k++){
                data[k] = Integer.parseInt(strings[k]);
            }

            result[i] = solution(data);
        }

        for(String r: result){
            System.out.println(r);
        }
    }

    public static String solution(int[] nums){
        int oddT = 0;
        int o = 0;

        int evenT = 0;
        int e = 0;

        for(int i = 0; i < nums.length; i++){
            if(i%2 == 0){
                evenT += nums[i];
                e += 1;
            }
            else{
                oddT += nums[i];
                o += 1;
            }
        }

        if((oddT+evenT) % nums.length != 0){
            return "NO";
        }
        
        boolean ans = oddT/o == evenT/e;


        if(ans){
            return "YES";
        }
        return "NO";


    }


}