ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)


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

template<typename T> void ckmin(T &x, T y) {if (y < x) x = y;}
template<typename T> void ckmax(T &x, T y) {if (y > x) x = y;}

void solve() {
    int n;
    cin >> n;
    
    vector<int> adjList[n + 5];
    int deg[n + 5] = {};

    for (int i = 1; i <= n - 1; i++) {
        int u, v;
        cin >> u >> v;
        adjList[u].push_back(v);
        adjList[v].push_back(u);
        deg[u]++;
        deg[v]++;
    }

    multiset<int> ms;
    for (int i = 1; i <= n; i ++)
        ms.insert(deg[i]);

    int ans = 0;
    
    for (int u = 1; u <= n; u++) {
        for (int v : adjList[u]) ckmax(ans, deg[u] + deg[v] - 2);
        
        ms.erase(deg[u]);
        for (int v : adjList[u]) ms.erase(deg[v]);
        if (ms.size()) ckmax(ans, deg[u] + *ms.rbegin() - 1);
        ms.insert(deg[u]);
        for (int v : adjList[u]) ms.insert(deg[v]);
    }

    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int numTest;
    cin >> numTest;
    while (numTest--)
        solve();   
    
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

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

template<typename T> void ckmin(T &x, T y) {if (y < x) x = y;}
template<typename T> void ckmax(T &x, T y) {if (y > x) x = y;}

void solve() {
    int n;
    cin >> n;
    
    vector<int> adjList[n + 5];
    int deg[n + 5] = {};

    for (int i = 1; i <= n - 1; i++) {
        int u, v;
        cin >> u >> v;
        adjList[u].push_back(v);
        adjList[v].push_back(u);
        deg[u]++;
        deg[v]++;
    }

    multiset<int> ms;
    for (int i = 1; i <= n; i ++)
        ms.insert(deg[i]);

    int ans = 0;
    
    for (int u = 1; u <= n; u++) {
        for (int v : adjList[u]) ckmax(ans, deg[u] + deg[v] - 2);
        
        ms.erase(deg[u]);
        for (int v : adjList[u]) ms.erase(deg[v]);
        if (ms.size()) ckmax(ans, deg[u] + *ms.rbegin() - 1);
        ms.insert(deg[u]);
        for (int v : adjList[u]) ms.insert(deg[v]);
    }

    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int numTest;
    cin >> numTest;
    while (numTest--)
        solve();   
    
    return 0;
}

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

template<typename T> void ckmin(T &x, T y) {if (y < x) x = y;}
template<typename T> void ckmax(T &x, T y) {if (y > x) x = y;}

void solve() {
    int n;
    cin >> n;
    
    vector<vector<int> > adjList(n + 5);
    int deg[n + 5] = {};

    for (int i = 1; i <= n - 1; i++) {
        int u, v;
        cin >> u >> v;
        adjList[u].push_back(v);
        adjList[v].push_back(u);
        deg[u]++;
        deg[v]++;
    }

    multiset<int> ms;
    for (int i = 1; i <= n; i ++)
        ms.insert(deg[i]);

    int ans = 0;
    
    for (int u = 1; u <= n; u++) {
        for (int v : adjList[u]) ckmax(ans, deg[u] + deg[v] - 2);
        
        ms.erase(deg[u]);
        for (int v : adjList[u]) ms.erase(deg[v]);
        if (ms.size()) ckmax(ans, deg[u] + *ms.rbegin() - 1);
        ms.insert(deg[u]);
        for (int v : adjList[u]) ms.insert(deg[v]);
    }

    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int numTest;
    cin >> numTest;
    while (numTest--)
        solve();   
    
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

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

int main() {
    long long t;
    cin >> t;
    while (t--) {
        long long n;
        cin >> n;
        long long sum = 0;
        long long present2 = 0;
        long long present3 = 0;
        
        // Calculating sum and checking for presence of 2's and 3's in the digits
        while (n != 0) {
            long long temp = n % 10;
            sum += temp;
            if (temp == 2) {
                present2++;
            }
            if (temp == 3) {
                present3++;
            }
            n = n / 10;
        }
        
        bool is_present = false;
        if (sum % 9 == 0) {
            is_present = true;
        }
        
        // Checking combinations of 2's and 3's
        if (present2 > 0 && present3 > 0) {
            for (long long i = 0; i <= present2; i++) {
                for (long long j = 0; j <= present3; j++) {
                    if ((sum + 2 * i + 6 * j) % 9 == 0) {
                        is_present = true;
                    }
                }
            }
        } else if (present2 > 0) {
            for (long long i = 0; i <= present2; i++) {
                if ((sum + 2 * i) % 9 == 0) {
                    is_present = true;
                }
            }
        } else if (present3 > 0) {
            for (long long i = 0; i <= present3; i++) {
                if ((sum + 6 * i) % 9 == 0) {
                    is_present = true;
                }
            }
        }
        
        if (is_present) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}


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

int main() {
    int t;
    cin >> t;
    while (t--) {
      long long n;
      cin>>n;
      int sum=0;
      int present2=0;
      int present3=0;
      while(n!=0){
        int temp=n%10;
        sum+=temp;
        if(temp==2){
            present2++;
        }
        if(temp==3){
            present3++;
        }
        n=n/10;
      }
      bool is_present=false;
      if(sum%9==0){
        is_present=true;
      }
      if(present2>0&&present3>0){
        for(int i=0;i<min(present2+1,10);i++){
            for(int j=0;j<min(present3+1,10);j++){
                if((sum+2*i+6*j)%9==0){
                    is_present=true;
                }
            }
        }
      }
      else if(present2>0){
        for(int i=0;i<min(present2+1,10);i++){
            if((sum+2*i)%9==0){
                is_present=true;
            }
        }
      }
      else if(present3>0){
        for(int i=0;i<min(present3+1,10);i++){
            if((sum+6*i)%9==0){
                is_present=true;
            }
        }
      }
      if(is_present){
        cout<<"YES"<<endl;
      }
      else{
        cout<<"NO"<<endl;
      }
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

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

int main() {
    int t;
    cin >> t;
    while (t--) {
      long long n;
      cin>>n;
      int sum=0;
      int present2=0;
      int present3=0;
      while(n!=0){
        int temp=n%10;
        sum+=temp;
        if(temp==2){
            present2++;
        }
        if(temp==3){
            present3++;
        }
        n=n/10;
      }
      bool is_present=false;
      if(sum%9==0){
        is_present=true;
      }
      if(present2>0&&present3>0){
        for(int i=0;i<min(present2+1,10);i++){
            for(int j=0;j<min(present3+1,10);j++){
                if((sum+2*i+6*j)%9==0){
                    is_present=true;
                }
            }
        }
      }
      else if(present2>0){
        for(int i=0;i<min(present2+1,10);i++){
            if((sum+2*i)%9==0){
                is_present=true;
            }
        }
      }
      else if(present3>0){
        for(int i=0;i<min(present3+1,10);i++){
            if((sum+6*i)%9==0){
                is_present=true;
            }
        }
      }
      if(is_present){
        cout<<"YES"<<endl;
      }
      else{
        cout<<"NO"<<endl;
      }
    }
    return 0;
}

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

void solve() {
    string s;
    cin >> s;

    int sum = 0;
    int twos = 0, threes = 0;

    for (char c : s) {
        int digit = c - '0';
        sum += digit;
        if (digit == 2) twos++;
        if (digit == 3) threes++;
    }

    for (int i = 0; i <= min(10, twos); i++) {
        for (int j = 0; j <= min(10, threes); j++) {
            if ((sum + i * 2 + j * 6) % 9 == 0) {
                cout << "YES" << endl;
                return;
            }
        }
    }
    cout << "NO" << endl;
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

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

int main() {
    int t;
    cin >> t;
    while (t--) {
      long long n;
      cin>>n;
      int sum=0;
      int present2=0;
      int present3=0;
      while(n!=0){
        int temp=n%10;
        sum+=temp;
        if(temp==2){
            present2++;
        }
        if(temp==3){
            present3++;
        }
        n=n/10;
      }
      bool is_present=false;
      if(sum%9==0){
        is_present=true;
      }
      if(present2>0&&present3>0){
        for(int i=0;i<present2+1;i++){
            for(int j=0;j<present3+1;j++){
                if((sum+2*i+6*j)%9==0){
                    is_present=true;
                }
            }
        }
      }
      else if(present2>0){
        for(int i=0;i<present2+1;i++){
            if((sum+2*i)%9==0){
                is_present=true;
            }
        }
      }
      else if(present3>0){
        for(int i=0;i<present3+1;i++){
            if((sum+6*i)%9==0){
                is_present=true;
            }
        }
      }
      if(is_present){
        cout<<"YES"<<endl;
      }
      else{
        cout<<"NO"<<endl;
      }
    }
    return 0;
}

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

int main() {
    long long t;
    cin >> t;
    while (t--) {
        long long n;
        cin >> n;
        long long sum = 0;
        long long present2 = 0;
        long long present3 = 0;
        
        // Calculating sum and checking for presence of 2's and 3's in the digits
        while (n != 0) {
            long long temp = n % 10;
            sum += temp;
            if (temp == 2) {
                present2++;
            }
            if (temp == 3) {
                present3++;
            }
            n = n / 10;
        }
        
        bool is_present = false;
        if (sum % 9 == 0) {
            is_present = true;
        }
        
        // Checking combinations of 2's and 3's
        if (present2 > 0 && present3 > 0) {
            for (long long i = 0; i <= present2; i++) {
                for (long long j = 0; j <= present3; j++) {
                    if ((sum + 2 * i + 6 * j) % 9 == 0) {
                        is_present = true;
                    }
                }
            }
        } else if (present2 > 0) {
            for (long long i = 0; i <= present2; i++) {
                if ((sum + 2 * i) % 9 == 0) {
                    is_present = true;
                }
            }
        } else if (present3 > 0) {
            for (long long i = 0; i <= present3; i++) {
                if ((sum + 6 * i) % 9 == 0) {
                    is_present = true;
                }
            }
        }
        
        if (is_present) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


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

int main() {
    int t;
    cin >> t;
    while (t--) {
      long long n;
      cin>>n;
      int sum=0;
      int present2=0;
      int present3=0;
      while(n!=0){
        int temp=n%10;
        sum+=temp;
        if(temp==2){
            present2++;
        }
        if(temp==3){
            present3++;
        }
        n=n/10;
      }
      bool is_present=false;
      if(sum%9==0){
        is_present=true;
      }
      if(present2>0&&present3>0){
        for(int i=0;i<present2+1;i++){
            for(int j=0;j<present3+1;j++){
                if((sum+2*i+6*j)%9==0){
                    is_present=true;
                }
            }
        }
      }
      else if(present2>0){
        for(int i=0;i<present2+1;i++){
            if((sum+2*i)%9==0){
                is_present=true;
            }
        }
      }
      else if(present3>0){
        for(int i=0;i<present3+1;i++){
            if((sum+6*i)%9==0){
                is_present=true;
            }
        }
      }
      if(is_present){
        cout<<"YES"<<endl;
      }
      else{
        cout<<"NO"<<endl;
      }
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int solve(vector<int> &nums) {
    int sum = 0;
    for (int i = 0; i < nums.size(); i++) {
        sum += nums[i];
    }
    return sum;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> v(n);
        for (int i = 0; i < n; i++) {
            cin >> v[i];
        }

        int ans = INT_MIN;
        queue<vector<int>> q;
        set<vector<int>> visited; 

        q.push(v);
        visited.insert(v);
        
        reverse(v.begin(),v.end());
        
        if(!visited.count(v)){
        	q.push(v);
        	visited.insert(v);
		}

        while (!q.empty()) {
            vector<int> temp = q.front();
            q.pop();

            ans = max(ans, solve(temp));

            if (temp.size() <= 1) 
                continue;

            vector<int> temp1;
            for (int i = 0; i < temp.size() - 1; i++) {
                temp1.push_back(temp[i + 1] - temp[i]);
            }

            if (!visited.count(temp1)) {
                q.push(temp1);
                visited.insert(temp1);
            }

            reverse(temp1.begin(), temp1.end());

            if (!visited.count(temp1)) {
                q.push(temp1);
                visited.insert(temp1);
            }
        }

        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

ll solve(vector<ll> &nums) {
    ll sum = 0;
    for (ll i = 0; i < nums.size(); i++) {
        sum += nums[i];
    }
    return sum;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;
        vector<ll> v(n);
        for (ll i = 0; i < n; i++) {
            cin >> v[i];
        }

        ll ans = LLONG_MIN;
        queue<vector<ll>> q;
        set<vector<ll>> visited; 

        q.push(v);
        visited.insert(v);
        
        reverse(v.begin(),v.end());
        
        if(!visited.count(v)){
        	q.push(v);
        	visited.insert(v);
		}

        while (!q.empty()) {
            vector<ll> temp = q.front();
            q.pop();

            ans = max(ans, solve(temp));

            if (temp.size() <= 1) 
                continue;

            vector<ll> temp1;
            for (ll i = 0; i < temp.size() - 1; i++) {
                temp1.push_back(temp[i + 1] - temp[i]);
            }

            if (!visited.count(temp1)) {
                q.push(temp1);
                visited.insert(temp1);
            }

            reverse(temp1.begin(), temp1.end());

            if (!visited.count(temp1)) {
                q.push(temp1);
                visited.insert(temp1);
            }
        }

        cout << ans << endl;
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


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

using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int solve(vector<int> &nums) {
    int sum = 0;
    for (int i = 0; i < nums.size(); i++) {
        sum += nums[i];
    }
    return sum;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> v(n);
        for (int i = 0; i < n; i++) {
            cin >> v[i];
        }

        int ans = INT_MIN;
        queue<vector<int>> q;
        set<vector<int>> visited; 

        q.push(v);
        visited.insert(v);

        while (!q.empty()) {
            vector<int> temp = q.front();
            q.pop();

            ans = max(ans, solve(temp));

            if (temp.size() <= 1) 
                continue;

            vector<int> temp1;
            for (int i = 0; i < temp.size() - 1; i++) {
                temp1.push_back(temp[i + 1] - temp[i]);
            }

            if (!visited.count(temp1)) {
                q.push(temp1);
                visited.insert(temp1);
            }

            reverse(temp1.begin(), temp1.end());

            if (!visited.count(temp1)) {
                q.push(temp1);
                visited.insert(temp1);
            }
        }

        cout << ans << endl;
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int solve(vector<int> &nums) {
    int sum = 0;
    for (int i = 0; i < nums.size(); i++) {
        sum += nums[i];
    }
    return sum;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> v(n);
        for (int i = 0; i < n; i++) {
            cin >> v[i];
        }

        int ans = INT_MIN;
        queue<vector<int>> q;
        set<vector<int>> visited; 

        q.push(v);
        visited.insert(v);

        while (!q.empty()) {
            vector<int> temp = q.front();
            q.pop();

            ans = max(ans, solve(temp));

            if (temp.size() <= 1) 
                continue;

            vector<int> temp1;
            for (int i = 0; i < temp.size() - 1; i++) {
                temp1.push_back(temp[i + 1] - temp[i]);
            }

            if (!visited.count(temp1)) {
                q.push(temp1);
                visited.insert(temp1);
            }

            reverse(temp1.begin(), temp1.end());

            if (!visited.count(temp1)) {
                q.push(temp1);
                visited.insert(temp1);
            }
        }

        cout << ans << endl;
    }
    return 0;
}



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

using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int solve(vector<int> &nums) {
    int sum = 0;
    for (int i = 0; i < nums.size(); i++) {
        sum += nums[i];
    }
    return sum;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> v(n);
        for (int i = 0; i < n; i++) {
            cin >> v[i];
        }

        int ans = INT_MIN;
        queue<vector<int>> q;
        set<vector<int>> visited; 

        q.push(v);
        visited.insert(v);
        
        reverse(v.begin(),v.end());
        
        if(!visited.count(v)){
        	q.push(v);
        	visited.insert(v);
		}

        while (!q.empty()) {
            vector<int> temp = q.front();
            q.pop();

            ans = max(ans, solve(temp));

            if (temp.size() <= 1) 
                continue;

            vector<int> temp1;
            for (int i = 0; i < temp.size() - 1; i++) {
                temp1.push_back(temp[i + 1] - temp[i]);
            }

            if (!visited.count(temp1)) {
                q.push(temp1);
                visited.insert(temp1);
            }

            reverse(temp1.begin(), temp1.end());

            if (!visited.count(temp1)) {
                q.push(temp1);
                visited.insert(temp1);
            }
        }

        cout << ans << endl;
    }
    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 endl '\n'
// #define int long long
// const int inf = 1e18;
// const int MOD = 1000000007;
// const int mod = 998244353;

bool func(int x,int y,map<int,int>&mp){
    bool mila = true;
    if(x==0 || y==0)return false;
    if(mp[x]>0)mp[x]--;
    else mila&=func(x/2,(x+1)/2,mp);

    if(!mila)return false;
    
    if(mp[y]>0){mp[y]--;return true;}
    else return func(y/2,(y+1)/2,mp);

}   

void solve(){
    int n,m;cin>>n>>m;
    map<int,int>mp;

    for(int i=0;i<n;++i){
        int x;cin>>x;mp[x]++;
    }

    for(int i=0;i<m;++i){
        int x;cin>>x;
        if(mp[x])mp[x]--;
        else{
            if(!func(x/2,(x+1)/2,mp)){
                cout << "NO" << endl;return;
            }
        }
    }
    for(auto i:mp){
        if(i.second>0){
            cout << "NO" << endl;return;
        }
    }
    cout << "YES" << endl;
}   

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



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

#define endl '\n'
// #define int long long
// const int inf = 1e18;
// const int MOD = 1000000007;
// const int mod = 998244353;

map<int,int>mp;

bool func(int x){
    bool mila = true;
    if(mp[x]>0){mp[x]--;return true;}
    if(x==1)return false;

    return (func(x/2)&&func((x+1)/2));
}   

void solve(){
    int n,m;cin>>n>>m;
    mp.clear();
    for(int i=0;i<n;++i){
        int x;cin>>x;mp[x]++;
    }

    for(int i=0;i<m;++i){
        int x;cin>>x;
        if(!func(x)){
            cout << "NO" << endl;return;
        }
    }
    for(auto i:mp){
        if(i.second>0){
            cout << "NO" << endl;return;
        }
    }
    cout << "YES" << endl;
}   

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