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

Fixed submission:
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
h, n = i2()
a = intl()
print("Yes" if h <= sum(a) else "No")

Buggy submission (verdict: Runtime Error):
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
h, n = i2()
a = intl()
m1 = max(a)
del a[a.index(m1)]
m2 = max(a)
print("Yes" if h <= m1+m2 else "No")
Problem p02811 (python)

Fixed submission:
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass

k ,x = i2()
if 500*k >= x:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass

n = i()
s = s()
cnt = 0
l = s.split("ABC")
if len(l) == 1:
    print(0)
else:
    print(len(l)-1)
Problem p02844 (python)

Fixed submission:
if __name__ == "__main__":
    n = int(input())
    s = list(input())
    cnt = 0
    def f(x):
        tgt = [x[0],x[1],x[2]]
        now = 0
        global n
        for i in range(n):
            if s[i] == tgt[now]:now += 1
            if now == 3:return True
        return False
    for i in range(1000):
        if len(str(i)) == 1:
            t = "00"+str(i)
        elif len(str(i)) == 2:
            t = "0"+str(i)
        else:t = str(i)
        if f(t):cnt += 1
    print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
import math
import numpy as np
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n = I()
    s = L()
    cnt = 0
    def f(x):
        tgt = [x[0],x[1],x[2]]
        now = 0
        global n
        for i in range(n):
            if s[i] == tgt[now]:now += 1
            if now == 3:return True
        return False
    for i in range(1000):
        if len(str(i)) == 1:
            t = "00"+str(i)
        elif len(str(i)) == 2:
            t = "0"+str(i)
        else:t = str(i)
        if f(t):cnt += 1
    print(cnt)
Problem p02952 (python)

Fixed submission:
n = int(input())
cnt = 0
for i in range(1,n+1):
  if len(str(i))%2 != 0:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt = 0
for i in range(1,n+1):
  if len(str(i)%2 == 0):
    cnt += 1
print(cnt)
Problem p02958 (python)

Fixed submission:
n = int(input())
a = [int(k) for k in input().split()]
cnt = 0
for i in range(n):
  if a[i] != i+1:cnt += 1
print("YES" if cnt <= 2 else "NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(k) for k in input().split()]
cnt = 0
for i in range(n):
  if a[i] != i+1:cnt += 1
print("YES" if k <= 2 else "NO")
Problem p02988 (python)

Fixed submission:
n = int(input())
a = [int(k) for k in input().split()]
cnt = 0
for i in range(n-2):
  if a[i] < a[i+1] and a[i+1] < a[i+2]:cnt += 1
  elif a[i] > a[i+1] and a[i+1] > a[i+2]:cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(k) for k in input().split()]
cnt = 0
for i in range(n-3):
  if a[i] < a[i+1] and a[i+1] < a[i+2]:cnt + =1
print(cnt)
Problem p03086 (python)

Fixed submission:
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i,n):
        if all("ATGC".count(c) == 1 for c in s[i:j+1]):
            ans = max(ans,j - i + 1)
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
for i in range(n):
    for j in range(i,n):
        if all("ATGC".count(c) == 1 for c in s[i:j+1]):
            ans = max(ans,j - i + 1)
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
for i in range(n):
    for j in range(i,n):
        if all("ATGC".cout(c) == 1 for c in s[i:j+1]):
            ans = max(ans,j - i + 1)
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
for i in range(n):
    for j in range(i,n):
        if all("ATGC".cout(c) for c in s[i:j+1]):
            ans = max(ans,j - i + 1)
print(ans)
Problem p03150 (python)

Fixed submission:
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    s = S()
    cnt = 0
    tgt = "keyence"
    for i in range(8):
        if s[:i] + s[len(s)-7+i:] == tgt:
            print("YES")
            exit()
    print("NO")

Buggy submission (verdict: Runtime Error):
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    s = S()
    cnt = 0
    tgt = "keyence"
    j = 0
    f = False
    for i in range(len(s)):
        if (s[i] == tgt[j]):
            j += 1
            f = True
        elif f:
            cnt += 1
            f = False
    #print(cnt,j)
    print("Yes" if cnt <= 1 and j == 7 else "No")
Problem p03281 (python)

Fixed submission:
import math
"""
方針
nは１<= n <= 200なので、
あらかじめ200まで全探索 O(n*2*√n)
"""
def countyakusu(n):
    cnt = 0
    for i in range(1,int(math.sqrt(n))+1):
        if n%i == 0:
            cnt += 1
            if i != n//i:
                cnt += 1
    return cnt
result = [0]*200
for i in range(1,201):
    if i%2 != 0:
        result[i-1] = countyakusu(i)

n = int(input())
cnt = 0
for i in range(n):
    if result[i] == 8:cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
"""
方針
nは１<= n <= 200なので、
あらかじめ200まで全探索 O(n*2*√n)
"""
def countyakusu(n):
    cnt = 0
    for i in range(1,int(math.sqrt(n))+1):
        if n%i == 0:
            cnt += 1
            if i != n//i:
                cnt += 1
    return cnt
result = [0]*200
for i in range(1,201):
    if i%2 != 0:
        result[i-1] = countyakusu(i)

n = int(input())
cnt = 0
for i in range(n):
    if result[i] == 8:cnt += 1
print(cnt)
Problem p03624 (python)

Fixed submission:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = l()
alf = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(s)):
	alf = alf.replace(s[i],"")
if alf == "":
	print("None")
else:
	print(alf[0])

Buggy submission (verdict: Runtime Error):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = l()
alf = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(s)):
	alf = alf.trplace(s[i],"")
print(alf)
if alf == "":
	print("None")
else:
	print(alf[0])

Buggy submission (verdict: Runtime Error):
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    alpha = "abcdefghijklmnopqrstuvwxyz"
    inp = S()
    for i in inp:
        alpha = alpha.strip(i)
    print(alpha[0])
Problem p03738 (python)

Fixed submission:
a = int(input())
b = int(input())
if a > b:
  print("GREATER")
elif a == b:
  print("EQUAL")
else:
  print("LESS")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a > b:
  print("GREATER")
elif a == b:
  print("EQUAL")
else:
  print("LESS")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a > b:
  print("GREATER")
elif a == b:
  print("EQUAL")
else:
  print("LESS")
Problem p04029 (python)

Fixed submission:
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass

n = i()
a = [i for i in range(1,n+1)]
print(sum(a))

Buggy submission (verdict: Runtime Error):
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass

n = i()
a = intl()
if n == 1:print(0)
else:
    s = max(a)+min(a)
    k1 = s//2
    k2 = s//2 + s%2
    k3 = s//2 -1
    c1 = 0
    c2 = 0
    c3 = 0
    for i in range(n):
        c3 += (a[i]-k3)**2
        c2 += (a[i]-k2)**2
        c1 += (a[i]-k1)**2
    print(min(c1,c2,c3))
Problem p04044 (python)

Fixed submission:
n,l = map(int,input().split())
s = [input() for i in range(n)]
s.sort()
for k in s:
  print(k, end ="")

Buggy submission (verdict: Runtime Error):
n,l = map(int,input(),split())
s = [input() for _ in range(n)]
s.sort()
for k in s:
  print(k, end ="")
Problem p02716 (python)

Fixed submission:
def main():
    N=int(input())
    A=[int(_) for _ in input().split()]
    dp=[[0,0,0] for _ in range(N//2+1)]
    for i in range(N//2):
        dp[i+1][0]=dp[i][0]+A[i*2]
        dp[i+1][1]=max(dp[i][1],dp[i][0])+A[i*2+1]
        if N%2:
            dp[i+1][2]=max(dp[i][2],dp[i][1],dp[i][0])+A[i*2+2]
    if N%2:
        print(max(dp[-1]))
    else:
        print(max(dp[-1][:2]))

main()

Buggy submission (verdict: Runtime Error):
def dp(i,k):
    if k<=0:
        return 0
    tmp=N-i
    if k>(tmp//2)+(tmp%2):
        return -float('inf')
    return max(A[i]+dp(i+2,k-1),dp(i+1,k))

N=int(input())
A=[int(_) for _ in input().split()]
print(dp(0,N//2))

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

@lru_cache(None)
def dp(N,A,i,k):
    if k<=0:
        return 0
    tmp=N-i
    if k>(tmp//2)+(tmp%2):
        return -float('inf')
    return max(A[i]+dp(N,A,i+2,k-1),dp(N,A,i+1,k))

def main():
    N=int(input())
    A=[int(_) for _ in input().split()]
    print(dp(N,A,0,N//2))

main()

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

def main():
    N=int(input())
    A=[int(_) for _ in input().split()]

    @lru_cache(None)
    def dp(i,k):
        if k<=0:
            return 0
        tmp=N-i
        if k>(tmp//2)+(tmp%2):
            return -float('inf')
        return max(A[i]+dp(i+2,k-1),dp(i+1,k))
    print(dp(0,N//2))

main()

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

    def dp(i,k):
        if k<=0:
            return 0
        tmp=N-i
        if k>(tmp//2)+(tmp%2):
            return -float('inf')
        return max(A[i]+dp(i+2,k-1),dp(i+1,k))
    print(dp(0,N//2))

main()

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

    def dp(i,k):
        if k<=0:
            return 0
        tmp=N-i
        if k>tmp//2+tmp%2:
            return -float('inf')
        return max(A[i]+dp(i+2,k-1),dp(i+1,k))

    print(dp(0,N//2))

main()

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

def main():
    N=int(input())
    A=[int(_) for _ in input().split()]

    def dp(i,k):
        if k<=0:
            return 0
        tmp=N-i
        if k>ceil(tmp/2):
            return -float('inf')
        return max(A[i]+dp(i+2,k-1),dp(i+1,k))

    print(dp(0,N//2))

main()

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

def main():
    N=int(input())
    A=[int(_) for _ in input().split()]

    def dp(i,k):
        print(i,k)
        if k<=0:
            return 0
        tmp=N-i
        if k>ceil(tmp/2):
            return -float('inf')
        return max(A[i]+dp(i+2,k-1),dp(i+1,k))

    print(dp(0,N//2))

main()

Buggy submission (verdict: Runtime Error):
from math import ceil
INF=float('inf')

def main():
    N=int(input())
    A=[int(_) for _ in input().split()]

    def dp(i,k):
        print(i,k)
        if k<=0:
            return 0
        tmp=N-i
        if k>ceil(tmp/2):
            return -INF
        return max(A[i]+dp(i+2,k-1),dp(i+1,k))

    print(dp(0,N//2))

main()
Problem p02730 (python)

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

def kaibun_checker(s):
    rev_s = s[::-1]
    len_s = len(s)
    for i in range(len_s//2):
        if s[i]!=rev_s[i]:
            return False
    return True

if N==3:
    print('Yes' if S[0]==S[2] else 'No')
else:
    if kaibun_checker(S[:]) and kaibun_checker(S[(N+3)//2]) and kaibun_checker(S[(N+3)//2-1:]):
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
S=input()
N=len(S)

def kaibun_checker(s):
    rev_s = s[::-1]
    len_s = len(s)
    for i in range(len_s//2):
        if s[i]!=rev_s[i]:
            return False
    return True

if kaibun_checker(S[:]) and kaibun_checker(S[(N+3)//2]) and kaibun_checker(S[(N+3)//2-1:]):
    print('Yes')
else:
    print('No')
Problem p02995 (python)

Fixed submission:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

A,B,C,D=map(int,input().split())
Cdiv = B // C - (A-1) // C
Ddiv = B // D - (A-1) // D
cddiv = (C*D) // gcd(C, D)
CDdiv = B // (cddiv) - (A-1) // cddiv

print( (B-A+1) - Cdiv - Ddiv + CDdiv )

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

A,B,C,D=map(int,input().split())
Cdiv = B // C - (A-1) // C
Ddiv = B // D - (A-1) // D
cddiv = (C*D) // gcd(C, D)
CDdiv = B // (cddiv) - (A-1) // cddiv

print( (B-A+1) - Cdiv - Ddiv + CDdiv )
Problem p03079 (python)

Fixed submission:
A,B,C=map(int,input().split())
print('NYoe s'[A==B==C::2])

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
print('NYoe s'[a==b==c::2])
Problem p03473 (python)

Fixed submission:
print(48-int(input()))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=input()
if s[:a].isdigit() and s[a:b]=='-' and s[b:].isdigit():
    print("True")
else:
    print("No")
Problem p03494 (python)

Fixed submission:
n=int(input())
lst=list(map(int,input().split()))
count=0
def check(lst):
    for i in lst:
        if i%2 != 0:
            return False
    return True
def two_devision(lst):
    new_lst=[]
    for i in lst:
        new_lst.append(i//2)
    return new_lst
while check(lst):
    lst=two_devision(lst)
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
n=int(input())
lst=list(map(int,input().split()))
count=0
def gcd(*numbers):
    return reduce(math.gcd, numbers)
result = gcd(*lst)
while 1:
    if result%2 == 0:
        count += 1
        result //= 2
    else:
        break
print(count)

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

n=int(input())
lst=list(map(int,input().split()))
count=0

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

result = gcd(*lst)

while 1:
    if result%2 == 0:
        count += 1
        result //= 2
    else:
        break
print(count)
Problem p03555 (python)

Fixed submission:
print("YES" if input()==input()[::-1] else "NO")

Buggy submission (verdict: Runtime Error):
import math
print(math.floor(math.sqrt(int(input())))**2)
Problem p03651 (python)

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
def gcd(a,b):
    if b==0:
        return a
    return gcd(b, a%b)
if N==1:
    print("POSSIBLE" if K==A[0] else "IMPOSSIBLE")
    exit()
element=gcd(A[0], A[1])
if N!=2:
    for _ in range(2, N):
        element=gcd(element, A[_])

print("POSSIBLE" if K%element==0 and max(A)>=K else "IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
def gcd(a,b):
    if b==0:
        return a
    return gcd(b, a%b)
element=gcd(A[0], A[1])
if N!=2:
    for _ in range(2, N):
        element=gcd(element, A[_])

print("POSSIBLE" if K%element==0 and max(A)>=K else "IMPOSSIBLE")
Problem p03719 (python)

Fixed submission:
A,B,C = map(int,input().split())
if A<=C<=B:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
c = [map(int,input().split()) for i in range(M)]
result = [0]*N

for a,b in c:
    result[a-1] += 1
    result[b-1] += 1

for i in result:
    print(i)
Problem p03795 (python)

Fixed submission:
n=int(input())
print(n*800-(n//15)*200)

Buggy submission (verdict: Runtime Error):
n=int(input())
print(n*800-adder*200)
Problem p04043 (python)

Fixed submission:
lst=list(map(int,input().split()))
so_lst=sorted(lst)
if so_lst[0]==5 and so_lst[1] == 5 and so_lst[2]==7:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
sorted_lst=sorted(list(map(int,input().split())))
if so_lst[0]==5 and so_lst[1] == 5 and so_lst[2]==7:
    print("YES")
else:
    print("NO")
Problem p02640 (python)

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

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

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())

ans = 'No'
for i range(x+1):
  if (x*2 + (x-i)*4) == y:
    ans='Yes'
    break
print(ans)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
if n == 0:
  print(x)
else:
  list_ = list(map(int, input().split()))

  diff = 0
  while True:
    if x-diff not in list_:
      print(x-diff)
      break
    if x+diff not in list_:
      print(x+diff)
      break
    diff+=1

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
  print(x)
else:
  list_ = list(map(int, input().split()))

diff = 0
while True:
  if x-diff not in list_:
    print(x-diff)
    break
  if x+diff not in list_:
    print(x-diff)
    break
  diff+=1

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
  print(x)
else:
  list_ = list(map(int, input().split()))

  all_list = list(range(1,101))
  for i in list_:
    all_list.remove(i)

  left = 0
  right = len(all_list)-1

  while left<right:
    mid = (left + right) // 2
    if x < all_list[mid]:
      right = mid
    else:
      left = mid+1
  
  small = all_list[left-1]
  big = all_list[right]

  if abs(small-x)<abs(big-x):
    print(small)
  elif abs(small-x)>abs(big-x):
    print(big)
  else:
    print(small)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
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, cnt])

    if temp!=1:
        arr.append([temp, 1])

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

    return arr

n = int(input())
if n==1:
  print(0)
else:
  arr = factorization(n)
  trial_list = []
  for p in arr:
    i = p[0]
    j = p[1]
    for k in range(1,j+1):
      trial_list.append(i**k)
  sorted(trial_list)
  cnt=0
  for i in trial_list:
    if n%i==0:
      cnt+=1
      n//=i
  print(cnt)
Problem p02947 (python)

Fixed submission:
n = int(input())
check = {}
lst = []

for _ in range(n):
  s = list(input())
  s.sort()
  s = "".join(s)
  lst.append(s)
  try:
    check[s]+=1
  except:
    check.update({s:1})
  
cnt=0
check_set = set(lst)
for c in check_set:
  temp_cnt = check[c]
  cnt +=  temp_cnt*(temp_cnt-1)/2
print(int(cnt))

Buggy submission (verdict: Runtime Error):
n = int(input())
check = {}
lst = []

for _ in range(n):
  s = list(input())
  s.sort()
  s = "".join(s)
  lst.append(s)
  try:
    check[s]+=1
  else:
    check.update({s:1})
  
cnt=0
check_set = set(lst)
for c in check_set:
  temp_cnt = check[c]
  cnt +=  temp_cnt*(temp_cnt-1)/2
print(int(cnt))
Problem p02971 (python)

Fixed submission:
import numpy as np

n = int(input())
lst = []
for _ in range(n):
  lst.append(int(input()))
max_idx = np.argmax(lst)
max_ = lst[max_idx]
lst[max_idx] = 0
next_max_ = max(lst)

for i in range(len(lst)):
  if i == max_idx:
    print(next_max_)
  else:
    print(max_)

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

n = int(input())
lst = []
for _ in range(n):
  lst.append(int(input()))
max_idx = np.argmax(lst)
max_ = lst[max_idx]
lst[max_idx] = 0
next_max_ = max(lst)

for i in range(lst):
  if i == max_idx:
    print(next_max_)
  else:
    print(max_)
Problem p03000 (python)

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

cnt=1
dist=0

for l in L:
  dist+=l
  if dist>X:
    break
  cnt+=1
    
print(cnt)

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

cnt=1
dist=0

for l in L:
  cnt+=1
  dist+=l
  if dist>=X:
    break
    
print(cnt)

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

cnt=1
dist=0

for l in L:
  cnt+=1
  dist+=l
  if dist>=X:
    break
    
print(cnt)