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

Fixed submission:
N=int(input())
if N%2==0:
  print(N)
else:
  print(N*2)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N%2==0:
  print(N)
else
  print(N*2)
Problem p03315 (python)

Fixed submission:
a=list(input())
count=0
for i in a:
  if i=='-':
    count-=1
  else:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
a=list(input())
count=1
for i in a:
  if i==-:
    count-=1
  else:
    count+=1
print(count)
Problem p02547 (python)

Fixed submission:
N=int(input())
D={}
for i in range(N):
    D[i]=input().split()

cou=0
for i in range(N):
    if D[i][0]==D[i][1]:
        cou+=1
        if cou ==3:
            print('Yes')
            break
    else:
        cou=0

if cou < 3:
    print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
D={}
for i in range(N):
    D[i]=[input().split()]

cou=0
for i in range(N):
    if D[i][0]==D[i][1]:
        cou+=1
    else:
        cou=0
    if cou == 3:
        print('Yes')
        break

if cou == 0:
    print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
D={}
for i in range(N):
    D=[input().split()]

cou=0
for i in range(N):
    if D[i][0]==D[i][1]:
        cou+=1
    else:
        cou=0
    
    if cou == 3:
        print('Yes')
        break

if cou == 0:
    print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
D={}
for i in range(N):
    D=[input().split()]
    for w in range(2):
        D[i][w]=int(D[i][w])

cou=0
for i in range(N):
    if D[i][0]==D[i][1]:
        cou+=1
    else:
        cou=0
    
    if cou == 3:
        print('Yes')
        break

if cou == 0:
    print('No')
Problem p02546 (python)

Fixed submission:
S = input()

if S[-1] == "s":
    print(S + "es")
else:
    print(S + "s")

Buggy submission (verdict: Runtime Error):
import sys

N, K = list(map(int, input().split()))
MOD = 998244353

sys.setrecursionlimit(N * 3)

L = []
R = []
for _ in range(K):
    l, r = list(map(int, input().split()))
    L.append(l)
    R.append(r)

memo = [None] * (N + 1)

def f(x):
    if x < 0:
        return 0
    if memo[x] is None:
        memo[x] = _f(x)
    # print(x, memo[x])
    return memo[x]


def _f(x):
    if x < 1:
        return 0
    if x == 1:
        return 1
    ans = 0
    for k in range(K):
        for i in range(L[k], R[k] + 1):
            ans += f(x - i)
            ans %= MOD
    return ans % MOD

print(f(N) % MOD)
Problem p02546 (python)

Fixed submission:
s = input()

if s[-1] != "s":
  s = s + "s"
  
else:
  s = s + "es"
  
print(s)

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

if s[-1] != "s":
  s.append("s")
  
else:
  s.append("es")
  
print(s)
Problem p02571 (python)

Fixed submission:
S = input()
T = input()

s = len(S)
t = len(T)
ans1 = 10000000

for i in range(s - t + 1):
  ans = 0
  for j in range(t):
    if T[j] != S[i + j]:
      ans += 1
      
  ans1 = min(ans, ans1)
      
print(ans1)

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

s = len(S)
t = len(T)
ans1 = 10000000

for i in range(s - t + 1):
  ans = 0
  for j in range(t):
    if t[j] != s[i + j]:
      ans += 1
      
  ans1 = ans
      
print(ans1)
Problem p02572 (python)

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

for i in range(N):
  sum_a += A[i] 

for i in range(N):
  sum_a -= A[i]
  sum += A[i] * sum_a
  ans = sum % (10**9 + 7)

print(ans)

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

for i in range(N):
  sum_a += A[i] 

for i in range(N):
  sum_a -= A[i]
  sum += A[i] * sum_a
  ans = sum % (10**9 + 7)

print(ans)
Problem p02577 (python)

Fixed submission:
N = input()
s = len(N)
sum = 0

for i in range(s):
  sum += int(N[i])
  
if sum % 9 == 0:
  print("Yes")
  
else:
  print("No")

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

sum(list(map(int, str(n))))
a = sum % 9

if a == 0:
  print("Yes")

else:
  print("No")

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

sum(list(map(int, str(n))))
a = sum // 9

if a == 0:
  print("Yes")

else:
  print("No")

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

sum(list(map(int, str(n))))

if sum // 9 == 0:
  print("Yes")

else:
  print("No")

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

sum(list(map(int, str(n))))

if sum // 9 == 0:
  print(Yes)

else:
  print(No)

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

sum(list(map(int, str(n))))

if sum // == 0:
  print(Yes)

else:
  print(No)
Problem p02578 (python)

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

for i in range(N - 1):
  if A[i] > A[i + 1]:
    dif = A[i] - A[i + 1]
    sum += dif
    A[i +1] = A[i + 1] + dif
    
print(sum)

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

for i in range(N - 1):
  if A[i] > A[i +1]:
    dif = A[i] - A[i + 1]
    sum += dif
    A[i +1] = A[i + 1] + dif
    
  else:
    
print(sum)

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

for i in range(N - 1):
  if A[i] > A[i +1]:
    dif = A[i] - A[i + 1]
    sum += dif
    A[i +1] = A[i + 1] + dif
    
  else:
    
print(sum)

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

for i in range(N - 1):
  if A[i] > A[i +1]:
    dif = A[i] - A[i + 1]
    sum += dif
    A[i +1] = A[i + 1] + dif
    
  else:
    
print(sum)
Problem p02595 (python)

Fixed submission:
import math

N, D = map(int, input().split())
count = 0

for i in range(N):
  x, y = map(int, input().split())
  d = math.sqrt(x**2 + y**2)
  
  if d<=D:
    count += 1
    
print(count)

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

for i in range(N):
  x, y = map(int, input().split())
  d = sqrt(x**2 + y**2)
  
  if d<=D:
    count += 1
    
print(count)
Problem p02676 (python)

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

length = len(S)

if length <= K:
  print(S)
  
else:
  S = S[:K]
  print(S + "...")

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()

length = len(S)

if length <= K:
  print(S)
  
else:
  S = S[K:]
  print(S.apend("..."))
Problem p02707 (python)

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

result = [0] * N

for a in A:
  result[a-1] += 1
  
for i in range(N):
  print(result[i])

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

result = [0] * N

for a in A:
  result[a-1] += 1
  
for i in range(N):
  print(result[i])
Problem p02773 (python)

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

for i in range(len(ans)):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

for i in len(ans):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

for i in ans:
  print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.apend(keys)
    
ans.sort()

for i in ans:
  print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for i in dic.keys():
  if dic[keys] == maxim:
    ans.apend(keys)
    
ans.sort()

for i in ans:
  print(ans[i])
Problem p02785 (python)

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

a = 0

if K > N:
  a = K - N

for _ in range(a):
  H.append(0)

H.sort(reverse = True)
sum = 0

for i in range(K):
  H[i] = 0
  
for i in range(N):
  sum += H[i]
  
print(sum)

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

H.sort(reverse = True)
sum = 0

for i in range(K):
  H[i] = 0
  
for i in range(N):
  sum += H[i]
  
print(sum)

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

H.sort(reverse = True)
sum = 0

for i in range(K):
  H[i] = 0
  
sum = sum(H)

print(sum)
Problem p02831 (python)

Fixed submission:
import numpy as np

A, B = map(int, input().split())

print(np.lcm(A, B))

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

A, B = map(int, input().split())

print(lcm(A, B))
Problem p02577 (python)

Fixed submission:
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

N = int(input())
if digitSum(N)%9==0:
    print("Yes")
else:
    print("No")

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

sum=0
while(1):
    sum=sum+(N%10)
    N=int(N/10)
    #print("sum")
    #print(sum)
    #print("N")
    #print(N)
    if N==0:
        break

if sum%9==0:
    print("Yes")
else:
    print("No")
Problem p02689 (python)

Fixed submission:
n,m =map(int,input().split())
h=list(map(int,input().split()))
result=[1]*n
for i in range(m):
    a,b =map(int,input().split())
    a-=1
    b-=1
    if h[a]>h[b]:
        result[b]=0
    elif h[a]<h[b]:
        result[a]=0
    else:
        result[a]=0
        result[b]=0

print(sum(result))

Buggy submission (verdict: Runtime Error):
n,m =map(int,input().split())
h=list(map(int,input().split()))
result=list(range(n))
for i in range(m):
    a,b =map(int,input().split())
    a-=1
    b-=1
    if h[a]>h[b]:
        if b in result:
            del result[b]
    elif h[a]<h[b]:
        if a in result:
            del result[a]
    else:
        if a in result:
            del result[a]
        if b in result:
            del result[b]

print(len(result))
Problem p02546 (python)

Fixed submission:
a=input()
if a[-1]=='s':
  print(a+'es')
else:
  print(a+'s')

Buggy submission (verdict: Runtime Error):
import numpy as np
num=input().split(' ')
count=0
plot=np.zeros([int(num[0]),int(num[0])])
t=[]
for a in range(int(num[1])):
  tmp=input().split(' ')
  t.append([int(tmp[0])+a for a in range(int(tmp[1])-int(tmp[0])+1)])
for a in range(int(num[0])):
  if a==0:
    plot[0,0]=1
  else:
    for posit in np.where(plot[a-1]>0)[0]:
      for b in t:
        for c in b:
          if posit+c<int(num[0]):
	          plot[a,posit+c]+=plot[a-1,posit]
xx=int(np.sum(plot[:,-1]))
print(xx%998244353)
Problem p02570 (python)

Fixed submission:
x=input().split(' ')
d=int(x[0])
s=int(x[1])
t=int(x[2])
if t<d/s:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
t=np.array(input().split(' '))
num=np.zeros(n)
for a in range(n):
  num[a]=int(t[a])
a=np.sum(num)**2
b=np.sum(num**2)
x=int((a-b)/2)
x=(x-1)%(10**9+7)
print(x)

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
t=input().split(' ')
num=np.zeros(n)
for a in range(n):
  num[a]=int(t[a])
a=np.sum(num)**2
b=np.sum(num**2)
x=int((a-b)/2)
x=x%(10**9+7)-1
print(x)
Problem p02625 (python)

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

dp = [0] * n
mod = 10**9 + 7


if n == 1:
    print((m-n) * m % mod)
elif n == 2:
    ans = (m - n)**2 + (m - n + 1)
    for i in range(2):
        ans *= (m - i)
        ans %= mod
    print(ans)
else:
    dp[0] = m - n
    dp[1] = (m - n)**2 + (m - n + 1)


    for i in range(2, n):
        dp[i] = (dp[i-1] + dp[i-2]) * i + dp[i-1] * (m - n)
        dp[i] %= mod

    ans = dp[-1]

    for i in range(n):
        ans *= (m - i)
        ans %= mod

    print(ans)

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

dp = [0] * n
mod = 10**9 + 7

dp[0] = m - n
dp[1] = (m - n)**2 + (m - n + 1)


for i in range(2, n):
    dp[i] = (dp[i-1] + dp[i-2]) * i + dp[i-1] * (m - n)
    dp[i] %= mod

ans = dp[-1]

for i in range(n):
    ans *= (m - i)
    ans %= mod

print(ans)
Problem p02873 (python)

Fixed submission:
s = input()
n = len(s) + 1

a = [-1] * n
tmp = 0

if s[0] == '<':
    a[0] = 0
if s[-1] == '>':
    a[-1] = 0

for i in range(1,n-2):
    if s[i] == '>' and s[i+1] == '<':
        a[i+1] = 0

for i in range(n-1):
    if a[i] == 0:
        tmp = 1
    else:
        tmp += 1
    if s[i] == '<':
        a[i+1] = tmp
    else:
        tmp = 0

for i in range(n-1):
    i = i * (-1) - 1
    if a[i] == 0:
        tmp = 1
    else:
        tmp += 1
    if s[i] == '>':
        a[i-1] = max(tmp, a[i-1])
    else:
        tmp = 0

print(sum(a))

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s) + 1

a = [-1] * n

if s[0] == '<':
    a[0] = 0
if s[-1] == '>':
    a[-1] = 0

for i in range(1,n-2):
    if s[i] == '>' and s[i+1] == '<':
        a[i+1] = 0

for i in range(n-1):
    if a[i] == 0:
        tmp = 1
    else:
        tmp += 1
    if s[i] == '<':
        a[i+1] = tmp
    else:
        tmp = 0

for i in range(n-1):
    i = i * (-1) - 1
    if a[i] == 0:
        tmp = 1
    else:
        tmp += 1
    if s[i] == '>':
        a[i-1] = max(tmp, a[i-1])
    else:
        tmp = 0

print(sum(a))
Problem p02891 (python)

Fixed submission:
s = input()
k = int(input())

li = []

count = 1
tmp = s[0]

if len(s) == 1:
    print(k//2)
    exit()

for i in range(1,len(s)):
    if s[i] == tmp:
        count += 1
    else:
        li.append((s[i-1],count))
        count = 1
    tmp = s[i]
if count != 1:
    li.append((s[-1],count))

if len(li) == 1:
    print(li[0][1] * k // 2)
elif li[0][0] == li[-1][0] and k >= 2:
    li2 = [(li[0][0],li[0][1]+li[-1][1])]
    for i in range(1,len(li)-1):
        li2.append(li[i])
    ans = 0
    for i in li2:
        ans += i[1] // 2
    ans *= k - 1
    for i in li:
        ans += i[1] // 2
    print(ans)
else:
    ans = 0
    for i in li:
        ans += i[1] // 2
    ans *= k
    print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

li = []

count = 1
tmp = s[0]

for i in range(1,len(s)):
    if s[i] == tmp:
        count += 1
    else:
        li.append((s[i-1],count))
        count = 1
    tmp = s[i]
if count != 1:
    li.append((s[-1],count))
    
if len(li) == 1:
    print(li[0][1] * k // 2)
elif li[0][0] == li[-1][0] and k >= 2:
    li2 = [(li[0][0],li[0][1]+li[-1][1])]
    for i in range(1,len(li)-1):
        li2.append(li[i])
    ans = 0
    for i in li2:
        ans += i[1] // 2
    ans *= k - 1
    for i in li:
        ans += i[1] // 2
    print(ans)
else:
    ans = 0
    for i in li:
        ans += i[1] // 2
    ans *= k
    print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

li = []

count = 1
tmp = s[0]

for i in range(1,len(s)):
    if s[i] == tmp:
        count += 1
    else:
        li.append((s[i-1],count))
        count = 1
    tmp = s[i]
if count != 1:
    li.append((s[-1],count))
    
if len(li) == 1:
    print(li[0][1] * k // 2)
elif li[0][0] == li[-1][0] and k >= 2:
    li2 = [(li[0][0],li[0][1]+li[-1][1])]
    for i in range(1,len(li)-1):
        li2.append(li[i])
    ans = 0
    for i in li2:
        ans += i[1] // 2
    ans *= k - 1
    for i in li:
        ans += i[1] // 2
    print(ans)
else:
    ans = 0
    for i in li:
        ans += i[1] // 2
    ans *= k
    print(ans)
Problem p02990 (python)

Fixed submission:
from math import factorial

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

mod = 10**9+7
nCr = {}

def cmb(n,r):
    return factorial(n)//(factorial(r)*factorial(n-r))

b = k
r = n - k


for i in range(1,k+1):
    r2 = r - i + 1
    if r2 < 0:
        print(0)
    else:
        print(int(cmb(b-1,i-1)*cmb(r2+i,i))%mod)

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

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

mod = 10**9+7
nCr = {}

def cmb(n,r):
    return factorial(n)//(factorial(r)*factorial(n-r))

b = k
r = n - k


for i in range(1,k+1):
    r2 = r - i + 1
    print(int(cmb(b-1,i-1)*cmb(r2+i,i))%mod)
Problem p03013 (python)

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

li = []
lia = [-1]
ans = 1
mod = 1000000007

for i in range(n+10):
    if i == 0 or i == 1:
        li.append(1)
    else:
        li.append((li[i-1] + li[i-2]) % mod)

for i in range(m):
    a = int(input())
    lia.append(a)

lia.append(n+1)

for i in range(len(lia)-1):
    if lia[i+1]-lia[i] != 1:
        ans *= li[lia[i+1]-lia[i]-2]
    else:
        ans = 0
    ans %= mod

print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
lia = [int(input()) for _ in range(m)]
cnt = 0
li = [0] * (n+1)
mod = 1000000007

for i in range(n+1):
    if i == 0 or i == 1:
        if lia[cnt] == i:
            li[i] = 0
            if cnt < m-1:
                cnt += 1
        else:
            li[i] = 1
    else:
        if lia[cnt] == i:
            li[i] = 0
            if cnt < m-1:
                cnt += 1
        else:
            li[i] = li[i-1] + li[i-2]
    li[i] %= mod

print(li[n])

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

li = []
lia = [-1]
ans = 1
mod = 1000000007

for i in range(n):
    if i == 0 or i == 1:
        li.append(1)
    else:
        li.append((li[i-1] + li[i-2]) % mod)

for i in range(m):
    a = int(input())
    lia.append(a)

lia.append(n+1)

for i in range(len(lia)-1):
    if lia[i+1]-lia[i] != 1:
        ans *= li[lia[i+1]-lia[i]-2]
    else:
        ans = 0
    ans %= mod

print(ans%mod)

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

li = [0]*10**5
lia = [-1]
ans = 1
mod = 1000000007

for i in range(n):
    if i == 0:
        li[i] = 1
    elif i == 1:
        li[i] = 1
    else:
        li[i] = li[i-1] + li[i-2]

for i in range(m):
    a = int(input())
    lia.append(a)

lia.append(n+1)

for i in range(len(lia)-1):
    if lia[i+1]-lia[i] != 1:
        ans *= li[lia[i+1]-lia[i]-2]
    else:
        if lia[i] == 0 or lia[i+1] == n:
            pass
        else:
            ans = 0
    ans %= mod

print(ans%mod)
Problem p03042 (python)

Fixed submission:
s = int(input())

b = s % 100
a = int((s-b)/100)

flaga = False
flagb = False

if a > 0 and a < 13:
    flaga = True
if b > 0 and b < 13:
    flagb = True

if flaga == True and flagb == True:
    print('AMBIGUOUS')
if flaga == False and flagb == True:
    print('YYMM')
if flaga == True and flagb == False:
    print('MMYY')
if flaga == False and flagb == False:
    print('NA')

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

b = s % 100
a = int((s-b)/100)

if a ==0 or b == 0:
    print(‘NA’)
elif a> 12 and b>12:
    print(‘NA’)
elif a>12:
    print(‘YYMM’)
elif b>12:
    print(‘MMYY’)
else:
    print(‘AMBIGUOUS’)

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

b = s % 100
a = int((s-b)/100)

if a ==0 or b == 0
    print(‘NA’)
elif a> 12 and b>12
    print(‘NA’)
elif a>12
    print(‘YYMM’)
elif b>12
    print(‘MMYY’)
else
    print(‘AMBIGUOUS’)
Problem p03107 (python)

Fixed submission:
s = input()
print(min(s.count('0'),s.count('1'))*2)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
count = 0

while True:
    if '10' in s:
        count += s.count('10') * 2
        s = s.replace('10','')
    elif '01' in s:
        count += s.count('01','') * 2
        s = s.replace('01','')
    else:
        break

print(count)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
count = 0

while True:
    if '10' in s:
        s = s.replace('10','',1)
        count += 2
        print(s)
    elif '01' in s:
        s = s.replace('01','',1)
        count += 2
        print(s)
    else:
        break

print(count)
Problem p03127 (python)

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

while len(li) > 1:
  a = min(li)
  for i in range(len(li)):
    if li[i] != a:
      li[i] %= a
  li = list(set(li))
  if 0 in li:
    li.remove(0)
      
print(li[0])

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

while len(li) > 1:
  a = min(li)
  for i in range(len(li)):
    li[i] %= a
    if li[i] == 0:
      li.pop(i)
      
print(li[0])

Buggy submission (verdict: Runtime Error):
import math

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

n = int(input())
li = list(map(int,input().split()))
li2 = list(set(li))
li2.sort()
li3 = [li2[0]]

for i in range(n-1):
    li3.append(abs(li[i+1]-li[i]))

a = math.gcd(li3[i],li3[i+1])
li4 = [a]

for i in li3:
    a = math.gcd(li4[-1],i)
    li4.append(a)

print(li4[-1])

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

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

n = int(input())
li = list(map(int,input().split()))
li2 = list(set(li))
li2.sort()
li3 = [li2[0]]

for i in range(n-1):
    li3.append(abs(li[i+1]-li[i]))

print(gcd_list(li2))
Problem p03221 (python)

Fixed submission:
n,m = map(int,input().split())
py = []
li = [1] * (10**5 + 10)

for i in range(m):
    p,y = map(int,input().split())
    py.append((p,y,i))

py.sort(key = lambda x: x[1])

ans = []

for p,y,i in py:
    ans_tmp = '0' * (6 - len(str(p))) + str(p) + '0' * (6 - len(str(li[p]))) + str(li[p])
    li[p] += 1
    ans.append([ans_tmp, i])

ans.sort(key = lambda x: x[1])
for i in range(m):
    print(ans[i][0])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
py = []
li = [1] * 10**5

for i in range(m):
    p,y = map(int,input().split())
    py.append((p,y,i))

py.sort(key = lambda x: x[1])

ans = []

for p,y,i in py:
    ans_tmp = '0' * (6 - len(str(p))) + str(p) + '0' * (6 - len(str(li[p]))) + str(li[p])
    li[p] += 1
    ans.append([ans_tmp, i])

ans.sort(key = lambda x: x[1])
for i in range(m):
    print(ans[i][0])
Problem p02693 (python)

Fixed submission:
K = int(input())
A, B = map(int, input().split())
result = 'NG'
for i in range (A, B + 1):
    if i % K == 0:
        result = 'OK'
print(result)

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().split())
result = 'NG'
for i in range (A, B + 1):
    if i % K == 0:
        result = 'OK'
print(result
Problem p02546 (python)

Fixed submission:
s = input()
print(s+'es') if s.endswith('s') else print(s+'s')

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

using namespace std;

int main()
{
    string s;
    cin >> s;
    if (s[s.size() - 1] == 's') {
        cout << s << "es";
    }
    else {
        cout << s << "s";
    }
    return 0;
}