Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
x = []
y = []
for i in range(a[1]):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)


for i in range(10**(a[0]-1),10**a[0]):
  s = str(i)
  flag = True
  for j in range(len(x)):
    if str(y[j]) != s[x[j]-4]:
      flag = False
      break
  if flag:
    break
      
#s = str(702)
#print(s[-1])
if flag:
  print(i)
else:
  print(-1)

Fixed submission:
a = list(map(int,input().split()))
x = []
y = []
for i in range(a[1]):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
 
#s = str(2)
#print(s[-1])

def start(n):
  if n == 1:
    return 0
  else:
    return 10**(n-1)
    
flag = False
for i in range(start(a[0]),10**a[0]):
  s = str(i)
  flag = True
  for j in range(len(x)):
    if str(y[j]) != s[x[j]-(a[0]+1)]:
      flag = False
      break
  if flag:
    break
      

if flag:
  print(i)
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

c = [0]*n
flag = 0
c[0] = a[0]
for i in range(n):
  for j in range(i):
    if c[j] == a[i]:
      flag = 1
      break
  if flag == 1:
    break
  else:
    c[i] = a[i]

#print(c)
if flag == 0:
  print("YES")
else:
  print("NO")
  

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

a.sort()
flag = 0

for i in range(n-1):
  if a[i] == a[i+1]:
    flag = 1
    break
    
if flag == 0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
a = list(map(int,input().split()))
p = list(map(int,input().split()))
n = a[0]
k = a[1]

#max_k = max(k)

sum_k = 0
max_i = 0
max_sum = 0
for i in range(n-k+1):
  sum_k = 0
  for j in range(i,i+k):
    sum_k += p[j]
  if max_sum < sum_k:
    max_sum = sum_k
    max_i = i

ans = 0
for i in range(k):
  ans += (p[max_i+i]+1)/2
   

print(ans)

Fixed submission:
a = list(map(int,input().split()))
p = list(map(int,input().split()))
n = a[0]
k = a[1]

E = [0]*(n+1)

sum_E = 0
max_E = 0

for i in range(1,n+1):
  sum_E += (p[i-1]+1)/2
  E[i] = sum_E

for i in range(n-k+1):
  #print(E[i+k] - E[i])
  if max_E < E[i+k] - E[i]:
    max_E = E[i+k] - E[i]
#print(E)
print(max_E)

Buggy python submission (verdict: Time Limit Exceeded):
a = list(map(int,input().split()))
p = list(map(int,input().split()))
n = a[0]
k = a[1]

sum_k = 0
max_i = 0
max_sum = 0
for i in range(n-k+1):
  sum_k = 0
  for j in range(i,i+k):
    sum_k += p[j]
  if max_sum < sum_k:
    max_sum = sum_k
    max_i = i

c = [0]*k
for i in range(k):
  c[i] = p[max_i+i]
    
#print(c)
ans = 0
for i in range(len(c)):
  n = c[i]+1
  for j in range(1,n):
    ans += j*(1/(n-1))

print(ans)

Fixed submission:
a = list(map(int,input().split()))
p = list(map(int,input().split()))
n = a[0]
k = a[1]

E = [0]*(n+1)

sum_E = 0
max_E = 0

for i in range(1,n+1):
  sum_E += (p[i-1]+1)/2
  E[i] = sum_E

for i in range(n-k+1):
  #print(E[i+k] - E[i])
  if max_E < E[i+k] - E[i]:
    max_E = E[i+k] - E[i]
#print(E)
print(max_E)
Buggy python submission (verdict: Time Limit Exceeded):
c = list(map(int,input().split()))
a = list(map(int,input().split()))

a.sort(reverse=True)
attack = 0
#print(min(c[1],c[0]))

for i in range(min(c[1],c[0])):
  a.pop(0)

#print(a)
for i in range(len(a)):
  attack += a[i]

print(attack)

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

a.sort()
attack = 0

for i in range(c[0]-c[1]):
  attack += a[i]

print(attack)

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

a.sort(reverse=True)
attack = 0
#print(min(c[1],c[0]))

for i in range(min(c[1],c[0])):
  a.pop(0)

#print(a)
for i in range(c[0]-c[1]):
  attack += a[i]

print(attack)

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

a.sort()
attack = 0

for i in range(c[0]-c[1]):
  attack += a[i]

print(attack)
Buggy python submission (verdict: Time Limit Exceeded):
h = int(input())

for i in range(10**12):
  h = h // 2
  if h == 1:
    break
    
#print(i+1)
ans = 0
for j in range(i+2):
  ans += 2**j
  
print(ans)

Fixed submission:
h = int(input())

if h >= 2:
  for i in range(10**12):
    h = h // 2
    if h == 1:
      break
  ans = 0
  for j in range(i+2):
    ans += 2**j
  
  print(ans)
else:
  print(h)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))

n = 0
for i in range(N):
  for j in range(0,i+1):
    #print(a[i],end=","),print(a[j])
    if a[i] > a[j]:
      #print("error")
      n += 1
      break

  
print(N-n)

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

Min = N+1
n = 0
for i in range(N):
  if Min > a[i]:
    Min = a[i]
    n += 1
  
print(n)
Buggy python submission (verdict: Runtime Error):
import math

s = input()
n = len(s)

l = math.floor(n/2)
if n % 2 == 0:
  k = l
else:
  k = l+1
  

s_f = s[:l]
s_r = s[k:]
j = 0

for i in [0,l-1]:
  if s_f[i] != s_r[(l-1)-i]:
    j+=1
    
print(j)

Fixed submission:
import math

s = input()
n = len(s)

l = math.floor(n/2)
if n % 2 == 0:
  k = l
else:
  k = l+1
  

s_f = s[:l]
s_r = s[k:]
j = 0

#print(s_f)
#print(s_r)

for i in range(0,l):
  if s_f[i] != s_r[(l-1)-i]:
    #print(s_f[i] + " " + s_r[(l-1)-i])
    j+=1
    
print(j)
Buggy python submission (verdict: Runtime Error):
Input = input().split()
Input[0] = int(Input[0])
Input[1] + int(Input[1])

if Input[0] >= Input[1]:
  print(str(Input[1])*Input[0])

else:
  print(str(Input[0])*Input[1])

Fixed submission:
Input = input().split()
Input[0] = int(Input[0])
Input[1] = int(Input[1])
 
if Input[0] >= Input[1]:
  print(str(Input[1])*Input[0])
  
else:
  print(str(Input[0])*Input[1])

Buggy python submission (verdict: Runtime Error):
Input = input().spilit()
Input[0] = int(Input[0])
Input[1] = int(Input[1])

i = 0

if Input[0] > Input[1]:
  print(str(Input[0])*Input[1])

elif Input[1] > Input[0]:
  print(str(Input[1])*Input[0])

else:
  print(str(Input[0])*Input[0])
  
  

Fixed submission:
Input = input().split()
Input[0] = int(Input[0])
Input[1] = int(Input[1])
 
if Input[0] >= Input[1]:
  print(str(Input[1])*Input[0])
  
else:
  print(str(Input[0])*Input[1])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import numpy

n = int(input())

seq = []
for _ in range(n):
  i = list(map(int, input().split(" ")))
  seq.append(i)
  
count = 0
results = []
for path in itertools.permutations(seq):
  pwd = None
  count += 1
  for p in path:
    if pwd is None:
      pwd = p
    else:
      a = numpy.array(pwd)
      b = numpy.array(p)
      u = b - a
      results.append(numpy.linalg.norm(u))
      pwd = p
print(sum(results) / count)

Fixed submission:
import itertools
import numpy
import math

n = int(input())

seq = []
for _ in range(n):
  i = list(map(int, input().split(" ")))
  seq.append(i)
  
length = len(list(itertools.permutations(seq)))
results = []
paths = list(itertools.combinations(seq, 2))
factorial = math.factorial(n - 1)
for path in paths:
  a, b = path
  a = numpy.array(a)
  b = numpy.array(b)
  u = b - a
  results.append(numpy.linalg.norm(u) * (factorial * 2))
print(sum(results) / length)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import numpy

n = int(input())

seq = []
for _ in range(n):
  i = list(map(int, input().split(" ")))
  seq.append(i)
  
permutations = list(itertools.permutations(seq))

results = []
for path in itertools.permutations(seq):
  pwd = None
  for p in path:
    if pwd is None:
      pwd = p
    else:
      a = numpy.array(pwd)
      b = numpy.array(p)
      u = b - a
      results.append(numpy.linalg.norm(u))
      pwd = p
print(sum(results) / len(permutations))

Fixed submission:
import itertools
import numpy
import math

n = int(input())

seq = []
for _ in range(n):
  i = list(map(int, input().split(" ")))
  seq.append(i)
  
length = len(list(itertools.permutations(seq)))
results = []
paths = list(itertools.combinations(seq, 2))
factorial = math.factorial(n - 1)
for path in paths:
  a, b = path
  a = numpy.array(a)
  b = numpy.array(b)
  u = b - a
  results.append(numpy.linalg.norm(u) * (factorial * 2))
print(sum(results) / length)
Buggy python submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
La = sorted(list(map(int, input().split())), reverse=True)
Lb = sorted(list(map(int, input().split())), reverse=True)
Lc = sorted(list(map(int, input().split())), reverse=True)

L = La[:x]
L.extend(Lb[:y])
L.sort(reverse=False)

for i in range(c):
    if L[i] < Lc[i]:
        L[i] = Lc[i]

print(sum(L))


Fixed submission:
x, y, a, b, c = map(int, input().split())
La = sorted(list(map(int, input().split())), reverse=True)
Lb = sorted(list(map(int, input().split())), reverse=True)
Lc = sorted(list(map(int, input().split())), reverse=True)

L = La[:x]
L.extend(Lb[:y])
L.sort(reverse=False)
min = min(c, len(L))

for i in range(min):
    if L[i] < Lc[i]:
        L[i] = Lc[i]

print(sum(L))
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())
c = 0

if a == 0:
    print(int(0))
else:
    while n >= 0:
        if n >= a:
            n -= a
            c += 1
        else:
            print(a*c + n)
            break
        if n >= b:
            n -= b
        else:
            print(a*c)
            break



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

ans = n // (a+b) * a
rem = n % (a+b)

ans += min(rem, a)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
num = -1

for i in range(100000):
    if a == math.floor(i*0.08):
        if b == math.floor(i*0.1):
            num = i
            break
print(num)

Fixed submission:
a, b = map(int, input().split())
import math
num = -1

for i in range(100000):
    if a == math.floor(i*0.08):
        if b == math.floor(i*0.1):
            num = i
            break
print(int(num))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split(' ')))

num = 0
for i in range(N):
  if all([P[i] <= P[j] for j in range(i)]):
    num += 1
      
print(num)

Fixed submission:
N = int(input())
P = list(map(int, input().split(' ')))

min = N
num = 1
for i in range(1, N):
  if min > P[i - 1]:
    min = P[i - 1]
  if P[i] <= min:
    num += 1
    
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
in1 = input().split()
in1num = [int(x) for x in in1]
N = in1num[0]
K = in1num[1]
#print(N, K)

while abs(N-K) < N:
  N = abs(N-K)
print(N)


Fixed submission:
in1 = input().split()
in1num = [int(x) for x in in1]
N = in1num[0]
K = in1num[1]
#print(N, K)

#while abs(N-K) < N:
#  N = abs(N-K)
#print(N)

q, mod = divmod(N, K)
#print(q, mod)
if mod == 0:
  print(0)
else:
  if K - mod < mod:
    print(K-mod)
  else:
    print(mod)
Buggy python submission (verdict: Runtime Error):
# REになった
# 各ルートの4方向で行ってないところを覚えるのではなく、すでに行ったマスのみをマークするようにする
# line input as int generator
def li():
    return map(int, input().split())


H, W = li()
# C = [input().split() for _ in range(H)]
C = [['' for _ in range(W)] for _ in range(H)]
# すでに行った道など、もう通らない道
route = []
for h in range(H):
    for w, c in enumerate(input()):
        C[h][w] = c
        if c == '#':
            route.append((h,w))
        # if h-1 >= 0:
        #     route[(h, w)].append((h - 1, w))
        # if h+1 < H:
        #     route[(h, w)].append((h + 1, w))
        # if w-1 >= 0:
        #     route[(h, w)].append((h, w - 1))
        # if w+1 < W:
        #     route[(h, w)].append((h, w + 1))
        if c == 's':
            start = (h, w)
# print(route)

def dfs(now):
    h, w = now
    # print(now)
    # if not ((0 <= h < H) and (0 <= w < W)):
    #     return False
    # print(route[now])
    if (h,w) in route:
        return False
    if C[h][w] == 'g':
        # OK!
        return True
    # elif C[h][w] == '#':
    #     return False
    else:
        # append
        route.append((h,w))
        if h-1 >= 0 and ((h-1,w) not in route):
            if dfs((h-1,w)):
                return True
        if h+1 < H and ((h+1,w) not in route):
            if dfs((h+1,w)):
                return True
        if w-1 >= 0 and ((h,w-1) not in route):
            if dfs((h,w-1)):
                return True
        if w+1 < W and ((h,w+1) not in route):
            if dfs((h,w+1)):
                return True
        return False

print('Yes' if dfs(start) else 'No')

Fixed submission:
a = int(input())
s = input()
print(s if a>=3200 else 'red')
Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce
 
def nCr(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def conv(st):
    res = [0]*26
    for s in st:
        res[ord(s)-ord('a')] += 1
    return ''.join(map(str,res))

N = int(input())
S = [conv(input()) for _ in range(N)]
setS = set(S)
res = 0
for s in setS:
    cnt = S.count(s)
    if cnt > 1:
        res += nCr(cnt, 2)
print(res)

Fixed submission:
def conv(st):
    res = [0]*26
    for s in st:
        res[ord(s)-ord('a')] += 1
    return ''.join(map(str,res))

N = int(input())
S = {}
res = 0
for i in range(N):
    s = conv(input())
    if s not in S.keys():
        S[s] = 1
    else:
        S[s] += 1
    if S[s] > 1:
        res += S[s]-1
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
max_A = max(A)
for i in range(N):
    if A[i] == max_A:
        print(max(A[:i]+A[i+1:]))
    else:
        print(max_A)
    

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
sortA = sorted(A, reverse=True)
for i in range(N):
    if A[i] == sortA[0]:
        print(sortA[1])
    else:
        print(sortA[0])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(x) for x in input().split()]
LR = [[int(x) for x in input().split()] for i in range(M)]
LR = [list(range(x,y+1)) for (x,y) in LR]
res = set(LR[0])
for x in LR[1:]:
    # print(res)
    # print(x)
    res = res.intersection(set(x))
    # print(res)
print(len(res))

Fixed submission:
N, M = [int(x) for x in input().split()]
L = 1
R = N
for i in range(M):
    L_,R_ = [int(x) for x in input().split()]
    L = max(L, L_)
    R = min(R, R_)

print(max((R-L + 1), 0))
Buggy python submission (verdict: Runtime Error):
R,G,B,N = [int(i) for i in input().split()]
num = 0
box = sorted([R,G,B], key=lambda x:-x)
nums = [N//b for b in box]
for i in range(nums[0]+1):
	if (nums[0]-i)*box[0] + nums[1]*box[1] + nums[2]*box[2] < N:
		break
	for j in range(nums[1]+1):
		resj = (nums[0]-i)*box[0] + (nums[1]-j)*box[1]
		if resj + nums[2]*box[2] < N:
			break
		if resj > N:
            continue
        if (N-resj)%box[2]!=0:
            continue
        num += 1
print(num)

Fixed submission:
R,G,B,N = [int(i) for i in input().split()]
num = 0
box = sorted([R,G,B], key=lambda x:-x)
nums = [N//b for b in box]
for i in range(nums[0]+1):
    if (nums[0]-i)*box[0] + nums[1]*box[1] + nums[2]*box[2] < N:
        break
    for j in range(nums[1]+1):
        resj = (nums[0]-i)*box[0] + (nums[1]-j)*box[1]
        if resj + nums[2]*box[2] < N:
            break
        if resj > N:
            continue
        if (N-resj)%box[2]!=0:
            continue
        num += 1
print(num)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = [int(i) for i in input().split()]
num = 0

box = sorted([R,G,B], key=lambda x:-x)
nums = [N//b for b in box]
for i in range(nums[0]+1):
    if (nums[0]-i)*box[0] + nums[1]*box[1] + nums[2]*box[2] < N:
        break
    for j in range(nums[1]+1):
        resj = (nums[0]-i)*box[0] + (nums[1]-j)*box[1]
        if resj + nums[2]*box[2] < N:
            break
        if resj > N:
            continue
        if (N-resj)%box[2]!=0:
            continue
        num += 1

print(num)

Fixed submission:
R,G,B,N = [int(i) for i in input().split()]
num = 0
box = sorted([R,G,B], key=lambda x:-x)
nums = [N//b for b in box]
for i in range(nums[0]+1):
    if (nums[0]-i)*box[0] + nums[1]*box[1] + nums[2]*box[2] < N:
        break
    for j in range(nums[1]+1):
        resj = (nums[0]-i)*box[0] + (nums[1]-j)*box[1]
        if resj + nums[2]*box[2] < N:
            break
        if resj > N:
            continue
        if (N-resj)%box[2]!=0:
            continue
        num += 1
print(num)
Buggy python submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]
S = input()
arr = []
val = 1
temp = S[0]
if temp == '1':
    arr += [0]
for s in S[1:]:
    if s == temp:
        val+=1
    else:
        arr += [val]
        val = 1
    temp = s
if val != 0:
    arr += [val]

print(max([sum(arr[i:i+K*2+1]) if i%2!=0 else sum(arr[i:i+K*2]) for i in range(len(arr)-(K*2)+1)]))


Fixed submission:
N, K = [int(i) for i in input().split()]
S = input()
arr_0,arr_1 = [],[]
val = 1
temp = S[0]
if temp == '0':
    arr_1 += [0]
for s in S[1:]+"_":
    if s == temp:
        val+=1
    else:
        if temp=="1":
            arr_1 += [val]
        else:
            arr_0 += [val]
        val = 1
    temp = s
if S[-1] == "0":
    arr_1 += [0]

max_ = sum(arr_0[:K]+arr_1[:K+1])
for i in range(1, len(arr_0)-K+1):
    if (arr_0[i+K-1]+arr_1[i+K]) > (arr_0[i-1]+arr_1[i-1]):
        tmp = sum(arr_0[i:i+K])+sum(arr_1[i:i+K+1])
        if tmp > max_:
            max_ = tmp
print(max_)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
pas = [0]*5
for i in range(5):
  pas[i] = int(input())
city = [0]*6
city[0] = N
temp = [0]*6
times = 0
while city[-1] < N:
  for i in range(len(city)-1):
    if city[i] == 0:
      continue
    temp[i+1] += min(city[i], pas[i])
    city[i] = max(0, city[i]-pas[i])
  for i in range(1,len(city)):
    city[i] += temp[i]
    temp[i] = 0
  times += 1
print(times)

Fixed submission:
N = int(input())
pas = [0]*5
for i in range(5):
  pas[i] = int(input())
min_pas = min(pas)
if N==min_pas:
  times = 0
elif min_pas == 1:
  times = N-1
else:
  times = N//min_pas
times += 5
print(times)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = input()
Ls = np.array([int(i) for i in input().split()])
max_arg = np.argmax(Ls)
sum_ = sum([v for i,v in enumerate(Ls) if i != max_arg])
print("Yes" if Ls[max_arg] < sum_ else "No")

Fixed submission:
input()
Ls = [int(i) for i in input().split()]
max_arg = Ls.index(max(Ls))
sum_ = sum([v for i,v in enumerate(Ls) if i != max_arg])
print("Yes" if Ls[max_arg] < sum_ else "No")

Buggy python submission (verdict: Runtime Error):
import numpy as np
input()
Ls = np.array([int(i) for i in input().split()])
max_arg = np.argmax(Ls)
sum_ = sum([v for i,v in enumerate(Ls) if i != max_arg])
print("Yes" if Ls[max_arg] < sum_ else "No")

Fixed submission:
input()
Ls = [int(i) for i in input().split()]
max_arg = Ls.index(max(Ls))
sum_ = sum([v for i,v in enumerate(Ls) if i != max_arg])
print("Yes" if Ls[max_arg] < sum_ else "No")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/python

n = int(input())
t = input().split()
a = []
for c in t:
    a.append(int(c))

# hash
h = {}
for v in a:
    if v in h:
        h[v] += 1
    else:
        h[v] = 1

ans = []
for c in a:
    aa = 0
    for k, v in h.items():
        vv = v
        if k == c:
            vv -= 1
        if vv > 1:
            aa += (vv*(vv-1)//2)
    print(aa)


Fixed submission:
#!/usr/bin/python

n = int(input())
t = input().split()
a = []
for c in t:
    a.append(int(c))

# hash
h = {}
for v in a:
    if v in h:
        h[v] += 1
    else:
        h[v] = 1
total = 0
for k in h.values():
    if k > 1:
        total += (k*(k-1)//2)

for c in a:
    aa = total
    if h[c] > 1:
        aa -= (h[c]*(h[c]-1)//2)
    if h[c] > 2:
        aa += ((h[c]-1)*(h[c]-2)//2)
    print(aa)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3 ## -*- python -*-
import math

t = input().split()
a = int(t[0])
b = int(t[1])
c = int(t[2])

ans = "No"
if math.sqrt(a)+math.sqrt(b) < math.sqrt(c):
    ans = "Yes"
print(ans)

Fixed submission:
#!/usr/bin/env python3 ## -*- python -*-
k = int(input())

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3 ## -*- python -*-
import math

t = input().split()
a = int(t[0])
b = int(t[1])
c = int(t[2])

ans = "No"
if math.sqrt(a)+math.sqrt(b) < math.squrt(c):
    ans = "Yes"
print(ans)

Fixed submission:
#!/usr/bin/env python3 ## -*- python -*-

t = input().split()
a = int(t[0])
b = int(t[1])
c = int(t[2])

ans = "No"
z = c-a-b
if z > 0 and 4 * a * b < z*z:
    ans = "Yes"
print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3 ## -*- python -*-

s = input()
q = int(input())

for i in range(q):
    d = input()
    if d[:1] == "1":
        if not s[:1] == s[-1:1]:
            s = s[::-1]
    else: # 2
        dd = d.split()
        f = int(dd[1])
        c = dd[2]
        if f == 1:
            s = c + s
        else: # f == 2
            s = s + c

print(s)

Fixed submission:
#!/usr/bin/env python3 ## -*- python -*-

s = input()

if "AB" in s:
  print("Yes")
elif "BA" in s:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
    n = int(input())
    """studentNumbers = [(x, str(i)) for x, i in
        zip(input().split(), range(1, 1000000))]
    studentNumbers.sort(key=lambda tup: tup[0])
    print(' '.join([x[1] for x in studentNumbers]))"""
    studentNumbers = [(str(i + 1), x) for i, x in enumerate(input().split())]
    if (n > 1):
        studentNumbers.sort(key=lambda tup: tup[1])
    print(' '.join([x[0] for x in studentNumbers]))


Fixed submission:
from math import ceil

if __name__ == "__main__":
    n = int(input())
    print(ceil(n/2)/n)

Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
    n = int(input())
    """studentNumbers = [(x, str(i)) for x, i in
        zip(input().split(), range(1, 1000000))]
    studentNumbers.sort(key=lambda tup: tup[0])
    print(' '.join([x[1] for x in studentNumbers]))"""
    studentNumbers = [(x, str(i + 1)) for x, i in zip(input().split(), range(n))]
    if (n > 1):
        studentNumbers.sort(key=lambda tup: tup[0])
    print(' '.join([x[1] for x in studentNumbers]))


Fixed submission:
from math import ceil

if __name__ == "__main__":
    n = int(input())
    print(ceil(n/2)/n)
Buggy python submission (verdict: Time Limit Exceeded):

import math


def primeFactorisation(x):
    res = set([1])
    while x % 2 == 0:
        res.add(2)
        x = x//2
    for i in range(3, int(math.sqrt(x)) + 1, 2):
        while (x % i == 0):
            res.add(i)
            x = x // i
    if (x > 2):
        res.add(x)
    return res


if __name__ == "__main__":
    a, b = map(int, input().split())
    divisors = set([x for x in range(1, max(a, b)) if (a % x == 0 and b % x == 0)])
    coPrimedivisors = set([1])
    for x in divisors:
        coPrimedivisors = coPrimedivisors.union(set(primeFactorisation(x)))
    print(len(coPrimedivisors))


Fixed submission:

import math


def primeFactorisation(x):
    res = set([1])
    while x % 2 == 0:
        res.add(2)
        x = x//2
    for i in range(3, int(math.sqrt(x)) + 1, 2):
        while (x % i == 0):
            res.add(i)
            x = x // i

    if (x > 2):
        res.add(x)
    return res


if __name__ == "__main__":
    prevs = []
    a, b = map(int, input().split())
    fa = primeFactorisation(a)
    fb = primeFactorisation(b)
    fres = fa.intersection(fb)
    print(len(fres))