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

Fixed submission:
import itertools
n,m,q = map(int,input().split())
inputList = []
for i in range(1,q+1):
    abcd = list(map(int,input().split()))
    inputList.append(abcd)
AList =  list(itertools.combinations_with_replacement(range(1,m+1), n))
PointList = []
for array in AList:
    point = 0
    for iList in inputList:
        if array[iList[1]-1] - array[iList[0]-1] == iList[2]:
            point = point + iList[3]
    PointList.append(point)
print(max(PointList))

Buggy submission (verdict: Runtime Error):
import itertools
n,m,q = map(int,input().split())
a = []
b = []
c = []
d = []
for i in range(1,q+1):
    ai,bi,ci,di = map(int,input().split())
    a.append(ai)
    b.append(bi)
    c.append(ci)
    d.append(di)
AList =  list(itertools.combinations(range(1,m+1), n))
PointList = []
for array in AList:
    point = 0
    for j in range(q):
        if array[b[j]-1] - array[a[j]-1] == c[j]:
            point = point + d[j]
    PointList.append(point)
print(max(PointList))
Problem p02689 (python)

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

data=[]
for n in range(N):
  data.append(H[n]-1)
    
for m in range(M):
  a,b=map(int,input().split(' '))
  data[a-1]=max(data[a-1],H[b-1])
  data[b-1]=max(data[b-1],H[a-1])
  
ans=0
for n in range(N):
  if H[n-1]-1==data[n-1]:
    ans+=1
print(ans)

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

data=[]
for n1 in range(N):
  data.append([])
  for n2 in range(N):
    data[n1].append(0)
    
for m in M:
  a,b=map(int,input().split(' '))
  data[a-1][b-1]=H[b-1]
  data[b-1][a-1]=H[a-1]
ans=0
for n in N:
  if H[n-1]>max(data[n-1]):
    ans+=1
print(ans)

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

data={{0 for in range(N)} for n in range(N)}

for m in range(M):
Problem p02701 (python)

Fixed submission:
from sys import stdin

def main():
    n = int(input())
    lst = list(set([stdin.readline()[:-1] for _ in range(n)]))
    print(len(lst))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    n = int(input())
    lst = set([stdin.readline()[:-1] for _ in range(n)])
    print(len(lst)))

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

Fixed submission:
def main():
    n = input()
    if '7' in n:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def bool3(a,b,c):
    if (a!=b) and (b!=c) and (c!=a):
        return True
    else:
        return False

def bool2(a,b,c):
    if a-b != b-c:
        return True
    else:
        return False

def main():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n):
        for j in range(i):
            ans += sum([1 if bool3(s[i],s[j],s[k]) and bool2(i,j,k) else 0 for k in range(j)])
    print(ans)

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

Fixed submission:
def main():
    k,n = map(int,input().split())
    pos = list(map(int, input().split()))
    dist = []
    for i in range(n-1):
        dist.append(pos[i+1] - pos[i])
    dist.append(k-pos[n-1]+pos[0])
    print(k - max(dist))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    k,n = map(int,input().split())
    pos = list(map(int, input().split()))
    dist[]
    for i in range(n-1):
        dist.append(pos[i+1] - pos[i])
    dist.append(k-pos[n]+pos[0])

    print(k - max(dist))

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

Fixed submission:
a,b,c = list(input())
print("No") if a==b and b==c and c==a else print("Yes")

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

if (a== b) and (a==c) and (b==C):
  ans = "No"
else:
  ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c = input().split()
print("No") if a == b and b == c and c == a else print("Yes")
Problem p02757 (python)

Fixed submission:
def main():
    N,P = map(int,input().split())
    S = input()[::-1]
    ans = 0
    if P == 2 or P == 5:
        for i,s in enumerate(S):
            if int(s) % P == 0:
                ans += N - i
    else:
        mods = [0] * P
        mods[0] = 1
        current = 0
        x = 1
        for s in S:
            current = (current + x * int(s)) % P
            ans += mods[current % P]
            mods[current % P] += 1
            x = x * 10 % P
    print(ans)

if __name__ == '__main__':
    main()

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

def main():
    N,P = map(int,input().split())
    S = input()[::-1]
    ans = 0
    if P == 2 or P == 5:
        for i,s in enumerate(S):
            if int(s) % P == 0:
                ans += N-i
    else:
        D = [0] * (N+1)
        for i in range(N):
            D[i] =  int(S[:i+1][::-1]) % P
        C = Counter(D)
        ans = 0
        for i in c.values():
            ans += i*(i-1)//2
    print(ans)

if __name__ == '__main__':
    main()

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

def main():
    N,P = map(int,input().split())
    S = input()[::-1]
    ans = 0
    if P == 2 or P == 5:
        for i,s in enumerate(S):
            if int(s) % P == 0:
                ans += N-i
    else:
        D = [0] * (N+1)
        for i in range(N):
            D[i] =  int(S[:i+1][::-1]) % P
        C = Counter(D)
        ans = sum([max(c*(c-1)//2 for c in C.values()])
    print(ans)

if __name__ == '__main__':
    main()

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

def main():
    N,P = map(int,input().split())
    S = list(map(int, input()))[::-1]
    D = [0] * (N+1)
    exp = 0
    for i, s in enumerate(S):
        exp += 1
        D[i] =  s * pow(10, exp) % P
    C = Counter(D)

    ans = 0
    for i in range(2020):
        ans += c[i] * (c[i]-1)//2
    print(ans)

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

Fixed submission:
from operator import itemgetter

n,m = map(int,input().split())
a = [int(i) for i in input().split()]
w = []
x = 0
for i in range(m):
    b,c = map(int,input().split())
    w.append((b,c))
w = list(sorted(w,key=itemgetter(1)))
w.reverse()
for i in w:
    a += [i[1]] * i[0]
    x += b
    if x > n:
        break
a.sort()
a = a[len(a)-n:]
print(sum(a))

Buggy submission (verdict: Runtime Error):
from operator import itemgetter

n,m = map(int,input().split())
a = [int(i) for i in input().split()]
w = []
x = 0
for i in range(m):
    b,c = map(int,input().split())
    w.append((b,c))
w = tuple(sorted(w,key=itemgetter(1)))
w.reverse()
for i in w:
    a += [i[1]] * i[0]
    x += b
    if x > n:
        break
a.sort()
a = a[len(a)-n:]
print(sum(a))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
for i in range(m):
    b,c = map(int,input().split())
    a += [c] * b
a = a.sort()[len(a)-n:]
print(sum(a))
Problem p02699 (python)

Fixed submission:
def compare():
    a,b=map(int,input().split())

    if a <= b:
        print("unsafe")
    else:
        print("safe")


compare()

Buggy submission (verdict: Runtime Error):
def compare():
  S=int(input())
  W=int(input())
  if S<=W:
    print("unsafe")
  else:
    print("safe")
compare()
Problem p02723 (python)

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input().split()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input().split()
if s[3] == s[4] and s[5] == s[6]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
if s[3] == s[4] and s[5] == s[6]:
    print("Yes")
else:
    print("No")
Problem p02773 (python)

Fixed submission:
n=int(input())
s=[input() for i in range(n)]
s=sorted(s)
s.append('')
s1=s[0]
ans=['']
tmp=1
kaisu=0
for i in range(1,n+1):
    if s[i]==s1:
        #ひとつ前と同じものだったら回数を１増やす
        tmp+=1
    else:
        if kaisu<tmp:
        #これまでの要素の最高登場回数よりも
        # 当該要素の登場回数が多ければ
        # リストを書き換える
            ans=['']
            ans.append(s1)
            kaisu=tmp
        elif kaisu==tmp:
        #最高回数と等しければリストに追加する
            ans.append(s1)
        tmp=1
        s1=s[i]
        
for i in range(1,len(ans)):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
#コメントの作法が分かりません><
n=int(input())
s=[input() for i in range(n)]
#入力を受け取る



l=list(set(s))
#sの重複している要素を除く

l.sort()
#辞書順に出力しないといけないので並べ替える

a=[]
#空のリストを作る

for i in range(len(l)):
    a.append(s.count(l[i]))
    #s中の各要素の登場回数を数えてリストaに入れる

r j in range(len(a)):
    while a[j]==max(a):
        print(l[j])
        j+=1

#aの各要素について、最大値を取っているならば
#そのaに対応する文字列を出力する
Problem p02847 (python)

Fixed submission:
s=input()
if s == 'SUN':
  print('7')
elif s == 'MON':
  print('6') 
elif s == 'TUE':
  print('5') 
elif s == 'WED':
  print('4')
elif s == 'THU':
  print('3')
elif s == 'FRI':
  print('2')
else:
  print('1')

Buggy submission (verdict: Runtime Error):
input()
if s == 'SUN':
  print('7')
elif s == 'MON':
  print('6') 
elif s == 'TUE':
  print('5') 
elif s == 'WED':
  print('4')
elif s == 'THU':
  print('3')
elif s == 'FRI':
  print('2')
else:
  print('1')
Problem p03042 (python)

Fixed submission:
S=input()
ab=int(S[0]+S[1])
cd=int(S[2]+S[3])
if ab==0:
  if cd==0:#0000
    print('NA')
  elif cd>=1 and cd<=12:
    #0001~0012
    print('YYMM')
  else: #0013~0099
    print('NA')
elif ab>=1 and ab<=12:
  if cd ==0:
    print('MMYY')
  elif cd>=1 and cd<=12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if cd>=1 and cd<=12:
    print('YYMM')
  else:
    print("NA")

Buggy submission (verdict: Runtime Error):
a=int(input())
if int(a[0])==0 and a[1]==0:
  print('NA')
elif int(a[2])==0 and a[3]==0:
  print('NA')
elif int(a[0])>=2:
  print ('YYMM')
elif int(a[0])>=1 and a[1]>=3:
  print('YYMM')
elif int(a[2])>=2:
  print ('MMYY')
elif int(a[2])>=1 and a[3]>=3:
  print('MMYY')

Buggy submission (verdict: Runtime Error):
a=int(input())
if a[0]==0 and a[1]==0:
  print('NA')
elif a[2]==0 and a[3]==0:
  print('NA')
elif a[0]>=2:
  print ('YYMM')
elif a[0]>=1 and a[1]>=3:
  print('YYMM')
elif a[2]>=2:
  print ('MMYY')
elif a[2]>=1 and a[3]>=3:
  print('MMYY')

Buggy submission (verdict: Runtime Error):
a=int(input())
if a[0]==0 and a[1]==0:
  print('NA')
elif a[2]==0 and a[3]==0:
  print('NA')
elif a[0]>=2:
  print ('YYMM')
elif a[0]>=1 and a[1]>=3:
  print('YYMM')
elif a[2]>=2:
  print ('MMYY')
elif a[2]>=1 and a[3]>=3:
  print('MMYY')

Buggy submission (verdict: Runtime Error):
a=int(input())
if a[0]==0 and a[1]==0:
  print('NA')
elif a[2]==0 and a[3]==0:
  print('NA')
elif a[0]>=2:
  print ('YYMM')
elif a[0]>=1 and a[1]>=3:
  print('YYMM')
elif a[2]>=2:
  print ('MMYY')
elif a[2]>=1 and a[3]>=3:
  print('MMYY')

Buggy submission (verdict: Runtime Error):
a=input()
if a[0]==0 and a[1]==0:
  print('NA')
elif a[2]==0 and a[3]==0:
  print('NA')
elif a[0]>=2:
  print ('YYMM')
elif a[0]>=1 and a[1]>=3:
  print('YYMM')
elif a[2]>=2:
  print ('MMYY')
elif a[2]>=1 and a[3]>=3:
  print('MMYY')
Problem p03272 (python)

Fixed submission:
a,b= (int(i) for i in input().split())  
print(a-b+1)

Buggy submission (verdict: Runtime Error):
a,b=int(input.split())
print(a-b+1)
Problem p03631 (python)

Fixed submission:
n=input()
if len(n)%2==0:
    m=int(len(n)/2)
else:
    m=int((len(n)-1)/2)

a=0

for i in range(m):
    if n[i]==n[-1*(i+1)]:
       continue
    else:
        a+=1

if a==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if b<=c or d<=a:
    print(0)
else:
    print(min(d,b)-max(a,c))
Problem p03803 (python)

Fixed submission:
a,b=map(int,input().split())
s=[2,3,4,5,6,7,8,9,10,11,12,13,1]
if s.index(a)==s.index(b):
    print('Draw')
elif s.index(a)>s.index(b):
    print('Alice')
else:
    print('Bob')

Buggy submission (verdict: Runtime Error):
a,b=map(int(input().split()))
s=[2,3,4,5,6,7,8,9,10,11,12,13,1]
if s.index(a)==s.index(b):
    print('Draw')
elif s.index(a)>s.index(b):
    print('Alice')
else:
    print('Bob')

Buggy submission (verdict: Runtime Error):
a,b=map(int(input().split()))
s=[2,3,4,5,6,7,8,9,10,11,12,13,1]
if a.index=b.index:
    print('Draw')
elif a.index>b.index:
    print('Alice')
else:
    print('Bob')
Problem p02695 (python)

Fixed submission:
from itertools import permutations, accumulate, combinations, combinations_with_replacement
import sys
input = sys.stdin.readline


def main():
    n, m, q = map(int, input().split())
    # <方針>：Aを全列挙する
    ans = 0
    a = [0] * q
    b = [0] * q
    c = [0] * q
    d = [0] * q
    for i in range(q):
        a[i], b[i], c[i], d[i] = map(int, input().split())
        a[i] -= 1
        b[i] -= 1
    for A in combinations_with_replacement(range(1, m + 1), n):
        tmp = 0
        for i in range(q):
            if A[b[i]] - A[a[i]] == c[i]:
                tmp += d[i]
        ans = max(ans, tmp)
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import pi, ceil, floor
import numpy as np
from collections import defaultdict, deque,Counter
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


def main():
    n, m, q = map(int, input().split())
    l = [tuple(map(int, input().split())) for _ in range(q)]
    ans = 0
    for i in range(2 ** q):  # とるかとらないかの2択
        check = [0] * q
        for j in range(q):
            if i >> j & 1:
                check[j] = 1
        # print(check)
        A = [1] * n
        used = [0] * n
        tmp = 0
        for k in range(q):
            if check[k]:  # とる時
                a, b, c, d = l[k]
                a -= 1
                b -= 1
                if not used[b]:  # 使ってない時は変更できる
                    A[b] = c + A[a]
                    tmp += d
                    used[b] = 1  # 変更ずみにする
                    used[a] = 1
                    if A[b] > m:  # m以上の場合はダメ
                        tmp = 0
                        break
                elif A[b] == c + A[a]:  # たまたま変更してからあってたら追加
                    tmp += d
                else:  # 条件に合わない場合
                    tmp = 0
                    break
        ans = max(ans, tmp)
    print(ans)



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

Fixed submission:
a, b = map(int, input().split())
# a, bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
# a, bの最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(a * b // math.gcd(a, b))
Problem p02862 (python)

Fixed submission:
mod = 10 ** 9 + 7
x, y = map(int, input().split())
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if (x + y) % 3 != 0 or a < 0 or b < 0:
    print(0)
    exit()
n = a + b
r = min(a, b)
ans = 1
for i in range(r):
    ans = ans * (n - i) * pow(i + 1, mod - 2, mod) % mod
print(ans)

Buggy submission (verdict: Runtime Error):
mod = 10 ** 9 + 7
x, y = map(int, input().split())
if (x + y) % 3 != 0:
    print(0)
    exit()
a = 0
while y / x != 2 and x / y != 2:
    x -= 2
    y -= 1
    a += 1
b = min(x, y)

n = a + b
r = min(a, b)
x = 1
for i in range(n - r):
    x = x * (n - i) % mod
y = 1
for j in range(1, r):
    y = y * j
ans = x * pow(y, mod - 2, mod) % mod
print(ans)
Problem p02891 (python)

Fixed submission:
import math
s = list(input())
ss = s[:]
k = int(input())
cnt = 0

if len(set(s)) == 1:
    cnt = math.floor(len(s) * k / 2)
else:
    cnt = 0
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            cnt += 1
            s[i + 1] = '*'
    cnt *= k
    if ss[0] == ss[-1]:
        a = 1
        for i in range(len(ss) - 1):
            if ss[i] == ss[i + 1]:
                a += 1
            else:
                break
        b = 1
        for j in range(len(ss) - 1, 0, -1):
            if ss[j] == ss[j - 1]:
                b += 1
            else:
                break
        cnt -= (k - 1) * (math.floor(a / 2) + math.floor(b / 2) - math.floor((a + b) / 2))
print(cnt)

Buggy submission (verdict: Runtime Error):
import math
s = list(input())
ss = s[:]
k = int(input())
cnt = 0

if len(set(s)) == 1:
    cnt = math.floor(len(s) * k / 2)
else:
    cnt = 0
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            cnt += 1
            s[i + 1] = '*'
    cnt *= k
    if s[0] == s[-1]:
        a = 0
        for i in range(len(s) - 1):
            if ss[i] == ss[i + 1]:
                a += 1
        b = 0
        for j in range(len(s), 0, -1):
            if ss[j] == ss[j - 1]:
                b += 1
        cnt -= (k - 1) * (math.floor(a / 2) + math.floor(b / 2) - math.floor((a + b) / 2))
print(cnt)
Problem p03221 (python)

Fixed submission:
N, M = map(int, input().split())
arr = [0 for _ in range(M)]
for i in range(M):
    p, y = map(int, input().split())
    arr[i] = [p, y, i]

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

arr[0][1] = 1
P_cnt = [1 for _ in range(10 ** 6)]
ans_list = [0] * M
for p, y, i in arr:
    ans_list[i] = [str(p).zfill(6) + str(P_cnt[p]).zfill(6), i]
    P_cnt[p] += 1

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

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
arr = [0 for _ in range(M)]
for i in range(M):
    p, y = map(int, input().split())
    arr[i] = [p, y, i]

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

arr[0][1] = 1
P_cnt = [1 for _ in range(10 ** 5)]
ans_list = [0] * M
for p, y, i in arr:
    ans_list[i] = [str(p).zfill(6) + str(P_cnt[p]).zfill(6), i]
    P_cnt[p] += 1

ans_list.sort(key=lambda x: x[1])
for i in range(M):
    print(ans_list[i][0])
Problem p03329 (python)

Fixed submission:
n = int(input())
dp = [0 for _ in range(n+1)]
for i in range(1, n+1):  # iは金額
    dp[i] = i  # 初期化
    power = 1  # 累乗を初期化
    while power <= i:  # 累乗より小さい値の時はループに入る
        dp[i] = min(dp[i], dp[i - power] + 1)  # 漸化式
        power *= 6  # 6の累乗を更新
    power = 1  # 累乗を初期化
    while power <= i:  # 累乗より小さい時はループい入る
        dp[i] = min(dp[i], dp[i - power] + 1)  # 漸化式
        power *= 9  # 9の累乗を更新
print(dp[n])

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


max_n = 11000
dp = [-1] * max_n  # -1を未探索とする
dp[0] = 0  # 初期条件の設定
n = int(input())
que = deque([])
que.append(dp[0])
while que:
    v = que.popleft()
    pow = 1
    while v + pow <= n:
        if dp[v + pow] == -1:
            dp[v + pow] = dp[v] + 1
            que.append(v + pow)
        pow *= 6
    pow = 1
    while v + pow <= n:
        if dp[v + pow] == -1:
            dp[v + pow] = dp[v] + 1
            que.append(v + pow)
        pow *= 9
# print(dp)
print(dp[n])
Problem p03774 (python)

Fixed submission:
n, m = map(int, input().split())
A = []
B = []
C = []
D = []
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
for j in range(m):
    c, d = map(int, input().split())
    C.append(c)
    D.append(d)
for i in range(n):
    v_min = float('inf')
    for j in range(m):
        v = abs(A[i] - C[j]) + abs(B[i] - D[j])
        if v_min > v:
            v_min = v
            ans = j + 1
    print(ans)

Buggy submission (verdict: Runtime Error):

C = []
D = []
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
for j in range(m):
    c, d = map(int, input().split())
    C.append(c)
    D.append(d)
for i in range(n):
    v_min = float('inf')
    for j in range(m):
        v = abs(A[i] - C[j]) + abs(B[i] - D[j])
        if v_min > v:
            v_min = v
            ans = j + 1
    print(ans)
Problem p02676 (python)

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

if len(S) <= K:
    print(S)
else:
    print(S[0:K] + '...')

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

if len(K) <= S:
    print(K)
else:
    print(K[0:S] + '...')
Problem p02766 (python)

Fixed submission:
N, K = map(int,input().split())
 
ans = 1

while N >= K:
    N = N // K
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
 
ans = 1
 
 while N >= K:
    N = N // K
    ans += 1
    
print(ans)
Problem p02779 (python)

Fixed submission:
import sys
 
 
def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    a.sort()
    for i in range(1, n):
        if a[i] == a[i-1]:
            print("NO")
            exit()
    print("YES")
 
 
if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
from math import gcd
N=int(input())
A=list(map(int,input().split()))
flg=1
for i in range(N):
    for j in range(i+1,N):
        if gcd(A[i],A[j])!=1:
            flg=0
print("YES" if flg else "NO")
Problem p02785 (python)

Fixed submission:
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort(reverse=True)
H_new=H[K:]
print(sum(H_new))

Buggy submission (verdict: Runtime Error):
N=int(input())
P=list(map(int,input().split()))
cnt=0
for i in range(N):
    M=min(P[:i+1])
    if M==P[i]:
        cnt+=1
print(cnt)
Problem p02831 (python)

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

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
lcm=A*B/math.gcd(A,B)
print(int(lcm))
Problem p03242 (python)

Fixed submission:
n=input()
for i in n:
    if(i=="1"):
        print(9,end="")
    if(i=="9"):
        print(1,end="")

Buggy submission (verdict: Runtime Error):
n=input()
for i in len(n):
    if(n[i]==1):
        n[i]=9
    else:
        n[i]=1
print(int(n))
Problem p03835 (python)

Fixed submission:
import sys

k,s = map(int,sys.stdin.readline().split(' '))

result = 0

for x in range(k+1):
    for y in range(min(s-x+1,k+1)):
        if (s-x-y)<=k:
            result+=1
        
print(result)

Buggy submission (verdict: Runtime Error):
import sys

k,s = map(int,sys.stdin.buffer.readline().split(' '))

result = 0

for x in range(k+1):
    for y in range(min(s-x+1,k+1)):
        z = s-x-y
        if z < 0: continue
        if z<=k:
            result+=1
        
print(result)
Problem p02707 (python)

Fixed submission:
N, = input().split()
A = input().split() 
ans = [0] * 2000001
for i in range(int(N) - 1):
    ans[int(A[i])] += 1
for i in range(1, int(N)+1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
N, = input().split()
A = input().split() 
ans = [0] * 200000
for i in range(int(N) - 1):
    ans[int(A[i])] += 1
for i in range(1, int(N)+1):
    print(ans[i])
Problem p02831 (python)

Fixed submission:
def gcd(a, b):
    if a < b :
        a, b = b, a
    while True:
        a, b = b, a % b
        if b == 0:
            return a
 
a, b = map(int, input().split())
print(int(a * b / gcd(a, b)))

Buggy submission (verdict: Runtime Error):
from fractions import Fraction
a,b = map(int,input().split())

def lcm(x,y):
    return (x*y) // fractions.gcd(x,y)

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())

def lcm(x,y):
    return (x*y) // math.gcd(x,y)

print(lcm(a,b))
Problem p02832 (python)

Fixed submission:
#11037751
N = int(input())
a = list(map(int,input().split()))
now = 1
cnt = 0
for i in range(N):
    if a[i]==now:
        now += 1
print(N-now+1 if now != 1 else -1)

Buggy submission (verdict: Runtime Error):
import fractions
a,b = map(int,input().split())

def lcm(x,y):
    return (x*y) // fractions.gcd(x,y)

print(lcm(a,b))