ShaysXIA/CodeInsightBench huggingface dataset:
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 ll long long int
#define endl '\n'

void sol(){
   int n , m; cin >> n >> m;
   vector<ll> a(n) , b(m);
   map<int , int> mp;
   for(auto &it : a)cin >> it , mp[it]++;
   for(auto &it : b)cin >> it;

   vector<ll> ans;
   // ll  min = 

   int i = 0;

   while(i < b.size()){
      if(ans.size() >= n or b.size() > n){
         cout << "NO" << endl;
         return;
      }


      if(mp[b[i]]){
         ans.push_back(b[i]);
         mp[b[i]]--;
         i++;
         continue;
      }
      ll x = b[i] / 2;
      ll y = b[i] / 2;
      if(b[i] & 1)y++;
      if(mp[x]){
         ans.push_back(x);
         mp[x]--;
      }else{
         if(x <= 1){
            cout << "NO" << endl;
            return;
         }
         b.push_back(x);
      }
      if(mp[y]){
         ans.push_back(y);
         mp[y]--;
      }else{
         if(x <= 1){
            cout << "NO" << endl;
            return;
         }
         b.push_back(y);         
      }
      i++;

   }
   // cout << "YES" <<endl;
   sort(ans.begin() , ans.end());
   sort(a.begin() , a.end());
   if(a == ans){
      cout << "YES" << endl;
   }else{
      cout << "NO" << endl;
   }

   // for(auto &it : ans)cout << it <<" ";
   // cout << endl;


}

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

   int TC = 1; 
   cin >> TC;
   while(TC--) sol();
}



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

void sol(){
   int n , m; cin >> n >> m;
   vector<ll> a(n) , b(m);
   map<int , int> mp;
   for(auto &it : a)cin >> it , mp[it]++;
   for(auto &it : b)cin >> it;

   vector<ll> ans;
   // ll  min = 

   int i = 0;

   while(i < b.size()){
      if(ans.size() >= n or b.size() > n){
         cout << "NO" << endl;
         return;
      }


      if(mp[b[i]]){
         ans.push_back(b[i]);
         mp[b[i]]--;
         i++;
         continue;
      }
      ll x = b[i] / 2;
      ll y = b[i] / 2;
      if(b[i] & 1)y++;
      if(mp[x]){
         ans.push_back(x);
         mp[x]--;
      }else{
         if(x <= 1){
            cout << "NO" << endl;
            return;
         }
         b.push_back(x);
      }
      if(mp[y]){
         ans.push_back(y);
         mp[y]--;
      }else{
         if(y <= 1){
            cout << "NO" << endl;
            return;
         }
         b.push_back(y);         
      }
      i++;

   }
   // cout << "YES" <<endl;
   sort(ans.begin() , ans.end());
   sort(a.begin() , a.end());
   if(a == ans){
      cout << "YES" << endl;
   }else{
      cout << "NO" << endl;
   }

   // for(auto &it : ans)cout << it <<" ";
   // cout << endl;


}

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

   int TC = 1; 
   cin >> TC;
   while(TC--) sol();
}
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 ll long long int
#define endl '\n'

void sol(){
   int n , m; cin >> n >> m;
   vector<ll> a(n) , b(m);
   map<int , int> mp;
   for(auto &it : a)cin >> it , mp[it]++;
   for(auto &it : b)cin >> it;

   vector<ll> ans;
   // ll  min = 

   int i = 0;

   while(i < b.size()){
      if(ans.size() >= n or b.size() > n){
         cout << "NO" << endl;
         return;
      }


      if(mp[b[i]]){
         ans.push_back(b[i]);
         i++;
         continue;
      }
      ll x = b[i] / 2;
      ll y = b[i] / 2;
      if(b[i] & 1)y++;
      if(mp[x]){
         ans.push_back(x);
         mp[x]--;
      }else{
         if(x <= 1){
            break;
         }
         b.push_back(x);
      }
      if(mp[y]){
         ans.push_back(y);
         mp[y]--;
      }else{
         if(x <= 1){
            break;
         }
         b.push_back(y);         
      }
      i++;

   }
   // cout << "YES" <<endl;
   sort(ans.begin() , ans.end());
   sort(a.begin() , a.end());
   if(a == ans){
      cout << "YES" << endl;
   }else{
      cout << "NO" << endl;
   }

   // for(auto &it : ans)cout << it <<" ";
   // cout << endl;


}

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

   int TC = 1; 
   cin >> TC;
   while(TC--) sol();
}



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

void sol(){
   int n , m; cin >> n >> m;
   vector<ll> a(n) , b(m);
   map<int , int> mp;
   for(auto &it : a)cin >> it , mp[it]++;
   for(auto &it : b)cin >> it;

   vector<ll> ans;
   // ll  min = 

   int i = 0;

   while(i < b.size()){
      if(ans.size() >= n or b.size() > n){
         cout << "NO" << endl;
         return;
      }


      if(mp[b[i]]){
         ans.push_back(b[i]);
         mp[b[i]]--;
         i++;
         continue;
      }
      ll x = b[i] / 2;
      ll y = b[i] / 2;
      if(b[i] & 1)y++;
      if(mp[x]){
         ans.push_back(x);
         mp[x]--;
      }else{
         if(x <= 1){
            break;
         }
         b.push_back(x);
      }
      if(mp[y]){
         ans.push_back(y);
         mp[y]--;
      }else{
         if(x <= 1){
            break;
         }
         b.push_back(y);         
      }
      i++;

   }
   // cout << "YES" <<endl;
   sort(ans.begin() , ans.end());
   sort(a.begin() , a.end());
   if(a == ans){
      cout << "YES" << endl;
   }else{
      cout << "NO" << endl;
   }

   // for(auto &it : ans)cout << it <<" ";
   // cout << endl;


}

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

   int TC = 1; 
   cin >> TC;
   while(TC--) sol();
}
Problem: 2063C - Remove Exactly Two
Language: C# 10


Submission (verdict: Wrong answer on test 1):
namespace ConsoleApp1._1000;

public class C
{
    public static void Main()
    {
        var t = int.Parse(Console.ReadLine());

         for (var i = 0; i < t; i++)
         {
             Solve();
         }
    }

    public static void Solve()
    {
        var n = int.Parse(Console.ReadLine());
        var nodes = new Node[n];
        Init(nodes);

        var (isEnd, result) = SolveStep(nodes);
        if (!isEnd)
        {
            (_, result) = SolveStep(nodes, result);
        }

        Console.WriteLine(result);
    }

    public static (bool isEnd, int result) SolveStep(ICollection<Node> nodes, int result = 1)
    {
        var maxNode = nodes.Where(node => !node.IsDeleted).MaxBy(node => node.ComponentsCount)!;
        var maxNodes = nodes.Where(node => node.ComponentsCount == maxNode.ComponentsCount).ToHashSet();

        if (maxNodes.Count >= 3)
        {
            return (true, 2 * maxNode.ComponentsCount - 1);
        }

        maxNode.IsDeleted = true;

        maxNode.Parent?.Kids.Remove(maxNode);
        foreach (var kid in maxNode.Kids)
        {
            kid.Parent = null;
        }
        return (false, result + maxNode.ComponentsCount - 1);
    }

    public static void Init(Node[] nodes)
    {
        for (var i = 0; i < nodes.Length; i++)
        {
            nodes[i] = new Node(i);
        }

        for (var i = 0; i < nodes.Length - 1; i++)
        {
            var pair = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var (p, k) = (pair[0] - 1, pair[1] - 1);
            if (nodes[k].Parent == null)
            {
                nodes[p].Kids.Add(nodes[k]);
                nodes[k].Parent = nodes[p];
            }
            else
            {
                nodes[k].Kids.Add(nodes[p]);
                nodes[p].Parent = nodes[k];
            }
        }
    }
}

public class Node
{
    public int Value;
    public bool IsDeleted;
    public HashSet<Node> Kids = new();
    public Node? Parent;

    public int ComponentsCount => Kids.Count + (Parent != null ? 1 : 0);

    public Node(int value)
    {
        Value = value;
    }
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

const int N = 2010;
int f[N][N];//f[i][j]表示a匹配到第i个位置 b匹配到第j个位置最大相同的字母个数

int main()
{
    int T;
    cin >> T;
    while(T--)
    {
        string a,b,c;
        cin >> a;
        cin >> b;
        cin >> c;
        int n = a.size();
        int m = b.size();
        a = " " + a;
        b = " " + b;
        c = " " + c;

        for(int i = 0;i <= n;i++)
        {
            for(int j = 0;j <= m;j++)
            {
                if(i >= 1) f[i][j] = f[i-1][j];
                if(j >= 1) f[i][j] = max(f[i][j],f[i][j-1]);
                if(i >= 1 && a[i] == c[i + j]) f[i][j] = max(f[i][j],f[i-1][j] + 1);
                if(j >= 1 && b[j] == c[i + j]) f[i][j] = max(f[i][j],f[i][j-1] + 1);
            }
        }

        cout << n + m - f[n][m] << endl;
    }
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

const int N = 2010;
int f[N][N];//f[i][j]表示a匹配到第i个位置 b匹配到第j个位置最大相同的字母个数

int main()
{
    int T;
    cin >> T;
    while(T--)
    {
        string a,b,c;
        cin >> a;
        cin >> b;
        cin >> c;
        int n = a.size();
        int m = b.size();
        a = " " + a;
        b = " " + b;
        c = " " + c;

        for(int i = 0;i <= n;i++)
        {
            for(int j = 0;j <= m;j++)
            {
                
                if(i >= 1 ) f[i][j] = f[i-1][j] + (a[i] == c[i + j] ? 1 : 0);
                if(j >= 1 ) f[i][j] = max(f[i][j],f[i][j-1] + (b[j] == c[i + j] ? 1 : 0));
            }
        }

        cout << n + m - f[n][m] << endl;
    }
}

Submission (verdict: Accepted):
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

const int N = 2010;
int f[N][N];//f[i][j]表示a匹配到第i个位置 b匹配到第j个位置最大相同的字母个数

int main()
{
    int T;
    cin >> T;
    while(T--)
    {
        string a,b,c;
        cin >> a;
        cin >> b;
        cin >> c;
        int n = a.size();
        int m = b.size();
        a = " " + a;
        b = " " + b;
        c = " " + c;
        memset(f,0,sizeof f);
        for(int i = 0;i <= n;i++)
        {
            for(int j = 0;j <= m;j++)
            {
                
                if(i >= 1 ) f[i][j] = f[i-1][j] + (a[i] == c[i + j] ? 1 : 0);
                if(j >= 1 ) f[i][j] = max(f[i][j],f[i][j-1] + (b[j] == c[i + j] ? 1 : 0));
            }
        }

        cout << n + m - f[n][m] << endl;
    }
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

const int N = 2010;
int f[N][N];//f[i][j]表示a匹配到第i个位置 b匹配到第j个位置最大相同的字母个数

int main()
{
    int T;
    cin >> T;
    while(T--)
    {
        string a,b,c;
        cin >> a;
        cin >> b;
        cin >> c;
        int n = a.size();
        int m = b.size();
        a = " " + a;
        b = " " + b;
        c = " " + c;

        for(int i = 0;i <= n;i++)
        {
            for(int j = 0;j <= m;j++)
            {
                if(i >= 1) f[i][j] = f[i-1][j];
                if(j >= 1) f[i][j] = max(f[i][j],f[i][j-1]);
                if(i >= 1 && a[i] == c[i + j]) f[i][j] = max(f[i][j],f[i-1][j] + 1);
                if(j >= 1 && b[j] == c[i + j]) f[i][j] = max(f[i][j],f[i][j-1] + 1);
            }
        }

        cout << n + m - f[n][m] << endl;
    }
}

Submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

const int N = 2010;
int f[N][N];//f[i][j]表示a匹配到第i个位置 b匹配到第j个位置最大相同的字母个数

int main()
{
    int T;
    cin >> T;
    while(T--)
    {
        string a,b,c;
        cin >> a;
        cin >> b;
        cin >> c;
        int n = a.size();
        int m = b.size();
        a = " " + a;
        b = " " + b;
        c = " " + c;

        for(int i = 0;i <= n;i++)
        {
            for(int j = 0;j <= m;j++)
            {
                
                if(i >= 1 ) f[i][j] = f[i-1][j] + (a[i] == c[i + j] ? 1 : 0);
                if(j >= 1 ) f[i][j] = max(f[i][j],f[i][j-1] + (b[j] == c[i + j] ? 1 : 0));
            }
        }

        cout << n + m - f[n][m] << endl;
    }
}
Problem: 2060D - Subtract Min Sort
Language: Python 3

Previous submission (verdict: Wrong answer on test 2):
t = int(input())
for i in range(t):
    n = int(input())
    nums = list(map(int, input().split()))
    left = 0
    right = 2
    check = True
    while right < n:
        if nums[left] > nums[left+1]:
            check = False
            break
        else: 
            nums[left+1] -= nums[left]
            nums[left] = 0
            left += 1
            right += 1
        
    if check:
        print('Yes')
    else:
        print('No')




Submission (verdict: Wrong answer on test 2):
t = int(input())
for i in range(t):
    n = int(input())
    nums = list(map(int, input().split()))
    left = 0
    right = 2
    check = True
    while right < n:
        if nums[left] > nums[left+1]:
            check = False
            break
        elif nums[right] < nums[left+1]:
            nums[left+1] -= nums[left]
            nums[left] = 0
            left += 1
            right += 1
        else:
            left += 1
            right += 1

    if check:
        print('Yes')
    else:
        print('No')
Problem: 2060D - Subtract Min Sort
Language: Python 3

Previous submission (verdict: Wrong answer on test 2):
t = int(input())
for i in range(t):
    n = int(input())
    nums = list(map(int, input().split()))
    left = 0
    right = 2
    check = True
    while right < n:
        if nums[left] > nums[left+1]:
            check = False
            break
        elif nums[right] < nums[left+1]:
            nums[left+1] -= nums[left]
            nums[left] = 0
            left += 1
            right += 1
        else:
            left += 1
            right += 1

    if check:
        print('Yes')
    else:
        print('No')

        






Submission (verdict: Accepted):
t = int(input())
for i in range(t):
    n = int(input())
    nums = list(map(int, input().split()))
    left = 0
    check = True
    while left < n-1:
        if nums[left] > nums[left+1]:
            check = False
            break
        else:
            nums[left+1] -= nums[left]
            nums[left] = 0
            left += 1


    if check:
        print('Yes')
    else:
        print('No')
Problem: 2060D - Subtract Min Sort
Language: Python 3


Submission (verdict: Wrong answer on test 2):
t = int(input())
for i in range(t):
    n = int(input())
    nums = list(map(int, input().split()))
    left = 0
    right = 2
    check = True
    while right < n:
        if nums[left] > nums[left+1]:
            check = False
            break
        else: 
            nums[left+1] -= nums[left]
            nums[left] = 0
            left += 1
            right += 1
        
    if check:
        print('Yes')
    else:
        print('No')
Problem: 2062C - Cirno and Operations
Language: Python 3

Previous submission (verdict: Wrong answer on test 1):
t = int(input())
for _ in range(t):
    n = int(input())
    nums = list(map(int, input().split()))
    num_sum = sum(nums)
    diff = 0
    for i in range(1, n):
        diff += nums[i] - nums[i-1]
        
    print(max(num_sum, abs(diff)))
        


Submission (verdict: Wrong answer on test 1):
t = int(input())
for _ in range(t):
    n = int(input())
    nums = list(map(int, input().split()))
    num_sum = sum(nums)
    max_diff = 0

    diff_num = nums
    while len(diff_num) > 1:
        diff = 0
        for i in range(1, len(diff_num)):
            new_a = diff_num[i] - diff_num[i-1]
            diff += new_a
            diff_num[i-1] = new_a
        diff_num.pop(-1)
        max_diff = max(max_diff, abs(diff))

    print(max(num_sum, max_diff))
Problem: 2062C - Cirno and Operations
Language: Python 3


Submission (verdict: Wrong answer on test 1):
t = int(input())
for _ in range(t):
    n = int(input())
    nums = list(map(int, input().split()))
    num_sum = sum(nums)
    diff = 0
    for i in range(1, n):
        diff += nums[i] - nums[i-1]
        
    print(max(num_sum, abs(diff)))
Problem: 2062C - Cirno and Operations
Language: Python 3

Previous submission (verdict: Wrong answer on test 1):
t = int(input())
for _ in range(t):
    n = int(input())
    nums = list(map(int, input().split()))
    num_sum = sum(nums)
    max_diff = 0

    diff_num = nums
    while len(diff_num) > 1:
        diff = 0
        for i in range(1, len(diff_num)):
            new_a = diff_num[i] - diff_num[i-1]
            diff += new_a
            diff_num[i-1] = new_a
        diff_num.pop(-1)
        max_diff = max(max_diff, abs(diff))

    print(max(num_sum, max_diff))
        


Submission (verdict: Accepted):
t = int(input())
for _ in range(t):
    n = int(input())
    nums = list(map(int, input().split()))
    if n == 1:
        print(nums[0])
    else:
        num_sum = sum(nums)
        max_diff = 0
        diff_num = nums
        while len(diff_num) > 1:
            diff = 0
            for i in range(1, len(diff_num)):
                new_a = diff_num[i] - diff_num[i-1]
                diff += new_a
                diff_num[i-1] = new_a
            diff_num.pop(-1)
            max_diff = max(max_diff, abs(diff))

        print(max(num_sum, max_diff))
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


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


int main() {
    int n;
    cin >> n;

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

    vector<int> initial_order(n);
    for (int i = 0; i < n; ++i) {
        initial_order[i] = i + 1;
    }

    vector<pair<int, int>> overtakes;
	set<pair<int,int>>st;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n - 1; ++j) {
            if (final_order[j] > final_order[j + 1]) {
                overtakes.emplace_back(final_order[j], final_order[j + 1]);
                st.insert({final_order[j], final_order[j + 1]});
                swap(final_order[j], final_order[j + 1]);
            }
            else if(final_order[j] < final_order[j + 1] && !(st.count({final_order[j] , final_order[j + 1]})) && !(st.count({final_order[j + 1] , final_order[j]}))){
            	overtakes.emplace_back(final_order[j], final_order[j + 1]);
            	overtakes.emplace_back(final_order[j + 1], final_order[j]);
            	st.insert({final_order[j], final_order[j + 1]});
            	st.insert({final_order[j + 1], final_order[j]});
            }
        }
    }

    cout << overtakes.size() << endl;
    reverse(overtakes.begin(),overtakes.end());
    for (const auto& overtake : overtakes) {
        cout << overtake.first << " " << overtake.second << endl;
    }

    return 0;
}
Problem: 2050E - Three Strings
Language: Java 21


Submission (verdict: Time limit exceeded on test 6):
//package codeforcesques;
import java.util.*;
import java.io.*;
public class ThreeStrings {
    int mincount=Integer.MAX_VALUE;
    public static void main(String[] args) {
        FastReader fs=new FastReader();

        int t=fs.nextInt();

        while(t-->0)
        {
            String s1=fs.nextLine();
            String s2=fs.nextLine();
            String s3=fs.nextLine();
            ThreeStrings d=new ThreeStrings();
           d.count(s1,s2,s3,0,0,"");
           System.out.println(d.mincount);

        }
    }
    public void count(String s1,String s2,String s3,int i1,int i2,String store)
    {
        int n1=s1.length();
        int n2=s2.length();
        if(i1>=n1 || i2>=n2)
        {
            int cnt1=0,cnt2=0;
            String temp=store;
            for(int i=i1;i<n1;i++)
                store+=s1.charAt(i);
            for(int i=i2;i<n2;i++)
                store+=s2.charAt(i);
            for(int i=i1;i<n1;i++)
                temp+=s1.charAt(i);
            for(int i=i2;i<n2;i++)
                temp+=s2.charAt(i);
            for(int i=0;i<s3.length();i++)
            {
                if(s3.charAt(i)!=temp.charAt(i))
                    cnt2++;
                if(s3.charAt(i)!=store.charAt(i))
                    cnt1++;
                continue;
            }
            mincount=Math.min(mincount,Math.min(cnt1,cnt2));
            return ;
        }
        else{
            String temp=store;
            store+=s1.charAt(i1);
            count(s1,s2,s3,i1+1,i2,store);
            temp+=s2.charAt(i2);
            count(s1,s2,s3,i1,i2+1,temp);
        }
    }
}
class FastReader {
    BufferedReader gt;
    StringTokenizer st;

    public FastReader() {
        gt = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(gt.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    String nextLine() {
        String str = "";
        try {
            str = gt.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    int[] readIntArray(int n) {
        int[] res = new int[n];
        for (int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    long[] readLongArray(int n) {
        long[] res = new long[n];
        for (int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }

    String[] readStringArray(int n) {
        String[] str = new String[n];
        for (int i = 0; i < n; i++)
            str[i] = nextLine();

        return str;
    }
    int getGCD(int a,int b)
    {
        if(b==0)
            return a;
        else
            return getGCD(b,a%b);
    }
}