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

Fixed submission:
# coding:utf-8


def main():
    A, B, K = map(int, input().split())
    ans = []
    ans.append(1)
    for i in range(2, max(A, B)+1):
        if A % i == 0 and B % i == 0:
            ans.append(i)
        # if len(ans) >= K:
        #     break
    # print(ans)
    print(ans[-K])


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8


def main():
    A, B, K = map(int, input().split())
    ans = []
    ans.append(1)
    for i in range(2, max(A, B)):
        if A % i == 0 and B % i == 0:
            ans.append(i)
        # if len(ans) >= K:
        #     break
    # print(ans)
    print(ans[-K])


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8


def main():
    A, B, K = map(int, input().split())
    ans = []

    for i in range(1, max(A, B)):
        if A % i == 0 and B % i == 0:
            ans.append(i)
        # if len(ans) >= K:
        #     break
    # print(ans)
    print(ans[-K])


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8


def main():
    A, B, K = map(int, input().split())
    ans = []

    for i in range(1, max(A, B)):
        if A % i == 0 and B % i == 0:
            ans.append(i)
        if len(ans) >= K:
            break
    # print(ans)
    print(ans[-1])


if __name__ == "__main__":
    main()
Problem p03110 (python)

Fixed submission:
# coding: utf-8

def main():
    N = int(input())
    btc_to_jpy = 380000.0
    ans = 0
    for i in range(N):
        temp_value,unit = input().split()
        value = float(temp_value)
        if unit == "BTC":
            value *= btc_to_jpy
        ans += value
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8

def main():
    N = int(input())
    btc_to_jpy = 380000.0
    ans = 0
    for i in range(N):
        temp_value,unit = input().split()
        value = int(temp_value)
        if unit == "BTC":
            value *= btc_to_jpy
        ans += value
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8

def main():
    N = int(input())
    btc_to_jpy = 380000.0
    ans = 0
    for i in range(N):
        value,unit = map(int,input().split())
        if unit == "BTC":
            value *= btc_to_jpy
        ans += value
    print(ans)

if __name__ == "__main__":
    main()
Problem p03695 (python)

Fixed submission:
#coding; utf-8


def main():
    N = int(input())
    A = list(map(int, input().split()))
    min_color = 0
    max_color = 0
    rate_criteria = 400
    rate = [0]*9
    for i in range(N):
        diva = A[i]//rate_criteria
        if diva > 8:
            diva = 8
        rate[diva] += 1

    for i in range(8):
        if rate[i] > 0:
            min_color += 1

    if min_color == 0 and rate[-1] > 0:
        min_color = 1
        max_color = rate[-1]
    else:
        max_color = min_color + rate[-1]
    # print(rate)
    print(min_color, max_color)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#coding; utf-8


def main():
    N = int(input())
    A = list(map(int, input().split()))
    min_color = 0
    max_color = 0
    rate_criteria = 400
    rate = [0]*9
    for i in range(N):
        diva = A[i]//rate_criteria
        rate[diva] += 1

    for i in range(8):
        if rate[i] > 0:
            min_color += 1

    max_color = min_color + rate[-1]
    # print(rate)
    print(min_color, max_color)


if __name__ == "__main__":
    main()
Problem p02690 (python)

Fixed submission:
X=int(input())
flg=False
for A in range(-120,120):
    for B in range(-120,120):
        if A**5-B**5==X:
            print(str(A)+" "+str(B))
            flg=True
            break
    if flg:
        break

Buggy submission (verdict: Runtime Error):
import sympy

X=int(input())
flg=False
for A in range(-118,119):
    for B in range(-118,119):
        if A**5-B**5==X:
            print(str(A)+" "+str(B))
            flg=True
            break
    if flg:
        break
Problem p02706 (python)

Fixed submission:
N,M = (input().strip().split())


A = list(map(int,input().strip().split()))

x = int(N)
#残り日数
for j in range(int(M)):
    x = x - int(A[j])
    j += 1

if x < 0 :
    print(-1)

else :
    print(x)

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

A = [input()for i in range(M)]

x = N
#残り日数
for j in range(M):
    x = x - int(A[j])
    j += 1

if x < 0 :
    print(-1)

else :
    print(x)
Problem p02983 (python)

Fixed submission:
import numpy as np
L,R=map(int,input().split(' '))
l,r=L%2019,R%2019
D=R-L
d=r-l
if D<2019:
  if D==d:
    res=[]
    for i in range(L,R+1):
      for j in range(i+1,R+1):
        res.append((i*j)%2019)
    print(min(res))
  else:
    print(0)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
L,R=map(int,input().split(' '))
l,r=L%2019,R%2019
D=R-L
d=r-l
if D<2019:
  if D==d:
    if 
    print( (l*(l+1))%2019 )
  else:
    print(0)
else:
  print(0)
Problem p02993 (python)

Fixed submission:
S=list(input())
N=len(S)
flg=1
for i in range(N-1):
  if S[i]==S[i+1]:
    print("Bad")
    flg=0
    break
if flg:
  print("Good")

Buggy submission (verdict: Runtime Error):
S=list(input())
N=len(S)
flg=0
for i in range(S-1):
  if S[i]==S[i+1]:
    print("Bad")
    break
if flg:
  print("Good")
Problem p03146 (python)

Fixed submission:
s = int(input())

def calc(n):
  if n % 2:
    return 3 * n + 1
  else:
    return n // 2

if s == 1 or s == 2 or s == 4:
  print(4)
else:
  count = 1
  while s != 4:
    s = calc(s)
    count += 1
  print(count + 3)

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

def calc(n):
  if n % 2:
    return 3 * n + 1
  else:
    return n // 2

if s == 1 or s == 2 or s == 4:
  print(4)
else:
  count = 1
  while s != 4:
    s = calc(s)
    count += 1

print(count + 3)
Problem p03337 (python)

Fixed submission:
A, B = map(int, input().split())
print(max(A + B, A - B, A * B))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input())
print(max([A + B, A - B, A * B]))
Problem p02802 (python)

Fixed submission:
# coding: utf-8

n,m = map(int,input().split(" "))
ac_list = [0] * n
wa_list = [0] * n


wa = 0

for i in range(m):
    a,b = input().split(" ")
    if ac_list[int(a) - 1]:
        continue
    if b == "AC":
        ac_list[int(a) - 1] = 1
        wa += wa_list[int(a)-1]
    else:
        wa_list[int(a)-1] += 1
        
print(sum(ac_list),wa)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split(" "))
question_list = []
res_list = []
ac_list = []
for i in range(m):
    a,b = input().split(" ")
    a = int(a)
    question_list.append(a)
    res_list.append(b)
correct = 0
mistake = 0




for i,j in enumerate(res_list):
    if i == 0:
        if j == "WA":
            mistake += 1
        else:
            correct += 1
            ac_list.append(question_list[i])
            
    elif question_list[i] not in ac_list:      
    	if j == "WA":
      		mistake += 1
     	else:
      		correct += 1
        	ac_list.append(question_list[i])
                
            
    if len(ac_list) == n:
        break
            
for i,j in enumerate(res_list):
    if question_list[i] not in ac_list:
        mistake -= 1
        
      
print(correct,mistake)
Problem p03493 (python)

Fixed submission:
line = input()
line = list(line)

count = 0
for i in line:
    if i == "1":
        count += 1
        
print(count)

Buggy submission (verdict: Runtime Error):
line = input()
line = list(line)

count = 0
for i in line:
	if i == "1":
      count += 1
      
print(count)
Problem p02641 (python)

Fixed submission:
X,N = map(int,input().split())
if N==0:
    print(X)
    exit()
P = [int(i) for i in input().split()]

ans = X+10
tmp = []
P2 = [int(i) for i in range(-200,200)]
P3 = list(set(P2)-set(P))
P3.sort()
P3[::-1]
for i in P3:
    if ans > abs(X-i):
        ans = abs(X-i)
        tmp.append(i)
print(max(tmp))

Buggy submission (verdict: Runtime Error):
X,N = map(int,input().split())
if N==0:
    print(X)
    exit()
P = [int(i) for i in input().split()]
ans = X+10
tmp = []
P2 = [int(i) for i in range(min(P),max(P)+1)]
P3 = list(set(P2)-set(P))

for i in P3:
    if ans > abs(X-i):
        ans = abs(X-i)
        tmp.append(i)
print(max(tmp))
Problem p02646 (python)

Fixed submission:
A,V= map(int,input().split())
B,W= map(int,input().split())
T = int(input())
if A < B and A + T* V >=B+ T* W:
    ans = "YES"
elif B < A and A -T* V <=B- T* W:
    ans = "YES"
else:
    ans ="NO"
print(ans)

Buggy submission (verdict: Runtime Error):
A,V= map(int,input().split())
B,W= map(int,input().split())
T = int(input())

if V!=W and  abs(A-B)/(V-W) <= T:
    ans = "YES"
elif A==B:
    ans = "YES"
elif A!=B and V==W:
    ans ="NO"
print(ans)
Problem p02683 (python)

Fixed submission:
N,M,X =map(int,input().split())
A =[]
for m in range(N):
    A.append([int(j) for j in input().split()])
ans = 10**10
import numpy as np
from itertools import product,compress
for i in list(product([True,False],repeat=N)):
    tmp = np.sum(list(compress(A, i)),axis=0)
    if type(tmp)!=np.float64:
    	if tmp[0]< ans and min(tmp[1:])>=X:
            ans =tmp[0]
if ans ==10**10:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
# ABC 167 C
N,M,X = map(int,input().split())
C =[]
for m in range(N):
    C.append([int(i) for i in input().split()])
C.sort(key=lambda x:x[0])

from itertools import combinations
import numpy as np

ans = 10**5 +1

for m in range(1,M+1):
    P=list(combinations(C,m))
    tmp =np.sum(P,axis=1)
    if ans < tmp[0,0]:
        print(ans)
        exit()
    elif min(tmp[0,1:])>=X and ans > tmp[0,0]:
        ans = tmp[0,0]


if min(tmp[0,1:])<X:
    print(-1)
else:
    print(ans)
Problem p02713 (python)

Fixed submission:
A = int(input())
# 最小公倍数
ans = 0
from math import gcd


for i in range(1,A+1):
    for j in range(1,A+1):
        for k in range(1,A+1):
            ans += gcd(gcd(i,j),k)
print(ans)

Buggy submission (verdict: Runtime Error):
# ABC 162

A = int(input())
# 最小公倍数
ans = 0
import math


for i in range(1,A+1):
    for j in range(1,A+1):
        for k in range(1,A+1):
            ans += gcd(gcd(i,j),k)
print(ans)
Problem p02748 (python)

Fixed submission:

A,B,M =map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = []
for m in range(M):
    x.append([int(i) for i in input().split()])
_min = min(a)+min(b)
		
for i in x:
    _min = min( (a[i[0]-1]+b[i[1]-1] - i[2]),_min)
print(_min)

Buggy submission (verdict: Runtime Error):

A,B,M =map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = []
for m in range(M):
    x.append([int(i) for i in input().split()])
_min = 10**7
for i in range(len(a)):
    _min = min(a[i]+b[i],_min)

for i in x:
    _min = min( (a[i[0]-1]+b[i[1]-1] - i[2]),_min)
print(_min)
Problem p02911 (python)

Fixed submission:
#ABC 141 C  Attack Survival
N,K,Q= map(int,input().split())
A=[K-Q]*N
for i in range(Q):
    A[int(input())-1]+=1
for a in A:
    if a < 1:
        print('No')
    else:
        print('Yes')

Buggy submission (verdict: Runtime Error):
#ABC 141 C  Attack Survival
N,K,Q= map(int,input().split())
A=[K-Q]*N
for i in range(1,Q+1):
    A[int(input())]+=1
for a in A:
    if a < 1:
        print('No')
    else:
        print('Yes')
Problem p02999 (python)

Fixed submission:
# ABC 130
X ,A =map(int,input().split(" "))
if X < A:
    print(0)
elif A<=X:
    print(10)

Buggy submission (verdict: Runtime Error):
#ABC 130 B
N,X=map(int,input().split())
L= [int(j) for j in input().split()]
cnt=0
d = 0

for l in L :
    d+=l
    if d <= X:
        cnt+=1
    else:
        break
print(cnt+1)
Problem p03086 (python)

Fixed submission:
S = input()
N = len(S)
ans =0
for i in range(0, N):
    for j in range(i, N+1):
        tmp = S[i:j]
        if len(tmp)==tmp.count('A')+tmp.count('G')+tmp.count('C')+tmp.count('T'):
            ans = max(ans,len(tmp))
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
jogai = 'BDEFHIJKLMNOPQRSUVWXYZ'
cnt = []
for i in range(0,N):
    for j in range(1,N+1):
        tmp = S[i:j]
        flg = 1
        for a in jogai:
            if a in tmp:
                flg = 0
        if flg:
            cnt.append(len(tmp))
print(max(cnt))

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

jogai = 'BDEFHIJKLMNOPQRSUVWXYZ'
cnt = []
for i in range(0,len(S)):
    for j in range(1,len(S)+1):
        tmp = S[i:j]
        flg = 1
        for a in jogai:
            if a in tmp:
                flg = 0
        if flg:
            cnt.append(len(tmp))
print(max(cnt))

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

jogai = "ZXVBNMLKJHFDSQWERYUIOP"
cnt = []
for i in range(0,len(S)):
    for j in range(1,len(S)+1):
        tmp = S[i:j]
        flg = 1
        for a in jogai:
            if a in tmp:
                flg = 0
        if flg:
            cnt.append(len(tmp))
print(max(cnt))
Problem p03087 (python)

Fixed submission:
#122 C
N,Q= map(int,input().split())
S=input()
ans=[0]*(N+1)

for i in range(2,N+1):
    ans[i]=ans[i-1]
    if S[i-2:i]=='AC':
        ans[i]+=1
    
for i in range(Q):
    l,r=map(int,input().split())
    print(ans[r]-ans[l])

Buggy submission (verdict: Runtime Error):
#122 C
from itertools import accumulate
N,Q= map(int,input().split())
S=input()
ans=[0]*(N)

for i,s in enumerate(list(accumulate(S))):
    ans[i]=s.count('AC')
ans
for i in range(Q):
    L1,L2= map(int,input().split())
    print(ans[L2-1]-ans[L1-1])
Problem p03146 (python)

Fixed submission:
#116 B
s =int(input())
lists=[]
lists.append(s)
for i in range(2,1000001):
    if lists[-1]%2==0:
        tmp=int(lists[-1]/2)
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()
    else:
        tmp=(3*lists[-1])+1
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()

Buggy submission (verdict: Runtime Error):
lists=[]
lists.append(s)
for i in range(2,1000000):
    print("A",i)
    if lists[-1]%2==0:
        tmp=int(lists[-1]/2)
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()
    else:
        tmp=(3*lists[-1])+1
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()

Buggy submission (verdict: Runtime Error):
lists=[]
lists.append(s)
for i in range(2,1000000000000000):
    print("A",i)
    if lists[-1]%2==0:
        tmp=int(lists[-1]/2)
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()
    else:
        tmp=(3*lists[-1])+1
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()
Problem p03280 (python)

Fixed submission:
#106 A

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

print(A*B - (A+B-1))

Buggy submission (verdict: Runtime Error):
#106 A

A=int(input())
B=int(input())
print(A*B - (A+B-1))
Problem p03284 (python)

Fixed submission:
#105 A
import math
N,K= map(int,input().split())
print(abs(math.ceil(N/K)- N//K))

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

cnt =0

for i in range(26):
    for j in range(15):
        if i * 4 + j * 7 == n:
            cnt +=1
if cnt >0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input()1
for i in range(26):
    for j in range(15):
        if i * 4 + j * 7 == n:
            cnt +=1
if cnt >0:
    print('Yes')
else:
    print('No')
Problem p03294 (python)

Fixed submission:
#ABC 103
N=int(input())
A = [int(j) for j in input().split()]
print(sum(A)-len(A))

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
N=int(input())
A = [int(j) for j in input().split()]

ans = 0
for a in A:
    ans+=(lcm(*A)-1)%a
print(ans)

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
N=int(input())
A = [int(j) for j in input().split()]

print(lcm(*A)-1)
Problem p03455 (python)

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

if (a * b)%2 ==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
A,B= map(int,input().split())
if (A* B)%2==0:
    ans ='Even'
else:
    ans=='Odd'
print(ans)
Problem p03494 (python)

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

cnt=0
while all(i%2 ==0 for i in A):
  A = [i/2 for i in A]
  cnt+=1
print(cnt)

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

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
tmp =gcd_list(A)
for i in range(100):
    if tmp == 2**i:
        print(i)
        break
Problem p03578 (python)

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

if N < M:
    print('NO')
    exit()

from collections import Counter
 
d_count = Counter(D)
t_count = Counter(T)
for k,v in t_count.items():
    if k not in d_count:
        print('NO')
        exit()
    if d_count[k]< v:
        print('NO')
        exit()
print('YES')

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

if N < D:
    print('NO')
    exit()

from collections import Counter
 
d_count = Counter(D)
t_count = Counter(T)
for k,v in t_count.items():
    if k not in d_count:
        print('NO')
        exit()
    if d_count[k]< v:
        print('NO')
        exit()
print('YES')

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

if N < T:
    print('NO')
    exit()

from collections import Counter
 
d_count = Counter(D)
t_count = Counter(T)
for k,v in t_count.items():
    if k not in d_count:
        print('NO')
        exit()
    if d_count[k]< v:
        print('NO')
        exit()
print('YES')
Problem p03611 (python)

Fixed submission:
#ABC 072 C
N=int(input())
A=[int(j) for j in input().split()]
cnt=[0]*(10**6)
for a in A:
    cnt[a]+=1
    cnt[a+1]+=1
    cnt[a+2]+=1
print(max(cnt))

Buggy submission (verdict: Runtime Error):
#ABC 072 C
N=int(input())
A=[int(j) for j in input().split()]
cnt=[0]*(10**5)
for a in A:
    cnt[a]+=1
    cnt[a+1]+=1
    cnt[a+2]+=1
print(max(cnt))
Problem p03699 (python)

Fixed submission:
N = int(input())
S = []
for i in range(N):
    S.append(int(input()))
nb10 = ([s for s in S if s%10 != 0])
b10  = ([s for s in S if s%10 == 0])
    
if sum(S)%10!=0:
    print(sum(S))
elif sum(S) ==sum(b10):
    print(0)
else:

    print(sum(S)-sorted(nb10)[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    S.append(int(input()))
not_b10 = sorted([s for s in S if s%10 != 0])
b10 = sorted([s for s in S if s%10 == 0])
    
if sum(S)%10!=0:
    print(sum(S))
elif S ==b10:
    print(0)
else:

    print(sum(S)-not_b10[0])
Problem p03720 (python)

Fixed submission:
N,M= map(int,input().split())
f = [0] * (N + 2)
for i in range(M):
    x,y = map(int,input().split())
    f[x]+=1
    f[y]+=1
for i in range(1,N+1):
    print(f[i])

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

for i in range(M):
    ind =AB[i][0]
    ind2 =AB[i][1]
    #print(i,ind,ind2)
    if result.get(str(ind)) is None:
        result[str(ind)] =1
    else:
        result[str(ind)] =result[str(ind)]+1
    
    if result.get(str(ind2)) is None:
        result[str(ind2)] =1
    else:
        result[str(ind2)] =result[str(ind2)]+1
    #print(result)
    
for i in range(1,N+1):    
    print(result[str(i)])
Problem p03779 (python)

Fixed submission:
# ABC 056 C
X =int(input())
for t in range(10**9):
    if t * (t+1)/2 >=X:
        print(t)
        exit()

Buggy submission (verdict: Runtime Error):
# ABC 056 C
X =int(input())
for t in range(10**9):
    if t * (t+1)/2 >=X:
        print(t)
        exit()a
Problem p03854 (python)

Fixed submission:
#049 C

S = input()
A = 'dream'
B = 'dreamer'
C = 'erase'
D = 'eraser'

S=S[::-1]
A=A[::-1]
B=B[::-1]
C=C[::-1]
D=D[::-1]

tmp =""
for i in S:
    tmp +=i
    for j in [A,B,C,D]:
        if tmp == j:
            S=S.replace(tmp,"",1)
            tmp=""
if len(S)==0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
#049 C

S = input()
A = 'dream'
B = 'dreamer'
C = 'erase'
D = 'eraser'

S=S[::-1]
A=A[::-1]
B=B[::-1]
C=C[::-1]
D=D[::-1]

tmp =""
for i in S:
    tmp +=i
    print(tmp)
    for j in [A,B,C,D]:
        if tmp == j:
            S=S.replace(tmp,"",1)
            print(S)
            tmp=""
if len(S)==0:
    print('YES')
else:
    print('NO')
Problem p04011 (python)

Fixed submission:
# ABC 044 A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if K >= N:
    ans = N * X
elif N > K:
    ans = K * X
    ans +=(N-K)* Y

print( ans )

Buggy submission (verdict: Runtime Error):
# ABC 044 A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if K > N:
    ans = N * X
elif N > K:
    ans = K * X
    ans +=(N-K)* Y

print( ans )
Problem p04045 (python)

Fixed submission:
N,K= map(int,input().split())
D = [int(j) for j in input().split()]
D2 = list(set([i for i in range(0,10)])-set(D))
def f(N,D):
    if len(set([int(i) for i in list((str(N)))])&set(D))==0:
        return True
    else:
        return False
if len(D2) ==0:
    print(N)
else:
    while not f(N,D):
        N+=1
print(N)

Buggy submission (verdict: Runtime Error):
N,K= map(int,input().split())
D = [int(j) for j in input().split()]
D2 = list(set([i for i in range(0,10)])-set(D))
D1 = list(set([i for i in range(1,10)])-set(D))
ans =''
for i in reversed(range(-len(str(N)),0)):
    if int(str(N)[i]) not in D:
        ans+=str(N)[i]
    elif i==-len(str(N)):
        ans+=str(min(D1))
    else:
        ans+=str(min([d for d in D2 if d>int(str(N)[i])]))
print(int(ans[::-1]))
Problem p02690 (python)

Fixed submission:
X = int(input())
A = [0] * 400
m = 0
n = 0
for i in range(400):
  A[i] = i ** 5
for i in range(400):
  x = A[i]
  for j in range(400):
    y = A[j]
    if ((x + y) == X):
      m = i
      n = (-1) * j
    elif ((x - y) == X):
      m = i
      n = j
print(m, n)

Buggy submission (verdict: Runtime Error):
X = int(input())
A = [0] * 200
m = 0
n = 0
for i in range(400):
  A[i] = i ** 5
for i in range(400):
  x = A[i]
  for j in range(400):
    y = A[j]
    if ((x + y) == X):
      m = i
      n = (-1) * j
    elif ((x - y) == X):
      m = i
      n = j
print(m, n)

Buggy submission (verdict: Runtime Error):
X = int(input())
m = 0
n = 0
tip = 0
for i in range(101):
    if (tip == 0):
        p = i ** 5
        q = X - p
        r = q ** (1/5)
        if ((r - int(r)) == 0):
            m = r
            n = ((-1) * p)
            tip = 1
print(int(m), int(n))
Problem p02731 (python)

Fixed submission:
L = float(input())
ans = L * L * L / 27.0
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
print(S[1])
N = len(S)
print(N)