ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
struct node{
    int l;
    int r;
    int idx;

};
bool cmp(node a,node b){

    if(a.l!=b.l)return a.l<b.l;
    else return a.r<b.r;

}

int gcd(int a,int b){
    return b? gcd(b,a%b):a;
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int ans=0;
int func(int fa,int u,vector<vector<int>> &g){
    if(g[u].size()==1&&u!=1){
        return 0;
    }
    int a=0;int b=0;
    for(int i=0;i<g[u].size();i++){
       if(g[u][i]!=fa){
        a=max(a,func(u,g[u][i],g));
        b=max(b,(int)g[g[u][i]].size()-(int)1);
       }
    }
    if(a!=0){
         if(u!=1)ans=max(ans,max(b-(int)1,a)+(int)g[u].size());
    else ans=max(ans,max(b-(int)1,a)+(int)g[u].size());

    }
    else{
        if(u!=1){
            ans=max(ans,b-(int)1+(int)g[u].size());
        }
         else ans=max(ans,b-(int)1+(int)g[u].size());
    }

    return max(a,b);

}
signed main()
{
    int q;
    cin>>q;
    while(q>0){
        int n;
        cin>>n;
        vector<vector<int>> g(n+1);
        for(int i=0;i<n-1;i++){
            int u,v;
            cin>>u>>v;
            g[u].push_back(v);
            g[v].push_back(u);
        }
        func(0,1,g);
        cout<<ans<<endl;
        ans=0;

        q--;
    }

    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
struct node{
    int l;
    int r;
    int idx;

};
bool cmp(node a,node b){

    if(a.l!=b.l)return a.l<b.l;
    else return a.r<b.r;

}

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

void func(int fa,int u,vector<vector<int>> &g,multiset<int> &st){
    if(g[u].size()==1&&u!=1) return ;
    int adjmax=0;
    for(int i=0;i<g[u].size();i++){
       adjmax=max(adjmax,(int)g[g[u][i]].size());
       st.erase(g[g[u][i]].size());
    }
    st.erase(g[u].size());
        ans=max(ans,adjmax+(int)g[u].size()-(int)2);
        if(!st.empty())ans=max(ans,(int)g[u].size()-(int)1+*st.rbegin());

        for(int i=0;i<g[u].size();i++){
          st.insert(g[g[u][i]].size());
        }
        st.insert(g[u].size());
           for(int i=0;i<g[u].size();i++){
             if(g[u][i]!=fa)func(u,g[u][i],g,st);
        }


}
signed main()
{
    int q;
    cin>>q;
    while(q>0){
        int n;
        cin>>n;
        vector<vector<int>> g(n+1);
        vector<int> degree(n+1,0);
        multiset<int> st;
        for(int i=0;i<n-1;i++){
            int u,v;
            cin>>u>>v;
            g[u].push_back(v);
            g[v].push_back(u);
            degree[u]++;
            degree[v]++;
        }
        for(int i=1;i<=n;i++){
            st.insert(degree[i]);
        }
        func(0,1,g,st);
        cout<<ans<<endl;
        ans=0;

        q--;
    }

    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
struct node{
    int l;
    int r;
    int idx;

};
bool cmp(node a,node b){

    if(a.l!=b.l)return a.l<b.l;
    else return a.r<b.r;

}

int gcd(int a,int b){
    return b? gcd(b,a%b):a;
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int ans=0;
int func(int fa,int u,vector<vector<int>> &g){
    if(g[u].size()==1&&u!=1){
        return 0;
    }
    int a=0;int b=0;
    for(int i=0;i<g[u].size();i++){
       if(g[u][i]!=fa){
        a=max(a,func(u,g[u][i],g));
        b=max(b,(int)g[g[u][i]].size()-(int)1);
       }
    }
    if(a!=0){
         if(u!=1)ans=max(ans,max(b-(int)1,a)+(int)g[u].size());
    else ans=max(ans,max(b-(int)1,a)+(int)g[u].size());

    }
    else{
        if(u!=1){
            ans=max(ans,b-(int)1+(int)g[u].size());
        }
         else ans=max(ans,b-(int)1+(int)g[u].size());
    }

    return max(a,b);

}
signed main()
{
    int q;
    cin>>q;
    while(q>0){
        int n;
        cin>>n;
        vector<vector<int>> g(n+1);
        for(int i=0;i<n-1;i++){
            int u,v;
            cin>>u>>v;
            g[u].push_back(v);
            g[v].push_back(u);
        }
        func(0,1,g);
        cout<<ans<<endl;
        ans=0;

        q--;
    }

    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)


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

using namespace std;

#define no_luv_no_life ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define fre(NAME)        freopen(NAME".inp","r",stdin); freopen(NAME".out","w",stdout)

#define NGUYEN_PHAM_KHANH_NGOC_CUTE main

#define el "\n"

#define int long long

int t,n,l,r,ans,A[200001];

signed NGUYEN_PHAM_KHANH_NGOC_CUTE()

{

    no_luv_no_life;

   // fre("luvispain");

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        ans=0;

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

            cin>>A[i];

        sort(A+1,A+1+n);

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

            ans+=A[i];

        cout<<ans<<el;

    }

  return 0; 

}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

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

using namespace std;

#define no_luv_no_life ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define fre(NAME)        freopen(NAME".inp","r",stdin); freopen(NAME".out","w",stdout)

#define NGUYEN_PHAM_KHANH_NGOC_CUTE main

#define el "\n"

#define int long long

int t,n,l,r,ans,A[200001],B[200001],C[200001],t1,t2;

signed NGUYEN_PHAM_KHANH_NGOC_CUTE()

{

    no_luv_no_life;

    //fre("luvispain");

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        ans=t1=t2=0;

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

            cin>>A[i];

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

            B[i]=A[i];

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

            C[i-(l-1)]=A[i];

        sort(B+1,B+l+1);

        sort(C+1,C+n-l+2);

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

        {

            t1+=B[i]; 

            t2+=C[i];

        }

        cout<<min(t1,t2)<<el;

    }

  return 0; 

}



Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define no_luv_no_life ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fre(NAME)        freopen(NAME".inp","r",stdin); freopen(NAME".out","w",stdout)
#define NGUYEN_PHAM_KHANH_NGOC_CUTE main
#define el "\n"
#define int long long
int t,n,l,r,ans,A[200001],B[200001],C[200001],t1,t2;
signed NGUYEN_PHAM_KHANH_NGOC_CUTE()
{
    no_luv_no_life;
   // fre("luvispain");
    cin>>t;
    while(t--)
    {
        cin>>n>>l>>r;
        ans=t1=t2=0;
        for(int i=1;i<=n;i++)
            cin>>A[i];
        for(int i=1;i<=r;i++)
            B[i]=A[i];
        for(int i=l;i<=n;i++)
            C[i-(l-1)]=A[i];
        sort(B+1,B+r+1);
        sort(C+1,C+n-l+2);
        for(int i=1;i<=(r-l+1);i++)
        {
            t1+=B[i]; 
            t2+=C[i];
        }
        cout<<min(t1,t2)<<el;
    }
  return 0; 
}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

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

using namespace std;

#define no_luv_no_life ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define fre(NAME)        freopen(NAME".inp","r",stdin); freopen(NAME".out","w",stdout)

#define NGUYEN_PHAM_KHANH_NGOC_CUTE main

#define el "\n"

#define int long long

int t,n,l,r,ans,A[200001];

signed NGUYEN_PHAM_KHANH_NGOC_CUTE()

{

    no_luv_no_life;

   // fre("luvispain");

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        ans=0;

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

            cin>>A[i];

        sort(A+1,A+1+n);

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

            ans+=A[i];

        cout<<ans<<el;

    }

  return 0; 

}



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

using namespace std;

#define no_luv_no_life ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define fre(NAME)        freopen(NAME".inp","r",stdin); freopen(NAME".out","w",stdout)

#define NGUYEN_PHAM_KHANH_NGOC_CUTE main

#define el "\n"

#define int long long

int t,n,l,r,ans,A[200001],B[200001],C[200001],t1,t2;

signed NGUYEN_PHAM_KHANH_NGOC_CUTE()

{

    no_luv_no_life;

    //fre("luvispain");

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        ans=t1=t2=0;

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

            cin>>A[i];

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

            B[i]=A[i];

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

            C[i-(l-1)]=A[i];

        sort(B+1,B+l+1);

        sort(C+1,C+n-l+2);

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

        {

            t1+=B[i]; 

            t2+=C[i];

        }

        cout<<min(t1,t2)<<el;

    }

  return 0; 

}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
// Aur Bhai Dekhne aagaye ;)

// Author: Parul(OG)

#include <bits/stdc++.h>

using namespace std;

#define pi (3.141592653589)

#define mod 1000000007

#define inp(x) \

    int x;     \

    cin >> x;

#define pb push_back

#define scanarr                 \

    int arr[n];                 \

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

    cin >> arr[i]

#define pb push_back

#define is insert

#define fre(i, b) for (int i = 0; i < (int)(b); i++)

#define mp make_pair

#define ff first

#define ss second

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

#define min3(a, b, c) min(c, min(a, b))

#define min4(a, b, c, d) min(d, min(c, min(a, b)))

#define inpvi(n) \

    vi a(n);     \

    fr(n) { cin >> a[i]; }

#define rfr(n) for (int i = n - 1; i >= 0; i--)

#define rep1(i, a, b) for (long long i = a; i <= b; i++)

#define fr(n) for (long long i = 0; i < n; i++)

#define fr1(n) for (long long i = 1; i < n; i++)

#define nesfr(x, y)                   \

    for (long long i = 0; i < x; i++) \

        for (long long j = 0; j < y; j++)

#define rep(i, a, b) for (long long i = a; i < b; i++)

#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

typedef long long int ll;

typedef long double ld;

typedef vector<ll> vi;

typedef vector<pair<ll, ll>> vip;

#define nl cout << "\n"

const unsigned int M = 1000000007;

const int N = 2e5 + 5;



void solve()

{

    string n;

    cin >> n;



    ll sum = 0;

    bool posi = false;

    for (char digi : n)

    {

        sum += digi - '0';

    }

    if (sum % 9 == 0)

    {

        posi = true;

    }

    else

    {



        for (char digit : n)

        {

            int digi = digit - '0';

            if (digi == 2 || digi == 3)

            {

                int newsum = sum + (digi * digi) - digi;

                if (newsum % 9 == 0)

                {

                    posi = true;

                    break;

                }

            }

        }

    }

    if (posi)

    {

        cout << "YES" << endl;

    }

    else

    {

        cout << "NO" << endl;

    }

}



int main()

{

    fast;

    ll t = 1;

    cin >> t;

    while (t--)

    {

        solve();

    }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
// Aur Bhai Dekhne aagaye ;)

// Author: Parul(OG)

#include <bits/stdc++.h>

using namespace std;

#define pi (3.141592653589)

#define mod 1000000007

#define inp(x)  int x;     cin >> x;

#define pb push_back

#define scanarr                int arr[n];                  for (int i = 0; i < n; i++)  cin >> arr[i]

#define pb push_back

#define is insert

#define fre(i, b) for (int i = 0; i < (int)(b); i++)

#define mp make_pair

#define ff first

#define ss second

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

#define min3(a, b, c) min(c, min(a, b))

#define min4(a, b, c, d) min(d, min(c, min(a, b)))

#define inpvi(n) vi a(n);fr(n){cin>>a[i];}

#define rfr(n) for(int i=n-1;i>=0;i--)

#define rep1(i,a,b) for(long long i=a;i<=b;i++)

#define fr(n) for(long long i=0;i<n;i++)

#define fr1(n) for(long long i=1;i<n;i++)

#define nesfr(x,y) for(long long i=0;i<x;i++)for(long long j=0;j<y;j++)

#define rep(i,a,b) for(long long i=a;i<b;i++)

#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

typedef long long int ll;

typedef long double ld;

typedef vector<ll> vi;

typedef  vector<pair<ll, ll>> vip;

#define nl cout << "\n"

const unsigned int M = 1000000007;

const int  N = 2e5 + 5 ;





void solve() {

int n;

cin>>n;



inpvi(n);



bool possi =true;



fr1(n){

if(a[i-1]>a[i]&& a[i]>a[i+1]){

possi=false;

}

}

if(possi){

cout<<"YES"<<endl;

}else{

cout<<"NO"<<endl;

}

}





int main(){

fast;

ll t=1;

cin>>t;

while(t--)

{

solve();

}

return 0;

}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_updat
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
template<class T> using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#define ll long long
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
#ifndef ONLINE_JUDGE
#define deb(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define deb(...)
#endif
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define forEach(arr) for (auto &x : arr)
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
template <typename A, typename B>
ostream &operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.F << ", " << p.S << ")"; }
template <typename A>
ostream &operator<<(ostream &cout,vector<A> const &v){cout<<"[";for (int i = 0; i < v.size(); i++){if(i) cout<<", ";cout << v[i];} return cout << "]";}
template <typename A>
ostream &operator<<(ostream &cout,set<A> const &s){cout<<"[";for (auto &x: s){cout << s;} return cout << "]";}
template <typename A, typename B>
ostream &operator<<(ostream &cout,unordered_map<A, B> const &v){cout<<"{";for(auto &x: v){cout<<"{"<<x.first<<"="<<x.second<<"}";} return cout << "}";}
template <typename A>
istream &operator>>(istream &cin, vector<A> &v) {for (auto &i : v) cin >> i; return cin;}

const int mod = 1e9+7;
//=======================

void solve() {
  string s; cin>>s;
  int n = s.length();
  string ans;
  for(int i=0; i<n; ) {
    if(s[i] == '#') {
      i++; continue;
    }
    int j = i+1, maxValIndex = i, maxVal = s[i]-'0', hashCnt = 0;
    while(j-i <= 9 and j < n) {
      if(s[j] == '#') {
        hashCnt++; j++;
        continue;
      }
      int currVal = s[j]-'0' - (j-i) + hashCnt;
      if(currVal > maxVal) {
        maxVal = currVal; 
        maxValIndex = j;
      }
      deb(i,j, currVal, maxVal, maxValIndex);
      j++;
    }
    s[maxValIndex] = '#';
    ans += (maxVal + '0');
  }
  cout<<ans;
}


int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("error.txt", "w", stderr);
  freopen("output.out", "w", stdout);
  freopen("input.in", "r", stdin);
#endif
  auto start1 = high_resolution_clock::now();
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
    deb("tc_end\n");
  }
  auto stop1 = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop1 - start1);
#ifndef ONLINE_JUDGE
  cerr << "Time: " << duration.count()<<"ms"<< endl;
#endif
  return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)


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

#ifdef LOCAL 
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << "\033[0m" << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) cerr<<"\033[1;31m"<< "LINE "<<__LINE__<<": -> [" << #__VA_ARGS__ << "]:", dbg_out(__VA_ARGS__) 
#else
#define dbg(...) 19
#endif

#define int int64_t
#define sz(x) int(x.size())

bool check(multiset<int>& A, multiset<int>& B){
    if(sz(A) and sz(B)){
        int mxA = *A.rbegin();
        int mxB = *B.rbegin();
        if(mxB < mxA){
            return false;
        }
        int mnA = *A.begin();
        int mnB = *B.begin();
        if(mnB < mnA){
            return false;
        }
        return true;
    } else{
        return false;
    }
}

void solve(int tt){
    int N, M; cin >> N >> M;
    multiset<int> A, B; 
    for(int i = 0; i < N; ++i){
        int x; cin >> x;
        A.insert(x);
    }
    for(int i = 0; i < M; ++i){
        int x; cin >> x;
        B.insert(x);
    }

    vector<int> toRemove;
    for(int x : B){
        if(A.find(x) != A.end()){
            toRemove.push_back(x);
        }
    }
    dbg(A, B, toRemove);
    for(int x : toRemove){
        A.extract(x);
        B.extract(x);
    }

    // overlap B to A
    while(true){
        dbg(A, B);
        if(sz(A) == sz(B) and sz(A) == 0){
            break;
        }
        if(!check(A, B)){
            cout << "No\n";
            return;
        } else{
            int mn = *B.begin();
            int a = mn/2;
            int b = mn - a;
            B.extract(mn); 
            B.insert(a); 
            B.insert(b);
            dbg(A, B); 
            vector<int> toRemove;
            if(B.count(a) and A.count(a)){
                toRemove.push_back(a);
            } 
            if(B.count(b) and A.count(b)){
                toRemove.push_back(b);
            }
            for(int x : toRemove){
                B.extract(x);
                A.extract(x);
                if((!sz(A) and sz(B)) or (sz(A) and !sz(B))){
                    cout << "No\n";
                    return;
                } 
            }
        }
    }
    cout << "Yes\n";
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T=1; cin >> T;
    for(int tt = 1; tt <= T; ++tt){
        solve(tt);    
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define f(i, n) for (int i = 0; i < n; i++)
#define f1(i, n) for (int i = 1; i < n; i++)
/*
For using ordered_set :

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
1. *s.find_by_order(k) --> Returns the element present at index k.
2.  s.order_of_key(k) -->  Returns the number of elements smaller than k.
*/
#define int long long
typedef vector<int> vi;
typedef vector<pair<int, int>> vp;
typedef map<int, int> mii;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
#define pb push_back
const int mod = 1e9 + 7;

class solution
{
    static int power(int a, int b, int mod = 1e9 + 7)
    {

        int res = 1;

        while (b)
        {
            if (b & 1)
                res = (res * a) % mod;

            a = (a * a) % mod;

            b >>= 1;
        }

        return res % mod;
    }
    static void yy()
    {
        cout << "YES" << endl;
    }
    static void nn()
    {
        cout << "NO" << endl;
    }

public:
    static void solve()
    {
        int n;
        cin >> n;
        vi a(n);
        f(i, n) cin >> a[i];
        vi b = a;
        sort(all(b));
        bool flag = 1;
        f(i, n)
        {
            if (a[i] != b[i])
            {
                flag = 0;
                break;
            }
        }
        if (flag)
        {
            cout << "YES" << endl;
            return;
        }
        if(a[0]<a[1]){
            cout<<"YES"<<endl;
            return;
        }
        cout << "NO" << endl;
        
    }
};

signed
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t;
    cin >> t;
    while (t--)
    {
        solution s1;
        s1.solve();
    }
}
Problem: 2062C - Cirno and Operations
Language: PyPy 3


Submission (verdict: Wrong answer on test 6):
import sys
data = sys.stdin.read().splitlines()

line = 2
while (line < len(data)):
    arr = list(map(int, data[line].split()))
    # print("arr=", arr)
    new_arr = arr
    diff = sum(arr)
    if len(arr) == 2:
        diff = max(abs(arr[0]-arr[1]), diff)
    else:
        for i in range(len(arr)-1):
            new_arr = [new_arr[i+1]-new_arr[i] for i in range(len(new_arr)-1)]
            if diff < abs(new_arr[0] - new_arr[-1]):
                diff = abs(new_arr[0] - new_arr[-1])
            # print(new_arr, "...diff=", diff)
    print(diff)
    line += 2
Problem: 2062C - Cirno and Operations
Language: PyPy 3

Previous submission (verdict: Wrong answer on test 6):
import sys
data = sys.stdin.read().splitlines()

line = 2
while (line < len(data)):
    arr = list(map(int, data[line].split()))
    # print("arr=", arr)
    new_arr = arr
    diff = sum(arr)
    if len(arr) == 2:
        diff = max(abs(arr[0]-arr[1]), diff)
    elif len(arr) >2 :
        for i in range(len(arr)-1):
            new_arr = [new_arr[i+1]-new_arr[i] for i in range(len(new_arr)-1)]
            if diff < abs(new_arr[0] - new_arr[-1]):
                diff = abs(new_arr[0] - new_arr[-1])
            # print(new_arr, "...diff=", diff)
    print(diff)
    line += 2

Submission (verdict: Wrong answer on test 6):
import sys
data = sys.stdin.read().splitlines()

line = 2
while (line < len(data)):
    arr = list(map(int, data[line].split()))
    # print("arr=", arr)
    new_arr = arr
    diff = sum(arr)
    if len(arr) == 2:
        diff = max(abs(arr[0]-arr[1]), diff)
    elif len(arr) >2 :
        for i in range(len(arr)-2):
            new_arr = [new_arr[i+1]-new_arr[i] for i in range(len(new_arr)-1)]
            if diff < abs(new_arr[0] - new_arr[-1]):
                diff = abs(new_arr[0] - new_arr[-1])
            # print(new_arr, "...diff=", diff)
    print(diff)
    line += 2
Problem: 2062C - Cirno and Operations
Language: PyPy 3

Previous submission (verdict: Wrong answer on test 6):
import sys
data = sys.stdin.read().splitlines()

line = 2
while (line < len(data)):
    arr = list(map(int, data[line].split()))
    # print("arr=", arr)
    new_arr = arr
    diff = sum(arr)
    if len(arr) == 2:
        diff = max(abs(arr[0]-arr[1]), diff)
    elif len(arr) >2 :
        for i in range(len(arr)-2):
            new_arr = [new_arr[i+1]-new_arr[i] for i in range(len(new_arr)-1)]
            if diff < abs(new_arr[0] - new_arr[-1]):
                diff = abs(new_arr[0] - new_arr[-1])
            # print(new_arr, "...diff=", diff)
    print(diff)
    line += 2

Submission (verdict: Accepted):
import sys
data = sys.stdin.read().splitlines()

line = 2
while (line < len(data)):
    arr = list(map(int, data[line].split()))
    new_arr = arr
    diff = sum(arr)
    # print(arr, "...diff=", diff)
    if len(arr) == 2:
        diff = max(abs(arr[0]-arr[1]), diff)
    elif len(arr) > 2:
        for i in range(len(arr)-2):
            new_arr = [new_arr[i+1]-new_arr[i] for i in range(len(new_arr)-1)]
            diff = max(abs(new_arr[0]-new_arr[-1]), diff, abs(sum(new_arr)))
            # print(new_arr, "...diff=", diff)
    print(diff)
    line += 2