ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050C - Uninteresting Number
Language: Java 21

Previous submission (verdict: Runtime error on test 3):
import java.util.*;
public class practice {
    public static boolean unintrestingNumber(String n){
        int count = 0;
        int count2 = 0;
        int count3 = 0;
        if (Long.parseLong(n)%9 == 0){
            return true;
        }
        for(int i = 0; i<n.length();i++){
            String Snum = String.valueOf(n.charAt(i));
            int num = Integer.parseInt(Snum);
            count+=num;
            if (num == 2){
                count2++;
            }
            if (num == 3){
                count3++;
            }
        }
        int newSum = count;
        for (int i = 0; i <= Math.min(9, count2); i++) {
            for (int j = 0; j <= Math.min(9, count3); j++) {
                if ((newSum + i * 2 + j * 6) % 9 == 0) {
                    return true; 
                }
            }
        }
        return false;
    }
    
    public static void main(String[] args){
        Scanner myScan = new Scanner(System.in);
        int testcases = myScan.nextInt();
        for (int i = 0; i<=testcases; i++){
            String test = myScan.nextLine();
            if (!"".equals(test)){
                if(unintrestingNumber(test)){
                    System.out.println("YES");
                }
                else{
                    System.out.println("NO");
                }
            }
        }
    }
}


Submission (verdict: Accepted):
import java.util.*;
public class practice {
    public static boolean unintrestingNumber(String n){
        int count = 0;
        int count2 = 0;
        int count3 = 0;
        for(int i = 0; i<n.length();i++){
            String Snum = String.valueOf(n.charAt(i));
            int num = Integer.parseInt(Snum);
            count+=num;
            if (num == 2){
                count2++;
            }
            if (num == 3){
                count3++;
            }
        }
        int newSum = count;
        for (int i = 0; i <= Math.min(9, count2); i++) {
            for (int j = 0; j <= Math.min(9, count3); j++) {
                if ((newSum + i * 2 + j * 6) % 9 == 0) {
                    return true; 
                }
            }
        }
        return false;
    }
    
    public static void main(String[] args){
        Scanner myScan = new Scanner(System.in);
        int testcases = myScan.nextInt();
        for (int i = 0; i<=testcases; i++){
            String test = myScan.nextLine();
            if (!"".equals(test)){
                if(unintrestingNumber(test)){
                    System.out.println("YES");
                }
                else{
                    System.out.println("NO");
                }
            }
        }
    }
}
Problem: 2050C - Uninteresting Number
Language: Java 21


Submission (verdict: Wrong answer on test 2):
import java.util.*;
public class practice {
    public static boolean unintrestingNumber(String n){
        int count = 0;
        HashMap<Integer,Integer> check = new HashMap<>();
        check.put(2,0);
        check.put(3,0);
        if (Long.parseLong(n)%9 == 0){
            return true;
        }
        for(int i = 0; i<n.length();i++){
            String Snum = String.valueOf(n.charAt(i));
            int num = Integer.parseInt(Snum);
            count+=num;
            if (check.containsKey(num)){
                check.put(num,check.get(num)+1);
            }
        }
        int newSum = count;
        int count2 = 1;
        while (newSum%9!=0){
            if (check.get(2)>0&& count2%3!=0){
                newSum+=2;
                check.put(2,check.get(2)-1);
                count2 ++;
            }
            else if (count2 %3 == 0 && check.get(3)>0 && check.get(2)>0){
                check.put(3,check.get(3)-1);
                newSum+=2;
                count2 = 1;
                check.put(2,check.get(2)+2);
            }
            else if (check.get(3)<=0 && check.get(2)>0){
                newSum+=2;
                check.put(2,check.get(2)-1);
            }
            else if (check.get(3)>0 && check.get(2)<=0){
                newSum+=6;
                check.put(3,check.get(3)-1);
            }
            else{
                break;
            }

        } 
        return newSum%9==0;   
    }
    
    public static void main(String[] args){
        Scanner myScan = new Scanner(System.in);
        int testcases = myScan.nextInt();
        for (int i = 0; i<=testcases; i++){
            String test = myScan.nextLine();
            if (!"".equals(test)){
                if(unintrestingNumber(test)){
                    System.out.println("YES");
                }
                else{
                    System.out.println("NO");
                }
            }
        }
    }
}
Problem: 2057B - Gorilla and the Exam
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int t;
    cin>>t;
        while(t--){
           int n, k;
           cin>>n>>k;
           vector<int> a(n);
           map<int, int> m;

           for(int i=0;i<n;i++){
            cin>>a[i];
            m[a[i]]++;
           }
           int uc = 0;
           for(auto x:m){
           
            if(x.second<=k){
                k = k-x.second;
            }
            else uc++;
           }
           
           cout<<max(1, uc)<<endl;
           
           
           
    }
       
        // sort(a.begin(), a.end());

    
}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int t;
    cin>>t;
        while(t--){
           int n, k;
           cin>>n>>k;
           vector<long long> a(n);
           map<long long, int> m;

           for(int i=0;i<n;i++){
            cin>>a[i];
            m[a[i]]++;
           }
           int uc = 0;
           for(auto x:m){
            if(x.second<=k){
                k = k-x.second;
            }
            else uc++;
           }
           
           cout<<max(1, uc)<<endl;
           
           
           
    }
       
        // sort(a.begin(), a.end());

    
}
Problem: 2057B - Gorilla and the Exam
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int t;
    cin>>t;
        while(t--){
           int n, k;
           cin>>n>>k;
           vector<long long> a(n);
           map<long long, int> m;

           for(int i=0;i<n;i++){
            cin>>a[i];
            m[a[i]]++;
           }
           int uc = 0;
           for(auto x:m){
            if(x.second<=k){
                k = k-x.second;
            }
            else uc++;
           }
           
           cout<<max(1, uc)<<endl;
           
           
           
    }
       
        // sort(a.begin(), a.end());

    
}

Submission (verdict: Accepted):
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int t;
    cin>>t;
        while(t--){
           int n, k;
           cin>>n>>k;
           vector<long long> a(n);
           map<long long, int> m;

           for(int i=0;i<n;i++){
            cin>>a[i];
            m[a[i]]++;
           }
           int uc = 0;
           vector<int> cnt;
           for(auto x:m){
            cnt.push_back(x.second); 
           }
           sort(cnt.begin(), cnt.end());
           for(int i=0;i<cnt.size();i++){
                if(cnt[i]<=k){
                    // cnt++;
                    k = k-cnt[i];
                }
                else uc++;
           }

           cout<<max(1, uc)<<endl;
           
           
           
    }
       
        // sort(a.begin(), a.end());

    
}
Problem: 2057B - Gorilla and the Exam
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int t;
    cin>>t;
        while(t--){
           int n, k;
           cin>>n>>k;
           vector<int> a(n);
           map<int, int> m;

           for(int i=0;i<n;i++){
            cin>>a[i];
            m[a[i]]++;
           }
           int uc = 0;
           for(auto x:m){
           
            if(x.second<=k){
                k = k-x.second;
            }
            else uc++;
           }
           
           cout<<max(1, uc)<<endl;
           
           
           
    }
       
        // sort(a.begin(), a.end());

    
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)

Previous submission (verdict: Time limit exceeded on test 6):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long int

typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> mset;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

vector<vector<int>> dp(2005,vector<int>(2005,-1));

int solve(string &a, string &b, string &c, int aa, int bb, int ptr){
    if(ptr >= c.size()) return 0;
    if(dp[aa][bb] != -1) return dp[aa][bb];
    int ans1 = aa < a.size() ? solve(a,b,c,aa+1,bb,ptr+1) + ( c[ptr] == a[aa] ? 0 : 1) : INT_MAX;
    int ans2 = bb < b.size() ? solve(a,b,c,aa,bb+1,ptr+1) + ( c[ptr] == b[bb] ? 0 : 1) : INT_MAX;
    return min(ans1,ans2);
}

void solve(){
    string a,b,c; cin>>a>>b>>c;
    for(int i=0;i<2005;++i){
        for(int j=0;j<2005;++j){
            dp[i][j] = -1;
        }
    }
    int ans = solve(a,b,c,0,0,0); cout<<ans<<"\n";
}

signed main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t; cin>>t;
    while(t--) solve();
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long int

typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> mset;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

vector<vector<int>> dp(2005,vector<int>(2005,-1));

int solve(string &a, string &b, string &c, int aa, int bb, int ptr){
    if(ptr >= c.size()) return 0;
    if(dp[aa][bb] != -1) return dp[aa][bb];
    int ans1 = aa < a.size() ? solve(a,b,c,aa+1,bb,ptr+1) + ( c[ptr] == a[aa] ? 0 : 1) : INT_MAX;
    int ans2 = bb < b.size() ? solve(a,b,c,aa,bb+1,ptr+1) + ( c[ptr] == b[bb] ? 0 : 1) : INT_MAX;
    return dp[aa][bb] = min(ans1,ans2);
}

void solve(){
    string a,b,c; cin>>a>>b>>c;
    for(int i=0;i<2005;++i){
        for(int j=0;j<2005;++j){
            dp[i][j] = -1;
        }
    }
    int ans = solve(a,b,c,0,0,0); cout<<ans<<"\n";
}

signed main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t; cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long int

typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> mset;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

vector<vector<int>> dp(2005,vector<int>(2005,-1));

int solve(string &a, string &b, string &c, int aa, int bb, int ptr){
    if(ptr >= c.size()) return 0;
    if(dp[aa][bb] != -1) return dp[aa][bb];
    int ans1 = solve(a,b,c,aa+1,bb,ptr+1) + ( c[ptr] == a[aa] ? 0 : 1);
    int ans2 = solve(a,b,c,aa,bb+1,ptr+1) + ( c[ptr] == b[bb] ? 0 : 1);
    return min(ans1,ans2);
}

void solve(){
    string a,b,c; cin>>a>>b>>c;
    for(int i=0;i<2005;++i){
        for(int j=0;j<2005;++j){
            dp[i][j] = -1;
        }
    }
    int ans = solve(a,b,c,0,0,0); cout<<ans<<"\n";
}

signed main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t; cin>>t;
    while(t--) solve();
    return 0;
}

Submission (verdict: Time limit exceeded on test 6):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long int

typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> mset;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

vector<vector<int>> dp(2005,vector<int>(2005,-1));

int solve(string &a, string &b, string &c, int aa, int bb, int ptr){
    if(ptr >= c.size()) return 0;
    if(dp[aa][bb] != -1) return dp[aa][bb];
    int ans1 = aa < a.size() ? solve(a,b,c,aa+1,bb,ptr+1) + ( c[ptr] == a[aa] ? 0 : 1) : INT_MAX;
    int ans2 = bb < b.size() ? solve(a,b,c,aa,bb+1,ptr+1) + ( c[ptr] == b[bb] ? 0 : 1) : INT_MAX;
    return min(ans1,ans2);
}

void solve(){
    string a,b,c; cin>>a>>b>>c;
    for(int i=0;i<2005;++i){
        for(int j=0;j<2005;++j){
            dp[i][j] = -1;
        }
    }
    int ans = solve(a,b,c,0,0,0); cout<<ans<<"\n";
}

signed main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t; cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long int

typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> mset;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

vector<vector<int>> dp(2005,vector<int>(2005,-1));

int solve(string &a, string &b, string &c, int aa, int bb, int ptr){
    if(ptr >= c.size()) return 0;
    if(dp[aa][bb] != -1) return dp[aa][bb];
    int ans1 = solve(a,b,c,aa+1,bb,ptr+1) + ( c[ptr] == a[aa] ? 0 : 1);
    int ans2 = solve(a,b,c,aa,bb+1,ptr+1) + ( c[ptr] == b[bb] ? 0 : 1);
    return min(ans1,ans2);
}

void solve(){
    string a,b,c; cin>>a>>b>>c;
    for(int i=0;i<2005;++i){
        for(int j=0;j<2005;++j){
            dp[i][j] = -1;
        }
    }
    int ans = solve(a,b,c,0,0,0); cout<<ans<<"\n";
}

signed main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t; cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 12):
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    int t; 
    cin >> t;
    while(t--){
        int n; 
        cin >> n;
        // n vertices; el árbol tiene n-1 aristas.
        vector<vector<int>> adj(n+1);
        vector<int> deg(n+1,0);
        vector<pair<int,int>> edges;
 
        for (int i = 1; i <= n-1; i++){
            int u, v;
            cin >> u >> v;
            // Agregamos la arista en ambos sentidos.
            adj[u].push_back(v);
            adj[v].push_back(u);
            deg[u]++;
            deg[v]++;
            edges.push_back({u,v});
        }
 
        // Para cada vértice, ordenamos su lista de vecinos para poder hacer búsqueda binaria.
        for (int i = 1; i <= n; i++){
            sort(adj[i].begin(), adj[i].end());
        }
 
        // --- Caso 1: pares adyacentes ---
        // Para cada arista (u,v), la cantidad de componentes si se remueven u y v es:
        // deg(u) + deg(v) - 2.
        int bestAdj = -1;
        for(auto &e : edges){
            int u = e.first, v = e.second;
            int cand = deg[u] + deg[v] - 2;
            bestAdj = max(bestAdj, cand);
        }
 
        // --- Caso 2: pares NO adyacentes ---
        // Queremos maximizar (deg(u)+deg(v)-1) entre pares no adyacentes.
        // Primero, buscaremos la máxima suma deg(u)+deg(v) entre pares no adyacentes.
        int bestNonAdjSum = -1;
 
        // Creamos un vector con (grado, vértice) para ordenar por grado descendiente.
        vector<pair<int,int>> degList;
        degList.reserve(n);
        for (int i = 1; i <= n; i++){
            degList.push_back({deg[i], i});
        }
        sort(degList.begin(), degList.end(), [](auto &a, auto &b){
            return a.first > b.first;
        });
 
        // Usamos solo los primeros X vértices; X lo elegimos pequeño (por ejemplo, 1000) para que
        // la doble iteración sea eficiente.
        int X = min(n, 1000);
        for (int i = 0; i < X; i++){
            for (int j = i+1; j < X; j++){
                int u = degList[i].second;
                int v = degList[j].second;
                // Si u y v son adyacentes, los saltamos.
                if(binary_search(adj[u].begin(), adj[u].end(), v))
                    continue;
                int sum = deg[u] + deg[v];
                bestNonAdjSum = max(bestNonAdjSum, sum);
            }
        }
 
        // Si encontramos algún par no adyacente, su "valor" es (suma - 1).
        int candNonAdj = (bestNonAdjSum == -1 ? -1 : bestNonAdjSum - 1);
 
        // La respuesta final es el máximo entre la opción con vértices adyacentes y no adyacentes.
        int ans = max(bestAdj, candNonAdj);
        cout << ans << "\n";
    }
    return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 6):
#include <bits/stdc++.h>
using namespace std;

#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef unordered_map<ll, ll> umpl;
typedef unordered_map<int, int> umpi;
typedef map<ll, ll> mpl;
typedef map<int, int> mpi;
typedef priority_queue<ll> pql;
typedef priority_queue<int> pqi;
typedef priority_queue<ll, vector<ll>, greater<ll>> minpql;
typedef priority_queue<int, vector<int>, greater<int>> minpqi;
typedef stack<ll> stl;
typedef stack<int> sti;
const ll mod = 1'000'000'007;
const ll N = 3e5, M = N;
vpii dir = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
vpii dir1 = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {1, 1}, {-1, -1}, {1, -1}, {-1, 1}};
//=======================

vi g[N];

int f(string &a, string &b, string &c, int i, int j, int k)
{
    if(k<0)
    {
        return 0;
    }
    // taking a-
    int takinga=0;
    if(i>=0)
    {
        if(a[i]!=c[k]){
            takinga++;
        }
        takinga += f(a,b,c, i-1, j, k-1);
    }
    else
    {
        takinga=INT_MAX;
    }
    
    int takingb=0;
    if(j>=0)
    {
        if(b[j]!=c[k]){
            takingb++;
        }
        takingb += f(a,b,c, i, j-1, k-1);
    }
    else
    {
        takingb=INT_MAX;
    }
    
    return min(takinga, takingb);
}
void solve()
{
    ll n, i, k, m, j;
    string a,b,c;
    cin>>a>>b>>c;
    cout<<f(a,b,c,a.length()-1, b.length()-1, c.length()-1)<<endl;
    return;
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    ll t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef unordered_map<ll, ll> umpl;
typedef unordered_map<int, int> umpi;
typedef map<ll, ll> mpl;
typedef map<int, int> mpi;
typedef priority_queue<ll> pql;
typedef priority_queue<int> pqi;
typedef priority_queue<ll, vector<ll>, greater<ll>> minpql;
typedef priority_queue<int, vector<int>, greater<int>> minpqi;
typedef stack<ll> stl;
typedef stack<int> sti;
const ll mod = 1'000'000'007;
const ll N = 3e5, M = N;
vpii dir = {{1,0},{-1,0},{0,1},{0,-1}};
vpii dir1 = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{-1,-1},{1,-1},{-1,1}};
//=======================

vi g[N];

void solve()
{
    ll n, i, j, k, q;
    cin>>n;
    vl a(n);
    ll sum1=0;
    fo(i,n)
    {
        cin>>a[i];
        sum1+=a[i];
    }
    if(a.size()==1)
    {
        cout<<a[0]<<endl;
        return;
    }
    ll ans=sum1;
    while (a.size()>1)
    {
        // cout<<1<<endl;
        ll sum=0;
        for(auto it : a)
        {
            sum+=it;
        }
        sum=abs(sum);
        max(ans, sum);
        vl b;
        fo(j, a.size()-1)
        {
            b.push_back(a[j+1]-a[j]);
        }
        a=b;
    }   
    ans=max(ans, abs(a[0]));
    cout<<ans<<endl;
    
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    ll t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    // solve();
    return 0;
}