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

Fixed submission:
c=str(input())
list=["a","i","u","o","e"]
if c in list:
  print("vowel")
else:
  print("consonant")

Buggy submission (verdict: Runtime Error):
c=str(input())
list=[a,i,u,o,e]
if c in list:
  print("vowel")
else:
  print("consonant")

Buggy submission (verdict: Runtime Error):
c=input()
list=[a,i,u,o,e]
if c in list:
  print("vowel")
else:
  print("consonant")
Problem p03860 (python)

Fixed submission:
a,b,c=[str(i) for i in input().split()]
print("A"+b[0]+"C")

Buggy submission (verdict: Runtime Error):
a,b,c=[for i in input().split()]
print("A"+b[0]+"C")
Problem p03997 (python)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2)

Buggy submission (verdict: Runtime Error):
(a+b)*h/2
Problem p04029 (python)

Fixed submission:
n=int(input())
print(n*(n+1)//2)

Buggy submission (verdict: Runtime Error):
return N(N+1)/2
Problem p04043 (python)

Fixed submission:
a,b,c,=map(int,input().split())
list1=[a,b,c]
if list1==[5,7,5]:
    print("YES")
elif list1==[7,5,5]:
    print("YES")
elif list1==[5,5,7]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
list=[int(i) for i in input().split()]
list1=sorted(list)
if list1=[5,5,7]:
  print('YES')
else:
  print('NO')
Problem p03102 (python)

Fixed submission:
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
A = [ list(map(int,input().split())) for _ in range(N) ]
 
ans = 0
for a in A:
  s = 0
  for i in range(M):
    s += a[i] * B[i]
  ans += 1 if s+C > 0 else 0
print(ans)

Buggy submission (verdict: Runtime Error):
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
A = [ list(map(int,input().split())) for _ in range(N) ]

ans = 0
for a,b in A,B:
  ans += 1 if sum([i*j for i,j in a,b])+C>0
 print(ans)
Problem p03103 (python)

Fixed submission:
N,M = map(int,input().split())
 
A = [ list(map(int,input().split())) for _ in range(N) ]
A.sort()
ans = 0
while M > 0:
  if M >= A[0][1]:
    ans += A[0][0] * A[0][1]
    M -= A[0][1]
    del A[0]
  else:
    ans += A[0][0] * M
    M = 0
print(ans)

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

A = [ list(map(int,input().split())) for _ in range(N) ]
A.sort()
ans = 0
for M == 0:
  if M >= A[0][1]:
    ans += A[0][0] * A[0][1]
    M -= A[0][1]
    del A[0]
  else:
    ans += A[0][0] * M
    M = 0
print(ans)
Problem p03814 (python)

Fixed submission:
a = -1
z = 0
for i, c in enumerate(input()):
  if c == "A" and a == -1: a = i
  if c == "Z": z = i

print(z-a+1)

Buggy submission (verdict: Runtime Error):
S = input()
a = -1
z = len(S)
for i, c in enumerate(input()):
  if c == "A" and a == -1: a = i
  if c == "Z": z = i

print(z-a+1)
Problem p02719 (python)

Fixed submission:
def solve():
    N, M = map(int, input().split())
    
    if N % M == 0:
        return 0
    
    a = N % M

    return min(a, abs(a-M))

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    N, M = map(int, input().split())
    a = abs(N-M)
    
    if a >= N:
        return N
    
    return min(N % a, N % M)

print(solve())
Problem p02768 (python)

Fixed submission:
def solve():
    n, a, b = list(map(int, input().split()))
    MOD = 10 ** 9 + 7
    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]
    
    for i in range(2, max(a, b)+1):
        fact.append((fact[-1] * i) % MOD)
        inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
        factinv.append((factinv[-1] * inv[-1]) % MOD)
    
    def ncr(n, r):
        ret = factinv[r]
        for i in range(n, n-r, -1):
            ret = ret * i % MOD
        return ret
        
    ans = pow(2, n, MOD)
    ans = (ans-ncr(n, a)-ncr(n, b)-1) % MOD
    return ans


print(solve())

Buggy submission (verdict: Runtime Error):
def ten_to_n(X, n):
    i = int(X / n)
    s = str(X % n)
    if (i):
        return ten_to_n(i, n) + s
    return s

def solve():
    N, M = map(int, input().split())
    n = ten_to_n(N, M)
    return len(n)
 
print(solve())
Problem p02780 (python)

Fixed submission:
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # スコアの累積和
    l = list(itertools.accumulate(A))

    score = sum(A[:M])
    for i in range(1, N-M):
        score = max(score, l[i+M] - l[i])
        
    ans = (M + score) / 2

    return ans

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    l = list(itertools.accumulate(A))
    
    if A[0] == 1 and len(A) == 1:
        return 1
    
    ans = 0
    for i in range(M, N):
        ans = max(ans, l[i] - l[i-M])
    
    ans = (ans+M) / 2
    
    return ans

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    
    base = [i for i in range(1, 1001)]
    l = list(itertools.accumulate(base))
    r = []
    for i in range(0, len(l)):
        r.append(l[i] / (i+1))

    memo = 0
    maxi = 0
    for i in range(N-M+1):
        if maxi < sum(A[i:M+i]):
            maxi = sum(A[i:M+i])
            memo = i

    ans = 0
    for i in A[memo:M+memo]:
        ans += r[i-1]

    return ans

print(solve())
Problem p02783 (python)

Fixed submission:
def solve():
    N, M = map(int, input().split())
    return N // M if N % M == 0 else N //M + 1

print(solve())

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

# S = input()
# N = int(input())
H, N = map(int, input().split())
# A = list(map(int, input().split()))
# B = [int(input()) for _ in range(n)]
# A = []
# B = []
# for _ in range(N):
#     a, b = list(map(int, input().split()))
#     A.append(a)
#     B.append(b)

# 二次元配列
# [[inf, inf, inf], [inf, inf, inf]]
# dp = [[float('inf')] * (H + 1) for i in range(N + 1)]

INF = 10 ** 18
dp = [INF] * (H + 1)
dp[0] = 0

def solve():
    for i in range(N):
        a, b = list(map(int, input().split()))

        for j in range(H):
            nj = min(j + a, H)
            dp[nj] = min(dp[nj], dp[j] + b)
    return dp[H]

print(solve())
Problem p02796 (python)

Fixed submission:
from operator import itemgetter

def solve():
    N = int(input())
    C = []
    for _ in range(N):
        a, b = list(map(int, input().split()))
        C.append((a-b, a+b))

    C.sort(key = itemgetter(1))
    
    c = 0
    cur = -float('inf')
    for i in range(N):
        if cur <= C[i][0]:
            c += 1
            cur = C[i][1]

    return c

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    C = []
    for _ in range(N):
        a, b = list(map(int, input().split()))
        C.append((a-b+1, a+b-1))

    C.sort()

    for i in range(len(C)-1):
        if C[i][1] > C[i+1][0]:
            C.pop(0)

    return len(C)

print(solve())
Problem p02811 (python)

Fixed submission:
def solve():
    N, M = map(int, input().split())
    return 'Yes' if N*500 >= M else 'No'

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    N, M = map(int, input().split())
    return 'Yes' if None*500 >= M else 'No'

print(solve())
Problem p03125 (python)

Fixed submission:
a, b = list(map(int, input().split()))
print(a+b if b%a == 0 else b-a)

Buggy submission (verdict: Runtime Error):
a, b = list(map(int(), input()))
print(a+b if b%a == 0 else b-a)
Problem p03162 (python)

Fixed submission:
N = int(input())
dp = [0,0,0]
for _ in range(N):
    a, b, c = map(int, input().split())
    ndp = [0,0,0]
    ndp[0] = max(dp[1], dp[2]) + a
    ndp[1] = max(dp[0], dp[2]) + b
    ndp[2] = max(dp[0], dp[1]) + c
    dp = ndp
print(max(dp))

Buggy submission (verdict: Runtime Error):
N = int(input())
dp = [0,0,0]
for _ in range(N):
    a, b, c = map(int, input().split())
    ndp = [0,0,0]
    ndp[0] = max(dp[1], dp[2]) + a
    ndp[1] = max(dp[0], dp[2]) + b
    ndp[2] = max(dp[0], dp[1]) + c
    dp = ndp
return max(dp)
Problem p03200 (python)

Fixed submission:
A = list(input())

count = 0
ans = 0
for a in A:
    if a == 'B':
        count += 1
    else:
        ans += count

print(ans)

Buggy submission (verdict: Runtime Error):
A = list(input())
n = len(A)

count = 0
for i in reversed(range(1, n)):
    if  A[i-1] == 'B' and A[i] == 'W':
        A[i-1] = 'W'
        A[i] = 'B'
        count += 1
        a += 1

print(count * 2)
Problem p03281 (python)

Fixed submission:
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def solve():
    N = int(input())
    
    c = 0
    for i in range(1, N+1, 2):
        f = factorize(i)
        b = 1
        for j in f:
            b += b * j[1]
        if b == 8:
            c += 1

    return c

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    
    c = 0
    for i in range(1, N+1, 2):
        f = factorize(i)
        l = []
        for j in f:
            l.append(j)
            l.append(N // j)
        l.append(N)
        l.append(1)
        s = len(set(l))
        if s == 8:
            c += 1

    return c

print(solve())
Problem p03545 (python)

Fixed submission:
def solve():
    N = list(input().split())[0]
    a,b,c,d = int(N[0]),int(N[1]),int(N[2]),int(N[3])

    if a+b+c+d == 7:
        print('{0}+{1}+{2}+{3}=7'.format(a,b,c,d))
        return 

    if a+b+c-d == 7:
        print('{0}+{1}+{2}-{3}=7'.format(a,b,c,d))
        return 

    if a+b-c+d == 7:
        print('{0}+{1}-{2}+{3}=7'.format(a,b,c,d))
        return 

    if a-b+c+d == 7:
        print('{0}-{1}+{2}+{3}=7'.format(a,b,c,d))
        return 

    if a+b-c-d == 7:
        print('{0}+{1}-{2}-{3}=7'.format(a,b,c,d))
        return 

    if a-b+c-d == 7:
        print('{0}-{1}+{2}-{3}=7'.format(a,b,c,d))
        return 

    if a-b-c+d == 7:
        print('{0}-{1}-{2}+{3}=7'.format(a,b,c,d))
        return 

    if a-b-c-d == 7:
        print('{0}-{1}-{2}-{3}=7'.format(a,b,c,d))
        return 

# print(solve())

# テスト用

solve()

Buggy submission (verdict: Runtime Error):
def solve():
    N = list(input().split())[0]
    a,b,c,d = int(N[0]),int(N[1]),int(N[2]),int(N[3])

    if a+b+c+d == 7:
        print(f'{a}+{b}+{c}+{d}=7')
        return 

    if a+b+c-d == 7:
        print(f'{a}+{b}+{c}-{d}=7')
        return 

    if a+b-c+d == 7:
        print(f'{a}+{b}-{c}+{d}=7')
        return 

    if a-b+c+d == 7:
        print(f'{a}-{b}+{c}+{d}=7')
        return 

    if a+b-c-d == 7:
        print(f'{a}+{b}-{c}-{d}=7')
        return 

    if a-b+c-d == 7:
        print(f'{a}-{b}+{c}-{d}=7')
        return 

    if a-b-c+d == 7:
        print(f'{a}-{b}-{c}+{d}=7')
        return 

    if a-b-c-d == 7:
        print(f'{a}-{b}-{c}-{d}=7')
        return 
      
solve()
Problem p03695 (python)

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

colors = [0 for _ in range(8)]
over = 0

for a in A:
    if 1 <= a < 400:
        colors[0] = 1
    if 400 <= a < 800:
        colors[1] = 1
    if 800 <= a < 1200:
        colors[2] = 1
    if 1200 <= a < 1600:
        colors[3] = 1
    if 1600 <= a < 2000:
        colors[4] = 1
    if 2000 <= a < 2400:
        colors[5] = 1
    if 2400 <= a < 2800:
        colors[6] = 1
    if 2800 <= a < 3200:
        colors[7] = 1
    if 3200 <= a:
        over += 1

c = colors.count(1)

if over == 0:
    maxi = c
else:
    maxi = c + over

if c == 0:
    mini = 1
else:
    mini = c

print(mini, maxi)

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

colors = [0 for _ in range(N + 1)]

for a in A:
    if 1<= a < 400:
        colors[0] = 1
    if 400 <= a < 800:
        colors[1] = 1
    if 800 <= a < 1200:
        colors[2] = 1
    if 1200 <= a < 1600:
        colors[3] = 1
    if 1600 <= a < 2000:
        colors[4] = 1
    if 2000 <= a < 2400:
        colors[5] = 1
    if 2400 <= a < 2800:
        colors[6] = 1
    if 2800 <= a < 3200:
        colors[7] = 1
    if 3200 <= a:
        colors[8] += 1

minimum = sum(colors[:-1])
zero_count = colors.count(0)
over_count = colors[-1]

max = 0
max = min(zero_count, over_count) + minimum

print(minimum, max)
Problem p04033 (python)

Fixed submission:
def solve():
    N, M = map(int, input().split())
    if N > 0:
        return 'Positive'
    elif N <= 0 <= M:
        return 'Zero'
    else:
        
        if (-(N-M)+1) % 2 == 0:
            return 'Positive'
        else:
            return 'Negative'
            
    return 0

print(solve())

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

if N > 0:
    print('Positive')
elif N <= 0 =< M:
    print('Zero')
elif M < 0:
    if N-M % 2:
        print('Negative')
    else:
        print('Positive')
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().strip())
print(c,a,b)
Problem p02787 (python)

Fixed submission:
H,N = map(int, input().strip().split())
M = [list(map(int, input().strip().split())) for _ in range(N)]

tb = [float('inf')]*(H+1)
tb[0] = 0
for a,b in M:
  for i in range(1,min(H+1,a+1)):
    tb[i] = min(tb[i], b)
  for i in range(H+1-a):
    tb[i+a] = min(tb[i+a], tb[i]+b)
  #print(tb)

print(tb[-1])

Buggy submission (verdict: Runtime Error):
H,N = map(int, input().strip().split())
M = [list(map(int, input().strip().split())) for _ in range(N)]

tb = [float('inf')]*(H+1)
tb[0] = 0
for a,b in M:
  for i in range(1,a+1):
    tb[i] = min(tb[i], b)
  for i in range(H+1-a):
    tb[i+a] = min(tb[i+a], tb[i]+b)
  #print(tb)

print(tb[-1])
Problem p02885 (python)

Fixed submission:
A,B = map(int, input().strip().split(' '))
print(max(0, A-(2*B)))

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().strip())
print(max(0, A-(2*B)))
Problem p02900 (python)

Fixed submission:
import fractions

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

# 素因数分解
def trial_division(n):
  result = []
  while n % 2 == 0:
    result.append(2)
    n //= 2
  f = 3
  while f*f <= n:
    if n % f == 0:
      result.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
    result.append(n)
  return result

gcd_ = fractions.gcd(A,B)
if gcd_ == 1:
  print(1)
else:
  print(len(set(trial_division(gcd_)))+1)

Buggy submission (verdict: Runtime Error):
import fractions

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

def make_primeset(n):
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]

  
gcd_ = fractions.gcd(A,B)
if gcd_ == 1:
  print(1)
else:
  ans = 1  # 1のぶん
   # 素因数の種類数+1
  for p in make_primeset(gcd_):
    if gcd_ % p == 0:
      ans += 1
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)

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

def gcd(a,b):
  if a < b: a,b = b,a
  if a % b == 0:
    return b
  else:
    return gcd(b, a%b)

def make_primeset(n):
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]

  
gcd_ = gcd(A,B)
if gcd_ == 1:
  print(1)
else:
  ans = 1  # 1のぶん
   # 素因数の種類数+1
  for p in make_primeset(gcd_):
    if gcd_ % p == 0:
      ans += 1
  print(ans)

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

def gcd(a,b):
  if a < b: a,b = b,a
  if a % b == 0:
    return b
  else:
    return gcd(b, a%b)

def make_primeset(n):
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]

  
gcd_ = gcd(A,B)
if gcd_ == 1:
  print(1)
else:
  ans = 1  # 1のぶん
   # 素因数の種類数+1
  for p in make_primeset(gcd_):
    if gcd_ % p == 0:
      ans += 1
  print(ans)
Problem p02939 (python)

Fixed submission:
S = input().strip()

prev = ''
now = ''
result = 0
for c in S:
  if len(prev) == 0:
    prev = c
    result += 1
    continue
  now += c
  if prev == now:
    continue
  else:
    prev = now
    now = ''
    result += 1
print(result)

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

def check(l):
  for i in range(len(l)-1):
    if l[i] == l[i+1]:
      return False
  return True

# 一番最後だけ分割する
def hoge(l):
  next_stack = []
  for i in range(1, len(l[-1])):
    next_list = l[:-1] + [l[-1][:i], l[-1][i:]]
    if check(next_list):
      next_stack.append(next_list)
  return next_stack
      
stack = [[S]]
max_len = 1
while True:
  if len(stack) == 0:
    break
  now = stack.pop(0)
  if len(now)+len(now[-1])-2 < max_len:
    continue
  #print('----------')
  #print(now)
  #print(hoge(now))
  max_len = max(max_len, len(now))
  stack += hoge(now)
  
print(max_len)

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

def check(l):
  for i in range(len(l)-1):
    if l[i] == l[i+1]:
      return False
  return True

# 一番最後だけ分割する
def hoge(l):
  next_stack = []
  for i in range(1, len(l[-1])):
    next_list = l[:-1] + [l[-1][:i], l[-1][i:]]
    if check(next_list):
      next_stack.append(next_list)
  return next_stack
      
stack = [[S]]
max_len = 1
while True:
  if len(stack) == 0:
    break
  now = stack.pop(0)
  if len(now)+len(now[-1])-2 <= max_len:
    continue
  #print('----------')
  #print(now)
  #print(hoge(now))
  max_len = max(max_len, len(now))
  stack += hoge(now)
  
print(max_len)
Problem p02963 (python)

Fixed submission:
s = int(input().strip())
m = int(1e9)
if s % m == 0:
  x = 0
  y = s//m
else:
  x = m-(s%m)
  y = (s//m)+1
print(0,0,1000000000,1,x,y)

Buggy submission (verdict: Runtime Error):
S = int(input().strip())
m = int(1e9)
print(0,0,1000000000,1,m-(s%m),(s//m)+1)
Problem p03059 (python)

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

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

# 約数列挙
def divisor(n):
  result = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      result.append(i)
      if i != n // i:
        result.append(n//i)
  return result

# A(intのlist)のうちdで割り切れるものがlen(A)-1個以上あればTrue
def check(A, d):
  count = 0
  for a in A:
    if a % d == 0:
      continue
    count += 1
    if count > 1:
      return False
  return True

for i in sorted(list(set(divisor(A[0])+divisor(A[1]))))[::-1]:
  if check(A, i):
    print(i)
    exit()
Problem p03074 (python)

Fixed submission:
N,K = map(int, input().strip().split(' '))
S = input().strip()
l,r,now_max,now_zeros = 0,0,1,0
for r in range(1,N):
  if S[r-1] == '0':
    if S[r] == '0':
      continue
    else:
      now_zeros += 1
  else:
    if S[r] == '0':
      if now_zeros < K:
        continue
      else:
        now_max = max(r-l, now_max)
        now_zeros -= 1
        for _ in range(l,r):
          l += 1
          if S[l-1:l+1] == '01':
            break
    else:
      continue
now_max = max(r-l+1, now_max)
print(now_max)

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().strip().split(' '))
S = input().strip()

# 奇数番目は1のカタマリの人数　偶数番目は0のカタマリの人数 両端は必ず1のカタマリの人数
now_state, now_count = '1', 0
L = []
for i in range(len(S)):
  if S[i] == now_state:
    now_count += 1
  else:
    L.append(now_count)
    # reset
    now_count = 1
    now_state = '1' if now_state == '0' else '0'
L.append(now_count)
if now_state == '0':
  L.append(0)

#print(L)
# 0の塊をj個ひっくり返す
# j==1のとき101の3個の和の最大
# j==2のとき10101の5個の和の最大
# j==jのとき101...1のj*2+1個の和の最大

def ngram(n, _list):
  return [_list[i:i+n] for i in range(len(_list)-n+1)]

now_max = 0
j = min((len(L)-1)/2, K)
tmp = ngram(j*2+1, L)
# 偶数番目だけ
tmp = [sum(tmp[i]) for i in range(len(tmp)) if i%2 == 0]
tmp = max(tmp) if len(tmp) > 0 else 0
now_max = max(tmp, now_max)
print(now_max)
Problem p03076 (python)

Fixed submission:
import sys

dishes = [int(line.strip()) for line in sys.stdin]
min1 = 10
for d in dishes:
  if 0 < d%10 < min1:
    min1 = d%10
if min1 == 0:
  min1 = 10
dishes = [((d+9)//10)*10 for d in dishes]
print(sum(dishes)-(10-min1))

Buggy submission (verdict: Runtime Error):
import sys

dishes = [int(line.strip()) for line in sys.stdin]
min1 = None
for d in dishes:
  if 0 < d%10 < min1:
    min1 = d%10
if not min1:
  min1 = 0
    
dishes = [((d+9)//10)*10 for d in dishes]
print(sum(dishes)-(10-min1))
Problem p03095 (python)

Fixed submission:
from collections import Counter
input()
S = input().strip()
c = Counter(S)
ans = 1
for k,v in c.items():
  ans *= (v+1)
print((ans-1)%(10**9+7))

Buggy submission (verdict: Runtime Error):
N = input()
S = input().strip()
type = len(set(S))

def DP(i,s):
  # 葉チェック
  if i >= len(S):
    return 1 if len(s) > 0 else 0
  if len(s) >= type:
    return 1
  
  # S[i]を採用しない枝
  notadopt = DP(i+1, s)
  
  # S[i]を採用する枝
  if S[i] not in s:
    s += S[i]
    adopt = DP(i+1, s)
  else:
    adopt = 0

  return adopt + notadopt

print(DP(0, '')%(10**9+7))

Buggy submission (verdict: Runtime Error):
input()
S = input().strip()
type = len(set(list(S)))

def DP(i,s):
  me = 1 if len(s) > 0 else 0
  # 葉
  if len(S) <= i:
    return me
  if len(s) >= type:
    return 1
  
  # S[i]を採用しない
  notadopt = DP(i+1, s)
  
  # S[i]を採用する
  if S[i] not in s:
    s += S[i]
    adopt = DP(i+1, s)
  else:
    adopt = 0

  return adopt + notadopt

print(DP(0, '')%(10**9+7))

Buggy submission (verdict: Runtime Error):
input()
S = input().strip()
color = len(set(list(S)))

def DP(i,s):
  me = 1 if len(s) > 0 else 0
  # 葉
  if len(S) <= i:
    return me
  
  # S[i]を採用しない
  notadopt = DP(i+1, s)
  
  # S[i]を採用する
  if S[i] not in s:
    s += S[i]
    adopt = DP(i+1, s)
  else:
    adopt = 0

  return adopt + notadopt

print(DP(0, '')%(10**9+7))
Problem p03193 (python)

Fixed submission:
import sys
lines = [list(map(int, line.strip().split(' '))) for line in sys.stdin]
print(sum([1 for h,w in lines[1:] if lines[0][1] <= h and lines[0][2] <= w]))

Buggy submission (verdict: Runtime Error):
import sys
lines = [map(int, line.strip().split(' ')) for line in sys.sydin]
print(sum([1 for h,w in lines[1:] if lines[1] <= h and lines[2] <= w]))
Problem p03282 (python)

Fixed submission:
S = input().strip()
K = int(input().strip())
for i in range(K):
  if S[i] == '1':
    continue
  else:
    print(S[i])
    exit()
print(S[K-1])

Buggy submission (verdict: Runtime Error):
S = input().strip()
K = int(input().strip())
for i in range(K):
  if S[i] == '1':
    continue
  else:
    print(S[i])
    exit()
print(S[K])
Problem p03316 (python)

Fixed submission:
N = input().strip()
print('Yes' if int(N) % sum(map(int, N)) == 0 else 'No')

Buggy submission (verdict: Runtime Error):
N = input().strip()
print('Yes' if N % sum(map(int, N)) == 0 else 'No')
Problem p03323 (python)

Fixed submission:
a,b = map(int, input().strip().split(' '))
print('Yay!' if max(a,b) <= 8 else ':(')

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().strip().split(' '))
print('Yay!' max(a,b) <= 8 else ':(')
Problem p03324 (python)

Fixed submission:
D,N = map(int, input().strip().split(' '))
if N == 100:
  print((N+1)*(100**D))
else:
  print(N*(100**D))

Buggy submission (verdict: Runtime Error):
D,N = map(input().strip().split(' '))
print(N*(100**D))
Problem p03360 (python)

Fixed submission:
A,B,C = map(int, input().strip().split(' '))
K = int(input().strip())

print(A+B+C+max(A,B,C)*((2**K)-1))

Buggy submission (verdict: Runtime Error):
A,B,C = map(int, input().strip().split(' '))
K = int(input().strip())

print(sum(A,B,C)+max(A,B,C)*((2**K)-1))