Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from networkx import*
(N,M,*S),*t=[map(int,t.split())for t in open(0)]
G=Graph()
for*u,a,b in t:G.add_edge(*u,y=a,s=b)
b=m=10**15
y,s,*r=map(eval(dir()[761]),(G,G),S,(m,m),'ys')
while N:b=min(b,y[N]+s[N]);r+=m-b,;N-=1
print(*r[::-1])

Fixed submission:
from heapq import*
def dijkstra(n,s,edge):
    g=10**6
    d=[10**18]*n
    used=[True]*n
    d[s]=0
    used[s]=False
    edgelist=[]
    for a,b in edge[s]:heappush(edgelist,a*g+b)
    while edgelist:
        minedge=heappop(edgelist)
        if not used[minedge%g]:continue
        v1=minedge%g
        c1=d[v1]=minedge//g
        used[v1]=False
        for c2,v2 in edge[v1]:
            if used[v2]:heappush(edgelist,(c1+c2)*g+v2)
    return d
def main():
    n,m,s,t,*z=map(int,open(0).read().split())
    e1,e2=[[[]for _ in range(n)]for _ in range(2)]
    for u,v,a,b in zip(*[iter(z)]*4):
        u-=1
        v-=1
        e1[u]+=(a,v),
        e1[v]+=(a,u),
        e2[u]+=(b,v),
        e2[v]+=(b,u),
    c1=dijkstra(n,s-1,e1)
    c2=dijkstra(n,t-1,e2)
    a=[]
    m=0
    for y,s in zip(c1[::-1],c2[::-1]):
        t=10**15-y-s
        if t>m:m=t
        a+=m,
    print(*a[::-1],sep='\n')
main()

Buggy python submission (verdict: Time Limit Exceeded):
from networkx import*
(N,M,*S),*t=[map(int,t.split())for t in open(0)]
G=Graph()
for*u,a,b in t:G.add_edge(*u,y=a,s=b)
b=m=10**15
y,s,*r=map(eval(dir()[761]),(G,G),S,(m,m),'ys')
while N:b=min(b,y[N]+s[N]);r+=m-b,;N-=1
print(*r[::-1])

Fixed submission:
from heapq import*
def dijkstra(n,s,edge):
    g=10**6
    d=[10**18]*n
    used=[True]*n
    d[s]=0
    used[s]=False
    edgelist=[]
    for a,b in edge[s]:heappush(edgelist,a*g+b)
    while edgelist:
        minedge=heappop(edgelist)
        if not used[minedge%g]:continue
        v1=minedge%g
        c1=d[v1]=minedge//g
        used[v1]=False
        for c2,v2 in edge[v1]:
            if used[v2]:heappush(edgelist,(c1+c2)*g+v2)
    return d
def main():
    n,m,s,t,*z=map(int,open(0).read().split())
    e1,e2=[[[]for _ in range(n)]for _ in range(2)]
    for u,v,a,b in zip(*[iter(z)]*4):
        u-=1
        v-=1
        e1[u]+=(a,v),
        e1[v]+=(a,u),
        e2[u]+=(b,v),
        e2[v]+=(b,u),
    c1=dijkstra(n,s-1,e1)
    c2=dijkstra(n,t-1,e2)
    a=[]
    m=0
    for y,s in zip(c1[::-1],c2[::-1]):
        t=10**15-y-s
        if t>m:m=t
        a+=m,
    print(*a[::-1],sep='\n')
main()
Buggy python submission (verdict: Runtime Error):
input();a=map(int,input().split());print(max(a)-min(a))

Fixed submission:
input();a=list(map(int,input().split()));print(max(a)-min(a))
Buggy python submission (verdict: Runtime Error):
s=lambda a,b:a*(a<b)or s(a//b,b)+a%b;n=int(input());print(min(s(i,6)+s(n-i,9)for i in range(n+1)))

Fixed submission:
def s(n,c):
  if n<6:return c+n
  a=b=1
  while a*6<=n:a*=6
  while b*9<=n:b*=9
  return min(s(n-a,c+1),s(n-b,c+1))
print(s(int(input()),0))

Buggy python submission (verdict: Runtime Error):
def s(a,b):return[s(a//b,b)+a%b,a][a<b]
n=int(input());print(min(s(i,6)+s(n-i,9)for i in range(n+1)))

Fixed submission:
def s(n,c):
  if n<6:return c+n
  a=b=1
  while a*6<=n:a*=6
  while b*9<=n:b*=9
  return min(s(n-a,c+1),s(n-b,c+1))
print(s(int(input()),0))

Buggy python submission (verdict: Runtime Error):
def s(n,p):
  while n>0:yield n%p;n//=p
c=lambda*a:sum(s(*a));n=int(input())print(min(c(i,6)+c(n-i,9)for i in range(n+1)))

Fixed submission:
def s(n,c):
  if n<6:return c+n
  a=b=1
  while a*6<=n:a*=6
  while b*9<=n:b*=9
  return min(s(n-a,c+1),s(n-b,c+1))
print(s(int(input()),0))

Buggy python submission (verdict: Runtime Error):
def s(n,p):
  while n>0:yield n%p;n//=p
c=lambda*a:sum(s(*a))
print(min(c(i,6)+c(n-i,9)for i in range(int(input())+1)))

Fixed submission:
def s(n,c):
  if n<6:return c+n
  a=b=1
  while a*6<=n:a*=6
  while b*9<=n:b*=9
  return min(s(n-a,c+1),s(n-b,c+1))
print(s(int(input()),0))

Buggy python submission (verdict: Runtime Error):
def s(n,p):
  while n>0:yield n%p;n//=p
c=lambda*a:sum(s(*a));print(min(c(i,6)+c(n-i,9)for i in range(int(input())+1)))

Fixed submission:
def s(n,c):
  if n<6:return c+n
  a=b=1
  while a*6<=n:a*=6
  while b*9<=n:b*=9
  return min(s(n-a,c+1),s(n-b,c+1))
print(s(int(input()),0))
Buggy python submission (verdict: Time Limit Exceeded):
n,c=map(int,input().split())
d=[list(map(int,input().split()))for _ in range(c)]
l=[[i for i in[0]*c]for _ in range(3)]
for i in range(n):
  t=list(map(int,input().split()))
  for j in range(n):
    l[(i+j)%3][t[j]-1]+=1
c=10**18
for i in range(c):
  for j in range(c):
    for k in range(c):
      if i==j or j==k or k==i:continue
      c=min(c,sum(d[x][i]*l[0][x]+d[x][j]*l[1][x]+d[x][k]*l[2][x]for x in range(c)))
print(c)

Fixed submission:
n,c=map(int,input().split())
d=[list(map(int,input().split()))for _ in range(c)]
l=[[i for i in[0]*c]for _ in range(3)]
for i in range(n):
  t=list(map(int,input().split()))
  for j in range(n):
    l[(i+j)%3][t[j]-1]+=1
a=10**18
for i in range(c):
  for j in range(c):
    for k in range(c):
      if i==j or j==k or k==i:continue
      a=min(a,sum(d[x][i]*l[0][x]+d[x][j]*l[1][x]+d[x][k]*l[2][x]for x in range(c)))
print(a)
Buggy python submission (verdict: Runtime Error):
n,a,b,k=map(int,input().split())
m=998244353
I=[0]*n
for i in range(n):
  I[i]=pow(i+1,m-2,m)
c=[0]*(n+1)
c[0]=1
for i in range(1,n+1):
  c[i]=(c[i-1]*(n-i+1)*I[i-1])%m
q=0
for i in range(0,n+1):
  j=k-i*a
  if j<0 or j%b:continue
  j//=b
  q=(q+c[i]*c[j])%m
print(q%m)

Fixed submission:
n,a,b,k=map(int,input().split())
m=998244353
I=[0]*n
for i in range(n):
  I[i]=pow(i+1,m-2,m)
c=[0]*(n+1)
c[0]=1
for i in range(1,n+1):
  c[i]=(c[i-1]*(n-i+1)*I[i-1])%m
q=0
for i in range(n+1):
  j=(k-i*a)//b
  if (k-i*a)%b or j<0 or j>n:continue
  q=(q+c[i]*c[j])%m 
print(q%m)

Buggy python submission (verdict: Runtime Error):
import math
from functools import lru_cache
@lru_cache(maxsize=None)
def p(n,r):
  return math.factorial(n)//math.factorial(n-r)
@lru_cache(maxsize=None)
def c(n,r):
  return p(n,r)//math.factorial(r)
n,a,b,k=map(int,input().split())
m=998244353
q=0
for i in range(0,n+1):
  j=k-i*a
  if j<0 or j%b:continue
  j//=b
  q=(q+c(n,i)*c(n,j))%m
print(q%m)

Fixed submission:
n,a,b,k=map(int,input().split())
m=998244353
I=[0]*n
for i in range(n):
  I[i]=pow(i+1,m-2,m)
c=[0]*(n+1)
c[0]=1
for i in range(1,n+1):
  c[i]=(c[i-1]*(n-i+1)*I[i-1])%m
q=0
for i in range(n+1):
  j=(k-i*a)//b
  if (k-i*a)%b or j<0 or j>n:continue
  q=(q+c[i]*c[j])%m 
print(q%m)
Buggy python submission (verdict: Runtime Error):
n=int(input());s=input();print(max((len(set(s[:i])*set(s[i:]))for i in range(n))))

Fixed submission:
n = int(input())
s = list(input())
a = 0
for i in range(n):
    x = list(set(s[:i]))
    y = list(set(s[i:]))
    t = 0
    for j in x:
        if j in y:
            t += 1
    a = max(a, t)
print(a)

Buggy python submission (verdict: Runtime Error):
n=int(input());s=input();print(max(len(set(s[:i])&set(s[i:]))for i in range(n))

Fixed submission:
n = int(input())
s = list(input())
a = 0
for i in range(n):
    x = list(set(s[:i]))
    y = list(set(s[i:]))
    t = 0
    for j in x:
        if j in y:
            t += 1
    a = max(a, t)
print(a)
Buggy python submission (verdict: Runtime Error):
n,s=open(0)
a=[0]*(n+1)
b=[0]*(n+2)
for i in range(n):
  a[i+1]=a[i]
  b[n-i]=b[n-i+1]
  if s[i]=='W':
    a[i+1]+=1
  if s[n-i-1]=='E':
    b[n-i]+=1
print(min(a[i]+b[i]-1for i in range(1,n+1)))

Fixed submission:
n=int(input())
s=list(input())
a=[0]*(n+1)
b=[0]*(n+2)
for i in range(n):
  a[i+1]=a[i]
  b[n-i]=b[n-i+1]
  if s[i]=='W':
    a[i+1]+=1
  if s[n-i-1]=='E':
    b[n-i]+=1
print(min(a[i]+b[i]-1for i in range(1,n+1)))
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q,*a=map(int,open(0).read().split())
s=sorted
m=1e18
for b in a:
    i=0
    l=[]
    for j,t in enumerate(a+[-1]):
        if t<b:
            l.extend(s(a[i:j])[::-1][k-1:])
            i=j+1
    l.sort()
    if len(l)>=q:m=min(m,l[q-1]-b)
print(m)

Fixed submission:
n,k,q,*a=map(int,open(0).read().split())
s=sorted
m=1e18
for b in a:
    i=[i for i,t in enumerate(a)if t<b]
    l=s(u for t in[s(a[i+1:j])[::-1][k-1:]for i,j in zip([-1]+i,i+[n])]for u in t)
    if len(l)>=q:m=min(m,l[q-1]-b)
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
n,k,q,*a=map(int,open(0).read().split())
s=sorted
m=1e18
for b in a:
    i=[i for i,t in enumerate(a)if t<b]
    l=s(u for t in[s(a[i+1:j])[::-1][k-1:]for i,j in zip([-1]+i,i+[n])]for u in t)
    if len(l)>=q:m=min(m,l[q-1]-b)
print(m)

Fixed submission:
n,k,q,*a=map(int,open(0).read().split())
s=sorted
m=1e18
for b in a:
    i=[i for i,t in enumerate(a)if t<b]
    l=s(u for t in[s(a[i+1:j])[::-1][k-1:]for i,j in zip([-1]+i,i+[n])]for u in t)
    if len(l)>=q:m=min(m,l[q-1]-b)
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
n,k,q,*a=map(int,open(0).read().split())
s=sorted
m=1e18
for b in a:
    i=[i for i,t in enumerate(a)if t<b]
    l=s(sum([s(a[i+1:j])[::-1][k-1:]for i,j in zip([-1]+i,i+[n])],[]))
    if len(l)>=q:m=min(m,l[q-1]-b)
print(m)

Fixed submission:
n,k,q,*a=map(int,open(0).read().split())
s=sorted
m=1e18
for b in a:
    i=[i for i,t in enumerate(a)if t<b]
    l=s(u for t in[s(a[i+1:j])[::-1][k-1:]for i,j in zip([-1]+i,i+[n])]for u in t)
    if len(l)>=q:m=min(m,l[q-1]-b)
print(m)
Buggy python submission (verdict: Runtime Error):
I=lambda:list(map(int.input().split()));n,m=I();p=I();l=[i for i in range(n+1)]
def u(x):
 if l[x]!=x:l[x]=u(l[x])
 return l[x]
for _ in[0]*m:x,y=I();l[u(x)]=u(y)
print(sum(u(i)==u(j)for i,j in enumerate(p,1)))

Fixed submission:
class UnionFind():
  def __init__(self,size):
    self.table=[-1for _ in range(size)]
  def root(self,x):
    while self.table[x]>=0:
      x=self.table[x]
    return x
  def unite(self,x,y):
    s1=self.root(x)
    s2=self.root(y)
    if s1!=s2:
      if self.table[s1]!=self.table[s2]:
        if self.table[s1]<self.table[s2]:
          self.table[s2]=s1
        else:
          self.table[s1]=s2
      else:
        self.table[s1]-=1
        self.table[s2]=s1
    return
  def same(self,x,y):
    return self.root(x)==self.root(y)
I=lambda:list(map(int,input().split()))
n,m=I()
p=I()
u=UnionFind(n)
for _ in range(m):
  a,b=I()
  u.unite(a-1,b-1)
print(sum(u.same(i,j-1)for i,j in zip(range(n),p)))
Buggy python submission (verdict: Runtime Error):
n, c, *t = map(int, open(0).read().split())
right = [0]
left = [0]
sushi = tuple([(0, 0)]) + tuple(zip(t[::2], t[1::2])) + tuple([(c, 0)])
for i in range(1, n + 1):
    x, v = sushi[i]
    y = sushi[i - 1][0]
    cost = right[-1] + v - (x - y)
    right.append(cost)
    x, v = sushi[n + 1 - i]
    y = sushi[n + 2 - i][0]
    cost = left[-1] + v - (y - x)
    left.append(cost)
ans = max(*right, *left)
right_max = right[:]
left_max = left[:]
for i in range(1, n + 1):
    right_max[i] = max(right_max[i], right_max[i - 1])
    left_max[i] = max(left_max[i], left_max[i - 1])
for i in range(1, n + 1):
    ans = max(ans, \
            right[i] - sushi[i][0] + left_max[n - i], \
            left[i] - c + sushi[n + 1 - i][0] + right_max[n - i])
print(ans)

Fixed submission:
n, c, *t = map(int, open(0).read().split())
right = [0]
left = [0]
sushi = tuple([(0, 0)]) + tuple(zip(t[::2], t[1::2])) + tuple([(c, 0)])
for i in range(1, n + 1):
    x, v = sushi[i]
    y = sushi[i - 1][0]
    cost = right[-1] + v - (x - y)
    right.append(cost)
    x, v = sushi[n + 1 - i]
    y = sushi[n + 2 - i][0]
    cost = left[-1] + v - (y - x)
    left.append(cost)
ans = max(right + left)
right_max = right[:]
left_max = left[:]
for i in range(1, n + 1):
    right_max[i] = max(right_max[i], right_max[i - 1])
    left_max[i] = max(left_max[i], left_max[i - 1])
for i in range(1, n + 1):
    ans = max(ans, \
            right[i] - sushi[i][0] + left_max[n - i], \
            left[i] - c + sushi[n + 1 - i][0] + right_max[n - i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m,x,*a=map(int,open(0).read().split());print(min(c:=sorted(a).index(x),m-c))

Fixed submission:
n, m, x = map(int, input().split())
l = [0 for _ in range(n + 1)]
a = list(map(int, input().split()))
for i in range(m):
  l[a[i]] = 1
print(min(l[:x].count(1), l[x:].count(1)))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split());*r,=range(a,b+1);print(*sorted({*r[:k]+r[-k:]}))

Fixed submission:
a,b,k=map(int,input().split());r=range(a,b+1);print(*sorted(set(r[:k])|set(r[-k:])),sep='\n')

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split());*r,=range(a,b+1);print(*sorted({*r[:k]+r[-k:]}))

Fixed submission:
a,b,k=map(int,input().split());r=range(a,b+1);print(*sorted(set(r[:k])|set(r[-k:])),sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split());print(*[i for i in range(a,b+1)if(i>=a+k)*b-k<i])

Fixed submission:
a,b,k=map(int,input().split());r=range(a,b+1);print(*sorted(set(r[:k])|set(r[-k:])),sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int, input().split());print(*[i for i in range(a,b+1)if(i>=a+k)*b-k<i])

Fixed submission:
a,b,k=map(int,input().split());r=range(a,b+1);print(*sorted(set(r[:k])|set(r[-k:])),sep='\n')

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split());r=range(a,b+1);print(*sorted({*(r[:k]+r[-k:])}))

Fixed submission:
a,b,k=map(int,input().split());r=range(a,b+1);print(*sorted(set(r[:k])|set(r[-k:])),sep='\n')

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split());r=range(a,b+1);print(*sorted({*r[:k]+r[-k:]}))

Fixed submission:
a,b,k=map(int,input().split());r=range(a,b+1);print(*sorted(set(r[:k])|set(r[-k:])),sep='\n')

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split());*r,=range(a,b+1)
for t in sorted(set(r[:k]+r[-k:])):print(t)

Fixed submission:
a,b,k=map(int,input().split());r=range(a,b+1);print(*sorted(set(r[:k])|set(r[-k:])),sep='\n')

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split());*r,=range(a,b+1);print(*sorted(set(r[:k]+r[-k:])),sep='\n')

Fixed submission:
a,b,k=map(int,input().split());r=range(a,b+1);print(*sorted(set(r[:k])|set(r[-k:])),sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
if n<4:
  print(2,5,63)
  exit()
a,b=[],[]
i=j=k=0
while i<n:
  if not b or a and a[-1]>b[-1]:
    b+=3*-~k,
    k+=1
    i+=1
  else:
    t=2*-~j
    if t%3:
      a+=t,
      i+=1
    j+=1
c=sum(a+b)
if c%6:
  if c%2:
    b[-1]+=3
    c+=3
  while c%6:
    a[-1]+=2
    c+=2
    if a[-1]%3<1:
      a[-1]+=2
      c+=2
print(*a+b)

Fixed submission:
n=int(input())
if n<4:
  print(2,5,63)
  exit()
a,b=[],[]
i=j=k=0
while i<n:
  if not b or a and a[-1]>b[-1]:
    b+=3*-~k,
    k+=1
    i+=1
  else:
    t=2*-~j
    if t%3:
      a+=t,
      i+=1
    j+=1
c=sum(a+b)
if c%6:
  if c%2:
    b[-1]+=3
    c+=3
  while c%6:
    a[-1]+=2
    c+=2
    if a[-1]%3<1and a[-1]==b[-1]:
      a[-1]+=2
      c+=2
print(*a+b)
Buggy python submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
a,b=a[:n],a[n:]
for a,b in zip(a,b):
    if a==b:continue
    if b>a:
        print(-1)
        exit()
    if a-b<b:
        print(-1)
        exit()
1/0

Fixed submission:
from scipy.sparse.csgraph import floyd_warshall
n,*a=map(int,open(0).read().split())
a,b=a[:n],a[n:]
for x,y in zip(a,b):
    if x==y:continue
    if y>x:
        print(-1)
        exit()
    if x-y<=y:
        print(-1)
        exit()
M=max(a)
d=[]
for k in range(M-1,-1,-1):
    s=set(a)
    e=[[0]*(M+1)for _ in range(M+1)]
    for i in range(M+1):e[i][i]=1
    for i in d+list(range(k,0,-1)):
        t=s.copy()
        for x in s:
            e[x][x%i]=1
            t|={x%i}
        s=t
    c=floyd_warshall(e)
    for x,y in zip(a,b):
        if c[x,y]==float('inf'):
            d+=k+1,
            break
print(sum(2**k for k in d))
Buggy python submission (verdict: Runtime Error):
_,a=open(0)
a=[0]+list(map(int,a.split()))+[0]
A=abs
c=sum(A(j-i)for i,j in zip(a,a[1:]));for i,j,k in zip(a,a[1:],a[2:]):print(c-A(j-i)-A(k-j)+A(k-i))

Fixed submission:
n,*a=map(int,open(0).read().split())
a=[0]+a+[0]
c=sum(abs(j-i)for i,j in zip(a,a[1:]))
for i,j,k in zip(a,a[1:],a[2:]):print(c-abs(j-i)-abs(k-j)+abs(k-i))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(100,100)
for i in range(50):
    for j in range(100):
        if a-1and (i+j)%2:
            print('.',end='')
            a-=1
        else:
            print('#',end='')
    print()
print('.'*100)
for i in range(49):
    for j in range(100):
        if b-1and (i+j)%2:
            print('#',end='')
            b-=1
        else:
            print('.',end='')
    print()
a,b=map(int,input().split())
print(100,100)
for i in range(50):
    for j in range(100):
        if a-1and (i+j)%2:
            print('.',end='')
            a-=1
        else:
            print('#',end='')
    print()
print('.'*100)
for i in range(49):
    for j in range(100):
        if b-1and (i+j)%2:
            print('#',end='')
            b-=1
        else:
            print('.',end='')
    print()
a,b=map(int,input().split())
print(100,100)
for i in range(50):
    for j in range(100):
        if a-1and (i+j)%2:
            print('.',end='')
            a-=1
        else:
            print('#',end='')
    print()
print('.'*100)
for i in range(49):
    for j in range(100):
        if b-1and (i+j)%2:
            print('#',end='')
            b-=1
        else:
            print('.',end='')
    print()
a,b=map(int,input().split())
print(100,100)
for i in range(50):
    for j in range(100):
        if a-1and (i+j)%2:
            print('.',end='')
            a-=1
        else:
            print('#',end='')
    print()
print('.'*100)
for i in range(49):
    for j in range(100):
        if b-1and (i+j)%2:
            print('#',end='')
            b-=1
        else:
            print('.',end='')
    print()

Fixed submission:
a,b=map(int,input().split())
print(100,100)
for i in range(50):
    for j in range(100):
        if a-1and i%2and j%2:
            print('.',end='')
            a-=1
        else:
            print('#',end='')
    print()
for i in range(50):
    for j in range(100):
        if b-1and i%2and j%2:
            print('#',end='')
            b-=1
        else:
            print('.',end='')
    print()
Buggy python submission (verdict: Runtime Error):
n,s=open(0).read().split();n=int(n);print(max(0,*[s[:n].count(i)-s[n:].count(i)for i in s[:n]]))

Fixed submission:
I=lambda:[input()for _ in[0]*int(input())];s=I();t=I();print(max([0]+[s.count(i)-t.count(i)for i in set(s)]))

Buggy python submission (verdict: Runtime Error):
I=lambda:[input()for _ in[0]*int(input())].count;s=I();t=I();print(max([0]+[s(i)-t(i)for i in set(s)]))

Fixed submission:
I=lambda:[input()for _ in[0]*int(input())];s=I();t=I();print(max([0]+[s.count(i)-t.count(i)for i in set(s)]))
Buggy python submission (verdict: Runtime Error):
print open(0).read(11)[::5]

Fixed submission:
print(''.join(input()[i]for i in range(3)))
Buggy python submission (verdict: Runtime Error):
a,b=map(int-2,input().split());print(abs(a*b))

Fixed submission:
a,b=map(int,input().split());print(abs((a-2)*(b-2)))

Buggy python submission (verdict: Runtime Error):
print(abs((int(input())-2)*(int(input())-2)))

Fixed submission:
a,b=map(int,input().split());print(abs((a-2)*(b-2)))
Buggy python submission (verdict: Runtime Error):
n = int(input)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(n):
  if a[i] > b[i]:
    print('No')
    sys.exit(0)
print('Yes')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
d = 0
for i in range(n):
  if b[i] > a[i]:
    c += (b[i] - a[i]) // 2
  else:
    d += a[i] - b[i]
print(['Yes', 'No'][c < d])
Buggy python submission (verdict: Runtime Error):
a,b,c,x=[int(input())+1for _ in[0]*4];print(len(0for s in range(a)for t in range(b)for r in range(c)if x-1==(10*s+2*t+r)*50))

Fixed submission:
a,b,c,x=[int(input())+1for _ in[0]*4];print(sum(x-1==(10*s+2*t+r)*50for s in range(a)for t in range(b)for r in range(c)))
Buggy python submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split());print(max(sum(a[:i+1]+a[n+i:]for i in range(n))))

Fixed submission:
n,*a=map(int,open(0).read().split());print(max(sum(a[:i+1]+a[n+i:])for i in range(n)))
Buggy python submission (verdict: Runtime Error):
print('OEdvde n'['0'in s:=input()or'4'in s::2])

Fixed submission:
a,b=map(int,input().split())
print(['Even','Odd'][a*b%2>0])

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
print(['Even','Odd'][a*b%2>0])

Fixed submission:
a,b=map(int,input().split())
print(['Even','Odd'][a*b%2>0])
Buggy python submission (verdict: Runtime Error):
print(48-int(input))

Fixed submission:
print(48-int(input()))
Buggy python submission (verdict: Runtime Error):
print(len(eval('//'.join(input().split()[::-1])))-2)

Fixed submission:
x,y=map(int,input().split())
c=0
while x<=y:
  c+=1
  x*=2
print(c)
Buggy python submission (verdict: Runtime Error):
s=input();n=len(s);print(min(n*(s[i-1]==s[i])or max(i,n-i)for i in range(1,n)))

Fixed submission:
s=input();n=len(s);print(min([max(i,n-i)for i in range(1,n)if s[i-1]!=s[i]]or[n]))

Buggy python submission (verdict: Runtime Error):
s=input();n=len(s);print(min(n*(s[i-1]==s[i])or max(i,n-i)for i in range(1,n)))

Fixed submission:
s=input();n=len(s);print(min([max(i,n-i)for i in range(1,n)if s[i-1]!=s[i]]or[n]))

Buggy python submission (verdict: Runtime Error):
s=input();n=len(s);print(min(max(i,n-i*(s[i-1]!=s[i]))for i in range(1,n)))

Fixed submission:
s=input();n=len(s);print(min([max(i,n-i)for i in range(1,n)if s[i-1]!=s[i]]or[n]))

Buggy python submission (verdict: Runtime Error):
s=input();n=len(s);print(min(max(i,n-i*(s[i-1]!=s[i]))for i in range(1,n)))

Fixed submission:
s=input();n=len(s);print(min([max(i,n-i)for i in range(1,n)if s[i-1]!=s[i]]or[n]))
Buggy python submission (verdict: Runtime Error):
print(eval(input()+'%9'))

Fixed submission:
s=list(input())
print(int(s[0])+int(s[1])+int(s[2]))
Buggy python submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
ans=[]
if sum(t for t in a if t>0)>sum(t for t in a if t<0):
    i=0
    while a[i]<0:i+=1
    for j in range(n):
        if a[j]>0and i!=j:
            a[i]+=a[j]
            ans+=[(j+1,i+1)]
    for j in range(n):
        if a[j]<0:
            a[j]+=a[i]
            ans+=[(i+1,j+1)]
    for i in range(1,n):
        ans+=[(i,i+1)]
else:
    i=0
    while a[i]>0:i+=1
    for j in range(n):
        if a[j]<0and i!=j:
            a[i]+=a[j]
            ans+=[(j+1,i+1)]
    for j in range(n):
        if a[j]>0:
            a[j]+=a[i]
            ans+=[(i+1,j+1)]
    for i in range(n,1,-1):
        ans+=[(i,i-1)]
print(len(ans))
for t in ans:print(*t)

Fixed submission:
n,*a=map(int,open(0).read().split())
ans=[]
if sum(t for t in a if t>0)>sum(-t for t in a if t<0):
    i=0
    while a[i]<0:i+=1
    for j in range(n):
        if a[j]>0and i!=j:
            a[i]+=a[j]
            ans+=[(j+1,i+1)]
    for j in range(n):
        if a[j]<0:
            a[j]+=a[i]
            ans+=[(i+1,j+1)]
    for i in range(1,n):
        ans+=[(i,i+1)]
else:
    i=0
    while a[i]>0:i+=1
    for j in range(n):
        if a[j]<0and i!=j:
            a[i]+=a[j]
            ans+=[(j+1,i+1)]
    for j in range(n):
        if a[j]>0:
            a[j]+=a[i]
            ans+=[(i+1,j+1)]
    for i in range(n,1,-1):
        ans+=[(i,i-1)]
print(len(ans))
for t in ans:print(*t)
Buggy python submission (verdict: Runtime Error):
I=input;n=int(I());print(max(sum(p[bin(i&f).count('1')]for f,p in zip([int(I()[::2],2)for _ in[0]*n],[list(map(int,I().split()))for _ in[0]*n]))for i in range(1,1024)))

Fixed submission:
I=input;n=int(I());f=[int(I()[::2],2)for _ in[0]*n];p=[list(map(int,I().split()))for _ in[0]*n];print(max(sum(q[bin(i&g).count('1')]for g,q in zip(f,p))for i in range(1,1024)))
Buggy python submission (verdict: Runtime Error):
import re;print(['NO','YES'][re.match('A?KIHA?BA?RA?$',input())])

Fixed submission:
import re;print(['NO','YES'][re.match('A?KIHA?BA?RA?$',input())!=None])