ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057B - Gorilla and the Exam
Language: C++17 (GCC 7-32)

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


void solver() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int input; cin >> input;
    while(input--) {
        int n, k; cin >> n >> k;
        unordered_map<int, int> map;
        int num;
        for(int i = 0; i < n; i++) {
            cin >> num;
            map[num]++;
        }

        vector<int> vec;
        for(auto ele: map) vec.push_back(ele.second);
        sort(vec.begin(), vec.end());

        int passes = vec.size();

        for(int i = 0; k > 0 && i < vec.size() - 1; i++) {
            if(k >= vec[i]) {
                k -= vec[i];
                vec[i] = 0;
                passes--;
            }
            else break;
        }

        cout << passes << "\n";
    }
}


int main(){

    solver();
;
}


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


void solver() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int input; cin >> input;
    while(input--) {
        int n, k; cin >> n >> k;
        map<int, int> map;
        int num;
        for(int i = 0; i < n; i++) {
            cin >> num;
            map[num]++;
        }

        vector<int> vec;
        for(auto ele: map) vec.push_back(ele.second);
        sort(vec.begin(), vec.end());

        int passes = vec.size();

        for(int i = 0; k > 0 && i < vec.size() - 1; i++) {
            int temp = min(vec[i], k);
            vec[i] -= temp;
            k -= temp;
            if(vec[i] == 0) passes--;
        }

        cout << passes << "\n";
    }
}


int main(){

    solver();

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

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


void solver() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int input; cin >> input;
    while(input--) {
        int n, k; cin >> n >> k;
        unordered_map<int, int> map;
        int num;
        for(int i = 0; i < n; i++) {
            cin >> num;
            map[num]++;
        }

        vector<int> vec;
        for(auto ele: map) vec.push_back(ele.second);
        sort(vec.begin(), vec.end());

        for(int i = 0; k > 0 && i < vec.size() - 1; i++) {
            int temp = min(vec[i], k);
            vec[i] -= temp;
            k -= temp;
            vec[vec.size() - 1] += temp;
        }

        int passes = 0;
        for(int i = 0; i < vec.size() - 1; i++) passes += (vec[i] > 0);
        cout << passes + 1 << "\n";
    }
}


int main(){

    solver();

}


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


void solver() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int input; cin >> input;
    while(input--) {
        int n, k; cin >> n >> k;
        unordered_map<int, int> map;
        int num;
        for(int i = 0; i < n; i++) {
            cin >> num;
            map[num]++;
        }

        vector<int> vec;
        for(auto ele: map) vec.push_back(ele.second);
        sort(vec.begin(), vec.end());

        int passes = vec.size();

        for(int i = 0; k > 0 && i < vec.size() - 1; i++) {
            int temp = min(vec[i], k);
            vec[i] -= temp;
            k -= temp;
            if(vec[i] == 0) passes--;
        }

        cout << passes << "\n";
    }
}


int main(){

    solver();

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


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


void solver() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int input; cin >> input;
    while(input--) {
        int n, k; cin >> n >> k;
        unordered_map<int, int> map;
        int num;
        for(int i = 0; i < n; i++) {
            cin >> num;
            map[num]++;
        }

        vector<int> vec;
        for(auto ele: map) vec.push_back(ele.second);
        sort(vec.begin(), vec.end());

        for(int i = 0; k > 0 && i < vec.size() - 1; i++) {
            int temp = min(vec[i], k);
            vec[i] -= temp;
            k -= temp;
            vec[vec.size() - 1] += temp;
        }

        int passes = 0;
        for(int i = 0; i < vec.size() - 1; i++) passes += (vec[i] > 0);
        cout << passes + 1 << "\n";
    }
}


int main(){

    solver();

}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 7):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    int a[n],b[n];
    int ans=0;
    vector<pair<int,int>> v;
    for (int i=0;i<n;i++) {cin>>b[i];a[i]=i+1;}
    for (int i=n-1;i>-1;i--) {
        for (int j=n-1;j>0;j--) {
            int temp=a[j];
            a[j]=a[j-1];
            a[j-1]=temp;
            v.push_back(make_pair(a[j-1],a[j]));
            ans++;
            bool t=true;
            for (int k=0;k<n;k++) if (a[k]!=b[k]) t=false;
            if (t) {
                j=0;i=0;
            }
        }
    }
    cout<<ans<<endl;
    for (int i=0;i<v.size();i++) {
        cout<<v[i].first<<" "<<v[i].second<<endl;
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 7):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    int a[n],b[n];
    int ans1=0,ans2=0;
    vector<pair<int,int>> v1;
    vector<pair<int,int>> v2;
    for (int i=0;i<n;i++) {cin>>b[i];a[i]=i+1;}
    for (int i=n-1;i>-1;i--) {
        for (int j=n-1;j>0;j--) {
            int temp=a[j];
            a[j]=a[j-1];
            a[j-1]=temp;
            v1.push_back(make_pair(a[j-1],a[j]));
            ans1++;
            bool t=true;
            for (int k=0;k<n;k++) if (a[k]!=b[k]) t=false;
            if (t) {
                j=0;i=0;
            }
        }
    }
    for (int i=0;i<n;i++) {a[i]=i+1;}
    for (int i=n-1;i>-1;i--) {
        for (int j=0;j<n-1;j++) {
            int temp=a[j];
            a[j]=a[j+1];
            a[j+1]=temp;
            v2.push_back(make_pair(a[j],a[j+1]));
            ans2++;
            bool t=true;
            for (int k=0;k<n;k++) if (a[k]!=b[k]) t=false;
            if (t) {
                j=n;i=0;
            }
        }
    }
    if (ans1<=ans2) {
        cout<<ans2<<endl;
        for (int i=0;i<v2.size();i++) {
            cout<<v2[i].first<<" "<<v2[i].second<<endl;
        }    
    }
    else {
        cout<<ans1<<endl;
        for (int i=0;i<v1.size();i++) {
            cout<<v1[i].first<<" "<<v1[i].second<<endl;
        }    
    }
    
} 

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    int a[n],b[n];
    vector<pair<int,int>> v;
    for (int i=0;i<n;i++) {cin>>b[i];a[i]=n-i;}
    int ans=n*(n-1)/2;
    for (int i=n;i>1;i--) {
        for (int j=i-1;j>0;j--) {
            v.push_back(make_pair(i,j));
        }
    }
    int idx=n-1;
    while (idx>-1) {
        int index=idx;
        while (index>-1&&b[index]==a[index]) {index--;idx--;}
        if (index==-1) break;
        int ind=0;
        while (ind<n&&a[ind]!=b[index]) ind++;
        if (ind==n) break;
        for (int j=ind;j<index;j++) {
            v.push_back(make_pair(a[j+1],a[j]));
            int temp=a[j];
            a[j]=a[j+1];
            a[j+1]=temp;
            ans++;
        }
        idx--;
    }
    cout<<ans<<endl;
    for (int i=0;i<v.size();i++) cout<<v[i].first<<" "<<v[i].second<<endl;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 7):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    int a[n],b[n];
    int ans=0;
    vector<pair<int,int>> v;
    for (int i=0;i<n;i++) {cin>>b[i];a[i]=i+1;}
    for (int i=n-1;i>-1;i--) {
        for (int j=n-1;j>0;j--) {
            int temp=a[j];
            a[j]=a[j-1];
            a[j-1]=temp;
            v.push_back(make_pair(a[j-1],a[j]));
            ans++;
            bool t=true;
            for (int k=0;k<n;k++) if (a[k]!=b[k]) t=false;
            if (t) {
                j=0;i=0;
            }
        }
    }
    cout<<ans<<endl;
    for (int i=0;i<v.size();i++) {
        cout<<v[i].first<<" "<<v[i].second<<endl;
    }
} 

Submission (verdict: Wrong answer on test 7):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    int a[n],b[n];
    int ans1=0,ans2=0;
    vector<pair<int,int>> v1;
    vector<pair<int,int>> v2;
    for (int i=0;i<n;i++) {cin>>b[i];a[i]=i+1;}
    for (int i=n-1;i>-1;i--) {
        for (int j=n-1;j>0;j--) {
            int temp=a[j];
            a[j]=a[j-1];
            a[j-1]=temp;
            v1.push_back(make_pair(a[j-1],a[j]));
            ans1++;
            bool t=true;
            for (int k=0;k<n;k++) if (a[k]!=b[k]) t=false;
            if (t) {
                j=0;i=0;
            }
        }
    }
    for (int i=0;i<n;i++) {a[i]=i+1;}
    for (int i=n-1;i>-1;i--) {
        for (int j=0;j<n-1;j++) {
            int temp=a[j];
            a[j]=a[j+1];
            a[j+1]=temp;
            v2.push_back(make_pair(a[j],a[j+1]));
            ans2++;
            bool t=true;
            for (int k=0;k<n;k++) if (a[k]!=b[k]) t=false;
            if (t) {
                j=n;i=0;
            }
        }
    }
    if (ans1<=ans2) {
        cout<<ans2<<endl;
        for (int i=0;i<v2.size();i++) {
            cout<<v2[i].first<<" "<<v2[i].second<<endl;
        }    
    }
    else {
        cout<<ans1<<endl;
        for (int i=0;i<v1.size();i++) {
            cout<<v1[i].first<<" "<<v1[i].second<<endl;
        }    
    }
    
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve(){
    int l, r; cin >> l >> r;
    int first = -1;
    int mid = 0;
    for(int i = 29; i >= 0; i--){
        if((r & (1 << i)) == (l & (1 << i))){
            if(first == -1){
                mid += (l & (1 << i));
            }
            else{
                mid += (1 << i) - (l & (1 << i));
            }
        }
        else{
            if(first == -1){
                first = i;
            }
            mid += (l & (1 << i));
        }
    }
    assert(first != -1);
    if(mid <= l){
        mid += (1 << first);
    }
    assert(mid > l && mid < r);
    //cout << first << '\n';
    cout << l << " " << mid << " " << r << '\n';
}

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

Submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve(){
    int l, r; cin >> l >> r;
    int first = -1;
    int mid = 0;
    for(int i = 29; i >= 0; i--){
        if((r & (1 << i)) == (l & (1 << i))){
            if(first == -1){
                mid += (l & (1 << i));
            }
            else{
                mid += (1 << i) - (l & (1 << i));
            }
        }
        else{
            if(first == -1){
                first = i;
            }
            mid += (l & (1 << i));
        }
    }
    assert(first != -1);
    if(mid <= l){
        mid += (1 << first);
        for(int i = mid - 1; i >= 0; i--){
            if((l & (1<<i)) && !(r & (1<<i))){
                mid -= (l&(1<<i));
            }
        }
    }
    assert(mid > l && mid < r);
    //cout << first << '\n';
    cout << l << " " << mid << " " << r << '\n';
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    cin >> t;
    while(t--) solve();
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

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

void solve(){
    int l, r; cin >> l >> r;
    int first = -1;
    int mid = 0;
    for(int i = 29; i >= 0; i--){
        if((r & (1 << i)) == (l & (1 << i))){
            if(first == -1){
                mid += (l & (1 << i));
            }
            else{
                mid += (1 << i) - (l & (1 << i));
            }
        }
        else{
            if(first == -1){
                first = i;
            }
            mid += (l & (1 << i));
        }
    }
    assert(first != -1);
    if(mid <= l){
        mid += (1 << first);
    }
    assert(mid > l && mid < r);
    cout << first << '\n';
    cout << l << " " << mid << " " << r << '\n';
}

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

Submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve(){
    int l, r; cin >> l >> r;
    int first = -1;
    int mid = 0;
    for(int i = 29; i >= 0; i--){
        if((r & (1 << i)) == (l & (1 << i))){
            if(first == -1){
                mid += (l & (1 << i));
            }
            else{
                mid += (1 << i) - (l & (1 << i));
            }
        }
        else{
            if(first == -1){
                first = i;
            }
            mid += (l & (1 << i));
        }
    }
    assert(first != -1);
    if(mid <= l){
        mid += (1 << first);
    }
    assert(mid > l && mid < r);
    //cout << first << '\n';
    cout << l << " " << mid << " " << r << '\n';
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    cin >> t;
    while(t--) solve();
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve(){
    int l, r; cin >> l >> r;
    int first = -1;
    int mid = 0;
    for(int i = 29; i >= 0; i--){
        if((r & (1 << i)) == (l & (1 << i))){
            if(first == -1){
                mid += (l & (1 << i));
            }
            else{
                mid += (1 << i) - (l & (1 << i));
            }
        }
        else{
            if(first == -1){
                first = i;
            }
            mid += (l & (1 << i));
        }
    }
    assert(first != -1);
    if(mid <= l){
        mid += (1 << first);
        for(int i = mid - 1; i >= 0; i--){
            if((l & (1<<i)) && !(r & (1<<i))){
                mid -= (l&(1<<i));
            }
        }
    }
    assert(mid > l && mid < r);
    //cout << first << '\n';
    cout << l << " " << mid << " " << r << '\n';
}

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

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

void solve(){
    int l, r; cin >> l >> r;
    int first = -1;
    int mid = 0;
    for(int i = 29; i >= 0; i--){
        if((r & (1 << i)) == (l & (1 << i))){
            if(first == -1){
                mid += (l & (1 << i));
            }
            else{
                mid += (1 << i) - (l & (1 << i));
            }
        }
        else{
            if(first == -1){
                first = i;
            }
            mid += (l & (1 << i));
        }
    }
    assert(first != -1);
    if(mid <= l){
        mid += (1 << first);
        for(int i = first - 1; i >= 0; i--){
            if((l & (1<<i)) && !(r & (1<<i))){
                mid -= (l&(1<<i));
            }
        }
    }
    assert(mid > l && mid < r);
    //cout << first << '\n';
    cout << l << " " << mid << " " << r << '\n';
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    cin >> t;
    while(t--) solve();
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve(){
    int l, r; cin >> l >> r;
    int first = -1;
    int mid = 0;
    for(int i = 29; i >= 0; i--){
        if((r & (1 << i)) == (l & (1 << i))){
            if(first == -1){
                mid += (l & (1 << i));
            }
            else{
                mid += (1 << i) - (l & (1 << i));
            }
        }
        else{
            if(first == -1){
                first = i;
            }
        }
    }
    assert(first != -1);
    if(mid <= l){
        mid += (1 << first);
    }
    assert(mid > l && mid < r);
    cout << l << " " << mid << " " << r << '\n';
}

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

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

void solve(){
    int l, r; cin >> l >> r;
    int first = -1;
    int mid = 0;
    for(int i = 29; i >= 0; i--){
        if((r & (1 << i)) == (l & (1 << i))){
            if(first == -1){
                mid += (l & (1 << i));
            }
            else{
                mid += (1 << i) - (l & (1 << i));
            }
        }
        else{
            if(first == -1){
                first = i;
            }
            mid += (l & (1 << i));
        }
    }
    assert(first != -1);
    if(mid <= l){
        mid += (1 << first);
    }
    assert(mid > l && mid < r);
    cout << first << '\n';
    cout << l << " " << mid << " " << r << '\n';
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    cin >> t;
    while(t--) solve();
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve(){
    int l, r; cin >> l >> r;
    int first = -1;
    int mid = 0;
    for(int i = 29; i >= 0; i--){
        if((r & (1 << i)) == (l & (1 << i))){
            if(first == -1){
                mid += (l & (1 << i));
            }
            else{
                mid += (1 << i) - (l & (1 << i));
            }
        }
        else{
            if(first == -1){
                first = i;
            }
        }
    }
    assert(first != -1);
    if(mid <= l){
        mid += (1 << first);
    }
    assert(mid > l && mid < r);
    cout << l << " " << mid << " " << r << '\n';
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    cin >> t;
    while(t--) solve();
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 4):
//don't stick at only one idea,think openly.you can do it Junaid
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll N=1e5+5;
ll mod =1e9+7;
string s[2];
ll dp[3][N];


void solve(){
     int n;
     cin>>n;
     vector<int>deg(n+1,0);
     set<pair<int,int>>st;
     for(int i=1 ; i<n;i++){
         int u,v;
         cin>>u>>v;
         deg[u]++;
         deg[v]++;
         st.insert({u,v});
         st.insert({v,u});
     }
     vector<pair<int,int>>edges;
     for(int i=1;i<=n;i++){
          edges.push_back({deg[i],i});
     }
     sort(edges.rbegin(),edges.rend());
     int ans=-1;
     for(int i=0;i<edges.size();i++){
         int u=edges[i].second;
         for(int j=i+1;j<edges.size();j++){
             int v=edges[j].second;
             if(st.count({u,v})==0){
                 ans=deg[u]+deg[v]-1;
                 break;
             }
         }
         if(ans!=-1)break;
     }
     for(int i=1;i<=n;i++){
          if(st.find({edges[0].second,i})!=st.end()){
              ans= max(ans,deg[edges[0].second]+deg[i]-2);
             // break;
          }
     }
     cout<<ans<<endl;
}
   
  






int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
   int t=1;
   cin>>t;
  // sieve();
   while(t--){
        solve();
   }

}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 4):
//don't stick at only one idea,think openly.you can do it Junaid
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll N=1e5+5;
ll mod =1e9+7;
string s[2];
ll dp[3][N];


void solve(){
     int n;
     cin>>n;
     vector<int>deg(n+1,0);
     set<pair<int,int>>st;
     for(int i=1 ; i<n;i++){
         int u,v;
         cin>>u>>v;
         deg[u]++;
         deg[v]++;
         st.insert({u,v});
         st.insert({v,u});
     }
     vector<pair<int,int>>edges;
     for(int i=1;i<=n;i++){
          edges.push_back({deg[i],i});
     }
     sort(edges.rbegin(),edges.rend());
     int ans=-1;
     for(int i=0;i<edges.size();i++){
         int u=edges[i].second;
         for(int j=i+1;j<edges.size();j++){
             int v=edges[j].second;
             if(st.find({u,v})==st.end()){
                 ans=max(ans,deg[u]+deg[v]-1);
                // break;
             }
         }
         if(ans!=-1)break;
     }
     for(int i=1;i<=n;i++){
          if(st.find({edges[0].second,i})!=st.end()){
              ans= max(ans,deg[edges[0].second]+deg[i]-2);
             // break;
          }
     }
     cout<<ans<<endl;
}
   
  






int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
   int t=1;
   cin>>t;
  // sieve();
   while(t--){
        solve();
   }

}


Submission (verdict: Wrong answer on test 4):
//don't stick at only one idea,think openly.you can do it Junaid
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll N=1e5+5;
ll mod =1e9+7;
string s[2];
ll dp[3][N];


void solve(){
     int n;
     cin>>n;
     vector<int>deg(n+1,0);
     set<pair<int,int>>st;
     for(int i=1 ; i<n;i++){
         int u,v;
         cin>>u>>v;
         deg[u]++;
         deg[v]++;
         st.insert({u,v});
         st.insert({v,u});
     }
     vector<pair<int,int>>edges;
     for(int i=1;i<=n;i++){
          edges.push_back({deg[i],i});
     }
     sort(edges.rbegin(),edges.rend());
     int ans=-1;
     for(int i=0;i<edges.size();i++){
         int u=edges[i].second;
         for(int j=i+1;j<edges.size();j++){
             int v=edges[j].second;
             if(st.find({u,v})==st.end()){
                 ans=max(ans,deg[u]+deg[v]-1);
                // break;
             }
         }
         if(ans!=-1)break;
     }
     for(auto it:st){
          int u=it.first;
          int v=it.second;
          ans=max(ans,deg[u]+deg[v]-2);
     }
     cout<<ans<<endl;
}
   
  






int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
   int t=1;
   cin>>t;
  // sieve();
   while(t--){
        solve();
   }

}