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

Fixed submission:
a = int(input())
s = input()
print(s if a >= 3200 else "red")

Buggy submission (verdict: Runtime Error):
a, s = input().split()
print(s if int(a) >= 3200 else "red")
Problem p02970 (python)

Fixed submission:
import math
n, d = map(int, input().split())
print(math.ceil(n / (2 * d + 1)))

Buggy submission (verdict: Runtime Error):
import math
n, d = map(int, input().split())
print(math.ceil(n / (2d + 1)))
Problem p03631 (python)

Fixed submission:
a = input()
print("Yes" if a == a[::-1] else "No")

Buggy submission (verdict: Runtime Error):
a = input()
print("Yes" if a == a.reverse() else "No")
Problem p02847 (python)

Fixed submission:
S = input()

d = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1}
print(d[S])

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

    d = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1}
    print(d[S])
Problem p02990 (python)

Fixed submission:
def ExtGCD(a, b):
    if b == 0:
        return a, 1, 0
    else:
        d, x, y = ExtGCD(b, a % b)
        x -= (a // b) * y
        return d, y, x
def ModInv(a, mod):
    return ExtGCD(a, mod)[1] % mod
def ModComb(n, k, mod):
    if n < k or n < 0 or k < 0:
        return 0
    elif n == 0 or k == 0:
        return 1
    q, a = 1, 1
    for i in range(n-k+1, n+1):
        q = (q * i) % mod
    for i in range(2, k+1):
        a = (a * i) % mod
    return int(q * ModInv(a, mod) % mod)
def main():
    n,k=map(int,input().split())
    mod=10**9+7
    for i in range(1,k+1):
        print(ModComb(n-k+1,i,mod)*ModComb(k-1,i-1,mod)%mod)
        # 最後のに%modつけるの忘れてた。。。。。。
main()

Buggy submission (verdict: Runtime Error):
from math import factorial
def comb(n,k):
    return factorial(n)//factorial(k)//factorial(n-k)
def main():
    n,k=map(int,input().split())
    mod=10**9+7
    for i in range(1,k+1):
        print(comb(n-k+1,i)*comb(k-1,i-1)%mod)
main()
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
#TLEの対策1. a in listと比べて a in setはめちゃんこ速い!!
a=set([int(input()) for _ in range(m)])

#TLEの対策2.配列ではなく変数を使う(対策1と比べると対して効果なし).
p,q=0,1

for i in range(1,n+1):
    #最新のp,q以前の値は捨てて良い.つまり配列を使用する必要なし.
    p,q=q,(p+q)%(10**9+7)*(not i in a) #n*Trueは1, n*Falseは0を表す.
print(q)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(int(input()) for _ in range(m))
dp=[0]*(n+1)
dp[0]=1
if a[0]==1:
    dp[1]=0
else:
    dp[1]=1
for i in range(2,n+1):
    if i in a:
        dp[i]=0
    else:
        dp[i]=dp[i-1]+dp[i-2]
        dp[i] %= 1000000007
print(dp[n]%1000000007)
Problem p03042 (python)

Fixed submission:
s=input()
c=0
if 0<int(s[0])*10+int(s[1])<13:c+=1
if 0<int(s[2])*10+int(s[3])<13:c+=2
print("AMBIGUOUS" if c==3 else "YYMM" if c==2 else "MMYY" if c==1 else "NA")

Buggy submission (verdict: Runtime Error):
s=int(input())
x=a%100
y=a//100
print(("AMBIGUOUS" if 0<x<13 else "MMYY") if 0<y<13 else "YYMM" if 0<x<13 else "NA")
Problem p03265 (python)

Fixed submission:
import numpy as np
a,b,c,d=map(int,input().split())
n=np.array([c-a,d-b])
p=np.array([-n[1],n[0]])
print(*([c,d]+p), end=" ") #print(*([c,d]+p),*([a,b]+p))がPython3.4.3には対応してない？
print(*([a,b]+p))

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b,c,d=map(int,input().split())
n=np.array([c-a,d-b])
p=np.array([-n[1],n[0]])
print(*([c,d]+p),*([a,b]+p))
Problem p02707 (python)

Fixed submission:
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)

for i in range(n-1):
  print(c[i+1])

print("0")

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)

for i in range(n):
  print(c[a[i]])
Problem p03013 (python)

Fixed submission:
n, m = list(map(int,input().split()))
a = []
for i in range(m):
  a.append(int(input()))
c = [0] * (n+2) #combination
for i in a:
  c[i] = -1
c[0] = 1

for i in range(n):
    if c[i] < 0:
      continue
    if c[i+1] >= 0:
        c[i+1] = c[i] + c[i+1]
    if c[i+2] >= 0:
        c[i+2] = c[i] + c[i+2]
    c[i] = c[i] % 10**9+7
print(c[n]%(10**9+7))

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

n, m = map(int, input().split())
a = []
for i in range(m):
  a.append(int(input()))
  
@lru_cache(maxsize=100000)
def comb(n):
  if n in a:
    return 0
  elif n in (0, 1):
    return 1
  else:
    return (comb(n-1) + comb(n-2))%(10**9 + 7)

print(comb(n)%(10**9 + 7))

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

n, m = map(int, input().split())
a = []
for i in range(m):
  a.append(int(input()))
  
@lru_cache(maxsize=100000)
def comb(n):
  if n in a:
    return 0
  elif n in (0, 1):
    return 1
  else:
    return (comb(n-1) + comb(n-2))

print(comb(n)%(10**9 + 7))

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

n, m = map(int, input().split())
a = []
for i in range(m):
  a.append(int(input()))
  
@lru_cache(maxsize=100000)
def comb(n):
  if n in a:
    return 0
  if 1 not in a and n == 1:
    return 0
  elif n in (0, 1):
    return 1
  else:
    return (comb(n-1) + comb(n-2))

print(comb(n)%(10**9 + 7))

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

n, m = map(int, input().split())
a = []
for i in range(m):
  a.append(int(input()))
  
@lru_cache(maxsize=100000)
def comb(n):
  for i in a:
    if n == i:
      return 0
  if a.count(1) == 0 and n == 1:
    return 1
  elif a.count(1) != 0 and n == 1:
    return 0
  elif n == 0:
    return 1
  else:
    return (comb(n-1) + comb(n-2))

print(comb(n)%(10**9 + 7))
Problem p02570 (python)

Fixed submission:
##A - Don't be late
D,T,S = map(int,input().split())
if D / S <= T:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
d,t,s　=　map(int,input.split())

if t <= d/s:
  print("Yes")
else:
  print("No")
Problem p02659 (python)

Fixed submission:
##C
A,B = map(str,input().split())
A = int(A)
B = int(B.replace('.',''))
print((A*B)//100)

Buggy submission (verdict: Runtime Error):
##C
A,B = map(float,input().split())
A = int(A)
B = int(B.replace('.',''))
print((A*B)//100)

Buggy submission (verdict: Runtime Error):
##C
A,B = map(float,input().split())
A = int(A)
B = B.replace('.','')
print((A*B)//100)
Problem p02773 (python)

Fixed submission:
N = int(input())
S = list(input() for i in range(N))

import collections

c = collections.Counter(S)
max = max(c.values())
 
max_k_list = [kv[0] for kv in c.items() if kv[1] == max]
max_k_list.sort()
for l in max_k_list:
    print(l)

Buggy submission (verdict: Runtime Error):
##C
N = int(input())
S = list(input() for i in range(N))

import collections

c = collections.Counter(S)
ans = 0
for j in range(N):
    if c.most_common()[0][1] == c.most_common()[j][1]:
        ans += 1
    else:
        break
ansl = list()
for k in range(ans):
    ansl.append((c.most_common()[k][0]))
ansl.sort()
for l in ansl:
    print(l)
Problem p02793 (python)

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

import fractions

##def lcm_base(x, y):
##    return (x * y) // fractions.gcd(x, y)

##def lcm_list(numbers):
##    return reduce(lcm_base, numbers, 1)

ans = A[0]
for i in range(1, N):
    ans = ans * A[i] // fractions.gcd(ans, A[i])

b = 0

for i in A:
##    b += lcm_list(A)/i
    b += ans//i
print(int(b)%(10**9+7))

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

from fractions import gcd

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

b = 0

for i in A:
    b += lcm_list(A)/i
print(int(b)%(10**9+7))

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

from fractions import gcd

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

b = 0

for i in A:
    b += lcm_list(A)/i
print(int(b)%(10**9+7))

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

import math

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

b = 0

for i in A:
    b += lcm_list(A)/i
print(int(b)%(10**9+7))

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

import fractions

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

b = 0

for i in A:
    b += lcm_list(A)/i
print(int(b)%(10**9+7))

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

import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

b = 0

for i in A:
    b += lcm_list(A)/i
print(int(b)%(10**9+7))
Problem p02819 (python)

Fixed submission:
s = int(input())
if s <= 2:
  print(2)
  exit()
elif s <= 3:
  print(3)
  exit()
elif s <= 5:
  print(5)
  exit()

while True:
  for i in range(2,s // 2):
    if s % i == 0:
      break
  if i == s //2 -1:
    print(s)
    exit()
  s += 1

Buggy submission (verdict: Runtime Error):
##C
X = input()

from sympy import nextprime
from sympy import isprime
if isprime(X):
    print(X)
else:
    print(nextprime(X))

Buggy submission (verdict: Runtime Error):
##C
X = input()

from sympy import nextprime
from sympy import isprime
if isprime(X):
    print(X)
else:
    print(nextprime(X))

Buggy submission (verdict: Runtime Error):
##C
X = input()

from sympy import nextprime
print(nextprime(X))
Problem p02831 (python)

Fixed submission:
##C
a,b = map(int,input().split())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

aa = (prime_factorize(a))
bb = (prime_factorize(b))

def f(a1, b1):
  result = []
  for i in sorted(set(a1 + b1)):
    aa1 = [x for x in a1 if x == i]
    bb1 = [x for x in b1 if x == i]
    result += aa1 if len(aa1) < len(bb1) else bb1
  return result

from operator import mul
from functools import reduce

aabb1 = f(aa,bb)

if aabb1 == []:
    aabb1 = [1,1]

aabb = reduce(mul,aabb1)

print(int(a*b/aabb))

Buggy submission (verdict: Runtime Error):
##C
a,b = map(int,input().split())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

aa = (prime_factorize(a))
bb = (prime_factorize(b))

def f(a1, b1):
  result = []
  for i in sorted(set(a1 + b1)):
    aa1 = [x for x in a1 if x == i]
    bb1 = [x for x in b1 if x == i]
    result += aa1 if len(aa1) < len(bb1) else bb1
  return result

from operator import mul
from functools import reduce

aabb = reduce(mul,f(aa,bb))

print(int(a*b/aabb))
Problem p02880 (python)

Fixed submission:
n = int(input())
a = 0
for i in range(9):
    for j in range(9):
        if n == (i+1)*(j+1):
            a += 1
if a == 0:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = 0
for i in range(9):
    for j in range(9):
        if n == i*j:
            ans += 1
if ans >=1:
    print("Yes")
else:
    print("No")
Problem p02577 (python)

Fixed submission:
N = input()
ans = []

for i in range(len(N)):
    ans.append(N[i])


ys = map((lambda x: int(x)), ans)
Sans = sum(ys)

if Sans % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
nn = str(N)
n = len(nn)
ans = []

for i in range(n):
    waru = N % 10
    N = int(N / 10)  
    ans.append(waru)


Sans = sum(ans)       
if Sans % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
nn = str(N)
n = len(nn)
ans = []

for i in range(n):
    waru = N % 10
    N = int(N / 10)  
    ans.append(waru)

print(ans)

Sans = sum(ans)       
if Sans % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
nn = str(N)
n = len(nn)
ans = []

for i in range(n):
    waru = N % 10
    N = int(N / 10)  
    ans.append(waru)
       
if sum(ans) % 9 == 0:
    print("Yes")
else:
    print("No")
Problem p02578 (python)

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

for i in range(N-1):
    if A[i] > A[i+1]:
        youso = A[i] - A[i+1]
        A[i+1] += youso
        ans.append(youso)
    else:
        pass

print(sum(ans))

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

for i in range(N-1):
    if A[i] > A[i+1]:
        youso = A[i] - A[i+1]
        A[i+1] += youso
        ans.append(youso)
        print(ans)
    else:
        pass

print(sum(ans))
Problem p02682 (python)

Fixed submission:
A,B,C,K = list(map(int,input().split()))
ans = 0

if A > K:
    ans += K * 1
else:
    ans += A * 1

if K - A - B >= 0:
    ans += (K - A - B) * (-1)
else:
    ans += 0
    
print(ans)

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

a = K - A #Aのカードを引いた後のB,Cの数
b = K - A - B #Bのカードで水増しした後のCの数

if A = 0:
    print((-1)*b)
elif A > 0:
    if b >= 0:
        print(A - b)
    elif b < 0:
        print(A)
Problem p02759 (python)

Fixed submission:
N = int(input())

if N % 2 == 1:
    print(int(N/2 +1))
else:
    print(int(N/2))

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

if N % 2 == 1:
    print(N/2 + 1)
else:
    print(N/2)
Problem p02596 (python)

Fixed submission:
k=int(input())
k*=9
if k%7==0:
    k//=7
if k%2==0 or k%5==0:
    print(-1)
else:
    i=1
    s=10
    while s%k!=1:
        s=s*10%k
        i+=1
    print(i)

Buggy submission (verdict: Runtime Error):
k=int(input())
#k*=9
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
if k%7==0:
    k//=7
if k%2==0 or k%5==0:
    print(-1)
else:
    i=1
    s=10
    while s%k!=1:
        s=s*10%k
        i+=1
print(i)

Buggy submission (verdict: Runtime Error):
k=int(input())
#k*=9
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
if k%7==0:
    k//=7
if k%2==0 or k%5==0:
    print(-1)
else:
    for j in make_divisors(k-1):
        s=1
        for p in range(j):
            s=s*10%k
        if s==1:
            break
    print(j)
Problem p02699 (python)

Fixed submission:
a=list(map(int,input().split()))
if a[1]>=a[0]:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
X=input()
a=list()
for i in range(len(X)):
    a.append(int(X[i:len(X)])%2019)
S=a.count(0)
for j in range(1,2018):
    b=a.count(j)
    S+=int(b*(b-1)/2)
print(S)

Buggy submission (verdict: Runtime Error):
S=int(input())
W=int(input())
if W>=S:
    print('unsafe')
else:
    print('safe')
Problem p03326 (python)

Fixed submission:
n,m=map(int,input().split())
X=list()
Y=list()
Z=list()
for i in range(n):
    x,y,z=map(int,input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)
A=list()
B=list()
C=list()
D=list()
for i in range(n):
    A.append(X[i]+Y[i]+Z[i])
    B.append(-X[i]+Y[i]+Z[i])
    C.append(X[i]-Y[i]+Z[i])
    D.append(X[i]+Y[i]-Z[i])
import functools
A.sort()
B.sort()
C.sort()
D.sort()
if m==0:
    print(0)
else:
    x1=functools.reduce(lambda x,y:x+y,[A[i] for i in range(m)])
    x2=functools.reduce(lambda x,y:x+y,[A[-i] for i in range(1,m+1)])
    y1=functools.reduce(lambda x,y:x+y,[B[i] for i in range(m)])
    y2=functools.reduce(lambda x,y:x+y,[B[-i] for i in range(1,m+1)])
    z1=functools.reduce(lambda x,y:x+y,[C[i] for i in range(m)])
    z2=functools.reduce(lambda x,y:x+y,[C[-i] for i in range(1,m+1)])
    w1=functools.reduce(lambda x,y:x+y,[D[i] for i in range(m)])
    w2=functools.reduce(lambda x,y:x+y,[D[-i] for i in range(1,m+1)])
    print(max(abs(x1),abs(x2),abs(y1),abs(y2),abs(z1),abs(z2),abs(w1),abs(w2)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
X=list()
Y=list()
Z=list()
for i in range(n):
    x,y,z=map(int,input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)
A=list()
B=list()
C=list()
D=list()
for i in range(n):
    A.append(X[i]+Y[i]+Z[i])
    B.append(-X[i]+Y[i]+Z[i])
    C.append(X[i]-Y[i]+Z[i])
    D.append(X[i]+Y[i]-Z[i])
import functools
A.sort()
B.sort()
C.sort()
D.sort()
x1=functools.reduce(lambda x,y:x+y,[A[i] for i in range(m)])
x2=functools.reduce(lambda x,y:x+y,[A[-i] for i in range(1,m+1)])
y1=functools.reduce(lambda x,y:x+y,[B[i] for i in range(m)])
y2=functools.reduce(lambda x,y:x+y,[B[-i] for i in range(1,m+1)])
z1=functools.reduce(lambda x,y:x+y,[C[i] for i in range(m)])
z2=functools.reduce(lambda x,y:x+y,[C[-i] for i in range(1,m+1)])
w1=functools.reduce(lambda x,y:x+y,[D[i] for i in range(m)])
w2=functools.reduce(lambda x,y:x+y,[D[-i] for i in range(1,m+1)])
print(max(abs(x1),abs(x2),abs(y1),abs(y2),abs(z1),abs(z2),abs(w1),abs(w2)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
X=list()
Y=list()
Z=list()
for i in range(n):
    x,y,z=map(int,input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)
A=[]
B=[]
C=[]
D=[]
for i in range(n):
    A.append(X[i]+Y[i]+Z[i])
    B.append(-X[i]+Y[i]+Z[i])
    C.append(X[i]-Y[i]+Z[i])
    D.append(X[i]+Y[i]-Z[i])
import functools
A.sort()
B.sort()
C.sort()
D.sort()
x1=functools.reduce(lambda x,y:x+y,[A[i] for i in range(m)])
x2=functools.reduce(lambda x,y:x+y,[A[-i] for i in range(1,m+1)])
y1=functools.reduce(lambda x,y:x+y,[B[i] for i in range(m)])
y2=functools.reduce(lambda x,y:x+y,[B[-i] for i in range(1,m+1)])
z1=functools.reduce(lambda x,y:x+y,[C[i] for i in range(m)])
z2=functools.reduce(lambda x,y:x+y,[C[-i] for i in range(1,m+1)])
w1=functools.reduce(lambda x,y:x+y,[D[i] for i in range(m)])
w2=functools.reduce(lambda x,y:x+y,[D[-i] for i in range(1,m+1)])
print(max(abs(x1),abs(x2),abs(y1),abs(y2),abs(z1),abs(z2),abs(w1),abs(w2)))
Problem p02596 (python)

Fixed submission:
k = int(input())
if k % 7 == 0:
    L = 9 * k // 7
else:
    L = 9 * k
out = -1
s = 10
for i in range(L):
    if s % L == 1:
        out = i + 1
        break
    else:
        s = (s % L) * 10
print(out)

Buggy submission (verdict: Runtime Error):
k = int(input())
if k % 7 == 0:
    L = 9 * k / 7
else:
    L = 9 * k
out = -1
s = 10
for i in range(L):
    if s % L == 1:
        out = i + 1
        break
    else:
        s = (s % L) * 10
print(out)
Problem p02597 (python)

Fixed submission:
n = int(input())
c = str(input())

r_m = c.count('R')
w_m = 0
out = max(r_m, w_m)
for i in range(n):
    if c[i] == 'W':
        w_m += 1
    else:
        r_m -= 1
    out = min(out, max(w_m, r_m))
print(out)

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

r_m = c.count('R')
w_m = c.count('W')
wr_m = c.count('WR')

print(min(r_m, w_m) - wr_m //2)
s = 0
if r_m >= w_m:
    for i in range(len(c) - 1):
    if c[i] == 'W' and c[i + 1] == 'R':
        c[i + 1] = 'W'
        s += 1
Problem p02598 (python)

Fixed submission:
n, k = map(int, input().split())
A = list(map(int, input().strip().split()))

b = 0
e = max(A)
L = e // 2
while e - b > 1:
    L = (e + b) // 2
    m = sum(list(map(lambda x: (x - 1) // L, A)))
    if m <= k:
        e = L
    else:
        b = L
print(e)

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

b = 0
e = max(A)
L = e // 2
while e - b >= 1:
    m = sum(list(map(lambda x: x // L, A)))
    if m <= k:
        e = L
        L = (e + b) // 2
    else:
        b = L
        L = (e + b) // 2
print(e)
Problem p02629 (python)

Fixed submission:
n = int(input())

n_c = n - 1
w_dict = {0: "a", 1: "b", 2: "c", 3: "d", 4: "e", 5:"f", 6:"g" , 7:"h", 8:"i", 9:"j", 10:"k"
        , 11:"l", 12:"m", 13:"n", 14:"o" , 15:"p", 16:"q", 17:"r", 18:"s", 19:"t", 20:"u"
        , 21:"v", 22:"w", 23:"x", 24:"y", 25:"z"}
out = ""
while n_c > 25:
    out = out + w_dict[n_c % 26]
    n_c = n_c // 26 - 1

out = out + w_dict[n_c]
print(out[::-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
w_dict = {1:"a", 2: "b", 3:"c", 4:"d", 5:"e", 6:"f", 7:"g" , 8:"h", 9:"i", 10:"j", 11:"k"
        , 12:"l", 13:"m", 14:"n", 15:"o" , 16:"p", 17:"q", 18:"r", 19:"s", 20:"t", 21:"u"
        , 22:"v", 23:"w", 24:"x", 25:"y", 26:"z"}
out = ""
while n > 26:
    out = out + w_dict[n % 26]
    n = n // 26

out = out + w_dict[n]
print(out[::-1])
Problem p02629 (python)

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

n = int(input())

r = ''

def to_moji(x: int):
    if x == 0:
        x = 26
    return chr(96 + x)

def devide(x, moji):
    a = x // 26
    b = x % 26

    if b == 0:
        a -= 1

    if a < 1:
        moji = to_moji(b) + moji
        return moji
    elif 1 <= a and a <= 26:
        moji = to_moji(b) + moji
        moji = to_moji(a) + moji
        return moji
    else:
        moji = to_moji(b) + moji
        return devide(a, moji)

print(devide(n, r))

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

import numpy as np

s = input()

x = np.base_repr(int(s), 26)

strings = {
"0": "a",
"1": "b",
"2": "c",
"3": "d",
"4": "e",
"5": "f",
"6": "g",
"7": "h",
"8": "i",
"9": "j",
"A": "k",
"B": "l",
"C": "m",
"D": "n",
"E": "o",
"F": "p",
"G": "q",
"H": "r",
"I": "s",
"J": "t",
"K": "u",
"L": "v",
"M": "w",
"N": "x",
"O": "y",
"P": "z",
}

strings_2 = {
"1": "a",
"2": "b",
"3": "c",
"4": "d",
"5": "e",
"6": "f",
"7": "g",
"8": "h",
"9": "i",
"A": "j",
"B": "k",
"C": "l",
"D": "m",
"E": "n",
"F": "o",
"G": "p",
"H": "q",
"I": "r",
"J": "s",
"K": "t",
"L": "u",
"M": "v",
"N": "w",
"O": "x",
"P": "y",
"Q": "z"
}

_index = 0
r = ''
for i in list(x):
    if _index == len(list(x)):
        r += strings[i]
    else:
        r += strings_2[i]
    _index += 1

print(r)

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

import numpy as np

s = input()

x = np.base_repr(int(s), 26)

strings = {
"1": "a",
"2": "b",
"3": "c",
"4": "d",
"5": "e",
"6": "f",
"7": "g",
"8": "h",
"9": "i",
"A": "j",
"B": "k",
"C": "l",
"D": "m",
"E": "n",
"F": "o",
"G": "p",
"H": "q",
"I": "r",
"J": "s",
"K": "t",
"L": "u",
"M": "v",
"N": "w",
"O": "x",
"P": "y",
"Q": "z"
}

r = ''
for i in list(x):
    r += strings[i]

print(r)

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

import numpy as np

s = input()

x = np.base_repr(int(s), 26)

strings = {
"1": "a",
"2": "b",
"3": "c",
"4": "d",
"5": "e",
"6": "f",
"7": "g",
"8": "h",
"9": "i",
"A": "j",
"B": "k",
"C": "l",
"D": "m",
"E": "n",
"F": "o",
"G": "p",
"H": "q",
"I": "r",
"J": "s",
"K": "t",
"L": "u",
"M": "v",
"N": "w",
"O": "x",
"P": "y",
"Q": "z"
}

r = ''
for i in list(x):
    r += strings[i]

print(x, r)
Problem p02688 (python)

Fixed submission:
n,k=map(int,input().split())
a=[list(map(int,input().split())) for i in range(k*2)]
ans=[1]*n
for i in range(1,k*2,2):
    for j in a[i]:
        ans[j-1]=0
print(sum(ans))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=[list(map(int,input().split())) for i in range(k*2)]
ans=[1,1,1]
for i in range(1,k*2,2):
    for j in a[i]:
        ans[j-1]=0
print(sum(ans))
Problem p02754 (python)

Fixed submission:
n,a,b=map(int,input().split())
if a==0:
    print(0)
else:
    ans=(min(n%(a+b),a) + (a*(n//(a+b))))
    print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if a==0:
    print(0)
else:
    blue=['b']*a
    red=['r']*b
    s=blue+red
    ans=(s[:n%(a+b)].count('b')) + (a*(n//(a+b)))
    print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if a==0:
    print(0)
else:
    blue=['b']*a
    red=['r']*b
    s=blue+red
    print(s[:n%(a+b)].count('b') + a*(n//(a+b)))