ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


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

using namespace std;

long long get_sum(long long sum){
    while(sum > 9){
        long long temp = 0,n = sum;
        sum = 0;
        while(n > 0){
            sum = n%10;
            n /= 10;
        }
    }
    return sum;
}

void solve(string s){
    long long arr[s.size()];
    long long sum = 0,two = 0,three = 0;
    for(int i = ;i < s.size();i++){
        arr[i] = s[i] - '0';
        sum += arr[i];
        if(arr[i] == 2)two++;
        else if(arr[i] == 3)three++;
    }
    sum = get_sum(sum);
    for(int i = 0;i < min(10,two + 1);i++){
        for(int j = 0;j < min(10,three + 1);j++){
            if((sum + i*2 + j*3)%9 == 0){
                cout << "YES\n";
                return;
            }
        }
    }
    cout << "NO\n";
    return;
}


int main(){
    int t;
    cin >> t;
    while(t--){
        string s;
        cin >> s;
        solve(s);
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include<bits/stdc++.h>

using namespace std;

long long get_sum(long long sum){
    while(sum > 9){
        long long n = sum;
        sum = 0;
        while(n > 0){
            sum += n%10;
            n /= 10;
        }
    }
    return sum;
}

void solve(string s){
    long long arr[s.size()];
    long long sum = 0,two = 0,three = 0;
    for(int i = 0;i < s.size();i++){
        arr[i] = s[i] - '0';
        sum += arr[i];
        if(arr[i] == 2)two++;
        else if(arr[i] == 3)three++;
    }
    sum = get_sum(sum);
    for(int i = 0;i < min(10,two + 1);i++){
        for(int j = 0;j < min(10,three + 1);j++){
            if((sum + i*2 + j*3)%9 == 0){
                cout << "YES\n";
                return;
            }
        }
    }
    cout << "NO\n";
    return;
}


int main(){
    int t;
    cin >> t;
    while(t--){
        string s;
        cin >> s;
        solve(s);
    }
    return 0;
}

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

using namespace std;

long long get_sum(long long sum){
    while(sum > 9){
        long long n = sum;
        sum = 0;
        while(n > 0){
            sum += n%10;
            n /= 10;
        }
    }
    return sum;
}

void solve(string s){
    long long arr[s.size()];
    long long sum = 0;
    int two = 0,three = 0;
    for(int i = 0;i < s.size();i++){
        arr[i] = s[i] - '0';
        sum += arr[i];
        if(arr[i] == 2)two++;
        else if(arr[i] == 3)three++;
    }
    sum = get_sum(sum);
    for(int i = 0;i < min(10,two + 1);i++){
        for(int j = 0;j < min(10,three + 1);j++){
            if((sum + i*2 + j*3)%9 == 0){
                cout << "YES\n";
                return;
            }
        }
    }
    cout << "NO\n";
    return;
}


int main(){
    int t;
    cin >> t;
    while(t--){
        string s;
        cin >> s;
        solve(s);
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include<bits/stdc++.h>

using namespace std;

long long get_sum(long long sum){
    while(sum > 9){
        long long temp = 0,n = sum;
        sum = 0;
        while(n > 0){
            sum = n%10;
            n /= 10;
        }
    }
    return sum;
}

void solve(string s){
    long long arr[s.size()];
    long long sum = 0,two = 0,three = 0;
    for(int i = ;i < s.size();i++){
        arr[i] = s[i] - '0';
        sum += arr[i];
        if(arr[i] == 2)two++;
        else if(arr[i] == 3)three++;
    }
    sum = get_sum(sum);
    for(int i = 0;i < min(10,two + 1);i++){
        for(int j = 0;j < min(10,three + 1);j++){
            if((sum + i*2 + j*3)%9 == 0){
                cout << "YES\n";
                return;
            }
        }
    }
    cout << "NO\n";
    return;
}


int main(){
    int t;
    cin >> t;
    while(t--){
        string s;
        cin >> s;
        solve(s);
    }
    return 0;
}

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

using namespace std;

long long get_sum(long long sum){
    while(sum > 9){
        long long n = sum;
        sum = 0;
        while(n > 0){
            sum += n%10;
            n /= 10;
        }
    }
    return sum;
}

void solve(string s){
    long long arr[s.size()];
    long long sum = 0,two = 0,three = 0;
    for(int i = 0;i < s.size();i++){
        arr[i] = s[i] - '0';
        sum += arr[i];
        if(arr[i] == 2)two++;
        else if(arr[i] == 3)three++;
    }
    sum = get_sum(sum);
    for(int i = 0;i < min(10,two + 1);i++){
        for(int j = 0;j < min(10,three + 1);j++){
            if((sum + i*2 + j*3)%9 == 0){
                cout << "YES\n";
                return;
            }
        }
    }
    cout << "NO\n";
    return;
}


int main(){
    int t;
    cin >> t;
    while(t--){
        string s;
        cin >> s;
        solve(s);
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

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

#define endl '\n'
typedef long long ll;
using namespace std;

template <typename T>T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template <typename T> T lcm(T a, T b) {return (a * b) / gcd(a, b);}
template <typename K> void print_vec(const vector<K>& vec) {for(size_t i = 0; i < vec.size(); ++i) {cout << vec[i];if(i != vec.size() - 1) {cout << " ";}}cout << endl;}

void solve() {
    int n;
    cin >> n;

    vector<int> a(n);
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans += a[i];
    }

    ans = abs(ans);

    while (n > 1) {
        ll x = 0;
        for (int i = 0; i < n - 1; i++) {
            a[i] = a[i + 1] - a[i];
            x += a[i];
        }

        ans = max(ans, abs(x));
        n--;
    }

    cout << ans << endl;
}

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

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

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

#define endl '\n'
typedef long long ll;
using namespace std;

template <typename T>T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template <typename T> T lcm(T a, T b) {return (a * b) / gcd(a, b);}
template <typename K> void print_vec(const vector<K>& vec) {for(size_t i = 0; i < vec.size(); ++i) {cout << vec[i];if(i != vec.size() - 1) {cout << " ";}}cout << endl;}

void solve() {
    int n;
    cin >> n;

    vector<ll> a(n);
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans += a[i];
    }

    while (n > 1) {
        ll x = 0;
        for (int i = 0; i < n - 1; i++) {
            a[i] = a[i + 1] - a[i];
            x += a[i];
        }

        ans = max(ans, abs(x));
        n--;
    }

    cout << ans << endl;
}

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

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

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

#define endl '\n'
typedef long long ll;
using namespace std;

template <typename T>T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template <typename T> T lcm(T a, T b) {return (a * b) / gcd(a, b);}
template <typename K> void print_vec(const vector<K>& vec) {for(size_t i = 0; i < vec.size(); ++i) {cout << vec[i];if(i != vec.size() - 1) {cout << " ";}}cout << endl;}

void solve() {
    int n;
    cin >> n;

    vector<int> a(n);
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans += a[i];
    }

    while (n > 1) {
        ll x = 0;
        for (int i = 0; i < n - 1; i++) {
            a[i] = a[i + 1] - a[i];
            x += a[i];
        }

        ans = max(ans, abs(x));
        n--;
    }

    cout << ans << endl;
}

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

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

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

#define endl '\n'
typedef long long ll;
using namespace std;

template <typename T>T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template <typename T> T lcm(T a, T b) {return (a * b) / gcd(a, b);}
template <typename K> void print_vec(const vector<K>& vec) {for(size_t i = 0; i < vec.size(); ++i) {cout << vec[i];if(i != vec.size() - 1) {cout << " ";}}cout << endl;}

void solve() {
    int n;
    cin >> n;

    vector<int> a(n);
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans += a[i];
    }

    ans = abs(ans);

    while (n > 1) {
        ll x = 0;
        for (int i = 0; i < n - 1; i++) {
            a[i] = a[i + 1] - a[i];
            x += a[i];
        }

        ans = max(ans, abs(x));
        n--;
    }

    cout << ans << endl;
}

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

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

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

#define endl '\n'
typedef long long ll;
using namespace std;

template <typename T>T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template <typename T> T lcm(T a, T b) {return (a * b) / gcd(a, b);}
template <typename K> void print_vec(const vector<K>& vec) {for(size_t i = 0; i < vec.size(); ++i) {cout << vec[i];if(i != vec.size() - 1) {cout << " ";}}cout << endl;}

void solve() {
    int n;
    cin >> n;

    vector<int> a(n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans += a[i];
    }

    while (n > 1) {
        int x = 0;
        for (int i = 0; i < n - 1; i++) {
            a[i] = a[i + 1] - a[i];
            x += a[i];
        }

        ans = max(ans, abs(x));
        n--;
    }

    cout << ans << endl;
}

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

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

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

#define endl '\n'
typedef long long ll;
using namespace std;

template <typename T>T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template <typename T> T lcm(T a, T b) {return (a * b) / gcd(a, b);}
template <typename K> void print_vec(const vector<K>& vec) {for(size_t i = 0; i < vec.size(); ++i) {cout << vec[i];if(i != vec.size() - 1) {cout << " ";}}cout << endl;}

void solve() {
    int n;
    cin >> n;

    vector<int> a(n);
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans += a[i];
    }

    while (n > 1) {
        ll x = 0;
        for (int i = 0; i < n - 1; i++) {
            a[i] = a[i + 1] - a[i];
            x += a[i];
        }

        ans = max(ans, abs(x));
        n--;
    }

    cout << ans << endl;
}

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

    int t;
    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>

#define endl '\n'
typedef long long ll;
using namespace std;

template <typename T>T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template <typename T> T lcm(T a, T b) {return (a * b) / gcd(a, b);}
template <typename K> void print_vec(const vector<K>& vec) {for(size_t i = 0; i < vec.size(); ++i) {cout << vec[i];if(i != vec.size() - 1) {cout << " ";}}cout << endl;}

void solve() {
    int n;
    cin >> n;

    vector<int> a(n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans += a[i];
    }

    while (n > 1) {
        int x = 0;
        for (int i = 0; i < n - 1; i++) {
            a[i] = a[i + 1] - a[i];
            x += a[i];
        }

        ans = max(ans, abs(x));
        n--;
    }

    cout << ans << endl;
}

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

    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    
    return 0;
}
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 i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
// using u128 = unsigned __int128;

void solve() {
    std::unordered_map<int, int> cnt;
     int ans = 0;
    std::vector<int> data;
    int n, k;
    std::cin >> n >> k;

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


    for(auto [x, c] : cnt){
        data.push_back(c);
    }

    std::sort(data.begin(), data.end());

    int i = 0;

    ans = data.size();

    while(k && i < data.size()){
        if(data[i] <= k){
            k -= data[i];
            ans--;
            i++;
        }else break;
    }

    if(ans == 0)ans = 1;

    std::cout << ans << std::endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}

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

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
// using u128 = unsigned __int128;

void solve() {
    std::unordered_map<int, int> cnt;
    std::vector<int> data;
    int n, k;
    std::cin >> n >> k;

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


    for(auto [x, c] : cnt){
        data.push_back(c);
    }

    std::sort(data.begin(), data.end());

    int i = 0;

    int ans = data.size();

    for(int i = 0; i < data.size()-1; ++i){
        if(k >= data[i]){
            k -= data[i];
            ans--;
        }
    }

    std::cout << ans << std::endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}
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 i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
// using u128 = unsigned __int128;

void solve() {
    std::unordered_map<int, int> cnt;
    std::vector<int> data;
    int n, k;
    std::cin >> n >> k;

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


    for(auto [x, c] : cnt){
        data.push_back(c);
    }

    std::sort(data.begin(), data.end());

    int i = 0;

    int ans = data.size();

    for(int i = 0; i < data.size()-1; ++i){
        if(k >= data[i]){
            k -= data[i];
            ans--;
        }
    }

    std::cout << ans << std::endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}

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

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
//using u128 = unsigned __int128;

void solve() {
    int n, k;
    std::cin >> n >> k;
    
    std::map<int, int> cnt;
    for (int i = 0; i < n; i++) {
        int a;
        std::cin >> a;
        cnt[a]++;
    }
    
    std::vector<int> c;
    for (auto [_, x] : cnt) {
        c.push_back(x);
    }
    std::sort(c.begin(), c.end());
    int ans = c.size();
    for (int i = 0; i < c.size() - 1; i++) {
        if (k >= c[i]) {
            ans--;
            k -= c[i];
        }
    }
    std::cout << ans << "\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}
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 i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
// using u128 = unsigned __int128;

void solve() {
    std::unordered_map<int, int> cnt;
     int ans = 0;
    std::vector<int> data;
    int n, k;
    std::cin >> n >> k;

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


    for(auto [x, c] : cnt){
        data.push_back(c);
    }

    std::sort(data.begin(), data.end());

    int i = 0;

    ans = data.size();

    while(k && i < n){
        if(data[i] <= k){
            k -= data[i];
            ans--;
            i++;
        }else break;
    }

    if(ans == 0)ans = 1;

    std::cout << ans << std::endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}

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

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
// using u128 = unsigned __int128;

void solve() {
    std::unordered_map<int, int> cnt;
     int ans = 0;
    std::vector<int> data;
    int n, k;
    std::cin >> n >> k;

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


    for(auto [x, c] : cnt){
        data.push_back(c);
    }

    std::sort(data.begin(), data.end());

    int i = 0;

    ans = data.size();

    while(k && i < data.size()){
        if(data[i] <= k){
            k -= data[i];
            ans--;
            i++;
        }else break;
    }

    if(ans == 0)ans = 1;

    std::cout << ans << std::endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}
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 i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
// using u128 = unsigned __int128;

void solve() {
    std::unordered_map<int, int> cnt;
     int ans = 0;
    std::vector<int> data;
    int n, k;
    std::cin >> n >> k;

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


    for(auto [x, c] : cnt){
        data.push_back(c);
    }

    std::sort(data.begin(), data.end());

    int i = 0;

    ans = data.size();

    while(k && i < n){
        if(data[i] <= k){
            k -= data[i];
            ans--;
            i++;
        }else break;
    }

    if(ans == 0)ans = 1;

    std::cout << ans << std::endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        vector<long long> a(n);
        long long sum = 0;
        for (int i = 0; i < n; i++){
            cin >> a[i];
            sum += a[i];
        }
 
        // Option 0: Do nothing.
        long long best = sum;
 
        // Let "cur" be our current sequence.
        vector<long long> cur = a;
        // We now simulate taking differences repeatedly.
        while(cur.size() > 1){
            // When allowed to reverse before taking differences,
            // we can force the new sequence’s sum to be the absolute difference
            // between its last and first element.
            long long candidate = llabs(cur.back() - cur.front());
            best = max(best, candidate);
 
            // Compute the difference–sequence.
            vector<long long> nxt(cur.size() - 1);
            for (int i = 0; i < (int)cur.size() - 1; i++){
                nxt[i] = cur[i+1] - cur[i];
            }
            cur = nxt;
        }
        // (When the current sequence has length 1, its "sum" is its only element.)
        if(cur.size() == 1)
            best = max(best, llabs(cur[0]));
 
        cout << best << "\n";
    }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        vector<long long> a(n);
        long long sum = 0;
        for (int i = 0; i < n; i++){
            cin >> a[i];
            sum += a[i];
        }
 
        // Option 0: Do nothing.
        long long best = sum;
 
        // Let "cur" be our current sequence.
        vector<long long> cur = a;
        // Simulate taking differences repeatedly.
        while(cur.size() > 1){
            // Before taking the difference, we can reverse if needed,
            // so the best outcome is the absolute difference between last and first.
            long long candidate = llabs(cur.back() - cur.front());
            best = max(best, candidate);
 
            // Compute the difference–sequence.
            vector<long long> nxt(cur.size() - 1);
            for (int i = 0; i < (int)cur.size() - 1; i++){
                nxt[i] = cur[i+1] - cur[i];
            }
            cur = nxt;
        }
        // When the sequence length is 1, no operation is allowed.
        // So we must use its only value as is.
        if(cur.size() == 1)
            best = max(best, cur[0]);
 
        cout << best << "\n";
    }
    return 0;
}