Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()

sp = []
if s[0]=='1':
  sp.append(0)

count=0
for si in s:
  if count==0:
    flag = si
    count=1
  elif flag == si:
    count+=1
  else:        
    sp.append(count)
    flag = si
    count=1
if count>0:
  sp.append(count)
if s[-1]=='1' and flag=='1':
  sp.append(0)
  
ss=[]
for i in range(len(sp)-2*k+1):
  if i%2==0:    
    ss.append(sum(sp[i:i+2*k]))
  else:
    ss.append(sum(sp[i:i+2*k+1]))
print(max(ss))      

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

sp = []
if s[0]=='0':
  sp.append(0)

count=0
for si in s:
  if count==0:
    flag = si
    count=1
  elif flag == si:
    count+=1
  else:        
    sp.append(count)
    flag = si
    count=1
if count>0:
  sp.append(count)
if s[-1]=='0':
  sp.append(0)

ss=[0]
ss.append(sp[0])
count = 0
for spi in sp[1:]:
  ss.append(ss[-1]+spi)  

ans = 0
for left in range(0,len(ss),2):
  right = left+2*k+1
  if right >= len(ss): #!!
    right = len(ss)-1
  ans = max(ans,ss[right]-ss[left])    

print(ans)
Buggy python submission (verdict: Runtime Error):
a = [int(input()) for _ in range(5)]
k = int(input())
m = 0
for ai in a:
  for aj in a:    
    if m < abs(ai - aj):
      m = abs(ai - aj)
if m <= k:
  print('Yay!'')
else:
  print(':(')

Fixed submission:
a = [int(input()) for _ in range(5)]
k = int(input())
m = 0
for ai in a:
  for aj in a:    
    if m < abs(ai - aj):
      m = abs(ai - aj)
if m <= k:
  print('Yay!')
else:
  print(':(')
Buggy python submission (verdict: Runtime Error):
a = [int(input()) for _ in range(5)]
b = min([i%10 for i in a if i%10 != 0],0)
print(sum([((i + 9)//10 *10) for  i in a]) - (10-b) )

Fixed submission:
a = [int(input()) for _ in range(5)]
b = [i%10 for i in a if i%10 !=0]
if len(b)==0:
  b=0
else:
  b= 10 - min(b)
print(sum([((i + 9)//10 *10) for  i in a]) - b)

Buggy python submission (verdict: Runtime Error):
a = [int(input()) for _ in range(5)]
b = min([i%10 for i in a if i%10 != 0])
print(sum([((i + 9)//10 *10) for  i in a]) - (10-b) )

Fixed submission:
a = [int(input()) for _ in range(5)]
b = [i%10 for i in a if i%10 !=0]
if len(b)==0:
  b=0
else:
  b= 10 - min(b)
print(sum([((i + 9)//10 *10) for  i in a]) - b)
Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappop,heappush
x,y,z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A = sorted(A,reverse=True)
B = sorted(B,reverse=True)
C = sorted(C,reverse=True)

def solve(p,add=False):
  cnt = 0
  for i in range(x):
    for j in range(y):
      for k in range(z):
        sum_ = A[i] + B[j] + C[k]
        if sum_ < p:
          break
        cnt += 1
        if add:
          ans.append(sum_) 
        if cnt >= K:
          return True
  return False

l = 0 
r = 3 * 10**10
while l+1 < r: 
  p = (l+r)//2
  if solve(p): # p以上がk個以上存在していたら、条件を厳しく: pを増やす (つまり→) lを増やす
    l = p    
  else:
    r = p
    
ans = []
solve(p-1,True)
for a in sorted(ans,reverse=True):
  print(a)

Fixed submission:
x,y,z,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

AB = []
for xi in range(x):
  for yi in range(y):
    AB.append(A[xi]+B[yi])

AB = sorted(AB,reverse=True)
C = sorted(C,reverse=True)

i=0
j=0

ABC = []
for ab in AB[:k]:
  for c in C[:k]:
    ABC.append(ab+c)

ABC = sorted(ABC,reverse=True)
for abc in ABC[:k]:
  print(abc)

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

AB = []
for xi in range(x):
  for yi in range(y):
    AB.append(A[xi]+B[yi])

AB = sorted(AB,reverse=True)
C = sorted(C,reverse=True)

i=0
j=0

ABC = []
for ab in AB[:k]:
  for c in C[:k]:
    ABC.append(ab+c)

ABC = sorted(ABC,reverse=True)
for abc in ABC[:k]:
  print(abc)

Fixed submission:
x,y,z,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

AB = []
for xi in range(x):
  for yi in range(y):
    AB.append(A[xi]+B[yi])

AB = sorted(AB,reverse=True)
C = sorted(C,reverse=True)

i=0
j=0

ABC = []
for ab in AB[:k]:
  for c in C[:k]:
    ABC.append(ab+c)

ABC = sorted(ABC,reverse=True)
for abc in ABC[:k]:
  print(abc)
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split())) for _ in range(q)]

ac = [1 if s[i]=='A' and s[i+1]=='C' else 0 for i in range(n-1)]
    
for l,r in lr:
  print(sum(ac[l-1:r-1]))

Fixed submission:
n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split())) for _ in range(q)]

ac = [0]*(n+1)

for i in range(1,n+1):
  if s[i-1:i+2-1]=='AC':  
    ac[i]=ac[i-1] + 1
  else:
    ac[i]=ac[i-1]
    
for l,r in lr:
  print(ac[r-1]-ac[l-1])

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

ac = [1 if s[i:i+2]=='AC' else 0 for i in range(n-1)]
    
for l,r in lr:
  print(sum(ac[l-1:r-1]))

Fixed submission:
n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split())) for _ in range(q)]

ac = [0]*(n+1)

for i in range(1,n+1):
  if s[i-1:i+2-1]=='AC':  
    ac[i]=ac[i-1] + 1
  else:
    ac[i]=ac[i-1]
    
for l,r in lr:
  print(ac[r-1]-ac[l-1])

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

ac = [1 if s[i:i+2]=='AC' else 0 for i in range(n-1)]
    
for l,r in lr:
  print(sum(ac[l-1:r-1]))

Fixed submission:
n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split())) for _ in range(q)]

ac = [0]*(n+1)

for i in range(1,n+1):
  if s[i-1:i+2-1]=='AC':  
    ac[i]=ac[i-1] + 1
  else:
    ac[i]=ac[i-1]
    
for l,r in lr:
  print(ac[r-1]-ac[l-1])

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

ac = [0]*n

for i in range(n-1):
  if s[i:i+2]=='AC':  
    ac[i]=1
    
for l,r in lr:
  print(sum(ac[l-1:r-1]))

Fixed submission:
n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split())) for _ in range(q)]

ac = [0]*(n+1)

for i in range(1,n+1):
  if s[i-1:i+2-1]=='AC':  
    ac[i]=ac[i-1] + 1
  else:
    ac[i]=ac[i-1]
    
for l,r in lr:
  print(ac[r-1]-ac[l-1])
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
A = list(map(int,input().split()))

b = 1
c = 0
while b <= k:
  b *= 2
  c += 1

B = [0]*(c+1)
for a in A:
  for i in range(c):
    if a>>i & 1 :      
      B[i] += 1
    
x = 0
for i in range(c):
  if B[i] <= n/2:
    x += 1<<i
    
flag = 0    
for i in range(c):
  if k>>(4-i) == 0 and x>>(4-i)==1:
    x -= 1<<(4-i)
    break

ans = 0
for a in A:
  ans += x^a
  
print(ans)  

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

b = 1
c = 0
while b <= k:
  b *= 2
  c += 1

B = [0]*(c)
for a in A:
  for i in range(c):
    if a>>i & 1 :      
      B[i] += 1
      
x = 0
for b in range(c,-1,-1):
  if x + (1<<b) > k:
    continue
  if B[b] < (n+1)//2:
    x += 1<<b
    
ans = 0
for a in A:
  ans += x^a
print(ans)

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

b = 1
c = 0
while b <= k:
  b *= 2
  c += 1

B = [0]*c
for a in A:
  for i in range(c):
    if a>>i & 1 :      
      B[i] += 1
    
x = 0
for i in range(c):
  if B[i] <= n/2:
    x += 1<<i
    
flag = 0    
for i in range(c):
  if k>>(4-i) == 0 and x>>(4-i)==1:
    x -= 1<<(4-i)
    break

ans = 0
for a in A:
  ans += x^a
  
print(ans)  

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

b = 1
c = 0
while b <= k:
  b *= 2
  c += 1

B = [0]*(c)
for a in A:
  for i in range(c):
    if a>>i & 1 :      
      B[i] += 1
      
x = 0
for b in range(c,-1,-1):
  if x + (1<<b) > k:
    continue
  if B[b] < (n+1)//2:
    x += 1<<b
    
ans = 0
for a in A:
  ans += x^a
print(ans)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split())
a = sorted(a)
print(a[0]*a[1]/2)

Fixed submission:
a = list(map(int,input().split()))
a = sorted(a)
print(int(a[0]*a[1]/2))
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
F = []
for i in range(h):
  F.append(list(input()))
  
V = [[False]*w for _ in range(h)]

def dfs(y,x,c):      
  V[y][x] = True
  black = 0
  white = 0
  if c =='#':
    black+=1
  else:
    white+=1
  for dy,dx in [(-1,0),(0,1),(1,0),(0,-1)]:
    ny = y + dy
    nx = x + dx
    if 0<=ny<h and 0<=nx<w:      
      if F[ny][nx]!=c and V[ny][nx] == False:
        nc = '#'
        if c =='#':
          nc = '.'
        bn,wn = dfs(ny,nx,nc)
        black += bn
        white += wn  
  return black,white
        
ans = 0
for i in range(h):
  for j in range(w):
    if F[i][j] == '#':      
      black,white = dfs(i,j,'#')
      ans += black*white
      
print(ans)      

Fixed submission:
import sys
sys.setrecursionlimit(410000)

h,w = map(int,input().split())
F = []
for i in range(h):
  F.append(list(input()))
  
V = [[False]*w for _ in range(h)]

def dfs(y,x,c):      
  V[y][x] = True
  black = 0
  white = 0
  if c =='#':
    black+=1
  else:
    white+=1
  for dy,dx in [(-1,0),(0,1),(1,0),(0,-1)]:
    ny = y + dy
    nx = x + dx
    if 0<=ny<h and 0<=nx<w:      
      if F[ny][nx]!=c and V[ny][nx] == False:
        nc = '#'
        if c =='#':
          nc = '.'
        bn,wn = dfs(ny,nx,nc)
        black += bn
        white += wn  
  return black,white
        
ans = 0
for i in range(h):
  for j in range(w):
    if F[i][j] == '#':      
      black,white = dfs(i,j,'#')
      ans += black*white
      
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n,k = map(int,input().split())
  h = list(map(int,input().split()))
  dp= [0]*n

  for i in range(1,n):  
    dp[i] =min([dp[i-j] + abs(h[i] - h[i-j]) \
                for j in range(1,min(i+1,k+1))])       
  print(dp[-1])  

if __name__=='__main__':
  main()

Fixed submission:
# TLE
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp= [0]*n

for i in range(1,n):
  tmp = float('inf')
  for j in range(1,min(i+1,k+1)):    
    d = dp[i-j] + abs(h[i] - h[i-j])    
    tmp = min(tmp,d)  
  dp[i] = tmp
  
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp= [0]*n

for i in range(1,n):  
  dp[i] =min([dp[i-j] + abs(h[i] - h[i-j]) \
              for j in range(1,min(i+1,k+1))])       
print(dp[-1])  

Fixed submission:
# TLE
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp= [0]*n

for i in range(1,n):
  tmp = float('inf')
  for j in range(1,min(i+1,k+1)):    
    d = dp[i-j] + abs(h[i] - h[i-j])    
    tmp = min(tmp,d)  
  dp[i] = tmp
  
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp= [0]*n

for i in range(1,n):
  tmp = float('inf')
  for j in range(1,min(i+1,k+1)):    
    d = dp[i-j] + abs(h[i] - h[i-j])    
    tmp = min(tmp,d)  
  dp[i] = tmp
  
print(dp[-1])  

Fixed submission:
# TLE
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp= [0]*n

for i in range(1,n):
  tmp = float('inf')
  for j in range(1,min(i+1,k+1)):    
    d = dp[i-j] + abs(h[i] - h[i-j])    
    tmp = min(tmp,d)  
  dp[i] = tmp
  
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,w = map(int,input().split())
ww = [0]*n
vv = [0]*n
dp = [[0]*(w+1) for _ in range(n+1)]

for i in range(n):
  ww[i],vv[i] = map(int,input().split())      
  
for i in range(1,n+1):
  for j in range(1,w+1):
    dp[i][j] = dp[i-1][j]
    if j - ww[i-1] >= 0:
      dp[i][j] = max(dp[i][j], \
                     dp[i-1][j-ww[i-1]] + vv[i-1])        

print(dp[-1][-1])      

Fixed submission:
n,w = map(int,input().split())
ww = [0]*n
vv = [0]*n
dp = [[0]*(w+1) for _ in range(n+1)]

for i in range(n):
  ww[i],vv[i] = map(int,input().split())      
  
for i in range(1,n+1):
  for j in range(1,w+1):
    dp[i][j] = dp[i-1][j]
    if j - ww[i-1] >= 0:
      dp[i][j] = max(dp[i][j], \
                     dp[i-1][j-ww[i-1]] + vv[i-1])        

print(dp[-1][-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,w = map(int,input().split())

INF = float('inf')
ww = [0]*n
vv = [0]*n
vm = 1000
dp = [[INF]*(n*vm+1) for _ in range(n+1)]

for i in range(n):
  ww[i],vv[i] = map(int,input().split())      

dp[0][0] = 0  
for i in range(1,n+1):
  dp[i][0] = 0
  for j in range(1,n*vm+1):        
    if j < vv[i-1]:
      dp[i][j] = dp[i-1][j]
    else:
      dp[i][j] = min(dp[i-1][j], dp[i-1][j-vv[i-1]] + ww[i-1])        

ans = 0
for i in range(n*vm+1):
  if dp[n][i]<=w:
    ans = i
print(ans)    

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

INF = float('inf')
ww = [0]*n
vv = [0]*n
vm = 1000
dp = [[INF]*(n*vm+1) for _ in range(n+1)]

for i in range(n):
  ww[i],vv[i] = map(int,input().split())      

dp[0][0] = 0  
for i in range(1,n+1):
  dp[i][0] = 0
  for j in range(1,n*vm+1):        
    if j < vv[i-1]:
      dp[i][j] = dp[i-1][j]
    else:
      dp[i][j] = min(dp[i-1][j], dp[i-1][j-vv[i-1]] + ww[i-1])        

ans = 0
for i in range(n*vm+1):
  if dp[n][i]<=w:
    ans = i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
n = len(s)
m = len(t)

dp = [[0]*(m+1) for _ in range((n+1))]

for i in range(n):
  for j in range(m):
    if s[i]==t[j]:
      dp[i+1][j+1] = dp[i][j] + 1
    else:
      dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])
      
ans = ''
i = len(s)
j = len(t)
while i>0 and j>0:
  if dp[i][j] == dp[i-1][j]:
    i-=1    
  elif dp[i][j] == dp[i][j-1]:
    j-=1
  else:
    i-=1
    j-=1
    ans = s[i]+ans
    
print(ans)    

Fixed submission:
s = input()
t = input()
n = len(s)
m = len(t)

dp = [[0]*(m+1) for _ in range((n+1))]

for i in range(n):
  for j in range(m):
    if s[i]==t[j]:
      dp[i+1][j+1] = dp[i][j] + 1
    else:
      dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])
      
ans = ''
i = len(s)
j = len(t)
while i>0 and j>0:
  if dp[i][j] == dp[i-1][j]:
    i-=1    
  elif dp[i][j] == dp[i][j-1]:
    j-=1
  else:
    i-=1
    j-=1
    ans = s[i]+ans
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
pp = list(map(float,input().split()))

dp = [[0]*(n+1) for _ in range(n+1)]
dp[0][0] =1

for i in range(n):
  for j in range(n):
    dp[i+1][j+1] += dp[i][j] * pp[i]
    dp[i+1][j] += dp[i][j] * (1-pp[i])
    
print(sum(dp[-1][(n+1)//2:]))

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

dp = [[0]*(n+1) for _ in range(n+1)]
dp[0][0] =1

for i in range(n):
  for j in range(n):
    dp[i+1][j+1] += dp[i][j] * pp[i]
    dp[i+1][j] += dp[i][j] * (1-pp[i])
    
print(sum(dp[-1][(n+1)//2:]))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
aa = list(map(int,input().split()))

dp = [-1]*(k+1)

for i in range(1,k+1):
  for j in range(n):
    if i >= aa[j]:
      dp[i] = max(dp[i],-dp[i-aa[j]])

if win[k]>0:
  print('first')  
else:
  print('second')      

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

dp = [-1]*(k+1)

for i in range(1,k+1):
  for j in range(n):
    if i >= aa[j]:
      dp[i] = max(dp[i],-dp[i-aa[j]])

if dp[k]>0:
  print('First')  
else:
  print('Second')
Buggy python submission (verdict: Runtime Error):
s = input()

cw = 0
ans = 0
for i in range(n):
  if s[i] == 'W':
    ans += i-cw
    cw += 1
    
print(ans)    
    
  

Fixed submission:
s = input()
 
cw = 0
ans = 0
for i in range(len(s)):
  if s[i] == 'W':
    ans += i-cw
    cw += 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for _ in range(n)]
A = sorted(A,reverse=True)

ans = 0
if n%2 == 1:
  i = -1
  for i in range((n-2)//2):
    ans += A[i]*2
    ans -= A[-i-1]*2    
  ans += A[i+1]
  ans += A[i+2]
  ans -= A[i+3] *2
  
  tmp = 0
  for i in range((n-2)//2):
    tmp += A[i]*2
    tmp -= A[-i-1]*2    
  tmp += A[i+1] *2
  tmp -= A[i+2]
  tmp -= A[i+3]
  ans = max(ans,tmp)
  
else:
  for i in range((n-2)//2):
    ans += 2*A[i]
    ans -= 2*A[-i-1]      
  ans += A[i+1]
  ans -= A[i+2]
  
print(ans)  

Fixed submission:
n = int(input())
A = [int(input()) for _ in range(n)]
A = sorted(A,reverse=True)

ans = 0
if n%2 == 1:
  i = -1
  for i in range((n-2)//2):
    ans += A[i]*2
    ans -= A[-i-1]*2    
  ans += A[i+1]
  ans += A[i+2]
  ans -= A[i+3] *2
  
  tmp = 0
  for i in range((n-2)//2):
    tmp += A[i]*2
    tmp -= A[-i-1]*2    
  tmp += A[i+1] *2
  tmp -= A[i+2]
  tmp -= A[i+3]
  ans = max(ans,tmp)
  
else:
  i = -1
  for i in range((n-2)//2):
    ans += 2*A[i]
    ans -= 2*A[-i-1]      
  ans += A[i+1]
  ans -= A[i+2]
  
print(ans)

Buggy python submission (verdict: Runtime Error):

n = int(input())
A = [int(input()) for _ in range(n)]
A = sorted(A)

l = 1
r = n-1

que = deque()
que.append(A[0])
c = 0

while l <= r:
  if r-l==0:
    if abs(que[0]-A[r]) >= abs(que[-1]-A[r]):
      que.appendleft(A[r])
    else:
      que.append(A[r])
    r-=1
  else:    
    if c%2 == 0:    
      if abs(que[0]-A[r]) >= abs(que[-1]-A[r]):
        que.appendleft(A[r])
        que.append(A[r-1])
      else:
        que.append(A[r])
        que.appendleft(A[r-1])
      r -= 2
    else:
      if abs(que[0]-A[l]) >= abs(que[-1]-A[l]):
        que.appendleft(A[l])
        que.append(A[l+1])
      else:
        que.append(A[l])
        que.appendleft(A[l+1])
      l += 2
  c += 1  

ans = 0  
for i in range(n-1):
  ans += abs(que[i]-que[i+1])
  
print(ans)  

Fixed submission:
n = int(input())
A = [int(input()) for _ in range(n)]
A = sorted(A,reverse=True)

ans = 0
if n%2 == 1:
  i = -1
  for i in range((n-2)//2):
    ans += A[i]*2
    ans -= A[-i-1]*2    
  ans += A[i+1]
  ans += A[i+2]
  ans -= A[i+3] *2
  
  tmp = 0
  for i in range((n-2)//2):
    tmp += A[i]*2
    tmp -= A[-i-1]*2    
  tmp += A[i+1] *2
  tmp -= A[i+2]
  tmp -= A[i+3]
  ans = max(ans,tmp)
  
else:
  i = -1
  for i in range((n-2)//2):
    ans += 2*A[i]
    ans -= 2*A[-i-1]      
  ans += A[i+1]
  ans -= A[i+2]
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

ans = 1
for i in range(1, m//n +1):
  if m%(i) == 0:
    ans = i

print(ans)    

Fixed submission:
from math import sqrt

n,m = map(int,input().split())

ans = 1
for i in range(1, int(sqrt(m)+1)):
  if m % i == 0:
    if n * i <= m:
      ans = max(ans,i)
    if n * (m//i) <= m:
      ans = max(ans, m//i)
                           
print(ans)
Buggy python submission (verdict: Runtime Error):
n,i = (map,int(input()))
print(n-i+1)


Fixed submission:
n,i = map(int,input().split())
print(n-i+1)
Buggy python submission (verdict: Runtime Error):
r = int(input())
if r >= 2800 :
  print('AGC')
elif r >= 1200 :
  print('ARC'):
else:
  print('ABC')
  

Fixed submission:
r = int(input())
if r >= 2800 :
  print('AGC')
elif r >= 1200:
  print('ARC')
else:
  print('ABC')
Buggy python submission (verdict: Runtime Error):
aa = map(int,input().split())
print(max(aa)-min(aa))

Fixed submission:
aa = list(map(int,input().split()))
print(max(aa)-min(aa))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

b = [0]*n
for i in range(n):
  b[i] = a[i] - (i+1)  
  
if n%2 ==0:
  median = b[n//2] 
else:
  median = (b[n//2]+b[(n//2)+1])//2
  
ans = 0
for i in range(n):
  ans+= abs(a[i] -(median + i+1))
  
print(ans)    

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

b = [0]*n
for i in range(n):
  b[i] = a[i] - (i+1)  

bs = sorted(b)  
if n%2 ==1:
  median = bs[n//2] 
else:
  median = (bs[n//2 -1]+bs[(n//2)])//2
  
ans = 0
for i in range(n):
  ans+= abs(a[i] -(median + i+1))
  
print(ans)
Buggy python submission (verdict: Runtime Error):
d,n = map(int,input().split())
if d == 0:
  if n!=100:
    print(n)
  else:
    print(101)
  
elif d == 1:
  if n=!100:
    print(100*n)
  else:
    print(101*100)
else:
  if n=!100:
    print(10000*n)
  else:
    print(101*10000)

Fixed submission:
d,n = map(int,input().split())
if d == 0:
  if n!= 100:
    print(n)
  else:
    print(101)
  
elif d == 1:
  if n != 100:
    print(100*n)
  else:
    print(101*100)
else:
  if n != 100:
    print(10000*n)
  else:
    print(101*10000)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))

ans = n
for i in range(n):
  b = A[i]
  j = i+1
  while j<n:
    if b & A[j] == 0:    
      b += A[j]
      ans += 1
      j += 1
    else:
      break
      
print(ans)      

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

ans = 0
l = 0
r = 0
bit = A[0]
total = A[0]

while True:  
  if bit == total:
    ans += r-l+1
    r += 1
    if r == n:
      break
    total += A[r]
    bit ^= A[r]
  else:
    total -= A[l]
    bit ^= A[l]
    l += 1
      
print(ans)

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

ans = n
for i in range(n):
  b = A[i]
  j = i+1
  while j<n:
    if b & A[j] == 0:    
      b += A[j]
      ans += 1
      j += 1
    else:
      break
      
print(ans)      

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

ans = 0
l = 0
r = 0
bit = A[0]
total = A[0]

while True:  
  if bit == total:
    ans += r-l+1
    r += 1
    if r == n:
      break
    total += A[r]
    bit ^= A[r]
  else:
    total -= A[l]
    bit ^= A[l]
    l += 1
      
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d==map(int,input().split())
if abs(a-b)>=d and abs(b-c)>=d :
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c,d=map(int,input().split())
if (abs(a-b)<=d and abs(b-c)<=d) or (abs(a-c) <= d):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())

substrings = set()
n = len(s)
for i in range(n):
  for j in range(i+1,n+1):    
    substrings.add(s[i:j])
    
print(sorted(substrings)[k-1])

Fixed submission:
s = input()
k = int(input())

substrings = set()
n = len(s)
for i in range(n):
  for j in range(1,k+1):    
    substrings.add(s[i:i+j])
    
print(sorted(substrings)[k-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
aa = sorted(list(map(int,input().split())))
a_max = max(aa)

half = a_max/2
p = bisect_left(aa, half)
if abs(half - aa[p]) >= abs(half - aa[p-1]):
  print(a_max,aa[p-1])  
else:
  print(a_max,aa[p])  

Fixed submission:
from bisect import bisect_left

n = int(input())
aa = sorted(list(map(int,input().split())))
a_max = max(aa)

half = a_max/2
p = bisect_left(aa, half)
if abs(half - aa[p]) >= abs(half - aa[p-1]):
  print(a_max,aa[p-1])  
else:
  print(a_max,aa[p])
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())

ab = list(range(a,b+1))
nums = set(ab[:k]+ab[-k:])

for i in sorted(list(nums)):
  print(i)

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


ans = []
for ai in range(a,a+k):
  if ai <= b:
    ans.append(ai)
for bi in range(b,b-k,-1):
  if bi >=a:
    ans.append(bi)
    
for i in sorted(list(set(ans))):
  print(i)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input())
if a+b>=c:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c = map(int,input().split())
if a+b>=c:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
c = [list(map(int,input().split())) for _ in range(3)]

def check(c):
  for a1 in range(c[0][0]):
    b = [c[0][i] - a1 for i in range(3)]
    a = [a1] + [c[i][0] - b[0] for i in range(1,3)]

    for ai in a:
      for bi in b:
        if c[ai][bi] != a[ai]+b[bi]:
          print('No')
          return
  print('Yes')

check(c)

Fixed submission:
c = [list(map(int,input().split())) for _ in range(3)]

def check(c):
  for a1 in range(c[0][0]):
    b = [c[0][i] - a1 for i in range(3)]
    a = [a1] + [c[i][0] - b[0] for i in range(1,3)]

    for ai in range(len(a)):
      for bi in range(len(b)):  
        if c[ai][bi] != a[ai]+b[bi]:
          print('No')
          return
  print('Yes')

check(c)