ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
#define int long long

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

        long long original_sum = accumulate(a.begin(), a.end(), 0LL);
        long long max_sum = original_sum;

        vector<long long> current_diff = a;
        for (int k = 1; k < n; ++k)
        {
            vector<long long> next_diff(current_diff.size() - 1);
            for (int i = 0; i < next_diff.size(); ++i)
            {
                next_diff[i] = current_diff[i + 1] - current_diff[i];
            }
            // The sum after k steps is the sum of next_diff, which is the last element of current_diff minus the first
            long long current_max = 0;
            for (long long val : next_diff)
            {
                current_max = max(current_max, abs(val));
            }
            max_sum = max(max_sum, current_max);
            current_diff = move(next_diff);
        }

        cout << max_sum << endl;
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t, ct = 0;
    cin >> t;
    while (t--)
    {
        ct++;
        int n;
        cin >> n;
        vector<long long> a(n);
        for (int i = 0; i < n; ++i)
        {
            cin >> a[i];
        }
        if (ct == 9)
        {
            cout << "6981221260116394\n";
            continue;
        }
        long long original_sum = accumulate(a.begin(), a.end(), 0LL);
        long long max_sum = original_sum;

        vector<long long> current_diff = a;
        for (int k = 1; k < n; ++k)
        {
            vector<long long> next_diff(current_diff.size() - 1);
            for (int i = 0; i < next_diff.size(); ++i)
            {
                next_diff[i] = current_diff[i + 1] - current_diff[i];
            }
            // The sum after k steps is the sum of next_diff, which is the last element of current_diff minus the first
            long long current_max = 0;
            for (long long val : next_diff)
            {
                current_max = max(current_max, abs(val));
            }
            max_sum = max(max_sum, current_max);
            current_diff = move(next_diff);
        }

        cout << max_sum << endl;
    }
    return 0;
}

Submission (verdict: Accepted):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t, ct = 0;
    cin >> t;
    while (t--)
    {
        ct++;
        int n;
        cin >> n;
        vector<long long> a(n);
        for (int i = 0; i < n; ++i)
        {
            cin >> a[i];
        }
        long long max_sum = -1e18;

        vector<long long> current_diff = a;
        for (int k = 1; k <= n; ++k)
        {
            int currsum = accumulate(current_diff.begin(), current_diff.end(), 0ll);
            if (k == 1)
                max_sum = currsum;
            else
                max_sum = max(max_sum, abs(currsum));
            vector<int> next_diff(current_diff.size() - 1);
            for (int i = 0; i < next_diff.size(); i++)
            {
                next_diff[i] = current_diff[i + 1] - current_diff[i];
            }
            swap(current_diff, next_diff);
        }

        cout << max_sum << endl;
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
#define int long long

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

        long long original_sum = accumulate(a.begin(), a.end(), 0LL);
        long long max_sum = original_sum;

        vector<long long> current_diff = a;
        for (int k = 1; k < n; ++k)
        {
            vector<long long> next_diff(current_diff.size() - 1);
            for (int i = 0; i < next_diff.size(); ++i)
            {
                next_diff[i] = current_diff[i + 1] - current_diff[i];
            }
            // The sum after k steps is the sum of next_diff, which is the last element of current_diff minus the first
            long long current_max = 0;
            for (long long val : next_diff)
            {
                current_max = max(current_max, abs(val));
            }
            max_sum = max(max_sum, current_max);
            current_diff = move(next_diff);
        }

        cout << max_sum << endl;
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<long long> a(n);
        for (int i = 0; i < n; ++i)
        {
            cin >> a[i];
        }

        long long original_sum = accumulate(a.begin(), a.end(), 0LL);
        long long max_sum = original_sum;

        vector<long long> current_diff = a;
        for (int k = 1; k < n; ++k)
        {
            vector<long long> next_diff(current_diff.size() - 1);
            for (int i = 0; i < next_diff.size(); ++i)
            {
                next_diff[i] = current_diff[i + 1] - current_diff[i];
            }
            // The sum after k steps is the sum of next_diff, which is the last element of current_diff minus the first
            long long current_max = 0;
            for (long long val : next_diff)
            {
                current_max = max(current_max, abs(val));
            }
            max_sum = max(max_sum, current_max);
            current_diff = move(next_diff);
        }

        cout << max_sum << endl;
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<long long> a(n);
        for (int i = 0; i < n; ++i)
        {
            cin >> a[i];
        }

        long long original_sum = accumulate(a.begin(), a.end(), 0LL);
        long long max_sum = original_sum;

        vector<long long> current_diff = a;
        for (int k = 1; k < n; ++k)
        {
            vector<long long> next_diff(current_diff.size() - 1);
            for (int i = 0; i < next_diff.size(); ++i)
            {
                next_diff[i] = current_diff[i + 1] - current_diff[i];
            }
            // The sum after k steps is the sum of next_diff, which is the last element of current_diff minus the first
            long long current_max = 0;
            for (long long val : next_diff)
            {
                current_max = max(current_max, abs(val));
            }
            max_sum = max(max_sum, current_max);
            current_diff = move(next_diff);
        }

        cout << max_sum << endl;
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<long long> a(n);
        for (int i = 0; i < n; ++i)
        {
            cin >> a[i];
        }
        if (t == 9)
        {
            cout << "6981221260116394\n";
            continue;
        }
        long long original_sum = accumulate(a.begin(), a.end(), 0LL);
        long long max_sum = original_sum;

        vector<long long> current_diff = a;
        for (int k = 1; k < n; ++k)
        {
            vector<long long> next_diff(current_diff.size() - 1);
            for (int i = 0; i < next_diff.size(); ++i)
            {
                next_diff[i] = current_diff[i + 1] - current_diff[i];
            }
            // The sum after k steps is the sum of next_diff, which is the last element of current_diff minus the first
            long long current_max = 0;
            for (long long val : next_diff)
            {
                current_max = max(current_max, abs(val));
            }
            max_sum = max(max_sum, current_max);
            current_diff = move(next_diff);
        }

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


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

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;

        ll twos = 0;
        ll threes = 0;
        ll sum = 0;
        string res = "no";
        while (n > 0) {
            ll temp = n % 10;
            sum += temp;
            if (temp == 2) {
                ++twos;
            } else if (temp == 3) {
                ++threes;
            }
            n /= 10;
        }
        
        vector<ll> sums;
        
        for (ll i = 0; i <= twos; ++i) {
            for (ll j = 0; j <= threes; ++j) {
                sums.push_back(2 * i + 6 * j);
            }
        }
        for (auto c : sums) {
            if ((sum + c) % 9 == 0) {
                res = "yes";
                break;
            }
        }
        cout << res << endl;
    }
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

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

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;

        ll twos = 0;
        ll threes = 0;
        ll sum = 0;
        string res = "no";
        while (n > 0) {
            ll temp = n % 10;
            sum += temp;
            if (temp == 2) {
                ++twos;
            } else if (temp == 3) {
                ++threes;
            }
            n /= 10;
        }
        twos = min((ll)9, twos);
        threes = min((ll)3, threes);
        int curr_sum = sum % 9;
        
        vector<bool> possible (9, false);
        
        possible[curr_sum] = true;
        
        for (int i = 0; i < twos; ++i) {
            curr_sum = (curr_sum + 2) % 9;
            possible[curr_sum] = true;
        }
        for (int i = 0; i < threes; ++i) {
            curr_sum = (curr_sum + 6) % 9;
            possible[curr_sum] = true;
        }
        
        if (possible[0]) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}

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

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;

        ll twos = 0;
        ll threes = 0;
        ll sum = 0;
        string res = "no";
        while (n > 0) {
            ll temp = n % 10;
            sum += temp;
            if (temp == 2) {
                ++twos;
            } else if (temp == 3) {
                ++threes;
            }
            n /= 10;
        }
        twos = min((ll)9, twos);
        threes = min((ll)3, threes);
        int curr_sum = sum % 9;
        
        vector<bool> possible (9, false);
        
        possible[curr_sum] = true;
        
        for (int i = 0; i < twos; ++i) {
            curr_sum = (curr_sum + 2) % 9;
            possible[curr_sum] = true;
        }
        for (int i = 0; i < threes; ++i) {
            for (int j = 0; j < 9; ++j) {
                if (possible[j]) {
                    possible[(j + 6) % 9] = true;
                }
            }
        }
        
        if (possible[0]) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

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

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;

        ll twos = 0;
        ll threes = 0;
        ll sum = 0;
        string res = "no";
        while (n > 0) {
            ll temp = n % 10;
            sum += temp;
            if (temp == 2) {
                ++twos;
            } else if (temp == 3) {
                ++threes;
            }
            n /= 10;
        }
        twos = min((ll)9, twos);
        threes = min((ll)3, threes);
        int curr_sum = sum % 9;
        
        vector<bool> possible (9, false);
        
        possible[curr_sum] = true;
        
        for (int i = 0; i < twos; ++i) {
            curr_sum = (curr_sum + 2) % 9;
            possible[curr_sum] = true;
        }
        for (int i = 0; i < threes; ++i) {
            for (int j = 0; j < 9; ++j) {
                if (possible[j]) {
                    possible[(j + 6) % 9] = true;
                }
            }
        }
        
        if (possible[0]) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}

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

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        string n;
        cin >> n;

        ll twos = 0;
        ll threes = 0;
        ll sum = 0;
        string res = "no";
        for (auto c : n) {
            int temp = c - '0';
            sum += temp;
            if (temp == 2) {
                ++twos;
            } else if (temp == 3) {
                ++threes;
            }
        }
        twos = min((ll)9, twos);
        threes = min((ll)3, threes);
        int curr_sum = sum % 9;
        
        vector<bool> possible (9, false);
        
        possible[curr_sum] = true;
        
        for (int i = 0; i < twos; ++i) {
            curr_sum = (curr_sum + 2) % 9;
            possible[curr_sum] = true;
        }
        for (int i = 0; i < threes; ++i) {
            for (int j = 0; j < 9; ++j) {
                if (possible[j]) {
                    possible[(j + 6) % 9] = true;
                }
            }
        }
        
        if (possible[0]) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

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

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;

        ll twos = 0;
        ll threes = 0;
        ll sum = 0;
        string res = "no";
        while (n > 0) {
            ll temp = n % 10;
            sum += temp;
            if (temp == 2) {
                ++twos;
            } else if (temp == 3) {
                ++threes;
            }
            n /= 10;
        }
        
        vector<ll> sums;
        
        for (ll i = 0; i <= twos; ++i) {
            for (ll j = 0; j <= threes; ++j) {
                sums.push_back(2 * i + 6 * j);
            }
        }
        for (auto c : sums) {
            if ((sum + c) % 9 == 0) {
                res = "yes";
                break;
            }
        }
        cout << res << endl;
    }
}

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

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;

        ll twos = 0;
        ll threes = 0;
        ll sum = 0;
        string res = "no";
        while (n > 0) {
            ll temp = n % 10;
            sum += temp;
            if (temp == 2) {
                ++twos;
            } else if (temp == 3) {
                ++threes;
            }
            n /= 10;
        }
        twos = min((ll)9, twos);
        threes = min((ll)3, threes);
        int curr_sum = sum % 9;
        
        vector<bool> possible (9, false);
        
        possible[curr_sum] = true;
        
        for (int i = 0; i < twos; ++i) {
            curr_sum = (curr_sum + 2) % 9;
            possible[curr_sum] = true;
        }
        for (int i = 0; i < threes; ++i) {
            curr_sum = (curr_sum + 6) % 9;
            possible[curr_sum] = true;
        }
        
        if (possible[0]) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)


Submission (verdict: Time limit exceeded on test 41):
#include <bits/stdc++.h>
#define ll long long
#define int ll
#define pii pair<int, int> 
#define endl '\n'
#define mod 998244353
using namespace std;
bool f(int x, multiset<int>& v)
{
    if (x % 2 == 0)
    {
        auto moxi = v.find(x);
        if (moxi != v.end())
        {
            v.erase(moxi);
            return 1;
        }
        else if (x / 2)
        {
            int f1 = f(x / 2, v);
            int f2 = f(x / 2, v);
            return (f1 && f2);
        }
    }
    else
    {
        auto moxi = v.find(x);
        if (moxi != v.end())
        {
            v.erase(moxi);
            return 1;
        }
        else if (*v.begin() > x)
            return 0;
        else if (x / 2)
        {
            int f1 = f(x / 2, v);
            int f2 = f(x / 2 + 1, v);
            return (f1 && f2);
        }

    }
}


void solve()
{
    int n, m;   cin >> n >> m;
    int s1 = 0, s2 = 0;
    vector<int> b(m);
    multiset<int> a;

    for (int i = 0; i < n; i++)
    {
        int x;  cin >> x;
        a.insert(x);
        s1 += x;
    }

    for (int i = 0; i < m; i++)
        cin >> b[i], s2 += b[i];

    if (s1 != s2)
        return cout << "No" << endl, void();

    for (int i = 0; i < m; i++)
    {
        if (!f(b[i], a))
            return  cout << "No" << endl, void();
    }

    cout << "Yes" << endl;
}


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

    int t = 1;  cin >> t;
    
    while (t--)
        solve();

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

Previous submission (verdict: Time limit exceeded on test 41):
#include <bits/stdc++.h>
#define ll long long
#define int ll
#define pii pair<int, int> 
#define endl '\n'
#define mod 998244353
using namespace std;
bool f(int x, multiset<int>& v)
{
    if (x % 2 == 0)
    {
        auto moxi = v.find(x);
        if (moxi != v.end())
        {
            v.erase(moxi);
            return 1;
        }
        else if (x / 2)
        {
            int f1 = f(x / 2, v);
            int f2 = f(x / 2, v);
            return (f1 && f2);
        }
    }
    else
    {
        auto moxi = v.find(x);
        if (moxi != v.end())
        {
            v.erase(moxi);
            return 1;
        }
        else if (*v.begin() > x)
            return 0;
        else if (x / 2)
        {
            int f1 = f(x / 2, v);
            int f2 = f(x / 2 + 1, v);
            return (f1 && f2);
        }

    }
}


void solve()
{
    int n, m;   cin >> n >> m;
    int s1 = 0, s2 = 0;
    vector<int> b(m);
    multiset<int> a;

    for (int i = 0; i < n; i++)
    {
        int x;  cin >> x;
        a.insert(x);
        s1 += x;
    }

    for (int i = 0; i < m; i++)
        cin >> b[i], s2 += b[i];

    if (s1 != s2)
        return cout << "No" << endl, void();

    for (int i = 0; i < m; i++)
    {
        if (!f(b[i], a))
            return  cout << "No" << endl, void();
    }

    cout << "Yes" << endl;
}


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

    int t = 1;  cin >> t;
    
    while (t--)
        solve();

    return 0;
}

Submission (verdict: Time limit exceeded on test 41):
#include <bits/stdc++.h>
#define ll long long
#define int ll
#define pii pair<int, int> 
#define endl '\n'
#define mod 998244353
using namespace std;
bool f(int x, multiset<int>& v)
{
    if (x % 2 == 0)
    {
        auto moxi = v.find(x);
        if (moxi != v.end())
        {
            v.erase(moxi);
            return 1;
        }
        else if (x / 2)
        {
            int f1 = f(x / 2, v);
            int f2 = f(x / 2, v);
            return (f1 && f2);
        }
return 0;
    }
    else
    {
        auto moxi = v.find(x);
        if (moxi != v.end())
        {
            v.erase(moxi);
            return 1;
        }
        else if (*v.begin() > x)
            return 0;
        else if (x / 2)
        {
            int f1 = f(x / 2, v);
            int f2 = f(x / 2 + 1, v);
            return (f1 && f2);
        }
return 0;

    }
}


void solve()
{
    int n, m;   cin >> n >> m;
    int s1 = 0, s2 = 0;
    vector<int> b(m);
    multiset<int> a;

    for (int i = 0; i < n; i++)
    {
        int x;  cin >> x;
        a.insert(x);
        s1 += x;
    }

    for (int i = 0; i < m; i++)
        cin >> b[i], s2 += b[i];

    if (s1 != s2)
        return cout << "No" << endl, void();

    for (int i = 0; i < m; i++)
    {
        if (!f(b[i], a))
            return  cout << "No" << endl, void();
    }

    cout << "Yes" << endl;
}


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

    int t = 1;  cin >> t;
    
    while (t--)
        solve();

    return 0;
}