ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057B - Gorilla and the Exam
Language: C++20 (GCC 13-64)

Previous submission (verdict: Time limit exceeded on test 11):
#include <bits/stdc++.h>
#define NSD ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define yes cout<<"DA"<<endl;
#define no cout<<"NET"<<endl;
using namespace std;

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }

ll binaryexpoI(ll a, ll b){
    ll ans = 1;
    while (b)
    {
        if (b & 1)
        {
            ans = ans * a;
        }
        a = a * a;
        b >>= 1;
    }
    return ans;
}


int main()
{
    ll t;
    cin>>t;
    while (t--)
    {
		ll n,k;
		cin>>n>>k;
		ll a[n];
		unordered_map<ll,ll> m;
		for (int i = 0; i < n; i++)
		{
			cin>>a[i];
			m[a[i]]++;
		}
		if(k>=n){
			cout<<1<<endl;
			continue;
		}
		vector<ll> v;
		for(auto x:m){
			v.push_back(x.second);
		}
		sort(v.begin(),v.end());
		ll i=0;
		for (i = 0; i < v.size() && k>0; i++)
		{
			k-=v[i];
		}
		if(k==0){
			cout<<v.size()-i<<endl;
		}
		else{
			cout<<v.size()-i+1<<endl;
		}

    }
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define NSD ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define yes cout<<"DA"<<endl;
#define no cout<<"NET"<<endl;
using namespace std;

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }

ll binaryexpoI(ll a, ll b){
    ll ans = 1;
    while (b)
    {
        if (b & 1)
        {
            ans = ans * a;
        }
        a = a * a;
        b >>= 1;
    }
    return ans;
}


int main()
{
    ll t;
    cin>>t;
    while (t--)
    {
		ll n,k;
		cin>>n>>k;
		ll a[n];
		map<ll,ll> m;
		for (int i = 0; i < n; i++)
		{
			cin>>a[i];
			m[a[i]]++;
		}
		if(k>=n){
			cout<<1<<endl;
			continue;
		}
		vector<ll> v;
		for(auto x:m){
			v.push_back(x.second);
		}
		sort(v.begin(),v.end());
		ll i=0;
		for (i = 0; i < v.size() && k>0; i++)
		{
			k-=v[i];
		}
		if(k==0){
			cout<<v.size()-i<<endl;
		}
		else{
			cout<<v.size()-i+1<<endl;
		}

    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
    int t;cin>>t;
    while(t--)
    {
    int n,l,r;cin>>n>>l>>r;
    vector<long long>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    vector<long long>a;
    vector<long long>b;
    for(int i=l-1;i<r;i++)
    {
      a.push_back(v[i]);
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++)
    {
       if(i>=l-1&&i<r)continue;
       b.push_back(v[i]);
    }
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    if(b.empty())
    {
        long long sum=0;
        for(int i=0;i<a.size();i++)
        {
            sum=sum+a[i];
        }
        cout<<sum<<"\n";
    }
    else
    {
        long long sum=0;
        //long long sz=min(a.size(),b.size());
        int j=b.size()-1;
        for(int i=a.size()-1;i>=0;i--)
        {
          if(j>=0 &&a[i]>b[j]){
                sum=sum+b[j];
                j--;
          }
          else sum=sum+a[i];

        }
        cout<<sum<<"\n";
    }
    }
return 0;
}


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

using namespace std;

int main() {

  ios_base::sync_with_stdio(0);

  cin.tie(0);

    int t;cin>>t;

    while(t--)

    {

    int n,l,r;cin>>n>>l>>r;

    vector<long long>v(n);

    for(int i=0;i<n;i++)

    {

        cin>>v[i];

    }

    vector<long long>a;

    vector<long long>b;

    for(int i=l-1;i<r;i++)

    {

      a.push_back(v[i]);

    }

    sort(a.begin(),a.end());

    for(int i=0;i<n;i++)

    {

       if(i>=l-1&&i<r)continue;

       b.push_back(v[i]);

    }

    sort(b.begin(),b.end());

    reverse(b.begin(),b.end());

if(l-1>0&&r<n-1){

  sort(v.begin(),v.begin()+l,greater<long long>());

  long long sum=0;

  int j=l-1;

  for(int i=a.size()-1;i>=0;i--)

  {

      if(j>=0 &&a[i]>v[j])

      {

          sum=sum+v[j];

          j--;

      }

      else sum=sum+a[i];

  }

  sort(v.begin()+r+1,v.end(),greater<long long>());

  long long sum1=0;

  int k=r+1;

  for(int i=a.size()-1;i>=0;i--)

  {

      if(k>=0 &&a[i]>v[k])

      {

          sum1=sum1+v[k];

          k--;

      }

      else sum1=sum1+a[i];

  }

  cout<<min(sum,sum1)<<"\n";

}

else{

        long long sum=0;

        //long long sz=min(a.size(),b.size());

        int j=b.size()-1;

        for(int i=a.size()-1;i>=0;i--)

        {

          if(j>=0 &&a[i]>b[j]){

                sum=sum+b[j];

                j--;

          }

          else sum=sum+a[i];



        }

        cout<<sum<<"\n";

}

    }

return 0;

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
    int t;cin>>t;
    while(t--)
    {
    int n,l,r;cin>>n>>l>>r;
    vector<long long>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    vector<long long>a;
    vector<long long>b;
    for(int i=l-1;i<r;i++)
    {
      a.push_back(v[i]);
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++)
    {
       if(i>=l-1&&i<r)continue;
       b.push_back(v[i]);
    }
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
if(l-1>0&&r<n){
  sort(v.begin(),v.begin()+l-1,greater<long long>());
  long long sum=0;
  int j=l-2;
  for(int i=a.size()-1;i>=0;i--)
  {
      if(j>=0 &&a[i]>v[j])
      {
          sum=sum+v[j];
          j--;
      }
      else sum=sum+a[i];
  }
  sort(v.begin()+r,v.end(),greater<long long>());
  long long sum1=0;
  int k=r;
  for(int i=a.size()-1;i>=0;i--)
  {
      if(k<n &&a[i]>v[k])
      {
          sum1=sum1+v[k];
          k++;
      }
      else sum1=sum1+a[i];
  }
  cout<<min(sum,sum1)<<"\n";
}
else{
        long long sum=0;
        //long long sz=min(a.size(),b.size());
        int j=b.size()-1;
        for(int i=a.size()-1;i>=0;i--)
        {
          if(j>=0 &&a[i]>b[j]){
                sum=sum+b[j];
                j--;
          }
          else sum=sum+a[i];

        }
        cout<<sum<<"\n";
}
    }
return 0;
}


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

using namespace std;

int main() {

  ios_base::sync_with_stdio(0);

  cin.tie(0);

    int t;cin>>t;

    while(t--)

    {

    int n,l,r;cin>>n>>l>>r;

    vector<long long>v(n);

    l--;r--;

    for(int i=0;i<n;i++)

    {

        cin>>v[i];

    }

   vector<long long>a;

   vector<long long>b;

   for(int i=0;i<=r;i++)

   {

     a.push_back(v[i]);

   }

   for(int i=l;i<n;i++)

   {

       b.push_back(v[i]);

   }

   sort(a.begin(),a.end());

   sort(b.begin(),b.end());

   int k=r-l+1;

   long long sum=0,sum1=0;

   for(int i=0;i<k;i++)

   {

       sum=sum+a[i];

       sum1=sum1+b[i];

   }

   cout<<min(sum,sum1)<<"\n";

    }

return 0;

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
    int t;cin>>t;
    while(t--)
    {
    int n,l,r;cin>>n>>l>>r;
    vector<long long>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    vector<long long>a;
    vector<long long>b;
    for(int i=l-1;i<r;i++)
    {
      a.push_back(v[i]);
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++)
    {
       if(i>=l-1&&i<r)continue;
       b.push_back(v[i]);
    }
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    if(b.empty())
    {
        long long sum=0;
        for(int i=0;i<a.size();i++)
        {
            sum=sum+a[i];
        }
        cout<<sum<<"\n";
    }
    else
    {
        long long sum=0;
        //long long sz=min(a.size(),b.size());
        int j=b.size()-1;
        for(int i=a.size()-1;i>=0;i--)
        {
          if(a[i]>b[j])sum=sum+b[j];
          else sum=sum+a[i];
          j--;
        }
        cout<<sum<<"\n";
    }
    }
return 0;
}


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
    int t;cin>>t;
    while(t--)
    {
    int n,l,r;cin>>n>>l>>r;
    vector<long long>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    vector<long long>a;
    vector<long long>b;
    for(int i=l-1;i<r;i++)
    {
      a.push_back(v[i]);
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++)
    {
       if(i>=l-1&&i<r)continue;
       b.push_back(v[i]);
    }
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    if(b.empty())
    {
        long long sum=0;
        for(int i=0;i<a.size();i++)
        {
            sum=sum+a[i];
        }
        cout<<sum<<"\n";
    }
    else
    {
        long long sum=0;
        //long long sz=min(a.size(),b.size());
        int j=b.size()-1;
        for(int i=a.size()-1;i>=0;i--)
        {
          if(j>=0 &&a[i]>b[j]){
                sum=sum+b[j];
                j--;
          }
          else sum=sum+a[i];

        }
        cout<<sum<<"\n";
    }
    }
return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

using namespace std;

int main() {

  ios_base::sync_with_stdio(0);

  cin.tie(0);

    int t;cin>>t;

    while(t--)

    {

    int n,l,r;cin>>n>>l>>r;

    vector<long long>v(n);

    for(int i=0;i<n;i++)

    {

        cin>>v[i];

    }

    vector<long long>a;

    vector<long long>b;

    for(int i=l-1;i<r;i++)

    {

      a.push_back(v[i]);

    }

    sort(a.begin(),a.end());

    for(int i=0;i<n;i++)

    {

       if(i>=l-1&&i<r)continue;

       b.push_back(v[i]);

    }

    sort(b.begin(),b.end());

    reverse(b.begin(),b.end());

if(l-1>0&&r<n-1){

  sort(v.begin(),v.begin()+l,greater<long long>());

  long long sum=0;

  int j=l-1;

  for(int i=a.size()-1;i>=0;i--)

  {

      if(j>=0 &&a[i]>v[j])

      {

          sum=sum+v[j];

          j--;

      }

      else sum=sum+a[i];

  }

  sort(v.begin()+r+1,v.end(),greater<long long>());

  long long sum1=0;

  int k=r+1;

  for(int i=a.size()-1;i>=0;i--)

  {

      if(k>=0 &&a[i]>v[k])

      {

          sum1=sum1+v[k];

          k--;

      }

      else sum1=sum1+a[i];

  }

  cout<<min(sum,sum1)<<"\n";

}

else{

        long long sum=0;

        //long long sz=min(a.size(),b.size());

        int j=b.size()-1;

        for(int i=a.size()-1;i>=0;i--)

        {

          if(j>=0 &&a[i]>b[j]){

                sum=sum+b[j];

                j--;

          }

          else sum=sum+a[i];



        }

        cout<<sum<<"\n";

}

    }

return 0;

}



Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
    int t;cin>>t;
    while(t--)
    {
    int n,l,r;cin>>n>>l>>r;
    vector<long long>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    vector<long long>a;
    vector<long long>b;
    for(int i=l-1;i<r;i++)
    {
      a.push_back(v[i]);
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++)
    {
       if(i>=l-1&&i<r)continue;
       b.push_back(v[i]);
    }
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
if(l-1>0&&r<n){
  sort(v.begin(),v.begin()+l-1,greater<long long>());
  long long sum=0;
  int j=l-2;
  for(int i=a.size()-1;i>=0;i--)
  {
      if(j>=0 &&a[i]>v[j])
      {
          sum=sum+v[j];
          j--;
      }
      else sum=sum+a[i];
  }
  sort(v.begin()+r,v.end(),greater<long long>());
  long long sum1=0;
  int k=r;
  for(int i=a.size()-1;i>=0;i--)
  {
      if(k<n &&a[i]>v[k])
      {
          sum1=sum1+v[k];
          k++;
      }
      else sum1=sum1+a[i];
  }
  cout<<min(sum,sum1)<<"\n";
}
else{
        long long sum=0;
        //long long sz=min(a.size(),b.size());
        int j=b.size()-1;
        for(int i=a.size()-1;i>=0;i--)
        {
          if(j>=0 &&a[i]>b[j]){
                sum=sum+b[j];
                j--;
          }
          else sum=sum+a[i];

        }
        cout<<sum<<"\n";
}
    }
return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
    int t;cin>>t;
    while(t--)
    {
    int n,l,r;cin>>n>>l>>r;
    vector<long long>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    vector<long long>a;
    vector<long long>b;
    for(int i=l-1;i<r;i++)
    {
      a.push_back(v[i]);
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++)
    {
       if(i>=l-1&&i<r)continue;
       b.push_back(v[i]);
    }
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    if(b.empty())
    {
        long long sum=0;
        for(int i=0;i<a.size();i++)
        {
            sum=sum+a[i];
        }
        cout<<sum<<"\n";
    }
    else
    {
        long long sum=0;
        //long long sz=min(a.size(),b.size());
        int j=b.size()-1;
        for(int i=a.size()-1;i>=0;i--)
        {
          if(a[i]>b[j])sum=sum+b[j];
          else sum=sum+a[i];
          j--;
        }
        cout<<sum<<"\n";
    }
    }
return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define ll             long long int 
#define ff(i,a,b)      for(int i=a;i<b;i++)
#define l(s)           s.length()
#define sa(a,n)        sort(a,a+n)
#define sv(v)          sort(v.begin(),v.end())
#define vi             vector<int>
#define input(a,n)     for(int i=0;i<n;i++) cin>>a[i];
#define rv(v)          reverse(v.begin(),v.end())
#define pb             push_back
#define mp             make_pair
#define all(v)         v.begin(),v.end()
#define ff(i,a,b)      for(int i=a;i<b;i++)
#define fr(i,a,b)      for(int i=a;i>=b;i--)
const int mod=1e9+7;
vector<bool> isprime(1000001,true);
int binexp(int a,int b,int m){
 int res=1;
while(b>0){
if(b&1){
res=(res*1LL*a)%mod;
}
a=(a*1LL*a)%mod;
b>>=1;
}
return res;
}
void peak_pd(){
  int t;
  cin>>t;
  while(t--){
   int n,l,r;
   cin>>n>>l>>r;
   int ct=r-l+1;
  //  cout<<"ct is";
  //  cout<<ct<<endl;
   vi a(n);
   input(a,n);
   sv(a);
    
    int sum=0;
    for(int i=0;i<n;i++){
      if(ct!=0){
        sum+=a[i];
        ct--;
      }
    }
    cout<<sum<<endl;
  }
  

}
int main(){
isprime[0]=isprime[1]=1;
for(int i=2;i<=1000000;i++)
{
if(isprime[i]==true)
{
for(int j=2*i;j<=1000000;j+=i)
{
isprime[j]=false;
}
}
}
peak_pd();
return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define ll             long long int 
#define ff(i,a,b)      for(int i=a;i<b;i++)
#define l(s)           s.length()
#define sa(a,n)        sort(a,a+n)
#define sv(v)          sort(v.begin(),v.end())
#define vi             vector<int>
#define input(a,n)     for(int i=0;i<n;i++) cin>>a[i];
#define rv(v)          reverse(v.begin(),v.end())
#define pb             push_back
#define mp             make_pair
#define all(v)         v.begin(),v.end()
#define ff(i,a,b)      for(int i=a;i<b;i++)
#define fr(i,a,b)      for(int i=a;i>=b;i--)
const int mod=1e9+7;
vector<bool> isprime(1000001,true);
int binexp(int a,int b,int m){
 int res=1;
while(b>0){
if(b&1){
res=(res*1LL*a)%mod;
}
a=(a*1LL*a)%mod;
b>>=1;
}
return res;
}
void peak_pd(){
  int t;
  cin>>t;
  while(t--){
   int n,l,r;
   cin>>n>>l>>r;
   int ct=r-l+1;
  //  cout<<"ct is";
  //  cout<<ct<<endl;
   vi a(n);
   input(a,n);
   sv(a);
    
    int sum=0;
    for(int i=0;i<n;i++){
      if(ct!=0){
        sum+=a[i];
        ct--;
      }
    }
    cout<<sum<<endl;
  }
  

}
int main(){
isprime[0]=isprime[1]=1;
for(int i=2;i<=1000000;i++)
{
if(isprime[i]==true)
{
for(int j=2*i;j<=1000000;j+=i)
{
isprime[j]=false;
}
}
}
peak_pd();
return 0;
}

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

using namespace std;

#define ll             long long int 

#define ff(i,a,b)      for(int i=a;i<b;i++)

#define l(s)           s.length()

#define sa(a,n)        sort(a,a+n)

#define sv(v)          sort(v.begin(),v.end())

#define vi             vector<int>

#define input(a,n)     for(int i=0;i<n;i++) cin>>a[i];

#define rv(v)          reverse(v.begin(),v.end())

#define pb             push_back

#define mp             make_pair

#define all(v)         v.begin(),v.end()

#define ff(i,a,b)      for(int i=a;i<b;i++)

#define fr(i,a,b)      for(int i=a;i>=b;i--)

const int mod=1e9+7;

vector<bool> isprime(1000001,true);

int binexp(int a,int b,int m){

 int res=1;

while(b>0){

if(b&1){

res=(res*1LL*a)%mod;

}

a=(a*1LL*a)%mod;

b>>=1;

}

return res;

}

void peak_pd(){

  int t;

  cin>>t;

  while(t--){

   int n,l,r;

   cin>>n>>l>>r;

   int ct=r-l+1;

  //  cout<<"ct is";

  //  cout<<ct<<endl;



   vi a(n);

   input(a,n);

   if(n==2){

    cout<<a[n-1]<<endl;

    continue;

   }

   sv(a);

    

    int sum=0;

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

      if(ct!=0){

        sum+=a[i];

        ct--;

      }

    }

    cout<<sum<<endl;

  }

  



}

int main(){

isprime[0]=isprime[1]=1;

for(int i=2;i<=1000000;i++)

{

if(isprime[i]==true)

{

for(int j=2*i;j<=1000000;j+=i)

{

isprime[j]=false;

}

}

}

peak_pd();

return 0;

}
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 3):
for _ in range(int(input())):
    s=[int(x) for x in list(input())]
    sm=sum(s)
    t=s.count(2)
    th=s.count(3)
    found=False
    for i in range(t+1):
        for j in range(th+1):
            if (sm+i*2+j*6)%9==0:
                print('YES')
                found=True
                break
    if not found:
        print('NO')


Submission (verdict: Accepted):
for _ in range(int(input())):
    s=[int(x) for x in list(input())]
    sm=sum(s)
    t=s.count(2)
    th=s.count(3)
    found=False
    for i in range(t+1):
        for j in range(th+1):
            if (sm+i*2+j*6)%9==0:
                print('YES')
                found=True
                break
        if found:
            break
    if not found:
        print('NO')
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 3):
for _ in range(int(input())):
    s=[int(x) for x in list(input())]
    sm=sum(s)
    t=s.count(2)
    th=s.count(3)
    found=False
    for i in range(min(9,t+1)):
        for j in range(min(9,th+1)):
            if (sm+i*2+j*6)%9==0:
                print('YES')
                found=True
                break
    if not found:
        print('NO')


Submission (verdict: Wrong answer on test 1):
for _ in range(int(input())):
    s=[int(x) for x in list(input())]
    sm=sum(s)
    t=s.count(2)
    th=s.count(3)
    found=False
    for i in range(min(10,t+1)):
        for j in range(min(10,t+1)):
            if (sm+i*2+j*6)%9==0:
                print('YES')
                found=True
                break
    if not found:
        print('NO')
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64


Submission (verdict: Wrong answer on test 3):
for _ in range(int(input())):
    s=[int(x) for x in list(input())]
    sm=sum(s)
    t=s.count(2)
    th=s.count(3)
    found=False
    for i in range(min(9,t+1)):
        for j in range(min(9,th+1)):
            if (sm+i*2+j*6)%9==0:
                print('YES')
                found=True
                break
    if not found:
        print('NO')
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 1):
for _ in range(int(input())):
    s=[int(x) for x in list(input())]
    sm=sum(s)
    t=s.count(2)
    th=s.count(3)
    found=False
    for i in range(min(10,t+1)):
        for j in range(min(10,t+1)):
            if (sm+i*2+j*6)%9==0:
                print('YES')
                found=True
                break
    if not found:
        print('NO')


Submission (verdict: Wrong answer on test 3):
for _ in range(int(input())):
    s=[int(x) for x in list(input())]
    sm=sum(s)
    t=s.count(2)
    th=s.count(3)
    found=False
    for i in range(t+1):
        for j in range(th+1):
            if (sm+i*2+j*6)%9==0:
                print('YES')
                found=True
                break
    if not found:
        print('NO')
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

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

int main() {
    int t, n, l, r;
    cin >> t;
    for (int i = 0; i < t; i++) {
        vector<int> lArr, rArr;
        cin >> n >> l >> r;
        for (int j = 1; j <= n; j++) {
            int a;
            cin >> a;
            if (j <= r) lArr.push_back(a);
            if (j >= l) rArr.push_back(a);
        }

        sort(lArr.begin(), lArr.end());
        sort(rArr.begin(), rArr.end());
        long max1 = 0, max2 = 0;

        for (int k = 0; k < r - l + 1; k++) {
            max1 += lArr[k];
            max2 += rArr[k];
        }
        cout << min(max1, max2) << "\n";
    }
}


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

int main() {
    int t, n, l, r;
    cin >> t;
    for (int i = 0; i < t; i++) {
        vector<int> lArr, rArr;
        cin >> n >> l >> r;
        for (int j = 1; j <= n; j++) {
            int a;
            cin >> a;
            if (j <= r) lArr.push_back(a);
            if (j >= l) rArr.push_back(a);
        }

        sort(lArr.begin(), lArr.end());
        sort(rArr.begin(), rArr.end());
        int max1 = 0, max2 = 0;

        for (int k = 0; k < r - l + 1; k++) {
            max1 = (max1 + lArr[k] < 0) ? INT_MAX : max1 + lArr[k];
            max2 = (max2 + rArr[k] < 0) ? INT_MAX : max2 + rArr[k];
        }
        cout << min(max1, max2) << "\n";
    }
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

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

int main() {
    int t, n, l, r;
    cin >> t;
    for (int i = 0; i < t; i++) {
        vector<int> lArr, rArr;
        cin >> n >> l >> r;
        for (int j = 1; j <= n; j++) {
            int a;
            cin >> a;
            if (j <= r) lArr.push_back(a);
            if (j >= l) rArr.push_back(a);
        }

        sort(lArr.begin(), lArr.end());
        sort(rArr.begin(), rArr.end());
        long max1 = 0, max2 = 0;

        for (int k = 0; k < r - l + 1; k++) {
            max1 = (max1 + lArr[k] < 0) ? LONG_MAX : max1 + lArr[k];
            max2 = (max2 + rArr[k] < 0) ? LONG_MAX : max2 + rArr[k];
        }
        cout << min(max1, max2) << "\n";
    }
}


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

int main() {
    int t, n, l, r;
    cin >> t;
    for (int i = 0; i < t; i++) {
        vector<int> lArr, rArr;
        cin >> n >> l >> r;
        for (int j = 1; j <= n; j++) {
            int a;
            cin >> a;
            if (j <= r) lArr.push_back(a);
            if (j >= l) rArr.push_back(a);
        }

        sort(lArr.begin(), lArr.end());
        sort(rArr.begin(), rArr.end());
        long long max1 = 0, max2 = 0;

        for (int k = 0; k < r - l + 1; k++) {
            max1 = (max1 + lArr[k] < 0) ? LLONG_MAX : max1 + lArr[k];
            max2 = (max2 + rArr[k] < 0) ? LLONG_MAX : max2 + rArr[k];
        }
        cout << min(max1, max2) << "\n";
    }
}