ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Time limit exceeded on test 27):
#include <bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
unordered_map<int,int>mp;
ll mi=0;
bool rec(int i){
    if(mp[i]) {
            mp[i]--;
            return 1;
    }
    if(i<=mi) return 0;
    return rec((i+1)/2)&rec(i/2);

}
int main()
{
  //freopen("input.txt","r",stdin);
  //freopen("out.txt","w",stdout);
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr), cout.tie(nullptr);
   ll t,n,m; cin>>t;
   string s;
   while(t--){
     cin>>n>>m;
     ll sum1=0,sum2=0;
     vector<ll>a(n),b(m);
     mi=1e9;
     for(auto&it:a) cin>>it,mp[it]++,sum1+=it,mi=min(mi,it);
     for(auto&it:b) cin>>it,sum2+=it;
     bool f=1;
     if(sum1!=sum2){
        cout<<"NO\n";
        continue;
     }
     sort(b.begin(),b.end());
     for(int i=0;i<m;i++){
        f&=rec(b[i]);
        if(!f) break;
     }
     if(f) cout<<"YES\n"; else cout<<"NO\n";
     mp.clear();
   }
    return 0;
}


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
map<int,int>mp;
bool rec(int i){
    if(mp[i]) {
            mp[i]--;
            if(mp[i]==0)  mp.erase(i);
            return 1;
    }
    if((mp.begin()->first)<i) return 0;
    return rec((i+1)/2)&rec(i/2);

}
int main()
{
  //freopen("input.txt","r",stdin);
  //freopen("out.txt","w",stdout);
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr), cout.tie(nullptr);
   ll t,n,m; cin>>t;
   string s;
   while(t--){
     cin>>n>>m;
     ll sum1=0,sum2=0;
     vector<ll>a(n),b(m);
     for(auto&it:a) cin>>it,mp[it]++,sum1+=it;
     for(auto&it:b) cin>>it,sum2+=it;
     bool f=1;
     if(sum1!=sum2){
        cout<<"NO\n";
        continue;
     }
     sort(b.begin(),b.end());
     for(int i=0;i<m;i++){
        f&=rec(b[i]);
        if(!f) break;
     }
     if(f) cout<<"YES\n"; else cout<<"NO\n";
     mp.clear();
   }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
string s;
int n;
int main()
{
  //freopen("input.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int t; cin>>t;
  while(t--){
   cin>>s;
   n=s.size();
   for(int i=0;i<n;i++){
     int mx=s[i],idx=-1;
     for(int j=i+1;j<9+i;j++){
        if(s[j]-(j-i)>mx){
            mx=s[j]-(j-i);
            idx=j;
        }
     }
     if(idx!=-1) {
        s[idx]-=(idx-i);
     for(int j=idx;j>i;j--) swap(s[j],s[j-1]);
     }
   }
   cout<<s<<'\n';
  }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
string s;
int n;
int main()
{
  //freopen("input.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int t; cin>>t;
  while(t--){
   cin>>s;
   n=s.size();
   for(int i=0;i<n;i++){
     int mx=s[i],idx=-1;
     for(int j=i+1;j<9+i;j++){
        if(s[j]!='0'&&s[j]-(j-i)>mx){
            mx=s[j]-(j-i);
            idx=j;
        }
     }
     if(idx!=-1) {
        s[idx]-=(idx-i);
     for(int j=idx;j>i;j--) swap(s[j],s[j-1]);
     }
   }
   cout<<s<<'\n';
  }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
string s;
int n;
int main()
{
  //freopen("input.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int t; cin>>t;
  while(t--){
   cin>>s;
   n=s.size();
   for(int i=0;i<n;i++){
     int mx=s[i],idx=-1;
     for(int j=i+1;j<min(9+i,n);j++){
        if(s[j]-(j-i)>mx){
            mx=s[j]-(j-i);
            idx=j;
        }
     }
     if(idx!=-1) {
        s[idx]-=(idx-i);
     for(int j=idx;j>i;j--) swap(s[j],s[j-1]);
     }
   }
   cout<<s<<'\n';
  }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
string s;
int n;
int main()
{
  //freopen("input.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int t; cin>>t;
  while(t--){
   cin>>s;
   n=s.size();
   for(int i=0;i<n;i++){
     int mx=s[i],idx=-1;
     for(int j=i+1;j<9+i;j++){
        if(s[j]-(j-i)>mx){
            mx=s[j]-(j-i);
            idx=j;
        }
     }
     if(idx!=-1) {
        s[idx]-=(idx-i);
     for(int j=idx;j>i;j--) swap(s[j],s[j-1]);
     }
   }
   cout<<s<<'\n';
  }
    return 0;
}


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
string s;
int n;
int main()
{
  //freopen("input.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int t; cin>>t;
  while(t--){
   cin>>s;
   n=s.size();
   for(int i=0;i<n;i++){
     int mx=s[i],idx=-1;
     for(int j=i+1;j<9+i;j++){
        if(s[j]!='0'&&s[j]-(j-i)>mx){
            mx=s[j]-(j-i);
            idx=j;
        }
     }
     if(idx!=-1) {
        s[idx]-=(idx-i);
     for(int j=idx;j>i;j--) swap(s[j],s[j-1]);
     }
   }
   cout<<s<<'\n';
  }
    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>
#define ll long long int
#define MOD (ll)1000000007
#define dbg(x) cout<< #x <<" : "<<(x)<<endl;
#define dbgv(v) cout<< #v <<" : ";for(auto &i:v) cout<<(i)<<" ";cout<<endl;
using namespace std;
void recur();
void solve(){  
     ll sum=0,n;cin>>n;
     vector<ll> a(n);
     for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
     }
    
    if(sum>abs(a[n-1]-a[0]) || n==1)cout<<sum;
    else cout<<abs(a[n-1]-a[0]);
    cout<<endl;
}

























int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll t=1;
    cin>>t;
    while(t--)
        solve();   
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long int
#define MOD (ll)1000000007
#define dbg(x) cout<< #x <<" : "<<(x)<<endl;
#define dbgv(v) cout<< #v <<" : ";for(auto &i:v) cout<<(i)<<" ";cout<<endl;
using namespace std;
void recur();
void solve(){  
    ll maxi=0,sum=0,n;cin>>n;
    vector<ll> a(n);
    for(ll& i:a){
        cin>>i;
        sum+=i;
    }
    if(n==1){
        cout<<sum<<endl;
        return;
    }
    maxi=max(sum,abs(a[n-1]-a[0]));
    for(int i=1;i<n;i++){
        sum=0;
        for(int j=0;j<n-i;j++){
            int t=a[j];
            a[j]=a[j+1]-t;
            sum+=a[j];
        }
        maxi=max(maxi,abs(sum));
        // cout<<maxi<<' '<<i;
    } 
    cout<<maxi<<endl;
}

























int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll t=1;
    cin>>t;
    while(t--)
        solve();   
    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>
#define ll long long int
#define MOD (ll)1000000007
#define dbg(x) cout<< #x <<" : "<<(x)<<endl;
#define dbgv(v) cout<< #v <<" : ";for(auto &i:v) cout<<(i)<<" ";cout<<endl;
using namespace std;
void recur();
void solve(){  
    ll maxi=0,sum=0,n;cin>>n;
    vector<ll> a(n);
    for(ll& i:a){
        cin>>i;
        sum+=i;
    }
    if(n==1){
        cout<<sum<<endl;
        return;
    }
    maxi=max(sum,abs(a[n-1]-a[0]));
    for(int i=1;i<n;i++){
        sum=0;
        for(int j=0;j<n-i;j++){
            int t=a[j];
            a[j]=a[j+1]-t;
            sum+=a[j];
        }
        maxi=max(maxi,abs(sum));
        // cout<<maxi<<' '<<i;
    } 
    cout<<maxi<<endl;
}

























int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll t=1;
    cin>>t;
    while(t--)
        solve();   
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long int
#define MOD (ll)1000000007
#define dbg(x) cout<< #x <<" : "<<(x)<<endl;
#define dbgv(v) cout<< #v <<" : ";for(auto &i:v) cout<<(i)<<" ";cout<<endl;
using namespace std;
void recur();
void solve(){  
    ll maxi=0,sum=0,n;cin>>n;
    vector<ll> a(n);
    for(ll& i:a){
        cin>>i;
        sum+=i;
    }
    if(n==1){
        cout<<sum<<endl;
        return;
    }
    maxi=sum;
    for(int i=1;i<n;i++){
        sum=0;
        for(int j=0;j<n-i;j++){
            int t=a[j];
            a[j]=a[j+1]-t;
            sum+=a[j];
        }
        maxi=max(maxi,abs(sum));
        // cout<<maxi<<' '<<i;
    } 
    cout<<maxi<<endl;
}

























int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll t=1;
    cin>>t;
    while(t--)
        solve();   
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define ll long long int
#define MOD (ll)1000000007
#define dbg(x) cout<< #x <<" : "<<(x)<<endl;
#define dbgv(v) cout<< #v <<" : ";for(auto &i:v) cout<<(i)<<" ";cout<<endl;
using namespace std;
void recur();
void solve(){  
     ll sum=0,n;cin>>n;
     vector<ll> a(n);
     for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
     }
    
    if(sum>abs(a[n-1]-a[0]) || n==1)cout<<sum;
    else cout<<abs(a[n-1]-a[0]);
    cout<<endl;
}

























int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll t=1;
    cin>>t;
    while(t--)
        solve();   
    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>
#define ll long long int
#define MOD (ll)1000000007
#define dbg(x) cout<< #x <<" : "<<(x)<<endl;
#define dbgv(v) cout<< #v <<" : ";for(auto &i:v) cout<<(i)<<" ";cout<<endl;
using namespace std;
void recur();
void solve(){  
    ll maxi=0,sum=0,n;cin>>n;
    vector<ll> a(n);
    for(ll& i:a){
        cin>>i;
        sum+=i;
    }
    if(n==1){
        cout<<sum<<endl;
        return;
    }
    maxi=sum;
    for(int i=1;i<n;i++){
        sum=0;
        for(int j=0;j<n-i;j++){
            int t=a[j];
            a[j]=a[j+1]-t;
            sum+=a[j];
        }
        maxi=max(maxi,abs(sum));
        // cout<<maxi<<' '<<i;
    } 
    cout<<maxi<<endl;
}

























int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll t=1;
    cin>>t;
    while(t--)
        solve();   
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define ll long long int
#define MOD (ll)1000000007
#define dbg(x) cout<< #x <<" : "<<(x)<<endl;
#define dbgv(v) cout<< #v <<" : ";for(auto &i:v) cout<<(i)<<" ";cout<<endl;
using namespace std;
void recur();
void solve(){  
    ll maxi=0,sum=0,n;cin>>n;
    vector<ll> a(n);
    for(ll& i:a){
        cin>>i;
        sum+=i;
    }
    if(n==1){
        cout<<sum<<endl;
        return;
    }
    maxi=sum;
    for(int i=1;i<n;i++){
        sum=0;
        for(int j=0;j<n-i;j++){
            a[j]=a[j+1]-a[j];
            sum+=a[j];
        }
        maxi=max(maxi,abs(sum));
        // cout<<maxi<<' '<<i;
    } 
    cout<<maxi<<endl;
}

























int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll t=1;
    cin>>t;
    while(t--)
        solve();   
    return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Time limit exceeded on test 16):
#define _CRT_SECURE_NO_WARNINGS
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <conio.h>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <list>
#include <map>
#include <set>

using namespace std;

#pragma GCC optimize ("-O3")

#define ll long long
#define ull unsigned long long
#define wt int t; cin>>t; while(t--)
#define all(v) v.begin(),v.end()
#define max3(a,b,c) max(max(a,b),max(a,c))
#define min3(a,b,c) min(min(a,b),min(a,c))
#define pi 3.141592653

void a()
{
	int t;
	cin >> t;

	for (int i = 0;i < t;i++)
	{
		int n, k;
		
		cin >> n >> k;

		vector<int> a(n);

		for (int j = 0;j < n; j++)
			cin >> a[j];

		sort(all(a));

		vector<int> cnt = { 1 };

		for (int j = 1;j < n; j++)
		{
			if (a[j] == a[j - 1]) cnt.back()++;
			else cnt.emplace_back(1);
		}

		sort(all(cnt));

		while (cnt.size() > 1 && k > 0)
		{
			if (cnt.front() <= k)
			{
				k -= cnt.front();
				cnt.erase(cnt.begin());
			}
			else break;
		}

		cout << cnt.size() << '\n';
	}
}

void b()
{

}

void c()
{

}

void d()
{

}

void e()
{

}

void f()
{

}

void g()
{

}

int main()
{
    IOS

#ifdef ASD
    freopen("a.in", "r", stdin);
    freopen("a.out", "w", stdout);
#endif

#ifdef TEST
    freopen("a.in", "w", stdout);

    test();
#else
    a();
#endif

    return 0;
}

Submission (verdict: Accepted):
#define _CRT_SECURE_NO_WARNINGS
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <conio.h>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <list>
#include <map>
#include <set>

using namespace std;

#pragma GCC optimize ("-O3")

#define ll long long
#define ull unsigned long long
#define wt int t; cin>>t; while(t--)
#define all(v) v.begin(),v.end()
#define max3(a,b,c) max(max(a,b),max(a,c))
#define min3(a,b,c) min(min(a,b),min(a,c))
#define pi 3.141592653

void a()
{
	int t;
	cin >> t;

	for (int i = 0;i < t;i++)
	{
		int n, k;
		
		cin >> n >> k;

		vector<int> a(n);

		for (int j = 0;j < n; j++)
			cin >> a[j];

		sort(all(a));

		vector<int> cnt = { 1 };

		for (int j = 1;j < n; j++)
		{
			if (a[j] == a[j - 1]) cnt.back()++;
			else cnt.emplace_back(1);
		}

		sort(all(cnt));

		int m = cnt.size();
		int ans = 1;

		for (int j = 0; j < m - 1;j++)
		{
			if (cnt[j] > k)
			{
				ans = m - j;
				break;
			}

			k -= cnt[j];
		}

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

void b()
{

}

void c()
{

}

void d()
{

}

void e()
{

}

void f()
{

}

void g()
{

}

int main()
{
    IOS

#ifdef ASD
    freopen("a.in", "r", stdin);
    freopen("a.out", "w", stdout);
#endif

#ifdef TEST
    freopen("a.in", "w", stdout);

    test();
#else
    a();
#endif

    return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#define _CRT_SECURE_NO_WARNINGS
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <conio.h>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <list>
#include <map>
#include <set>

using namespace std;

#pragma GCC optimize ("-O3")

#define ll long long
#define ull unsigned long long
#define wt int t; cin>>t; while(t--)
#define all(v) v.begin(),v.end()
#define max3(a,b,c) max(max(a,b),max(a,c))
#define min3(a,b,c) min(min(a,b),min(a,c))
#define pi 3.141592653

void a()
{
	int t;
	cin >> t;

	for (int i = 0;i < t;i++)
	{
		int n, k;
		
		cin >> n >> k;

		vector<int> a(n);

		for (int j = 0;j < n; j++)
			cin >> a[j];

		sort(all(a));

		vector<int> cnt = { 1 };

		for (int j = 1;j < n; j++)
		{
			if (a[j] == a[j - 1]) cnt.back()++;
			else cnt.emplace_back(1);
		}

		sort(all(cnt));

		while (cnt.size() > 1 && k > 0)
		{
			if (cnt.front() <= k)
			{
				k -= cnt.front();
				cnt.erase(cnt.begin());
			}
			else break;
		}

		cout << k << '\n';
	}
}

void b()
{

}

void c()
{

}

void d()
{

}

void e()
{

}

void f()
{

}

void g()
{

}

int main()
{
    IOS

#ifdef ASD
    freopen("a.in", "r", stdin);
    freopen("a.out", "w", stdout);
#endif

#ifdef TEST
    freopen("a.in", "w", stdout);

    test();
#else
    a();
#endif

    return 0;
}

Submission (verdict: Time limit exceeded on test 16):
#define _CRT_SECURE_NO_WARNINGS
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <conio.h>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <list>
#include <map>
#include <set>

using namespace std;

#pragma GCC optimize ("-O3")

#define ll long long
#define ull unsigned long long
#define wt int t; cin>>t; while(t--)
#define all(v) v.begin(),v.end()
#define max3(a,b,c) max(max(a,b),max(a,c))
#define min3(a,b,c) min(min(a,b),min(a,c))
#define pi 3.141592653

void a()
{
	int t;
	cin >> t;

	for (int i = 0;i < t;i++)
	{
		int n, k;
		
		cin >> n >> k;

		vector<int> a(n);

		for (int j = 0;j < n; j++)
			cin >> a[j];

		sort(all(a));

		vector<int> cnt = { 1 };

		for (int j = 1;j < n; j++)
		{
			if (a[j] == a[j - 1]) cnt.back()++;
			else cnt.emplace_back(1);
		}

		sort(all(cnt));

		while (cnt.size() > 1 && k > 0)
		{
			if (cnt.front() <= k)
			{
				k -= cnt.front();
				cnt.erase(cnt.begin());
			}
			else break;
		}

		cout << cnt.size() << '\n';
	}
}

void b()
{

}

void c()
{

}

void d()
{

}

void e()
{

}

void f()
{

}

void g()
{

}

int main()
{
    IOS

#ifdef ASD
    freopen("a.in", "r", stdin);
    freopen("a.out", "w", stdout);
#endif

#ifdef TEST
    freopen("a.in", "w", stdout);

    test();
#else
    a();
#endif

    return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Time limit exceeded on test 9):
#define _CRT_SECURE_NO_WARNINGS
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <conio.h>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <list>
#include <map>
#include <set>

using namespace std;

#pragma GCC optimize ("-O3")

#define ll long long
#define ull unsigned long long
#define wt int t; cin>>t; while(t--)
#define all(v) v.begin(),v.end()
#define max3(a,b,c) max(max(a,b),max(a,c))
#define min3(a,b,c) min(min(a,b),min(a,c))
#define pi 3.141592653

void a()
{
	int t;
	cin >> t;

	for (int i = 0;i < t;i++)
	{
		int n, k, maxNum = 0, maxCount = 0, cur;
		map<int, int> m;

		cin >> n >> k;

		for (int j = 0;j < n; j++)
		{
			cin >> cur;

			m[cur]++;

			if (m[cur] > maxCount || (m[cur] == maxCount && cur > maxNum))
			{
				maxCount = m[cur];
				maxNum = cur;
			}
		}

		while (k > 0 && m.size() > 1)
		{
			int minNum = 1e8, minCount = 1e8;

			for (auto& i : m)
			{
				if (i.second < minCount || (i.second == minCount && i.first < minNum))
				{
					minCount = i.second;
					minNum = i.first;
				}
			}

			// вычисляем, сколько чисел мы можем изменить на текущем шаге
			int delta = min(m[minNum], k);

			m[minNum] -= delta;
			k -= delta;

			if (m[minNum] == 0)
				m.erase(minNum);
		}

		cout << m.size() << '\n';
	}
}

void b()
{

}

void c()
{

}

void d()
{

}

void e()
{

}

void f()
{

}

void g()
{

}

int main()
{
    IOS

#ifdef ASD
    freopen("a.in", "r", stdin);
    freopen("a.out", "w", stdout);
#endif

#ifdef TEST
    freopen("a.in", "w", stdout);

    test();
#else
    a();
#endif

    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>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e18; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n; 
    cin >> n; 
    vector<int> a(n); 
    int ans = -INF; 
    for (int i = 0; i < n; ++i) cin >> a[i]; 
    if (n == 1) {
        console(a[0]); 
        return; 
    }
    int l = 0; 
    while (n - l >= 1) {
        int s = 0; 
        for (int i = l; i < n; ++i) s += a[i]; 
        ans = max(ans, max(-s,s)); 
        vector<int> b(all(a)); 
        for (int i = l + 1; i < n; ++i) a[i] -= b[i-1]; 
       // console(ans); 
        ++l; 
    }
    console(ans); 
}
signed main()
{
    fast;
    int T; 
    cin >> T; 
    while (T--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e18; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n; 
    cin >> n; 
    vector<int> a(n);  
    int sum = 0; 
    for (int i = 0; i < n; ++i) {
        cin >> a[i]; 
        sum += a[i]; 
    } 
    int ans = max(sum, -sum); 
    if (n == 1) {
        console(a[0]); 
        return; 
    }
    int l = 0; 
    while (n - l >= 1) {
        int s = 0; 
        for (int i = l; i < n; ++i) s += a[i]; 
        ans = max(ans, max(-s,s)); 
        vector<int> b(all(a)); 
        for (int i = l + 1; i < n; ++i) a[i] -= b[i-1]; 
       // console(ans); 
        ++l; 
    }
    console(ans); 
}
signed main()
{
    fast;
    int T; 
    cin >> T; 
    while (T--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e18; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n; 
    cin >> n; 
    vector<int> a(n);  
    int sum = 0; 
    for (int i = 0; i < n; ++i) {
        cin >> a[i]; 
        sum += a[i]; 
    } 
    int ans = max(sum, -sum); 
    if (n == 1) {
        console(a[0]); 
        return; 
    }
    int l = 0; 
    while (n - l >= 1) {
        int s = 0; 
        for (int i = l; i < n; ++i) s += a[i]; 
        ans = max(ans, max(-s,s)); 
        vector<int> b(all(a)); 
        for (int i = l + 1; i < n; ++i) a[i] -= b[i-1]; 
       // console(ans); 
        ++l; 
    }
    console(ans); 
}
signed main()
{
    fast;
    int T; 
    cin >> T; 
    while (T--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e18; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n; 
    cin >> n; 
    vector<int> a(n);  
    int sum = 0; 
    for (int i = 0; i < n; ++i) {
        cin >> a[i]; 
        sum += a[i]; 
    } 
    int ans = -INF; 
    if (n == 1) {
        console(a[0]); 
        return; 
    }
    int l = 0; 
    while (n - l >= 1) {
        int s = 0; 
        for (int i = l; i < n; ++i) s += a[i]; 
        if (l > 0) ans = max(ans, max(-s,s)); 
        vector<int> b(all(a)); 
        for (int i = l + 1; i < n; ++i) a[i] -= b[i-1]; 
       // console(ans); 
        ++l; 
    }
    console(ans); 
}
signed main()
{
    fast;
    int T; 
    cin >> T; 
    while (T--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/