Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = []
c = []
for i in range(len(a)):
  x = a[i]
  if x in b:
    c[b.index(x)].append(i)
  else:
    b.append(x)
    c.append([i])
d = []
for i in range(len(a)):
  x = a[i]
  xc = c[b.index(x)]
  d.append(xc[(xc.index(i)+1)%len(xc)])
#print(d)
count = 0
now = 0
while now != 0 or count == 0:
  past = now
  now = ( d[past] + 1 ) % n
  if now - 1 <= past:
    count += 1
  #print(past,now,count)
limit = k % count
#print(count,limit)
count = 0
now = 0
while True:
  past = now
  now = ( d[past] + 1 ) % n
  if now - 1 <= past:
    if count == limit - 2:
      break
    count += 1
#print(d,past,a)
ans = []
for i in range(-n+past,n):
  x = a[i%n]
  #print(x)
  if x in ans:
    ans = ans[:ans.index(x)]
  else:
    ans.append(x)
#print(ans)
ans2 = list(map(str,ans))
print(' '.join(ans2))

Fixed submission:
#17:43
n,k = map(int,input().split())
a = list(map(lambda x: int(x)-1, input().split()))
mx = max(a) + 1
num = [[] for _ in range(mx)]
leg = [0 for _ in range(mx)]
for i in range(n):
  num[a[i]].append(i)
  leg[a[i]] += 1
#print(num)
nex = [0 for _ in range(n)]
for j in range(mx):
  nu = num[j]
  le = leg[j]
  for li in range(le-1):
    nex[nu[li]] = nu[li+1]+1
  if nu:
    nex[nu[-1]] = nu[0]+n+1
#print(nex)
unit = 0
now = 0
while True:
  tmp = nex[now]
  unit += tmp // n
  now = tmp % n
  #print(tmp,now)
  if now == 0:
    break
#print(unit)
k %= unit
k *= n
#print(k)
if k == 0:
  exit()
while True:
  tmp = nex[now]
  if k - (tmp-now) > 0:
    k -= tmp - now
    now = tmp % n
  else:
    ans = a[-k:]
    break
  #print(k)
l = len(ans)
seen = [0 for _ in range(mx)]
ans2 = []
for li in range(l):
  if seen[ans[li]] == 1:
    while True:
      p = ans2.pop()
      seen[p] = 0
      if p == ans[li]:
        break
  else:
    ans2.append(ans[li])
    seen[ans[li]] = 1
print(' '.join(map(lambda x:str(x+1),ans2)))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = list(map(int,input().split()))
m = 10**9+7
for i in range(1,k+1):
  a = 1
  for j in range(i-1):
    a *= k-1-j
    a //= j+1
  b = 1
  for j in range(i):
    b *= n-k+1-j
    b //= j+1
  a %= m
  b %= m
  print(a*b%m)

Fixed submission:
n,k = list(map(int,input().split()))
m = 10**9+7
a = 1
b = n-k+1
print(a*b%m)
for i in range(2,k+1):
  a *= k+1-i
  a //= i-1
  at = a%m
  b *= n-k+2-i
  b //= i
  bt = b%m
  print(at*bt%m)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = list(map(int,input().split()))
m = 10**9+7
def c(x,y):
  t = 1
  for j in range(y):
    t *= x-j
    t //= j+1
  return t
for i in range(1,k+1):
  print( (c(k-1,i-1) * c(n-k+1,i)) % m )

Fixed submission:
n,k = list(map(int,input().split()))
m = 10**9+7
a = 1
b = n-k+1
print(a*b%m)
for i in range(2,k+1):
  a *= k+1-i
  a //= i-1
  at = a%m
  b *= n-k+2-i
  b //= i
  bt = b%m
  print(at*bt%m)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = list(map(int,input().split()))
m = 10**9+7
def inv(x):
  m = 10**9+7
  t = x
  y = 1
  while True:
    if t == 1:
      break
    y *= m // t
    t = m % t
    y *= -1
    y %= m
  return y
def c(x,y):
  t = 1
  for j in range(y):
    t *= x-j
    t *= inv(j+1)
  return t
for i in range(1,k+1):
  print( (c(k-1,i-1) * c(n-k+1,i)) % m )

Fixed submission:
n,k = list(map(int,input().split()))
m = 10**9+7
a = 1
b = n-k+1
print(a*b%m)
for i in range(2,k+1):
  a *= k+1-i
  a //= i-1
  at = a%m
  b *= n-k+2-i
  b //= i
  bt = b%m
  print(at*bt%m)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = list(map(int,input().split()))
m = 10**9+7
def c(x,y):
  t = 1
  for j in range(y):
    t *= x-j
    t //= j+1
  return t
for i in range(1,k+1):
  print( (c(k-1,i-1) * c(n-k+1,i)) % m )

Fixed submission:
n,k = list(map(int,input().split()))
m = 10**9+7
a = 1
b = n-k+1
print(a*b%m)
for i in range(2,k+1):
  a *= k+1-i
  a //= i-1
  at = a%m
  b *= n-k+2-i
  b //= i
  bt = b%m
  print(at*bt%m)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
r = (n-1)*(n-2)//2 - k
if r < 0:
  print(-1)
else:
  print(n-1+r)
  for i in range(1,n):
    print(1,i+1)
  while r != 0:
    for i in range(1,n):
      while r != 0:
        for j in range(i+1,n):
          print(i+1,j+1)
          r -= 1

Fixed submission:
n,k = map(int,input().split())
r = (n-1)*(n-2)//2 - k
if r < 0:
  print(-1)
else:
  print(n-1+r)
  for i in range(1,n):
    print(1,i+1)
  for i in range(1,n):
    r -= n-i-1
    if r >= 0:
      for j in range(i+1,n):
        print(i+1,j+1)
    else:
      for j in range(i+1,r+n):
        print(i+1,j+1)
      break

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
r = (n-1)*(n-2)//2 - k
if r < 0:
  print(-1)
else:
  print(n-1+r)
  for i in range(1,n):
    print(1,i+1)
  while r != 0:
    for i in range(1,n):
      while r != 0:
        for j in range(i+1,n):
          print(i+1,j+1)
          r -= 1

Fixed submission:
n,k = map(int,input().split())
r = (n-1)*(n-2)//2 - k
if r < 0:
  print(-1)
else:
  print(n-1+r)
  for i in range(1,n):
    print(1,i+1)
  for i in range(1,n):
    r -= n-i-1
    if r >= 0:
      for j in range(i+1,n):
        print(i+1,j+1)
    else:
      for j in range(i+1,r+n):
        print(i+1,j+1)
      break
Buggy python submission (verdict: Time Limit Exceeded):
#解説読み 2次元dp
mod = 10**9 + 7
n,m = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
tmp = [1 for _ in range(m+1)]
dp = [tmp]
for ni in range(n):
  last = tmp
  tmp = [1]
  for mi in range(m):
    if A[ni] != B[mi]:
      x = tmp[-1]+last[mi+1]-last[mi]
    else:
      x = tmp[-1]+last[mi+1]
    x %= mod
    tmp.append(x)
  dp.append(tmp)
print(dp[-1][-1])

Fixed submission:
#15:35
h,w = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
mod = 10 ** 9 + 7
now = [1 for _ in range(w+1)]
for i in range(h):
  last = now
  now = [1]
  for j in range(w):
    if a[i] == b[j]:
      now.append((last[j+1]+now[-1])%mod)
    else:
      now.append((last[j+1]+now[-1]-last[j])%mod)
  #print(now)
print(now[-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
xy = []
diff = []
for _ in range(n):
  tmp = list(map(int,input().split()))
  xy.append(tmp)
for i in range(n):
  for j in range(n):
    if j != i:
      tmpd = [ xy[j][0] - xy[i][0] , xy[j][1] - xy[i][1] ]
      flag = 0
      for mxy in diff:
        if mxy[1:] == tmpd:
            flag = 1
            mxy[0] += 1
            break
      if flag == 0:
        diff.append([0]+tmpd)
diff.sort()
diff.reverse()
print(n-diff[0][0]-1)

Fixed submission:
n = int(input())
xy = []
diff = []
for _ in range(n):
  tmp = list(map(int,input().split()))
  xy.append(tmp)
for i in range(n):
  for j in range(n):
    if j != i:
      tmpd = [ xy[j][0] - xy[i][0] , xy[j][1] - xy[i][1] ]
      flag = 0
      for mxy in diff:
        if mxy[1:] == tmpd:
            flag = 1
            mxy[0] += 1
            break
      if flag == 0:
        diff.append([0]+tmpd)
diff.sort()
diff.reverse()
if n == 1:
  print(1)
else:
  print(n-diff[0][0]-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
plus = 0
for i in range(n):
  plus += ( 2 * int( a[i] > 0 ) - 1 )
score = 0
for i in range(n):
  score += abs(a[i])
if plus != n:
  print(score)
  a.sort()
  if plus >=0:
    for k in range(plus):
      print(a[0],a[-1])
      a[0] -= a[-1]
      del a[-1]
    half = ( n - plus ) // 2
    if half != 0:
      for k in range(half-1):
        print(a[k],a[-1])
        a[k] -= a[-1]
        del a[-1]
      for k in range(half):
        print(a[-1],a[0])
        a[-1] -= a[0]
        del a[0]
  else:
    plus *= -1
    for k in range(plus):
      print(a[-1],a[0])
      a[-1] -= a[0]
      del a[0]
    half = ( n - plus ) // 2
    if half != 0:
      for k in range(half-1):
        print(a[k],a[-1])
        a[k] -= a[-1]
        del a[-1]
      for k in range(half):
        print(a[-1],a[0])
        a[-1] -= a[0]
        del a[0]
else:
  unchi

Fixed submission:
#12:17
n = int(input())
a = list(map(int,input().split()))
plus = []
minus = []
for i in range(n):
  if a[i] >= 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
plus.sort()
minus.sort(reverse=True)
lp = len(plus)
lm = len(minus)
if lp >= 1 and lm >= 1:
  ans = sum(plus) - sum(minus)
  print(ans)
  x = minus[0]
  lp = len(plus)
  for i in range(1,lp):
    print(x,plus[i])
    x = x - plus[i]
  minus[0] = x
  x = plus[0]
  for j in range(lm):
    print(x,minus[j])
    x = x - minus[j]
elif lp == 0:
  ans = - sum(minus) + 2 * max(minus)
  print(ans)
  x = minus[1]
  for j in range(2,lm):
    print(x,minus[j])
    x = x - minus[j]
  print(x,minus[0])
elif lm == 0:
  ans = sum(plus) - 2 * min(plus)
  print(ans)
  x = plus[0]
  for i in range(2,lp):
    print(x,plus[i])
    x = x - plus[i]
  print(plus[1],x)
Buggy python submission (verdict: Runtime Error):
#23:39
a = map(int,input().split())
print( sum(a) - max(a) )

Fixed submission:
A = list(map(int,input().split()))
print(sum(A)-max(A))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
b = [int(input()) for _ in range(m)]
A = [0,1]
if 0 in b:
  print(0)
else:
  for i in range(1,n+1):
    if i in b:
      A.append(0)
    else:
      A.append( (A[-1]+A[-2]) % (10**9+7) )
  print(A[-1])

Fixed submission:
n,m = map(int,input().split())
b = [int(input()) for _ in range(m)] + [n+1]
now = 0
A = [0,1]
if b[0] == 0:
  print(0)
else:
  for i in range(1,n+1):
    if b[now] == i:
      A.append(0)
      now += 1
    else:
      A.append( (A[-1]+A[-2]) % (10**9+7) )
  print(A[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
b = []
for _ in range(m):
  b.append(int(input()))
A = [0,1]
for i in range(1,n+1):
  if i in b:
    A.append(0)
  else:
    A.append( (A[-1]+A[-2]) % (10**9+7) )
print(A[-1])

Fixed submission:
n,m = map(int,input().split())
b = [int(input()) for _ in range(m)] + [n+1]
now = 0
A = [0,1]
if b[0] == 0:
  print(0)
else:
  for i in range(1,n+1):
    if b[now] == i:
      A.append(0)
      now += 1
    else:
      A.append( (A[-1]+A[-2]) % (10**9+7) )
  print(A[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
b = []
for _ in range(m):
  b.append(int(input()))
A = [0,1]
for i in range(1,n+1):
  if i in b:
    A.append(0)
  else:
    A.append( (A[-1]+A[-2]) % (10**9+7) )
print(A[-1])

Fixed submission:
n,m = map(int,input().split())
b = [int(input()) for _ in range(m)] + [n+1]
now = 0
A = [0,1]
if b[0] == 0:
  print(0)
else:
  for i in range(1,n+1):
    if b[now] == i:
      A.append(0)
      now += 1
    else:
      A.append( (A[-1]+A[-2]) % (10**9+7) )
  print(A[-1])
Buggy python submission (verdict: Time Limit Exceeded):
#14:07
s = input()
l = len(s)
cnt = 0
ans = 0
for i in range(l):
  if s[i] == '1':
    cnt += 1
    ans += 3**(l-1-i) * 2**(cnt-1)
ans += 2**cnt
print(ans%(10**9+7))

Fixed submission:
#16:17
s = input()
n = len(s)
mod = 10 ** 9 + 7
left = [1]
stand = [1]
right = [1]
for i in range(1,n):
  right.append(right[-1] * 3 % mod)
  if s[i] == '1':
    left.append(left[-1] * 2 % mod)
    stand.append(1)
  else:
    left.append(left[-1])
    stand.append(0)
right.reverse()
ans = 0
for i in range(n):
  ans += left[i] * right[i] * stand[i]
  ans %= mod
#print(left)
#print(right)
#print(stand)
ans += left[-1] * 2
ans %= mod
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = list(map(int,input().split()))
m = 10**9+7
def inv(x):
  m = 10**9+7
  t = x
  y = 1
  while True:
    if t == 1:
      break
    y *= m // t
    t = m % t
    y *= -1
    y %= m
  return y
def c(x,y):
  t = 1
  for j in range(y):
    t *= x-j
    t *= inv(j+1)
  return t
for i in range(1,k+1):
  print( (c(k-1,i-1) * c(n-k+1,i)) % m )

Fixed submission:
#解説チラ見
n = int(input())
peer = [[] for _ in range(n)]
for _ in range(n-1):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  peer[a].append(b)
  peer[b].append(a)
now = [0]
scr = list(map(int,input().split()))
scr.sort()
scr.reverse()
ans = [0 for _ in range(n)]
ans[0] = scr[0]
pin = 1
while now:
  last = now
  now = []
  for x in last:
    for y in peer[x]:
      if ans[y] == 0:
        ans[y] = scr[pin]
        pin += 1
        now.append(y)
print(sum(scr[1:]))
print(' '.join(list(map(str,ans))))
Buggy python submission (verdict: Runtime Error):
#17:09
n,k = map(int,input().split())
v = list(map(int,input().split()))
'''
左からa個
右からb個
k-a-b個以内捨てて良し
'''
can = []
nk = min(n,k)
for a in range(nk+1):
  if a != 0:
    x.append(v[a-1])
  else:
    x = []
  for b in range(nk+1-a):
    if b != 0:
      y.append(v[-b])
    else:
      y = []
    z = x + y
    z.sort()
    r = k - a - b
    tmp = 0
    if r < a+b:
      if z[r] < 0:
        for i in range(r,a+b):
          tmp += z[i]
      else:
        for i in range(a+b):
          if z[i] >= 0:
            tmp += z[i]
    else:
      for i in range(a+b):
        if z[i] >= 0:
          tmp += z[i]
    can.append(tmp)
print(max(can))

Fixed submission:
a,p = map(int,input().split())
print((3*a+p)//2)
Buggy python submission (verdict: Runtime Error):
while True:
  must1 = 1
  for mi in range(m):
    onoff = 0
    for ni in range(n):
      onoff += li[mi][ni]*yyy[ni]
    should1 = bool(onoff%2 == p[mi])
    must1 *= should1
  if must1 == 1:
    score += 1
  yyy[0] += 1
  for ni in range(n-1):
    if yyy[ni] == 2:
      yyy[ni] = 0
      yyy[ni+1] += 1
  if yyy[n-1] == 2:
    break
print(score)

Fixed submission:
n,m = map(int,input().split())
ls = []
for _ in range(m):
  tmp = list(map(int,input().split()))[1:]
  lls = []
  for i in range(1,n+1):
    lls += [int(i in tmp)]
  ls += [lls]
p = list(map(int,input().split()))
count = 0
yyy = [0]*n
while True:
  if yyy[-1] == 2:
    break
  dd = 0
  for mi in range(m):
    c = 0
    for ni in range(n):
      c += ls[mi][ni] * yyy[ni]
    d = c%2
    dd += 1-int(d==p[mi])
  if dd == 0:
    count += 1
  yyy[0] += 1
  for j in range(0,n-1):
    if yyy[j] == 2:
      yyy[j] = 0
      yyy[j+1] += 1
print(count)
Buggy python submission (verdict: Runtime Error):
#12:10
n,k = map(int,input().split())
v = list(map(int,input().split()))
can = []
for i in range(n):
  if i == 0:
    a = []
  elif i <= k:
    a.append(v[i-1])
  for j in range(n):
    if j == 0:
      b = []
    elif i + j <= n and i + j <= k:
      b.append(v[-j])
    rest = min(k-i-j,i+j)
    c = a + b
    c.sort()
    tmp = sum(c)
    for de in range(rest):
      if c[de] < 0:
        tmp -= c[de]
    can.append(tmp)
    #print(i,j,a,b,tmp)
print(max(can))

Fixed submission:
#17:09
n,k = map(int,input().split())
v = list(map(int,input().split()))
'''
左からa個
右からb個
k-a-b個以内捨てて良し
'''
can = []
nk = min(n,k)
for a in range(nk+1):
  if a != 0:
    x.append(v[a-1])
  else:
    x = []
  for b in range(nk+1-a):
    if b != 0:
      y.append(v[-b])
    else:
      y = []
    z = x + y
    z.sort()
    r = k - a - b
    tmp = 0
    if r < a+b:
      if z[r] < 0:
        for i in range(r,a+b):
          tmp += z[i]
      else:
        for i in range(a+b):
          if z[i] >= 0:
            tmp += z[i]
    else:
      for i in range(a+b):
        if z[i] >= 0:
          tmp += z[i]
    can.append(tmp)
print(max(can))

Buggy python submission (verdict: Runtime Error):
#17:09
n,k = map(int,input().split())
v = list(map(int,input().split()))
'''
左からa個
右からb個
k-a-b個以内捨てて良し
'''
can = []
x = []
for a in range(k):
  if a != 0:
    x.append(v[a-1])
  y = []
  for b in range(k):
    if b != 0:
      y.append(v[-b])
    if a + b <= min(n,k):
      z = x + y
      z.sort()
      r = k - a - b
      tmp = 0
      if r < a+b:
        if z[r] < 0:
          for i in range(r,a+b):
            tmp += z[i]
        else:
          for i in range(a+b):
            if z[i] > 0:
              tmp += z[i]
      else:
        for i in range(r,a+b):
          if z[i] > 0:
            tmp += z[i]
      can.append(tmp)
print(max(can))

Fixed submission:
#17:09
n,k = map(int,input().split())
v = list(map(int,input().split()))
'''
左からa個
右からb個
k-a-b個以内捨てて良し
'''
can = []
nk = min(n,k)
for a in range(nk+1):
  if a != 0:
    x.append(v[a-1])
  else:
    x = []
  for b in range(nk+1-a):
    if b != 0:
      y.append(v[-b])
    else:
      y = []
    z = x + y
    z.sort()
    r = k - a - b
    tmp = 0
    if r < a+b:
      if z[r] < 0:
        for i in range(r,a+b):
          tmp += z[i]
      else:
        for i in range(a+b):
          if z[i] >= 0:
            tmp += z[i]
    else:
      for i in range(a+b):
        if z[i] >= 0:
          tmp += z[i]
    can.append(tmp)
print(max(can))
Buggy python submission (verdict: Runtime Error):
#21:30
n = int(input())
peer = [[] for _ in range(n)]
for _ in range(n-1):
  a,b,x = map(int,input().split())
  a -= 1
  b -= 1
  peer[a].append([b,x])
  peer[b].append([a,x])
ans = [-1 for _ in range(n)]
now = [0]
while now != []:
  last = now
  now = []
  for x in last:
    for yz in peer[x]:
      y = yz[0]
      z = yz[1]
      if ans[y] == -1:
        ans[y] = (ans[x] + z) % 2
        now.append(y)
  #print(now)
for i in range(n):
  print(ans[now])

Fixed submission:
#21:30
n = int(input())
peer = [[] for _ in range(n)]
for _ in range(n-1):
  a,b,x = map(int,input().split())
  a -= 1
  b -= 1
  peer[a].append([b,x])
  peer[b].append([a,x])
ans = [-1 for _ in range(n)]
now = [0]
while now != []:
  last = now
  now = []
  for x in last:
    for yz in peer[x]:
      y = yz[0]
      z = yz[1]
      if ans[y] == -1:
        ans[y] = (ans[x] + z) % 2
        now.append(y)
  #print(now)
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
#21:30
n = int(input())
peer = [[] for _ in range(n)]
for _ in range(n-1):
  a,b,x = map(int,input().split())
  a -= 1
  b -= 1
  peer[a].append([b,x])
  peer[b].append([a,x])
ans = [-1 for _ in range(n)]
now = [0]
while now != []:
  last = now
  now = []
  for x in last:
    for yz in peer[x]:
      y = yz[0]
      z = yz[1]
      if ans[y] == -1:
        ans[y] = (ans[x] + z) % 2
        now.append(y)
  #print(now)
for i in range(n):
  print(now[i])

Fixed submission:
#21:30
n = int(input())
peer = [[] for _ in range(n)]
for _ in range(n-1):
  a,b,x = map(int,input().split())
  a -= 1
  b -= 1
  peer[a].append([b,x])
  peer[b].append([a,x])
ans = [-1 for _ in range(n)]
now = [0]
while now != []:
  last = now
  now = []
  for x in last:
    for yz in peer[x]:
      y = yz[0]
      z = yz[1]
      if ans[y] == -1:
        ans[y] = (ans[x] + z) % 2
        now.append(y)
  #print(now)
for i in range(n):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
S = input()
h = 'o'
if S[k-1] == 'A':
  h = 'a'
elif S[k-1] == 'B':
  h = 'b'
else:
  h = 'c'
print(S[:k-1]+h+S[k:])

Fixed submission:
a,b = list(map(int,input().split()))
print(a-b+1)
Buggy python submission (verdict: Runtime Error):
#19:32
n = int(input())
ans = 0
for i in range(1,int(n**.5)+1):
  if n % i == 0:
    x = n // i - 1
    if n // x == n % x == i:
      ans += x
      #print(x)
print(ans)

Fixed submission:
#19:32
n = int(input())
ans = 0
if n == 1:
  print(0)
else:
  for i in range(1,int(n**.5)+1):
    if n % i == 0:
      x = n // i - 1
      if n // x == n % x == i:
        ans += x
        #print(x)
  print(ans)
Buggy python submission (verdict: Runtime Error):
import fractions
N = int(input())
A = list(map(int,input().split()))
hard = fractions.gcd(A[0],A[1])
easy = [A[0],A[1]]
del A[0],A[1]
while len(A) != 0:
  easyt1 = fractions.gcd(easy[0],A[0])
  easyt2 = fractions.gcd(easy[1],A[0])
  easyt3 = hard
  easy = sorted([easyt1,easyt2,easyt3])[1:3]
  hard = fractions.gcd(hard,A[0])
  del A[0]
print(max(easy))

Fixed submission:
import fractions
N = int(input())
A = list(map(int,input().split()))
hard = fractions.gcd(A[0],A[1])
easy = [A[0],A[1]]
del A[0]
del A[0]
while len(A) != 0:
  easyt1 = fractions.gcd(easy[0],A[0])
  easyt2 = fractions.gcd(easy[1],A[0])
  easyt3 = hard
  easy = sorted([easyt1,easyt2,easyt3])[1:3]
  hard = fractions.gcd(hard,A[0])
  del A[0]
print(max(easy))
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if A<C and B<C:
  print('No')
elif A>C and B>C:
  print('No')
else:
  Print('Yes')

Fixed submission:
A,B,C = map(int,input().split())
if A<C and B<C:
  print('No')
elif A>C and B>C:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = input()
if S[0] == '0':
  divide = []
else:
  divide = [0]
tmp = 1
for i in range(1,N):
  if S[i] == S[i-1]:
    tmp += 1
  else:
    divide += [tmp]
    tmp = 1
divide += [tmp]
le = len(divide)
zero = [0]*2*le + divide + [0]*2*le
su = [0]
for i in range(0,5*le):
  su += [su[-1]+zero[i]]
del su[0]
lle = len(su)
mxm = 0
for k in range(K,lle):
  if 2*k+1 >= lle:
    break
  cd = su[2*k+1] - su[2*k-2*K]
  if cd > mxm:
    mxm = cd
print(mxm)

Fixed submission:
A,B = map(int,input().split())
if A > B:
  print(2*A-1)
if A == B:
  print(A+B)
if A < B:
  print(2*B-1)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = input()
if S[0] == '0':
  divide = []
else:
  divide = [0]
tmp = 1
for i in range(1,N):
  if S[i] == S[i-1]:
    tmp += 1
  else:
    divide += [tmp]
    tmp = 1
divide += [tmp]
le = len(divide)
zero = [0]*2*le + divide + [0]*2*le
su = [0]
for i in range(0,5*le):
  su += [su[-1]+zero[i]]
del su[0]
lle = len(su)
mxm = 0
for k in range(K,lle):
  if 2*k+1 > lle:
    break
  cd = su[2*k+1] - su[2*k-2*K]
  if cd > mxm:
    mxm = cd
print(mxm)

Fixed submission:
N,K = map(int,input().split())
S = input()
if S[0] == '0':
  divide = []
else:
  divide = [0]
tmp = 1
for i in range(1,N):
  if S[i] == S[i-1]:
    tmp += 1
  else:
    divide += [tmp]
    tmp = 1
divide += [tmp]
le = len(divide)
zero = [0]*2*le + divide + [0]*2*le
su = [0]
for i in range(0,5*le):
  su += [su[-1]+zero[i]]
del su[0]
lle = len(su)
mxm = 0
for k in range(K,lle):
  if 2*k+1 >= lle:
    break
  cd = su[2*k+1] - su[2*k-2*K]
  if cd > mxm:
    mxm = cd
xmx = max(divide)
print(max(mxm,xmx))
Buggy python submission (verdict: Runtime Error):
A,B,C,D,E = [int(input()) for _ in range(5)]
a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10
if a == b == c == d == e == 0:
  print(A+B+C+D+E)
else:
  print(A-a+B-b+C-c+D-d+E-e-max(10-a,10-b,10-c,10-d,10-e)

Fixed submission:
A,B,C,D,E = [int(input()) for _ in range(5)]
a = (10-A) % 10
b = (10-B) % 10
c = (10-C) % 10
d = (10-D) % 10
e = (10-E) % 10
if a == b == c == d == e == 0:
  print(A+B+C+D+E)
else:
  print(A+B+C+D+E+a+b+c+d+e-max(a,b,c,d,e))