Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02658 (python)

Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)

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

An = list(map(int, input().split()))

j = 100000000000000000

ans = 1

for i in range(n):
    ans *= An[i]

if ans <= s:
    print(ans)
else :
    print('-1')
Problem p02639 (python)

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

for i, x in enumerate(X):
  if x == 0:
    print(i+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
x,N = map(int, input().split())

P = list(map(int, input().split()))

abs_list = []

for p in P:
  abs_list.append(np.abs(x-p))
  
if len(abs_list) == 0:
  print(x)
  sys.exit()
   
abs_max = max(abs_list)
for i in range(100):
  if abs_list.count(i) == 0:
    print(x-i)
    sys.exit()
  elif abs_list.count(i) == 1 and x+i in P and i !=0:
    print(x-i)
    sys.exit()
  elif abs_list.count(i) == 1 and x-i in P and i != 0:
    print(x+i)
    sys.exit()
Problem p02687 (python)

Fixed submission:
s = str(input())

if s == 'ARC':
  print('ABC')
else:
  print('ARC')

Buggy submission (verdict: Runtime Error):
x = int(input())

import math
def trial_division(n):
    #素因数を格納するリスト
    num_list = []
    factor = set(num_list)
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.add(num)
    #リストが空ならそれは素数
    if not factor:
        return [1]
    else:
        factor.add(n)
        return factor


for number in trial_division(x):
  for a in range(round(x**(1/5))):
    b = a - number
    if a**5 - b**5 == x:
      print(a,b)
      break
    elif a**5 - (-b)**5==x:
      print(a,-b)
      break
Problem p02690 (python)

Fixed submission:
import sys
x = int(input())

for a in range(120):
  for b in range(120):
    if a**5 - b**5 == x:
      print(a,b)
      sys.exit()
    elif a**5 - (-b)**5==x:
      print(a,-b)
      sys.exit()

Buggy submission (verdict: Runtime Error):
x = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr

for number in factorization(x):
  for a in range(x/number):
    b = a - number
    if a**5 - b**5 == x:
      print(a,b)
      break
    elif a**5 - (-b)**5==x:
      print(a,-b)
      break
Problem p02675 (python)

Fixed submission:
N = str(input())
if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9':
    print('hon')
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '6' or N[-1] == '8':
    print('pon')
elif N[-1] == '3':
    print('bon')

Buggy submission (verdict: Runtime Error):
from math import cos, sqrt, radians
A, B, H, M = map(int, input().split())
Md = M * 6
Hd = (H * 30) + ((M/60) * 30)
Cd = (Hd - Md)
As = A ** 2
Bs = B ** 2
D = 2 * A * B
X = sqrt(As + Bs - (D * cos(radians(Cd))))
print(X)
Problem p03324 (python)

Fixed submission:
d, n = map(int, input().split())
if n<=99:
 ans = 100**d * n
else:
 ans = 100**d * (n+1)
print(ans)

Buggy submission (verdict: Runtime Error):
d n = map(int, input().split())
ans = 100**d * n
print(ans)
Problem p02687 (python)

Fixed submission:
S=input()
if S=="ABC":
    ans="ARC"
else:
    ans="ABC"
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
if s=="ABC":
    ans=ARC
else:
    ans=ABC
print(ans)
Problem p02715 (python)

Fixed submission:
mod=10**9+7
N,K=map(int,input().split())
d=[0]*(K+1)
ans=0
for i in range(1,K+1):
    d[i]=pow(K//i,N,mod)
for i in range(K,0,-1):
    for j in range(2*i,K+1,i):
        d[i]-=d[j]
        d[i]%=mod
    ans+=d[i]*i
    ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
N,K=map(int,input().split())
gcd=[0]*(K+1)
ans=0
multipleNumber=0
for i in reversed(range(1,K+1)):
    multipleNumber=K//i
    totalNumber=multipleNumber**N%mod
    minus=range(2*i,K+1,i)
    for j in minus:
        totalNumber-=gcd[j]
        totalNumber%=mod
    gcd[i]=totalNumber
    ans+=i*gcd[i]
print(ans%a)

Buggy submission (verdict: Runtime Error):
import math
a=10**9+7
N,K=map(int,input().split())
gcd=[0]*(K+1)
ans=0
multipleNumber
for i in reversed(range(1,K+1)):
    multipleNumber=math.floor(K/i)
    totalNumber=multipleNumber**N
    if 2*i<=K:
        minus=range(2*i,K+1,i)
        for j in minus:
            totalNumber-=gcd[j]
    gcd[i]=totalNumber
for i in range(1,len(gcd)):
    ans+=i*gcd[i]
print(ans)
Problem p02717 (python)

Fixed submission:
X,Y,Z=map(int,input().split())
print(str(Z)+" "+str(X)+" " + str(Y))

Buggy submission (verdict: Runtime Error):
X,Y,Z=map(int,input())
print(str(Z) + " " + str(X) + " " + str(Y))
Problem p02630 (python)

Fixed submission:
#D
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BandC = [list(map(int, input().split())) for _ in range(Q)]

temp = [0] * (10 ** 5 + 1)
for i in range(N):
    temp[A[i]] += 1
    
s = sum(A)

for i in range(Q):
    num = BandC[i][0]
    num_temp = temp[BandC[i][0]]
    temp[BandC[i][0]] = 0
    temp[BandC[i][1]] += num_temp
    s = s - BandC[i][0] * num_temp + BandC[i][1] * num_temp
    print(s)

Buggy submission (verdict: Runtime Error):
#D
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BandC = [list(map(int, input().split())) for _ in range(Q)]

temp = [0] * 10 ** 5
for i in range(N):
    temp[A[i]] += 1
    
s = sum(A)

for i in range(Q):
    num = BandC[i][0]
    num_temp = temp[num]
    temp[num] = 0
    temp[BandC[i][1]] += num_temp
    s = s - BandC[i][0] * num_temp + BandC[i][1] * num_temp
    print(s)
Problem p02853 (python)

Fixed submission:
X, Y = map(int, input().split())
if X <= 3 and Y <= 3:
    ans = (4-X) * 100000 + (4-Y) * 100000
    if X == 1 and Y == 1:
        ans += 400000
elif X <= 3:
    ans = (4-X) * 100000
elif Y <= 3:
    ans = (4-Y) * 100000
else:
    ans = 0
    
print(ans)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
if X <= 3 and Y <= 3:
    ans = (4-X) * 100000 + (4-Y) * 100000
    if X == 1 and Y == 1:
        ans += 400000
elif X <= 3:
    ans = (4-X) * 100000
elif Y <= 3:
    ans = (4-Y) * 100000
    
print(ans)
Problem p02899 (python)

Fixed submission:
from collections import deque
N = int(input())
A = [int(i) for i in input().split()]
values = [str(i+1) for i in range(N)]
dic = {key: val for key, val in zip(A, values)}
dic_s = deque(sorted(dic.items()))
s =deque()
for i in range(N):
    s.append(dic_s[i][1])

ans = ' '.join(list(s))
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
values = [str(i+1) for i in range(N)]
dic = {key: val for key, val in zip(A, values)}
dic_s = deque(sorted(dic.items()))
s =[]
for i in range(N):
    s.append(dic_s[i][1])

ans = ' '.join(s)
print(ans)
Problem p02927 (python)

Fixed submission:
M, D = (int(i) for i in input().split())

days = 0

for m in range(1, M+1):
    for d in range(1, D+1):
        d1 = d % 10
        d2 = d // 10
        if d1 >= 2 and d2 >= 2 and d1*d2 == m:
            days += 1

print(days)

Buggy submission (verdict: Runtime Error):
N, K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
numc = 0
numf = 0

for i in range(0, N):
    for j in range(0,i):
        if A[j] > A[i]:
            numc += 1
        if A[i] > A[j]:
            numf += 1
numbers = numc*K*(K+1) % (10**9+7)+ numf*K*(K-1) % (10**9+7)
 
ans = int(numbers/2 % (10**9 + 7))
print(ans)
Problem p02934 (python)

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

arev_sum = 0
for i in a_int:
    arev_sum += 1/i
    
ans = 1/arev_sum
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
a = input().split(' ')
a_int = [int(i) for i in asp]

arev_sum = 0
for i in a_int:
    arev_sum += round(1/i, 5)
    
ans = round(1/arev_sum, 5)
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
a = input().split(' ')
a_int = [int(i) for i in asp]

arev_sum = 0
for i in a_int:
    arev_sum += 1/i
    
ans = 1/arev_sum
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
a = input().split()
a_int = [int(i) for i in asp]
arev_sum = 0
for i in a_int:
    arev_sum += 1/i
ans = 1/arev_sum
print(ans)
Problem p02983 (python)

Fixed submission:
L, R = map(int, input().split())
Lmin = L % 2019
Rmin = R % 2019
anlis = []

if R-L >= 2018 or Lmin > Rmin:
    print(0)
    
else:
    for j in range(Lmin+1, Rmin+1):
        for i in range(Lmin, j):
            anlis.append((i * j) % 2019)
    print(min(anlis))

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
Lmin = L % 2019
Rmin = R % 2019
anlis = []

if L-R >= 2019 or Lmin > Rmin:
    print(0)
    
else:
    for j in range(Lmin, Rmin+1):
        for i in range(Lmin, j):
            anlis.append((i * j) % 2019)



print(min(anlis))
Problem p02995 (python)

Fixed submission:
import fractions
A, B, C, D = map(int, input().split())
A = A-1
f=fractions.gcd(C,D)
f2=C*D//f

Aans = A - (A//C + A//D - A//f2)
Bans = B - (B//C + B//D - B//f2)
print(Bans- Aans)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
A = A-1
f=math.gcd(C,D)
f2=C*D//f

Aans = A - (A//C + A//D - A//f2)
Bans = B - (B//C + B//D - B//f2)
print(Bans- Aans)
Problem p02628 (python)

Fixed submission:
N,K = input().split()
lists = []
B = 0

lists = list(map(int, input().split()))

lists.sort()
#print(lists)

for j in range(int(K)):
  B += int(lists[j])
 
print(B)

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
lists = []
B = 0

for i in range(int(N)):
    A = input()
    lists.append(int(A))
    #print(A)

lists.sort()
#print(lists)

for j in range(int(K)):
  B += int(lists[j])
 
print(B)

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
lists = []
A = 0

for i in range(int(N)):
  lists.append((input()))
 
lists.sort()
 
A = sum(lists[:K])
 
print(A)

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
lists = []
A = 0

for i in range(int(N)):
  lists.append((input()))
 
lists.sort()
 
for j in range(int(K)):
  A += int(lists[j])
 
print(A)

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
 
for i in range(N):
  list[i] = input()
 
list.sort()
 
for j in range(K):
  A += list[j]
 
print(A)

Buggy submission (verdict: Runtime Error):
N = input()
K = input()

for i in range(N):
  list.append(input())

list.sort()

for j in range(K):
  A += list[j]

print(A)
Problem p02783 (python)

Fixed submission:
H, A = map(int, input().split())
Ans = 0
 
while (H > 0):
	H -= A
	Ans += 1
 
print(Ans)

Buggy submission (verdict: Runtime Error):
H, A = map(int, input().split())
Ans = 0
 
while (H =< 0):
	H -= A
	Ans += 1
 
print(Ans)

Buggy submission (verdict: Runtime Error):
H, A = map(int, input().split())
Ans = 0

while (Ans =< 0):
	H -= A
	Ans += 1

print(Ans)

Buggy submission (verdict: Runtime Error):
h, a = map(int, input().split())
Ans = 0
Ans2 = 0
 
while Ans =< 0:
	Ans = h-a
	Ans2 += 1
 
print(Ans2)

Buggy submission (verdict: Runtime Error):
h, a = map(int, input().split())
Ans = 0
Ans2 = 0

while Ans =< 0:
	Ans = h-a
	Ans2+=1

print(Ans2)

Buggy submission (verdict: Runtime Error):
H = input()
A = input()

while Ans =< 0:
	Ans = H-A
	Ans2++

print(Ans)
Problem p02784 (python)

Fixed submission:
H, N = map(int, input().split())
A = map(int, input().split())
Ans = 0
 
for x in A:
  Ans += x
  
if Ans >= H:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = map(int, input().split())
Ans = 0

for x in A:
  Ans += x
  
if(Ans >= H):
  print(`Yes`)
else:
  print(`No`)
Problem p02705 (python)

Fixed submission:
import  math

R=int(input())

print(2*math.pi*R)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=list(map(int,input().split()))

L=sum(A)
if L>N:
    print(-1)
else:
    print(N-L)
Problem p02722 (python)

Fixed submission:
# 素因数分解

N=int(input())
cand=[]

def check(N0,K0):
    if N0%K0==0:
        return check(int(N0/K0),K0)
    elif N0%K0==1:
        return 1
    else:
        return 0

def check0(N0,K0):
    while N0%K0==0:
        N0=int(N0/K0)
    if N0%K0==1:
        return 1
    else:
        return 0

# N-1の約数の数
for i in range(2,int((N-1)**0.5)+1):#O(N**0.5)
    if (N-1)%i==0:
        cand.append(i)
        if i!=int((N-1)/i):
            cand.append(int((N-1)/i))
if N>2:
    cand.append(N-1)

# Nの約数
for i in range(2,int(N**0.5)+1):#O(N**0.5)
    if N%i==0:
        cand.append(i)
        if i!=int(N/i):
            cand.append(int(N/i))
cand.append(N)

#print(cand)
count=0
for i in range(len(cand)):
    if check(N,cand[i]):
        count+=1

print(count)

Buggy submission (verdict: Runtime Error):
# 素因数分解

N=int(input())
cand=[]

def check(N0,K0):
    if N0%K0==0:
        return check(int(N0/K0),K0)
    elif N0%K0==1:
        return 1
    else:
        return 0

def check0(N0,K0):
    while N0%K0==0:
        N0=int(N0/K0)
    if N0%K0==1:
        return 1
    else:
        return 0

# N-1の約数の数
for i in range(2,int((N-1)**0.5)+1):#O(N**0.5)
    if (N-1)%i==0:
        cand.append(i)
        cand.append(int((N-1)/i))

# Nの約数
for i in range(2,int(N**0.5)+1):#O(N**0.5)
    if N%i==0:
        cand.append(i)
        cand.append(int(N/i))
cand.append(N)
cand.append(N-1)

count=0
for i in range(len(cand)):
    if check(N,cand[i]):
        count+=1

print(count)
Problem p02732 (python)

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

L=0
C=[0]*N

for i in range(N):
    C[A[i]-1]+=1

for i in range(N):
    L+=int(C[i]*(C[i]-1)/2)
    
for i in A:
    print(L-C[i-1]+1)

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

L=0
C=[]
for i in range(N):
    C.append(A.count(i))
    L+=int(C[i]*(C[i]-1)/2)
    
for i in range(N):
    print(L-C[A[i]]+1)

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

for i in range(N):
    A0=A.copy()
    A0.pop(i)
    A0=sorted(A0)
    
    ii=0
    C=0
    L=0
    while ii<N-1:
        C=A0.count(A0[ii])
        ii+=C
        L=int(C*(C-1)/2)+L
    print(L)
Problem p02761 (python)

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

flag=True
ex=[False]*(N)
for i in range(M):
    S,C=map(int,input().split())
    if ex[S-1]==False or ex[S-1]==str(C):
        ex[S-1]=str(C)
    else:
        flag=False
        break

if N>1 and ex[0]==str(0):
    flag=False

if flag:
    for i in range(N-1):
        if ex[i+1]==False:
            ex[i+1]='0'
    if ex[0]==False and N>1:
        ex[0]='1'
    elif ex[0]==False:
        ex[0]='0'
    Ex=''.join(ex)
    print(Ex)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())

flag=True
ex=[False]*(N)
for i in range(M):
    S,C=map(int,input().split())
    if S>N:
        flag=False
        break
    elif ex[S-1]==False or ex[S-1]==str(C):
        ex[S-1]=str(C)
    else:
        flag=False
        break

if N>1 and ex[0]==0:
    flag=False

if flag:
    for i in range(N-1):
        if ex[i+1]==False:
            ex[i+1]='0'
    if ex[0]==False:
        ex[0]=1
    Ex=''.join(ex)
    print(Ex)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())

flag=True
ex=[False]*(N)
for i in range(M):
    S,C=map(int,input().split())
    if S>N:
        flag=False
        break
    elif ex[S-1]==False or ex[S-1]==str(C):
        ex[S-1]=str(C)
    else:
        flag=False
        break

if N>1 and ex[N-1]==0:
    flag=False

if flag:
    for i in range(N):
        if i<N-1 and ex[i]==False:
            ex[i]='0'
        elif i==N and ex[i]==False:
            ex[i]='1'
    Ex=''.join(ex)
    print(Ex)
else:
    print(-1)
Problem p02658 (python)

Fixed submission:
N = int(input())
numbers = [int(n) for n in input().split()]
mlt = 1
if 0 in numbers:
    print(0)
else:
    for n in numbers:
        mlt *= n
        if mlt > 1000000000000000000:
            mlt = -1
            break
    print(mlt)

Buggy submission (verdict: Runtime Error):
N = int(input())
numbers = [int(n) for n in input().split()]
mlt = 1
if 0 in n:
    print(0)
for n in numbers:
    mlt *= n
    if mlt > 1000000000000000000:
        mlt = -1
        break
print(mlt)
Problem p02657 (python)

Fixed submission:
x, y = map(int, input().split())
print(x * y)

Buggy submission (verdict: Runtime Error):
x, y = input().split()
print(x * y)
Problem p02684 (python)

Fixed submission:
num_town, num_move = map(int, input().split())
teleports = list(map(lambda x: int(x) - 1, input().split()))

current = 0
memo = {}
for i in range(num_move):
    if memo.get(current) == 2:
        break
    if not memo.get(current):
        memo[current] = 1
    else:
        memo[current] += 1
    destination = teleports[current]
    current = destination

loop = {k:v for k,v in memo.items() if v==2}
minus = {k:v for k,v in memo.items() if v==1}

new_move_count = 0
if len(loop) == 0:
    current = 0
    new_move_count = num_move
else:
    new_move_count = (num_move - len(minus)) % len(loop)

for i in range(new_move_count):
    destination = teleports[current]
    current = destination

print(current + 1)

Buggy submission (verdict: Runtime Error):
from collections import deque

N, M = map(int, input().split())
AB = [map(int, input().split()) for _ in range(M)]

links = [[] for _ in range(N + 1)]
for a, b in AB:
    links[a].append(b)
    links[b].append(a)

result = [-1] * (N + 1)
q = deque([1])
while q:
    i = q.popleft()
    for j in links[i]:
        if result[j] == -1:
            result[j] = i
            q.append(j)
print('Yes')
print('\n'.join(str(i) for i in result[2:]))

Buggy submission (verdict: Runtime Error):
num_town, num_move = map(int, input().split())
teleports = list(map(lambda x: int(x) - 1, input().split()))

current = 0
memo = {}
for i in range(num_move):
    if memo.get(current) == 2:
        break
    if not memo.get(current):
        memo[current] = 1
    else:
        memo[current] += 1
    destination = teleports[current]
    current = destination

loop = {k:v for k,v in memo.items() if v==2}
minus = {k:v for k,v in memo.items() if v==1}

new_move_count = (num_move - len(minus)) % len(loop)

if num_move < new_move_count:
    new_move_count = num_move
    current = 0

for i in range(new_move_count):
    destination = teleports[current]
    current = destination

print(current + 1)
Problem p02934 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
b=[]
for i in range(N):
  b.append(1.0/a[i])
  B = sum(b)
print(1.0/B)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
b=[]
for i in range(N+1):
  b.append(1.0/a[i])
  B = sum(b)
print(1.0/B)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
b=[]
for i in range(N+1):
  b.append(1.0/a[i])
  B = sum(b)
print(1/B)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
b=[]
for i in range(N+1):
  b.append(1.0/i)
  B = sum(b)
print(1/B)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
b=[]
for i in range(N+1):
  b[i]=1/a[i]
  B = sum(b)
print(1/B)

Buggy submission (verdict: Runtime Error):
n = int(input())
a =list(map(int,input()))
b = []
for i range(n):
  b[i]= 1/a[i]
  B = sum(b)
print(1/B)

Buggy submission (verdict: Runtime Error):
n = int(input())
a =list(map(int,input()))
b = []
for i range(n):
  b[i]= 1/a[i]
  B = sum(b)
print("1/B")
Problem p03773 (python)

Fixed submission:
a, b = map(int, input().split())
print((a + b)%24)

Buggy submission (verdict: Runtime Error):
a, b =map(in, input().split())
print((a+b)%24)
Problem p02969 (python)

Fixed submission:
a = int(input())
print(3*a*a)

Buggy submission (verdict: Runtime Error):
a = int(input())
print(3a^2)
Problem p03455 (python)

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

c = int(a)*int(b)%2

if c==1:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
input_line = input()

num_array = input_line.split()
ans = num_array[0] * num_array[1] %2

if ans = "0":
  print("Even")
else:
  print("Odd")
Problem p03456 (python)

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

c = a+b
w = False

for i in range(int(c)):
    if i*i == int(c):
        print("Yes")
        w = True
        break
if w == False:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b = input().split()

c = a+b
number = int(c)
w = False

for i in range(number/2):
    if i*i == number:
        print("Yes")
        w = True
        break
if w == False:
    print("No")
Problem p03423 (python)

Fixed submission:
n = int(input())
print(n//3)

Buggy submission (verdict: Runtime Error):
H, W, D = map(int, input().split())
M = [(-1, -1)]*(H*W+1)
A = []
for i in range(H):
  As = list(map(int, input().split()))
  for j in range(W):
    a = As[j]
    M[a] = (i, j)
  A.append(As)
#print(M)
Dist = [0]*(H*W+1)
for k in range(0, H*W-D+1):
  i, j = M[k]
  x, y = M[k+D]
  Dist[k+D] = Dist[k]+abs(x-i)+abs(y-j)
Q = int(input())
for i in range(Q):
  L, R = map(int, input().split())
  r = Dist[R]-Dist[L]
  print(r)
Problem p04043 (python)

Fixed submission:
def main():
    s = list(map(int, input().split()))
    fives = 0
    sevens = 0
    for item in s:
        if item == 5: fives += 1
        if item == 7: sevens += 1
    if fives == 2 and sevens == 1:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from math import *

H, W, A, B = list(map(int, input().split()))
p = 1000000007

ft = [1]
ift = [-1] * (H + W + 1)
for i in range(1, H + W + 1):
    ft.append(ft[i-1] * i % p)

def ifac(a):
    if ift[a] != -1: return ift[a]
    res = 1
    x = ft[a]
    for i in range(ceil(log2(p-2))):
        if ((p - 2) >> i) & 1:
            res *= x % p
        x *= x % p
    ift[a] = res
    return res

def com(a, b):
    return (ft[a] * ifac(b) * ifac(a-b)) % p

ans = 0
for i in range(H-A):
    ans += com(B+i-1, i) * com(W-B+H-i-2, H-i-1)
    ans %= p

print(ans)
Problem p02774 (python)

Fixed submission:
import numpy as np
import math
stdin = open(0)

N,K = map(int,input().split())
A = np.array([int(Ai) for Ai in input().split()])
A = np.sort(A)

maxA = max(np.abs(A))

z = A[A==0]
p = A[A>0]
n = A[A<0]

def check(x):
    ret = 0
    if x >= 0:
        ret += N*len(z)
    ret += np.searchsorted(A,x//p,side='right').sum()
    ret += (N - np.searchsorted(A, (-x - 1) // (-n), side='right')).sum()
#     ret += (N-np.searchsorted(A,np.ceil(x/n))).sum()
    ret -= np.count_nonzero(A*A<=x)
    return ret//2;

ub = maxA*maxA
lb = -ub-1
while ub-lb > 1:
    mid = (ub+lb)>>1
    if check(mid) < K:
        lb = mid
    else:
        ub = mid
print(ub)

Buggy submission (verdict: Runtime Error):
import numpy as np
stdin = open(0)

N,K = map(int,input().split())
A = np.array(stdin.read().split(), np.int64)
A = np.sort(A)

maxA = max(np.abs(A))


z = A[A==0]
p = A[A>0]
n = A[A<0]


def check(x):
    ret = 0
    if x >= 0:
        ret += N*len(z)
    ret += np.searchsorted(A,x//p,side='right').sum()
    ret += (N-np.searchsorted(A,x/n)).sum()
    ret -= len([a for a in A if a*a <= x])
    return ret//2;
        

ub = maxA*maxA
lb = -ub-1
while ub-lb > 1:
    mid = (ub+lb)>>1
    if check(mid) < K:
        lb = mid
    else:
        ub = mid
print(ub)