Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
x,k,d=map(int,input().split())

x=abs(x)

a=x//d

if a>=k:
    ans=x-k*d

elif (k-a)%2==0:
    ans=x-d*m

else:
    ans=x-d*m-d

print(abs(ans)

Fixed submission:
import sys
x,k,d=map(int,input().split())

x=abs(x)

a=x//d

if a>=k:
    ans=x-k*d

elif (k-a)%2==0:
    ans=x-d*a

else:
    ans=x-d*a-d

print(abs(ans))

Buggy python submission (verdict: Runtime Error):
import sys
x,k,d=map(int,input().split())

x=abs(x)

if k*d<=x:
    print(x-k*d)
    sys.exit()

if k>=x:

    
else:
    print(x%d)

Fixed submission:
import sys
x,k,d=map(int,input().split())

x=abs(x)

a=x//d

if a>=k:
    ans=x-k*d

elif (k-a)%2==0:
    ans=x-d*a

else:
    ans=x-d*a-d

print(abs(ans))

Buggy python submission (verdict: Time Limit Exceeded):
x,k,d=map(int,input().split())

x=abs(x)

m=[]

for i in range(1,k+1):
    a=x-(d*i)
    m.append(abs(a))

print(min(m))

Fixed submission:
import sys
x,k,d=map(int,input().split())

x=abs(x)

a=x//d

if a>=k:
    ans=x-k*d

elif (k-a)%2==0:
    ans=x-d*a

else:
    ans=x-d*a-d

print(abs(ans))

Buggy python submission (verdict: Time Limit Exceeded):
x,k,d=map(int,input().split())

m=[]
n=[]

for i in range(1,k+1):
    a=d*i
    b=-d*i
    m.append(a)
    n.append(b)

mx=[]
for i in m:
    m1=x+i
    m2=abs(m1)
    mx.append(m2)

nx=[]
for i in n:
    n1=-1*(x+i)
    n2=abs(n1)
    nx.append(n2)

mxmin=min(mx)
nxmin=min(nx)

ans=min(mxmin,nxmin)

print(ans)

Fixed submission:
import sys
x,k,d=map(int,input().split())

x=abs(x)

a=x//d

if a>=k:
    ans=x-k*d

elif (k-a)%2==0:
    ans=x-d*a

else:
    ans=x-d*a-d

print(abs(ans))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=map(int,input().split())

p=list(p)
p.sort()

a=0

for i in range(3):
    a+=p[i]

print(a)

Fixed submission:
n,k=map(int,input().split())
p=map(int,input().split())

p=list(p)
p.sort()

a=0

for i in range(k):
    a+=p[i]

print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

anum=[]
asum=sum(a) #当初の数列Aの要素の和

for i in a:
  acnt=a.count(i)
  anum.append([i,acnt])

d=dict(anum) #当初の数列Aの各整数の数のdictionary

for i in range(q):
  if bc[i][0] not in d.keys():
    print(asum)
  if bc[i][0] in d.keys():
    x=(bc[i][1]-bc[i][0])*d[bc[i][0]]
    print(asum+x)
    asum+=x
    if bc[i][1] in d.keys():
      d[bc[i][1]]=d[bc[i][1]]+d[bc[i][0]]
      d[bc[i][0]]=0
    else:
      d[bc[i][1]]=d[bc[i][0]]
      d[bc[i][0]]=0

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

asum=sum(a) #当初の数列Aの要素の和
d={}

for i in a:
  if i in d:
    d[i]+=1
  else:
    d[i]=1

for b,c in bc:
  if b in d:
    asum+=d[b]*(c-b)
    if c in d:
      d[c]+=d[b]
    else:
      d[c]=d[b]
    d[b]=0
  print(asum)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

for j in range(q):
  for n, i in enumerate(a):
    if i==bc[j][0]:
      a[n]=bc[j][1]
  print(sum(a))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

asum=sum(a) #当初の数列Aの要素の和
d={}

for i in a:
  if i in d:
    d[i]+=1
  else:
    d[i]=1

for b,c in bc:
  if b in d:
    asum+=d[b]*(c-b)
    if c in d:
      d[c]+=d[b]
    else:
      d[c]=d[b]
    d[b]=0
  print(asum)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

for j in range(q):
  for i in range(n):
    if a[i]==bc[j][0]:
      a[i]=bc[j][1]
  print(sum(a))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

asum=sum(a) #当初の数列Aの要素の和
d={}

for i in a:
  if i in d:
    d[i]+=1
  else:
    d[i]=1

for b,c in bc:
  if b in d:
    asum+=d[b]*(c-b)
    if c in d:
      d[c]+=d[b]
    else:
      d[c]=d[b]
    d[b]=0
  print(asum)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))

c=1

for i in range(n):
    c*=a[i]

if c>10**18:
    print('-1')
else:
    print(c)

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

if 0 in a:
    print('0')
    sys.exit()

c=1

for i in range(n):
    c*=a[i]
    if c>10**18:
        print('-1')
        sys.exit()
    else:
        continue

print(c)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import decimal

a,b,n=map(int,input().split())

ans=[]

for i in range(1,n+1):
  x=decimal.Decimal(a*i/b)
  y=decimal.Decimal(i/b)
  c=math.floor(x)-a*math.floor(y)
  ans.append(c)

print(max(ans))

Fixed submission:
import math
import decimal

a,b,n=map(int,input().split())

if b<=n:
  x=decimal.Decimal(a*(b-1)/b)
  c=math.floor(x)
  print(c)

else:
  x=decimal.Decimal(a*n/b)
  c=math.floor(x)
  print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[input() for i in range(n)]

a=[]
c=0

for i in s:
    if i not in a:
        a.append(i)
        c+=1

print(c)

Fixed submission:
n=int(input())
s=[input() for i in range(n)]

s=set(s)

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

ans=[]
for i in range(1,n+1):
    b=str(a.count(i))
    ans.append(b)

print('\n'.join(ans))

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

b=[0]*n

for i in a:
    b[i-1]+=1

for j in b:
    print(j)
Buggy python submission (verdict: Runtime Error):
import collections

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

c=collections.Counter(a)

print(c)

for i in c.values():
  s+=i*(i-1)//2 #ボールを抜かない場合に2つのボールを選ぶ方法の数

for j in a:
  f=c[j]
  print(s-(f-1)) #下記メモ参照

'''
複数個のボールから1個のボールが抜かれる場合、i*(i-1)//2が(i-1)*(i-2)//2となる。

i*(i-1)//2-(i-1)*(i-2)//2
=i-1

よって、2つのボールを選ぶ方法が(i-1)だけ減る。
'''


Fixed submission:
import collections

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

c=collections.Counter(a)
s=0

for i in c.values():
  s+=i*(i-1)//2 #ボールを抜かない場合に2つのボールを選ぶ方法の数

for j in a:
  f=c[j]
  print(s-(f-1)) #下記メモ参照

'''
複数個のボールから1個のボールが抜かれる場合、i*(i-1)//2が(i-1)*(i-2)//2となる。

i*(i-1)//2-(i-1)*(i-2)//2
=i-1

よって、2つのボールを選ぶ方法が(i-1)だけ減る。
'''
Buggy python submission (verdict: Runtime Error):
s=input()
q=int(input())
a=[list(map(str,input().split())) for i in range(q)]

ans=[]
ans.append(s)

for i in range(q):
  if len(a[i])==1:
    ans.insert(0,ans[-1])
    ans.append(ans[1])
    print(ans)
    ans.pop(1)
    ans.pop(-2)

  else:
    if a[i][1]=='1':
      ans.insert(0,a[i][2])
    else:
      ans.append(a[i][2])

print(''.join(ans))

Fixed submission:
from collections import deque

s=deque(input())
q=int(input())
qq=[list(input().split()) for i in range(q)]

rl=1
fleft=deque()
fright=deque()

for i in qq:
  if i[0]=='1':
    rl*=-1
  else:
    if i[1]=='1':
      if rl==1:
        fleft.appendleft(i[2])
      else:
        fright.append(i[2])
    else:
      if rl==1:
        fright.append(i[2])
      else:
        fleft.appendleft(i[2])

fleft.reverse()

s.extendleft(fleft)
s.extend(fright)

if rl==-1:
  s.reverse()

print(''.join(s))
Buggy python submission (verdict: Runtime Error):
n=int(input())
x=list(map(int,input().split()))

if n==1:
    print('0')

a=sum(x)/len(x)
d=[]
for i in range(min(x),max(x)):
    c=0
    for j in x:
        c+=(i-j)**2
    d.append(c)

print(min(d))

Fixed submission:
import sys
n=int(input())
x=list(map(int,input().split()))

if n==1:
    print('0')
    sys.exit()

if x.count(x[0])==n:
    print('0')
    sys.exit()

a=sum(x)/len(x)
d=[]
for i in range(min(x),max(x)):
    c=0
    for j in x:
        c+=(i-j)**2
    d.append(c)

print(min(d))

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

a=sum(x)/len(x)
d=[]
for i in range(min(x),max(x)):
    c=0
    for j in x:
        c+=(i-j)**2
    d.append(c)

print(min(d))

Fixed submission:
import sys
n=int(input())
x=list(map(int,input().split()))

if n==1:
    print('0')
    sys.exit()

if x.count(x[0])==n:
    print('0')
    sys.exit()

a=sum(x)/len(x)
d=[]
for i in range(min(x),max(x)):
    c=0
    for j in x:
        c+=(i-j)**2
    d.append(c)

print(min(d))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n=int(input())
s=[input() for i in range(n)]

c=collections.Counter(s)

m=[]

for v in c.values():
    m.append(v)

keys=[k for k, v in c.items() if v==max(m)]

keys.sort()

print('\n'.join(keys))

Fixed submission:
n= int(input())
l={}
a=0

for i in range(n):
  s=input()
  if s in l:
    l[s]+=1
  else:
    l[s]=1
  if a<l[s]:
    a=l[s]
  
ans=[]
for i in l.keys():
  if l[i]==a:
    ans.append(i)

ans.sort()
for j in ans:
  print(j)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n,k=map(int,input().split())
h=list(map(int,input().split()))

h.sort(reverse=True)

if len(h)<=k:
    print('0')
    sys.exit()
else:
    for i in range(k):
        del h[0]

a=sum(h)

print(a)

Fixed submission:
import sys
n,k=map(int,input().split())
h=list(map(int,input().split()))

h.sort(reverse=True)

if len(h)<=k:
    print('0')
    sys.exit()
else:
    del h[0:k]

a=sum(h)

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

l=[0]*n
w=0
c=0
ac=[]

for i in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if s=='WA':
    l[p-1]+=1
  else:
    if p not in ac:
      c+=1
      w+=l[p-1]
      ac.append(p)

print(c,w)

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

l=[0]*n
w=0
c=0
ac=set()

for i in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if s=='WA':
    l[p-1]+=1
  else:
    if p not in ac:
      c+=1
      w+=l[p-1]
      ac.add(p)

print(c,w)
Buggy python submission (verdict: Runtime Error):
import sympy
n=int(input())
a=sympy.divisors(n)
b=sorted(a,reverse=True)

c=[]
for i in range(len(a)//2):
    d=a[i]-1+b[i]-1
    c.append(d)

print(min(c))

Fixed submission:
n=int(input())

def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

a=divisor(n)
a.sort()

b=sorted(a,reverse=True)

c=[]
for i in range(len(a)//2+1):
    d=a[i]-1+b[i]-1
    c.append(d)

print(min(c))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=input()
a=list(a)

c=0


for i in range(n-1):
    if a[i]!=a[i+1]:
        c+=1

if a[-1]!=a[-2]:
    c+=1

if c==0:
    c+=1
    
print(c)

Fixed submission:
n=int(input())
s=input()
s=list(s)

for i in reversed(range(1,n)):
    if s[i-1]==s[i]:
        s.pop(i)

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

ans=[]

for i in range(n):
  for j in range(n):
    if i+1==a[j]:
      ans.append(j+1)

ans2=[str(i) for i in ans]

print(' '.join(ans2))

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

num=[i for i in range(1,n+1)]

order=dict(zip(num,a))

order2=sorted(order.items(),key=lambda x:x[1])

ans=[]

for i in range(n):
  ans.append(order2[i][0])

print(' '.join([str(n) for n in ans]))
Buggy python submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
a=[int(input()) for i in range(q)]

m=[0]*n

for i in range(q):
  m[a[i]-1]+=1

for j in range(n):
  m[j]=k+m[j]-q

cnt=0
for h in range(n):
  if m[h]>0:
    cnt+=h

ans=['No']*n

ans[cnt]='Yes'

print('\n'.join(ans))

Fixed submission:
n,k,q=map(int,input().split())
a=[int(input()) for i in range(q)]

m=[0]*n

for i in range(q):
  m[a[i]-1]+=1

for j in range(n):
  m[j]=k+m[j]-q

ans=['No']*n

for h in range(n):
  if m[h]>0:
    ans[h]='Yes'

print('\n'.join(ans))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())

ans=[]

if b==1:
  print('0')

else:
  for i in range(20):
    if b<=a+(a-1)*i:
      ans.append(i+1)

print(min(ans))

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

ans=[]

if b==1:
  print('0')

else:
  for i in range(20):
    if b<=a+(a-1)*i:
      ans.append(i+1)
  print(min(ans))
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))

step=[]

for i in range(n-1):
  if h[i]<h[i+1]:
    step.append(0)
  else:
    step.append(1)

a=[i for i, x in enumerate(step) if x==0]

ans=[]

for i in range(len(a)):
  if i==0:
    d=a[0]
    ans.append(d)
  else:
    b=a[i]-a[i-1]
    ans.append(b)

ans.append((n-1)-a[-1])

print(max(ans)-1)

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

step=[]

for i in range(n-1):
  if h[i]<h[i+1]:
    step.append(0)
  else:
    step.append(1)

a=[i for i, x in enumerate(step) if x==0]

ans=[]

for i in range(len(a)):
  if i==0:
    d=a[0]
    ans.append(d)
  else:
    b=a[i]-a[i-1]
    ans.append(b)
    

if not a:
  print(n-1)
else:
  ans.append((n-1)-a[-1])
  print(max(ans)-1)
Buggy python submission (verdict: Time Limit Exceeded):
import copy

n=int(input())
s=[input() for i in range(n)]

ssort=[]


for i in range(n):
  a=s[i]
  b=sorted(a)
  ssort.append(b)

tsort=copy.copy(ssort)

cnt=0

for i in tsort:
  for j in ssort:
    if i==j:
      cnt+=1

print((cnt-n)//2)

Fixed submission:
import collections
n=int(input())
s=[]
a=0

for i in range(n):
    b=list(input())
    b.sort()
    b=str(b)
    s.append(b)

c=collections.Counter(s)

for i in c.values():
    if i>1:
        a+=i*(i-1)//2

print(a)

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

ssort=[]

for i in range(n):
  a=s[i]
  b=sorted(a)
  ssort.append(b)

cnt=0
for j in range(0,n):
  for k in range(0,n):
    if j!=k:
      if ssort[j]==ssort[k]:
        cnt+=1

print(cnt//2)

Fixed submission:
import collections
n=int(input())
s=[]
a=0

for i in range(n):
    b=list(input())
    b.sort()
    b=str(b)
    s.append(b)

c=collections.Counter(s)

for i in c.values():
    if i>1:
        a+=i*(i-1)//2

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

a=[]

for i in range(1,n):
    if h[i-1]>h[i]:
        a.append(h[i-1])
        h[i-1]=h[i-1]-1        
        if h[i-1]-1>h[i]:
            print('No')
            sys.exit()
    for j in a:
        if h[i]<=(j-2):
            print('No')
            sys.exit()

print('Yes')

Fixed submission:
import sys
n=int(input())
h=list(map(int,input().split()))

for i in range(n-1):
    if h[i+1]>h[i]:
        h[i+1]-=1
    elif h[i+1]<h[i]:
        print('No')
        sys.exit()

print('Yes')
Buggy python submission (verdict: Runtime Error):
r=int(input())
print(3r**2)

Fixed submission:
r=int(input())
print(3*(r**2))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
b=a[:]
p=max(a)
b.remove(p)
q=max(b)

c=[i for i, x in enumerate(a) if x==p]

for i in range(n):
    if i not in c:
        print(p)
    else:
        print(q)

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]

l1=sorted(a)[-1]
l2=sorted(a)[-2]

for i in a:
  if i==l1:
    print(l2)
  if i!=l1:
    print(l1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
b=a[:]

for i in range(n):
    b.remove(a[i])
    print(max(b))
    b.append(a[i])

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]

l1=sorted(a)[-1]
l2=sorted(a)[-2]

for i in a:
  if i==l1:
    print(l2)
  if i!=l1:
    print(l1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
  ainput=int(input())
  a.append(ainput)

anext=a[:]
for i in range(n):
  anext.remove(anext[i])
  b=max(anext)
  print(b)
  anext.insert(i,a[i])

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]

l1=sorted(a)[-1]
l2=sorted(a)[-2]

for i in a:
  if i==l1:
    print(l2)
  if i!=l1:
    print(l1)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d=map(int,input().split())

cnt=0

for i in range(a,b+1):
  if i%c!=0 and i%d!=0:
    cnt+=1

print(cnt)


Fixed submission:
import math
a,b,c,d=map(int,input().split())

cyaku=b//c
dyaku=b//d


cds=b//((c*d)//(math.gcd(c,d)))

x=b-(cyaku+dyaku-cds)

cyaku2=(a-1)//c
dyaku2=(a-1)//d

cds2=(a-1)//((c*d)//(math.gcd(c,d)))

y=(a-1)-(cyaku2+dyaku2-cds2)

print(x-y)

Buggy python submission (verdict: Time Limit Exceeded):
import math

a,b,c,d=map(int,input().split())

cnt=0

for i in range(a,b+1):
  if i%c==0:
    cnt+=1
  if i%d==0:
    cnt+=1

def lcm(x,y):
  return (x*y)//math.gcd(x,y)

lcm_cd=lcm(c,d)

for i in range(a,b+1):
  if i%lcm_cd==0:
    cnt-=1


print(b-a+1-cnt)

Fixed submission:
import math
a,b,c,d=map(int,input().split())

cyaku=b//c
dyaku=b//d


cds=b//((c*d)//(math.gcd(c,d)))

x=b-(cyaku+dyaku-cds)

cyaku2=(a-1)//c
dyaku2=(a-1)//d

cds2=(a-1)//((c*d)//(math.gcd(c,d)))

y=(a-1)-(cyaku2+dyaku2-cds2)

print(x-y)
Buggy python submission (verdict: Runtime Error):
x,a=map(int,input().split())
if x<a:
  print('0')
  else:
    print('10')

Fixed submission:
x,a=map(int,input().split())
if x<a:
  print('0')
else:
  print('10')
Buggy python submission (verdict: Time Limit Exceeded):
import math
import functools
import copy

N=int(input())
a=list(map(int,input().split()))
b=copy.copy(a)
ans=list()

for i in range(N):
  del b[i]
  gcd=functools.reduce(math.gcd,b)
  ans.append(gcd)
  b.insert(i,a[i])

print(max(ans))

Fixed submission:
import math
from itertools import accumulate

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

fromleft = list(accumulate(a, math.gcd))
fromright = list(accumulate(a[::-1], math.gcd))[::-1]

gcd = []

gcd.append(fromright[1])
for i in range(1, n-1):
    gcd.append(math.gcd(fromleft[i-1], fromright[i+1]))
gcd.append(fromleft[n-2])

print(max(gcd))

Buggy python submission (verdict: Time Limit Exceeded):
import math
import functools
import copy

N=int(input())
a=list(map(int,input().split()))
b=copy.copy(a)
ans=list()

for i in range(len(a)):
  del b[i]
  gcd=functools.reduce(math.gcd,b)
  ans.append(gcd)
  b.insert(i,a[i])

print(max(ans))

Fixed submission:
import math
from itertools import accumulate

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

fromleft = list(accumulate(a, math.gcd))
fromright = list(accumulate(a[::-1], math.gcd))[::-1]

gcd = []

gcd.append(fromright[1])
for i in range(1, n-1):
    gcd.append(math.gcd(fromleft[i-1], fromright[i+1]))
gcd.append(fromleft[n-2])

print(max(gcd))
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
M=max(a,b)
m=min(a,b)

n=0
n+=M
M-=1

n+=max(M,m)

print(n)

Fixed submission:
a,b=map(int,input().split())
M=max(a,b)
m=min(a,b)

n=0
n+=M
M-=1

n+=max(M,m)

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

l=[]
cnt=0

for i in s:
  if i=='A' or i=='C' or i=='G' or i=='T':
    cnt+=1
  else:
    if cnt!=0:
      l.append(cnt)
      cnt=0

print(max(l))

Fixed submission:
s=list(input())

l=[]
cnt=0

for i in s:
  if i=='A' or i=='C' or i=='G' or i=='T':
    cnt+=1
  else:
    if cnt!=0:
      l.append(cnt)
      cnt=0

l.append(cnt)
print(max(l))
Buggy python submission (verdict: Runtime Error):
import sys

s=input()
k=int(input())


s=list(s)

c=0
for i in range(k):
        if s[i]=='1':
                c+=1
if c==k:
        print('1')
        sys.exit()
                

for i in range(len(s)):
        if s[i]!='1':
                print(s[i])
                sys.exit()

Fixed submission:
import sys

s=input()
k=int(input())


s=list(s)

c=0
for i in range(len(s)):
        if s[i]=='1':
                c+=1
if c==len(s):
        print('1')
        sys.exit()

d=0
if len(s)>=k:
        for i in range(k):
                if s[i]=='1':
                        d+=1
if d==k:
        print('1')
        sys.exit()

for i in range(len(s)):
        if s[i]!='1':
                print(s[i])
                sys.exit()
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(str(n))
a=n%(sum(s))

if a==0:
  print('Yes')
else:
  print('No')

Fixed submission:
n=int(input())
s=list(str(n))
for i in range(len(s)):
  s[i]=int(s[i])
b=sum(s)
a=n%b

if a==0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(str(n))
a=n%(sum(s))

if a==0:
  print('Yes')
else:
  print('No')

Fixed submission:
n=int(input())
s=list(str(n))
for i in range(len(s)):
  s[i]=int(s[i])
b=sum(s)
a=n%b

if a==0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=sorted([int(i) for i in input().split()],reverse=True)
print(sum(a[0::2]-sum(a[1::2]))

Fixed submission:
N=int(input())
a=sorted([int(i) for i in input().split()],reverse=True)
print(sum(a[0::2])-sum(a[1::2]))
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())

if (a*b)%2==0:
    print("Even")

else:
    print("Odd")
 

Fixed submission:
a,b=map(int,input().split()) #1行で1スペースあけて入力

if (a*b)%2==0:
    print('Even')
else:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()

if (a*b)%2==0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a,b=map(int,input().split()) #1行で1スペースあけて入力

if (a*b)%2==0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())

x=(a+b)/2
if x%1==0:
    print(int(x))
else:
    print(int(x)+1)
  

Fixed submission:
a,b=map(int,input().split()) #入力を改行ではなくてスペース1マスあける

x=(a+b)/2
if x%1==0:
    print(int(x))
else:
    print(int(x)+1)
Buggy python submission (verdict: Runtime Error):
N=input()
a=int(N)
b=list(N)
sum=0

for i in b:
  sum+=i
 
if a%sum==0:
  print('Yes')
else:
  print('No')

Fixed submission:
N=input()
a=int(N)
b=list(N)
sum=0

for i in b:
  sum+=int(i)
 
if a%sum==0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
N=input()
a=int(N)
b=list(N)
sum=0
for i in N:
  sum+=i
 
if a%sum==0:
  print('Yes')
else:
  print('No')

Fixed submission:
N=input()
a=int(N)
b=list(N)
sum=0

for i in b:
  sum+=int(i)
 
if a%sum==0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
N=input()
a=int(N)
b=list(N)
sum=0
for i in N:
  sum+=i

if N%sum==0:
  print('Yes')
else:
  print('No')


Fixed submission:
N=input()
a=int(N)
b=list(N)
sum=0

for i in b:
  sum+=int(i)
 
if a%sum==0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N=int(input())

def liu(i):
    if i==2:
        return 3
    if i==3:
        return 4
    else:
        return liu(i-1)+liu(i-2)

print(liu(N))

Fixed submission:
N=int(input())
lst=[2,1]
for i in range(2,N+1):
    lst.append(lst[i-1]+lst[i-2])
print(lst[N])

Buggy python submission (verdict: Time Limit Exceeded):
def luka(i):
    if i==0:
        return 2
    if i==1:
        return 1
    return luka(i-1)+luka(i-2)

N=int(input())
print(luka(N))

Fixed submission:
N=int(input())
lst=[2,1]
for i in range(2,N+1):
    lst.append(lst[i-1]+lst[i-2])
print(lst[N])