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

Fixed submission:
# -*- coding: utf-8 -*-
a = int(input())
lis = list(map(int, input().split()))
for i in range(a):
  judge = True
  if (lis[i] % 2 == 0):
    if (lis[i] % 3 != 0) and (lis[i] % 5 != 0):
      judge = False
      break
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())

for i in range(a):
  lis = list(map(int, input().split()))
  judge = True
  if (lis[i] % 2 == 0):
    if (lis[i] % 3 != 0) and (lis[i] % 5 != 0):
      judge = False
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
for i in range(a):
  b = int(input())
  judge = True
  if (b % 2 == 0):
    if (b % 3 != 0) and (b % 5 != 0):
      judge = False
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
judge = True
for i in range(a):
  b = int(input())
  if (b % 2 == 0):
    if (b % 3 != 0) and (b % 5 != 0):
      judge = False
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
judge = True
for i in range(a):
  b = int(input())
  if (b % 2 == 0)
    if (b % 3 != 0) and (b % 5 != 0):
      judge = False
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
judge = True
for i in range(a):
  b = int(input())
  if (b % 2 == 0)
    if (b % 3 != 0) or (b % 5 != 0):
      judge = False
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
judge = True
for i in range(a):
  b = int(input())
  if (b % 2 == 0) and (b % 3 != 0) and (b % 5 != 0):
    judge = False
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
judge = True
for i in range(a):
  b = int(input())
  if (b % 2 == 0) and ((b % 3 != 0) or (b % 5 != 0)):
    judge = False
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
judge = True
for i in range(a):
  b = int(input())
  if (b % 2 == 0) and ((b % 3 == 0) or (b % 5 == 0)):
    judge = False
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
judge = True
for i in range(a):
  b = int(input())
  if (b % 2 == 0) & ((b % 3 == 0) or (b % 5 == 0)):
    judge = False
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")
Problem p02784 (python)

Fixed submission:
H,N =map(int, input().split())
A = list(map(int, input().split()))
for Ax in A:
  H -= Ax
if H > 0:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
H,N map(int, input().split())
A = list(map(int, input().split()))
for Ax in A:
  H -= Ax
if H < 0:
  print("Yes")
else:
  print("No")
Problem p02801 (python)

Fixed submission:
C = input()
lis = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
       'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for x in range(len(lis)):
  if C == lis[x]:
    print(lis[x+1])
    break

Buggy submission (verdict: Runtime Error):
C = input()
lis = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
       'p', 'q', 'r', 's', 't'. 'u', 'v', 'w', 'x', 'y', 'z']
for x in range(len(lis)):
  if C == lis[x]:
    print(lis[x+1])
    break
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a + a*a + a*a*a)

Buggy submission (verdict: Runtime Error):
a = (int(x) for x in input().split())

print(a + a*a + a*a*a)
Problem p02639 (python)

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

c = 1
for x in l:
    if x == 0:
        print(c)
    c += 1

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

c = 0
for x in l:
    if x == 0:
        print(c)
    c++
Problem p02639 (python)

Fixed submission:
A = list(map(int,input().split()))
ans=0
for i in range(5):
  if A[i]!=i+1:
    ans=i+1
print(ans)

Buggy submission (verdict: Runtime Error):
X,Y=map(int,input().split())
var=0
for i in range(2X,4X+1,2):
  if Y==i:
    var=1
if var==1:
  print("Yes")
else:
  print("No")
Problem p02621 (python)

Fixed submission:
a=int(input())
print(a+a*a+a*a*a)

Buggy submission (verdict: Runtime Error):
print(a+a*a+a*a*a)
Problem p02921 (python)

Fixed submission:
x=input()
y=input()
c=0
for i in range (len(x)):
  if x[i]==y[i]:
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=[int(n) for n in input().split()]
a=[0]*n
for i in range(1,n):
  if x[i-1]>=x[i]:
    a[i]=1
m=0
c=0
for i in a:
  if i==1:
    c+=1
  else:
    m=max(c,m)
    c=0
print(m)
Problem p02640 (python)

Fixed submission:
X, Y = map(int, input().split())
ans = 'No'
for a in range(X + 1):
  b = X - a
  if 2 * a + 4 * b == Y:
    ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
 ans = 'No'
for a in range(X + 1):
  b = X - a
  if 2 * a + 4 * b == Y:
    ans = 'Yes'
print(ans)
Problem p02719 (python)

Fixed submission:
import numpy as np
import fractions
N, K = [int(i) for i in input().split(' ')]

if N == 0:
	result = 0
elif K == 0:
	result = N
elif N % K == 0:
	result = 0
elif K % N == 0:
	result = K/N if N > K/N else N
elif N > K:
  result = N % K if N % K < K - N % K else K-N%K
elif N < K:
  result = K-N if N > K - N else N
  
print("{}".format(result))

#lis = np.array([int(n) for n in input().split(' ')])
#print("{} {}".format(sum(lis) / 4 / int(M), lis[int(M)-1]))

#count = sum(sum(lis) / 4.0 / int(M) <= lis)

Buggy submission (verdict: Runtime Error):
import numpy as np
import fractions
N, K = [int(i) for i in input().split(' ')]

if K % N == 0:
	result = N
elif N % K == 0:
	result = 0
elif fractions.gcd(N, K) == 1 and N > K:
	result = 1
elif fractions.gcd(N, K) == 1 and K > N:
	result = K-N if N > K - N else N
else:
  result = fractions.gcd(N, K)
  
print("{}".format(result))

#lis = np.array([int(n) for n in input().split(' ')])
#print("{} {}".format(sum(lis) / 4 / int(M), lis[int(M)-1]))

#count = sum(sum(lis) / 4.0 / int(M) <= lis)
Problem p02706 (python)

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

if int(n)-sum(a) < 0:
    print("-1")
else:
    print(int(n)-sum(a))

Buggy submission (verdict: Runtime Error):
n, m = input().split()
a = list(map(int, input().split()))
print(max(n-sum(a),-1))
Problem p02658 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys

input()
l = list(map(lambda x: int(x), str(input()).split(" ")))
r = 1
finished = False

for i in l:
  if i == 0:
    print(str(0))
    sys.exit()
    
for i in l:
    r = r * i
    if r > 10 ** 18:
        print(str(-1))
        sys.exit()

print(str(r))

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


input()
l = list(map(lambda x: int(x), str(input()).split(" ")))
r = 1
finished = False
for i in l:
    r = r * l
    if r > 10 ** 18:
        print(str(-1))
        finished = True
        break

if not finished:
    print(str(r))
Problem p04043 (python)

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

m = {5: 0, 7: 0}
m[a] = m[a] + 1
m[b] = m[b] + 1
m[c] = m[c] + 1
if m[5] == 2 and m[7] == 1:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n, k = (input().split())
n = list(map(int, n));
dSet = set(map(int, input().split()))
okList = [i for i in range(10) if i not in dSet]
i = len(n)
while i >= 0:
    i -= 1
    if n[i] in okList:
        continue
    for y in okList:
        if n[i] < y:
            n[i] = y
            j = i+1
            while j < len(n):
                n[j] = okList[0]
                j += 1

            break
    else:
        if i - 1 < 0:
            n = [0] + n
            i += 1
        n[i - 1] += 1
        j = i
        while j < len(n):
            n[j] = okList[0]
            j += 1
print(int("".join(list(map(str, n)))))
Problem p04044 (python)

Fixed submission:
n, L = (map(int, input().split()))
ss = []
for i in range(n):
    ss.append(input())

ss.sort()
print("".join(ss))

Buggy submission (verdict: Runtime Error):
n, l = (map(int, input().split()))
ss = []
for i in range(n):
    ss.append(input())

ss.sort()
print(str.join(ss))
Problem p02783 (python)

Fixed submission:
H , A = map(int,input().split())
count = 0
while H > 0:
    H -= A
    count +=1

print(count)

Buggy submission (verdict: Runtime Error):
H , A = int(input().split().)
count = 0
while H > 0:
    H -= A
    count +=1

print(count)

Buggy submission (verdict: Runtime Error):
H , A = input().split().
count = 0
while H > 0:
    H -= A
    count +=1

print(count)
Problem p02789 (python)

Fixed submission:
N , M = map(int, input().split())
if N == M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a , b =map(int,input().split())
A=str(a)
B=str(b)
for(int i=0; i<a; i++):
    X+="A"
for(int j=0; j<b; j++):
    Y+="B"

if a<b:
    print(X)
if a>b:
    print(Y)

Buggy submission (verdict: Runtime Error):
#include <stdio.h>
int main()
{
  int N,M;
  scanf("%d %d",&N,&M);
  if (N == M)
      printf("Yes\n");
  if (N != M)
      printf("No\n");
}

Buggy submission (verdict: Runtime Error):
#include <stdio.h>
int main()
{
  int N,M;
  scanf("%d %d",&N,%M);
  if (N == M)
      printf("Yes");
  if (N != M)
      printf("No");
}

Buggy submission (verdict: Runtime Error):
#include <stdio.h>
int main()
{
  int N,M;
  scanf("%d %d",&N,%M);
  if (N == M)
      printf("Yes");
  if !(N == M)
      printf("No");
}

Buggy submission (verdict: Runtime Error):
#include <stdio.h>
int main()
{
  int N,M;
  scanf("%d %d",&N,%M);
  if N == M;
  printf("Yes");
  if !(N == M);
  printf("No")
}
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
wa, ac = [0]*(N+1), [0]*(N+1)
wa_ac = 0
for i in range(1, M+1):
  pi, Si = input().split()
  pi = int(pi)
  if Si == 'WA' and ac[pi] == 0: 
    wa[pi] += 1
  elif Si == 'AC' and ac[pi] == 0:
    ac[pi] += 1

for i in range(1, N+1):
  if ac[i] == 1:
    wa_ac += wa[i]

print('{} {}'.format(sum(ac), wa_ac))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
wa, ac = [0]*(N+1), [0]*(N+1)
wa_ac = 0
for i in range(1, M+1):
  pi, Si = input().split()
  pi = int(pi)
  if Si == 'WA' and ac[pi] == 0: 
    wa[pi] += 1
  elif Si == 'AC' and ac[pi] == 0:
    ac[pi] += 1

for i in range(1, M+1):
  if ac[i] == 1:
    wa_ac += wa[i]

print('{} {}'.format(sum(ac), wa_ac))
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
c = 0
ans = 0

for i in range(n-1, 0, -1):
  if h[i-1] >= h[i]:
    c += 1
    if c > ans:
      ans = c
  elif h[i-1] < h[i]:
      c = 0
      
print(ans)

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

ans = 0
for i in range(0, n-2):
  c = 0
  for j in range(i, n-2):
  if h[j] > = h[j+1]:
    c += 1
    if(c > ans):
      ans = c
print(ans)
Problem p02639 (python)

Fixed submission:
x = input()
x = x.split(' ')
j = 1
for i in x:
  if i == '0':
    print(j)
  j = j+1

Buggy submission (verdict: Runtime Error):
a = input()
j = 1
for i in a:
  if i ==0 :
    print(j)
    j++
Problem p02700 (python)

Fixed submission:
import math
a,b,c,d=[int(x) for x in input().split()]
if math.ceil(c/b)<=math.ceil(a/d):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,a,b=[int(x) for x in input().split()]

print((n//(a+b))*a + (n%(a+b)))
Problem p02628 (python)

Fixed submission:
N,K = input().split()

P = [int(p) for p in input().split()]

P.sort()

X = 0

for q in range(int(K)):
    X = X + P[q]

print(X)

Buggy submission (verdict: Runtime Error):
N,K = input().split()

P = [int(p) for p in input().split()]

P.sort()

for q in range(int(K)):
    X = X + int(q)

print(X)
Problem p02641 (python)

Fixed submission:
X,N = input().split()
list = [int(x) for x in input().split()]

min_num = [300, abs(int(X) - 300)]

for a in range(0,102):
    A = abs(int(X) - a)
    
    if a in list:
        continue
        
    else:
        if A > min_num[1]:
            continue
            
        elif A == min_num[1]:
            min_num[0] = min(a,min_num[0])
            min_num[1] = abs(int(X) - min_num[0])
            
        elif A < min_num[1]:
            min_num[0] = a
            min_num[1] = abs(int(X) - min_num[0])
            
print(min_num[0])

Buggy submission (verdict: Runtime Error):
X,N = int(input().split())
list = [int(x) for x in input().split()]

min_num = 150

for a in range(X - N - 2, X + N + 3):
    counter = 0
    A = abs(X - a)
    for b in list:
        if a == b:
            counter = 1
        else:
            continue
    if counter == 1:
        continue
    else:
        if A == abs(X - a):
            min_num = (a, min_num)
        elif A > abs(X - a):
            min_num = a
        else:
            continue

print(min_num)

Buggy submission (verdict: Runtime Error):
X,N = int(input().split())
list = [int(x) for x in input().split()]

min_num = 150

for a in range(-10,110):
    counter = 0
    A = abs(X - a)
    for b in list:
        if a == b:
            counter = 1
        else:
            continue
    if counter == 1:
        continue
    else:
        if A == abs(X - a):
            min_num = (a, min_num)
        elif A > abs(X - a):
            min_num = a
        else:
            continue

print(min_num)
Problem p02657 (python)

Fixed submission:
A,B = input().split()
print(int(A)*int(B))

Buggy submission (verdict: Runtime Error):
A,B = int(input().split())
print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = input().split()
print(A*B)
Problem p02658 (python)

Fixed submission:
N = input().split()

list = [int(x) for x in input().split()]

list.sort()

answer = 1

for a in list:
    answer = answer*a
    if answer == 0:
        break
    if answer > 10**18:
        answer = -1
        break
    else:
        continue

print(answer)

Buggy submission (verdict: Runtime Error):
N = input().split()

list = [int(x) for x in input().split()]

sortlist = list.sorted()

answer = 1

for a in sortlist:
    answer = answer*a
    if answer == 0:
        break
    if answer > 10^18:
        answer = -1
        break
    else:
        continue

print(answer)

Buggy submission (verdict: Runtime Error):
N = input().split()

list = [int(x) for x in input().split()]

sortlist = list.sorted()

answer = 1

for a in sortlist:
    answer = answer*a
    if answer == 0:
        break
    if answer > 10^18:
        answer = -1
        break
    else:
        continue
Problem p02630 (python)

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



A = list(A)

hashmap = {}
s = 0
for i in range(len(A)):
	s += A[i]
	hashmap[A[i]] = hashmap.get(A[i], [0, A[i]]) 
	hashmap[A[i]][0] += 1

for _ in range(Q):
	# replace every element whose value is B with C
	B, C = map(int, input().split())

	if B in hashmap:
		num = hashmap[B][0]
		del hashmap[B]
		s -= num * B
		s += num * C

		hashmap[C] = hashmap.get(C, [0, C])
		hashmap[C][0] += num
	print(s)

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



A = list(A)

hashmap = {}
s = 0
for i in range(len(A)):
	s += A[i]
	hashmap[A[i]] = hashmap.get(A[i], {'i': 0, 'v': A[i]}) 
	hashmap[A[i]]['i'] += 1

for _ in range(Q):
	# replace every element whose value is B with C
	B, C = map(int, input().split())

	if B in hashmap:
		num = hashmap[B]['i']
		del hashmap[B]
		s -= num * B
		s += num * C

	hashmap[C] = hashmap.get(C, {'i': 0, 'v': C})
	hashmap[C]['i'] += num
	print(s)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
import sys
import functools
import operator

L = []
for l in sys.stdin:
  L.append(l) 
A = list(map(int, L[1].split()))

answer = functools.reduce(operator.mul, A)
if answer <= 1000000000000000000:
  print(answer)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
import sys
import functools
import operator

L = []
for l in sys.stdin:
  L.append(l) 
  A = list(map(int, L[1].split()))

answer = functools.reduce(operator.mul, A)
if answer <= 1000000000000000000:
  print(answer)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
import sys
L = []
for l in sys.stdin:
  L.append(l)
N = int(L[0])
A = list(map(int, L[1].split()))

answer = 1
for a in A:
  answer = answer * a
  if answer > 1000000000000000000:
    print(-1)
    break
if answer <= 1000000000000000000:
  print(answer)
Problem p02663 (python)

Fixed submission:
import sys
a = []
for l in sys.stdin:
    a.append(l)
h1, m1, h2, m2, k  = a[0].split()
H1, M1, H2, M2, K = int(h1), int(m1), int(h2), int(m2), int(k)
time = 60 * H2 + M2 - (60*H1 + M1) - K
print(time)

Buggy submission (verdict: Runtime Error):
import sys
a = []
for l in sys.stdin:
    a.append(int(l))
h1, m1, h2, m2, k  = a[0].split()
H1, M1, H2, M2, K = int(h1), int(m1), int(h2), int(m2), int(k)
time = 60 * H2 + M2 - (60*H1 + M1) - K
print(time)
Problem p02946 (python)

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

start = x - k + 1
last = x + k - 1

result = []
result.append(start)

for i in range(1, last - start + 1):
    result.append(start + i)
for i in result:
    if i == start:
	    output = str(i)
    else:
        output = output + " " + str(i)

print(output)

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

start = x - k + 1
last = x + k - 1

result = []
result.append(start)

for i in range(1, last - start + 1):
    result.append(start + i)
for i in result:
    if i == start:
	output = str(i)
    else:
        output = output + " " + str(i)

print(output + "\n")

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

start = x - k + 1
last = x + k - 1

result = []
result.append(start)

for i in range(1, last - start + 1):
    result.append(start + i)
for i in result:
    if i == start:
	output = str(i)
    else:
        output = output + " " + str(i)
print(output)

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

start = x - k + 1
last = x + k - 1

result = []
result.append(start)

for i in range(1, last - start + 1):
    print(i)
    result.append(start + i)
for i in result:
    if i == start:
	output = str(i)
    else:
        output = output + " " + str(i)
print(output)
Problem p04047 (python)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
L.sort()
sum = 0
for i in range(N):
    x = L.pop(0)
    y = L.pop(0)
    sum += x
print(sum)

Buggy submission (verdict: Runtime Error):
N, X = map(int, intpu().split())
if X <= N / 3:
    result = 3 * (N - X)
if N / 3 < X and X < N /2:
    result = 6 * X
if N / 2 <= X:
    result = 3 * X
print(result)
Problem p02675 (python)

Fixed submission:
Nin=input()

N=Nin[-1]

if N in "24579":
  print("hon")
elif N in "0168":
  print("pon")
else:
  print("bon")

Buggy submission (verdict: Runtime Error):
import math 
A, B, H, M = map(int, input().split())
 
pai = math.pi

#HとMを正規化する事で、針間の角度を算出している
angle = 2*pai*((H+M/60)/12 - M/60)

#余弦定理
distance = np.sqrt(A**2+B**2-2*A*B*math.cos(angle))
print(distance)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = len(str(N)) - 1
if str(N[a]) == 2 or str(N[a]) == 4 or str(N[a]) == 5 or str(N[a]) == 7 or str(N[a]) == 9:
  print("hon")
elif str(N[a]) == 0 or str(N[a]) == 1 or str(N[a]) == 6 or str(N[a]) == 8:
  print("pon")
elif str(N[a]) == 3:
  print("bon")

Buggy submission (verdict: Runtime Error):
a = len(str(N)) - 1
if str(N[a]) == 2 or str(N[a]) == 4 or str(N[a]) == 5 or str(N[a]) == 7 or str(N[a]) == 9:
  print("hon")
elif str(N[a]) == 0 or str(N[a]) == 1 or str(N[a]) == 6 or str(N[a]) == 8:
  print("pon")
elif str(N[a]) == 3:
  print("bon")
Problem p02677 (python)

Fixed submission:
import math
 
A,B,H,M = map(int,input().split())
 
radH = 2*math.pi*H/12 + 30/180*math.pi*M/60
radM = 2*math.pi*M/60
 
L = math.sqrt(A**2+B**2-2*A*B*math.cos(radH-radM))
 
print(L)

Buggy submission (verdict: Runtime Error):
import math 
A, B, H, M = map(int, input().split())
 
pai = math.pi
 
#HとMを正規化する事で、針間の角度を算出している
angle = 2*pai*((H+M/60)/12 - M/60)
 
#余弦定理
distance = np.sqrt(A**2+B**2-2*A*B*math.cos(angle))
print(distance)
Problem p02724 (python)

Fixed submission:
X=int(input())

s=0
t=0

if X>=500:
    s=1000*(X//500)

if  (X-500*(X//500))>=5:
    b=(X-500*(X//500))//5
    t=5*b

print(int(s+t))

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

s=0
t=0

if X>=500:
    a=X//500
    s=1000*a

if  (X-500*(X//500))>=5:
    b=(X - 500 * a)//5
    t=5*b

print(s+t)
Problem p02952 (python)

Fixed submission:
N=int(input())

if N<10:
    print(N)
elif N<100:
    print(9)
elif N<1000:
    X=9+(N-99)
    print(X)
elif N<10000:
    print(909)
elif N<100000:
    X=909+(N-9999)
    print(X)
else:
    print(90909)

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

if N<=9:
    print(N)
elif N<=99:
    print(9)
elif N<=999:
    X=9+(N-99)
    print(X)
elif N<=9999:
    print(909)
elif N<=99999:
    X=909+(N-9999)
    print(x)
else:
    print(90909)
Problem p02658 (python)

Fixed submission:
def main():
    N =int(input())
    A =list(map(int,input().split()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main()

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

if 0 in A:
    ans = 0
else:
    for a in A:
        ans *= a
    if ans > 1000000000000000000:
        ans = -1
        return
print(ans)

Buggy submission (verdict: Runtime Error):
ans = 1
for a in A:
    if 0 in A:
        ans = 0
        break
    ans *= a
    if ans > 10**18:
        ans = -1
        break
print(ans)
Problem p02765 (python)

Fixed submission:
#AtCodr ABC156-A

N, R = input().rstrip().split(' ')
N = int(N)
R = int(R)

if N <= 9:
    rate = R+(10-N)*100
    print(rate)
else:
    print(R)

Buggy submission (verdict: Runtime Error):
#AtCodr ABC156-A

N, R = input().rstrip().split(' ')
N = int(N)
R = int(R)

if N <= 9:
    rate = R+22 3051(10-N)*100
    print(rate)
else:
    print(R)
Problem p02664 (python)

Fixed submission:
a = input()
s = list(a)

for i in range(len(s)):
  if (a[i] == '?'):
    s[i] = 'D'

s = "".join(s)
print(s)

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

a = input()
s = list(a)

index = []
index.append(a.find('?')+1)

i = 0
while a.find('?',index[i]) != -1:
  tmp = a.find('?',index[i])
  index.append(tmp + 1)
  i = i + 1

score = a.count('D') + a.count('PD')

for j in range(len(index)):
  if(index[j] != 0):
    if (s[index[j]-2] == 'P'):
      s[index[j]-1] = 'D'
      score = score + 2
    elif (s[index[j]-2] == 'D'):
      if index[j] - 1 < len(a):
        if (a[index[j]] == 'P'):
          s[index[j]-1] = 'D'
          score = score + 1
        elif (a[index[j]] == 'D'):
          s[index[j]-1] = 'P'
          score = score + 1
        elif (a[index[j]] == '?'):
          s[index[j]-1] = 'P'
      else:
        s[index[j]-1] = 'D'
        score = score + 1
s = "".join(s)
print(s)

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

a = input()
index = []
index.append(a.find('?')+1)

i = 0
while a.find('?',index[i]) != -1:
  tmp = a.find('?',index[i])
  index.append(tmp + 1)
  i = i + 1

len = len(a)
cnt = 0
s = a[0]
if a[0] == 'D':
  cnt = cnt + 1

j = 1
while j < len:
  if a[j] == 'D':
    s = s + 'D'
    cnt = cnt + 1
    if s[j-1] == 'P':
      cnt = cnt + 1
  elif a[j] == '?':
    if j == 0:
      s = s + 'D'
      cnt = cnt + 1
    elif j > 0:
      if s[j-1] == 'P':
        s = s + 'D'
        cnt = cnt + 2
      elif s[j-1] == 'D' and j < len - 1:
        if a[j+1] == 'D' or a[j+1] == '?':
          s = s + 'P'
        else:
          s = s + 'D'
          cnt = cnt + 1
  elif a[j] == 'P':
    s = s + 'P'
  j = j + 1

print(s)