Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
K=int(input())
S=input()
n=K+len(S)
MAX=1000000
fac=[0]*MAX
finv=[0]*MAX
inv=[0]*MAX
MOD=10**9+7
#テーブルを作る前処理
def COMinit():
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,MAX):
      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 comb(n,k):
  if (n < k):
    return 0
  if (n < 0 or k < 0):
    return 0
  else:
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

COMinit()
com=1
q=(26**K)%(10**9+7)
ans=0
for i in range(K+1):
  ans+=(q*comb(len(S)+i-1,i))%(10**9+7)#comb(len(S)+i-1,len(S)-1))%(10**9+7)
  q=(q*423076927)%(10**9+7)
  #com=(com*(len(S)+i))//(i+1)
print(ans%(10**9+7))
#print((25*576923081)%(10**9+7))

Fixed submission:
K=int(input())
S=input()
n=K+len(S)
MAX=2000000
fac=[0]*MAX
finv=[0]*MAX
inv=[0]*MAX
MOD=10**9+7
#テーブルを作る前処理
def COMinit():
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,MAX):
      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 comb(n,k):
  if (n < k):
    return 0
  if (n < 0 or k < 0):
    return 0
  else:
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

COMinit()
com=1
q=(26**K)%(10**9+7)
ans=0
for i in range(K+1):
  ans+=(q*comb(len(S)+i-1,i))%(10**9+7)#comb(len(S)+i-1,len(S)-1))%(10**9+7)
  q=(q*423076927)%(10**9+7)
  #com=(com*(len(S)+i))//(i+1)
print(ans%(10**9+7))
#print((25*576923081)%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
S=input()
n=K+len(S)
#ans=comb(n,min(K,len(S)))
com=1
p=1
q=(26**K)%(10**9+7)
ans=0
for i in range(K+1):
  ans+=(p*q*com)%(10**9+7)#comb(len(S)+i-1,len(S)-1))%(10**9+7)
  p=(p*25)%(10**9+7)
  q=(q*576923081)%(10**9+7)
  com=(com*(len(S)+i))//(i+1)
print(ans%(10**9+7))

Fixed submission:
K=int(input())
S=input()
n=K+len(S)
MAX=2000000
fac=[0]*MAX
finv=[0]*MAX
inv=[0]*MAX
MOD=10**9+7
#テーブルを作る前処理
def COMinit():
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,MAX):
      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 comb(n,k):
  if (n < k):
    return 0
  if (n < 0 or k < 0):
    return 0
  else:
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

COMinit()
com=1
q=(26**K)%(10**9+7)
ans=0
for i in range(K+1):
  ans+=(q*comb(len(S)+i-1,i))%(10**9+7)#comb(len(S)+i-1,len(S)-1))%(10**9+7)
  q=(q*423076927)%(10**9+7)
  #com=(com*(len(S)+i))//(i+1)
print(ans%(10**9+7))
#print((25*576923081)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
import math
import bisect
from collections import deque

N=int(input())
a=list(map(int,input().split()))
u=[]
v=[]
road=[[] for i in range(N)]
for i in range(N-1):
  u1,v1=map(int,input().split())
  road[u1-1].append(v1-1)
  road[v1-1].append(u1-1)
  
#幅優先探索BFSか
ans=[0]*N
houmon=[0]*N
s=deque([])
s.append(0)
dp=[[] for i in range(N)]
dp[0].append(a[0])
while(s):
  v=s.popleft()
  for x in road[v]:#vから行ける場所x
    if(houmon[x]==0):
      dp[x].extend(dp[v])
      s.append(x)
      dp[x].append(a[x])
  houmon[v]=1
  #print(dp)
for i in range(N):
  seq=dp[i]
  #print(seq)
  LIS = [seq[0]]
  for i in range(len(seq)):
    if seq[i] > LIS[-1]:
      LIS.append(seq[i])
    else:
      LIS[bisect.bisect_left(LIS, seq[i])] = seq[i]
  print(len(LIS))

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

if(B//K-(A-1)//K>0):
  print("OK")
else:
  print("NG")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
count=0
s=[]
for i in range(N):
  a=input()
  if(a not in s):
    count+=1
    s.append(a)
print(count)

Fixed submission:
N=int(input())
S=[input() for i in range(N)]
S.sort()
count=1
s=[]
for i in range(N-1):
  if(S[i]!=S[i+1]):
    count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=[input() for i in range(N)]

count=0
s=[]
for i in range(N):
  if(S[i] not in s):
    count+=1
    s.append(S[i])
print(count)

Fixed submission:
N=int(input())
S=[input() for i in range(N)]
S.sort()
count=1
s=[]
for i in range(N-1):
  if(S[i]!=S[i+1]):
    count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
r=S.count("R")
g=S.count("G")
b=S.count("B")
ans=r*g*b
for i in range(N):
  x=S[i]
  for j in range(i+1,N):
    if(S[j]!=x):
      y=S[j]
      if(2*j-i>=0 and 2*j-i<N):
        if(S[2*j-i]!=x and S[2*j-i]!=y):
          ans-=1
print(ans)

Fixed submission:
N=input()
for i in range(len(N)):
  if(N[i]=="7"):
    print("Yes")
    exit()
print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
r=S.count("R")
g=S.count("G")
b=S.count("B")
ans=r*g*b
for i in range(N):
  x=S[i]
  for j in range(i+1,N):
    if(S[j]!=x):
      y=S[j]
      if(2*j-i>=0 and 2*j-i<N):
        if(S[2*j-i]!=x and S[2*j-i]!=y):
          ans-=1
print(ans)

Fixed submission:
N=int(input())
S=input()
r=S.count("R")
g=S.count("G")
b=S.count("B")
ans=r*g*b
for i in range(N):
  x=S[i]
  for j in range(i+1,N):
    if(S[j]!=x):
      y=S[j]
      if(2*j-i>=0 and 2*j-i<N):
        if(S[2*j-i]!=x and S[2*j-i]!=y):
          ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p.sort()
q.sort()
p.reverse()
q.reverse()

a=p[:]
a.extend(q)
a.extend(r)
a.sort()
a.reverse()
b=q[:]
b.extend(r)
b.sort()
b.reverse()
c=p[:]
c.extend(r)
c.sort()
c.reverse()
red=0
green=0
sum=0
sum1=0
sum2=0
d=0
for i in range((X+Y)*2):
  if(a[i] in p):
    red+=1
  elif(a[i] in q):
    green+=1
  d+=a[i]
  if(red>X and i-X-Y+1+green==Y):
    break
  if(i<X):
      sum1+=p[i]
      sum2+=c[i]
  if(i<Y):
      sum1+=b[i]
      sum2+=q[i]
  if(i==X+Y and red<=X and green<=Y):
    print(sum)
    break
  if(red>X and i-X-Y+1+green==Y):
    print(sum1)
    break
  elif(green>Y and i-X-Y+1+red==X):
    print(sum2)
    break

Fixed submission:
s=input()

if(s[2]==s[3]and s[4]==s[5]):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
p.reverse()
q.reverse()
p=p[:X]
q=q[:Y]
r=r[:max(X,Y)]
 
a=p[:]
a.extend(q)
a.extend(r)
a.sort()
a.reverse()
b=q[:]
b.extend(r)
b.sort()
b.reverse()
c=p[:]
c.extend(r)
c.sort()
c.reverse()
red=0
green=0
sum=0
sum1=0
sum2=0
d=0
for i in range(X+Y):
  if(a[i] in p):
    red+=1
  elif(a[i] in q):
    green+=1
  d+=a[i]
 
  if(i<X):
      sum1+=p[i]
      sum2+=c[i]
  if(i<Y):
      sum1+=b[i]
      sum2+=q[i]
    
if(red<=X and green<=Y):
  print(d)
elif(red>X):
  print(sum1)
elif(green>Y):
  print(sum2)

Fixed submission:
N,X,Y=map(int,input().split())

k=[0]*(N-1)
for i in range(N):
  for j in range(i+1,N):
    k[min(j-i,abs(j+1-Y)+1+abs(i+1-X))-1]+=1
    
for i in range(N-1):
  print(k[i])
Buggy python submission (verdict: Runtime Error):
L=int(input())
print((L/3)**3)

Fixed submission:
n,m=map(int,input().split())
 
print(n*(n-1)//2+m*(m-1)//2)

Buggy python submission (verdict: Runtime Error):
L=int(input())
print((L/3)**3)

Fixed submission:
n,m=map(int,input().split())
 
print(n*(n-1)//2+m*(m-1)//2)

Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)

flag=True

for i in range(n):
  if(s[i]!=s[n-1-i]):
    flag=False

for i in range((n-1)/2):
  if(s[i]!=s[(n-1)/2-1-i]):
    flag=False
  if(s[(n-1)/2+1+i]!=s[n-1-i]):
    flag=False
    
if(flag):
  print("Yes")
else:
  print("No")

Fixed submission:
n,m=map(int,input().split())
 
print(n*(n-1)//2+m*(m-1)//2)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
 
print(n(n-1)/2+m(m-1)/2)

Fixed submission:
n,m=map(int,input().split())
 
print(n*(n-1)//2+m*(m-1)//2)

Buggy python submission (verdict: Runtime Error):
n.m=map(int,input().split())

print(n(n-1)/2+m(m-1)/2)

Fixed submission:
n,m=map(int,input().split())
 
print(n*(n-1)//2+m*(m-1)//2)

Buggy python submission (verdict: Runtime Error):
n=input()
m=input()

print(n+m)

Fixed submission:
n,m=map(int,input().split())
 
print(n*(n-1)//2+m*(m-1)//2)
Buggy python submission (verdict: Runtime Error):
L=input()
print((L/3)**3)

Fixed submission:
L=int(input())
print((L/3)**3)
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
b=[0]*N
sum=0
for i in range(N):
  b[a[i]]+=1

for i in range(N):
  sum+=b[i]*(b[i]-1)//2
for i in range(N):
  print(sum-b[a[i]]+1)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=[0]*N
sum=0
for i in range(N):
  b[a[i]-1]+=1

for i in range(N):
  sum+=b[i]*(b[i]-1)//2
for i in range(N):
  print(sum-b[a[i]-1]+1)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
b=[0]*N
sum=0
for i in range(N):
  b[a[i]]+=1

for i in range(N):
  sum+=b[i]*(b[i]-1)//2
for i in range(N):
  print(sum-b[a[i]]-1)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=[0]*N
sum=0
for i in range(N):
  b[a[i]-1]+=1

for i in range(N):
  sum+=b[i]*(b[i]-1)//2
for i in range(N):
  print(sum-b[a[i]-1]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
count=0
count2=0
for i in range(N):
  for j in range(N):
    if(a[j]==a[i]):
      count+=1
      count2+=1
#print((count-N)//2)

for i in range(N):
  count2=0
  for j in range(N):
    if(a[j]==a[i]):
      count2+=1
 # print(count)
  print((count-N)//2-count2+1)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=[0]*N
sum=0
for i in range(N):
  b[a[i]-1]+=1

for i in range(N):
  sum+=b[i]*(b[i]-1)//2
for i in range(N):
  print(sum-b[a[i]-1]+1)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
ans=[-1]*N
flag=True
sc = [map(int, input().split()) for _ in range(M)]
s, c = [list(i) for i in zip(*sc)]
x=0
for i in range(M):
  s1=s[i]
  c1=c[i]
  if(ans[s1-1]==-1):
    ans[s1-1]=c1
  elif(ans[s1-1]!=c1):
    flag=False
  if(N>1 and c1==0):
    flag=False
if(flag==False):
  print("-1")
else:
  for i in range(N):
    if(N==1):
      if(ans[i]==-1):
        ans[i]=0
    else:
      if(i==0 and ans[i]==-1):
        ans[i]=1
      elif(ans[i]==-1):
        ans[i]=0
  for j in range(N):
    x+=ans[j]*(10**(N-j-1))
  print(x)

Fixed submission:
N,M=map(int,input().split())
ans=[-1]*N
flag=True
s=[]
c=[]
for i in range(M):
  s1,c1=map(int,input().split())
  s.append(s1)
  c.append(c1)
#sc = [map(int, input().split()) for _ in range(M)]
#s, c = [list(i) for i in zip(*sc)]
x=0
for i in range(M):
  s1=s[i]
  c1=c[i]
  if(ans[s1-1]==-1):
    ans[s1-1]=c1
  elif(ans[s1-1]!=c1):
    flag=False
  if(N>1 and s1==1 and c1==0):
    flag=False
if(flag==False):
  print("-1")
else:
  for i in range(N):
    if(N==1):
      if(ans[i]==-1):
        ans[i]=0
    else:
      if(i==0 and ans[i]==-1):
        ans[i]=1
      elif(ans[i]==-1):
        ans[i]=0
  for j in range(N):
    x+=ans[j]*(10**(N-j-1))
  print(x)
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input())
if((A==B and A!=C)or(B==C and B!=A)or(C==A and C!=B)):
  print("Yes")
else:
  print("No")

Fixed submission:
A,B,C=map(int,input().split())
if((A==B and A!=C)or(B==C and B!=A)or(C==A and C!=B)):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math
 
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
#print(A)
sum=0
for i in range(N-K+1):
  sum+=(A[N-1-i]-A[i])*(comb(N-i-1,K-1))%(10**9+7)
print(sum%(10**9+7))

Fixed submission:
import math
MAX=510000
fac=[0]*MAX
finv=[0]*MAX
inv=[0]*MAX
MOD=10**9+7
#テーブルを作る前処理
def COMinit():
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,MAX):
      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 comb(n,k):
  if (n < k):
    return 0
  if (n < 0 or k < 0):
    return 0
  else:
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

COMinit()
N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
#print(A)
sum=0
for i in range(N-K+1):
  sum+=(A[N-1-i]-A[i])*(comb(N-i-1,K-1))%(10**9+7)
print(sum%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import math
 
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
#print(A)
sum=0
for i in range(N-K+1):
  sum+=(A[N-1-i]-A[i])*(comb(N-i-1,K-1))%(10**9+7)
print(sum%(10**9+7))

Fixed submission:
import math
MAX=510000
fac=[0]*MAX
finv=[0]*MAX
inv=[0]*MAX
MOD=10**9+7
#テーブルを作る前処理
def COMinit():
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,MAX):
      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 comb(n,k):
  if (n < k):
    return 0
  if (n < 0 or k < 0):
    return 0
  else:
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

COMinit()
N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
#print(A)
sum=0
for i in range(N-K+1):
  sum+=(A[N-1-i]-A[i])*(comb(N-i-1,K-1))%(10**9+7)
print(sum%(10**9+7))
Buggy python submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N,K=map(int,input().split())
for i in range(1,K+1):
  a=comb(N-K+1,i)%(10**9+7)
  b=comb(K-1,i-1)%(10**9+7)
  print((a*b)%(10**9+7))

Fixed submission:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N,K=map(int,input().split())
for i in range(1,K+1):
  if(N-K+1>=i):
    a=comb(N-K+1,i)%(10**9+7)
    b=comb(K-1,i-1)%(10**9+7)
    print((a*b)%(10**9+7))
  else:
    print("0")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque
H,W=map(int,input().split())
A=[[c for c in l.strip()] for l in sys.stdin]
maze=[[3000]*W for i in range(H)]
q=deque([])
start=[]
dy=[1,0,-1,0]
dx=[0,1,0,-1]
for i in range(H):
  for j in range(W):
    if(A[i][j]=="#"):
      q.append((i,j))
#print(start)
x=0
y=maze[:]

for i in q:
  maze[i[0]][i[1]]=0
while(q):
  c=q.popleft()
  for j in range(4):
    if(c[0]+dy[j]>=0 and c[0]+dy[j]<H and c[1]+dx[j]>=0 and c[1]+dx[j]<W):
      if(maze[c[0]+dy[j]][c[1]+dx[j]]==3000 and A[c[0]+dy[j]][c[1]+dx[j]]=="."):
        q.append((c[0]+dy[j],c[1]+dx[j]))
        maze[c[0]+dy[j]][c[1]+dx[j]]=maze[c[0]][c[1]]+1
        
        x=max(x,maze[c[0]+dy[j]][c[1]+dx[j]])
print(x)

Fixed submission:
import sys
from collections import deque
H,W=map(int,input().split())
A=[[c for c in l.strip()] for l in sys.stdin]
maze=[[3000]*W for i in range(H)]
q=deque([])
start=[]
dy=[1,0,-1,0]
dx=[0,1,0,-1]
for i in range(H):
  for j in range(W):
    if(A[i][j]=="#"):
      q.append((i,j))
#print(start)
x=0
y=maze[:]

for i in q:
  maze[i[0]][i[1]]=0
while(q):
  c=q.popleft()
  for j in range(4):
    if(c[0]+dy[j]>=0 and c[0]+dy[j]<H and c[1]+dx[j]>=0 and c[1]+dx[j]<W):
      if(maze[c[0]+dy[j]][c[1]+dx[j]]==3000 and A[c[0]+dy[j]][c[1]+dx[j]]=="."):
        q.append((c[0]+dy[j],c[1]+dx[j]))
        maze[c[0]+dy[j]][c[1]+dx[j]]=maze[c[0]][c[1]]+1
        
        x=max(x,maze[c[0]+dy[j]][c[1]+dx[j]])
print(x)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque
H,W=map(int,input().split())
A=[[c for c in l.strip()] for l in sys.stdin]
maze=[[3000]*W for i in range(H)]
q=deque([])
start=[]
dy=[1,0,-1,0]
dx=[0,1,0,-1]
for i in range(H):
  for j in range(W):
    if(A[i][j]=="#"):
      start.append((i,j))
#print(start)
x=0
y=maze[:]
for i in start:
  maze=[[3000]*W for i in range(H)]
  q.append(i)
  maze[i[0]][i[1]]=0
  while(q):
    c=q.popleft()
    y[c[0]][c[1]]=min(y[c[0]][c[1]],maze[c[0]][c[1]])
    for j in range(4):
      if(c[0]+dy[j]>=0 and c[0]+dy[j]<H and c[1]+dx[j]>=0 and c[1]+dx[j]<W):
        if(maze[c[0]+dy[j]][c[1]+dx[j]]==3000 and A[c[0]+dy[j]][c[1]+dx[j]]=="."):
          q.append((c[0]+dy[j],c[1]+dx[j]))
          maze[c[0]+dy[j]][c[1]+dx[j]]=maze[c[0]][c[1]]+1
          
          #y=max(y,maze[c[0]+dy[j]][c[1]+dx[j]])

for i in range(H):
  x=max(x,max(y[i]))
print(x)

Fixed submission:
import sys
from collections import deque
H,W=map(int,input().split())
A=[[c for c in l.strip()] for l in sys.stdin]
maze=[[3000]*W for i in range(H)]
q=deque([])
start=[]
dy=[1,0,-1,0]
dx=[0,1,0,-1]
for i in range(H):
  for j in range(W):
    if(A[i][j]=="#"):
      q.append((i,j))
#print(start)
x=0
y=maze[:]

for i in q:
  maze[i[0]][i[1]]=0
while(q):
  c=q.popleft()
  for j in range(4):
    if(c[0]+dy[j]>=0 and c[0]+dy[j]<H and c[1]+dx[j]>=0 and c[1]+dx[j]<W):
      if(maze[c[0]+dy[j]][c[1]+dx[j]]==3000 and A[c[0]+dy[j]][c[1]+dx[j]]=="."):
        q.append((c[0]+dy[j],c[1]+dx[j]))
        maze[c[0]+dy[j]][c[1]+dx[j]]=maze[c[0]][c[1]]+1
        
        x=max(x,maze[c[0]+dy[j]][c[1]+dx[j]])
print(x)
Buggy python submission (verdict: Runtime Error):
N=int(input())
x=[]
y=[]
h=[]
for i in range(N):
  a,b,c=map(int,input().split())
  x.append(a)
  y.append(b)
  h.append(c)
field=[[-1 for i in range(101)] for i in range(101)]
for i in range(N):
  for j in range(101):
    for k in range(101):
      if(field[j][k]==-1):
        field[j][k]=h[i]+abs(j-x[i])+abs(k-y[i])
      elif(field[j][k]!=h[i]+abs(j-x[i])+abs(k-y[i])):
        field[j][k]=-2
for i in range(101):
  for j in range(101):
    if(field[i][j]>=0):
      cx=i
      cy=j
      H=field[i][j]
print(cx,cy,H)

Fixed submission:
N=int(input())
x=[]
y=[]
h=[]
for i in range(N):
  a,b,c=map(int,input().split())
  x.append(a)
  y.append(b)
  h.append(c)
field=[[-1 for i in range(101)] for i in range(101)]
for i in range(N):
  for j in range(101):
    for k in range(101):
      if(h[i]!=0):
        if(field[j][k]==-1):
          field[j][k]=h[i]+abs(j-x[i])+abs(k-y[i])
        elif(field[j][k]!=h[i]+abs(j-x[i])+abs(k-y[i])):
          field[j][k]=-2
      else:
        if(field[j][k]>h[i]+abs(j-x[i])+abs(k-y[i])):
          field[j][k]=-2
cx=0
cy=0
H=0
for i in range(101):
  for j in range(101):
    if(field[i][j]>=0):
      cx=i
      cy=j
      H=field[i][j]
print(cx,cy,H)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if(ab%2==1):
  print("odd")
else:
  print("even")

Fixed submission:
a,b=map(int,input().split())
if((a*b)%2==1):
  print("Odd")
else:
  print("Even")
Buggy python submission (verdict: Runtime Error):
N,Y=map(int,input().split())

flag=False

for i in range(N+1):
  for j in range(N+1):
    if(9000*i+4000*j==Y-1000*N):
      flag=True
      x=i
      y=j
      z=N-i-j
      
if(flag=True and z>=0):
  print(str(x)+" "+str(y)+" "+str(z))
else:
  print("-1 -1 -1")

Fixed submission:
N,Y=map(int,input().split())

flag=False

for i in range(N+1):
  for j in range(N+1):
    if(9000*i+4000*j==Y-1000*N):
      flag=True
      x=i
      y=j
      z=N-i-j
      
if(flag==True and z>=0):
  print(str(x)+" "+str(y)+" "+str(z))
else:
  print("-1 -1 -1")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
 
count=0
ans=a[0]
for i in range(n):
  count=0
  while(a[i]%2==0):
    a[i]=a[i]//2
    count+=1
  ans=min(ans,count)
  
print(ans)

Fixed submission:
n=int(input())
print(n%9)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
 
count=0
ans=a[0]
for i in range(n):
  count=0
  while(a[i]%2==0):
    a[i]=a[i]//2
    count+=1
  ans=max(ans,count)
  
print(ans)

Fixed submission:
n=int(input())
print(n%9)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=a[:]

x=0#pmpm
y=0

for i in range(n):
  if(i%2==0):
    if(sum(a[:i+1])<=0):
      x+=1-sum(a[:i+1])
      a[i]+=1-sum(a[:i+1])
    if(sum(b[:i+1])>=0):
      y+=sum(b[:i+1])+1
      b[i]-=sum(b[:i+1])+1
  else:
    if(sum(a[:i+1])>=0):
      x+=sum(a[:i+1])+1
      a[i]-=1+sum(a[:i+1])
    if(sum(b[:i+1])<=0):
      y+=1-sum(b[:i+1])
      b[i]+=1-sum(b[:i+1])
print(min(x,y))

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

x=0#pmpm
y=0
sum1=0
sum2=0

for i in range(n):
  sum1+=a[i]
  sum2+=b[i]
  if(i%2==0):
    if(sum1<=0):
      x+=1-sum1
      a[i]+=1-sum1
      sum1+=1-sum1
    if(sum2>=0):
      y+=sum2+1
      b[i]-=sum2+1
      sum2-=sum2+1
  else:
    if(sum1>=0):
      x+=sum1+1
      a[i]-=1+sum1
      sum1-=1+sum1
    if(sum2<=0):
      y+=1-sum2
      b[i]+=1-sum2
      sum2+=1-sum2
print(min(x,y))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
count=0
ans=1
if(N%2==0):
  flag=True
  for i in range(N//2):
    try:
      A.remove(2*i+1)
      try:
        A.remove(2*i+1)
        count+=1
        ans=(ans*2)%(10**9+7)
      except:
        flag=False
        break
    except:
      flag=False
      break
else:
  flag=True
  for i in range((N+1)//2):
    if(i==0):
      try:
        A.remove(0)
      except:
        flag=False
        break
    else:
      try:
        A.remove(2*i)
        try:
          A.remove(2*i)
          count+=1
          ans=(ans*2)%(10**9+7)
        except:
          flag=False
          break
      except:
        flag=False
        break
if(flag==True):
  print(ans)
else:
  print(0)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
count=0
ans=1
A.sort()
if(N%2==0):
  flag=True
  for i in range(N):
    if(i%2==0):
      if(A[i]!=i+1):
        flag=False
        break
    else:
      if(A[i]!=i):
        flag=False
        break
      else:
        ans=(ans*2)%(10**9+7)
else:
  flag=True
  if(A[0]!=0):
    flag=False
  for i in range(N):
    if(i%2==1):
      if(A[i]!=i+1):
        flag=False
        break
    else:
      if(A[i]!=i):
        flag=False
        break
      else:
        if(i>0):
          ans=(ans*2)%(10**9+7)
if(flag==True):
  print(ans)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
count=0
if(N%2==0):
  flag=True
  for i in range(N//2):
    try:
      A.remove(2*i+1)
      try:
        A.remove(2*i+1)
        count+=1
      except:
        flag=False
        break
    except:
      flag=False
      break
else:
  flag=True
  for i in range((N+1)//2):
    if(i==0):
      try:
        A.remove(0)
      except:
        flag=False
        break
    else:
      try:
        A.remove(2*i)
        try:
          A.remove(2*i)
          count+=1
        except:
          flag=False
          break
      except:
        flag=False
        break
if(flag==True):
  print(2**count%(10**9+7))
else:
  print(0)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
count=0
ans=1
A.sort()
if(N%2==0):
  flag=True
  for i in range(N):
    if(i%2==0):
      if(A[i]!=i+1):
        flag=False
        break
    else:
      if(A[i]!=i):
        flag=False
        break
      else:
        ans=(ans*2)%(10**9+7)
else:
  flag=True
  if(A[0]!=0):
    flag=False
  for i in range(N):
    if(i%2==1):
      if(A[i]!=i+1):
        flag=False
        break
    else:
      if(A[i]!=i):
        flag=False
        break
      else:
        if(i>0):
          ans=(ans*2)%(10**9+7)
if(flag==True):
  print(ans)
else:
  print(0)