Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
w = []
a = input()
w.append(a)

for i in range(n):
    b = input()
    if b[0] != a[-1] or b in count:
        print("No")
        quit()
    count.append(b)
    a=b
print("Yes")

Fixed submission:
n = int(input())
w = [input() for i in range(n)]
ans = "Yes"
if len(set(w)) != n:
    ans = "No"
for j in range(1,len(w)):
    if w[j-1][-1] != w[j][0]:
        ans = "No"
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
h,w=map(int,input().split())
s=[]
for _ in range(w):
    a = input() 
    if "#" in a:
        s.append(a)
d = []
for i in zip(*s):
    if "#" in i:
        d.append(i)
for j in zip(*d):
    print(*j,sep="")

Fixed submission:
h,w = map(int,input().split())
a = []
for _ in range(h):
    i = input()
    if "#" in i:
        a.append(i)

ans = []
for i in zip(*a):
    if "#" in i:
        ans.append(i)
for j in zip(*ans):
    print(*j,sep = "")

Buggy python submission (verdict: Runtime Error):
import numpy as np
h,w=map(int,input().split())
s=[]
for _ in range(w):
    a = input() 
    if "#" in a:
        s.append(a)
d = []
for i in zip(*s):
    if "#" in i:
        d.append(i)
for j in zip(*d):
    print(*j,sep="")

Fixed submission:
h,w = map(int,input().split())
a = []
for _ in range(h):
    i = input()
    if "#" in i:
        a.append(i)

ans = []
for i in zip(*a):
    if "#" in i:
        ans.append(i)
for j in zip(*ans):
    print(*j,sep = "")
Buggy python submission (verdict: Runtime Error):
vs=input()
t=input()
print("Yes" if t in s*2 else "No")

Fixed submission:
s = input()
t = input()
print(["No","Yes"][t in s*2])
Buggy python submission (verdict: Runtime Error):
n = input()
s = 0
for i in len(n):
    s += int(n[i])

print(["No","Yes"][int(n)%s == 0])

Fixed submission:
n = int(input())
s = 0
for i in str(n):
    s += int(i)
print("Yes" if n%s == 0 else "No")

Buggy python submission (verdict: Runtime Error):
n = input()
s = 0
for i in len(n):
    s += int(n[i])

print(["No","Yes"][n%s == 0])

Fixed submission:
n = int(input())
s = 0
for i in str(n):
    s += int(i)
print("Yes" if n%s == 0 else "No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = 0
for i in len(n):
    s += n[i]

print(["No","Yes"][n%s == 0])

Fixed submission:
n = int(input())
s = 0
for i in str(n):
    s += int(i)
print("Yes" if n%s == 0 else "No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = 0
for i in n:
    s += n[i]

print(["No","Yes"][n%s == 0])

Fixed submission:
n = int(input())
s = 0
for i in str(n):
    s += int(i)
print("Yes" if n%s == 0 else "No")

Buggy python submission (verdict: Runtime Error):
n = input()
s = 0
for i in n:
    s += n[i]

print(["No","Yes"][n%s == 0])

Fixed submission:
n = int(input())
s = 0
for i in str(n):
    s += int(i)
print("Yes" if n%s == 0 else "No")

Buggy python submission (verdict: Runtime Error):
n = input()
s = 0
for i in n:
    s += n[i]

print(["No","Yes"][n%s == 0])

Fixed submission:
n = int(input())
s = 0
for i in str(n):
    s += int(i)
print("Yes" if n%s == 0 else "No")
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
d = []
f = 0
for i in range(1,1000):
    f += i
    d.append(f)
c = []
for j in range(b) :
    c.append(abs(d[j]-a))
print(min(c)) 
    

Fixed submission:
a,b = map(int,input().split())
s = b-a
d = []
f = 0
for i in range(1,1000):
    f += i
    d.append(f)

print(d[s-1]-b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
a = 0
for i in range(1,n):
    a = max(a,set(s[:i]) & set(s[i:]))

print(a)


Fixed submission:
n = int(input())
s = input()
a = 0
for i in range(1,n):
    a = max(a, len(set(s[:i]) & set(s[i:])))

print(a)
Buggy python submission (verdict: Runtime Error):
x = int(input())
a = 0
for i in range(1,x+1):
    for j in range(2,4):
        if i**j <= x:
            a = max(a,i**j)
print(a)

Fixed submission:
a,b,c,d=map(int,input().split())
x = abs(a-b)
y = abs(b-c)
z = abs(a-c)
if x <= d and y <= d:
    print("Yes")
elif z <= d:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = 1
for i in range(1,n):
    for j in range(2,n):
        if i**j <= n:
            a = max(a,i**j)
print(a)

Fixed submission:
n = int(input())
a = 1
for i in range(1,n):
    for j in range(2,n):
        if i**j <= n:
            a = max(a,i**j)
        else:
            break


print(a)
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
print(["NO","YES"][(a+b>=c)*(a<=c)])


Fixed submission:
a,b,c = map(int,input().split())
if (a+b>=c and a<= c):print("YES")
else:print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if x-a<=b and x>=a:
    print("YES")
else:
    print("NO")


Fixed submission:
a,b,c = map(int,input().split())
if (a+b>=c and a<= c):print("YES")
else:print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
print(["No","Yes"][(a+b>=c)*(a<=c)])


Fixed submission:
a,b,c = map(int,input().split())
if (a+b>=c and a<= c):print("YES")
else:print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())

for i in range(a,b+1):
    if i-a<k or b-i<k:
        print(i)

Fixed submission:
a,b,k = map(int,input().split())
if b+1-a <= k*2:
    for i in range(a,b+1):
        print(i)
else:
    for j in range(a,a+k):
        print(j)
    for l in range(b-k+1,b+1):
        print(l)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
k = int(input())
for i in range(a,b+1):
    if i<a+k or i>b-k:
        print(i)
    
 
   


 


Fixed submission:
a,b,k = map(int,input().split())
if b+1-a <= k*2:
    for i in range(a,b+1):
        print(i)
else:
    for j in range(a,a+k):
        print(j)
    for l in range(b-k+1,b+1):
        print(l)

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

 


Fixed submission:
a,b,k = map(int,input().split())
if b+1-a <= k*2:
    for i in range(a,b+1):
        print(i)
else:
    for j in range(a,a+k):
        print(j)
    for l in range(b-k+1,b+1):
        print(l)

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


 


Fixed submission:
a,b,k = map(int,input().split())
if b+1-a <= k*2:
    for i in range(a,b+1):
        print(i)
else:
    for j in range(a,a+k):
        print(j)
    for l in range(b-k+1,b+1):
        print(l)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
print(min(a,b)+min(c,d))

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a,b)+min(c,d))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = {}
for i in range(n):
    d = input()
    if d in s:
        s[d] += 1
    else:
        s.update({d:1}) 

m = int(input())
for j in range(m):
    t = input()
    if t in s:
        s[t] -= 1
    else:
        s.update({t:-1})

print("0" if max(d.values()) < 0 else max(d.values()))


Fixed submission:
a,b,c = map(int,input().split())
print(["Yes","No"][a+b<c])
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = {}
for i in range(n):
    d = input()
    if d in s:
        s[d] += 1
    else:
        s.update({d:1}) 

m = int(input())
for j in range(m):
    t = input()
    if t in s:
        s[t] -= 1
    else:
        s.update({t:-1})

print("0" if max(d.values()) < 0 else max(d.values()))


Fixed submission:
n = int(input())
s = list(input() for _ in range(n))

m = int(input())
t = list(input() for _ in range(m))

a = 0
d = 0
for i in s:
    a = s.count(i)-t.count(i)
    if d <= a:
        d = a
print(d)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = {}
for i in range(n):
    d = input()
    if d in s:
        s[d] += 1
    else:
        s.update({d:1}) 

m = int(input())
for j in range(m):
    t = input()
    if t in s:
        s[t] -= 1
    else:
        s.update({t:-1})

print(0 if max(d.values()) < 0 else max(d.values()))


Fixed submission:
n = int(input())
s = list(input() for _ in range(n))

m = int(input())
t = list(input() for _ in range(m))

a = 0
d = 0
for i in s:
    a = s.count(i)-t.count(i)
    if d <= a:
        d = a
print(d)
Buggy python submission (verdict: Runtime Error):
a = input()
for i in range(int(a[0]+a[2:])):
    if int(a[0]+a[2:]) == i**2:
        print("Yes")
        exit()
print("No")


Fixed submission:
a = list(map(int,input().split()))
s = int(str(a[0]) + str(a[1]))
for i in range(s):
    if s == i**2:
        print("Yes")
        exit()
print("No")

Buggy python submission (verdict: Runtime Error):
a = input()
s = 0
for i in range(int(a[0]+a[2]+a[3])+1):
    if int(a[0]+a[2]+a[3]) == i**2:
        s += 1
        break
if s == 1:
    print("Yes")
else:
    print("No")


Fixed submission:
a = list(map(int,input().split()))
s = int(str(a[0]) + str(a[1]))
for i in range(s):
    if s == i**2:
        print("Yes")
        exit()
print("No")

Buggy python submission (verdict: Runtime Error):
a = input()
print(int(a[0]+a[2]+a[3]))
s = 0
for i in range(int(a[0]+a[2]+a[3])+1):
    if int(a[0]+a[2]+a[3]) == i**2:
        s += 1
        break
if s == 1:
    print("Yes")
else:
    print("No")


Fixed submission:
a = list(map(int,input().split()))
s = int(str(a[0]) + str(a[1]))
for i in range(s):
    if s == i**2:
        print("Yes")
        exit()
print("No")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, raw_input().split())
s = list(raw_input())
s[k] = s[k].lower()
ans = ""
for i in s:
  ans = ans + i
print ans

Fixed submission:
n, k = map(int, raw_input().split())
s = list(raw_input())
s[k - 1] = s[k - 1].lower()
ans = ""
for i in s:
  ans = ans + i
print ans
Buggy python submission (verdict: Runtime Error):
data = input()
[A, B, T] = data.split(" ")
biscuits = 0
time = 0
while time < int(T) + 0.5:
  biscuits = biscuits + int(B)
  time = time + int(A)
print biscuits

Fixed submission:
[A, B, T] = map(int, raw_input().split())
biscuits = 0
time = 0
while time < (T + 0.5 - A):
  biscuits = biscuits + B
  time = time + A
print biscuits
Buggy python submission (verdict: Runtime Error):
def gcd(x, y):
  while(y): 
       x, y = y, x % y   
  return x 

def solve():
  n = 3
  a = [7, 6, 8]
  left = [0] * n + 1
  right = [0] * n + 1
  for i in range(1,n + 1):
    left[i] = gcd(left[i - 1], a[i - 1])
  for i in range(n - 1, 0, -1):
    right[i] = gce(right[i + 1], a[i])
  max_gcd = 0
  for i range(n):
    max_gcd = max(max_gcd, gcd(left[i], right[i]))
  print max_gcd
        
if __name__ == '__main__':
    solve()

Fixed submission:
def gcd(x, y):
  while(y): 
       x, y = y, x % y   
  return x 

def solve():
  n = int(raw_input())
  a = map(int, raw_input().split())
  left = [0] * (n + 1)
  right = [0] * (n + 1)
  for i in range(1,n + 1):
    left[i] = gcd(left[i - 1], a[i - 1])
  for i in range(n - 1, 0, -1):
    right[i] = gcd(right[i + 1], a[i])
  max_gcd = 0
  for i in range(n):
    max_gcd = max(max_gcd, gcd(left[i], right[i + 1]))
  print max_gcd
        
if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
a = map(int, raw_input().split())

memo = dict()
def dp(pos, flag):
  if pos == n - 1:
    if flag == 0:
      return a[pos]
    else:
      return -a[pos]
  if (pos, flag) in memo:
    return memo[(pos, flag)]
  elif flag == 0:
    memo[(pos, flag)] = max(dp(pos + 1, 0) + a[pos], dp(pos + 1, 1) - a[pos])
    return memo[(pos, flag)]
  else:
    memo[(pos, flag)] = max(dp(pos + 1, 0) - a[pos], dp(pos + 1, 1) + a[pos])
    return memo[(pos, flag)]
print dp(0, 0)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

n = int(raw_input())
a = map(int, raw_input().split())

memo = dict()
def dp(pos, flag):
  if pos == n - 1:
    if flag == 0:
      return a[pos]
    else:
      return -a[pos]
  if (pos, flag) in memo:
    return memo[(pos, flag)]
  elif flag == 0:
    memo[(pos, flag)] = max(dp(pos + 1, 0) + a[pos], dp(pos + 1, 1) - a[pos])
    return memo[(pos, flag)]
  else:
    memo[(pos, flag)] = max(dp(pos + 1, 0) - a[pos], dp(pos + 1, 1) + a[pos])
    return memo[(pos, flag)]
print dp(0, 0)

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
a = map(int, raw_input().split())

memo = dict()
def dp(pos, flag):
  if pos == n - 1:
    if flag == 0:
      return a[pos]
    else:
      return -a[pos]
  if (pos, flag) in memo:
    return memo[(pos, flag)]
  elif flag == 0:
    memo[(pos, flag)] = max(dp(pos + 1, 0) + a[pos], dp(pos + 1, 1) - a[pos])
  else:
    memo[(pos, flag)] = max(dp(pos + 1, 0) - a[pos], dp(pos + 1, 1) + a[pos])
  return memo[(pos, flag)]

print dp(0, 0)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

n = int(raw_input())
a = map(int, raw_input().split())

memo = dict()
def dp(pos, flag):
  if pos == n - 1:
    if flag == 0:
      return a[pos]
    else:
      return -a[pos]
  if (pos, flag) in memo:
    return memo[(pos, flag)]
  elif flag == 0:
    memo[(pos, flag)] = max(dp(pos + 1, 0) + a[pos], dp(pos + 1, 1) - a[pos])
    return memo[(pos, flag)]
  else:
    memo[(pos, flag)] = max(dp(pos + 1, 0) - a[pos], dp(pos + 1, 1) + a[pos])
    return memo[(pos, flag)]
print dp(0, 0)

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
a = map(int, raw_input().split())
dp = [[0, float('inf')]] * N

for i in range(n):
  dp[i + 1, 0] = max(dp[i, 0] + a[i], dp[i, 1] - a[i])
  dp[i + 1, 1] = max(dp[i, 0] - a[i], dp[i, 1] + a[i])
print dp[n - 1, 0]
    

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

n = int(raw_input())
a = map(int, raw_input().split())

memo = dict()
def dp(pos, flag):
  if pos == n - 1:
    if flag == 0:
      return a[pos]
    else:
      return -a[pos]
  if (pos, flag) in memo:
    return memo[(pos, flag)]
  elif flag == 0:
    memo[(pos, flag)] = max(dp(pos + 1, 0) + a[pos], dp(pos + 1, 1) - a[pos])
    return memo[(pos, flag)]
  else:
    memo[(pos, flag)] = max(dp(pos + 1, 0) - a[pos], dp(pos + 1, 1) + a[pos])
    return memo[(pos, flag)]
print dp(0, 0)
Buggy python submission (verdict: Runtime Error):
nums = map(int, raw_input())
a = max(nums)
b = min(nums)
ans = a + max(a - 1, b)
print ans

Fixed submission:
nums = map(int, raw_input().split())
a = max(nums)
b = min(nums)
ans = a + max(a - 1, b)
print ans

Buggy python submission (verdict: Runtime Error):
nums = map(int, raw_input().split(""))
print sum(nums)

Fixed submission:
nums = map(int, raw_input().split())
a = max(nums)
b = min(nums)
ans = a + max(a - 1, b)
print ans
Buggy python submission (verdict: Runtime Error):
n,k = [ int(i) for i in input().split(" ") ]
s = input()
print(s[:k] + s[k].lower() + s[k+1:])

Fixed submission:
n,k = [ int(i) for i in input().split(" ") ]
s = input()
print(s[:k-1] + s[k-1].lower() + s[k:])
Buggy python submission (verdict: Runtime Error):
import collections
import math

n, p = [int(i) for i in input().split()]
d = collections.defaultdict(lambda: 0)

def bunkai(q):
	if q == 1:
		return 0
	for i in range(2, math.ceil(math.sqrt(p))):
		if q % i == 0:
			d[i] += 1
			return bunkai(q//i)

if n == 1 or p == 1:
	print(p)
else:
	bunkai(p)
	ans = 1

	for j in d.key
		k = d[j]
		if k // n >= 1:
			ans *= j**(k//n)
	print(ans)


Fixed submission:
import collections
import math

n, p = [int(i) for i in input().split()]
d = collections.defaultdict(lambda: 0)

def bunkai(q):
	if q == 1:
		return 0
	for i in range(2, math.ceil(math.sqrt(p))):
		if q % i == 0:
			d[i] += 1
			return bunkai(q//i)

if n == 1 or p == 1:
	print(p)
else:
	bunkai(p)
	ans = 1

	for j in d.keys():
		k = d[j]
		if k // n >= 1:
			ans *= j**(k//n)
	print(ans)

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

n, p = [int(i) for i in input().split()]
d = collections.defaultdict(lambda: 0)

def bunkai(q):
	if q == 1:
		return 0
	for i in range(2,p):
		if q % i == 0:
			d[i] += 1
			return bunkai(q//i)

if n == 1 or p == 1:
	print(p)
else:
	bunkai(p)
	ans = 1

	for j in d.keys():
		k = d[j]
		if k // n >= 1:
			ans *= j**(k//n)
	print(ans)



Fixed submission:
import collections
import math

n, p = [int(i) for i in input().split()]
d = collections.defaultdict(lambda: 0)

def bunkai(q):
	if q == 1:
		return 0
	for i in range(2, math.ceil(math.sqrt(p))):
		if q % i == 0:
			d[i] += 1
			return bunkai(q//i)

if n == 1 or p == 1:
	print(p)
else:
	bunkai(p)
	ans = 1

	for j in d.keys():
		k = d[j]
		if k // n >= 1:
			ans *= j**(k//n)
	print(ans)
Buggy python submission (verdict: Runtime Error):
n, x = [int(i) for i in input().split()]

def tlen(L):
    l = 1
    for i in range(1, L):
        l = l*2 + 3
    return l

def tpat(L):
    p = 1
    for i in range(1, L):
        p = p*2 + 1
    return p

def maisu(n, x):
    tl = tlen(n)
    if x == 1:
        return(0)
    elif n == 1:
        b = "bpppb"
        b = b[:x]
        return(b.count(p))
    elif 2 <= x <= 1+tl-1:
        return(maisu(n-1, x-1))
    elif x == 1+tl:
        return(tpat(n))
    elif x == 2+tl:
        return(tpat(n)+1)
    elif tl+3 <= x <= 1+tl*2:
        return(tpat(n)+1+maisu(n-1,x-2-tl))
    else:
        return(tpat(n)*2+1)  

print(maisu(n,x))

Fixed submission:
n, x = [int(i) for i in input().split()]

def tlen(L):
    l = 1
    for i in range(1, L):
        l = l*2 + 3
    return l

def tpat(L):
    p = 1
    for i in range(1, L):
        p = p*2 + 1
    return p

def maisu(n, x):
    tl = tlen(n)
    if x == 1:
        return(0)
    elif n == 1:
        b = "bpppb"
        b = b[:x]
        return(b.count("p"))
    elif 2 <= x <= 1+tl-1:
        return(maisu(n-1, x-1))
    elif x == 1+tl:
        return(tpat(n))
    elif x == 2+tl:
        return(tpat(n)+1)
    elif tl+3 <= x <= 1+tl*2:
        return(tpat(n)+1+maisu(n-1,x-2-tl))
    else:
        return(tpat(n)*2+1)  

print(maisu(n,x))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [[int(i) for i in input().split()] for j in range(N)]
SS = sorted(S,key=lambda x: x[2], reverse=True)

#(x, y)を(0,0)から(100,100)まで試す
def firstlook(si, kohod): 
    for x in range(0, 100+1):
        for y in range(0, 100+1):
            h = si[2]+abs(si[0]-x)+abs(si[1]-y)
            kohod[(x,y)] = h
    return kohod

def lastlook(si, kohod):
    for (x, y) in list(kohod.keys()):
        h = max((si[2]+abs(si[0]-x)+abs(si[1]-y)),0)
        if kohod[(x,y)] != h:
            del kohod[(x,y)]
    return kohod

anspre = firstlook(SS[0], dict())
for Si in SS:
    ans = lastlook(Si, anspre)

[xy] = list(ans.keys())
print(str(xy[0]) + " " + str(xy[1]) + " "+ str(ans[xy]))

Fixed submission:
N = int(input())
S = [[int(i) for i in input().split()] for j in range(N)]
SS = sorted(S,key=lambda x: x[2], reverse=True)

#(x, y)を(0,0)から(100,100)まで試す
def firstlook(si, kohod): 
    for x in range(0, 100+1):
        for y in range(0, 100+1):
            h = si[2]+abs(si[0]-x)+abs(si[1]-y)
            kohod[(x,y)] = h
    return kohod

def lastlook(si, kohod):
    for (x, y) in list(kohod.keys()):
        h = max(kohod[(x,y)]-abs(si[0]-x)-abs(si[1]-y),0)
        if si[2] != h:
            del kohod[(x,y)]
    return kohod

ans = firstlook(SS[0], dict())
for Si in SS[1:]:
    ans = lastlook(Si, ans)

[xy] = list(ans.keys())
print(str(xy[0]) + " " + str(xy[1]) + " "+ str(ans[xy]))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [[int(i) for i in input().split()] for j in range(N)]
SS = sorted(S,key=lambda x: x[2], reverse=True)

#(x, y)を(0,0)から(100,100)まで試す
def firstlook(si, kohod): 
    for x in range(0, 100+1):
        for y in range(0, 100+1):
            h = max((si[2]+abs(si[0]-x)+abs(si[1]-y)),0)
            kohod[(x,y)] = h
    return kohod

def lastlook(si, kohod):
    for (x, y) in list(kohod.keys()):
        h = max((si[2]+abs(si[0]-x)+abs(si[1]-y)),0)
        if kohod[(x,y)] != h:
            del kohod[(x,y)]
    return kohod

anspre = firstlook(SS[0], dict())
for Si in SS:
    ans = lastlook(Si, anspre)

[xy] = list(ans.keys())
print(str(xy[0]) + " " + str(xy[1]) + " "+ str(ans[xy]))

Fixed submission:
N = int(input())
S = [[int(i) for i in input().split()] for j in range(N)]
SS = sorted(S,key=lambda x: x[2], reverse=True)

#(x, y)を(0,0)から(100,100)まで試す
def firstlook(si, kohod): 
    for x in range(0, 100+1):
        for y in range(0, 100+1):
            h = si[2]+abs(si[0]-x)+abs(si[1]-y)
            kohod[(x,y)] = h
    return kohod

def lastlook(si, kohod):
    for (x, y) in list(kohod.keys()):
        h = max(kohod[(x,y)]-abs(si[0]-x)-abs(si[1]-y),0)
        if si[2] != h:
            del kohod[(x,y)]
    return kohod

ans = firstlook(SS[0], dict())
for Si in SS[1:]:
    ans = lastlook(Si, ans)

[xy] = list(ans.keys())
print(str(xy[0]) + " " + str(xy[1]) + " "+ str(ans[xy]))
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
v = [int(i) for i in input().split()]

dummy = (-1, -1)
(av1, ak1), (av2, ak2) = (collections.Counter(v[::2]).most_common(2) + dummy)[:2]
(bv1, bk1), (bv2, bk2) = (collections.Counter(v[1::2]).most_common(2) + dummy)[:2]

if av1 != bv1:
    print(n-ak1-bk1)
elif ak1 < bk1:
    print(n-ak2-bk1)
else:
    print(n-ak1-bk2)

Fixed submission:
n = int(input())
v = [int(i) for i in input().split()]

a, b = dict(), dict()
for i in range(n):
    if i%2 == 0:
        a[v[i]] = a.get(v[i], 0) + 1
    else:
        b[v[i]] = b.get(v[i], 0) + 1
alst = sorted(list(a.items()), key=lambda x: x[1], reverse=True)
blst = sorted(list(b.items()), key=lambda x: x[1], reverse=True)

if alst[0][0] != blst[0][0]:
    print(n-alst[0][1]-blst[0][1])
elif len(alst) == 1 and len(blst) == 1:
    print(blst[0][1])    
elif len(alst) == 1:
    print(n-alst[0][1]-blst[1][1])
elif len(blst) == 1:
    print(n-alst[1][1]-blst[0][1])
elif blst[0][1]+alst[1][1] > alst[0][1]+blst[1][1]:
    print(n-alst[1][1]-blst[0][1])
else:
    print(n-alst[0][1]-blst[1][1])
Buggy python submission (verdict: Runtime Error):
s = input()
slen = len(s)

kotae = 0
for i in range(2**(slen-1)):
    for j in range(slen-1):
        if i & 1<<j:
            si = si[:slen-j]+"+"+si[slen-j:]
        else:
            pass
    kotae += eval(si)

print(kotae)

Fixed submission:
s = input()
slen = len(s)

def keisan(s):
    smod = s
    wa = 0
    while smod.count("+") != 0:
        wa += int(smod[:smod.index("+")])
        smod = smod[smod.index("+")+1:]
    wa += int(smod)
    return wa

kotae = 0
for i in range(2**(slen-1)):
    ibin = bin(i)[2:]
    si = s
    for j in range(1, len(ibin)+1):
        if ibin[-j] == "1":
            si = si[:slen-j]+"+"+si[slen-j:]
        else:
            pass
    kotae += keisan(si)

print(kotae)
Buggy python submission (verdict: Runtime Error):
def isM(s):
    return 1<=int(s)<=12

if __name__ == '__main__':
    input = sys.stdin.read()
    F, S = input[:2], input[2:]
    if isM(F) and not isM(S): print "MMYY"
    elif not isM(F) and isM(S): print "YYMM"
    elif isM(F) and isM(S): print "AMBIGUOUS"
    else: print 'NA'

Fixed submission:
import sys

def isM(s):
    if (s[0] == '0' and '1'<=s[1]<='9' ) or \
        (s[0] == '1' and s[1] in ('0', '1', '2')):
        return True
    return False

if __name__ == '__main__':
    input = sys.stdin.read()
    F, S = input[:2], input[2:]
    if isM(F) and not isM(S): print "MMYY"
    elif not isM(F) and isM(S): print "YYMM"
    elif isM(F) and isM(S): print "AMBIGUOUS"
    else: print 'NA'
Buggy python submission (verdict: Runtime Error):
# cook your dish here
import math
        
n,k=map(int,input().split())
summ=0
for i in range(1,n+1):
    if k/i<=1:
        value=0
    elif abs((math.log(k)-math.log(i))//math.log(2)-(math.log(k)-math.log(i))/math.log(2))<=0.00001:
        value = (math.log(k)-math.log(i))//math.log(2)
    else:
        value = (math.log(k)-math.log(i))//math.log(2)+1    
    else:
        value=math.log(k)-math.log(i)
    po=(0.5)**value
    summ+=po
    
summ=summ/n
print('{0:.12f}'.format(summ))

Fixed submission:
# cook your dish here
n,k=map(int,input().split())
s=input()
a=""
for i in range(n):
    if i==k-1:
        a+=(s[i].lower())
    else:
        a+=s[i]
print(a)