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

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if b-a > k:
  print(':(')
  exit()
elif c-a > k:
  print(':(')
  exit()
elif d-a > k:
  print(':(')
  exit()
elif e-a > k:
  print(':(')
  exit()
else:
  print('Yay!')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if b-a > k:
  print(':(')
  exit()
else
  print('Yay!')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if b-a > k:
  print(':(')
  exit()
elif c-a > k:
  print(':(')
  exit()
elif d-a > k:
  print(':(')
  exit()
elif e-a > k:
  print(':(')
  exit()
else
  print('Yay!')
  exit()
Problem p03135 (python)

Fixed submission:
t,x = map(int, input().split())
print(float(t)/float(x))

Buggy submission (verdict: Runtime Error):
t,x = map(int, input().split)
print(float(t)/float(x))

Buggy submission (verdict: Runtime Error):
t,x = map(float, input().split)
print(t/x)
Problem p03315 (python)

Fixed submission:
s = input()
pu = s.count('+')
mi = s.count('-')
print(pu-mi)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(str, input().split())
s = 0
if a == '+':
  s = s + 1
else:
  s = s - 1

if b == '+':
  s = s + 1
else:
  s = s - 1

if c == '+':
  s = s + 1
else:
  s = s - 1

if d == '+':
  s = s + 1
else:
  s = s - 1

print(s)
Problem p03834 (python)

Fixed submission:
a=input()
b = a.replace(',',' ')
print(b)

Buggy submission (verdict: Runtime Error):
a,b,c = map(str, input().split())
d = ' '
print(a+d+b+d+c)
Problem p02880 (python)

Fixed submission:
n = int(input())
flag = False
for i in range(2, 10):
  flag = flag or (n/i == n//i and n//i <= 9)    
print ("Yes" if n <= 9 or (flag and n <= 81) else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
flag = False
for i in range(2, 10):
  flag = flag or (n/i = n//i and n//i <= 9)    
print ("Yes" if n <= 9 or (flag and n <= 81) else "No")
Problem p03013 (python)

Fixed submission:
n, m = list(map(int, input().split()))
if m > 0:
  a = set([int(input()) for i in range(m)])
else:
  a = set([])

if n == 1:
  pat = 1
else:
  pt = [1]
  if (1 in a):
    pt.append(0)
  else:
    pt.append(1)

  for i in range(2, n + 1):
    if (i in a):
      pt.append(0)
    else:
      if (i-1 in a):
        pt.append(pt[i-2])
      else:
        pt.append(pt[i-1] + pt[i-2])

  pat = (pt[-1] % 1000000007)
print(pat)

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
if m > 0:
  a = set([int(input()) for i in range(m)])
else:
  a = set([])

if n == 1:
  pat = 1
else:
  pt = [1]
  if (1 in a):
    pt.append(0)
  else:
    pt.append(1)

  for i in range(2, n + 1):
    if (i in a):
      pt.append(0)
    else:
      if (i-1 in a):
        pt.append(pt[i-2])
      else:
        pt.append(pt[i-1] + pt[i-2])

pat = (pt[-1] % 1000000007)
print(pat)

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
if m > 0:
  a = [int(input()) for i in range(m)]
else:
  a = []

if n == 1:
  pat = 1
else:
  pt = [1]
  if (1 in a):
    pt.append(0)
  else:
    pt.append(1)

  for i in range(2, n + 1):
    if (i in a):
      pt.append(0)
    else:
      if (i-1 in a):
        pt.append(pt[i-2])
      else:
        pt.append(pt[i-1] + pt[i-2])

pat = (pt[-1] % 1000000007)
print(pat)

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
if m > 0:
  a = [int(input()) for i in range(m)]
else:
  a = []

if n = 1:
  pat = 1
else:
  pt = [1]
  if (1 in a):
    pt.append(0)
  else:
    pt.append(1)

  for i in range(2, n + 1):
    if (i in a):
      pt.append(0)
    else:
      if (i-1 in a):
        pt.append(pt[i-2])
      else:
        pt.append(pt[i-1] + pt[i-2])

pat = (pt[-1] % 1000000007)
print(pat)

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
if m > 0:
  a = [int(input()) for i in range(m)]
else:
  a = []

pt = [1]
if a[0] == 1:
  pt.append(0)
else:
  pt.append(1)

for i in range(2, n+1):
  if (i in a):
    pt.append(0)
  else:
    if (i-1 in a):
      pt.append(pt[i-2])
    else:
      pt.append(pt[i-1] + pt[i-2])

pat = (pt[-1] % 1000000007)
print(pat)
Problem p03075 (python)

Fixed submission:
t = [int(input()) for i in range(6)]
print ("Yay!" if t[4]-t[0] <= t[5] else ":(")

Buggy submission (verdict: Runtime Error):
import heapq
import itertools

def dif(l):
  return max(l) - min(l)

x,y,z,k = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

flag = True
while flag:
  fa = False
  while (x-1)*y*z > k and dif(a) > dif(b) and dif(a) > dif(c):
    a.pop()
    x -= 1
    fa = True

  fb = False
  while x*(y-1)*z > k and dif(b) > dif(a) and dif(b) > dif(c):
    b.pop()
    y -= 1
    fb = True

  fc = False
  while x*y*(z-1) > k and dif(c) > dif(b) and dif(c) > dif(a):
    c.pop()
    z -= 1
    fc = True
  
  flag = fa or fb or fc

l=[]
for a1 in a:
    for b1 in b:
        for c1 in c:
            l.append(a1+b1+c1)

m2 = heapq.nlargest(k, l)
for i in range(k):
  print(m2[i])
Problem p02815 (python)

Fixed submission:
N = int(input())
C = list(map(int, input().split()))
C.sort(reverse = True)
#print(C)
sosu = 10 ** 9 + 7
K = dict()
K[-1] = 1
K[0] = 1
for i in range(1, N+1):
    a = K[i-1] * 2 % sosu
    K[i] = a
ans = 0
for i in range(N):
    #for j in range(1,circle):##j番目に大きい
    #    kkk = c(i, j-1) * 2 ** (N-i-1)###i+1番目に大きいものがj番目に大きくなるような選び方
    #    ans += C[i] * kake * j * kkk
    ans += (C[i] * K[N] * (K[i] + i * K[i-1]) * K[N-i-1]) % sosu
    ans %= sosu
print(int(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
C = list(map(int, input().split()))
C.sort(reverse = True)
#print(C)
sosu = 10 ** 9 + 7
K = [1 for i in range(N+1)]
for i in range(1, N+1):
    a = K[i-1] * 2 % sosu
    K[i] = a
ans = 0
for i in range(N):
    #for j in range(1,circle):##j番目に大きい
    #    kkk = c(i, j-1) * 2 ** (N-i-1)###i+1番目に大きいものがj番目に大きくなるような選び方
    #    ans += C[i] * kake * j * kkk
    ans += C[i] * K[N] * (2 ** i + i * 2 ** (i-1)) * K[N-i-1]
    ans %= sosu
print(int(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
C = list(map(int, input().split()))
C.sort(reverse = True)
#print(C)
sosu = 10 ** 9 + 7
kake = (2 ** N) % sosu
ans = 0
for i in range(N):
    #for j in range(1,circle):##j番目に大きい
    #    kkk = c(i, j-1) * 2 ** (N-i-1)###i+1番目に大きいものがj番目に大きくなるような選び方
    #    ans += C[i] * kake * j * kkk
    ans += C[i] * kake * (2 ** i + i * 2 ** (i-1)) * 2 ** (N-i-1)
    ans %= sosu
print(int(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
C = list(map(int, input().split()))
C.sort(reverse = True)
#print(C)
sosu = 10 ** 9 + 7
kake = 2 ** N
ans = 0
for i in range(N):
    #for j in range(1,circle):##j番目に大きい
    #    kkk = c(i, j-1) * 2 ** (N-i-1)###i+1番目に大きいものがj番目に大きくなるような選び方
    #    ans += C[i] * kake * j * kkk
    ans += C[i] * kake * (2 ** i + i * 2 ** (i-1)) * 2 ** (N-i-1)
    ans %= sosu
print(int(ans))
Problem p02990 (python)

Fixed submission:
import math
sosu = 10 ** 9 + 7
N, K = map(int, input().split())
#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

def conv(n, r):
    bunbo = math.factorial(n) % sosu
    bunsi1 = mod_inv(math.factorial(r), sosu)
    bunsi2 = mod_inv(math.factorial(n-r), sosu)
    ans = bunbo * bunsi1 * bunsi2 % sosu
    return(ans)
#print(conv(1997,2))

for i in range(1, K+1):
    if N-K+1 >= i:
        fir = conv(K-1, i-1)
        sec = conv(N-K+1, i)
        ans = fir * sec % sosu
        print(int(ans))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
import math
sosu = 10 ** 9 + 7
N, K = map(int, input().split())
def conv(n, r):
    ans = math.factorial(n) / (math.factorial(r) * math.factorial(n-r)) % sosu
    return(ans)

for i in range(1, K+1):
    if N-K+1 >= i:
        fir = conv(K-1, i-1)
        #print(fir)
        sec = conv(N-K+1, i)
        #print(sec)
        ans = fir * sec % sosu
        print(int(ans))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
import math
sosu = 10 ** 9 + 7
N, K = map(int, input().split())
def conv(n, r):
    ans = math.factorial(n) / (math.factorial(r) * math.factorial(n-r)) % sosu
    return(ans)

for i in range(1, K+1):
    fir = conv(K-1, i-1)
    #print(fir)
    sec = conv(N-K+1, i)
    #print(sec)
    ans = fir * sec % sosu
    print(int(ans))
Problem p03107 (python)

Fixed submission:
S = input()
zero = S.count('0')
one = S.count('1')
print(min(zero, one) * 2)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
dp = [0 for i in range(N)]
last = ['' for i in range(N)]
last[0] = S[0]
for i in range(1, N):
    if last[i-1][-1] != S[i]:
        dp[i] = dp[i-1] + 1
        if i >= 2:
            last[i] = last[i-2]
    else:
        dp[i] = dp[i-1]
        last[i] = last[i-1] + S[i]
print(dp[N-1]*2)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
dp = [0 for i in range(N)]
last = [False for i in range(N)]
last[0] = S[0]
for i in range(1, N):
    if last[i-1][-1] != S[i]:
        dp[i] = dp[i-1] + 1
        if i >= 2:
            last[i] = last[i-2]
    else:
        dp[i] = dp[i-1]
        last[i] = last[i-1] + S[i]
print(dp[N-1]*2)
Problem p03745 (python)

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

sign = 0
c = 0
for i in range(1,len(A)):
    dif = A[i] - A[i-1]
    if dif * sign < 0:
        c += 1
        sign = 0
        continue
    if dif != 0:
        sign = dif
print(c+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, L, T = map(int, input().split())
X = []
W = []
ant = [i for i in range(N)]
for i in range(N):
    xi, wi = map(int, input().split())
    X.append(xi)
    W.append(wi)

npX = np.array(X).astype(np.float)
npW = np.array(W).astype(np.float)
npW[npW == 2] = -1

def swap(ant, i, j):
    tmp = ant[i]
    ant[i] = ant[j]
    ant[j] = tmp
    return ant

ans = (npX + npW * T) % L

T %= L
if T > L - T:
    T = L - T
    npW *= -1
t = 0
while t < T:
    t += 0.5
    npX = (npX + npW * 0.5) % L
    colision = set([e for e in set(npX) if np.sum(npX == e) == 2])
    if len(colision) != 0:
        for e in colision:
            i, j = np.where(npX == e)[0].tolist()
            swap(ant, i, j)

for i in range(N):
    print(int(ans[ant.index(i)]))
Problem p03774 (python)

Fixed submission:
import numpy as np
N, M = map(int, input().split())
list_coStu = []
list_coChe = []
for i in range(N):
    list_coStu.append(list(map(int, input().split())))
for i in range(M):
    list_coChe.append(list(map(int, input().split())))

#calc distance

for iS in range(len(list_coStu)):
    coStu = np.array(list_coStu[iS])
    min_iC = 0
    d = 4 * 10**8 + 1
    for iC in range(len(list_coChe)):
        coChe = np.array(list_coChe[iC])
        dif = coChe - coStu
        dist = np.sum(np.abs(dif))
        if dist < d:
            min_iC = iC
            d = dist
    print(min_iC + 1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
list_coStu = []
list_coChe = []
for i in range(N):
    list_coStu.append(list(map(int, input().split())))
for i in range(N):
    list_coChe.append(list(map(int, input().split())))

#calc distance

for iS in range(len(list_coStu)):
    coStu = np.array(list_coStu[iS])
    min_iC = 0
    d = 4 * 10**8 + 1
    for iC in range(len(list_coChe)):
        coChe = np.array(list_coChe[iC])
        dif = coChe - coStu
        dist = np.sum(np.abs(dif))
        if dist < d:
            min_iC = iC
            d = dist
    print(min_iC + 1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
list_coStu = []
list_coChe = []
for i in range(N):
    list_coStu.append(list(map(int, input().split())))
for i in range(N):
    list_coChe.append(list(map(int, input().split())))

#calc distance

for iS in range(len(list_coStu)):
    coStu = np.array(list_coStu[iS])
    min_iC = 0
    d = 2 * 10**8 + 1
    for iC in range(len(list_coChe)):
        coChe = np.array(list_coChe[iC])
        dif = coChe - coStu
        dist = np.sum(np.abs(dif))
        if dist < d:
            min_iC = iC
            d = dist
    print(min_iC + 1)
Problem p03775 (python)

Fixed submission:
N = int(input())

def count_digit(N):
    return(len(str(N)))

ans = count_digit(N)

A = 1
while (A * A <= N):
    if N%A != 0: pass
    else:
        B = N//A
        curDig = max(count_digit(A), count_digit(B))
    ans = min(ans, curDig)
    A += 1
print(ans)

Buggy submission (verdict: Runtime Error):
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

N = int(input())
if N = 1:
    print(1)
else:
    table = prime_decomposition(N)
    digN = len(str(N))
    digMaxEle = len(str(table[-1]))
    if digN / 2  < digMaxEle:
        print(digMaxEle)
    else:
        print(digN//2 + digN%2)

Buggy submission (verdict: Runtime Error):
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

N = int(input())
table = prime_decomposition(N)
digN = len(str(N))
digMaxEle = len(str(table[-1]))
if digN / 2  < digMaxEle:
    print(digMaxEle)
else:
    print(digN//2 + digN%2)
Problem p03073 (python)

Fixed submission:
char_list = list(input())
count1 = 0
count2 = 0
if len(char_list) == 1:
    print(0)
else:
    for i in range(len(char_list)):
        if i % 2 == 0:
            if char_list[i] is "0":
                continue
            else:
                count1 += 1
        else:
            if char_list[i] is "1":
                continue
            else:
                count1 += 1
    for i in range(len(char_list)):
        if i % 2 == 0:
            if char_list[i] is "1":
                continue
            else:
                count2 += 1
        else:
            if char_list[i] is "0":
                continue
            else:
                count2 += 1
    print(min(count1,count2))

Buggy submission (verdict: Runtime Error):
char_list = list(input())
count1 = 0
count2 = 0
if len(char_list) == 1:
    print(count)
else:
    for i in range(len(char_list)):
        if i % 2 == 0:
            if char_list[i] is "0":
                continue
            else:
                count1 += 1
        else:
            if char_list[i] is "1":
                continue
            else:
                count1 += 1
    for i in range(len(char_list)):
        if i % 2 == 0:
            if char_list[i] is "1":
                continue
            else:
                count2 += 1
        else:
            if char_list[i] is "0":
                continue
            else:
                count2 += 1
print(min(count1,count2))

Buggy submission (verdict: Runtime Error):
char_list = list(input())
count1 = 0
count2 = 0
if len(char_list) == 1:
    print(count)
else:
    for i in char_list:
        if i % 2 == 0
            if char_list[i] is "0"
                continue
            else:
                count1 += 1
        else:
            if char_list[i] is "1"
                continue
            else:
                count1 += 1
    for i in char_list:
        if i % 2 == 0
            if char_list[i] is "1"
                continue
            else:
                count2 += 1
        else:
            if char_list[i] is "0"
                continue
            else:
                count2 += 1
print(min(count1,count2))
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
MOD = 10 ** 9 + 7
dp = [0] * (N+1)
dp[0] = 1
a = set()
for _ in range(M):
    a.add(int(input()))
if 1 in a:
    if 2 in a:
        print(0)
        exit()
    dp[2] = 1
    start = 3
else:
    dp[1] = 1
    start = 2
for i in range(start, N+1):
    if i in a:
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= MOD
print(dp[N])

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = set()
for i in range(M):
    A.append(int(input()))
count = [0] * (N+1)
count[0] = 1
mod = 10 ** 9 + 7
if 1 in A:
    if 2 in A:
        print(0)
        exit()
    count[2] = 1
    start = 3
else:
    count[1] = 1
    start = 2
for i in range(start, N+1):
    if i in A:
        continue
    count[i] = count[i-1] + count[i-2]
    count[i] %= mod
print(count[N])
Problem p02831 (python)

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

def gcd(A, B):
    x = max(A, B)
    y = min(A, B)
    if x % y == 0:
        return y
    else : 
        while x % y != 0:
            z = x % y
            x = y
            y = z
        
        return y

print(A*B // gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())
print(A*B // math.gcd(A, B))
Problem p02912 (python)

Fixed submission:
import heapq

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
b = []
heapq.heappush(b,0)
for _ in range(m):
    bm = -b[0]
    if len(a) != 0 and a[-1] > bm:
        am = a.pop()
        am = am // 2
        heapq.heappush(b,-am)
    else:
        bm = -heapq.heappop(b)
        bm = bm // 2
        heapq.heappush(b,-bm)
        
    
print(sum(a)-sum(b))

Buggy submission (verdict: Runtime Error):
import bisect

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
b = [0]
for _ in range(m):
    if a[-1] > b[-1]:
        am = a.pop()
        am = am // 2
        bisect.insort_left(b, am)
    else:
        bm = b.pop()
        bm = bm // 2
        bisect.insort_left(b, bm)
        
    
print(sum(a)+sum(b))
Problem p03104 (python)

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

a2 = True
b2 = False
if a % 2 != 0:
    a0 = a
    a += 1
    a2 = False
if b % 2 == 0:
    b0 = b
    b -= 1
    b2 = True

c = b-(a-1)
if c % 2 == 0:
    if (c // 2) % 2 == 0:
        ans = 0
    else:
        ans = 1 
elif ((c-1) // 2) % 2 == 0:
    ans = 0 ^ b
else:
    ans = 1 ^ b
    
if a2 == False:
    ans = ans ^ a0
if b2 == True:
    ans = ans ^ b0

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
a, b = list(map(int, input().split()))

n = int(np.ceil(np.log2(b)))+1
c = [0]*n
for i in range(n):
    ra = (a-1) % (2**(i+1))
    if ra < 2**i:
        ra1 = 0
    else:
        ra1 = 1
    rb = b % (2**(i+1))
    if rb < 2**i:
        rb1 = 0
    else:
        rb1 = 1    
    if ra1 == rb1:
        c[n-(i+1)] = '0'
    else:
        c[n-(i+1)] = '1'

s = ''.join(c)
ans = int(s, 2)
print(ans)
Problem p03253 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 22:00:37 2018
ABC110D
@author: maezawa
"""
import collections

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    return comb(n, r-1)*(n-r+1)//r

n, m = list(map(int, input().split()))

mod = 10**9+7
np = int(10**4.5 + 10)
is_prime = [True]*(np+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, np//2):
    if is_prime[i] == True:
        for j in range(2*i,np+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(np+1) if is_prime[i]]

pds = []
for i in prime_numbers:
    if i > m//2:
        break
    md = m
    while md%i == 0:
        pds.append(i)
        md = md//i
mul = 1
for i in pds:
    mul *= i
if m != mul:
    pds.append(m//mul)

#print(pds)
cpds = collections.Counter(pds)
#print(cpds)
ans = 1
for i in cpds.values():
    ans = ans*comb(n+i-1,i)%mod

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 22:00:37 2018
ABC110D
@author: maezawa
"""
import collections

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    return comb(n, r-1)*(n-r+1)//r

n, m = list(map(int, input().split()))

mod = 10**9+7
np = int(10**4.5 + 10)
is_prime = [True]*(np+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, np//2):
    if is_prime[i] == True:
        for j in range(2*i,np+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(np+1) if is_prime[i]]

pds = []
for i in prime_numbers:
    if i > m//2:
        break
    md = m
    while md%i == 0:
        pds.append(i)
        md = md//i
    if md > np:
        pds.append(md)
if pds == []:
    pds.append(m)

#print(pds)
cpds = collections.Counter(pds)
#print(cpds)
ans = 1
for i in cpds.values():
    ans = ans*comb(n+i-1,i)%mod

print(ans)
Problem p03329 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 10 21:28:22 2018

@author: maezawa
"""

n = int(input())

c = [1, 6, 36, 216, 1296, 7776, 46656,
     9, 81, 729, 6561, 59049]
m = len(c)

dp = [float('inf') for _ in range(n+1)]
dp[0] = 0
#print(n,m)
#print(c)
#print(*dp, sep='\n')

for j in range(1,n+1):
    temp = []
    for i in range(m):
        if j < c[i]:
            continue
        else:
            temp.append(dp[j-c[i]]+1)
    dp[j] = min(temp)

print(dp[n])

Buggy submission (verdict: Runtime Error):
n = int(input())
coins = []
for i in range(7):
    if 6**i <= 10**5:
        coins.append(6**i)
    if 9**i <= 10**5:
        coins.append(9**i)
dp = [10**5]*(n+1)

def f(i):
    if i==0:
        return 0
    if dp[i] != 10**5:
        return dp[i]
    candidates = [f(i-coin)+1 for coin in coins if i-coin >= 0]
    dp[i] = min(candidates)
    return dp[i]

print(f(n))
Problem p03345 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun May 20 20:55:50 2018
AGC024A
@author: maezawa
"""

a, b, c, k = list(map(int, input().split()))
if a-b > 10**18 or b-a > 10**18:
    print('Unfair')
elif k%2 == 0:
    print(a-b)
else:
    print(b-a)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun May 20 20:55:50 2018
AGC024B
@author: maezawa
"""

n = int(input())
q = [None for _ in range(n)]
for i in range(n):
    p = int(input())
    q[p-1] = i+1

max_cnt = 0
cnt = 1
qpre = q[0]
 
for i in range(1,n):
    if q[i] > qpre:
        cnt += 1
    else:
        if max_cnt < cnt:
            max_cnt = cnt
        cnt = 1
    qpre = q[i]
if max_cnt < cnt:
    max_cnt = cnt

print(n-max_cnt)
Problem p02835 (python)

Fixed submission:
N,M,K = map(int,input().split())
ans = 'win'
if N+M+K >= 22:
  ans = 'bust'
print(ans)

Buggy submission (verdict: Runtime Error):
N,M,K = int(input())
ans = 'win'
if N+M+K >= 22:
  ans = 'bust'
print(ans)
Problem p02819 (python)

Fixed submission:
import math
x = int(input())
if (x <= 2):
    print(2)
    exit()
ans = 100003
if (x%2 == 0):
    x += 1
for num in range(x, 10**5, 2):
    flag = True
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if(num % i == 0):
            flag = False
            break
    if(flag):
        ans = num
        break
print(ans)

Buggy submission (verdict: Runtime Error):
prime_list = [2]
for num in range(3,10**5,2):
    if all(num % prime != 0 for prime in prime_list):
        prime_list.append(num)
        if (num >= x):
            print(num)
            exit()
print(100003)
Problem p02835 (python)

Fixed submission:
a,b,c = map(int, input().split())
if a+b+c >= 22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
if(sum(a) > 21)
  print('bust')
else
  print('win')
Problem p02836 (python)

Fixed submission:
s = input()

res = 0
for i in range(len(s)//2):
  if(s[i] != s[-i-1]):
    res += 1

print(res)

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

res = 0
for i in range(len(s)//2):
  if(s[i] != s[-i-1])
    res++

print(res)