Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n, q = [ int(v) for v in input().split() ]
s = input()
ac_list = [ 0 for i in range(n-1) ]
for i in range(n-1):
	if s[i:i+2] == "AC":
		ac_list[i] += 1


for i in range(q):
	l, r = [ int(v) for v in input().split() ]
	print(sum(ac_list[l-1:r-1]))

Fixed submission:
import bisect
import sys
input = sys.stdin.readline
n, q = [ int(v) for v in input().split() ]
s = input()
ac_list = []

for i in range(n-1):
	if s[i:i+2] == "AC":
		ac_list.append(i)


for i in range(q):
	l, r = [ int(v) for v in input().split() ]
	a = (bisect.bisect_left(ac_list, l-1))
	b = (bisect.bisect_right(ac_list, r-2))
	print(b-a)

Buggy python submission (verdict: Time Limit Exceeded):

n, q = [ int(v) for v in input().split() ]
s = input()
ac_list = [ 0 for i in range(n-1) ]
for i in range(n-1):
	if s[i:i+2] == "AC":
		ac_list[i] += 1


for i in range(q):
	l, r = [ int(v) for v in input().split() ]
	print(sum(ac_list[l-1:r-1]))

Fixed submission:
import bisect
import sys
input = sys.stdin.readline
n, q = [ int(v) for v in input().split() ]
s = input()
ac_list = []

for i in range(n-1):
	if s[i:i+2] == "AC":
		ac_list.append(i)


for i in range(q):
	l, r = [ int(v) for v in input().split() ]
	a = (bisect.bisect_left(ac_list, l-1))
	b = (bisect.bisect_right(ac_list, r-2))
	print(b-a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans_list = [ 1 for i in range(n) ]

color_list = [ -1 for i in range(10**5)] 
for i in range(n):
    color = int(input()) - 1

    if color_list[color] not in [-1,i-1]:
        ans_list[i] = ans_list[i-1] + ans_list[color_list[color]]
    else:
        ans_list[i] = ans_list[i-1]
    ans_list[i] %= 10**9+7

    color_list[color] = i
print(ans_list[-1])

Fixed submission:

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

color_list = [ -1 for i in range(2*(10**5))] 
for i in range(n):
    color = int(input()) - 1

    if color_list[color] not in [-1,i-1]:
        ans_list[i] = ans_list[i-1] + ans_list[color_list[color]]
    else:
        ans_list[i] = ans_list[i-1]
    ans_list[i] %= 10**9+7

    color_list[color] = i
print(ans_list[-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans_list = [ 1 for i in range(n) ]

color_list = [ [0,-1] for i in range(10**5)] 
for i in range(n):
    color = int(input()) - 1

    if color_list[color][0] > 0 and color_list[color][1] not in [i-1,-1]:
        ans_list[i] = ans_list[i-1] + ans_list[color_list[color][1]]
    else:
        ans_list[i] = ans_list[i-1]
    ans_list[i] %= 10**9+7
    
    color_list[color][0] += 1
    color_list[color][1] = i
print(ans_list[-1])

Fixed submission:

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

color_list = [ -1 for i in range(2*(10**5))] 
for i in range(n):
    color = int(input()) - 1

    if color_list[color] not in [-1,i-1]:
        ans_list[i] = ans_list[i-1] + ans_list[color_list[color]]
    else:
        ans_list[i] = ans_list[i-1]
    ans_list[i] %= 10**9+7

    color_list[color] = i
print(ans_list[-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans_list = [ 1 for i in range(n) ]

color_list = [ [0,-1] for i in range(10**5)] 
for i in range(n):
    color = int(input()) - 1
    color_list[color][0] += 1
    if color_list[color][0] > 0 and color_list[color][1] not in [i-1,-1]:
        ans_list[i] = ans_list[i-1] + ans_list[color_list[color][1]]
    else:
        ans_list[i] = ans_list[i-1]
    ans_list[i] %= 10**9+7
    color_list[color][1] = i
print(ans_list[-1])

Fixed submission:

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

color_list = [ -1 for i in range(2*(10**5))] 
for i in range(n):
    color = int(input()) - 1

    if color_list[color] not in [-1,i-1]:
        ans_list[i] = ans_list[i-1] + ans_list[color_list[color]]
    else:
        ans_list[i] = ans_list[i-1]
    ans_list[i] %= 10**9+7

    color_list[color] = i
print(ans_list[-1])
Buggy python submission (verdict: Runtime Error):
s = input()

print(abs(s.count("1")-abs(s.count("0")))

Fixed submission:
s = input()
	
print(min(s.count("1"),s.count("0"))*2)
Buggy python submission (verdict: Runtime Error):
s = input()
total_1_list = [ [ 0 for i in range(10) ]  for j in range(10)]

for i in range(1,10):
    total_1_list[0][i] = 1
total_1 = 0
for i in range(1,10):
    base_1 = 1 + i * ( 10 ** (i-1) )
    total_1_list[i][1] = base_1
    base_9 = ( 10 + (9 * i) ) * 10 ** (i-1)
    for j in range(2,10):
        total_1_list[i][j] = base_9 - (i * (10 ** (i-1) ) ) * (9-j) 

ans = 0
for i in range(len(s)):
    a = int(s[::-1][i])
    if i != 0  and a == 1:
        ans += int(s[len(s)-i:])
    ans += total_1_list[i][a]
print(ans)

Fixed submission:
def star(x):
    return x*(x-1)//2

def root(x):
    compress_node = []
    while parent_list[x] != x:
        compress_node.append(x)
        x = parent_list[x]   
    for i in compress_node:
        parent_list[i] = x
    return x


n, m = [ int(v) for v in input().split() ]
bridge_list = [ [ int(v)-1 for v in input().split() ] for i in range(m) ]
bridge_list.reverse()
parent_list = [ i for i in range(n) ]
connect_list = [ 1 for i in range(n) ]
total_inconvinience = star(n)
ans_list = [total_inconvinience]

for i in bridge_list:
    a, b = i
    ra, rb = root(a), root(b)
    if ra != rb:
        parent_list[ra] = rb
        rc = connect_list[rb]
        connect_list[rb] += connect_list[ra]
        total_inconvinience -= star(connect_list[rb]) - star(connect_list[ra]) - star(rc)
        connect_list[ra] = 0
    ans_list.append(total_inconvinience)

ans_list = ans_list[:-1]
ans_list.reverse()
for i in ans_list:
    print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
stpo = 0
num_list = []
while stop == 0:
  if n in num_list:
    stop = 1
    print(num_list.index(n)+1)
  else:
    num_list.append(n)
    if n % 2 == 0:
      n //= 2
    else:
      n = 3 * n + 1

Fixed submission:
n = int(input())
stop = 0
num_list = []
while stop == 0:
	if n in num_list:
		stop = 1
		print(num_list.index(n)+4)
	else:
		num_list.append(n)
		if n % 2 == 0:
			n //= 2
		else:
			n = 3 * n + 1
Buggy python submission (verdict: Time Limit Exceeded):
mod = 10**9+7
n, k = [ int(v) for v in input().split() ]
a_list = [ int(v) for v in input().split() ]

dp_list = [ 0 for i in range(k+1) ]
dp_list[0] = 1

for i in range(n):
    new_dp_list = [ 0 for i in range(k+1) ]
    for j in range(k+1):
        for h in range(a_list[i]+1):
            if j+h <= k:
                new_dp_list[j+h] += dp_list[j]
    dp_list = [ i % mod for i in new_dp_list ]

print(dp_list[-1])

Fixed submission:
def cumsum(inlist):
    s = 0
    outlist = [0]
    for i in inlist:
        s += i
        outlist.append(s)
    return outlist

mod = 10**9+7
n, k = [ int(v) for v in input().split() ]
a_list = [ int(v) for v in input().split() ]

dp_list = [ 0 for i in range(k+1) ]
dp_list[0] = 1

for i in range(n):
    cum_dp_list = cumsum(dp_list)

    new_dp_list = [ 0 for i in range(k+1) ]
    for j in range(k+1):
        r = min(j+1,k+1)
        l = max(0,j-a_list[i]) 
        new_dp_list[j] = cum_dp_list[r] - cum_dp_list[l]
    dp_list = [ i % mod for i in new_dp_list ]

print(dp_list[-1])
Buggy python submission (verdict: Runtime Error):
a, b, c = [ list(input()) for i in range(h) ]
print(b+min(c,a+b))

Fixed submission:
a, b, c = [ int(v) for v in input().split() ]
print(b+min(c,a+b+1))
Buggy python submission (verdict: Runtime Error):
n = int(input)
present_list = [0]*n
for i in range(n):
	present_list[i] = int(input())

print(sum(present_list)-present_list[-1]//2)


Fixed submission:
n = int(input())
present_list = [0]*n
for i in range(n):
	present_list[i] = int(input())
present_list = sorted(present_list)
print(sum(present_list)-present_list[-1]//2)

Buggy python submission (verdict: Runtime Error):
n = int(input)

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

print(sum(present_list)-present_list[-1]//2)

Fixed submission:
n = int(input())
present_list = [0]*n
for i in range(n):
	present_list[i] = int(input())
present_list = sorted(present_list)
print(sum(present_list)-present_list[-1]//2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
flame_list = [ int(v) for v in input().split() ]

mean = sum(flame_list)

if mean % 2 == 0:
  print(flame_list.index(mean//2))
else:
  print(min(flame_list.index((mean-1)//2),flame_list.index((mean+1)//2)))

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

mean = sum(flame_list)/n

flame_list_2 = [ abs(mean - i) for i in flame_list ]


print(flame_list_2.index(min(flame_list_2)))
Buggy python submission (verdict: Runtime Error):
    n = int(input())
    t, a = [ int(v) for v in input().split() ]
    height_list = [ abs(t-a-int(V)*0.006) for v in input().split() ]
    print(height_list.index(min(height_list))+1)

Fixed submission:
n = int(input())
t, a = [ int(v) for v in input().split() ]
height_list = [ abs(t-a-int(v)*0.006) for v in input().split() ]
print(height_list.index(min(height_list))+1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
t, a = [ int(v) for v in input().split() ]
height_list = [ abs(t-a-int(V)*0.006) forfor v in input().split() ]
print(height_list.index(min(height_list))+1)


Fixed submission:
n = int(input())
t, a = [ int(v) for v in input().split() ]
height_list = [ abs(t-a-int(v)*0.006) for v in input().split() ]
print(height_list.index(min(height_list))+1)
Buggy python submission (verdict: Runtime Error):
a, b, k = [ int(v) for v in input().split() ]

for i in range(k):
  if i % 2 == 0:
  	a = a // 2
    b += a // 2
  else:
    a += b // 2
    b = b // 2
print(a,b)

Fixed submission:

a, b, k = [ int(v) for v in input().split() ]
	
for i in range(k):
	if i % 2 == 0:
		b += a // 2
		a = a // 2
		
	else:
		a += b // 2
		b = b // 2
print(a,b)
Buggy python submission (verdict: Runtime Error):
s = list(input())
for i in range(s):
  if s[i] == "1":
    s[i] = "9"
  elif s[i] == "9":
    s[i] = "1"


print("".join(s))

Fixed submission:
s = list(input())
for i in range(len(s)):
  if s[i] == "1":
    s[i] = "9"
  elif s[i] == "9":
    s[i] = "1"


print("".join(s))
Buggy python submission (verdict: Runtime Error):
n, m, x, y = [ int(v) for v in input().split() ]
xmax = sorted([ int(v) for v in input().split() ] + [x])
ymin = sorted([ int(v) for v in input().split() ] + [y])
ans = "War
if xmax < ymin:
  ans = "No War"
print(ans)

Fixed submission:
n, m, x, y = [ int(v) for v in input().split() ]
xmax = max(sorted([ int(v) for v in input().split() ] + [x]))
ymin = min(sorted([ int(v) for v in input().split() ] + [y]))
ans = "War"
if xmax < ymin:
  ans = "No War"
print(ans)
Buggy python submission (verdict: Runtime Error):
n, x = [ int(v) for v in input().split() ]
candy_list = sorted([ int(v) for v in input().split() ])
candy_list_2 = cumsum(candy_list)

if sum(candy_list) <= x:
    print(n)
else:
    for i in range(n):
        if candy_list_2[i] > x:
            print(i)
            break 


Fixed submission:
def cumsum(inlist):
    s = 0
    outlist = []
    for i in inlist:
        s += i
        outlist.append(s)
    return outlist

n, x = [ int(v) for v in input().split() ]
candy_list = sorted([ int(v) for v in input().split() ])
candy_list_2 = cumsum(candy_list)

ans = 0
for i in range(n):
    if i != n-1 and candy_list_2[i] <= x:
        ans += 1
    elif i == n-1 and candy_list_2[i] == x:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = [ int(v) for v in input().split() ]
coordinate_list = sorted([ int(v) for v in input().split() ]) 

def fire(inlist):
    if inlist[0] * inlist[-1] >= 0:
        r = max(abs(inlist[0]),abs(inlist[-1]))
    else:
        r = abs(inlist[0]) + abs(inlist[-1]) + min(abs(inlist[0]),abs(inlist[-1]))
    return r

ans = 10**14
for i in range(n-k+1):
    
    ans = min(fire(coordinate_list[i:i+k]),ans)
print(ans)

Fixed submission:
n, k = [ int(v) for v in input().split() ]
coordinate_list = sorted([ int(v) for v in input().split() ]) 

def fire(a,b):
    if a * b >= 0:
        r = max(abs(a),abs(b))
    else:
        r = abs(a) + abs(b) + min(abs(a),abs(b))
    return r

ans = 10**14
for i in range(n-k+1):
    ans = min(fire(coordinate_list[i],coordinate_list[i+k-1]),ans)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = [ int(v) for v in input().split() ]
coordinate_list = sorted([ int(v) for v in input().split() ]) 

def fire(inlist):
    if inlist[0] * inlist[-1] >= 0:
        r = max(abs(inlist[0]),abs(inlist[-1]))
    else:
        r = abs(inlist[0]) + abs(inlist[-1]) + min(abs(inlist[0]),abs(inlist[-1]))
    return r

ans = 10**14
for i in range(n-k+1):
    
    ans = min(fire(coordinate_list[i:i+k]),ans)
print(ans)

Fixed submission:
n, k = [ int(v) for v in input().split() ]
coordinate_list = sorted([ int(v) for v in input().split() ]) 

def fire(a,b):
    if a * b >= 0:
        r = max(abs(a),abs(b))
    else:
        r = abs(a) + abs(b) + min(abs(a),abs(b))
    return r

ans = 10**14
for i in range(n-k+1):
    ans = min(fire(coordinate_list[i],coordinate_list[i+k-1]),ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
print((int(input())-1)*(int(input())-1))

Fixed submission:

a, b = [ int(v) for v in input().split() ]
print((a-1)*(b-1))
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

for i in range(len(s)):
	if s[i] != "1":
		f = i+1
		break

if k < f:
	print(1)
else:
	print(s[i])


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

for i in range(len(s)):
	f = i+1
	if s[i] != "1":
		break

if k < f:
	print(1)
else:
	print(s[i])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

for i in range(len(s)):
	if s[i] != "1":
		f = i+1
		break

if k < f:
	print(1)
else:
	print(s[i])


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

for i in range(len(s)):
	f = i+1
	if s[i] != "1":
		break

if k < f:
	print(1)
else:
	print(s[i])
Buggy python submission (verdict: Runtime Error):
ans = "WA"
s = list(input())
if s[0] == "A":
  if s[2:-1].count("C") == 1:
    c = s[2:-1].index("C")
    if all([ list[i].islower() for i in range(1,len(s)) if i != c]):
      ans = "AC"
print(ans)

Fixed submission:

ans = "WA"
s = list(input())
if s[0] == "A":
  if s[2:-1].count("C") == 1:
    c = s[2:-1].index("C")+2

    if all([ s[i].islower() for i in range(1,len(s)) if i != c]):
      ans = "AC"

print(ans)
Buggy python submission (verdict: Runtime Error):
def total(inlist,k):
    print(sum([ abs(i-k) for i in inlist ]))
    return
n = int(input())
a_list = [ int(v) for v in input().split() ]
a_list = [ v-i for i, v in enumerate(a_list,1) ]
a_list.sort()

total(a_list,a_list[n//2])ｖ

Fixed submission:
def total(inlist,k):
    print(sum([ abs(i-k) for i in inlist ]))
    return
n = int(input())
a_list = [ int(v) for v in input().split() ]
a_list = [ v-i for i, v in enumerate(a_list,1) ]
a_list.sort()

total(a_list,a_list[n//2])

Buggy python submission (verdict: Runtime Error):
n = int(input())

num_list = [ int(v) for v in input().split() ]
num_list = [ num_list[i] - (i+1) for i in range(n) ]
median_u = num_list[(n//2)+1]
median_d = num_list[n//2]

d_list = [i-median_u for i in num_list]
u_list = [i-median_d for i in num_list]

print(min(sum(map(abs,d_list)),sum(map(abs,u_list))))

Fixed submission:
def total(inlist,k):
    print(sum([ abs(i-k) for i in inlist ]))
    return
n = int(input())
a_list = [ int(v) for v in input().split() ]
a_list = [ v-i for i, v in enumerate(a_list,1) ]
a_list.sort()

total(a_list,a_list[n//2])
Buggy python submission (verdict: Runtime Error):
n = int(input())
blue_list = [ input() for i in range(n)]
m = int(input())
red_list = [ input() for i in range(m)]

card_list = list(set(blue_list+red_list))

point = 0

for i in card_list:
	point = max(point,blue_list.count(i)-red_list.count(i))

print(point)

Fixed submission:
n, k = [ int(v) for v in input().split() ]
a = (n-1)//(k-1)
b = (n-1)%(k-1)

if b != 0:
    a += 1
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n =int(input())
s = input()

ans = n
for i in range(n):
	ans = min((s[:i].count("W")+s[i+1:].count("E")),ans)
print(ans)

Fixed submission:

n =int(input())
s = input()


ans = n
if n < 10:
	for i in range(n):
		ans = min((s[:i].count("W")+s[i+1:].count("E")),ans)
else:
	change = (s[1:].count("E"))
	ans = change
	for i in range(1,n):

		t = 0
		if s[i-1] == "W":
			t += 1
		if s[i] == "E":
			t -= 1
		change += t
		ans = min(ans,change)

print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c = sorted([ int(v) for v in input().split() ])
n = int(input())
print(a+b+c*(2**k))

Fixed submission:
a, b, c = sorted([ int(v) for v in input().split() ])
k = int(input())
print(a+b+c*(2**k))
Buggy python submission (verdict: Runtime Error):

n = int(input())
num_list = sorted([ int(v) for v in input().split() ])

x = num_list[-1]
x_half = x / 2
y = bisect.bisect_left(num_list,x_half)
if y != 0:
    if y == n-1:
        y -= 1
    else:
        if abs(num_list[y] - x_half) >= abs(num_list[y-1] - x_half):
            y -= 1
print(x,num_list[y])

Fixed submission:
import bisect

n = int(input())
num_list = sorted([ int(v) for v in input().split() ])

x = num_list[-1]
x_half = x / 2
y = bisect.bisect_left(num_list,x_half)
if y != 0:
    if y == n-1:
        y -= 1
    else:
        if abs(num_list[y] - x_half) >= abs(num_list[y-1] - x_half):
            y -= 1
print(x,num_list[y])

Buggy python submission (verdict: Time Limit Exceeded):
import math
import bisect
def logcomp(n,m):
    if m in [0,n]:
        r = 1
    else:
        a = (sum(map(math.log,[i for i in range(max(n-m+1,m+1),n+1)])))
        b = (sum(map(math.log,[i for i in range(1,min(n-m+1,m+1))])))
        r = a-b
    return r



n = int(input())
num_list = sorted([ int(v) for v in input().split() ])


for i in range(1,n):
    x = num_list[i]
    y = bisect.bisect_left(num_list,x/2)
    if y == i:
        z = logcomp(x,num_list[y-1])
        w = num_list[y-1]
    else:
        if abs(num_list[y]-(x/2)) <= abs(num_list[y+1]-(x/2)):
            z = logcomp(x,num_list[y])
            w = num_list[y]
        else:
            z = logcomp(x,num_list[y+1])
            w = num_list[y+1]
    if i == 1:
        ans = (x,w)
        max_z = z
    else:
        if max_z < z:
            max_z = z
            ans = (x,w)
print(*ans)


Fixed submission:
import bisect

n = int(input())
num_list = sorted([ int(v) for v in input().split() ])

x = num_list[-1]
x_half = x / 2
y = bisect.bisect_left(num_list,x_half)
if y != 0:
    if y == n-1:
        y -= 1
    else:
        if abs(num_list[y] - x_half) >= abs(num_list[y-1] - x_half):
            y -= 1
print(x,num_list[y])
Buggy python submission (verdict: Runtime Error):
print(min(int(input(),int(input()))+min(int(input(),int(input())))))

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):
print(min(int(input(),int(input()))+min(int(input(),int(input()))))

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):
print(min(int(input(),int(input()))+min(int(input(),int(input())))

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):
ans = "No"
if int(input()) + int(input()) >= int(input()):
  ans = "Yes"
print(ans)

Fixed submission:
ans = "No"
a, b, c = [ int(v) for v in input().split() ]
if a + b >= c:
  ans = "Yes"
print(ans)
Buggy python submission (verdict: Runtime Error):
    n = int(input())
     
    num_list = sorted([ int(v) for v in input().split() ],reverse = True)
     
    a_sum, b_sum = 0, 0
     
    for i in range(n):
      if i % 2 == 0:
        a_sum += num_list[i]
      else:
        b_sum += num_list[i]
     
    print(a_sum-b_sum)

Fixed submission:
n = int(input())

num_list = sorted([ int(v) for v in input().split() ])

a_sum, b_sum = 0, 0

for i in range(n):
  if i % 2 == 0:
    a_sum += num_list[i]
  else:
    b_sum += num_list[i]

print(abs(a_sum-b_sum))

Buggy python submission (verdict: Runtime Error):
n = int(input())

num_list = [ int(v) for v in input().split() ]

a_sum, b_sum = 0, 0

for i in range(n):
  if i % 2 == 0:
    a_sum += num_list[i]
  else:
    b_sum += num_list[i]

print(a-b)

Fixed submission:
n = int(input())

num_list = sorted([ int(v) for v in input().split() ])

a_sum, b_sum = 0, 0

for i in range(n):
  if i % 2 == 0:
    a_sum += num_list[i]
  else:
    b_sum += num_list[i]

print(abs(a_sum-b_sum))
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split(" "))
if (a * b) % 2 == 0:
  print("Even")
  else:
    print("Odd")

Fixed submission:
a,b = map(int, input().split(" "))
if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")
Buggy python submission (verdict: Runtime Error):

a, b =  [ v for v in input().split() ]

c = int(a+b)

if int(math.sqrt(c))**2 == c:
	print("Yes")
else:
	print("No")

Fixed submission:

a, b =  [ v for v in input().split() ]

c = int(a+b)

if int(c**0.5)**2 == c:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
n = input()
n1 = int(n)
n2 = int(sum(list(n)))

if n1 % n2 == 0:
  print("YES")
else:
  print("No")

Fixed submission:
n = input()
n1 = int(n)
n2 = int(sum([int(v) for v in list(n)]))

if n1 % n2 == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):

k, a, b = [ int(v) for v in input().split() ]

if a >= k:
    ans = 1
elif b > a:
    ans = -1
else:
    ans = 1 + ( ( k - b - 1 ) // (a - b) ) * 2
print(ans)

Fixed submission:
k, a, b = [ int(v) for v in input().split() ]

if a >= k:
    ans = 1
elif b >= a:
    ans = -1
else:
    ans = 1 + ( ( k - b - 1 ) // (a - b) ) * 2
print(ans)
Buggy python submission (verdict: Runtime Error):
import bisect
n, q = [ int(v) for v in input().split() ]

tree_list = [0] + [ (n**(i+1)-1) // (n-1) for i in range(100) if (n**(i+1)-1) // (n-1) <= 10**9 ]

def upward(a):
    d = bisect.bisect_left(tree_list,a) - 1
    outlist = []
    for i in range(d+1):
        outlist.append(a)
        if i < d:
            a -= tree_list[d-i] + 1
            a //= n
            a += tree_list[d-i-1] + 1
    return d, outlist

def lca(a,b):
    da, a_list = upward(a)
    db, b_list = upward(b)

    if da < db:
        da, db = db, da
        a_list, b_list = b_list, a_list
    s = da - db
    ans = None
    for i in range(db+1):
        if a_list[s+i] == b_list[i]:
            ans = a_list[s+i]
            break
    return ans



for i in range(q):
    v, w = [ int(v) for v in input().split() ]
    print(lca(v,w))


Fixed submission:
import bisect
n, q = [ int(v) for v in input().split() ]

if n != 1:
    tree_list = [0] + [ (n**(i+1)-1) // (n-1) for i in range(100) if (n**(i+1)-1) // (n-1) <= 10**9 ]

def upward(a):
    d = bisect.bisect_left(tree_list,a) - 1
    outlist = []
    for i in range(d+1):
        outlist.append(a)
        if i < d:
            a -= tree_list[d-i] + 1
            a //= n
            a += tree_list[d-i-1] + 1
    return d, outlist

def lca(a,b):
    da, a_list = upward(a)
    db, b_list = upward(b)

    if da < db:
        da, db = db, da
        a_list, b_list = b_list, a_list
    s = da - db
    ans = None
    for i in range(db+1):
        if a_list[s+i] == b_list[i]:
            ans = a_list[s+i]
            break
    return ans



for i in range(q):
    v, w = [ int(v) for v in input().split() ]
    if n != 1:
        print(lca(v,w))
    else:
        print(min(v,w))