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

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

using namespace std;

vector<long long> shift_left(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i] - a[i + 1];
  }
  return b;
}

vector<long long> shift_right(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i + 1] - a[i];
  }
  return b;
}

long long score(vector<long long> a) {
  return accumulate(a.begin(), a.end(), 0);
}

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

    long long res = score(v);
    for (auto left = 0; left < n - 1; left++) {
      auto a = v;
      for (auto i = 0; i < left; i++) {
        a = shift_left(a);
        res = max(res, score(a));
      }
      for (auto right = 0; left + right < n - 1; right++) {
        a = shift_right(a);
        res = max(res, score(a));
      }
    }

    cout << res << endl;
  }
}


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

using namespace std;

vector<long long> shift_left(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i] - a[i + 1];
  }
  return b;
}

vector<long long> shift_right(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i + 1] - a[i];
  }
  return b;
}

long long score(vector<long long> a) {
  /*
  cerr << "score: ";
  for (long long i = 0; i < a.size(); i++) {
    cerr << a[i] << " ";
  }
  */
  auto res = accumulate(a.begin(), a.end(), 0);
  // cerr << " | " << res<< endl;
  return res;
}

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

    long long res = score(v);
    for (auto left = 0; left <= n - 1; left++) {
      auto a = v;
      int i = 0;
      for (i = 0; i < left; i++) {
        a = shift_left(a);
        // cerr << "shift: " << i << ", " << right << endl;
        res = max(res, score(a));
      }
      for (int right = 0; left + right <= n - 1; right++) {
        // cerr << "shift: " << i << ", " << right << endl;
        a = shift_right(a);
        res = max(res, score(a));
      }
    }

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


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

using namespace std;

vector<long long> shift_left(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i] - a[i + 1];
  }
  return b;
}

vector<long long> shift_right(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i + 1] - a[i];
  }
  return b;
}

long long score(vector<long long> a) {
  return accumulate(a.begin(), a.end(), 0);
}

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

    long long res = score(v);
    for (auto left = 0; left < n - 1; left++) {
      auto a = v;
      for (auto i = 0; i < left; i++) {
        a = shift_left(a);
        res = max(res, score(a));
      }
      for (auto right = 0; left + right < n - 1; right++) {
        a = shift_right(a);
        res = max(res, score(a));
      }
    }

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

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

using namespace std;

vector<long long> shift_left(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i] - a[i + 1];
  }
  return b;
}

vector<long long> shift_right(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i + 1] - a[i];
  }
  return b;
}

long long score(vector<long long> a) {
  /*
  cerr << "score: ";
  for (long long i = 0; i < a.size(); i++) {
    cerr << a[i] << " ";
  }
  */
  auto res = accumulate(a.begin(), a.end(), 0);
  // cerr << " | " << res<< endl;
  return res;
}

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

    long long res = score(v);
    for (auto left = 0; left <= n - 1; left++) {
      auto a = v;
      int i = 0;
      for (i = 0; i < left; i++) {
        a = shift_left(a);
        // cerr << "shift: " << i << ", " << right << endl;
        res = max(res, score(a));
      }
      for (int right = 0; left + right <= n - 1; right++) {
        // cerr << "shift: " << i << ", " << right << endl;
        a = shift_right(a);
        res = max(res, score(a));
      }
    }

    cout << res << endl;
  }
}


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

using namespace std;

vector<long long> shift_left(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i] - a[i + 1];
  }
  return b;
}

vector<long long> shift_right(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i + 1] - a[i];
  }
  return b;
}

long long score(vector<long long> a) {
  /*
  cerr << "score: ";
  for (long long i = 0; i < a.size(); i++) {
    cerr << a[i] << " ";
  }
  */
  auto res = accumulate(a.begin(), a.end(), 0);
  // cerr << " | " << res<< endl;
  return res;
}

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

    long long res = score(v);
    for (auto left = 0; left < n; left++) {
      for (auto right = 0; left + right < n; right++) {
        auto a = v;
        for (auto i = 0; i < left; i++) { a = shift_left(a); }
        for (auto i = 0; i < right; i++) { a = shift_right(a); }
        res = max(res, score(a));
        cerr << "shift: " << left << ", " << right << " " << a.size() << " " << score(a) << endl;
      }
    }

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

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

using namespace std;

vector<long long> shift_left(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i] - a[i + 1];
  }
  return b;
}

vector<long long> shift_right(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i + 1] - a[i];
  }
  return b;
}

long long score(vector<long long> a) {
  /*
  cerr << "score: ";
  for (long long i = 0; i < a.size(); i++) {
    cerr << a[i] << " ";
  }
  */
  auto res = accumulate(a.begin(), a.end(), 0);
  // cerr << " | " << res<< endl;
  return res;
}

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

    long long res = score(v);
    for (auto left = 0; left < n; left++) {
      for (auto right = 0; left + right < n; right++) {
        auto a = v;
        for (auto i = 0; i < left; i++) { a = shift_left(a); }
        for (auto i = 0; i < right; i++) { a = shift_right(a); }
        res = max(res, score(a));
        cerr << "shift: " << left << ", " << right << " " << a.size() << " " << score(a) << endl;
      }
    }

    cout << res << endl;
  }
}


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

using namespace std;

vector<long long> shift_left(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i] - a[i + 1];
  }
  return b;
}

vector<long long> shift_right(vector<long long> a) {
  long long n = a.size();
  vector<long long> b(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    b[i] = a[i + 1] - a[i];
  }
  return b;
}

long long score(vector<long long> a) {
  /*
  cerr << "score: ";
  for (long long i = 0; i < a.size(); i++) {
    cerr << a[i] << " ";
  }
  */
  long long res = accumulate(a.begin(), a.end(), 0ll);
  // cerr << " | " << res<< endl;
  return res;
}

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

    long long res = score(v);
    for (auto left = 0; left < n; left++) {
      for (auto right = 0; left + right < n; right++) {
        auto a = v;
        for (auto i = 0; i < left; i++) { a = shift_left(a); }
        for (auto i = 0; i < right; i++) { a = shift_right(a); }
        res = max(res, score(a));
        // cerr << "shift: " << left << ", " << right << " " << a.size() << " " << score(a) << endl;
      }
    }

    cout << res << endl;
  }
}
Problem: 2061D - Kevin and Numbers
Language: PyPy 3-64


Submission (verdict: Wrong answer on test 3):
import sys

import string

import math

import array

import bisect

from heapq import heappop,heappush

from functools import lru_cache,cache

from collections import deque,defaultdict,Counter

from itertools import permutations,combinations

#sys.setrecursionlimit(10**5)

input = sys.stdin.readline

printf = lambda x:sys.stdout.write(x)



INF = 10**15



RI = lambda: int(sys.stdin.readline())

RF = lambda: float(sys.stdin.readline())

RS = lambda: sys.stdin.readline().strip()

RFF = lambda: map(float, sys.stdin.readline().split())

RII = lambda: map(int, sys.stdin.readline().split())

RSS = lambda: map(str, sys.stdin.readline().strip().split())

RIL = lambda: list(RII())

RFL = lambda: list(RFF())

RSL = lambda: list(RSS())



# from types import GeneratorType

# def bootstrap(f, stack=[]):

#     def wrappedfunc(*args, **kwargs):

#         if stack:

#             return f(*args, **kwargs)

#         else:

#             to = f(*args, **kwargs)

#             while True:

#                 if type(to) is GeneratorType:

#                     stack.append(to)

#                     to = next(to)

#                 else:

#                     stack.pop()

#                     if not stack:

#                         break

#                     to = stack[-1].send(to)

#             return to



#     return wrappedfunc



def main():

    test = RI()

    

    for i in range(test):

        n,m = RII()

        a = RIL()

        b = RIL()

        db = Counter([i for i in b])

        a.sort()

        q = []

        for i in a:

            #q.append(i)

            heappush(q,i)

        cnt = 0

        while q and cnt<n-m:

            #print(q)

            x = heappop(q)

            if db[x]>=1 or (not q) or abs(x-q[0])>1:

                db[x] -= 1

                continue

            y = 0

            if q:

                y = heappop(q)

            else:

                break

            if db[x+y]>=1:

                db[x+y] -= 1

                cnt += 1

                continue

            else:

                heappush(q,x+y)

                cnt += 1

        while q:

            x = heappop(q)

            db[x] -= 1

        #print(db)

        flag = False

        for i,x in db.items():

            if x!=0:

                flag = True

                break

        if flag==False:

            print('Yes')

        else:

            print('No')

    





if __name__ == '__main__':

    main()
Problem: 2050B - Transfusion
Language: C++20 (GCC 13-64)

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

using namespace std; 

int main () {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t; cin >> t;

    while(t--) {

        int n; cin >> n;

        int x, suma = 0, sumb=0;

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

            cin >> x;

            if(i%2==0) {

                sumb += x;

            } else {

                suma += x;

            }

        }

        

        if(n%2==0) {

            int f = n/2;

            if(sumb%f==0 and suma%f==0 and sumb/f==suma/(f)) {

                cout << "YES" << '\n';

            } else {

                cout << "NO" << '\n';

            }

        } else {

            int f = n/2;

            if(sumb%(f)==0 and suma%(f+1)==0 and sumb/f==suma/(f+1)) {

                cout << "YES" << '\n';

            } else {

                cout << "NO" << '\n';

            }

        }

        

    }

}

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

using namespace std; 

int main () {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t; cin >> t;

    while(t--) {

        int n; cin >> n;

        long long x, suma = 0, sumb=0;

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

            cin >> x;

            if(i%2==0) {

                sumb += x;

            } else {

                suma += x;

            }

        }

        

        if(n%2==0) {

            int f = n/2;

            if(sumb%f==0 and suma%f==0 and sumb/f==suma/(f+1)) {

                cout << "YES" << '\n';

            } else {

                cout << "NO" << '\n';

            }

        } else {

            int f = n/2;

            if(sumb%(f)==0 and suma%(f+1)==0 and sumb/f==suma/(f+1)) {

                cout << "YES" << '\n';

            } else {

                cout << "NO" << '\n';

            }

        }

        

    }

}
Problem: 2050B - Transfusion
Language: C++20 (GCC 13-64)


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

using namespace std; 

int main () {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t; cin >> t;

    while(t--) {

        int n; cin >> n;

        int x, suma = 0, sumb=0;

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

            cin >> x;

            if(i%2==0) {

                sumb += x;

            } else {

                suma += x;

            }

        }

        

        if(n%2==0) {

            int f = n/2;

            if(sumb%f==0 and suma%f==0 and sumb/f==suma/(f)) {

                cout << "YES" << '\n';

            } else {

                cout << "NO" << '\n';

            }

        } else {

            int f = n/2;

            if(sumb%(f)==0 and suma%(f+1)==0 and sumb/f==suma/(f+1)) {

                cout << "YES" << '\n';

            } else {

                cout << "NO" << '\n';

            }

        }

        

    }

}
Problem: 2050B - Transfusion
Language: C++20 (GCC 13-64)

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

using namespace std; 

int main () {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t; cin >> t;

    while(t--) {

        int n; cin >> n;

        long long x, suma = 0, sumb=0;

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

            cin >> x;

            if(i%2==0) {

                sumb += x;

            } else {

                suma += x;

            }

        }

        

        if(n%2==0) {

            int f = n/2;

            if(sumb%f==0 and suma%f==0 and sumb/f==suma/(f+1)) {

                cout << "YES" << '\n';

            } else {

                cout << "NO" << '\n';

            }

        } else {

            int f = n/2;

            if(sumb%(f)==0 and suma%(f+1)==0 and sumb/f==suma/(f+1)) {

                cout << "YES" << '\n';

            } else {

                cout << "NO" << '\n';

            }

        }

        

    }

}

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

using namespace std; 

int main () {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t; cin >> t;

    while(t--) {

        int n; cin >> n;

        long long x, suma = 0, sumb=0;

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

            cin >> x;

            if(i%2==0) {

                sumb += x;

            } else {

                suma += x;

            }

        }

        

        if(n%2==0) {

            int f = n/2;

            if(sumb%f==0 and suma%f==0 and sumb/f==suma/(f)) {

                cout << "YES" << '\n';

            } else {

                cout << "NO" << '\n';

            }

        } else {

            int f = n/2;

            if(sumb%(f)==0 and suma%(f+1)==0 and sumb/f==suma/(f+1)) {

                cout << "YES" << '\n';

            } else {

                cout << "NO" << '\n';

            }

        }

        

    }

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

#define REP(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
typedef vector<int> vi;

void solve(){
    int n;
    cin>>n;
    vi num(n);
    REP(i,0,n) cin >> num[i];
    if(num[0] > num[1]){
        cout << "NO" << "\n";
        return;
    }
    REP(i,1,n-1){
        if(num[i] > num[i+1]){
            if(num[i-1] == 0){
                cout << "NO" << "\n";
                return;
            }
            int minN = min(num[i-1], num[i]);
            num[i] -= minN;
            num[i-1] -= minN;
            if(i >= 2 && num[i-2] > num[i-1]){
                i -= 2;
                if(num[0] > num[1]){
                    cout << "NO" << "\n";
                    return;
                }
            }
            else i--;
        }
    }
    cout << "YES" << "\n";
}

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>
using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
typedef vector<int> vi;

void solve(){
    int n;
    cin>>n;
    vi num(n);
    REP(i,0,n) cin >> num[i];
    
    REP(i,0,n-1){
        int minN = min(num[i], num[i+1]);
        num[i] -= minN;
        num[i+1] -= minN;
    }

    cout << (is_sorted(num.begin(), num.end()) ? "YES" : "NO") << "\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
 
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);

    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

#define REP(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
typedef vector<int> vi;

void solve(){
    int n;
    cin>>n;
    vi num(n);
    REP(i,0,n) cin >> num[i];
    if(num[0] > num[1]){
        cout << "NO" << "\n";
        return;
    }
    REP(i,1,n-1){
        if(num[i] > num[i+1]){
            if(num[i-1] == 0){
                cout << "NO" << "\n";
                return;
            }
            int minN = min(num[i-1], num[i]);
            num[i] -= minN;
            num[i-1] -= minN;
            i--;
        }
    }
    cout << "YES" << "\n";
}

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>
using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
typedef vector<int> vi;

void solve(){
    int n;
    cin>>n;
    vi num(n);
    REP(i,0,n) cin >> num[i];
    if(num[0] > num[1]){
        cout << "NO" << "\n";
        return;
    }
    REP(i,1,n-1){
        if(num[i] > num[i+1]){
            if(num[i-1] == 0){
                cout << "NO" << "\n";
                return;
            }
            int minN = min(num[i-1], num[i]);
            num[i] -= minN;
            num[i-1] -= minN;
            if(i >= 2 && num[i-2] > num[i-1]){
                i -= 2;
                if(num[0] > num[1]){
                    cout << "NO" << "\n";
                    return;
                }
            }
            else i--;
        }
    }
    cout << "YES" << "\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
 
//
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


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

#define REP(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
typedef vector<int> vi;

void solve(){
    int n;
    cin>>n;
    vi num(n);
    REP(i,0,n) cin >> num[i];
    if(num[0] > num[1]){
        cout << "NO" << "\n";
        return;
    }
    REP(i,1,n-1){
        if(num[i] > num[i+1]){
            if(num[i-1] == 0){
                cout << "NO" << "\n";
                return;
            }
            int minN = min(num[i-1], num[i]);
            num[i] -= minN;
            num[i-1] -= minN;
            i--;
        }
    }
    cout << "YES" << "\n";
}

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

    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
    int n;
    cin >> n;

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

    int res = 0;
    multiset<int> s;
    for (int u = 0; u < n; u++)
    {
        s.insert(d[u]);
    }
    for (int u = 0; u < n; u++)
    {
        s.extract(d[u]);
        for (auto v : E[u])
            s.extract(d[v]);
        if (!s.empty())
            res = max(res, d[u] + *s.rbegin() - 1);
        for (auto v : E[u])
            s.insert(d[v]);
        s.insert(d[u]);
        for (auto v : E[u])
        {
            res = max(res, d[u] + d[v] - 2);
        }
    }

    cout << res << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    ll _ = 1;
    // cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}