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

Fixed submission:
N=int(input())
X=int(N/1.08)
C=[X-1,X,X+1]
for c in C:
    d=int(c*1.08)
    if d==N:
        print(c)
        break
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
N=int(input())
X=N/1.08
if int(X*1.08)!=N:
    print(":(")
elif:
    ((int(X)+1)*1.08)==N:
        print(int(X)+1)
else:
    print(int(X))

Buggy submission (verdict: Runtime Error):
N=int(input())
X=N/1.08
if X==int(X):
    print(int(X))
elif int(X*1.08)!=N:
    print(":(")
elif:
    ((int(X)+1)*1.08)==N:
        print(int(X)+1)
else:
    print(int(X))
Problem p02921 (python)

Fixed submission:
S=str(input())
T=str(input())
count=0
for i in range(3):
    if S[i]==T[i]:
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
S,T=map(str,input().split())
count=0
for i in range(3):
    if S[i]==T[i]:
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
S,T=map(str,input().split())
count=0
for i in range(len(S)):
    if S[i]==T[i]:
        count+=1
print(count)
Problem p02755 (python)

Fixed submission:
A, B = map(int, input().split())
_MAX_PRICE = 1001
for n in range(1, _MAX_PRICE):
  if int(n * 0.08) == A and int(n * 0.1) == B:
    print(n)
    exit()
print(-1)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
_MAX_PRICE = 1001
for n in range(1, _MAX_PRICE):
  if int(n * 0.08) == A and int(n * 0.1) == B:
    print(n)
    exit()
print(-1)c
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
SC = [input().split() for _ in range(M)]
ans = ["0"] * N
for s, c in SC:
  # check duplicated s
  if ans[int(s) - 1] != "0" and ans[int(s) - 1] != c:
    print(-1)
    exit()
  # check impossible case
  if N > 1 and s == "1" and c == "0":
    print(-1)
    exit()
  ans[int(s) - 1] = c
# replace head
if ans[0] == "0" and N > 1:
  ans[0] = "1"
print("".join(ans))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
SC=[input().split() for _ in range(M)]
ans=["0"]*N
for s,c in SC:
  if ans[int(s)-1]!="0" and ans[int(s)-1]!=c:
    print(-1)
    exit()
  if N>1 and s=="1" and c=="0":
    print(-1)
    exit()
  ans[int(s)-1]=c
if ans[0]=="0" and N>1:
  ans[0]=1
print("".join(ans))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
SC=[input().split() for _ in range(M)]
ans=["0"]*N
for s,c in SC:
  if ans[int(s)-1]!="0" and ans[int(s)-1]!=c:
    print(-1)
    exit()
  if N>1 and s=="1" and c=="0":
    print(-1)
    exit()
  ans[int(s)-1]=c
if ans[0]=="0" and N>1:
  ans[0]=1
print("".join(ans))
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
PS = [list(map(str, input().split())) for _ in range(M)]
ac = [False] * N # index means p
wa = [0] * N # index means p
wa_cnt = 0
for ps in PS:
  p = int(ps[0]) - 1 # index starts from 0
  s = ps[1]
  if not ac[p] and s == "AC":
    wa_cnt += wa[p]
    ac[p] = True
  elif s == "WA":
    wa[p] += 1
print(ac.count(True), wa_cnt)

Buggy submission (verdict: Runtime Error):
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) - 1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
penalties = sum(w * a else 0 for a, w in zip(ac, wa))
print(sum(ac), penalties)

Buggy submission (verdict: Runtime Error):
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) -1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
penalties = sum([w or a for a, w in zip(ac, wa)])
print("{} {}".format(sum(ac),penalties)
Problem p02854 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
total = sum(A)
mid = total // 2
sum_left, sum_left2 = 0, 0
seperation_i = 0
for i, l in enumerate(A[:-1]):
  sum_left += l
  if sum_left >= mid:
      seperation_i = i
      sum_left2 = sum_left - l
      break
sum_right, sum_right2 = sum(A[seperation_i + 1:]), sum(A[seperation_i:])
print(min(abs(sum_right - sum_left), abs(sum_right2 - sum_left2)))

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

def dfs(A, k, cnt=0):
  s1, s2 = 0, 0
  for i in range(len(A)):
    if i <= N / 2:
      if A[k] > 1:
        A[k] -= 1
        cnt += 1
      s1 += A[i]
    else:
      if A[k] > 1:
        A[k] -= 1 
      s2 += A[i]
  if s1 == s2:
    return cnt
  if A[k] > 1:
    return dfs(A, k, cnt)
  else:
    return dfs(A, k + 1, cnt)

s = 0
for i in range(len(A)):
  s += A[i]
if s % 2 == 0:
  print(0)
  exit()
else:
  ans = dfs(A, 0)
  print(ans)

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

def dfs(A, k, cnt=0):
  s1, s2 = 0, 0
  for i in range(len(A)):
    if i <= N / 2:
      if A[k] > 1:
        A[k] -= 1
        cnt += 1
      s1 += A[i]
    else:
      if A[k] > 1:
        A[k] -= 1 
      s2 += A[i]
  if s1 == s2:
    return cnt
  if A[k] > 1:
    return dfs(A, k, cnt)
  else:
    return dfs(A, k + 1, cnt)

s = 0
for i in range(len(A)):
  s += A[i]
if s / 2 == 0:
  print(0)
  exit(0)
else:
  ans = dfs(A, 0)
  print(ans)

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

def dfs(A, k, cnt=0):
  s1, s2 = 0, 0
  for i in range(len(A)):
    if i <= N / 2:
      if A[k] > 1:
        A[k] -= 1
        cnt += 1
      s1 += A[i]
    else:
      if A[k] > 1:
        A[k] -= 1 
      s2 += A[i]
  if s1 == s2:
    return cnt
  if A[k] > 1:
    return dfs(A, k, cnt)
  else:
    return dfs(A, k + 1, cnt)

s = 0
for i in range(len(A)):
  s += A[i]
if s / 2 == 0:
  print(0)
  exit(0)
else:
  ans = dfs(A, 0)
  print(ans)
Problem p02911 (python)

Fixed submission:
N, K, Q = map(int, input().split())
A = []
for q in range(Q):
    A.append(int(input()))
score = [K - Q] * (N + 1)
for a in A:
    score[a] += 1
ans = "\n".join("No" if s <= 0 else "Yes" for s in score[1:])
print(ans)

Buggy submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = []
A = (int(x) for x in sys.stdin.read().split())
score = [K - Q] * (N + 1)
for a in A:
    score[a] += 1
ans = "\n".join("No" if s <= 0 else "Yes" for s in score[1:])
print(ans)
Problem p03281 (python)

Fixed submission:
from math import floor, sqrt
 
N = int(input())
ans = 0
for o in range(1, N + 1, 2):
    cnt = 0
    for n in range(1, 1 + floor(sqrt(o))):
    	if o % n == 0:
            cnt += 2
    if cnt == 8:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from math import floor, sqrt

N = int(input())
ans = 0
for o in range(1, N + 1, 2):
	cnt = 0
    for n in range(1, 1 + floor(sqrt(o))):
    	if o % n == 0:
            cnt += 2
    if cnt == 8:
      ans += 1
print(ans)
Problem p02574 (python)

Fixed submission:
N = int(input())
A = [int(s) for s in input().split()]

PRIME_LENGTH = (10**6 + 1)

prime_list = [[] for _ in range(PRIME_LENGTH)]

for i in range(2, PRIME_LENGTH):
    if not prime_list[i]:
        idx = i
        while (idx < PRIME_LENGTH):
            prime_list[idx].append(i)
            idx += i

vote = [0] * (PRIME_LENGTH)

for a in A:
    for v in prime_list[a]:
        vote[v] += 1

if max(vote) == len(A):
    print("not coprime")
elif sum(map(lambda x: x > 1, vote)) > 0:
    print("setwise coprime")
else:
    print("pairwise coprime")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(s) for s in input().split()]

PRIME_LENGTH = 10**6

prime_list = [[] for _ in range(PRIME_LENGTH)]

for i in range(2, PRIME_LENGTH):
    if not prime_list[i]:
        idx = i
        while (idx < PRIME_LENGTH):
            prime_list[idx].append(i)
            idx += i

vote = [0] * (PRIME_LENGTH)

for a in A:
    for v in prime_list[a]:
        vote[v] += 1

if max(vote) == len(A):
    print("not coprime")
elif sum(map(lambda x: x > 1, vote)) > 0:
    print("setwise coprime")
else:
    print("pairwise coprime")
Problem p02664 (python)

Fixed submission:
T = list(input())

if len(T) == 1:
    print('D')
    exit()

if T[0] == '?':
    if T[1] == 'P':
        T[0] = 'D'
    else:
        T[0] = 'P'


for i in range(1, len(T)-1):
    if T[i] == '?':
        if T[i - 1] == 'D' and (T[i + 1] == 'D' or T[i + 1] == '?'):
            T[i] = 'P'
        else:
            T[i] = 'D'

if T[-1] == '?':
    T[-1] = 'D'

print(''.join(T))

Buggy submission (verdict: Runtime Error):
T = list(input())

if T[0] == '?':
    if T[1] == 'P':
        T[0] = 'D'
    else:
        T[0] = 'P'


for i in range(1, len(T)-1):
    if T[i] == '?':
        if T[i - 1] == 'D' and (T[i + 1] == 'D' or T[i + 1] == '?'):
            T[i] = 'P'
        else:
            T[i] = 'D'

if T[-1] == '?':
    T[-1] = 'D'

print(''.join(T))

Buggy submission (verdict: Runtime Error):
T = list(input())

if T[0] == '?':
    if T[1] == 'P':
        T[0] = 'D'
    else:
        T[0] = 'P'


for i in range(1, len(T)-1):
    if T[i] == '?':
        if T[i - 1] == 'D' and T[i + 1] == 'D':
            T[i] = 'P'
        else:
            T[i] = 'D'

if T[-1] == '?':
    T[-1] = 'D'

print(''.join(T))
Problem p02675 (python)

Fixed submission:
N = input()

if N[-1] == '3':
    print('bon')
elif N[-1] in ['0', '1', '6', '8']:
    print('pon')
else:
    print('hon')

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

N, M = [int(s) for s in input().split()]
edge = [[int(s) - 1 for s in input().split()] for _ in range(M)]
graph = [[] for _ in range(N)]
for i, j in edge:
    graph[i].append(j)
    graph[j].append(i)

dq = deque([0])
visited = [False] * N
visited[0] = True
parent = [0]*N
while(dq):
    search_obj = dq.pop()
    for candidate_obj in graph[search_obj]:
        if not visited[candidate_obj]:
            dq.appendleft(candidate_obj)
            parent[candidate_obj] = search_obj
            visited[candidate_obj] = True

total_visited = sum(visited)
if total_visited < N:
    print('No')
else:
    print('Yes')
    for i in range(1, N):
        print(parent[i]+1)
Problem p02678 (python)

Fixed submission:
from collections import deque

N, M = [int(s) for s in input().split()]
edge = [[int(s) - 1 for s in input().split()] for _ in range(M)]
graph = [[] for _ in range(N)]
for i, j in edge:
    graph[i].append(j)
    graph[j].append(i)

dq = deque([0])
visited = [False] * N
visited[0] = True
parent = [0]*N
while(dq):
    search_obj = dq.pop()
    for candidate_obj in graph[search_obj]:
        if not visited[candidate_obj]:
            dq.appendleft(candidate_obj)
            parent[candidate_obj] = search_obj
            visited[candidate_obj] = True

total_visited = sum(visited)
if total_visited < N:
    print('No')
else:
    print('Yes')
    for i in range(1, N):
        print(parent[i]+1)

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

N, M = [int(s) for s in input().split()]
edge = [[int(s) - 1 for s in input().split()] for _ in range(M)]
graph = [[] for _ in range(M)]
for i, j in edge:
    graph[i].append(j)
    graph[j].append(i)

dq = deque([0])
visited = [False] * N
visited[0] = True
parent = [0]*N
while(dq):
    search_obj = dq.pop()
    for candidate_obj in graph[search_obj]:
        if not visited[candidate_obj]:
            dq.appendleft(candidate_obj)
            parent[candidate_obj] = search_obj
            visited[candidate_obj] = True

total_visited = sum(visited)
if total_visited < N:
    print('No')
else:
    print('Yes')
    for i in range(1, N):
        print(parent[i]+1)
Problem p02713 (python)

Fixed submission:
import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


N = int(input())
cnt = 0
for i in range(1, N+1):
    for j in range(1, N + 1):
        for k in range(1, N + 1):
            cnt += gcd(i, j, k)
print(cnt)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)

N = int(input())
cnt = 0
for i in range(1, N+1):
    for j in range(i, N + 1):
        for k in range(k, N + 1)
            cnt += gcd(i, j, k)
print(cnt)
Problem p02718 (python)

Fixed submission:
def LI():
	return [ int(s) for s in input().split() ]
N,M = LI()
A = LI()
sum_A = sum(A)
 
print('Yes') if sum(map(lambda x: x >= sum_A*(1/4/M), A)) >= M else print('No')

Buggy submission (verdict: Runtime Error):
def LI():
	return [ int(s) for s in input().split() ]
N,M = LI()
A = LI()

print('Yes') if sum(map(lambda x: x >= (1/4/M))) >= M else print('No')
Problem p02732 (python)

Fixed submission:
import collections
 
def LI():
	return [ int(s) for s in input().split() ]
 
N = int(input())
A = LI()
 
c_counter = [0]*(2*(10**5))
 
for a in A:
  c_counter[a]+=1
 
total = 0
total_dict = [0]*(2*(10**5))
 
for a in range(len(c_counter)):
  v = c_counter[a]
  if v >= 2:
    comb = v*(v-1)//2
    total_dict[a] = comb
    total += comb
 
for a in A:
  if total == 0:
    print(0)
  else:
    print(total - total_dict[a] + (c_counter[a]-1)*(c_counter[a]-2)//2)

Buggy submission (verdict: Runtime Error):
import collections
import sys

def LI():
	return [ int(s) for s in input().split() ]

N = int(input())
A = LI()

c_counter = collections.Counter(A)
c_dict = dict(c_counter)

total = 0
total_dict = {}

for k,v in c_dict.items():
  if v >= 2:
    comb = v*(v-1)//2
    total_dict[k] = comb
    total += comb

for a in A:
  if total == 0:
    print(0)
  else:
    print(total - total_dict[a] + (c_dict[a]-1)*(c_dict[a]-2)//2)

Buggy submission (verdict: Runtime Error):
import collections
import sys

def LI():
	return [ int(s) for s in input().split() ]

N = int(input())
A = LI()

c_counter = collections.Counter(A)
c_dict = dict(c_counter)


total = 0
total_dict = {}

for k,v in c_dict.items():
  if v >= 2:
    comb = v*(v-1)//2
    total_dict[k] = comb
    total += comb
    
if total == 0:
  print(0)
  sys.exit()

for a in A:
  print(total - total_dict[a] + (c_dict[a]-1)*(c_dict[a]-2)//2)

Buggy submission (verdict: Runtime Error):
import collections

def LI():
	return [ int(s) for s in input().split() ]

N = int(input())
A = LI()

c_counter = collections.Counter(A)
c_dict = dict(c_counter)


total = 0
total_dict = {}

for k,v in c_dict.items():
  if v >= 2:
    comb = v*(v-1)//2
    total_dict[k] = comb
    total += comb

for a in A:
  print(total - total_dict[a] + (c_dict[a]-1)*(c_dict[a]-2)//2)
Problem p02743 (python)

Fixed submission:
import math

def LI():
	return [ int(s) for s in input().split() ]
  
a,b,c = LI()
check = c-b-a 

print('Yes') if check > 0 and 4*a*b < check**2 else print('No')

Buggy submission (verdict: Runtime Error):
import math

def LI():
	return [ int(s) for s in input().split() ]
  
a,b,c = LI()

check = c-b-a 
print('Yes') if check > 0 and 4*a*b < check**2 print('No')
Problem p02817 (python)

Fixed submission:
s, t = input().split()
print(t + s)

Buggy submission (verdict: Runtime Error):
import math

def is_prime(x):
  if x <= 1:
    return False
  max_judge = math.sqrt(x)
  count = 2
  while(count < max_judge):
    if x % count == 0:
      return False
    count+=1
  return True
 
x = int(input())
 
judge_prime = False

while(True):
  if is_prime(x):
    break
  x+=1

print(x)

Buggy submission (verdict: Runtime Error):
class CookieCalc:
  def __init__(self, t_cookie, a_cookie):
    self.takahashi_cookie = t_cookie
    self.aoki_cookie = a_cookie
    
  def eat_cookie(self):
    if self.takahashi_cookie > 0:
      self.takahashi_cookie-=1
    elif self.aoki_cookie > 0:
      self.aoki_cookie -= 1
      
  def sum_cookie(self):
    return self.takahashi_cookie + self.aoki_cookie
      
t_cookie,a_cookie,K = [int(s) for s in input().split()]
cookie = CookieCalc(t_cookie, a_cookie)
 
for i in range(K):
  cookie.eat_cookie()
  if cookie.sum_cookie() == 0:
    break
    
  
print(cookie.takahashi_cookie, cookie.aoki_cookie)

Buggy submission (verdict: Runtime Error):
S, T = input()
print(T + S)
Problem p02841 (python)

Fixed submission:
def LI():
	return [int(s) for s in input().split()]

D1 = LI()
D2 = LI()
 
print(1) if D2[1] == 1 else print(0)

Buggy submission (verdict: Runtime Error):
def LI:
	return [int(s) for s in input().split()]
  

D1 = LI()
D2 = LI()

if print(0) if D2[0] != D1[0] else print(1)
Problem p02861 (python)

Fixed submission:
import math
import numpy as np
import itertools

def LI():
  return [int(s) for s in input().split()]

def distance(x1,x2):
  return math.sqrt((x1[0] - x2[0])**2 + (x1[1] - x2[1])**2)

def roots_distance(roots):
  dist = 0
  for i in range((len(roots)-1)):
    dist+=distance(locates[roots[i]],locates[roots[i+1]])
    
  return dist

N = int(input())

locates = np.array([LI() for i in range(N)])

dist = 0
count = 0
for roots in itertools.permutations(range(N),N):
  dist+=roots_distance(roots)
  count+=1
  
print(dist / count)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())

def distance(x1,x2,y1,y2):
  return math.sqrt((x1-x2)**2 + (y1-y2)**2)

x1,y1 = [int(s) for s in input().split()]

total_distance = 0
for i in range(1,N):
  x2,y2 = [int(s) for s in input().split()]
  total_distance += distance(x1,x2,y1,y2)
  
print total_distance / N
Problem p02885 (python)

Fixed submission:
def LI():
  return [int(s) for s in input().split()]
 
A,B = LI()
 
print(int(A-2*B)) if A > 2*B else print(0)

Buggy submission (verdict: Runtime Error):
 LI():
  return [int(s) for s in input().split()]
 
A,B = LI()
 
print(int(A-2*B)) if A > 2*B else print(0)
Problem p02898 (python)

Fixed submission:
N,K = [int(s) for s in input().split()]
heights = [int(s) for s in input().split()]
 
count = 0
 
for i in range(N):
  if heights[i] >= K:
    count+=1
    
print(count)

Buggy submission (verdict: Runtime Error):
import numpy

N,K = [int(s) for s in input.split()]
heights = np.array([int(s) for s in input().split()])

sum(heights > K)

Buggy submission (verdict: Runtime Error):
N,K = [int(s) for s in inpput().split()]
heights = [int(s) for s in input().split()]

count = 0

for i in range(N):
  if heights[i] >= K:
    count+=1
    
print(count)
Problem p02911 (python)

Fixed submission:
import numpy as np
 
def LI():
  return [int(s) for s in input().split()]
 
N,K,Q = LI()
Seikai_s = np.array([Q]*N)
 
for i in range(Q):
  seikai = int(input())
  Seikai_s[seikai-1]-=1
      
for i in range(N):
  if K-Seikai_s[i] > 0:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np

def LI():
  return [int(s) for s in input().split()]

N,K,Q = LI()
A_s = np.array([K]*N)

for i in range(Q):
  seikai = int(input())
  for j in range(N):
    if j != (seikai-1):
      A_s[j]-=1
      
for i in range(N):
  if A_s[i] > 0:
    print('Yes')
  else:
    print('No')
Problem p02934 (python)

Fixed submission:
def LI():
  return [int(s) for s in input().split()]

N = int(input())
A_s = LI()
 
total = 0
for a in A_s:
  total+=(1/a)
  
print(1/total)

Buggy submission (verdict: Runtime Error):
N = int(input())
A_s = LI()

total = 0
for a in A_s:
  total+=(1/a)
  
print(1/total)
Problem p02945 (python)

Fixed submission:
def LI():
  return [int(s) for s in input().split()]
 
A,B = LI()
 
print(max([A+B,A-B,int(A*B)]))

Buggy submission (verdict: Runtime Error):
def LI():
  return [int(s) for s in input().split()]

A,B = LI()

print(max(A+B,A-B,int(A*B))
Problem p02947 (python)

Fixed submission:
import string
import collections

N = int(input())
count = 0

s = []

for i in range(0,N):
  s.append(''.join(sorted(input())))

  
c = collections.Counter(s)
go = c.most_common()

for i in range(len(go)):
  k = go[i][1]
  count+=k*(k-1)//2
  
print(count)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = [sorted(input()) for _ in range(N)]
S = sorted(S)
print(sum(map(lambda x: x*(x-1)//2, Counter(S).values())))
Problem p02952 (python)

Fixed submission:
N = int(input())
count = 0
for i in range(1,N+1):
  s = str(i)
  if len(s) % 2 == 1:
    count+=1
    
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(s) for s in input().split()]
for i in range(N - 1):
    if H[i + 1] - H[i] >= 0:
        H[i + 1] -= H[i + 1] != H[i]
    else:
        print('No')
        exit()

print('Yes')
Problem p02971 (python)

Fixed submission:
import numpy as np

N = int(input())
A_s = []
for i in range(N):
  A_s.append(int(input()))
  
A_s = np.array(A_s)
  
m_index = A_s.argmax()
sort_A_s = sorted(A_s)
m_value = A_s[m_index]
m_second = sort_A_s[N-2]

for i in range(N):
  if i != m_index:
    print(m_value)
  else:
    print(m_second)

Buggy submission (verdict: Runtime Error):
A = [int(s) for s in input().split()]
first, second = sorted(A)[::-1][:2]
for a in A:
    print(first if a != first else second)

Buggy submission (verdict: Runtime Error):
N = int(input())
A_s = []
for i in range(N):
  A_s.append(int(input()))
  
A_s = np.array(A_s)
  
m_index = A_s.argmax()
sort_A_s = sorted(A_s)
m_value = A_s[m_index]
m_second = sort_A_s[N-2]

for i in range(N):
  if i != m_index:
    print(m_value)
  else:
    print(m_second)
Problem p02640 (python)

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

for i in range(x + 1):
    if 4 * i + 2 * (x - i) == y:
        print('Yes')
        exit()

print('No')

Buggy submission (verdict: Runtime Error):
    x, y = map(int,input().split())
     
    for i in range(x+1):
        if 4 * i + 2*(x - i) == y:
            print('Yes')
            exit()
     
    print('No')
Problem p02642 (python)

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

a_max = max(a)
cnt = [0] * (max(a) + 1)
ans = 0

for ai in a:
    for multi in range(ai, a_max + 1, ai):
        cnt[multi] += 1

for ai in a:
    if cnt[ai] == 1:
        ans += 1

print(ans)

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

a = sorted(a)
a.append(0)

ans = 0
tmp = 0
for i in range(len(a)):
    if a[i] == 1:continue
    tmp = a[i]
    if a[i] != a[i+1]:
        ans += 1
    for j in range(len(a)):
        if a[j] % tmp == 0:
            a[j] = 1
        if all(x == 1 for x in a):
            print(ans)
            exit()
Problem p02755 (python)

Fixed submission:
A,B = map(int, input().split())
for i in range(1010):
    if int(i*0.08) == A and int(i*0.1) == B:
        print(i)
        exit()

print(-1)

Buggy submission (verdict: Runtime Error):
A,B = int(input())
ans = -1
for i in range(1010):
    if int(i*0.08) == A and int(i*0.1) == B:
        ans = i
        exit()

print(ans)

Buggy submission (verdict: Runtime Error):
A,B = int(input())
ans = -1
for i in range(1010):
    if int(i*0.08) == A and int(i*0.1) == B:
        ans = i
        break

print(ans)
Problem p02765 (python)

Fixed submission:
K, R = map(int, input().split())
ans = 0
 
if K >= 10:
  ans = R
else:
  ans = R + 100*(10 - K)
 
print(ans)

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

if N >= 10:
  ans = R
else:
  ans = R + 100*(10 - K)

print(ans)
Problem p02621 (python)

Fixed submission:
x = int(input())
print(x+x*x+x*x*x)

Buggy submission (verdict: Runtime Error):
x = int(import())
print(x+x*x+x*x*x)