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

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

blist = [0] * 50
for i in range(N):
  bn = bin(A[i])
  for j in range(len(bn)):
    if bn[len(bn) - 1 - j] == '1':
      blist[j] += 1
      
K = bin(K)[2::]
digit = len(K)
dp = [[0, 0] for i in range(digit)]
t = 0
for i in range(digit, 45):
  t += blist[i] * (2 ** i)
if K != '0':
  dp[digit - 1][0] = t + blist[digit - 1] * 2 ** (digit - 1)
  dp[digit - 1][1] = t + (N - blist[digit - 1]) * 2 ** (digit - 1)
else:
  dp[digit - 1] = [t, t]
for i in reversed(range(0, digit - 1)):
  if K[len(K) - i - 1] == '1':
    dp[i][1] = dp[i + 1][1] + (N - blist[i]) * (2 ** i)
    dp[i][0] = max([dp[i + 1][1] + blist[i] * (2 ** i),
                    dp[i + 1][0] + max([blist[i], N - blist[i]]) * (2 ** i)])
  else:
    dp[i][1] = dp[i + 1][1] + blist[i] * (2 ** i)
    dp[i][0] = dp[i + 1][0] + max([blist[i], N - blist[i]]) * (2 ** i)
    
print(max(dp[0]))

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

blist = [0] * 50
for i in range(N):
  bn = bin(A[i])
  for j in range(len(bn)):
    if bn[len(bn) - 1 - j] == '1':
      blist[j] += 1
      
K = bin(K)[2::]
digit = len(K)
dp = [[0, 0] for i in range(digit)]
t = 0
for i in range(digit, 45):
  t += blist[i] * (2 ** i)
if K != '0':
  dp[digit - 1][0] = t + blist[digit - 1] * 2 ** (digit - 1)
  dp[digit - 1][1] = t + (N - blist[digit - 1]) * 2 ** (digit - 1)
else:
  dp[digit - 1] = [t, t]
for i in reversed(range(0, digit - 1)):
  if K[len(K) - i] == '1':
    dp[i][1] = dp[i + 1][1] + (N - blist[i]) * (2 ** i)
    dp[i][0] = max([dp[i + 1][1] + blist[i] * (2 ** i),
                    dp[i + 1][0] + max([blist[i], N - blist[i]]) * (2 ** i)])
  else:
    dp[i][1] = dp[i + 1][1] + blist[i] * (2 ** i)
    dp[i][0] = dp[i + 1][0] + max([blist[i], N - blist[i]]) * (2 ** i)
    
print(max(dp[0]))
Problem p03102 (python)

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

ans = 0
for i in range(N):
  A = list(map(int, input().split()))
  score = C
  for j in range(M):
    score += A[j] * B[j]
  if(score > 0):
    ans += 1
print(ans)

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

ans = 0
for i in range(N):
  A = list(map(int, input().split()))
  score = C
  for j in range(M):
    score += A[i] * B[i]
  if(score > 0):
    ans += 1
print(ans)
Problem p03102 (python)

Fixed submission:
s=input().split()
n=int(s[0]);m=int(s[1]);c=int(s[2])
b=input().split();a=[];ans=0
for i in range(n) : a.append(input().split())
for i in range(n) :
  temp=0
  for j in range(m) : temp+=int(a[i][j])*int(b[j])
  if temp+c>0 : ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
s=input().split()
n=int(s[0]);m=int(s[1]);c=int(s[2])
b=input().split();a=[];ans=0
for i in range n : a.append(input().split())
for i in range n :
  temp=0
  for j in range m : temp+=int(a[i][j])*int(b[j])
  if temp+c>0 : ans+=1
print(ans)
Problem p02583 (python)

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

L = sorted(L)

ln = len(L)

ans = 0

for i in range(ln-2):
   for j in range(i+1, ln-1):
      for k in range(j + 1, ln):
         if L[i] + L[j] > L[k] and L[i] != L[j] and L[j] != L[k]:
             ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ln = len(L)
ansl = []
nonans = 0

for i in range(ln-2):
   for j in range(1,ln -1):
      for k in range(2, ln):
         if L[i] + L[j] > L[k] and L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
            ansl.append([L[i], L[j], L[k]])

for i in range(ln-1):
   for j in range(i + 1, ln):
      if ansl[i] == ansl[j]:
         nonans += 1
            

print(len(ansl) - nonans -1)
Problem p02584 (python)

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

a = (k * d - x) / (2 * d)

if abs(x) < k * d:
   if abs(int(a) + 1 - a) >= abs(int(a) - a):
      print(abs(x + 2 * int(a) * d - k * d))
   else:
      print(abs(x + 2 * (int(a) + 1) * d - k * d))

elif x < 0:
   print(abs(x + k * d))
else:
   print(x - k * d)

Buggy submission (verdict: Runtime Error):
X,  K,  D = list(map(int, input().split()))
L = X + D * K
 
if X >= 0:
   if K == 1 or D == 1:
      print(abs(X - D*K))
      exit()

elif X < 0:
   if K == 1 or D == 1:
      print(abs(X + D*K))
      exit()

elif L >= 0:
   if L / (2 * D) - int(L / (2 * D)) > 0.5:
      a = L // (2 * D) + 1
   else:
      a = L // (2 * D)
 
elif L < 0:
   if L / (2 * D) - int(L / (2 * D)) < -0.5:
      a = int(L / (2 * D)) - 1
   else:
      a = int(L / (2 * D)) 
print(abs(X-2*D*a+D*K))
Problem p02615 (python)

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

A = sorted(A, reverse = True)

B = [A[0]] + [A[i] for i in range(1,N)] * 2

B = sorted(B, reverse = True)

ans = 0

for i in range(N - 1):
   ans +=  B[i]
print(ans)

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

A = sorted(A, reverse = True)

la = len(A)

for i in range(la-1):
   ans += A[i]

print(ans)
Problem p02641 (python)

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

p = set(p)
for i in range(200):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break

Buggy submission (verdict: Runtime Error):
X, N = list(map(int,input().split()))
if N == 0:
  print(X)
  exit()
p = list(map(int,input().split()))
if N == 1:
  if p[0] == X:
    print(X-1)
  else:
    print(X)

MAX = 0
for i in range(N):
  if MAX < X - p[i]:
    MAX = X - p[i]
    
for i in range(MAX):
  if X - i not in p:
    ans = X - i
    break
for i in range(MAX):
  if X + i not in p:
    ans = min(X - ans, ans - X) + X
    break
print(ans)
Problem p02642 (python)

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

d = {}
for a in A:
  d.setdefault(a,0)
  d[a] += 1
  
A = sorted(set(A))
t = [True] * (10 ** 6 + 1)
for a in A:
    if d[a] > 1:
        t[a] = False
    for i in range(a + a, 10 ** 6 + 1, a):
        t[i] = False
print(sum(1 for a in A if t[a]))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
ans = 1
flag = 0
#第1項が割り切れる場合答えは0。割り切れるとしたら次の項で可能。
if A[0] % A[1] == 0:
  print(0)
  exit()
#第二項以降を考える。
for i in range(1,N):
  for j in range(i-1):
    if A[i] % A[j] == 0:
      flag += 1
  if flag == 0:
    ans += 1
  else:
    flag = 0
    
print(ans)
Problem p02663 (python)

Fixed submission:
H1, M1, H2, M2, K = list(map(int,input().split()))
a = 60*H1 + M1
b = 60*H2 + M2
print(b - a - K)

Buggy submission (verdict: Runtime Error):
H1, M1, H2, M2, K = list(map(int,input().split()))
a = 60*H1 + M1
b = 60*H2 + M2
print(b - a - p)
Problem p02730 (python)

Fixed submission:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
s = input()
n = len(s)
m = (n-1) // 2
k = (n+3) // 2
flag = 1
for i in range(0, n//2):
    if s[i] != s[n-i-1]:
        flag = 0
        break
for i in range(0, m//2):
    if s[i] != s[m-i-1]:
        flag = 0
        break
for i in range(0, (n-k)//2+1):
    if s[i+k-1] != s[n-i-1]:
        flag = 0
        break
if flag == 1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
sl = list(S)
N = len(sl)
flag = 0
a = int((N-1)/2)
b = int((N+3)/2)
slr = list(reversed(sl))
asl = sl[0:a]
aslr = list(reversed(asl))
bsl = sl[b:N]
bslr = list(reversed(bsl))
for i in range(N-1):
  if sl[i] != slr[i]:
    flag += 1
for i in range(0,a-1):
  if asl[i] != aslr[i]:
    flag += 1
for i in range(b-1,N-3):
  if bsl[i] != bslr[i]:
    flag += 1
if flag == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
flag = 0
a = (N-1)/2
b = (N+3)/2
sl = list(S)
slr = reversed(sl)
asl = sl[0:a]
aslr = reversed(asl)
bsl = sl[b:N]
bslr = reversed(bsl)
for i in range(N):
  if sl[i] != slr[i]:
    flag += 1
for i in range(0,a-1):
  if asl[i] != aslr[i]:
    flag += 1
for i in range(b-1,N):
  if bsl[i] != bslr[i]:
    flag += 1
if flag == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
judg = 0
n = N - 1 
for i in range(0,n):
  if S[i] == S[n - i]:
    judg += 0
  else:
    judg += 1

for i in range(0,n/2-1):
  if S[i] == S[n/2 - i]:
    judg += 0
  else:
    judg += 1

for i in range(n/2+1,n):
  if S[i] == S[n - i]:
    judg += 0
  else:
    judg += 1
    
if judg == 0:
  print('Yes')
else:
  print('No')
Problem p02732 (python)

Fixed submission:
import collections
N = int(input())
li = list(map(int, input().split()))
cn = collections.Counter(li)
sumC = sum([n*(n-1)//2 for n in cn.values()])
for k in range(N):
    print(sumC-cn[li[k]] + 1)

Buggy submission (verdict: Runtime Error):
import collections as cl
N = int(input())
A = list(map(int,inpput().split()))
cn = cl.Counter(A)
sumC = sum([n*(n-1)//2 for n in cl.values()])
for k in range(N):
  print(sumC - cn[A[k]] +1)

Buggy submission (verdict: Runtime Error):
import collections as cl
N = int(input())
A = list(map(int,inpput().split()))
cn = cl.Counter(A)
sumC = sum([n*(n-1)//2 for n in cl.values()])
for k in range(N):
  print(sumC - cn[k] +1)
Problem p02741 (python)

Fixed submission:
lists = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(int(lists[k-1]))

Buggy submission (verdict: Runtime Error):
k = input()
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(int(A[k-1]))

Buggy submission (verdict: Runtime Error):
k = input()
A = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}
print(int(A[k-1]))

Buggy submission (verdict: Runtime Error):
k = input()
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[k-1])

Buggy submission (verdict: Runtime Error):
lists = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(lists(k+1))

Buggy submission (verdict: Runtime Error):
lists = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(lists(k))

Buggy submission (verdict: Runtime Error):
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(A[K+1])
Problem p02743 (python)

Fixed submission:
import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
    print("No")
else:
    if(l < r):
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = list(map(int, input().split()))
if a > 0 and b > 0 and c > 0:
  if 4*a*b < (c-a-b)**2:
  print('Yes')
  else:
  print('No')
else:
  print('')

Buggy submission (verdict: Runtime Error):
import math as mat
a, b, c = int(input().split())
if mat.sqrt(a) + mat.sqrt(b) < mat.sqrt(c):
  print('Yes')
else:
  print('No')
Problem p02756 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
 
S = deque(readline().rstrip().decode())
Q = int(readline())
query = readlines()
 
rev = False
for q in query:
    if q[0] == ord('1'):
        rev = not rev
    else:
        _, f, c = q.decode().split()
        f = int(f)
        if rev ^ (f == 1):
            S.appendleft(c)
        else:
            S.append(c)
 
T = ''.join(S)
if rev:
    T = T[::-1]
print(T)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import deque

S = deque(readline().rstrip().decode())
Q = int(readline())
query = int(readlines())
rev = False
for q in query:
  if q[0] == ord('1'):
        rev = not rev
    else:
        _, f, c = q.decode().split()
        f = int(f)
        if rev ^ (f == 1):
            S.appendleft(c)
        else:
            S.append(c)
 
T = ''.join(S)
if rev:
    T = T[::-1]
print(T)
Problem p02767 (python)

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
s = sum(X)
l = len(X)
ave = s/l
if ave - float(int(ave)) <= 0.5:
  avei = int(s/l)
else:
  avei = int(s/l) + 1
ans = 0
for i in range(N):
  ans += (X[i] - avei)**2
print(ans)

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

for i in range(N):
  for j in range(1,101):
    print(min(sum(j-x[i])**2))
Problem p02772 (python)

Fixed submission:
#入力
N = int(input())
A = list(map(int,input().split()))
#2で割り切れるものいれるリスト,要素として0は入らないのでとりあえず0
B = [0 for _ in range(N)]
#2で割り切れるリストの数カウント
count = 0
#2で割り切れるリストに偶数要素を代入&要素数カウント
for i in range(N):
  if A[i] % 2 == 0:
    B[i] = A[i]
    count += 1
#0は後からいれた要素ではありえないので削除
C = [i for i in B if i != 0]
#3と5のどちらでも割り切れない場合はだめ
flag = 0
for i in range(count):
  if C[i] % 3 != 0 and C[i] % 5 != 0:
    flag += 1
if flag == 0:
  print('APPROVED')
else:
  print('DENIED')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = [0 for _ in range(N)]
count = 0
for i in range(N):
  if A[i] % 2 == 0:
    B[i] = A[i]
    count += 1
B.remove(0)
flag = 0
for i in range(count):
  if B[i] % 3 != 0 and B[i] % 5 != 0:
    flag += 1
if flag == 0:
  print('APPROVED')
else:
  print('DENIED')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = (input().split())
i_count = 0
test = []
 for i in A:
  num = int(i) % 2
  if num == 0 :
    test.append(i)
 
 for i in test:
  num3 = int(i) % 3
  num5 = int(i) % 5
  if num3 == 0 or num5 ==0:
    i_count += 1
 
 if i_count == len(test):
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
for i in N:
  if A[i] % 2 == 0:
    if A[i] % 3 == 0 or A[i] % 5 == 0:
print('APPROVED')
    else:
print('DENIED')
  else:
print('DENIED')
Problem p02780 (python)

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

m = [(e + 1) / 2 for e in p]

t = sum(m[0:K])
result = t
for i in range(N - K):
    t -= m[i]
    t += m[i + K]
    if t > result:
        result = t
print(result)

Buggy submission (verdict: Runtime Error):
N, K = list(map(int,input().split()))
p = list(map(int,input().split()))
P = sorted(p,reverse = True)
Sum = [0 for _ in range(N-1)]
exp = [0 for _ in range(N-1)]
Exp = 0
for i in range(N-1):
  for j in range(P[i]+1):
    Sum[i] += j
  exp[i] = Sum[i]/P[i]
for i in range(0,K):
  Exp += exp[i] 
print(Exp)
Problem p02801 (python)

Fixed submission:
A = ['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']
C = input()
for i in range(len(A)):
  if C == A[i]:
    break
print(A[i+1])

Buggy submission (verdict: Runtime Error):
A = ['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']
C = input()
for i in range(len(A)):
  elif C == A[i]:
  break
print(A[i+1])
Problem p02811 (python)

Fixed submission:
K, X = list(map(int,input().split()))
if 500*K >= X:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
K, X = int(input())
if 500*K >= X:
  print('Yes')
else:
  print('No')
Problem p02813 (python)

Fixed submission:
from itertools import permutations
 
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
 
i = 0
a = 0
b = 0
for s in permutations(range(1, n+1)):
    for j in range(n):
        if p[j] != s[j]:
            break
    else:
        a = i
    for j in range(n):
        if q[j] != s[j]:
            break
    else:
        b = i
    i += 1
 
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
from itertools import permutations

n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

i = 0
a = 0
b = 0

for s in permutaions(range(1,n + 1)):
  for j in range(n):
    if p[j] != s[j]:
      break
  else:
    a = i
  for j in range(n):
    if q[j] != s[j]:
      break
  else:
    b = i
    i += 1
    
print(abs(a-b))
Problem p02818 (python)

Fixed submission:
A, B, X = list(map(int,input().split()))
if A > X:
  print(A-X, B)
elif A <= X and B > X - A:
  print(0, B-(X-A))
elif A == 0 and B == 0:
  print(0,0)
else:
  print(0,0)

Buggy submission (verdict: Runtime Error):
A, B, X = list(map(int,input().split()))
if A > X:
  print(A-X, B)
elif A <= x and B > X - A:
  print(0, B-(X-A))
elif A == 0 and B == 0:
  print(0,0)
else:
  print(0,0)
Problem p02823 (python)

Fixed submission:
N,A,B = map(int,input().split())
if (B-A) % 2 == 0:
  print((B-A)//2)
else:
  print(min(A-1,N-B)+1+(B-A-1)//2)

Buggy submission (verdict: Runtime Error):
N, A, B = list(map(int.input().split()))
if abs(A-B) % 2 == 0:
  print(abs(A-B)//2)
else:
  print(max(A-1,B-1))
Problem p02843 (python)

Fixed submission:
X = int(input())
flag = 0
for C in range(X+1):
  if 100*C <= X and 105*C >= X:
    flag += 1
    break
print(flag)

Buggy submission (verdict: Runtime Error):
X = int(input())
flag = 0
for c in range(X):
  if 100*C <= X and 105*C >= X:
    flag += 1
print(flag)
Problem p02993 (python)

Fixed submission:
#数字でも文字列として扱える。intにすると左一桁目から0がある場合存在しないものとなるので注意
s = input()
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
  print('Bad')
else:
  print('Good')

Buggy submission (verdict: Runtime Error):
S = int(input())
ls = list(str(S))
if ls[0] == ls[1] or ls[1] == ls[2] or ls[2] == ls[3]:
  print('Bad')
else:
  print('Good')

Buggy submission (verdict: Runtime Error):
S = int(input())
ls = list(S)
if ls[0] == ls[1] or ls[1] == ls[2] or ls[2] == ls[3]:
  print('Bad')
else:
  print('Good')

Buggy submission (verdict: Runtime Error):
S = int(input())
ls = list(S)
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
  print('Bad')
else:
  print('Good')
Problem p03085 (python)

Fixed submission:
s = input()
if s == 'A':
  print('T')
elif s == 'T':
  print('A')
elif s == 'C':
  print('G')
else:
  print('C')

Buggy submission (verdict: Runtime Error):
if input() == 'A':
  print('T')
elif input() == 'T':
  print('A')
elif input() == 'C':
  print('G')
else:
  print('C')
Problem p03239 (python)

Fixed submission:
N, T = list(map(int,input().split()))
c = [0 for i in range(N)]
t = [0 for i in range(N)]
for i in range(N):
  c[i], t[i] = input().split()
  c[i] = int(c[i])
  t[i] = int(t[i])

ans = float('inf')
for i in range(N):
  if t[i] <= T and c[i] < ans:
    ans = c[i]
if ans == float('inf'):
  print('TLE')
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N,T = list(map(int,input().split()))
c = [None for _ in range(N)]
t = [None for _ in range(N)]
A = [None for _ in range(N)]
for i in range(N):
  c[i], t[i] = input().split()
  c[i] = int(c[i])
  t[i] = int(t[i])
for i in range(N):
  if t[i] <= T:
    A[i] = c[i]
A = [a for a in A if type(a) != 'Nonetype']
A = sorted(A)
ans = A[0]
print(ans)
Problem p03290 (python)

Fixed submission:
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], -(-(g - sum) // (use * 100))) #ムダに-演算子を重ねているのは切り上げしたいから
            count += n
            sum += n * use * 100
        if sum >= g:
            ans = min(ans, count)
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("inf")
dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)

Buggy submission (verdict: Runtime Error):
def dfs(i, sum, count, unsolve):
 global ans
 if i == D:
  #G点に満たなければunsolveのうち最も大きいものを解く
  if sum < G:
   use = max(unsolve)
  #解く問題が問題数を超えないようにする
   N = min(pc[use-1][0], -(-(g-sum)//(100*use)))
   count += N 
   sum += N * 100 * use
  if sum > G:
   ans = min(ans, count)
 else:
 dfs(i + 1, sum, count, unsolve)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], unsolve - {i + 1})

d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("inf")
dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)
Problem p03308 (python)

Fixed submission:
n = input()
A = list(map(int, input().split()))
print(int(max(A)) - int(min(A)))

Buggy submission (verdict: Runtime Error):
n = input()
A = list(map(int, input().split())
print(int(max(A))-int(min(A)))

Buggy submission (verdict: Runtime Error):
N = input()
A = [int(i) for input().split()]
int(max) = 0
int(min) = 0
for i in N:
  if int(max) < A[i]:
    max = A[i]
for i in N:
  if int(min) > A[i]:
    min = A[i]

abs = max - min
print(int(abs))
Problem p03369 (python)

Fixed submission:
s=input()
n=0
for a in s:
  if a=='o':
    n+=100
sum = 700+n
print(sum)

Buggy submission (verdict: Runtime Error):
s=input()
n=0
for s in a:
  if a=='o':
    n+=100
sum = 700+n
print(sum)
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
print(sum(500*a+100*b+50*c==X for a in range(A+1) for b in range(B+1) for c in range(C+1)))

Buggy submission (verdict: Runtime Error):
A, B, C, X = [int(input()) for i in range(4)]
count = 0
if 500*a + 100*b + 50*c == X for a in range(A+1) for b in range(B+1) for c in range(C+1):
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A, B, C, X = [for i in range(4) int(input())]
count = 0
if 500*a + 100*b + 50*c == X for a in range(A+1) for b in range(B+1) for c in range(C+1):
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
for i in range(4):
   A, B, C, X = int(input())
count = 0
if 500*a + 100*b + 50*c == X for a in range(A+1) for b for range(B+1) for c in range(C+1):
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
i for range(4):
  A, B, C, X = [int(input())]
count = 0
if 500*a + 100*b +50*c == X for a in range(A+1) for b in range(B+1) for c in range(C+1):
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A, B, C, X = [int(input()) for i in range(4)]
print(sum(500*a + 100*b + 50*c == X for a in range(A+1) and b in range(B+2) and c in range(C+1)))

Buggy submission (verdict: Runtime Error):
A, B, C, X = [int(input()) for i in range(4)]
print(sum(500a + 100b + 50c == X for a in range(A+1) and b in range(B+2) and c in range(C+1)))
Problem p03455 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
b, c = map(int, input().split())
#席の余り
mod =  (b*c)%2
# 出力
if mod == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
b, c = map(int, input().split())
# 積の計算と余りの判別
mod = (b*c)%2
# 出力
if(mod==0)
	print('Even')
else
	print('Odd')
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
 
ans = [-1,-1,-1]
for x in range(0,N+1):
    for y in range(0,N-x+1):
        z = N - x - y
        if x*10000 + y*5000 + z*1000 == Y:
            ans[0] = x
            ans[1] = y
            ans[2] = z
print(ans[0],ans[1],ans[2])

Buggy submission (verdict: Runtime Error):
N, Y = int(input().split())
ans = [-1,-1,-1]
for x in range(N+1):
  for y in range(N+1):
    z = N - x - y
    if 10000 * x + 5000 * y + 1000 * z == Y:
      ans[0] = x
      ans[1] = y
      ans[2] = z
print(ans[0],ans[1],ans[2])

Buggy submission (verdict: Runtime Error):
N, Y = int(input().split())
ans = [-1,-1,-1]
for x in range(N+1):
  for y in range(N+1):
    z = N - x - y
    if 10000 * x + 5000 * y + 1000 * z == Y:
      ans[0] = x
      ans[1] = y
      ans[2] = z
print(ans)

Buggy submission (verdict: Runtime Error):
N, Y = int(input().split())
if 10000*a + 5000*b +1000*c == Y for a in range(N + 1) for b in range(N + 1) for c in range(N + 1):
  print('{}{}{}', a,b,c)
else:
  print('{}{}{}',-1,-1,-1)