ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

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

using namespace std;

#define int long long

void solve() {

    int n, m;

    cin >> n >> m;

    multiset<int> st;

    unordered_map<int, int> mp;

    for (int i = 0; i < n; ++i) {

        int a;

        cin >> a;

        st.insert(a);

    }

    for (int i = 0; i < m; ++i) {

        int a;

        cin >> a;

        ++mp[a];

    }

    for (int i = 0; i < n; ++i) {

        int a = *st.begin();

        st.erase(st.begin());

        if (mp.count(a)) {

            --mp[a];

            if (mp[a] == 0)

                mp.erase(a);

        } else {

            if (st.empty())

                return void(cout << "NO\n");

            int b = *st.begin();

            st.erase(st.begin());

            if (b - a > 1)

                return void(cout << "NO\n");

            st.insert(a + b);

        }

    }

    if (st.size()) {

        cout << "NO\n";

    } else {

        cout << "YES\n";

    }

}



int32_t main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t;

    cin >> t;

    while (t--)

        solve();



    return 0;

}



Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>

using namespace std;

#define int long long

void solve() {

    int n, m;

    cin >> n >> m;

    multiset<int> st;

    unordered_map<int, int> mp;

    for (int i = 0; i < n; ++i) {

        int a;

        cin >> a;

        st.insert(a);

    }

    for (int i = 0; i < m; ++i) {

        int a;

        cin >> a;

        ++mp[a];

    }

    for (int i = 0; i < n; ++i) {

        int a = *st.begin();

        st.erase(st.begin());

        if (mp.count(a)) {

            --mp[a];

            if (mp[a] == 0)

                mp.erase(a);

        } else {

            if (st.empty())

                return void(cout << "NO\n");

            int b = *st.begin();

            st.erase(st.begin());

            if (b - a > 1)

                return void(cout << "NO\n");

            st.insert(a + b);

        }

    }

    if (st.size() || mp.size()) {

        cout << "NO\n";

    } else {

        cout << "YES\n";

    }

}



int32_t main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t;

    cin >> t;

    while (t--)

        solve();



    return 0;

}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>

using namespace std;

#define int long long

void solve() {

    int n, m;

    cin >> n >> m;

    multiset<int> st;

    unordered_map<int, int> mp;

    for (int i = 0; i < n; ++i) {

        int a;

        cin >> a;

        st.insert(a);

    }

    for (int i = 0; i < m; ++i) {

        int a;

        cin >> a;

        ++mp[a];

    }

    for (int i = 0; i < n; ++i) {

        int a = *st.begin();

        st.erase(st.begin());

        if (mp.count(a)) {

            --mp[a];

            if (mp[a] == 0)

                mp.erase(a);

        } else {

            if (st.empty())

                return void(cout << "NO\n");

            int b = *st.begin();

            st.erase(st.begin());

            if (b - a > 1)

                return void(cout << "NO\n");

            st.insert(a + b);

        }

    }

    if (st.size() || mp.size()) {

        cout << "NO\n";

    } else {

        cout << "YES\n";

    }

}



int32_t main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t;

    cin >> t;

    while (t--)

        solve();



    return 0;

}



Submission (verdict: Accepted):
#include <bits/stdc++.h>

using namespace std;

#define int long long

void solve() {

    int n, m;

    cin >> n >> m;

    multiset<int> a, b;

    for (int i = 0; i < n; ++i) {

        int x;

        cin >> x;

        a.insert(x);

    }

    for (int i = 0; i < m; ++i) {

        int x;

        cin >> x;

        b.insert(x);

    }

    while (!a.empty()) {

        if (b.empty() || b.size() > a.size()) {

            return void(cout << "NO\n");

        }

        int x = *b.rbegin();

        b.erase(prev(b.end()));

        if (x < *a.rbegin()) {

            return void(cout << "NO\n");

        }

        if (x == *a.rbegin()) {

            a.erase(prev(a.end()));

        } else {

            b.insert(x / 2), b.insert((x + 1) / 2);

        }

    }

    if (b.size()) {

        cout << "NO\n";

    } else

        cout << "YES\n";

}



int32_t main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t;

    cin >> t;

    while (t--)

        solve();



    return 0;

}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)


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

using namespace std;

#define int long long

void solve() {

    int n, m;

    cin >> n >> m;

    multiset<int> st;

    unordered_map<int, int> mp;

    for (int i = 0; i < n; ++i) {

        int a;

        cin >> a;

        st.insert(a);

    }

    for (int i = 0; i < m; ++i) {

        int a;

        cin >> a;

        ++mp[a];

    }

    for (int i = 0; i < n; ++i) {

        int a = *st.begin();

        st.erase(st.begin());

        if (mp.count(a)) {

            --mp[a];

            if (mp[a] == 0)

                mp.erase(a);

        } else {

            if (st.empty())

                return void(cout << "NO\n");

            int b = *st.begin();

            st.erase(st.begin());

            if (b - a > 1)

                return void(cout << "NO\n");

            st.insert(a + b);

        }

    }

    if (st.size()) {

        cout << "NO\n";

    } else {

        cout << "YES\n";

    }

}



int32_t main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t;

    cin >> t;

    while (t--)

        solve();



    return 0;

}
Problem: 2057C - Trip to the Olympiad
Language: Java 8


Submission (verdict: Wrong answer on test 2):
import java.util.*;

public class C{
    public static boolean powerOf2(int n){
        int a = 1;
        while(a<n) a = a*2;
        if(a==n) return true;
        return false;
    }
    public static void main(String...args){
        Scanner sc = new Scanner(System.in);

        int t = sc.nextInt();
        while(t>0){
            t--;

            int l = sc.nextInt();
            int r = sc.nextInt();

            int mid = 0;
            boolean smallerThanr = false, greaterThanl = false;

            int start = 30;
            for(int i=30; i>=0; i--){
                int rbit = (((1<<i)&r)>>i);
                if(rbit==1){
                    start = i;
                    break;
                }
            }

            if(powerOf2(r)){
                mid = 0;
            }
            else if(powerOf2(l+1)){
                mid += 1<<start;
            }
            else{
                start = 30;
            }

            for(int i=start; i>=0; i--){
                int lbit = (((1<<i)&l)>>i);
                int rbit = (((1<<i)&r)>>i);
                int mBit = 0;

                if(lbit==1 && rbit == 1 ){
                    if(!smallerThanr){
                        mBit = 1;
                    } // else 0
                }
                else if(lbit == 0 && rbit == 0){
                    if(!smallerThanr){
                        mBit = 0;
                    }
                    else if(!greaterThanl){
                        mBit = 1;
                    } //else 0
                }
                else if(lbit == 0 && rbit == 1){
                    if(!smallerThanr){
                        mBit = 0;
                        smallerThanr = true;
                    }
                    else if(!greaterThanl){
                        mBit = 1;
                        greaterThanl = true;
                    }
                }
                else{ // lbit == 1 && rbit == 0
                    if(!greaterThanl){
                        mBit = 1;
                    }
                }

                mid += (mBit<<i);
            }

            System.out.println(l + " " + mid + " " + r);
        }
    }
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 8):
#include <bits/stdc++.h>

using namespace std;
using vi = vector<int>;

void solve() {
    int n, l, r;
    cin >> n >> l >> r;
    l--;
    
    vi arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    
    vi brr = arr;
    sort(brr.begin() + l, brr.end());
    
    vi crr = arr;
    sort(crr.begin(), crr.begin() + r, greater<int>());
    
    int sum_brr = accumulate(brr.begin() + l, brr.begin() + r, 0);
    int sum_crr = accumulate(crr.begin() + l, crr.begin() + r, 0);
    
    cout << min(sum_brr, sum_crr) << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--) solve();
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>

using namespace std;
using vi = vector<int>;
using ll = long long;

void solve() {
    int n, l, r;
    cin >> n >> l >> r;
    l--;
    
    vi arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    
    vi brr = arr;
    sort(brr.begin() + l, brr.end());
    
    vi crr = arr;
    sort(crr.begin(), crr.begin() + r, greater<int>());
    
    ll sum_brr = accumulate(brr.begin() + l, brr.begin() + r, 0LL);
    ll sum_crr = accumulate(crr.begin() + l, crr.begin() + r, 0LL);
    
    cout << min(sum_brr, sum_crr) << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--) solve();
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 8):
#include <bits/stdc++.h>

using namespace std;
using vi = vector<int>;

void solve() {
    int n, l, r;
    cin >> n >> l >> r;
    l--;
    
    vi arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    
    vi brr = arr;
    sort(brr.begin() + l, brr.end());
    
    vi crr = arr;
    sort(crr.begin(), crr.begin() + r, greater<int>());
    
    int sum_brr = 0, sum_crr = 0;
    for (int i = l; i < r; ++i) {
        sum_brr += brr[i];
        sum_crr += crr[i];
    }
    
    cout << min(sum_brr, sum_crr) << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--) solve();
}


Submission (verdict: Wrong answer on test 8):
#include <bits/stdc++.h>

using namespace std;
using vi = vector<int>;

void solve() {
    int n, l, r;
    cin >> n >> l >> r;
    l--;
    
    vi arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    
    vi brr = arr;
    sort(brr.begin() + l, brr.end());
    
    vi crr = arr;
    sort(crr.begin(), crr.begin() + r, greater<int>());
    
    int sum_brr = accumulate(brr.begin() + l, brr.begin() + r, 0);
    int sum_crr = accumulate(crr.begin() + l, crr.begin() + r, 0);
    
    cout << min(sum_brr, sum_crr) << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--) solve();
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 8):
#include <bits/stdc++.h>

using namespace std;
using vi = vector<int>;

void solve() {
    int n, l, r;
    cin >> n >> l >> r;
    l--;
    
    vi arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    
    vi brr = arr;
    sort(brr.begin() + l, brr.end());
    
    vi crr = arr;
    sort(crr.begin(), crr.begin() + r, greater<int>());
    
    int sum_brr = 0, sum_crr = 0;
    for (int i = l; i < r; ++i) {
        sum_brr += brr[i];
        sum_crr += crr[i];
    }
    
    cout << min(sum_brr, sum_crr) << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--) solve();
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)


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

#define ll long long 
#define ld long double
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))

const int M = 1000000007;
const int mod = 998244353;

typedef pair<int, int>  pi;
typedef pair<ll, ll>    pl;
typedef vector<int>     vi;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef vector<ll>      vl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
typedef vector<vc>      vvc;
typedef vector<vs>      vvs;
typedef vector<pi>      vpi;
typedef vector<pl>      vpl;
void solve() {
    string s;cin>>s;
    int n = s.size();
    vs dp(n);
    dp[0]=s.substr(0,1);
    // cout<<dp[0]<<"\n";

    for(int i=1;i<n;i++){
        string str= dp[i-1];
        int n2 = str.size();

        int num1 = s[i]-'0';
        int idx =max(0,n2-num1+1);
        int itr =num1-(n2-idx);
        string ans=str+s[i];
        for(int j = idx;j<n2;j++){
            if(itr >(str[j]-'0')){
                ans = str.substr(0,j)+to_string(itr)+str.substr(j);
                break;
            }
            itr++;
        }
        dp[i]=ans;
        // cout<<dp[i-1]<<" ";
    }
    cout<<dp[n-1]<<"\n";

    // cout<<"\n";



 

}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin >> t;   
    while(t--) solve();
    return 0;
}


// 1 2
// 1 1 2 2
// 4 5 5 1 1 2 2 3
// 1 8 2 2 1 3 3 9 1 1
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

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

#define ll long long 
#define ld long double
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))

const int M = 1000000007;
const int mod = 998244353;

typedef pair<int, int>  pi;
typedef pair<ll, ll>    pl;
typedef vector<int>     vi;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef vector<ll>      vl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
typedef vector<vc>      vvc;
typedef vector<vs>      vvs;
typedef vector<pi>      vpi;
typedef vector<pl>      vpl;
void solve() {
    string s;cin>>s;
    int n = s.size();
    string prv = s.substr(0,1);

    for(int i=1;i<n;i++){
        string str= prv;
        int n2 = str.size();

        int num1 = s[i]-'0';
        int idx =max(0,n2-num1+1);
        int itr =num1-(n2-idx);
        string ans=str+s[i];
        for(int j = idx;j<n2;j++){
            if(itr >(str[j]-'0')){
                ans = str.substr(0,j)+to_string(itr)+str.substr(j);
                break;
            }
            itr++;
        }
        prv=ans;
    }
    cout<<prv<<"\n";



 

}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin >> t;   
    while(t--) solve();
    return 0;
}


// 1 2
// 1 1 2 2
// 4 5 5 1 1 2 2 3
// 1 8 2 2 1 3 3 9 1 1


Submission (verdict: Accepted):
#include<bits/stdc++.h> 
using namespace std;

#define ll long long 
#define ld long double
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))

const int M = 1000000007;
const int mod = 998244353;

typedef pair<int, int>  pi;
typedef pair<ll, ll>    pl;
typedef vector<int>     vi;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef vector<ll>      vl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
typedef vector<vc>      vvc;
typedef vector<vs>      vvs;
typedef vector<pi>      vpi;
typedef vector<pl>      vpl;
void solve() {
    string s;cin>>s;
    int n = s.size();
    string str = s.substr(0,1);
    for(int i=1;i<n;i++){
        // string str= prv;
        // cout<<str<<" ";
        str+=s[i];
        int j = str.size()-1;
        while(j>0 && str[j]-1>str[j-1]){
            str[j]--;
            swap(str[j],str[j-1]);
            j--;
        }
        
    }
    cout<<str<<"\n";
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin >> t;   
    while(t--) solve();
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

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

#define ll long long 
#define ld long double
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))

const int M = 1000000007;
const int mod = 998244353;

typedef pair<int, int>  pi;
typedef pair<ll, ll>    pl;
typedef vector<int>     vi;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef vector<ll>      vl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
typedef vector<vc>      vvc;
typedef vector<vs>      vvs;
typedef vector<pi>      vpi;
typedef vector<pl>      vpl;
void solve() {
    string s;cin>>s;
    int n = s.size();
    vs dp(n);
    dp[0]=s.substr(0,1);
    // cout<<dp[0]<<"\n";

    for(int i=1;i<n;i++){
        string str= dp[i-1];
        int n2 = str.size();

        int num1 = s[i]-'0';
        int idx =max(0,n2-num1+1);
        int itr =num1-(n2-idx);
        string ans=str+s[i];
        for(int j = idx;j<n2;j++){
            if(itr >(str[j]-'0')){
                ans = str.substr(0,j)+to_string(itr)+str.substr(j);
                break;
            }
            itr++;
        }
        dp[i]=ans;
        // cout<<dp[i-1]<<" ";
    }
    cout<<dp[n-1]<<"\n";

    // cout<<"\n";



 

}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin >> t;   
    while(t--) solve();
    return 0;
}


// 1 2
// 1 1 2 2
// 4 5 5 1 1 2 2 3
// 1 8 2 2 1 3 3 9 1 1


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

#define ll long long 
#define ld long double
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))

const int M = 1000000007;
const int mod = 998244353;

typedef pair<int, int>  pi;
typedef pair<ll, ll>    pl;
typedef vector<int>     vi;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef vector<ll>      vl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
typedef vector<vc>      vvc;
typedef vector<vs>      vvs;
typedef vector<pi>      vpi;
typedef vector<pl>      vpl;
void solve() {
    string s;cin>>s;
    int n = s.size();
    string prv = s.substr(0,1);

    for(int i=1;i<n;i++){
        string str= prv;
        int n2 = str.size();

        int num1 = s[i]-'0';
        int idx =max(0,n2-num1+1);
        int itr =num1-(n2-idx);
        string ans=str+s[i];
        for(int j = idx;j<n2;j++){
            if(itr >(str[j]-'0')){
                ans = str.substr(0,j)+to_string(itr)+str.substr(j);
                break;
            }
            itr++;
        }
        prv=ans;
    }
    cout<<prv<<"\n";



 

}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin >> t;   
    while(t--) solve();
    return 0;
}


// 1 2
// 1 1 2 2
// 4 5 5 1 1 2 2 3
// 1 8 2 2 1 3 3 9 1 1
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

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

#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<long long>
#define vpii vector<pii>
#define F first
#define S second
#define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MOD = 1e9 + 7;
const int INF = 1e9;

void solve() {

    ll n;
    cin>>n;


    ll two = 0;
    ll thr = 0;
    ll sum=0;

    while(n!=0){
        ll k = n%10;
        sum+=k;
        if(k==2) two++;
        if(k==3) thr++;
        n/=10;
    }

    // cout<<sum<<" ";
    

        int rem = 9 - sum%9;

        // cout<<rem<<" ";

        for(int i=0 ; i<=two ; i++){
            for(int j=0 ; j<=thr ; j++){
                if((sum + i*2 + j*6)%9==0){
                    cout<<"YES"<<endl;
                    return;
                }
            }
        }

        cout<<"NO"<<endl;

    

    
}

int main() {
    fast_io;

    int t;
    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}

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

#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<long long>
#define vpii vector<pii>
#define F first
#define S second
#define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MOD = 1e9 + 7;
const int INF = 1e9;

void solve() {

    ll n;
    cin>>n;


    ll two = 0;
    ll thr = 0;
    ll sum=0;

    while(n!=0){
        ll k = n%10;
        sum+=k;
        if(k==2) two++;
        if(k==3) thr++;
        n/=10;
    }

        for(ll i=0 ; i<=two ; i++){
            for(ll j=0 ; j<=thr ; j++){
                if((sum + i*2 + j*6)%9==0){
                    cout<<"YES"<<endl;
                    return;
                }
            }
        }

        cout<<"NO"<<endl;

    

    
}

int main() {
    fast_io;

    int t;
    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


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

#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<long long>
#define vpii vector<pii>
#define F first
#define S second
#define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MOD = 1e9 + 7;
const int INF = 1e9;

void solve() {

    ll n;
    cin>>n;


    ll two = 0;
    ll thr = 0;
    ll sum=0;

    while(n!=0){
        ll k = n%10;
        sum+=k;
        if(k==2) two++;
        if(k==3) thr++;
        n/=10;
    }

    // cout<<sum<<" ";
    

        int rem = 9 - sum%9;

        // cout<<rem<<" ";

        for(int i=0 ; i<=two ; i++){
            for(int j=0 ; j<=thr ; j++){
                if((sum + i*2 + j*6)%9==0){
                    cout<<"YES"<<endl;
                    return;
                }
            }
        }

        cout<<"NO"<<endl;

    

    
}

int main() {
    fast_io;

    int t;
    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}