ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 14):
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int dp[1001][1001];
int valid[1001][1001];
int t;

int minChangedChars(string a, string b, string c)
{
  int i = a.size(), j = b.size();
  if (valid[i][j] == t)
    return dp[i][j];
  valid[i][j] = t;
  int acnt = 0, bcnt = 0;
  if (a.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != b[i])
        bcnt++;
    }
    return dp[i][j] = bcnt;
  }

  if (b.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != a[i])
        acnt++;
    }
    return dp[i][j] = acnt;
  }
  acnt = minChangedChars(a.substr(1), b, c.substr(1));
  if (a[0] != c[0])
    acnt++;
  bcnt = minChangedChars(a, b.substr(1), c.substr(1));
  if (b[0] != c[0])
    bcnt++;
  return dp[i][j] = min(acnt, bcnt);
}

int main()
{
  cin >> t;
  while (t--)
  {
    string a, b, c;
    cin >> a >> b >> c;
    cout << minChangedChars(a, b, c) << endl;
  }
  return 0;
}

Submission (verdict: Time limit exceeded on test 16):
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int dp[1001][1001];
int valid[1001][1001];
int t;

int minChangedChars(string a, string b, string c)
{
  int i = a.size(), j = b.size();
  if (valid[i][j] == t)
    return dp[i][j];
  valid[i][j] = t;
  int acnt = 0, bcnt = 0;
  if (a.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != b[i])
        bcnt++;
    }
    return dp[i][j] = bcnt;
  }

  if (b.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != a[i])
        acnt++;
    }
    return dp[i][j] = acnt;
  }
  acnt = minChangedChars(a.substr(1), b, c.substr(1));
  if (a[0] != c[0])
    acnt++;
  bcnt = minChangedChars(a, b.substr(1), c.substr(1));
  if (b[0] != c[0])
    bcnt++;
  return dp[i][j] = min(acnt, bcnt);
}

int main()
{
  cin >> t;
  t++;
  while (t > 1)
  {
    t--;
    string a, b, c;
    cin >> a >> b >> c;
    cout << minChangedChars(a, b, c) << endl;
  }
  return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 16):
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int dp[1001][1001];

int minChangedChars(string a, string b, string c)
{
  int i = a.size(), j = b.size();
  if (dp[i][j] != -1)
    return dp[i][j];
  int acnt = 0, bcnt = 0;
  if (a.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != b[i])
        bcnt++;
    }
    return dp[i][j] = bcnt;
  }

  if (b.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != a[i])
        acnt++;
    }
    return dp[i][j] = acnt;
  }
  acnt = minChangedChars(a.substr(1), b, c.substr(1));
  if (a[0] != c[0])
    acnt++;
  bcnt = minChangedChars(a, b.substr(1), c.substr(1));
  if (b[0] != c[0])
    bcnt++;
  return dp[i][j] = min(acnt, bcnt);
}

int main()
{
  ll t;
  cin >> t;
  while (t--)
  {
    string a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i <= a.size(); i++)
      for (int j = 0; j <= b.size(); j++)
        dp[i][j] = -1;
    cout << minChangedChars(a, b, c) << endl;
  }
  return 0;
}

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

int dp[1001][1001];
int valid[1001][1001];
int t;

int minChangedChars(string a, string b, string c)
{
  int i = a.size(), j = b.size();
  if (valid[i][j] == t)
    return dp[i][j];
  valid[i][j] = t;
  int acnt = 0, bcnt = 0;
  if (a.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != b[i])
        bcnt++;
    }
    return dp[i][j] = bcnt;
  }

  if (b.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != a[i])
        acnt++;
    }
    return dp[i][j] = acnt;
  }
  acnt = minChangedChars(a.substr(1), b, c.substr(1));
  if (a[0] != c[0])
    acnt++;
  bcnt = minChangedChars(a, b.substr(1), c.substr(1));
  if (b[0] != c[0])
    bcnt++;
  return dp[i][j] = min(acnt, bcnt);
}

int main()
{
  cin >> t;
  while (t--)
  {
    string a, b, c;
    cin >> a >> b >> c;
    cout << minChangedChars(a, b, c) << endl;
  }
  return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 16):
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int dp[1001][1001];
int valid[1001][1001];
int t;

int minChangedChars(string a, string b, string c)
{
  int i = a.size(), j = b.size();
  if (valid[i][j] == t)
    return dp[i][j];
  valid[i][j] = t;
  int acnt = 0, bcnt = 0;
  if (a.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != b[i])
        bcnt++;
    }
    return dp[i][j] = bcnt;
  }

  if (b.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != a[i])
        acnt++;
    }
    return dp[i][j] = acnt;
  }
  acnt = minChangedChars(a.substr(1), b, c.substr(1));
  if (a[0] != c[0])
    acnt++;
  bcnt = minChangedChars(a, b.substr(1), c.substr(1));
  if (b[0] != c[0])
    bcnt++;
  return dp[i][j] = min(acnt, bcnt);
}

int main()
{
  cin >> t;
  t++;
  while (t > 1)
  {
    t--;
    string a, b, c;
    cin >> a >> b >> c;
    cout << minChangedChars(a, b, c) << endl;
  }
  return 0;
}

Submission (verdict: Time limit exceeded on test 16):
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int dp[1001][1001];
int valid[1001][1001];
int t;

int minChangedChars(string a, string b, string c)
{
  int i = a.size(), j = b.size();
  if (valid[i][j] == t)
    return dp[i][j];
  valid[i][j] = t;
  int acnt = 0, bcnt = 0;
  if (a.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != b[i])
        bcnt++;
    }
    return dp[i][j] = bcnt;
  }

  if (b.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != a[i])
        acnt++;
    }
    return dp[i][j] = acnt;
  }
  acnt = minChangedChars(a.substr(1), b, c.substr(1));
  if (a[0] != c[0])
    acnt++;
  bcnt = minChangedChars(a, b.substr(1), c.substr(1));
  if (b[0] != c[0])
    bcnt++;
  return dp[i][j] = min(acnt, bcnt);
}

int main()
{
  cin >> t;
  while (t)
  {
    string a, b, c;
    cin >> a >> b >> c;
    cout << minChangedChars(a, b, c) << endl;
    t--;
  }
  return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 16):
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int dp[1001][1001];

int minChangedChars(string a, string b, string c)
{
  int i = a.size(), j = b.size();
  if (dp[i][j] != -1)
    return dp[i][j];
  int acnt = 0, bcnt = 0;
  if (a.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != b[i])
        bcnt++;
    }
    return dp[i][j] = bcnt;
  }

  if (b.size() == 0)
  {
    for (int i = 0; i < c.size(); i++)
    {
      if (c[i] != a[i])
        acnt++;
    }
    return dp[i][j] = acnt;
  }
  acnt = minChangedChars(a.substr(1), b, c.substr(1));
  if (a[0] != c[0])
    acnt++;
  bcnt = minChangedChars(a, b.substr(1), c.substr(1));
  if (b[0] != c[0])
    bcnt++;
  return dp[i][j] = min(acnt, bcnt);
}

int main()
{
  ll t;
  cin >> t;
  while (t--)
  {
    string a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i <= a.size(); i++)
      for (int j = 0; j <= b.size(); j++)
        dp[i][j] = -1;
    cout << minChangedChars(a, b, c) << endl;
  }
  return 0;
}
Problem: 2060D - Subtract Min Sort
Language: PyPy 3-64


Submission (verdict: Wrong answer on test 1):
# Jai Shree Ram

def main() -> None:
    n=int(input())
    v=list(map(int,input().strip().split()))
    m=max(v)
    
    if m==v[0]:
        print("NO")
        return
    
    

t=int(input())

while t>0:
    t-=1
    main()
Problem: 2060D - Subtract Min Sort
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 1):
# Jai Shree Ram

def main() -> None:
    n=int(input())
    v=list(map(int,input().strip().split()))
    m=max(v)
    
    if m==v[0]:
        print("NO")
        return
    
    

t=int(input())

while t>0:
    t-=1
    main()

Submission (verdict: Wrong answer on test 2):
# Jai Shree Ram

def main() -> None:
    n=int(input())
    v=list(map(int,input().strip().split()))
    m=max(v)
    
    if m==v[0]: print("NO")
    else: print("YES")

t=int(input())

while t>0:
    t-=1
    main()
Problem: 2060D - Subtract Min Sort
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 2):
# Jai Shree Ram

def main() -> None:
    n=int(input())
    v=list(map(int,input().strip().split()))
    m=max(v)
    
    if m==v[0]: print("NO")
    else: print("YES")

t=int(input())

while t>0:
    t-=1
    main()

Submission (verdict: Accepted):
# Jai Shree Ram

def main() -> None:
    n=int(input())
    v=list(map(int,input().strip().split()))
    
    i,j=0,1
    while j<n:
        m=min(v[i],v[j])
        v[i]-=m
        v[j]-=m
        i+=1
        j+=1
    
    for i in range(n-1):
        if v[i]!=0:
            print("NO")
            return
    
    print("YES")

t=int(input())

while t>0:
    t-=1
    main()
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define ll long long

using namespace std;

bool f()
{
    string s;
    cin >> s;
    int tw = 0, th = 0, sum = 0, n = s.length();
    for (int i = 0; i < n; i++)
    {
        int x = s[i] - '0';
        sum += x;
        sum %= 9;
        if (x == 2) tw++;
        if (x == 3) th++;
    }
    if (tw >= 8 || th >= 8 || !sum) return true;
    for (int i = 0; i <= tw; i++)
    {
        for (int j = 0; j <= th; j++)
        {
            if (!((sum + i * 2 + j * 6) % 9)) return true;
        }        
    }
    return false;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--)
    {
        cout << (f() ? "YES" : "NO") << endl;
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

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

using namespace std;

bool f()
{
    string s;
    cin >> s;
    int tw = 0, th = 0, sum = 0, n = s.length();
    for (int i = 0; i < n; i++)
    {
        int x = s[i] - '0';
        sum += x;
        sum %= 9;
        if (x == 2) tw++;
        if (x == 3) th++;
    }
    if (tw > 8 || th > 8 || !sum) return true;
    for (int i = 0; i <= tw; i++)
    {
        for (int j = 0; j <= th; j++)
        {
            if (!((sum + i * 2 + j * 6) % 9)) return true;
        }        
    }
    return false;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--)
    {
        cout << (f() ? "YES" : "NO") << endl;
    }
    return 0;
}

Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define ll long long

using namespace std;

bool f()
{
    string s;
    cin >> s;
    int tw = 0, th = 0, sum = 0, n = s.length();
    for (int i = 0; i < n; i++)
    {
        int x = s[i] - '0';
        sum += x;
        sum %= 9;
        if (x == 2) tw++;
        if (x == 3) th++;
    }
    if (tw > 9 || th > 9 || !sum) return true;
    for (int i = 0; i <= tw; i++)
    {
        for (int j = 0; j <= th; j++)
        {
            if (((sum + i * 2 + j * 6) % 9) == 0) return true;
        }        
    }
    return false;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--)
    {
        cout << (f() ? "YES" : "NO") << endl;
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

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

using namespace std;

bool f()
{
    string s;
    cin >> s;
    int tw = 0, th = 0, sum = 0, n = s.length();
    for (int i = 0; i < n; i++)
    {
        int x = s[i] - '0';
        sum += x;
        sum %= 9;
        if (x == 2) tw++;
        if (x == 3) th++;
    }
    if (tw >= 8 || th >= 8 || !sum) return true;
    for (int i = 0; i <= tw; i++)
    {
        for (int j = 0; j <= th; j++)
        {
            if (!((sum + i * 2 + j * 6) % 9)) return true;
        }        
    }
    return false;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--)
    {
        cout << (f() ? "YES" : "NO") << endl;
    }
    return 0;
}

Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define ll long long

using namespace std;

bool f()
{
    string s;
    cin >> s;
    int tw = 0, th = 0, sum = 0, n = s.length();
    for (int i = 0; i < n; i++)
    {
        int x = s[i] - '0';
        sum += x;
        sum %= 9;
        if (x == 2) tw++;
        if (x == 3) th++;
    }
    if (tw > 8 || th > 8 || !sum) return true;
    for (int i = 0; i <= tw; i++)
    {
        for (int j = 0; j <= th; j++)
        {
            if (!((sum + i * 2 + j * 6) % 9)) return true;
        }        
    }
    return false;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--)
    {
        cout << (f() ? "YES" : "NO") << endl;
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

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

using namespace std;

bool f()
{
    string s;
    cin >> s;
    int tw = 0, th = 0, sum = 0, n = s.length();
    for (int i = 0; i < n; i++)
    {
        int x = s[i] - '0';
        sum += x;
        sum %= 9;
        if (x == 2) tw++;
        if (x == 3) th++;
    }
    if (tw > 9 || th > 9 || !sum) return true;
    for (int i = 0; i <= tw; i++)
    {
        for (int j = 0; j <= th; j++)
        {
            if (((sum + i * 2 + j * 6) % 9) == 0) return true;
        }        
    }
    return false;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--)
    {
        cout << (f() ? "YES" : "NO") << endl;
    }
    return 0;
}

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

using namespace std;

bool f()
{
    string s;
    cin >> s;
    int tw = 0, th = 0, sum = 0, n = s.length();
    for (int i = 0; i < n; i++)
    {
        int x = s[i] - '0';
        sum += x;
        if (x == 2) tw++;
        if (x == 3) th++;
    }
    for (int i = 0; i <= min(9, tw); i++)
    {
        for (int j = 0; j <= min(9, th); j++)
        {
            if (((sum + i * 2 + j * 6) % 9) == 0) return true;
        }        
    }
    return false;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--)
    {
        cout << (f() ? "YES" : "NO") << endl;
    }
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 4):
// bye bye bye

#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> A(N);
    for (auto& a : A) {
        cin >> a;
    }
    vector<pair<int,int>> ovr;
    vector<pair<int,int>> othr;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            if (A[i] > A[j]) {
                ovr.emplace_back(A[i], A[j]);
            } else {
                othr.emplace_back(A[j], A[i]);
                othr.emplace_back(A[i], A[j]);
            }
        }
    }
    cout << ovr.size() + othr.size() << '\n';
    for (auto [x,y] : ovr) {
        cout << x << ' ' << y << '\n';
    }
    for (auto [x,y] : othr) {
        cout << x << ' ' << y << '\n';
    }
    return 0;
}

Submission (verdict: Wrong answer on test 7):
// bye bye bye

#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> A(N);
    for (auto& a : A) {
        cin >> a;
    }
    vector<pair<int,int>> ovr;
    vector<pair<int,int>> othr;
    vector<pair<int,int>> final;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            if (A[i] > A[j]) {
                ovr.emplace_back(A[i], A[j]);
            } else {
                othr.emplace_back(A[j], A[i]);
                final.emplace_back(A[i], A[j]);
            }
        }
    }
    cout << ovr.size() + othr.size() + final.size() << '\n';
    for (auto [x,y] : ovr) {
        cout << x << ' ' << y << '\n';
    }
    for (auto [x,y] : othr) {
        cout << x << ' ' << y << '\n';
    }
    for (auto [x,y] : final) {
        cout << x << ' ' << y << '\n';
    }
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 4):
// bye bye bye

#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> A(N);
    for (auto& a : A) {
        cin >> a;
    }
    vector<pair<int,int>> ovr;
    vector<pair<int,int>> othr;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            if (A[i] > A[j]) {
                ovr.emplace_back(A[i], A[j]);
            } else {
                othr.emplace_back(A[j], A[i]);
                othr.emplace_back(A[i], A[j]);
            }
        }
    }
    cout << ovr.size() + othr.size() << '\n';
    for (auto [x,y] : ovr) {
        cout << x << ' ' << y << '\n';
    }
    for (auto [x,y] : othr) {
        cout << x << ' ' << y << '\n';
    }
    return 0;
}
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)


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

using namespace std;

#pragma GCC optimize("O3")

#pragma GCC optimize("Ofast")

#pragma optimize("unroll-loops")

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

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

#define rll(x) x.rbegin(), x.rend()

#define COMP(x) x.erase(unique(all(x)), x.end())

#define MOD 1000000007

#define MOD2 998244353

#define sz(x) (ll)x.size()

typedef __int128_t lll;

typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;

typedef pair<ll,ll> pll;

typedef pair<ll, pll> PP;

const ll Lnf = 2e18;

const ll inf = 1e9;

void solve(){

    ll n; cin>>n;

    ll x,y; cin>>x>>y; x--; y--;

    if(x+1==y){

        if(~n&1)for(int i = 0 ; i < n ; i++)cout<<(i&1)<<" \n"[i==n-1];

        else{

            for(int i = 0 ; i < n-1 ; i++)cout<<(i&1)<<" ";

            cout<<2<<"\n";

        }

        return;

    }

    if(~n&1){

        vector<ll> ans(n);

        if((y-x-1)%2==0){

            ans[x]=2;

            for(int i = x+1, j = 0 ; i < y ; i++, j++)ans[i] = (j&1);

            ans[y]= 3;

            for(int i = (y+1)%n, j = 0 ; i != x ; i=(i+1)%n, j++)ans[i] = (j&1);

        }

        else{

            ans[x]=2;

            for(int i = x+1, j = 0 ; i < y ; i++, j++)ans[i] = (j&1);

            ans[y]= 3;

            for(int i = (y+1)%n, j = 1 ; i != x ; i=(i+1)%n, j++)ans[i] = (j&1);

        }

        for(auto i : ans)cout<<i<<" "; cout<<"\n";

    }

    else{

        vector<ll> ans(n);

        if((y-x-1)%2==1){

            ans[x]=1;

            for(int i = x+1, j = 0 ; i < y ; i++, j++)ans[i] = (j&1);

            ans[y]=2;

            for(int i = (y+1)%n, j = 1 ; i != x ; i=(i+1)%n, j++)ans[i] = (j&1);

        }

        else{

            ans[x]=2;

            for(int i = x+1, j = 1 ; i < y ; i++, j++)ans[i] = (j&1);

            ans[y]=1;

            for(int i = (y+1)%n, j = 0 ; i != x ; i=(i+1)%n, j++)ans[i] = (j&1);

        }

        for(auto i : ans)cout<<i<<" "; cout<<"\n";

    }

}

int main(){

    fast;

    ll t; cin>>t; while(t--)solve();

}
Problem: 2050B - Transfusion
Language: Python 3

Previous submission (verdict: Wrong answer on test 1):
def process_array():
    _size = int(input())
    a =list(map(int, input().split()))
    sum1 = 0 
    odd= (_size+1)//2
    sum2 = 0 
    even = _size-odd
    for i in range(_size):
        if i%2==0 :
           sum1+=a[i]
           
        else :
           sum2+=a[i] 
    print(sum1, sum2, odd ,even)
    if (sum1+sum2)%_size==0 :
       if sum1 == odd*((sum1+sum2)/_size) and sum2== even*((sum1+sum2)/_size):
          print("YES")
          return
       else:
          print("NO")
          return   
    else:
      print("NO")

t = int(input())    
for _ in range(t): 
       process_array()


Submission (verdict: Accepted):
def process_array():
    _size = int(input())
    a =list(map(int, input().split()))
    sum1 = 0 
    odd= (_size+1)//2
    sum2 = 0 
    even = _size-odd
    for i in range(_size):
        if i%2==0 :
           sum1+=a[i]
           
        else :
           sum2+=a[i] 
   # print(sum1, sum2, odd ,even)
    if (sum1+sum2)%_size==0 :
       if sum1 == odd*((sum1+sum2)/_size) and sum2== even*((sum1+sum2)/_size):
          print("YES")
          return
       else:
          print("NO")
          return   
    else:
      print("NO")

t = int(input())    
for _ in range(t): 
       process_array()
Problem: 2050B - Transfusion
Language: Python 3

Previous submission (verdict: Wrong answer on test 1):
def process_array():
    _size = int(input())
    a =list(map(int, input().split()))
    sum1 = 0 
    odd= (_size+1)/2
    sum2 = 0 
    even = _size-odd
    for i in range(_size):
        if i%2==0 :
           sum1+=a[i]
        else :
           sum2+=a[i] 
    if (sum1+sum2)%_size==0 :
       if sum1 == odd*((sum1+sum2)/_size) and sum2== even*((sum1+sum2)/_size):
          print("YES")
          return
       else:
         print("NO")
         return   
    else:
      print("NO")

t = int(input())    
for _ in range(t): 
       process_array()


Submission (verdict: Wrong answer on test 1):
def process_array():
    _size = int(input())
    a =list(map(int, input().split()))
    sum1 = 0 
    odd= (_size+1)/2
    sum2 = 0 
    even = _size-odd
    for i in range(_size):
        if i%2==0 :
           sum1+=a[i]
        else :
           sum2+=a[i] 
    if (sum1+sum2)%_size==0 :
       if sum1 == odd*((sum1+sum2)/_size) and sum2== even*((sum1+sum2)/_size):
          print("YES")
          return
       else:
          print("NO")
          return   
    else:
      print("NO")

t = int(input())    
for _ in range(t): 
       process_array()
Problem: 2050B - Transfusion
Language: Python 3

Previous submission (verdict: Wrong answer on test 1):
def process_array():
    _size = int(input())
    a =list(map(int, input().split()))
    sum1 = 0 
    odd= (_size+1)/2
    sum2 = 0 
    even = _size-odd
    for i in range(_size):
        if i%2==0 :
           sum1+=a[i]
        else :
           sum2+=a[i] 
    if (sum1+sum2)%_size==0 :
       if sum1 == odd*((sum1+sum2)/_size) and sum2== even*((sum1+sum2)/_size):
          print("YES")
          return
       else:
          print("NO")
          return   
    else:
      print("NO")

t = int(input())    
for _ in range(t): 
       process_array()


Submission (verdict: Wrong answer on test 1):
def process_array():
    _size = int(input())
    a =list(map(int, input().split()))
    sum1 = 0 
    odd= (_size+1)//2
    sum2 = 0 
    even = _size-odd
    for i in range(_size):
        if i%2==0 :
           sum1+=a[i]
           
        else :
           sum2+=a[i] 
    print(sum1, sum2, odd ,even)
    if (sum1+sum2)%_size==0 :
       if sum1 == odd*((sum1+sum2)/_size) and sum2== even*((sum1+sum2)/_size):
          print("YES")
          return
       else:
          print("NO")
          return   
    else:
      print("NO")

t = int(input())    
for _ in range(t): 
       process_array()