Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
if __name__=='__main__':
    n,k,*h=map(int,open(0).read().split())
    dp=[0]*n
    for i in range(1,n):
        t=h[i]
        d=10**18
        for v,w in zip(dp[max(0,i-k):i],h[max(0,i-k):i]):
            d=min(d,v+abs(t-w))
        dp[i]=d
    print(dp[-1])

Fixed submission:
n,k,*h=map(int,open(0).read().split())
dp=[0]+[10**18]*~-n
for i in range(1,n):
    for j in range(k):
        if i-k+j<0:continue
        dp[i]=min(dp[i],dp[i-k+j]+abs(h[i]-h[i-k+j]))
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
if __name__=='__main__':
    n,k,*h=map(int,open(0).read().split())
    dp=[0]
    for i in range(1,n):
        t=h[i]
        d=10**18
        for v,w in zip(dp[max(0,i-k):i],h[max(0,i-k):i]):
            d=min(d,v+abs(t-w))
        dp.append(d)
    print(dp[-1])

Fixed submission:
n,k,*h=map(int,open(0).read().split())
dp=[0]+[10**18]*~-n
for i in range(1,n):
    for j in range(k):
        if i-k+j<0:continue
        dp[i]=min(dp[i],dp[i-k+j]+abs(h[i]-h[i-k+j]))
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
if __name__=='__main__':
    n,k,*h=map(int,open(0).read().split())
    dp=[0]
    for i in range(1,n):
        t=h[i]
        d=10**18
        for j in range(k):
            l=i-k+j
            if l<0:continue
            d=min(d,dp[l]+abs(t-h[l]))
        dp.append(d)
    print(dp[-1])

Fixed submission:
n,k,*h=map(int,open(0).read().split())
dp=[0]+[10**18]*~-n
for i in range(1,n):
    for j in range(k):
        if i-k+j<0:continue
        dp[i]=min(dp[i],dp[i-k+j]+abs(h[i]-h[i-k+j]))
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
if __name__=='__main__':
    n,k,*h=map(int,open(0).read().split())
    dp=[0]+[10**18]*~-n
    for i in range(1,n):
        for j in range(k):
            if i-k+j<0:continue
            dp[i]=min(dp[i],dp[i-k+j]+abs(h[i]-h[i-k+j]))
    print(dp[-1])

Fixed submission:
n,k,*h=map(int,open(0).read().split())
dp=[0]+[10**18]*~-n
for i in range(1,n):
    for j in range(k):
        if i-k+j<0:continue
        dp[i]=min(dp[i],dp[i-k+j]+abs(h[i]-h[i-k+j]))
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k,*h=map(int,open(0).read().split())
dp=[0]+[10**18]*~-n
for i in range(1,n):
    for j in range(k):
        if i-k+j<0:continue
        dp[i]=min(dp[i],dp[i-k+j]+abs(h[i]-h[i-k+j]))
print(dp[-1])

Fixed submission:
n,k,*h=map(int,open(0).read().split())
dp=[0]+[10**18]*~-n
for i in range(1,n):
    for j in range(k):
        if i-k+j<0:continue
        dp[i]=min(dp[i],dp[i-k+j]+abs(h[i]-h[i-k+j]))
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
I=lambda:list(map(int,input().split()))
n,W=I()
g=[0]+[I()for _ in range(n)]
dp=[[0]*-~W for _ in range(n+1)]
for i in range(1,n+1):
    t=g[i]
    for j in range(W+1):
        if j-t[0]>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-t[0]]+t[1])
        else:
            dp[i][j]=dp[i-1][j]
print(max(dp[-1]))

Fixed submission:
I=lambda:list(map(int,input().split()))
n,W=I()
g=[0]+[I()for _ in range(n)]
dp=[[0]*-~W for _ in range(n+1)]
for i in range(1,n+1):
    t=g[i]
    for j in range(W+1):
        if j-t[0]>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-t[0]]+t[1])
        else:
            dp[i][j]=dp[i-1][j]
print(max(dp[-1]))
Buggy python submission (verdict: Runtime Error):
I=lambda:list(map(int,input().split()))
n,W=I()
g=[0]+[I()for _ in range(n)]
dp=[[0]*-~W for _ in range(n+1)]
for i in range(1,n+1):
    t=g[i]
    for j in range(W+1):
        if j-t[0]>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-t[0]]+t[1])
        else:
            dp[i][j]=dp[i-1][j]
print(max(dp[-1]))

Fixed submission:
I=lambda:list(map(int,input().split()))
n,W=I()
g=[0]+[I()for _ in range(n)]
vm=n*1000+1
dp=[[0]+[10**18]*vm]+[[0]*vm for _ in range(n)]
for i in range(1,n+1):
    w,v=g[i]
    for j in range(vm):
        k=j-v
        if k<0:
            dp[i][j]=dp[i-1][j]
        else:
            dp[i][j]=min(dp[i-1][j],dp[i-1][k]+w)
for j in range(vm)[::-1]:
    if dp[n][j]<=W:
        print(j)
        break
Buggy python submission (verdict: Runtime Error):
import networkx as nx
def main():
    G=setup_graph()
    print_longest_path(G)
def setup_graph():
    G=nx.DiGraph()
    G.add_edges_from(tuple(tuple(list(map(int,input().split())))for _ in range(int(input().split()[1]))))
    return G
def print_longest_path(G):
    print(len(nx.dag_longest_path(G))-1)
if __name__=='__main__':
    main()

Fixed submission:
from collections import defaultdict,deque
v,n=map(int,input().split())
es=[[int(x)for x in input().split()]for _ in range(n)]
outs=defaultdict(list)
ins=defaultdict(int)
for v1,v2 in es:
    outs[v1].append(v2)
    ins[v2]+=1
q=deque(v1 for v1 in range(v+1)if ins[v1]==0)
res=[]
p=[0]*-~v
while q:
    v1=q.popleft()
    res.append(v1)
    for v2 in outs[v1]:
        ins[v2]-=1
        if ins[v2]==0:
            q.append(v2)
            p[v2]=v1
dp=[0]*-~v
for i in res[1:]:
  dp[i]=dp[p[i]]+1
print(max(dp)-1)
Buggy python submission (verdict: Time Limit Exceeded):
n,*a=map(int,open(0).read().split())
dp=[[0]*(n+1)for _ in range(n+1)]
for k in range(1,n+1):
    for i in range(n-k+1):
        j=i+k
        dp[i][j]=min(dp[i+1][j]-a[i],dp[i][j-1]-a[j-1])if(n-k)%2else max(dp[i+1][j]+a[i],dp[i][j-1]+a[j-1])
print(dp[0][n])

Fixed submission:
n,*a=map(int,open(0).read().split())
dp=[[0]*(n+1)for _ in range(n+1)]
for k in range(1,n+1):
    for i in range(n-k+1):
        j=i+k
        dp[i][j]=min(dp[i+1][j]-a[i],dp[i][j-1]-a[j-1])if(n-k)%2else max(dp[i+1][j]+a[i],dp[i][j-1]+a[j-1])
print(dp[0][n])
Buggy python submission (verdict: Time Limit Exceeded):
from numpy import*
def main():
  M=10**9+7
  n,*a=open(0)
  n=int(n)
  a=array([int8(t.split())for t in a],'?')
  dp=zeros(2**n,'i8')
  dp[0]=1
  j=1<<arange(n)
  for i in range(2**n-1):
    to=i|j[a[bin(i).count('1')]]
    dp[to]+=dp[i]
    dp[to]%=M
  print(dp[-1])
main()

Fixed submission:
def main():
  M=10**9+7
  n,*a=open(0)
  n=int(n)
  a=[list(map(int,t[::2]))for t in a]
  dp=[1]+[0]*(2**n-1)
  for i in range(2**n-1):
    j=bin(i).count('1')
    for k in range(n):
      to=i|1<<k
      if to==i or not a[j][k]:continue
      dp[to]+=dp[i]
      dp[to]%=M
  print(dp[-1])
main()

Buggy python submission (verdict: Runtime Error):
from numpy import*
def main():
  M=10**9+7
  a=loadtxt(open(0),'?',skiprows=1)
  n=len(a)
  dp=zeros(2**n,'i8')
  dp[0]=1
  for i in range(2**n-1):
    to=i|1<<arange(n)[a[bin(i).count('1')]]
    dp[to]+=dp[i]
    dp[to]%=M
  print(dp[-1])
main()

Fixed submission:
def main():
  M=10**9+7
  n,*a=open(0)
  n=int(n)
  a=[list(map(int,t[::2]))for t in a]
  dp=[1]+[0]*(2**n-1)
  for i in range(2**n-1):
    j=bin(i).count('1')
    for k in range(n):
      to=i|1<<k
      if to==i or not a[j][k]:continue
      dp[to]+=dp[i]
      dp[to]%=M
  print(dp[-1])
main()
Buggy python submission (verdict: Time Limit Exceeded):
M=10**9+7
(n,k),*a=[list(map(int,t.split()))for t in open(0)]
r=a if k&1else[[i==j for j in range(n)]for i in range(n)]
d=a
for i in range(1,k.bit_length()):
  p=[]
  for y in d:
    q=[0]*n
    for x,s in zip(y,d):
      for j,t in enumerate(s):
        q[j]+=t*x%M
    p+=q,
  d=p
  if 1<<i&k:
    p=[]
    for y in r:
      q=[0]*n
      for x,s in zip(y,d):
        for j,t in enumerate(s):
          q[j]+=t*x%M
      p+=q,
    r=p
print(sum(t for s in r for t in s)%M)

Fixed submission:
M=10**9+7
(n,k),*a=[list(map(int,t.split()))for t in open(0)]
r=a if k&1else[[i==j for j in range(n)]for i in range(n)]
d=a
for i in range(1,k.bit_length()):
  p=[]
  for y in d:
    q=[0]*n
    for x,s in zip(y,d):
      for j,t in enumerate(s):
        q[j]+=t*x%M
    p+=q,
  d=p
  if 1<<i&k:
    p=[]
    for y in r:
      q=[0]*n
      for x,s in zip(y,d):
        for j,t in enumerate(s):
          q[j]+=t*x%M
      p+=q,
    r=p
print(sum(t for s in r for t in s)%M)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()[::-1];i=0
while'WB'in s:s=s.replace('WB','BW',1);i+=1
print(i)

Fixed submission:
s=input()
a=b=0
for i in range(len(s)):
  if s[i]=='B':
    b+=1
  else:
    a+=b
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
e=enumerate
n,s,q,*k=open(0).read().split()
n=int(n)
m,c,x=eval('[0]*-~n,'*3)
for i,t in e(s):
  m[i+1]=m[i]+(t=='M')
  f=t=='C'
  c[i+1]=c[i]+f
  x[i+1]=x[i]+f*m[i+1]
for k in k:
  k=int(k)
  a=0
  for i,t in e(s):
    j=min(n,i+k)
    a+=t=='D'and(c[i]-c[j])*m[i]+x[j]-x[i]
  print(a)

Fixed submission:
from numpy import*
_,s,_,k=open(0)
s=array(list('='+s[:-1]))
d,m,c=[s==t for t in'DMC']
x,y=map(cumsum,(d,m))
for k in int32(k.split()):
  t=copy(x)
  t[k:]-=x[:-k]
  t*=m
  t[k+1:]-=d[1:-k]*(y[k:-1]-y[:~k])
  print(sum(cumsum(t)*c))

Buggy python submission (verdict: Runtime Error):
e=enumerate
n,s,q,*k=open(0).read().split()
m,c,x=eval('[0]*-~int(n),'*3)
for i,t in e(s,1):
  m[i]=m[i-1]+(t=='M')
  f=t=='C'
  c[i]=c[i-1]+f
  x[i]=x[i-1]+f*m[i]
for k in map(int,k):
  a=0
  for i,t in e(s):
    j=min(n,i+k)
    if t=='D':a+=x[j]-x[i]-(c[j]-c[i])*m[i]
  print(a)

Fixed submission:
from numpy import*
_,s,_,k=open(0)
s=array(list('='+s[:-1]))
d,m,c=[s==t for t in'DMC']
x,y=map(cumsum,(d,m))
for k in int32(k.split()):
  t=copy(x)
  t[k:]-=x[:-k]
  t*=m
  t[k+1:]-=d[1:-k]*(y[k:-1]-y[:~k])
  print(sum(cumsum(t)*c))
Buggy python submission (verdict: Runtime Error):
s=input();print(int(s[:2])+int(s[2:])//2)

Fixed submission:
a,b=map(int,input().split());print(a+b//2)

Buggy python submission (verdict: Runtime Error):
print(eval(input().replace(' ','+0.5*'))

Fixed submission:
a,b=map(int,input().split());print(a+b//2)
Buggy python submission (verdict: Runtime Error):
input();I=map(int,input().split());t,a=I();d,i=9**9,0
for j,v in enumerate(I()):
 w=abs(a-t+v*0.006)
 if w<d:d=w;i=j
print(i+1)

Fixed submission:
n,t,a,*h=map(int,open(0).read().split())
d,i=10**18,0
for j in range(n):
  if abs(a-t+h[j]*0.006)<d:
    d=abs(a-t+h[j]*0.006)
    i=j
print(i+1)

Buggy python submission (verdict: Runtime Error):
n,t,a,*h=map(int,open(0).read().spilt())
d,i=10**18,0
for j in range(n):
  if abs(a-t+h[j]*0.006)<d:
    d=abs(a-t+h[j]*0.006)
    i=j
print(i+1)

Fixed submission:
n,t,a,*h=map(int,open(0).read().split())
d,i=10**18,0
for j in range(n):
  if abs(a-t+h[j]*0.006)<d:
    d=abs(a-t+h[j]*0.006)
    i=j
print(i+1)

Buggy python submission (verdict: Runtime Error):
n,t,a,*h=map(int,open(0).read().spilt())
d,i=10**18,0
for j in range(n):
  if abs(a-t+h*0.006)<d:
    d=abs(a-t+h*0.006)
    i=j
print(i+1)

Fixed submission:
n,t,a,*h=map(int,open(0).read().split())
d,i=10**18,0
for j in range(n):
  if abs(a-t+h[j]*0.006)<d:
    d=abs(a-t+h[j]*0.006)
    i=j
print(i+1)
Buggy python submission (verdict: Runtime Error):
I=lambda:list(map(int,input().split()))[::-1];m,n=I();l=[I()+[i]for i in range(m)];c=[0]*-~n;a=[0]*m
for y,p,i in sorted(l):c[p]+=1;a[i]='%06d'%p+'%06d'%c[p]
print('\n'.join(t))

Fixed submission:
I=lambda:map(int,input().split())
n,m=I()
l=[[]for _ in range(n+1)]
for i in range(m):
  p,y=I()
  l[p].append([y,i])
a=[]
for p in range(1,n+1):
  l[p].sort()
  for i,t in enumerate(l[p]):
    a.append([t[1],'%06d'%p+'%06d'%-~i])
a.sort()
for t in a:
  print(t[1])

Buggy python submission (verdict: Runtime Error):
I=lambda:list(map(int,input().split()));n,m=I();l=[I()+[i]for i in range(M)];c=[0]*-~N;a=[0]*M
for p,y,i in sorted(l,key=lambda x:x[1]):c[p]+=1;a[i]='%06d'%p+'%06d'%c[p]
for t in a:print(t)

Fixed submission:
I=lambda:map(int,input().split())
n,m=I()
l=[[]for _ in range(n+1)]
for i in range(m):
  p,y=I()
  l[p].append([y,i])
a=[]
for p in range(1,n+1):
  l[p].sort()
  for i,t in enumerate(l[p]):
    a.append([t[1],'%06d'%p+'%06d'%-~i])
a.sort()
for t in a:
  print(t[1])
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
l=n*m//gcd(n,m)
x=['.']*l
for i in range(n):
  x[i*(l//n)]=s[i]
for i in range(m):
  if x[i*(l//m)]!='.'and x[i*(l//m)]!=t[i]:
    print(-1)
    break
else:
  print(l)

Fixed submission:
from fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
g=gcd(n,m)
a=n//g
b=m//g
for i in range(g):
  if s[a*i]!=t[b*i]:
    print(-1)
    break
else:
  print(n*m//g)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
def swap(a,b):
  c=a
  a=b
  b=c
  return(a,b)
n,m=map(int,input().split())
s=input()
t=input()
o=n*m//gcd(n,m)
if m>n:
  s,t=swap(s,t)
  n,m=swap(n,m)
if not n%m:
  for i in range(m):
    if s[n//m*i]!=t[i]:
      print(-1)
      break
  else:
    print(n)
  exit()
for i in range(1,10**7):
  g=o*i
  x=['.']*g
  for j in range(n):
    x[j*(g//n)]=s[j]
  for j in range(m):
    if x[j*(g//m)]!='.'and x[j*(g//m)]!=t[j]:break
  else:
    print(len(x))
    break
else:print(-1)

Fixed submission:
from fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
g=gcd(n,m)
a=n//g
b=m//g
for i in range(g):
  if s[a*i]!=t[b*i]:
    print(-1)
    break
else:
  print(n*m//g)

Buggy python submission (verdict: Runtime Error):
from fraction import gcd
def swap(a,b):
  c=a
  a=b
  b=c
  return(a,b)
n,m=map(int,input().split())
s=input()
t=input()
o=n*m//gcd(n,m)
if m>n:
  s,t=swap(s,t)
  n,m=swap(n,m)
if not n%m:
  for i in range(m):
    if s[n//m*i]!=t[i]:
      print(-1)
      break
  else:
    print(n)
  exit()
for i in range(1,10**7):
  g=o*i
  x=['.']*g
  for j in range(n):
    x[j*(g//n)]=s[j]
  for j in range(m):
    if x[j*(g//m)]!='.'and x[j*(g//m)]!=t[j]:break
  else:
    print(len(x))
    break
else:print(-1)

Fixed submission:
from fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
g=gcd(n,m)
a=n//g
b=m//g
for i in range(g):
  if s[a*i]!=t[b*i]:
    print(-1)
    break
else:
  print(n*m//g)
Buggy python submission (verdict: Runtime Error):
print input()+input()if input()-1else'Hello World'

Fixed submission:
print input()+input()if input()-1 else'Hello World'
Buggy python submission (verdict: Runtime Error):
i=lambda:map(int,input().split());N,T=i();print(min([c for c,t in[i()for _ in[0]*N]if t<=T],default='TLE'))

Fixed submission:
i=lambda:map(int,input().split())
N,T=i()
a=9999
for _ in[0]*N:
  c,t=i()
  a=[min(a,c),a][t>T]
print('TLE'*(a>1000)or a)
Buggy python submission (verdict: Runtime Error):
def s(n):
    return[m(t)for t in d(f(n))]
def f(n):
    l=[]
    b,e=2,0
    while b*b<=n:
        while not n%b:
            n//=b
            e+=1
        if e:
            l.append((b,e))
        b,e=b+1,0
    if n>1:
        l.append((n,1))
    return l
def d(l):
    b,e=l.pop()
    p=d(l)if l else[[]]
    v=[[(b,k)]for k in range(e+1)]
    return[s+t for s in p for t in v]
def m(l):
    a=1
    for b,e in l:
        a*=b**e
    return a
N,M=map(int,input().split())
a=0
for i in sorted(s(M))[::-1]:
    if M//i>=N:
        a=i
        break
print(a)

Fixed submission:
def s(n):
    return[m(t)for t in d(f(n))]
def f(n):
    l=[]
    b,e=2,0
    while b*b<=n:
        while not n%b:
            n//=b
            e+=1
        if e:
            l.append((b,e))
        b,e=b+1,0
    if n>1:
        l.append((n,1))
    return l
def d(l):
    b,e=l.pop()
    p=d(l)if l else[[]]
    v=[[(b,k)]for k in range(e+1)]
    return[s+t for s in p for t in v]
def m(l):
    a=1
    for b,e in l:
        a*=b**e
    return a
N,M=map(int,input().split())
if M<2:print(1);exit()
a=0
for i in sorted(s(M))[::-1]:
    if M//i>=N:
        a=i
        break
print(a)
Buggy python submission (verdict: Runtime Error):
print(''.join(map(lambda x:{'1':'9','9':'1'}[x],input().split())))

Fixed submission:
print(''.join(map(lambda x:{'1':'9','9':'1'}[x],input())))
Buggy python submission (verdict: Runtime Error):
z,x,y=eval('map(int,input().split()),'*3);print('No War'[3*(max(z[2],*x)>=min(z[3],*y)):])

Fixed submission:
x,y=input().split()[2:];print('No '*(max(map(int,input().split()+[x]))<min(map(int,input().split()+[y])))+'War')

Buggy python submission (verdict: Time Limit Exceeded):
def bogosort(l):
  import random
  while 1:
    random.shuffle(l)
    for i in range(1,len(l)):
      if l[i]<l[i-1]:
        break
    else:
      return l
i=lambda:list(map(int,input().split()))
n,m,x,y=i()
if bogosort(i()+[x])[-1]<bogosort(i()+[y])[0]:
    print('No War')
else:
    print('War')

Fixed submission:
x,y=input().split()[2:];print('No '*(max(map(int,input().split()+[x]))<min(map(int,input().split()+[y])))+'War')

Buggy python submission (verdict: Time Limit Exceeded):
def bsort(l):
  import random
  while 1:
    random.shuffle(l)
    for i in range(1,len(l)):
      if l[i]<l[i-1]:
        break
    else:
      return l
i=lambda:list(map(int,input().split()))
n,m,x,y=i()
if bsort(i()+[x])[-1]<bsort(i()+[y])[0]:
    print('No War')
else:
    print('War')

Fixed submission:
x,y=input().split()[2:];print('No '*(max(map(int,input().split()+[x]))<min(map(int,input().split()+[y])))+'War')

Buggy python submission (verdict: Time Limit Exceeded):
def bogosort(l):
  import random
  while 1:
    random.shuffle(l)
    for i in range(1,len(l)):
      if l[i]<l[i-1]:
        break
    else:
      return l
i=lambda:list(map(int,input().split()))
n,m,x,y=i()
a=bogosort(i()+[x])
b=bogosort(i()+[y])
if a[-1]<b[0]:
    print('No War')
else:
    print('War')


Fixed submission:
x,y=input().split()[2:];print('No '*(max(map(int,input().split()+[x]))<min(map(int,input().split()+[y])))+'War')
Buggy python submission (verdict: Time Limit Exceeded):
s,t=map(lambda x:sorted(x.count(i)for i in x),open(0))
print('YNeos'[s!=t::2])

Fixed submission:
s,t=[0]*26,[0]*26
for a,b in zip(input(),input()):
  s[ord(a)-ord('a')]+=1
  t[ord(b)-ord('a')]+=1
u,v=[],[]
for a,b in zip(s,t):
  if a!=b:
    u.append(a)
    v.append(b)
print('YNeos'[sorted(u)!=sorted(v)::2])

Buggy python submission (verdict: Runtime Error):
from collections import*;C=Counter;print('YNeos'[eval('!=C(C(input()).values())'*2[2:])::2])

Fixed submission:
s,t=[0]*26,[0]*26
for a,b in zip(input(),input()):
  s[ord(a)-ord('a')]+=1
  t[ord(b)-ord('a')]+=1
u,v=[],[]
for a,b in zip(s,t):
  if a!=b:
    u.append(a)
    v.append(b)
print('YNeos'[sorted(u)!=sorted(v)::2])
Buggy python submission (verdict: Runtime Error):


Fixed submission:
n,x=map(int,input().split())
a=list(map(int,input().split()))
if sum(a)<x:
    a.sort(reverse=True)
else:
    a.sort()
c=0
for t in a:
    x-=t
    if x<0:break
    c+=1
if x>0:
    print(c-1)
else:
    print(c)
Buggy python submission (verdict: Runtime Error):
print('No'*'2'in input()or'Yes')

Fixed submission:
a,b=map(int,input().split())
if a*b%2:print('Yes')
else:print('No')
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
def g(x):return reduce(math.gcd,x)
print(g([int(input().split()[1])]+list(map(int,input().split()))))

Fixed submission:
N,X=map(int,input().split())
x=sorted(map(lambda x:int(x)-X if int(x)-X>0 else -(int(x)-X),input().split()))
for i in range(x[0]+1)[::-1]:
    if x[0]%i:continue
    if sum(map(lambda x:x%i,x))==0:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
N,X=map(int,input().split())
x=sorted(map(lambda x:int(x)-X if int(x)-X>0 else -(int(x)-X),input().split()))
for i in range(x[0]+1)[::-1]:
    if sum(map(lambda x:x%i,x))==0:
        print(i)
        break

Fixed submission:
N,X=map(int,input().split())
x=sorted(map(lambda x:int(x)-X if int(x)-X>0 else -(int(x)-X),input().split()))
for i in range(x[0]+1)[::-1]:
    if x[0]%i:continue
    if sum(map(lambda x:x%i,x))==0:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
m=[0]*n
for i in range(1,n+1):m[i%k]+=1
print(m[0]*3+[m[k//2]*3,0][k%2])

Fixed submission:
n,k=map(int,input().split())
m=[0]*k
for i in range(1,n+1):m[i%k]+=1
print(m[0]**3+[m[k//2]**3,0][k%2])
Buggy python submission (verdict: Runtime Error):
f=lambda s:zip(*[t for t in s if'#'in t]);for r in f(f(open(0).readlines())):print(*r,sep='')

Fixed submission:
h, w = map(int, input().split())
a = []
for _ in range(h):
  t = list(input())
  if t.count('.') != w:
    a.append(t)
i = 0
while True:
  if i >= len(a[0]):break
  for t in a:
    if t[i] != '.':
      i += 1
      break
  else:
    for j in range(len(a)):
      del a[j][i]
for t in a:
  print(''.join(t))
Buggy python submission (verdict: Runtime Error):
s=input();print(~-int(s[:2])*~-int(s[2:]))

Fixed submission:
a,b=map(lambda x:int(x)-1,input().split())
print(a*b)

Buggy python submission (verdict: Runtime Error):
print(eval('~-'+'*~-'.join(input().split()))

Fixed submission:
a,b=map(lambda x:int(x)-1,input().split())
print(a*b)

Buggy python submission (verdict: Runtime Error):
eval('print(('+input().replace(' ','-1)*(')+'-1))'

Fixed submission:
a,b=map(lambda x:int(x)-1,input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
print(eval(input().replace(' ','%'))

Fixed submission:
n, k = map(int, input().split())
print((n + k - 1) // k - n // k)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=''
while n!=0:
  s=str(n%2)+s
  n=-(n//2)
print(s*(s!='')else 0)

Fixed submission:
n=int(input())
s=''
while n!=0:
  s=str(n%2)+s
  n=-(n//2)
print(s*(s!='')or 0)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=''
while n!=0:
  s=str(n%2)+s
  n=-(n//2)
print(s*(if s)else 0)

Fixed submission:
n=int(input())
s=''
while n!=0:
  s=str(n%2)+s
  n=-(n//2)
print(s*(s!='')or 0)
Buggy python submission (verdict: Time Limit Exceeded):
a=[1]+[0]*4
for s in input():
 i=ord(s)-64
 if i>0:a[i]+=a[i-1]
 else:a=[a[i]*3+a[i-1]for i in range(4)]+[0]
print(a[3]%(10**9+7))

Fixed submission:
def index(c):return ord(c)-ord('A')+1
s=' '+input()
m=10**9+7
dp=[[0]*4 for _ in range(len(s))]
dp[0][0]=1
for i in range(1,len(s)):
    for j in range(4):
        dp[i][j]=dp[i-1][j]
    if s[i]=='?':
        dp[i][0]=dp[i-1][0]*3%m
        for j in range(1,4):
            dp[i][j]=(dp[i-1][j-1]+dp[i-1][j]*3)%m
    else:
        k=index(s[i])
        dp[i][k]=(dp[i-1][k-1]+dp[i-1][k])%m
print(dp[-1][3])
Buggy python submission (verdict: Runtime Error):
input();print(eval(input().replace(' ','-1+'))-1)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] -= 1
print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(input())
l=s[:n]
r=s[n:][::-1]
d={}
e={}
for i in range(1<<n):
  s=t=u=v=''
  for j in range(n):
    if (i>>j)&1:
      s+=l[j]
      t+=r[j]
    else:
      u+=l[j]
      v+=r[j]
  d[(s,u)]=d.get((s,u),0)+1
  e[(t,v)]=e.get((t,v),0)+1
a=0
for i in d.keys():
  a+=d[i]*e.get(i,0)
print(a)

Fixed submission:
n=int(input())
s=list(input())
l=s[:n]
r=s[n:][::-1]
d={}
e={}
for i in range(1<<n):
  s=t=u=v=''
  for j in range(n):
    if (i>>j)&1:
      s+=l[j]
      t+=r[j]
    else:
      u+=l[j]
      v+=r[j]
  d[(s,u)]=d.get((s,u),0)+1
  e[(t,v)]=e.get((t,v),0)+1
a=0
for i in d.keys():
  a+=d[i]*e.get(i,0)
print(a)