ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int md= 998244353;
const int N=200005;
const int M=1<<13;
int dx[]={0,0,-1,1};
int dy[]={1,-1,0,0};
string dir="RLDU";
vector<int>v;
signed main()
{
    //freopen("distinct.in","r",stdin);
   //freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
    int t=1;cin>>t;
    while(t--)
    {
        string s;cin>>s;
        int sum=0;
        int num2=0,num3=0;
        for(auto&it:s)sum+=it-'0',num2+=(it=='2'),num3+=(it=='3');
        sum%=9;
        if(!sum)cout<<"YES\n";
        else
        {
            if((sum==1&&(num2>=4||(num2&&num3)))||(sum==3&&(num2>=3||num3))||(sum==5&&(num2>=2))||(sum==7&&num2)||(sum==2&&((num2>=8)||(num3&&num2>=5)||(num3>=2&&num2>=2)))||(sum==4&&((num2>=7)||(num3&&num2>=4)||(num3>=2&&num2>=1)))||(sum==6&&((num2>=6)||(num3&&num2>=3)||(num3>=2))))cout<<"YES\n";
             else cout<<"NO\n";
        }
    }
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int md= 998244353;
const int N=200005;
const int M=1<<13;
int dx[]={0,0,-1,1};
int dy[]={1,-1,0,0};
string dir="RLDU";
vector<int>v;
signed main()
{
    //freopen("distinct.in","r",stdin);
   //freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);

    int t=1;cin>>t;
    while(t--)
    {
        string s;cin>>s;
        int sum=0,f=0;
        int num2=0,num3=0;
        for(auto&it:s)sum+=it-'0',num2+=(it=='2'),num3+=(it=='3');
        sum%=9;
        if(!sum)cout<<"YES\n";
        else
        {
            for(int i=9;i<=9*s.size();i+=9)
            {
                int rem=i-sum;
                int n6=rem/6;
                n6=min(n6,num3);
                rem-=6*n6;
                if(rem%2==0&&(rem/2)<=num2)f=1;
            }
            if(f)cout<<"YES\n";
            else cout<<"NO\n";
        }
    }
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int md= 998244353;
const int N=200005;
const int M=1<<13;
int dx[]={0,0,-1,1};
int dy[]={1,-1,0,0};
string dir="RLDU";
vector<vector<int>>dp;
string a,b,c;
int n,m;
int rec(int i,int j)
{
    if(i>a.size()||j>b.size())return 1e9;

    if(i==a.size())
    {
        int rem=0;
        for(int k=j;k<b.size();k++)
            if(b[k]!=c[j+a.size()])rem++;
        return rem;
    }
    if(j==b.size())
    {
        int rem=0;
        for(int k=i;k<a.size();k++)
            if(a[k]!=c[i+b.size()])rem++;
        return rem;
    }
    int &ret=dp[i][j];
    if(~ret)return ret;
    ret=1e9;
    if(i+1<=a.size())ret=min(ret,rec(i+1,j)+(c[i+j]!=a[i]));
    if(j+1<=b.size())ret=min(ret,rec(i,j+1)+(c[i+j]!=b[j]));

    return ret;
}
signed main()
{
    //freopen("distinct.in","r",stdin);
   //freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
    int t=1;cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        dp=vector<vector<int>>(a.size()+5,vector<int>(b.size()+5,-1));
        cout<<rec(0,0)<<'\n';
    }
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int md= 998244353;
const int N=200005;
const int M=1<<13;
int dx[]={0,0,-1,1};
int dy[]={1,-1,0,0};
string dir="RLDU";
vector<vector<int>>dp;
string a,b,c;
int n,m;
int rec(int i,int j)
{
    if(i>a.size()||j>b.size())return 1e9;

    if(i==a.size())
    {
        int rem=0;
        for(int k=j;k<b.size();k++)
            if(b[k]!=c[k+a.size()])rem++;
        return rem;
    }
    if(j==b.size())
    {
        int rem=0;
        for(int k=i;k<a.size();k++)
            if(a[k]!=c[k+b.size()])rem++;
        return rem;
    }
    int &ret=dp[i][j];
    if(~ret)return ret;
    ret=1e9;
    if(i+1<=a.size())ret=min(ret,rec(i+1,j)+(c[i+j]!=a[i]));
    if(j+1<=b.size())ret=min(ret,rec(i,j+1)+(c[i+j]!=b[j]));

    return ret;
}
signed main()
{
    //freopen("distinct.in","r",stdin);
   //freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
    int t=1;cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        dp=vector<vector<int>>(a.size()+5,vector<int>(b.size()+5,-1));
        cout<<rec(0,0)<<'\n';
    }
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int md= 998244353;
const int N=200005;
const int M=1<<13;
int dx[]={0,0,-1,1};
int dy[]={1,-1,0,0};
string dir="RLDU";
vector<vector<int>>dp;
string a,b,c;
int n,m;
int rec(int i,int j)
{
    if(i==a.size())
    {
        int rem=0;
        for(int k=j;k<b.size();k++)
            if(b[k]!=c[j+a.size()])rem++;
        return rem;
    }
    if(j==b.size())
    {
        int rem=0;
        for(int k=i;k<a.size();k++)
            if(a[k]!=c[i+b.size()])rem++;
        return rem;
    }
    int &ret=dp[i][j];
    if(~ret)return ret;
    ret=min(rec(i+1,j)+(c[i+j]!=a[i]),rec(i,j+1)+(c[i+j]!=b[j]));

    return ret;
}
signed main()
{
    //freopen("distinct.in","r",stdin);
   //freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
    int t=1;cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        dp=vector<vector<int>>(a.size()+5,vector<int>(b.size()+5,-1));
        cout<<rec(0,0)<<'\n';
    }
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int md= 998244353;
const int N=200005;
const int M=1<<13;
int dx[]={0,0,-1,1};
int dy[]={1,-1,0,0};
string dir="RLDU";
vector<vector<int>>dp;
string a,b,c;
int n,m;
int rec(int i,int j)
{
    if(i>a.size()||j>b.size())return 1e9;

    if(i==a.size())
    {
        int rem=0;
        for(int k=j;k<b.size();k++)
            if(b[k]!=c[j+a.size()])rem++;
        return rem;
    }
    if(j==b.size())
    {
        int rem=0;
        for(int k=i;k<a.size();k++)
            if(a[k]!=c[i+b.size()])rem++;
        return rem;
    }
    int &ret=dp[i][j];
    if(~ret)return ret;
    ret=1e9;
    if(i+1<=a.size())ret=min(ret,rec(i+1,j)+(c[i+j]!=a[i]));
    if(j+1<=b.size())ret=min(ret,rec(i,j+1)+(c[i+j]!=b[j]));

    return ret;
}
signed main()
{
    //freopen("distinct.in","r",stdin);
   //freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
    int t=1;cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        dp=vector<vector<int>>(a.size()+5,vector<int>(b.size()+5,-1));
        cout<<rec(0,0)<<'\n';
    }
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int md= 998244353;
const int N=200005;
const int M=1<<13;
int dx[]={0,0,-1,1};
int dy[]={1,-1,0,0};
string dir="RLDU";
vector<vector<int>>dp;
string a,b,c;
int n,m;
int rec(int i,int j)
{
    if(i==a.size())
    {
        int rem=0;
        for(int k=j;k<b.size();k++)
            if(b[k]!=c[j+a.size()])rem++;
        return rem;
    }
    if(j==b.size())
    {
        int rem=0;
        for(int k=i;k<a.size();k++)
            if(a[k]!=c[i+b.size()])rem++;
        return rem;
    }
    int &ret=dp[i][j];
    if(~ret)return ret;
    ret=min(rec(i+1,j)+(c[i+j]!=a[i]),rec(i,j+1)+(c[i+j]!=b[j]));

    return ret;
}
signed main()
{
    //freopen("distinct.in","r",stdin);
   //freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
    int t=1;cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        dp=vector<vector<int>>(a.size()+5,vector<int>(b.size()+5,-1));
        cout<<rec(0,0)<<'\n';
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 5):
#include <stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  int a[n+1], b[n+1];
  for(int i = 1; i <= n; ++i){
    scanf("%d", &a[i]);
    b[a[i]] = i;
  }
  //先统计最多交换次数
  int sum = 0;
  for(int i = n; i >= 2; i--){
    sum += i-1;
    int pos;
    for(int j = 1; j <= n; j++)
      if(b[j] == i) pos = j;
    for(int j = 1; j < pos; j++)
      if(b[j] < i) sum++;
  }
  printf("%d\n", sum);
  //再输出交换方式
  for(int i = n; i >= 2; i--){
    int pos;
    for(int j = 1; j <= n; j++)
      if(b[j] == i) pos = j;
    for(int j = pos-1; j >= 1; j--)
      if(b[j] < i) printf("%d %d\n", a[b[pos]], a[b[j]]);
    for(int j = 1; j < pos; j++)
      if(b[j] < i) printf("%d %d\n", a[b[j]], a[b[pos]]);
    for(int j = pos+1; j <= i; j++)
      printf("%d %d\n", a[b[j]], a[b[pos]]);
  }
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 4):
#include <stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  int a[n+1], b[n+1];
  for(int i = 1; i <= n; ++i){
    scanf("%d", &a[i]);
    b[a[i]] = i;
  }
  //先统计最多交换次数
  int sum = 0;
  for(int i = n; i >= 2; i--){
    sum += i-1;
    int pos;
    for(int j = 1; j <= n; j++)
      if(b[j] == i) pos = j;
    for(int j = 1; j < pos; j++)
      if(b[j] < i) sum++;
  }
  printf("%d\n", sum);
  //再输出交换方式
  for(int i = n; i >= 2; i--){
    int pos;
    for(int j = 1; j <= n; j++)
      if(b[j] == i) pos = j;
    for(int j = pos-1; j >= 1; j--)
      if(b[j] < i) printf("%d %d\n", a[b[pos]], a[b[j]]);
    for(int j = 1; j < pos; j++)
      if(b[j] < i) printf("%d %d\n", a[b[j]], a[b[pos]]);
    for(int j = pos+1; j <= n; j++)
      printf("%d %d\n", a[b[j]], a[b[pos]]);
  }
  return 0;
}

Submission (verdict: Accepted):
#include <stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  int a[n+1], b[n+1];
  for(int i = 1; i <= n; ++i){
    scanf("%d", &a[i]);
    b[a[i]] = i;
  }
  //先统计最多交换次数
  int sum = 0;
  for(int i = n; i >= 2; i--){
    sum += i-1;
    int pos;
    for(int j = 1; j <= n; j++)
      if(b[j] == i) pos = j;
    for(int j = 1; j < pos; j++)
      if(b[j] < i) sum++;
  }
  printf("%d\n", sum);
  //再输出交换方式
  for(int i = n; i >= 2; i--){
    int pos;
    for(int j = 1; j <= n; j++)
      if(b[j] == i) pos = j;
    for(int j = pos-1; j >= 1; j--)
      if(b[j] < i) printf("%d %d\n", a[i], a[b[j]]);
    for(int j = 1; j < pos; j++)
      if(b[j] < i) printf("%d %d\n", a[b[j]], a[i]);
    for(int j = pos+1; j <= n; j++)
      if(b[j] < i) printf("%d %d\n", a[b[j]], a[i]);
  }
  return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 5):
#include <stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  int a[n+1], b[n+1];
  for(int i = 1; i <= n; ++i){
    scanf("%d", &a[i]);
    b[a[i]] = i;
  }
  //先统计最多交换次数
  int sum = 0;
  for(int i = n; i >= 2; i--){
    sum += i-1;
    int pos;
    for(int j = 1; j <= n; j++)
      if(b[j] == i) pos = j;
    for(int j = 1; j < pos; j++)
      if(b[j] < i) sum++;
  }
  printf("%d\n", sum);
  //再输出交换方式
  for(int i = n; i >= 2; i--){
    int pos;
    for(int j = 1; j <= n; j++)
      if(b[j] == i) pos = j;
    for(int j = pos-1; j >= 1; j--)
      if(b[j] < i) printf("%d %d\n", a[b[pos]], a[b[j]]);
    for(int j = 1; j < pos; j++)
      if(b[j] < i) printf("%d %d\n", a[b[j]], a[b[pos]]);
    for(int j = pos+1; j <= i; j++)
      printf("%d %d\n", a[b[j]], a[b[pos]]);
  }
}

Submission (verdict: Wrong answer on test 4):
#include <stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  int a[n+1], b[n+1];
  for(int i = 1; i <= n; ++i){
    scanf("%d", &a[i]);
    b[a[i]] = i;
  }
  //先统计最多交换次数
  int sum = 0;
  for(int i = n; i >= 2; i--){
    sum += i-1;
    int pos;
    for(int j = 1; j <= n; j++)
      if(b[j] == i) pos = j;
    for(int j = 1; j < pos; j++)
      if(b[j] < i) sum++;
  }
  printf("%d\n", sum);
  //再输出交换方式
  for(int i = n; i >= 2; i--){
    int pos;
    for(int j = 1; j <= n; j++)
      if(b[j] == i) pos = j;
    for(int j = pos-1; j >= 1; j--)
      if(b[j] < i) printf("%d %d\n", a[b[pos]], a[b[j]]);
    for(int j = 1; j < pos; j++)
      if(b[j] < i) printf("%d %d\n", a[b[j]], a[b[pos]]);
    for(int j = pos+1; j <= n; j++)
      printf("%d %d\n", a[b[j]], a[b[pos]]);
  }
  return 0;
}
Problem: 2063B - Subsequence Update
Language: PyPy 3-64


Submission (verdict: Wrong answer on test 1):
import sys
lines = sys.stdin.read().splitlines()
t = int(lines[0])

for i in range(1, t + 1):
    n,l,r = list(map(int,lines[2 * i - 1].split()))
    nums = list(map(int,lines[2 * i].split()))
    l -= 1
    r -= 1
    summ = min(sum(nums[:r + 1]),sum(nums[l:]))
    print(summ)
Problem: 2063B - Subsequence Update
Language: PyPy 3-64

Previous submission (verdict: Runtime error on test 1):
import sys
lines = sys.stdin.read().splitlines()
t = int(lines[0])

for i in range(1, t + 1):
    n,l,r = list(map(int,lines[2 * i - 1].split()))
    nums = list(map(int,lines[2 * i].split()))
    l -= 1
    r -= 1
    arr1 = nums[:r + 1]
    arr1.sort()
    summ1 = r
    for j in range(r - l + 1):
        summ1 += arr1[j]
    arr2 = nums[l:]
    arr2.sort()
    for j in range(r - l + 1):
        summ2 += arr2[j]
    print(min(summ1,summ2))
        
        

Submission (verdict: Wrong answer on test 1):
import sys
lines = sys.stdin.read().splitlines()
t = int(lines[0])

for i in range(1, t + 1):
    n,l,r = list(map(int,lines[2 * i - 1].split()))
    nums = list(map(int,lines[2 * i].split()))
    l -= 1
    r -= 1
    arr1 = nums[:r + 1]
    arr1.sort()
    summ1 = r
    for j in range(r - l + 1):
        summ1 += arr1[j]
    arr2 = nums[l:]
    arr2.sort()
    summ2 = 0
    for j in range(r - l + 1):
        summ2 += arr2[j]
    print(min(summ1,summ2))
Problem: 2063B - Subsequence Update
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 1):
import sys
lines = sys.stdin.read().splitlines()
t = int(lines[0])

for i in range(1, t + 1):
    n,l,r = list(map(int,lines[2 * i - 1].split()))
    nums = list(map(int,lines[2 * i].split()))
    l -= 1
    r -= 1
    summ = min(sum(nums[:r + 1]),sum(nums[l:]))
    print(summ)
        
        

Submission (verdict: Runtime error on test 1):
import sys
lines = sys.stdin.read().splitlines()
t = int(lines[0])

for i in range(1, t + 1):
    n,l,r = list(map(int,lines[2 * i - 1].split()))
    nums = list(map(int,lines[2 * i].split()))
    l -= 1
    r -= 1
    arr1 = nums[:r + 1]
    arr1.sort()
    summ1 = r
    for j in range(r - l + 1):
        summ1 += arr1[j]
    arr2 = nums[l:]
    arr2.sort()
    for j in range(r - l + 1):
        summ2 += arr2[j]
    print(min(summ1,summ2))
Problem: 2063B - Subsequence Update
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 1):
import sys
lines = sys.stdin.read().splitlines()
t = int(lines[0])

for i in range(1, t + 1):
    n,l,r = list(map(int,lines[2 * i - 1].split()))
    nums = list(map(int,lines[2 * i].split()))
    l -= 1
    r -= 1
    arr1 = nums[:r + 1]
    arr1.sort()
    summ1 = r
    for j in range(r - l + 1):
        summ1 += arr1[j]
    arr2 = nums[l:]
    arr2.sort()
    summ2 = 0
    for j in range(r - l + 1):
        summ2 += arr2[j]
    print(min(summ1,summ2))
        
        

Submission (verdict: Accepted):
import sys
lines = sys.stdin.read().splitlines()
t = int(lines[0])

for i in range(1, t + 1):
    n,l,r = list(map(int,lines[2 * i - 1].split()))
    nums = list(map(int,lines[2 * i].split()))
    l -= 1
    r -= 1
    arr1 = nums[:r + 1]
    arr1.sort()
    summ1 = 0
    for j in range(r - l + 1):
        summ1 += arr1[j]
    arr2 = nums[l:]
    arr2.sort()
    summ2 = 0
    for j in range(r - l + 1):
        summ2 += arr2[j]
    print(min(summ1,summ2))
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


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

#define ll long long

using namespace std;

const int N=2e5+5;

int n,m;

int a[N];

signed main() {

int T;

cin>>T;

while(T--)

{

cin>>n;

for(int i=1;i<=n;i++) cin>>a[i];

int ok=1;

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

{

if(a[i]==a[i-1]) i++;

else if(a[i]-a[i-1]==1) break;

else

{

ok=0;

break;

}

}

if(ok) cout<<"YES\n";

else cout<<"NO\n";

}

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>

#define ll long long

using namespace std;

const int N=2e5+5;

int n,m;

int a[N];

signed main() {

int T;

cin>>T;

while(T--)

{

cin>>n;

for(int i=1;i<=n;i++) cin>>a[i];

int ok=1;

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

{

if(a[i-1]<=a[i]&&a[i]%a[i-1]==0) i++;

else if(a[i-1]==1||(a[i-1]<a[i]&&a[i]%a[i-1]==1)) break;

else

{

ok=0;

break;

}

}

if(ok) cout<<"YES\n";

else cout<<"NO\n";

}

return 0;

}



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

#define ll long long

using namespace std;

const int N=2e5+5;

int n,m;

int a[N];

signed main() {

int T;

cin>>T;

while(T--)

{

cin>>n;

for(int i=1;i<=n;i++) cin>>a[i];

int ok=1;

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

{

if(a[i-1]==1||(a[i-1]<a[i]&&a[i]%a[i-1]==1)) break;

else if(a[i-1]<=a[i]&&a[i]%a[i-1]==0) i++;

else

{

ok=0;

break;

}

}

if(ok) cout<<"YES\n";

else cout<<"NO\n";

}

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>

#define ll long long

using namespace std;

const int N=2e5+5;

int n,m;

int a[N];

signed main() {

int T;

cin>>T;

while(T--)

{

cin>>n;

for(int i=1;i<=n;i++) cin>>a[i];

int ok=1;

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

{

if(a[i-1]==1||(a[i-1]<a[i]&&a[i]%a[i-1]==1)) break;

else if(a[i-1]<=a[i]&&a[i]%a[i-1]==0) i++;

else

{

ok=0;

break;

}

}

if(ok) cout<<"YES\n";

else cout<<"NO\n";

}

return 0;

}



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

#define ll long long

using namespace std;

const int N=2e5+5;

int n,m;

int a[N];

signed main() {

int T;

cin>>T;

while(T--)

{

cin>>n;

for(int i=1;i<=n;i++) cin>>a[i];

int ok=1;

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

{

if(a[i]>=a[i-1])

{

a[i]-=a[i-1];

a[i-1]=0;

}

else

{

ok=0;

break;

}

}

if(ok) cout<<"YES\n";

else cout<<"NO\n";

}

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>

#define ll long long

using namespace std;

const int N=2e5+5;

int n,m;

int a[N];

signed main() {

int T;

cin>>T;

while(T--)

{

cin>>n;

for(int i=1;i<=n;i++) cin>>a[i];

int ok=1;

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

{

if(a[i]==a[i-1]) i++;

else if(a[i]-a[i-1]==1) break;

else

{

ok=0;

break;

}

}

if(ok) cout<<"YES\n";

else cout<<"NO\n";

}

return 0;

}



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

#define ll long long

using namespace std;

const int N=2e5+5;

int n,m;

int a[N];

signed main() {

int T;

cin>>T;

while(T--)

{

cin>>n;

for(int i=1;i<=n;i++) cin>>a[i];

int ok=1;

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

{

if(a[i]==a[i-1]) i++;

else if(a[i-1]==1||a[i]%a[i-1]==1) break;

else

{

ok=0;

break;

}

}

if(ok) cout<<"YES\n";

else cout<<"NO\n";

}

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>

#define ll long long

using namespace std;

const int N=2e5+5;

int n,m;

int a[N];

signed main() {

int T;

cin>>T;

while(T--)

{

cin>>n;

for(int i=1;i<=n;i++) cin>>a[i];

int ok=1;

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

{

if(a[i]==a[i-1]) i++;

else if(a[i-1]==1||a[i]%a[i-1]==1) break;

else

{

ok=0;

break;

}

}

if(ok) cout<<"YES\n";

else cout<<"NO\n";

}

return 0;

}



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

#define ll long long

using namespace std;

const int N=2e5+5;

int n,m;

int a[N];

signed main() {

int T;

cin>>T;

while(T--)

{

cin>>n;

for(int i=1;i<=n;i++) cin>>a[i];

int ok=1;

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

{

if(a[i-1]<=a[i]&&a[i]%a[i-1]==0) i++;

else if(a[i-1]==1||(a[i-1]<a[i]&&a[i]%a[i-1]==1)) break;

else

{

ok=0;

break;

}

}

if(ok) cout<<"YES\n";

else cout<<"NO\n";

}

return 0;

}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

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

using namespace std;
int main() {
  int num_tests;
  cin >> num_tests;

  for (int t = 0; t < num_tests; ++t) {
    int n;
    cin >> n;
    vector<int> a;
    int s = 0;
    for (int i = 0; i < n; ++i) {
      int ai;
      cin >> ai;
      s += ai;
      a.push_back(ai);
    }

    vector<int> b;
    while (a.size() >= 2) {
      int next_s = 0;
      if (a[0] > a[a.size() - 1]) {
        reverse(a.begin(), a.end());
      }
      for (int i = 1; i < a.size(); ++i) {
        next_s += a[i] - a[i - 1];
        b.push_back(a[i] - a[i - 1]);
      }
      if (next_s > s) {
        s = next_s;
      }
      a = b;
      b.clear();
    }
    printf("%d\n", s);
  }
}


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

using namespace std;
int main() {
  int num_tests;
  cin >> num_tests;

  for (int t = 0; t < num_tests; ++t) {
    int n;
    cin >> n;
    vector<long> a;
    int s = 0;
    for (int i = 0; i < n; ++i) {
      long ai;
      cin >> ai;
      s += ai;
      a.push_back(ai);
    }

    vector<long> b;
    while (a.size() >= 2) {
      long next_s = 0;
      if (a[0] > a[a.size() - 1]) {
        reverse(a.begin(), a.end());
      }
      for (int i = 1; i < a.size(); ++i) {
        next_s += a[i] - a[i - 1];
        b.push_back(a[i] - a[i - 1]);
      }
      if (next_s > s) {
        s = next_s;
      }
      a = b;
      b.clear();
    }
    printf("%d\n", s);
  }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


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

using namespace std;
int main() {
  int num_tests;
  cin >> num_tests;

  for (int t = 0; t < num_tests; ++t) {
    int n;
    cin >> n;
    vector<int> a;
    int s = 0;
    for (int i = 0; i < n; ++i) {
      int ai;
      cin >> ai;
      s += ai;
      a.push_back(ai);
    }

    vector<int> b;
    while (a.size() >= 2) {
      int next_s = 0;
      if (a[0] > a[a.size() - 1]) {
        reverse(a.begin(), a.end());
      }
      for (int i = 1; i < a.size(); ++i) {
        next_s += a[i] - a[i - 1];
        b.push_back(a[i] - a[i - 1]);
      }
      if (next_s > s) {
        s = next_s;
      }
      a = b;
      b.clear();
    }
    printf("%d\n", s);
  }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

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

using namespace std;
int main() {
  int num_tests;
  cin >> num_tests;

  for (int t = 0; t < num_tests; ++t) {
    int n;
    cin >> n;
    vector<long> a;
    int s = 0;
    for (int i = 0; i < n; ++i) {
      long ai;
      cin >> ai;
      s += ai;
      a.push_back(ai);
    }

    vector<long> b;
    while (a.size() >= 2) {
      long next_s = 0;
      if (a[0] > a[a.size() - 1]) {
        reverse(a.begin(), a.end());
      }
      for (int i = 1; i < a.size(); ++i) {
        next_s += a[i] - a[i - 1];
        b.push_back(a[i] - a[i - 1]);
      }
      if (next_s > s) {
        s = next_s;
      }
      a = b;
      b.clear();
    }
    printf("%d\n", s);
  }
}


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

using namespace std;
int main() {
  int num_tests;
  cin >> num_tests;

  for (int t = 0; t < num_tests; ++t) {
    int n;
    cin >> n;
    vector<long long> a;
    long long s = 0;
    for (int i = 0; i < n; ++i) {
      long ai;
      cin >> ai;
      s += ai;
      a.push_back(ai);
    }

    vector<long long> b;
    while (a.size() >= 2) {
      long long next_s = 0;
      if (a[0] > a[a.size() - 1]) {
        reverse(a.begin(), a.end());
      }
      for (int i = 1; i < a.size(); ++i) {
        next_s += a[i] - a[i - 1];
        b.push_back(a[i] - a[i - 1]);
      }
      if (next_s > s) {
        s = next_s;
      }
      a = b;
      b.clear();
    }
    printf("%lld\n", s);
  }
}