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

Fixed submission:
def main():
    from sys import stdin
    from collections import Counter
    readline = stdin.readline

    n = int(readline())
    S = [readline()[:-1] for _ in [0]*n]

    s = Counter(S)
    most = s.most_common(1)[0][1]

    answers = [i[0] for i in s.items() if i[1] == most]
    answers = sorted(answers)

    for ans in answers:
        print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from sys import setrecursionlimit
setrecursionlimit(10**9)


def main():
    from sys import stdin
    import pandas as pd
    readline = stdin.readline

    n = int(readline())
    S = pd.Series([readline()[:-1] for _ in [0]*n])

    S = S.value_counts().copy()
    cond = S[0]
    answers = list(S[S == cond].sort_index().index)

    for ans in answers:
        print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from sys import stdin
    import pandas as pd
    readline = stdin.readline

    n = int(readline())
    S = pd.Series([readline()[:-1] for _ in [0]*n])

    S = S.value_counts().copy()
    cond = S[0]
    answers = list(S[S == cond].sort_index().index)

    for ans in answers:
        print(ans)


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

Fixed submission:
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [-i for i in A]

heapq.heapify(A)
for _ in range(M):
#Hは全部マイナスをつけたからaは最大値的なのはいる
    a = heapq.heappop(A)
    heapq.heappush(A, int(a/2))
print(-sum(A))

Buggy submission (verdict: Runtime Error):
import heapq
N, M = map(int, input().split())
A = [-int(i) for i in input().split()]

heapq.heapify(A)
for _ in range(M):
#Hは全部マイナスをつけたからaは最大値的なのはいる
    heapq.heapreplace((A, int(A[0]/2))
print(-sum(A))
Problem p02959 (python)

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

ans = 0
for i,b in enumerate(B):
    temp = min(b,A[i]+A[i+1])
    ans += temp
    A[i+1] -= max(0, temp-A[i]) #有り余った力を次の街で倒す
print(ans)

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

ans = 0
for i,b in enumerate(B):
    temp = min(b,A[i]+A[i+1])
    ans += temp
    A[i+1] -= max(0, temp-A[i]) #有り余った力を次の街で倒す
print(an)
Problem p02572 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
st=10**9+7
ans = 0
s = sum(a)-a[0]
for i in range(n-1):
  ans+=(a[i]*s)
  ans%=st
  s-=a[i+1]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0
s = sum(a)-a[0]
for i in range(n-1):
  ans+=(a[i]*s)
  ans%=st
  s-=a[i+1]
print(ans)
Problem p02880 (python)

Fixed submission:
n = int(input())

num = [1, 2, 3, 4, 5, 6, 7, 8, 9]

ans = 0
for i in range(9):
    for j in range(9):
        if n%num[i] == 0 and n%num[i] == 0 and n//(num[i]) == num[j]:
            ans = 1
if ans == 1:
    print("Yes")
else:
    print("No")

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

num = [1, 2, 3, 4, 5, 6, 7, 8, 9]

ans = 0
for i in range(9):
    for j in range(9):
        if n%num[i] == 0 and n%num[j] == o and n//(num[i]) == num[j]:
            ans = 1
if ans == 1:
    print("Yes")
else:
    print("No")
Problem p02785 (python)

Fixed submission:
def main():
	N,K = map(int,input().split())
	H = [int(h) for h in input().split()]
	H = sorted(H,reverse=True)
	for i in range(min(K,N)):
		H[i] = 0
	print(sum(H))
if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
def main():
	N,K = map(int,input().split())
	H = [int(h) for h in input().split()]
	H = sorted(H,reverse=True)
	for i in range(K):
		H[i] = 0
	print(sum(H))
if __name__ == '__main__':
	main()
Problem p02984 (python)

Fixed submission:
def main():
    n = int(input())
    a = list(map(int,input().split()))
    s = sum(a)
    l1 = 0
    for i in range(n):
        if i%2==0:
            l1 += a[i]
        else:
            l1 -= a[i]
    print(l1,end=" ")
    for i in range(n-1):
        l1 = 2*a[i]-l1
        print(l1,end=" ")
    print()
if __name__ == '__main__':
    main()

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

m = (n-1)/2

ls = [ans for _ in range(n)]

for i in range(n):
    for j in range(int(m)):
        ls[i] = str(ls[i]-2*(a[i+1+2*j]))

print(" ".join(ls))
Problem p02990 (python)

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


import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,k+1):
    if n-k+1>=i:
        red = combinations_count(n-k+1,i)
    else:
        red = 0
    
    ls = [int(x) for x in range(1,)]

    
    print((red*combinations_count(k-1,i-1))%(10**9+7))

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


import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,k+1):
    print(i)
    print((combinations_count(n-k+1,i)*combinations_count(k-1,i-1))%(10**9+7))

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


import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,k+1):

    print((combinations_count(n-k+1,i)*combinations_count(k-1,i-1))%(10**9+7))
Problem p03013 (python)

Fixed submission:
n,m = map(int,input().split())
ls = set()
for i in range(m):
    ls.add(int(input()))
dp = [0]*(n+1)
dp[0]=1
if 1 in ls:
    dp[1]= 0
else:
    dp[1]= 1
for i in range(2,n+1):
    if i in ls :
        continue
    dp[i] = dp[i-1]+dp[i-2]
print(dp[n]%(10**9+7))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
if m!=0:
    ls = [int(input()) for _ in range(m)]

else:
    ls = []
    
dp = [0 for _ in range(n+1)]
dp[1] = 1
dp[2] = 2

for i in range(3,n+1):
    if i in ls :
        dp[i] = 0
    else:
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)

print(dp[n]%(10**9+7))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ls = [int(input()) for _ in range(m)]

dp = [0 for _ in range(n+1)]
dp[1] = 1
dp[2] = 2

for i in range(3,n+1):
    if i in ls :
        dp[i] = 0
    else:
        dp[i] = dp[i-1]+dp[i-2]

print(dp[n]%(10**9+7))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ls = [int(input()) for _ in range(m)]

dp = [0 for _ in range(n+1)]
dp[1] = 1
dp[2] = 2

for i in range(3,n+1):
    if i in ls :
        dp[i] = 0
    else:
        dp[i] = dp[i-1]+dp[i-2]

print(dp[n]%(10**9+7))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ls = [int(input()) for _ in range(m)]

dp = [0 for _ in range(n+1)]
dp[1] = 1
dp[2] = 2

for i in range(3,n+1):
    if i in ls :
        dp[i] = 0
    else:
        dp[i] = dp[i-1]+dp[i-2]

print(dp)

print(dp[n]%(10**9+7))

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

a = [int(x) for x in input()]



def solve(n,now,ls,cnt):
    if n == now:
        return cnt
    elif n-1 == now:
        return cnt
    else:
        pass

    if now+1 in ls and now+2 in ls:
        return 0
    elif   now+1 in ls:
        return solve(n,now+2,ls,cnt)
    elif   now+2 in ls:
        return solve(n,now+1,ls,cnt)
    else:
        return solve(n,now+2,ls,cnt*2)

ans = solve(n,0,a,1)

print(ans%(1000000007))
Problem p03073 (python)

Fixed submission:
import numpy as np
s = [int(i) for i in input()]

n = len(s)

list01 = [int(i%2) for i in range(n)]
list10 = [int((i+1)%2) for i in range(n)]

        
list_a = np.array(s) - np.array(list01)
list_b = np.array(s) - np.array(list10)

count0 = np.sum(list_a == 0)
count1 = np.sum(list_b == 0)
countmin = min((n-count0),(n-count1))
print(countmin)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
num = [int(input()) for i in range(5)]
print(int(4+math.ceil(n/min(min(num)))))
Problem p03207 (python)

Fixed submission:
n = int(input())
p = [int(input()) for _ in range(n)]

m = max(p)/2

c = sum(p) - m

print(int(c))

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

m = max(p)/2

c = sum(p) - m

print(int(c))
Problem p03208 (python)

Fixed submission:
n,k = map(int,input().split())
c = [int(input()) for _ in range(n)]
c.sort()
ans = []
for i in range(n-k+1):
    ans.append(c[i+k-1]-c[i])
print(min(ans))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
c = [int(input()) for _ in range(n)]
c.sort()
ans = []
for i in range(n-k+1):
    ans.append(c[i+k]-c[i])
print(min(ans))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
c = [int(input()) for _ in range(n)]

c.sort()

ans = []
for i in range(n-k+1):
    ans.append(max(c[i:k+i])-min(c[i:k+i])))

print(min(ans))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
c = [int(input()) for _ in range(n)]

c.sort()

for i in range(n-k+1):
    ans = min(ans,max(c[i:k+i])-min(c[i:k+i]))

print(ans)
Problem p03221 (python)

Fixed submission:
n,m = map(int,input().split())
ls = [[] for _ in range(n+1)]

for i in range(m):
    a,b = map(int,input().split())
    ls[a].append((b,i))
ans = [None]*m
for i,l in enumerate(ls):
    l.sort()
    for j,(a,b) in enumerate(l):
        ans[b]= "{:06d}{:06d}".format(i,j+1)
for i in range(m):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ls = [[int(x) for x in input().split()] for _ in range(m)]

ans = sorted(ls,key=lambda x:(x[0],x[1]))

dic = [[] for _ in range(m+1)]

for i in range(m):
    key = ans[i][0]
    value = ans[i][1]
    dic[key].append(value)

for i in range(m):
    print("{:06d}{:06d}".format(ls[i][0],dic[ls[i][0]].index(ls[i][1])+1))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ls = [[int(x) for x in input().split()] for _ in range(m)]

ans = sorted(ls,key=lambda x:(x[0],x[1]))

dic = [[] for _ in range(m+1)]

for i in range(m):
    key = ans[i][0]
    value = ans[i][1]
    dic[key+1].append(value)

for i in range(m):
    print("{:06d}{:06d}".format(ls[i][0],dic[ls[i][0]+1].index(ls[i][1])+1))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ls = [[int(x) for x in input().split()] for _ in range(m)]

cnt = [[0] for _ in range(n+1)]

for i in range(m):
    idx = ls[i][0]
    cnt[idx].append(ls[i][1])

for i in range(m):
    cnt[i].sort()


for i in range(m):
    idx = ls[i][0]
    print("{:06d}{:06d}".format(idx,cnt[idx].index(ls[i][1])))
Problem p03345 (python)

Fixed submission:

if __name__ == "__main__":
    a,b,c,k = map(int,input().split())
    if k%2 == 0:
        if abs(a-b)>10**18:
            print("Unfair")
        else:
            print(a-b)
    else:
        if abs(a-b)>10**18:
            print("Unfair")
        else:
            print(b-a)

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

if k==0:
    if abs(a-b)>=10**18:
        print("Unfair")
    else:
        print(a-b)
elif k==1:
    if abs(a-b)>=10**18:
        print("Unfair")
    else:
        print(b-a)
elif abs(a-b)==0:
    print(0)
else:
    if k>=100:
        print("Unfair")
    else:    
        m = int(2(2**(k-1)-(-1)**(k-1))/3)
        n = int((2**k-(-1)**k)/3)
        ans = (a-b)*(m-n)
        if abs(ans)>=10**18:
            print("Unfair")
        else:
            print(ans)

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

if k==0:
    if abs(a-b)>=10**18:
        print("Unfair")
    else:
        print(a-b)
elif k==1:
    if abs(a-b)>=10**18:
        print("Unfair")
    else:
        print(b-a)
elif abs(a-b)==0:
    print("Unfair")
else:
    if k>=100:
        print("Unfair")
    else:    
        m = int(2(2**(k-1)-(-1)**(k-1))/3)
        n = int((2**k-(-1)**k)/3)
        ans = (a-b)*(m-n)
        if abs(ans)>=10**18:
            print("Unfair")
        else:
            print(ans)

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

if k<=1:
    if abs(a-b)>=10**18:
        print("Unfair")
    else:
        print(a-b)
elif k==1:
    if abs(a-b)>=10**18:
        print("Unfair")
    else:
        print(b-a)
else:
    m = int(2(2**(k-1)-(-1)**(k-1))/3)
    n = int((2**k-(-1)**k)/3)
    ans = (a-b)*(m-n)
    if abs(ans)>=10**18:
        print("Unfair")
    else:
        print(ans)
Problem p03617 (python)

Fixed submission:
def main():
    q,h,s,d = map(int,input().split())
    n = int(input())
    # one per yen
    one = min([q*4,h*2,s])
    # two per yen
    two = d

    if one*2 > two:
        print((n//2)*two + (n%2)*one)

    else:
        print(n*one)



if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
q,h,s,d = map(int,input().split())
n = int(input())
a = min([q*4,h*2,s])
if n%2==0:
    print(min([a*n,int(b*n/2)]))
else:
    print(min([a*n,int(b*(n-1)/2+a)]))
Problem p03745 (python)

Fixed submission:
def main():
    n = int(input())
    ls = [int(x) for x in input().split()]
    if n==1:
        print(1)
    else:
        right,left = 0,1
        cnt = 0
        flg = 0
        while 1:
            now = ls[left]
            nex = ls[right]   
            if now<nex:
                if flg ==-1:
                    cnt +=1
                    flg = 0
                else:
                    flg = 1
                left +=1
                right +=1
            elif nex==now:
                left +=1
                right +=1         

            else:
                if flg ==1:
                    cnt += 1
                    flg = 0
                else:
                    flg = -1
                left +=1
                right +=1

            if right==n-1:
                cnt +=1
                break
        print(cnt)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    ls = [int(x) for x in input().split()]
    right,left = 0,1
    cnt = 0
    flg = 0
    while 1:
        now = ls[left]
        nex = ls[right]   
        if now<nex:
            if flg ==-1:
                cnt +=1
                flg = 0
            else:
                flg = 1
            left +=1
            right +=1
        elif nex==now:
            left +=1
            right +=1         

        else:
            if flg ==1:
                cnt += 1
                flg = 0
            else:
                flg = -1
            left +=1
            right +=1
        if right==n-1:
            cnt +=1
            break
    print(cnt)

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

Fixed submission:
s = input()
ls = []
for i,j in enumerate(s):
    if i == 5 or i == 13:
        ls.append(" ")
    else:
        ls.append(j)
print("".join(ls))

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans=0
for i in range(k+1):
    for j in range(k+1):
        if 0<=(s-i-j)<=k:
            ans+=1
print(ans)
Problem p03835 (python)

Fixed submission:
k,s=map(int,input().split())
ans=0
for i in range(k+1):
    for j in range(k+1):
        if 0<=(s-i-j)<=k:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans=0
for i in range(K+1):
    for j in range(K+1):
        if 0<=(s-i-j)<=K:
            ans+=1
print(ans)
Problem p02912 (python)

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda a: int(a)*(-1), input().split()))

heapq.heapify(A)

for i in range(M):
    a = -heapq.heappop(A)//2
    heapq.heappush(A, -a)
    
print(-sum(A))

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

A.sort(reverse=True)

for i in range(M):
    A[0] = A[0]//2
    if A[0]<A[1]:
        A.sort(reverse=True)

print(sum(A))
Problem p03137 (python)

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

ans = 0
if N>=M:
    pass
else:
    X_diff = []
    for i in range(len(X)-1):
        X_diff.append(X[i+1]-X[i])
    X_diff.sort()
    ans = 0
    for i in range(M-N):
        ans += X_diff[i]
print(ans)

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

X.sort()
Y = []

for i in range(M-1):
    Y.append(X[i+1] - X[i])

for i in range(N-1):
    idx = Y.index(max(Y))
    Y[idx] = 0
    
print(sum(Y))
Problem p03805 (python)

Fixed submission:
from itertools import permutations

N, M = map(int, input().split())
gr = set()

for i in range(M):
    a, b = map(int, input().split())
    gr |= {(a-1,b-1),(b-1,a-1)}

ans = 0
for p in permutations(range(N)):
    if p[0]==0:
        cnt = 0
        cntp = 0
        for i in range(N-1):
            cnt += 1
            if (p[i],p[i+1]) in gr:
                cntp += 1
            else:
                break
        if cnt == cntp:
            ans += 1
print(ans)

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

gr = set()

for i in range(N):
    a, b = map(int, input().split())
    gr |= {(a-1,b-1),(b-1,a-1)}

from itertools import permutations

ans = 0
for p in permutations(range(N)):
    if p[0]==0:
        cnt = 0
        cntp = 0
        for i in range(N-1):
            cnt += 1
            if (p[i],p[i+1]) in gr:
                cntp += 1
            else:
                break
        if cnt == cntp:
            ans += 1
print(ans)
Problem p03315 (python)

Fixed submission:
import sys
import io

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(n):
    QUE=n
    EatSM=0
    Sum=QUE.count("+")
    Minus=QUE.count("-")
    return EatSM+Sum-Minus

def readQuestion():
    line = sys.stdin.readline().rstrip()
    return line

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
    QUE=input("")
    EatSM=0
    Sum=QUE.count("+")
    Minus=QUE.count("-")
    print(EatSM+Sum-Minus)

Buggy submission (verdict: Runtime Error):
    QUE=input("")
    EatSM=0
    Sum=QUE.count("+")
    Minus=QUE.count("-")
    return EatSM+Sum-Minus
Problem p03317 (python)

Fixed submission:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(n, k, as1):
    if (n-1)%(k-1)==0:
        return (n-1)//(k-1)
    else:
        return (n-1)//(k-1)+1

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_n, str_k] = line.split(' ')
    line = sys.stdin.readline().rstrip()
    as1 = line.split(' ')
    return (int(str_n), int(str_k), [int(a) for a in as1])

def main():
    n, k, as1 = readQuestion()
    answer = solve(n, k, as1)
    print(answer)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(n, k, as):
    if (n-1)%(k-1)==0:
        return (n-1)/(k-1)
    else:
        return round((n-1)/(k-1))

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_n, str_k] = line.split(' ')
    line = sys.stdin.readline().rstrip()
    as = line.split(' ')
    return (int(str_n), int(str_k), [int(a) for a in as])

def main():
    n, k, as = readQuestion()
    answer = solve(n, k, as)
    print(answer)
    
if __name__ == '__main__':
    main()
Problem p02629 (python)

Fixed submission:
N = int(input())
L = list("abcdefghijklmnopqrstuvwxyz")
a = 1
while N > 26**a:
    N = N - 26**a
    a += 1
 
pre = []
for i in reversed(range(1,a)):
    r = (N-1) // 26**i
    pre.append(r)
    N = int(N%(26**i))
 
ans = ''
for i in pre:
    ans += L[i]
print(ans+L[N-1])

Buggy submission (verdict: Runtime Error):
from string import ascii_lowercase
N = int(input())

k = [0, 26]
for i in range(1, 13):
    k.append(26 * (k[i] + 1))

    for i in range(13):
        if k[i] + 1 <= N <= k[i+1]:
            n = N - (k[i] + 1)
            for j in range(i, -1, -1):
                print(ascii_lowercase[(n//26**j) % 26], end="")

Buggy submission (verdict: Runtime Error):

from string import ascii_lowercase
N = int(input())
     
k = [0, 26]
for i in range(1, 13):
  k.append(26 * (k[i] + 1))
     
  for i in range(13):
    if k[i] + 1 <= N <= k[i+1]:
      n = N - (k[i] + 1)
     
      for j in range(i, -1, -1):
        print(ascii_lowercase[(n//26**j) % 26], end="")
Problem p02623 (python)

Fixed submission:
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
aa = [0]
for i in a:
    aa.append(aa[-1]+i)
bb = [0]
for i in b:
    bb.append(bb[-1]+i)
ans = 0
j = m
for i in range(n+1):
    if aa[i] > k:
        break
    while aa[i] + bb[j] > k and j > 0:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
aa = [0]
bb = [0]
for i in a:
    aa.append(aa[-1]+i)
for i in b:
    bb.append(bb[-1]+i)
for i in range(n+1):
    if aa[i] > k:
        break
    for j in range(m+1):
        if aa[i]+bb[j] <= k:
            tmp = i+j
        else:
            break
    ans = max(ans, tmp)
print(ans)
Problem p02629 (python)

Fixed submission:
n = int(input())
abc = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
while n != 0:
    n -= 1
    ans += abc[n%26]
    n //= 26
print(ans[::-1])

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

abc = 'abcdefghijklmnopqrstuvwxyz'
s = ''
while n > 0:
    n -= 1
    n, mod = divmod(n, 26)
    s += a[mod]
print(s[::-1])
Problem p02689 (python)

Fixed submission:
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [True] * n
for _ in range(m):
    a, b = map(int, input().split())
    if h[a-1] > h[b-1]:
        ab[b-1] = False
    elif h[b-1] > h[a-1]:
        ab[a-1] = False
    else:
        ab[a-1] = False
        ab[b-1] = False

print(ab.count(True))

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

ans = 0
for i in range(n):
    if 1 not in ab[i]:
        ans += 1
print(ans)
Problem p03835 (python)

Fixed submission:
k, s = map(int, input().split())
 
ans = 0
for x in range(k+1):
    for y in range(k+1):
        ans += max(0, 0<=s-x-y<=k)
print(ans)

Buggy submission (verdict: Runtime Error):
k, s = map(int, input().split())

ans = 0
for x in range(k+1):
    if x > s:
        break
    if x+k+k < s:
        continue
    for y in range(k+1):
        xy = x+y
        if xy > s:
            break
        if xy+k < s:
            continue:
        for z in range(k+1):
            xyz = x+y+z
            if xyz > s:
                break
            if xyz == s:
                ans += 1
print(ans)
Problem p03631 (python)

Fixed submission:
N = input()

if N == N[::-1]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input().split()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])

a_c = max(A, C)
b_d = min(B, D)

if a_c - b_d:
  print(a_c - b_d)
else:
  print("0")

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

A, B, C, D = [i for i in s]

greater = max(A, C)
less = min(B, D)

if min(0, greater - less):
　print(min(0, greater- less)
else:
   print("0")