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

Fixed submission:
a=set(map(int,input().split()))
print("Yes" if len(a)==2 else "No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print("No" if a==b==c or a!=b!=!c else "Yes")
Problem p02897 (python)

Fixed submission:
N = int(input())
print(1/2 if (N % 2 == 0) else (N + 1) / 2 / N)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(if(n%2==0) 1/2 else (n+1)/2/n)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a>=3200:
  print(s)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
if a >= 3200:
  print(s)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
if a >=3200:
  print(s)
  else:
    print("red")
Problem p02711 (python)

Fixed submission:
N = input()
if int(N[2])==7:
    print("Yes")
elif int(N[1])==7:
    print("Yes")
elif int(N[0])==7:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = input()
if int(N[2])=7:
    print("Yes")
elif int(N[1])=7:
    print("Yes")
elif int(N[0])=7:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = input()
if int(N[2])=7:
    print("Yes")
elif int(N[1])=7:
    print("Yes")
elif int(N[0])=7:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = input()
if int(x[2])=7:
    print("Yes")
elif int(x[1])=7:
    print("Yes")
elif int(x[0])=7:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
N = str(input())
if int(x[2])=7:
    print(Yes)
else if int(x[1])=7:
    print(Yes)
else if int(x[0])=7:
    print(Yes)
else:
    print(No)

Buggy submission (verdict: Runtime Error):
N = input()
if int(x[2])=7:
    print(Yes)
else if int(x[1])=7:
    print(Yes)
else if int(x[0])=7:
    print(Yes)
else:
    print(No)

Buggy submission (verdict: Runtime Error):
x = input()
if int(x[2])=7:
    print(Yes)
else if int(x[1])=7:
    print(Yes)
else if int(x[0])=7:
    print(Yes)
else:
    print(No)
Problem p02773 (python)

Fixed submission:
N = input()
dic = {}
max = 0
for i in range(int(N)):
  word = input()
  if word not in dic.keys():
    
    if max == 0:
      max += 1
    dic[word] = 1
    
  else:
    
    if max == dic[word]:
      max += 1
    dic[word] += 1

candidates = sorted([word for word in dic.keys() if dic[word] == max])
for word in candidates:
  print(word)

Buggy submission (verdict: Runtime Error):
N = input()
dic = {}
max = 0
for i in range(int(N)):
  word = input()
  if word not in dic.keys():
    
    if max == 0:
      max += 1
    dic['word'] = 1
    
  else:
    
    if max == dic['word']:
      max += 1
    dic['word'] += 1
    
candidates = sorted([word for word in dic.keys() if dic[key] == max])
for word in candidates:
  print(word)

Buggy submission (verdict: Runtime Error):
n = input()
words_org = []
for i in range(int(n)):
  words_org.append(input())
print(words_org)

countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1], reverse=True)
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)

Buggy submission (verdict: Runtime Error):
n = input()
words_org = []
for i in range(int(n)):
  words_org.append(input())

countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1], reverse=True)
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)

Buggy submission (verdict: Runtime Error):
n = input()
words_org = []
for i in range(int(n)):
  words_org.append(input())

countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1], reverse=True)
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)

Buggy submission (verdict: Runtime Error):
n = input()
words_org = []
for i in range(n):
  words_org.append(input())
countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1])
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)
Problem p02990 (python)

Fixed submission:
#atcoder_RedAndBlueBalls

import numpy as np 

MAX = pow(10,9)+7

def fact(n):
    ls = [1] 
    for i in range(1,n+1):
        ls.append(ls[i-1]*i) 
    return(ls) 

n,k = input().split()
n,k = int(n),int(k) 

ls = fact(2000)

def C(n,m):
    return ((ls[n]//(ls[m]*ls[n-m])) % MAX)

for i in range(k):
    ans = ( C(n-k+1,i+1) * C(k-1,i) ) % MAX 
    print (ans)

Buggy submission (verdict: Runtime Error):
#atcoder_RedAndBlueBalls

import numpy as np 
from math import factorial as fact

MAX = pow(10,9)+7


def C(n,m):
    return (fact(n)//(fact(m)*fact(n-m))) 

n,k = input().split()
n,k = int(n),int(k) 

for i in range(k):
    ans = (C(n-k+1,i+1) * C(k-1,i) ) % MAX 
    print (ans)
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())
x=1
for i in range(3):
  if x!=A and x!=B:
    print(str(x))
  x+=1

Buggy submission (verdict: Runtime Error):
N = int(input())
S,T = map(str,input().split())
A = ""
for i in S:
  A+=i
  for j in T:
    A+=j
print(A)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
x=1
for i range(3):
  if x!=A and x!=B:
    print(str(x))
  x+=1
Problem p02831 (python)

Fixed submission:
from fractions import gcd
A,B=map(int,input().split())
x=(A*B)//(gcd(A,B))

print(x)

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
x=(A*B)/(math.gcd(A,B))

print(str(x))

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
x=(A*B)//(math.gcd(A,B))

print(str(x))

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
x=A*B//math.gcd(A,B)

print(x)

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
x=A*B//gcd(A,B)

print(x)

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
print(str(math.gcd(A,B)))

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
print(str(gcd(A,B)))
Problem p02707 (python)

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

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

for i in B:
    print(i)

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

B = [0 for i in range(len(A))]
for i in A:
    B[i] =B[i] + 1

for i in B:
    print(i)

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

B = [0 for i in range(len(A))]
for i in A:
    B[i] =B[i] + 1

for i in range(B):
    print(i)
Problem p03127 (python)

Fixed submission:
import numpy as np

n = int(input())
A = np.array([int(i) for i in input().split()])

A=np.sort(A)
s=A[0]
for i in range(max([n, s])):
    c = A[0]
    A = A % c
    A[0] = c
    z=len(A) - np.count_nonzero(A)
    A=np.sort(A)[z:]
    if len(A) == 1:
        break
print (A[0])

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

n = int(input())
A = np.array([int(i) for i in input().split()])

A=np.sort(A)
s=A[0]
for i in range(max([n, s])):
    c = A[0]
    A = A % c
    A[0] = c
    z=A.count(0)
    A=np.sort(A)[z:]
    for j in range(len(A)):
        if A[0] != 0:
            break
        A = np.delete(A, 0)
    if len(A) == 1:
        break
print (A[0])
Problem p03221 (python)

Fixed submission:
n,m=[int(i) for i in input().split()]
P=[[int(i) for i in input().split()] for j in range(m)]

def prefecturesort(i):
    return i[0]

def yearsort(i):
    return i[1]

W=[0 for i in range(n)]
Z=[]

for i in range(m):
    P[i].append(i)
    W[P[i][0]-1]+=1

P.sort(key=prefecturesort)
P_c=[]
sum=0
for i in range(n):
    c=W[i]
    if c==0:
        P_c.append([])
    else:
        P_c.append(P[sum:c+sum])
    sum+=c
    P_c[i].sort(key=yearsort)
for x in P_c:
    for j in range(len(x)):
        X=str("{0:06d}".format(x[j][0]))
        Y=str("{0:06d}".format(j+1))
        Z.append([X+Y,x[j][2]])
Z.sort(key=yearsort)
for i in range(m):
    print(Z[i][0])

Buggy submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
P=[[int(i) for i in input().split()] for j in range(m)]

def prefecturesort(i):
    return i[0]

def yearsort(i):
    return i[1]

W=[0 for i in range(n)]
Z=[]

for i in range(m):
    P[i].append(i)
    W[P[i][0]]+=1

P.sort(key=prefecturesort)
P_c=[]
sum=0
for i in range(n):
    c=W[i]
    if c==0:
        P_c.append([])
    else:
        P_c.append(P[sum:c+sum])
    sum+=c
    P_c[i].sort(key=yearsort)
for x in P_c:
    for j in range(len(x)):
        X=str("{0:06d}".format(x[j][0]))
        Y=str("{0:06d}".format(j+1))
        Z.append([X+Y,x[j][2]])
Z.sort(key=yearsort)
for i in range(m):
    print(Z[i][0])

Buggy submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
P=[[int(i) for i in input().split()] for j in range(m)]

def prefecturesort(i):
    return i[0]

def yearsort(i):
    return i[1]

W=[]
Z=[]

for i in range(m):
    P[i].append(i)
    W.append(P[i][0])

P.sort(key=prefecturesort)
P_c=[]
sum=0
for i in range(n):
    P_c.append(P[sum:W.count(i+1)+sum])
    sum+=c
    P_c[i].sort(key=yearsort)
for x in P_c:
    for j in range(len(x)):
        X=str("{0:06d}".format(x[j][0]))
        Y=str("{0:06d}".format(j+1))
        Z.append([X+Y,x[j][2]])
Z.sort(key=yearsort)
for i in range(m):
    print(Z[i][0])
Problem p03286 (python)

Fixed submission:
n=int(input())

if n==0:
    ans="0"
else:
    ans=""
    while n!=0:
        ans=str(n%2)+ans
        n=-1*(n//2)
ans=int(ans)
print(ans)

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

if n==0:
    print(0)
else:
    ans=""
    while n!=0:
        ans=str(n%2)+ans
        n=-1*(n//2)
ans=int(ans)
print(ans)

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

if n==0:
    print(0)
else:
    ans=""
    while n!=0:
        ans=str(n%2)+ans
        n=n//(-2)
ans=int(ans)
print(ans)
Problem p02707 (python)

Fixed submission:
import collections

N = int(input())
s = list(map(int, input().split()))

ct = collections.Counter(s)

for i in range(N):
    print(ct[i+1])

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
#s = [0,]*(N-1)
s = []
for i in range(N-1):
    #s[i] = int(input())
    s.append(int(input()))

ct = collections.Counter(s)

for i in range(N):
    print(ct[i+1])

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

N = int(input())
#s = [0,]*(N-1)
s = []
for i in range(N-1):
    #s[i] = int(input())
    s.append(int(input()))

ct = Counter(s)

for i in range(N):
    print(ct[i+1])

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

N = int(input())
s = [0]*(N-1)
for i in range(N-1):
    s[i] = int(input())

ct = Counter(s)

for i in range(N):
    print(ct[i+1])

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

N = int(input())
s = [0]*(N-1)
for i in range(N-1):
    #s[i] = ''.join(sorted(list(input())))
    s[i] = int(input())

ct = Counter(s)

for i in range(N):
    print(ct[i+1])

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

N = int(input())
s = [0]*(N-1)
for i in range(N-1):
    #s[i] = ''.join(sorted(list(input())))
    s[i] = int(input())

ct = Counter(s)

for i in range(1,N):
    if i in ct.keys():
        print(ct[i])
    else:
        print(0)
#print(0)

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

N = int(input())
s = [0]*(N-1)
for i in range(N-1):
    #s[i] = ''.join(sorted(list(input())))
    s[i] = int(input())

ct = Counter(s)

for i in range(1,N):
    if i in ct.keys():
        print(ct[i])
    else:
        print(0)
print(0)
Problem p02707 (python)

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

result = [0 for _ in range(n)]
for i in range(n - 1):
    result[a[i]-1] += 1

for v in result:
    print(v)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(0, n - 1):
    a.append(int(input()))

for i in range(1, n +1):
    print(a.count(i))
Problem p02729 (python)

Fixed submission:
import itertools

n,m = map(int, input().split())

even = [i for i in range(2, 333, 2)]

odd = [i for i in range(1, 333, 2)]


seq = []


for i in range(n):
    seq.append(even[i])

for i in range(m):
    seq.append(odd[i])



cnt = 0

for v1, v2 in itertools.combinations(seq,2):
    tmp = int(v1) + int(v2)
    if tmp % 2 == 0:
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
import itertools

n,m = map(int, input().split())

even = [i for i in range(2, 100, 2)]

odd = [i for i in range(1, 100, 2)]


seq = []


for i in range(n):
    seq.append(even[i])

for i in range(m):
    seq.append(odd[i])



cnt = 0

for v1, v2 in itertools.combinations(seq,2):
    tmp = int(v1) + int(v2)
    if tmp % 2 == 0:
        cnt += 1

print(cnt)
Problem p03018 (python)

Fixed submission:
s = input().replace('BC','D')
n = len(s)
 
count = 0
res = 0
 
for i in range(n):
    if s[i] == 'A':
        count += 1
    elif s[i] == 'D':
        res += count
    else:
        count = 0
print(res)

Buggy submission (verdict: Runtime Error):
s = input().replace('BC','D')
n = len(s)
 
count = 0
res = 0
 
for i in range(n):
    if s[i] == 'A':
        count += 1
    elif s[i] == 'D':
        res += count
    else:
        count = 0
print ans

Buggy submission (verdict: Runtime Error):
s = input().replace('BC','D')
n = len(s)
 
count = 0
res = 0
 
for i in range(n):
    if s[i] == 'A':
        count += 1
    elif s[i] == 'D':
        res += count
    else:
        count = 0
 
print(ans)
Problem p02766 (python)

Fixed submission:
n,m = map(int,input().split())
ct = 0

while n > 0:
  ct+=1
  n//=m
  
print(ct)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ct = 0

while n > 0:
  ct+=1
  n//=k
  
print(ct)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
print(k * len(str(n))
Problem p02753 (python)

Fixed submission:
s=input()
if(s.count('A')==0 or s.count('B')==0):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
for i in range(100):
  if(i//12.5==a and i//10==b):
    print(i)
  else:
    print("-1")
Problem p02779 (python)

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
f=sorted(list(s))
d=set(s)
if(len(s)==len(d)):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(map(int,input().split()))
f=sortedlist(s)
d=set(s)
if(len(s)==len(d)):
  print("YES")
else:
  print("NO")
Problem p02819 (python)

Fixed submission:
x = int(input())
while any(x % i < 1 for i in range(2, x)): 
    x += 1
print(x)

Buggy submission (verdict: Runtime Error):
import sympy
x=int(input())
r=sympy.nextprime(x)
print(r)

Buggy submission (verdict: Runtime Error):
import sympy
x=int(input())
r=sympy.nextprime(50)
print(r)

Buggy submission (verdict: Runtime Error):
import sympy
x=int(input())
print sympy.nextprime(x)
Problem p02831 (python)

Fixed submission:
import fractions
 
A,B = map(int,input().split())
gcd = fractions.gcd(A,B)
lcm = int(A*B/gcd)
print(lcm)

Buggy submission (verdict: Runtime Error):
import fractions
m,n=map(int,input().split())
print int(m*n/fractions.gcd(m,n))

Buggy submission (verdict: Runtime Error):
import fractions
m,n=map(int,input().split())
print(m*n//gcd.fractions(m,n))
Problem p02711 (python)

Fixed submission:
n=str(input())
if n.find("7")!= -1:
   print("Yes")
else:
   print("No")

Buggy submission (verdict: Runtime Error):
n=str(N)
if n.find("7")!= -1:
   print('Yes')
else:
   print('No')

Buggy submission (verdict: Runtime Error):
n=str(N)
if n.find("7")!= -1:
   print("Yes")
else:
   print("No")

Buggy submission (verdict: Runtime Error):
n=str(N)
if n.find("7")!= -1:
   print("Yes")
else:
   print("No")

Buggy submission (verdict: Runtime Error):
n=str(N)
if n.find("7")!=-1
   print("Yes")
else 
   print("No")

Buggy submission (verdict: Runtime Error):
n=str(N)
if n.find(7)!=-1
   print("Yes")
else 
   print("No")
Problem p02712 (python)

Fixed submission:
n=int(input())
a=1
b=0
while True:
	if a%3!=0 and a%5!=0:
		b+=a
	if a==n:
		break
	a+=1
print(b)

Buggy submission (verdict: Runtime Error):
n=input(a)
n.remove('Buzz','Fizz','FizzBuzz')
print(sum(n))

Buggy submission (verdict: Runtime Error):
n=input()
n.remove('Buzz')
n.remove('Fizz')
n.remove('FizzBuzz')
print(sum(n))

Buggy submission (verdict: Runtime Error):
n=input()
n.remove('Buzz','Fizz','FizzBuzz')
print(sum(n))
Problem p02879 (python)

Fixed submission:
A,B = map(int,input().split())
if A>=10 or B>=10: 
    print(-1)
else:
    print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = map(input().split())
if A>=10 or B>=10: 
    print(-1)
else:
    print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = map(input(split.()))
if A>=10 or B>=10: 
    print(-1)
else:
    print(A*B)
Problem p02707 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
buka = list()
for i in range(N):
    buka.append(0)
for j in range(len(A)):
    buka[A[j]-1] += 1
for k in range(len(buka)):
    print(buka[k])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
def count(n, a):
    c = 0
    for i in range(n+1):
        if a[i] == n:
            c += 1
    return c
for j in range(N):
    print(count(j+1, A))
Problem p02707 (python)

Fixed submission:
a=[0]*int(input())
for i in input().split(): a[int(i)-1]+=1
for i in range(len(a)): print(f'{a[i]}')

Buggy submission (verdict: Runtime Error):
a=[0]*int(input())
for i in input().split(): a[int(i)-1]+=1
for i in range(N): print(f'{a[i]}')
Problem p02711 (python)

Fixed submission:
n = input()
x = len(n)
b = 'false'
for i in range(x):
    if n[i] is '7':
        b = 'true'
        print('Yes')
        break
if b is not 'true':
  print('No')

Buggy submission (verdict: Runtime Error):
n = input()
if n<100 or n>999:
	x = len(n)
	for i in range(x):
    	if n[i] is '7':
       		print('Yes')
        	break
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = input()
if n<100 or n>999:
    n = 107
x = len(n)
for i in range(x):
    if n[i] is '7':
        print('Yes')
        break

Buggy submission (verdict: Runtime Error):
n = input()
while n<100 or n>999:
    n = input()
x = len(n)
for i in range(x):
    if n[i] is '7':
        print('Yes')
        break
Problem p02766 (python)

Fixed submission:
#ライブラリの読み込み
import math

#入力値の格納
n,k = map(int, input().split())

#n進数への変換定義
def convert(x,y):
    if int(x/y):
        return convert(int(x/y),y) + str(x%y)
    return str(x%y)

#n進数へ変換し長さを算出
text = len(convert(n,k))

#結果を表示
print(text)

Buggy submission (verdict: Runtime Error):
#ライブラリの読み込み
import math

#入力値の格納
x = int(input())

#得点の計算
score = int((x // 500 * 1000) + (x % 500 // 5 * 5))

#表示
print(score)
Problem p02712 (python)

Fixed submission:
n = int(input())

list = []

count = 1

for i in range(n):
  if count % 3 != 0 and count % 5 != 0:
    list.append(count)
  count += 1
    
print(sum(list))

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

count = 0

for i in range(N):
	num = int(input())
    if num % 3 == 0 and num % 5 == 0:
    	continue
    elif num % 3 == 0:
    	continue
    elif num % 5 == 0:
    	continue
    else:
    	count += num

print(count)
Problem p02753 (python)

Fixed submission:
bus = input()
if bus == 'AAA' or bus == 'BBB':
	print('No')
else:
	print('Yes')

Buggy submission (verdict: Runtime Error):
a = input()
	if a == 'AAA':
    	print('NO')
    elif a == 'BBB':
    	print('NO')
    else:
    	print('YES')
Problem p02759 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
	print(N // 2)
elif N % 2 == 1:
	print(N // 2 + 1)

Buggy submission (verdict: Runtime Error):
num = int(input())
if num % 2 == 0:
	print(num // 2)
elif:
	print(num // 2 + 1)
Problem p02754 (python)

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
    n, a, b = na()
    
    if (a == 0 and b == 0) or a == 0:
        print(0)
        return

    if n <= a:
        print(n)
        return
      
    AB = a + b
    if n <= AB:
        print(min(n, a))
        return 
    
    x = int(n / AB)

    print(x * a + min(n - (x * AB), a))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
    n, a, b = na()
    
    if a == 0 and b == 0 || a == 0:
        print(0)
        return

    if n <= a:
        print(n)
        return
      
    AB = a + b
    if n <= AB:
        print(min(n, a))
        return 
    
    x = int(n / AB)
    print(x * a + n - (x * AB))

if __name__ == '__main__':
    main()
Problem p02881 (python)

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def main():
  n = ni()

  x = divi(n)
  
  ans = 1e18+7
  for i in range(0, len(x), 2):
    # print(x[i])
    try:
      ans = min(ans, x[i] - 1 + x[i+1] - 1)
    except:
      ans = min(ans, (x[i] - 1) * 2)  
  print(ans)
  
main()

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def main():
  n = ni()

  x = divi(n)
  
  ans = 1e18+7
  for i in range(0, len(x), 2):
    print(x[i])
    ans = min(ans, x[i] - 1 + x[i+1] - 1)
  print(ans)
  

main()
Problem p02897 (python)

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n = ni()

  odd = 1 if n%2 == 1 else 0
  for i in range(1, n+1):
    if i%2 == 0:
      odd += 1
  print(odd/n)

main()

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n = ni()

  odd = 1 if i%2 == 1 else 0
  for i in range(1, n+1):
    if i%2 == 0:
      odd += 1
  print(odd/n)

main()
Problem p02933 (python)

Fixed submission:
N = int(input())
S = input()

if N >= 3200:
  print(S)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <string>

using namespace std;

int main(){
  int a; 
  string s;
  cin >> a >> s;

  if (a < 3200) {
    cout << "red" << endl;
  } else {
    cout << s << endl;
  }
}

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin
na = lambda: map(int, stdin.readline().split())

def main():
  N, Q = na()

  ab = []
  for _ in range(N-1):
    a, b = na()
    ab.append([a, b])
  ab.sort()

  counter = [0] * (N+1)
  for _ in range(Q):
    p, x = na()
    counter[p] += x
  for i in range(N - 1):
    counter[ab[i][1]] += counter[ab[i][0]]
  print(*counter[1:])

if __name__ == "__main__":
  main()