Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, C = map(int, input().split())
D = np.array(map(int, input().split()), dtype=int)
for i in range(C-1):
    D = np.vstack((D, np.array(map(int, input().split()), dtype=int)))
Z = np.array(map(int, input().split()), dtype=int)
for i in range(N-1):
    Z = np.vstack((c, np.array(map(int, input().split()), dtype=int)))
num = np.zeros(size=(3,C), dtype=int)
for i in range(3):
    X = np.array([[(x+y+2)%3==i for y in range(N)] for x in range(N)])
    for c in range(C):
        Y = (Z*X)==c+1
        num[i,c] = Y.sum()
costs = np.matmul(num, D)
mincost = 10**10
for c0 in range(C):
    for c1 in range(C):
        if c1 ==c0:
            continue
        for c2 in range(C):
            if c2 == c1:
                continue
            cost = costs[0,c0]+costs[1,c1]+costs[2,c2]
            mincost = min(mincost, cost)
print(mincost)

Fixed submission:
import numpy as np
N, C = map(int, input().split())
D = np.array(list(map(int, input().split())), dtype=int)
for i in range(C-1):
    D = np.vstack((D, np.array(list(map(int, input().split())), dtype=int)))
Z = np.array(list(map(int, input().split())), dtype=int)
for i in range(N-1):
    Z = np.vstack((Z, np.array(list(map(int, input().split())), dtype=int)))
num = np.zeros((3,C), dtype=int)
for i in range(3):
    X = np.array([[(x+y+2)%3==i for y in range(N)] for x in range(N)])
    for c in range(C):
        Y = ((Z*X)==(c+1))
        num[i,c] = Y.sum()
costs = np.dot(num, D)
mincost = 10**10
for c0 in range(C):
    for c1 in range(C):
        if c1 ==c0:
            continue
        for c2 in range(C):
            if c2 == c0 or c2 == c1:
                continue
            cost = costs[0,c0]+costs[1,c1]+costs[2,c2]
            mincost = min(mincost, cost)
print(mincost)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = []
y = []
ans = 0
for i in range(n):
    x1, y1 = map(int, input().split())
    x.append(x1)
    y.append(y1)
for i in range(n-1):
    for j in range(i,n):
        m = abs(x[i]-x[j]) + abs(y[i]-y[j])
        ans = max(ans, m)
print(ans)

Fixed submission:
n = int(input())
u = []
v = []
ans = 0
for i in range(n):
    x, y = map(int, input().split())
    u.append(x+y)
    v.append(x-y)
ans = max(max(u) - min(u), max(v) - min(v))
print(ans)
Buggy python submission (verdict: Runtime Error):
#include <stdio.h>
#include <string.h>

int main(void){
    char s[1000];
    char t[1000];
    scanf("%s",s);
    scanf("%s",t);
    int m[strlen(s)];
    for(int i = 0; i < strlen(s); i++){
        m[i] = 0;
    }
    for(int i = 0; i < strlen(s); i++){
        for(int j = 0; j < strlen(t); j++){
            if(s[i] == t[j] && i>=j && strlen(s)-i>=strlen(t)-j){
                for(int k = j; k < strlen(s); k++){
                    if(s[i+k-j] == t[k]){
                        m[i]++;
                    }
                    else{
                        break;
                    }
                }
            }
        }
    }
    int max = 0;
    for(int i = 0; i < strlen(t); i++){
        if(max < m[i]){
            max = m[i];
        }
    }
    printf("%d",strlen(t)-max);
    return 0;
}

Fixed submission:
s = input()
t = input()
ans = 0
for i in range(len(s)-len(t)+1):
    m = 0
    for j, k in zip(s[i:],t):
        if j==k:
            m += 1
    if m > ans:
        ans = m
print(len(t) - ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
a = list(map(int, input().split()))
c = 1
for i  in range(k):
    c *= a[i]
for i in range(n):
    if i>=k:
        c1 = c * a[i] / a[i-k]
        c2 = c
        if c1>c2:
            print("Yes")
        else:
            print("No")
        c = c1

Fixed submission:
n,k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    if i>=k:
        if a[i]>a[i-k]:
            print("Yes")
        else:
            print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n):
    if i>=k:
        c1 = 1
        c2 = 1
        for j in range(i-k+1,i+1):
            c1 *= a[j]
            c2 *= a[j-1]
        if c1>c2:
            print("Yes")
        else:
            print("No")

Fixed submission:
n,k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    if i>=k:
        if a[i]>a[i-k]:
            print("Yes")
        else:
            print("No")
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
ans = [0 for _ in range(10000)]

for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            t = x**2 + y**2 + z**2 + x*y + y*z + z*x 
            if t < 10000:
                ans[t] += 1
for i in range(1,n+1):
    print(ans[i])

Fixed submission:
import math
n = int(input())
ans = [0 for _ in range(10001)]

for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            t = x**2 + y**2 + z**2 + x*y + y*z + z*x 
            if t <= 10000:
                ans[t] += 1
for i in range(1,n+1):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
for i in range(n):
    ans = 0
    for x in range(1,int(math.sqrt(n))):
        for y in range(1,int(math.sqrt(n))):
            for z in range(1,int(math.sqrt(n))):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i+1:
                    ans += 1
    print(ans)

Fixed submission:
import math
n = int(input())
ans = [0 for _ in range(10001)]

for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            t = x**2 + y**2 + z**2 + x*y + y*z + z*x 
            if t <= 10000:
                ans[t] += 1
for i in range(1,n+1):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n%1000!=0:
    print(min(1000-(n%1000)))
else:
    print("0")

Fixed submission:
n = int(input())
if n%1000!=0:
    print(1000-(n%1000))
else:
    print("0")
Buggy python submission (verdict: Runtime Error):
x,n = map(int, input().split())
p = list(map(int, input().split()))
mini = 100
for i in range(1,101):
    if not i in p:
        if mini>abs(x-i):
            ans = i
            mini=abs(x-i)
print(ans)

Fixed submission:
x,n = map(int, input().split())
p = list(map(int, input().split()))
mini = 1000
for i in range(-200,200):
    if not i in p:
        if mini>abs(x-i):
            ans = i
            mini=abs(x-i)
print(ans)

Buggy python submission (verdict: Runtime Error):
x,n = map(int, input().split())
p = list(map(int, input().split()))
mini = 100
for i in range(101):
    if not i in p:
        if mini>abs(x-i) and i!=0:
            ans = i
            mini=abs(x-i)
print(ans)

Fixed submission:
x,n = map(int, input().split())
p = list(map(int, input().split()))
mini = 1000
for i in range(-200,200):
    if not i in p:
        if mini>abs(x-i):
            ans = i
            mini=abs(x-i)
print(ans)

Buggy python submission (verdict: Runtime Error):
x,n = map(int, input().split())
p = list(map(int, input().split()))
mini = 100
for i in range(101):
    if not i in p and i!=0:
        if mini>abs(x-i):
            ans = i
            mini=abs(x-i)
print(ans)

Fixed submission:
x,n = map(int, input().split())
p = list(map(int, input().split()))
mini = 1000
for i in range(-200,200):
    if not i in p:
        if mini>abs(x-i):
            ans = i
            mini=abs(x-i)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans*=a[i]
if ans > pow(10,18):
    print("-1")
else:
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 1
for i in range(n):
    ans*=a[i]
    if ans > pow(10,18) or ans==0:
        break
if ans > pow(10,18):
    print("-1")
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
b = []
for i in range(n):
    a[i],b[i] = map(int, input().split())
a.sort()
b.sort()
if n%2 == 1:
    	print(b[(n+1)//2]-a[(n+1)//2]+1)
else:
	print(b[n//2]-a[n//2]+b[n//2+1]-a[n//2+1]+1)

Fixed submission:
n = int(input())
a = []
b = []
for i in range(n):
    a1,b1 = map(int, input().split())
    a.append(a1)
    b.append(b1)
a.sort()
b.sort()
if n%2 == 1:
    print(b[(n+1)//2-1]-a[(n+1)//2-1]+1)
else:
	print(b[n//2-1]-a[n//2-1]+b[n//2]-a[n//2]+1)
Buggy python submission (verdict: Runtime Error):
t = list(input())
for i in range(len(t)):
    if t[i]=="?":
        if i==0:
            if t[i+1]=="D" or t[i+1]=="?":
                t[i] = "P"
                t[i+1] = "D"
            else:
                t[i] = "D"
        elif i!=len(t)-1:
            if t[i-1]=="P":
                t[i] = "D"
            if t[i+1]=="D" or t[i+1]=="?":
                t[i] = "P"
                t[i+1] = "D"
        else:
            t[i] = "D"
print(*t,sep="")

Fixed submission:
t = list(input())
for i in range(len(t)):
    if t[i]=="?":
        if i==0 and len(t)!=1:
            if t[i+1]=="D" or t[i+1]=="?":
                t[i] = "P"
                t[i+1] = "D"
            else:
                t[i] = "D"
        elif i!=len(t)-1:
            if t[i-1]=="P":
                t[i] = "D"
            elif t[i+1]=="D" or t[i+1]=="?":
                t[i] = "P"
                t[i+1] = "D"
            else:
                t[i] = "D"
        else:
            t[i] = "D"
print(*t,sep="")
Buggy python submission (verdict: Runtime Error):
#include <stdio.h>

int main(void){
    long long int a,b,n;
    scanf("%lld %lld %lld",&a,&b,&n);
    printf("%lld\n",(a*(n-1))/b-a*((n-1)/b));
    return 0;
}

Fixed submission:
a,b,n=(int(x) for x in input().split())
n = min(b-1,n)
print((a*n)//b-a*(n//b))
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int, input().split())
a = [int(input()) for _ in range(q)]
ans = [k for _ in range(n)]
for i in range(q):
    ans[a[i]-1] += 1
    for j in range(n):
        ans[j] -= 1
for i in range(n):
    if ans[i] > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q = map(int, input().split())
a = [int(input()) for _ in range(q)]
ans = [0 for _ in range(n)]
for i in range(q):
    ans[a[i]-1] += 1
for i in range(n):
    if q-ans[i] < k:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]
print(max(a[1:]))
for i in range(1,n-1):
    print(max(*a[:i],*a[i+1:]))
print(max(a[:n-1]))

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
temp = sorted(a)
m1 = temp[-1]
m2 = temp[-2]
for i in range(n):
    if a[i] == m1:
        print(m2)
    else:
        print(m1)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = [[a%10,a//10*10+10,a],[b%10,b//10*10+10,b],[c%10,c//10*10+10,c],[d%10,d//10*10+10,d],[e%10,e//10*10+10,e]]
s.sort()
while True:
    if s[0][0] == 0:
        s[0][1]-=10
        s.append(s.pop(0))
    else:
        break
s = np.array(s)
ans = s[0][2] + sum(s[1:,1])
print(ans)

Fixed submission:
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = [[a%10,a//10*10+10,a],[b%10,b//10*10+10,b],[c%10,c//10*10+10,c],[d%10,d//10*10+10,d],[e%10,e//10*10+10,e]]
s.sort()
for i in range(5):
    if s[0][0] == 0:
        s[0][1]-=10
        s.append(s.pop(0))
    else:
        break
s = np.array(s)
ans = s[0][2] + sum(s[1:,1])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd

n = int(input())
a = list(map(int,input().split()))
i,g = n-2,a[n-1]
pc = True
while i >= 0:
  res = gcd(g,a[i])
  if res != 1:
    pc = False
    break
  g *= a[i]
  i -= 1
if not pc:
  i,g = n-2,a[n-1]
  while i >= 0:
    g = gcd(g,a[i])
    i -= 1
  if g != 1:
    print("not coprime")
  else:
    print("setwise coprime")
else:
  print("pairwise coprime")

Fixed submission:
from math import gcd
from collections import defaultdict

mxn = 10**6+1
spf = [i for i in range(mxn)]

for i in range(4,mxn,2):
  spf[i] = 2
i = 3
while i*i <= mxn:
  if spf[i] == i:
    for j in range(i*i,mxn,i):
      if spf[j] == j:
        spf[j] = i
  i += 1
ph = defaultdict(lambda:False)
pc = True
def getFactors(n):
  global pc
  while n != 1:
    temp = spf[n]
    if ph[temp] == True:
      pc = False
      break
    ph[temp] = True
    while n%temp == 0:
      n //= temp

n = int(input())
a = list(map(int,input().split()))
i,g = n-2,a[n-1]
while i >= 0:
  g = gcd(g,a[i])
  i -= 1
if g != 1:
  print("not coprime")
else:
  for i in a:
    if not pc:
      break
    getFactors(i)
  if not pc:
    print("setwise coprime")
  else:
    print("pairwise coprime")
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))
prev = 1
for i in range(k):
  prev *= a[i]
for i in range(k,n):
  cur = (prev//a[i-k])*a[i]
  print("Yes" if cur > prev else "No")
  prev = cur

Fixed submission:
import math as m

n,k = map(int,input().split())
a = list(map(int,input().split()))
prev = 1
for i in range(k):
  prev += m.log(a[i])
for i in range(k,n):
  cur = prev + m.log(a[i])
  cur -= m.log(a[i-k])
  print("Yes" if cur > prev else "No")
  prev = cur
Buggy python submission (verdict: Runtime Error):
n = int(input())
lim = 10**18
ans,exc = 1,False
for x in input().split():
  ans *= int(x)
  if ans > lim:
    exc = True
    print("-1")
if not exc:
  print(ans)

Fixed submission:
a,b = map(int,input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
res = 1
exc = False
for i in a:
	res *= i
	if res > 10**18:
      exc = True
      print(-1)
if not exc:
  print(res)

Fixed submission:
n = int(input())
lim = 10**18
ans,exc = 1,False
a = list(map(int,input().split()))
# print(a)
if 0 in a:
  print(0)
else:
  for x in a:
    ans *= x
    if ans > lim:
      exc = True
      print("-1")
      break
  if not exc:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
res = 1
for i in a:
	res *= i
if res > 10**18:
  print(-1)
else:
  print(res)

Fixed submission:
n = int(input())
lim = 10**18
ans,exc = 1,False
a = list(map(int,input().split()))
# print(a)
if 0 in a:
  print(0)
else:
  for x in a:
    ans *= x
    if ans > lim:
      exc = True
      print("-1")
      break
  if not exc:
    print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
res = a*b
print(int(res))

Fixed submission:
from decimal import Decimal
a,b = map(Decimal,input().split())
print(int(a*b))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input())
a = [int(x) for x in input().split()]
s = sum(a)
if n < s:
  print("-1")
else:
  print(n-s)

Fixed submission:
n,m = map(int,input().split())
a = [int(x) for x in input().split()]
s = sum(a)
if n < s:
  print("-1")
else:
  print(n-s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
found = True
for _ in range(n):
  t,x,y = map(int,input().split())
  if t==0:
  	if x==0 and y==0:
      found = False
  else:
    if t%(x+y) != 0:
      found = False
if found:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
found = True
ti,xi,yi = 0,0,0
for _ in range(n):
  t,x,y = map(int,input().split())
  rt = abs(x-xi)+abs(y-yi)
  if rt > (t-ti) or (t-ti-rt)&1:
    found = False
  ti,xi,yi = t,x,y
print("Yes" if found else "No")
Buggy python submission (verdict: Runtime Error):
fac=[1]*505050
inv=[1]*505050
finv=[1]*505050
mod=1000000007
for i in range(1,500010):
  fac[i]=fac[i-1]*i%mod
  inv[i]=(mod-inv[mod%i]*(mod//i))%mod
  finv[i]=finv[i-1]*inv[i]%mod

def C(n,r):
  if n<0 or r<0 or n<r: return 0
  return fac[n]*inv[n-r]*inv[r]%mod

n,m=map(int,input().split())
ans=0
for i in range(N+1):
  ans+=C(n,i)*fac[M]*finv[M-i]*(C(M-i,N-i)**2)*(1 if i%2==0 else -1) % mod
print(ans%mod)


Fixed submission:
fac=[1]*505050
inv=[1]*505050
finv=[1]*505050
mod=1000000007
for i in range(2,500010):
  fac[i]=fac[i-1]*i%mod
  inv[i]=-inv[mod%i]*(mod//i)%mod
  finv[i]=finv[i-1]*inv[i]%mod

def C(n,r):
  if n<0 or r<0 or n<r: return 0
  return fac[n]*finv[n-r]*finv[r]%mod

N,M=map(int,input().split())
ans=0
for i in range(N+1):
  ans+=C(N,i)*fac[M]*finv[M-i]*((fac[M-i]*finv[M-N])**2)*(1 if i%2==0 else -1) % mod
print(ans%mod)

Buggy python submission (verdict: Runtime Error):
fac=[0]*505050
inv=[0]*505050
finv=[0]*505050
mod=1000000007
fac[0]=finv[0]=inv[1]=1
for i in range(1,500010):
  fac[i]=fac[i-1]*i%mod
  inv[i]=(mod-inv[mod%i]*(mod//i))%mod
  finv[i]=finv[i-1]*inv[i]%mod

def C(n,r):
  if n<0 or r<0 or n<r: return 0
  return fac[n]*inv[n-r]*inv[r]%mod

n,m=map(int,input().split())
ans=0
for i in range(N+1):
  ans+=C(n,i)*fac[M]*finv[M-i]*(C(M-i,N-i)**2)*(1 if i%2==0 else -1) % mod
print(ans%mod)


Fixed submission:
fac=[1]*505050
inv=[1]*505050
finv=[1]*505050
mod=1000000007
for i in range(2,500010):
  fac[i]=fac[i-1]*i%mod
  inv[i]=-inv[mod%i]*(mod//i)%mod
  finv[i]=finv[i-1]*inv[i]%mod

def C(n,r):
  if n<0 or r<0 or n<r: return 0
  return fac[n]*finv[n-r]*finv[r]%mod

N,M=map(int,input().split())
ans=0
for i in range(N+1):
  ans+=C(N,i)*fac[M]*finv[M-i]*((fac[M-i]*finv[M-N])**2)*(1 if i%2==0 else -1) % mod
print(ans%mod)

Buggy python submission (verdict: Runtime Error):
fac=[0]*505050
inv=[0]*505050
finv=[0]*505050
mod=1000000007
fac[0]=finv[0]=inv[1]=1;
for i in range(1,500010):
  fac[i]=fac[i-1]*i%mod
  inv[i]=inv[mod%i]*(mod//i)%mod
  finv[i]=finv[i-1]*inv[i]%mod

def C(n,r):
  if n<0 or r<0 or n<r: return 0
  return fac[n]*inv[n-r]*inv[r]%mod

n,m=map(int,input().split())
ans=0
for i in range(N+1):
  ans+=C(n,i)*fac[M]*finv[M-i]*(C(M-i,N-i)**2)*(1 if i%2==0 else -1) % mod
print(ans%mod)


Fixed submission:
fac=[1]*505050
inv=[1]*505050
finv=[1]*505050
mod=1000000007
for i in range(2,500010):
  fac[i]=fac[i-1]*i%mod
  inv[i]=-inv[mod%i]*(mod//i)%mod
  finv[i]=finv[i-1]*inv[i]%mod

def C(n,r):
  if n<0 or r<0 or n<r: return 0
  return fac[n]*finv[n-r]*finv[r]%mod

N,M=map(int,input().split())
ans=0
for i in range(N+1):
  ans+=C(N,i)*fac[M]*finv[M-i]*((fac[M-i]*finv[M-N])**2)*(1 if i%2==0 else -1) % mod
print(ans%mod)
Buggy python submission (verdict: Runtime Error):
n=map(int,input().split())
a=list(map(int,input().split()))

m=100000
c=[0]*(m+1)

for i in a:c[i]+=1

for i in range(1,m+1):
	if c[i] == 0:continue
	for j in range(i*2,m+1,i):
		c[j]+=1
ans=0
for i in a:
 if c[i]==1:ans+=1
print(ans)

Fixed submission:
n=map(int,input().split())
a=list(map(int,input().split()))

m=1000000
c=[0]*(m+1)

for i in a:c[i]+=1

for i in range(1,m+1):
	if c[i] == 0:continue
	for j in range(i*2,m+1,i):
		c[j]+=1
ans=0
for i in a:
 if c[i]==1:ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
H,W=map(imt,input().split())
if H==1 or W==1:
	print(1)
else:
	print((H*W+1)//2)

Fixed submission:
H,W=map(int,input().split())
if H==1 or W==1:
	print(1)
else:
	print((H*W+1)//2)
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

cnt = [[0] * 26 for i in range(26)]

for i in range(len(S)):
    cnt[ord(S[i]) - ord('a')][ord(T[i]) - ord('a')] += 1

for j in range(26):
    n = 0
    for i in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)
exit(1)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

cnt = [[0] * 26 for i in range(26)]

for i in range(len(S)):
    cnt[ord(S[i]) - ord('a')][ord(T[i]) - ord('a')] += 1

for j in range(26):
    n = 0
    for i in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)

for i in range(26):
    n = 0
    for j in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)

print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int,input().split())
B = map(int,input().split())

ans = 0
for i in range(N):
    cur = 0
    for j in range(N):
        if j < i:
            cur += A[j]
        elif j == i:
            cur += A[j] + B[j]
        else:
            cur += B[j]
    ans = max(ans , cur)
print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = 0
for i in range(N):
    cur = 0
    for j in range(N):
        if j < i:
            cur += A[j]
        elif j == i:
            cur += A[j] + B[j]
        else:
            cur += B[j]
    ans = max(ans , cur)
print(ans)
Buggy python submission (verdict: Runtime Error):
M=8**7
m,f,g,i=M*476+1,[j:=1],[k:=1]*M,0
while i<M:i+=1;f+=f[-1]*i%m,
g+=pow(f[-1],m-2,m),
while i:g[i-1]=g[i]*i%m;i-=1
A,B=map(int,input().split())
if A<B:A,B=B,A
while j<=B:i+=k*f[A+B-j]*g[B-j];k=k*2%m;j+=1
print((i*f[B]*g[A+B]+A)%m))

Fixed submission:
m=998244353
M=1000001
f=[0]*M
g=[0]*M
h=[0]*M
f[0]=g[0]=f[1]=g[1]=h[1]=1
for i in range(2,M):
	f[i]=f[i-1]*i%m
	h[i]=m-h[m%i]*(m//i)%m
	g[i]=g[i-1]*h[i]%m
A,B=map(int,input().split())
if A<B:
	A,B=B,A
b=1
ans=0
for j in range(1,B+1):
	ans+=b*f[A+B-j]*g[B-j]*g[A]%m
	b=b*2%m
ans=ans*f[A]*f[B]*g[A+B]+A
print(ans%m)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 6)
N=int(input())
g = [[] for i in range(N)]
for i in range(N-1):
	a,b=map(int,input().split())
	a -= 1
	b -= 1
	g[a].append(b)
	g[b].append(a)

nim = [-1 for i in range(N)]

def dfs(cur,par):
	val = 0
	for dst in g[cur]:
		if dst == par:
			continue
		val ^= dfs(dst,cur) + 1
	nim[cur] = val
	return val

dfs(0 , -1)
#print(nim)
if nim[0] == 0:
	print('Bob')
else:
	print('Alice')

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
N=int(input())
g = [[] for i in range(N)]
for i in range(N-1):
	a,b=map(int,input().split())
	a -= 1
	b -= 1
	g[a].append(b)
	g[b].append(a)

nim = [-1 for i in range(N)]

def dfs(cur,par):
	val = 0
	for dst in g[cur]:
		if dst == par:
			continue
		val ^= dfs(dst,cur) + 1
	nim[cur] = val
	return val

dfs(0 , -1)
#print(nim)
if nim[0] == 0:
	print('Bob')
else:
	print('Alice')

Buggy python submission (verdict: Runtime Error):
N=int(input())
g = [[] for i in range(N)]
for i in range(N-1):
	a,b=map(int,input().split())
	a -= 1
	b -= 1
	g[a].append(b)
	g[b].append(a)

nim = [-1 for i in range(N)]

def dfs(cur,par):
	val = 0
	for dst in g[cur]:
		if dst == par:
			continue
		val ^= dfs(dst,cur) + 1
	nim[cur] = val
	return val

dfs(0 , -1)
#print(nim)
if nim[0] == 0:
	print('Bob')
else:
	print('Alice')

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
N=int(input())
g = [[] for i in range(N)]
for i in range(N-1):
	a,b=map(int,input().split())
	a -= 1
	b -= 1
	g[a].append(b)
	g[b].append(a)

nim = [-1 for i in range(N)]

def dfs(cur,par):
	val = 0
	for dst in g[cur]:
		if dst == par:
			continue
		val ^= dfs(dst,cur) + 1
	nim[cur] = val
	return val

dfs(0 , -1)
#print(nim)
if nim[0] == 0:
	print('Bob')
else:
	print('Alice')

Buggy python submission (verdict: Runtime Error):
N=int(input())
g = [[] for i in range(N)]
for i in range(N-1):
	a,b=map(int,input().split())
	a -= 1
	b -= 1
	g[a].append(b)
	g[b].append(a)

nim = [-1 for i in range(N)]

def dfs(cur,par):
	val = 0
	for dst in g[cur]:
		if dst == par:
			continue
		val ^= dfs(dst,cur) + 1
	nim[cur] = val
	return val

dfs(0 , -1)
print(nim)
if nim[0] == 0:
	print('Bob')
else:
	print('Alice')

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
N=int(input())
g = [[] for i in range(N)]
for i in range(N-1):
	a,b=map(int,input().split())
	a -= 1
	b -= 1
	g[a].append(b)
	g[b].append(a)

nim = [-1 for i in range(N)]

def dfs(cur,par):
	val = 0
	for dst in g[cur]:
		if dst == par:
			continue
		val ^= dfs(dst,cur) + 1
	nim[cur] = val
	return val

dfs(0 , -1)
#print(nim)
if nim[0] == 0:
	print('Bob')
else:
	print('Alice')