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

Fixed submission:
N, M = map(int, input().split())
a = [int(input())for i in range(M)]
MOD = 10 ** 9 + 7
ans = []
dp = [1] * (N + 1)

for i in a:
    dp[i] = 0

for i in range(2, N + 1):
    if dp[i] != 0:
        dp[i] = (dp[i - 1] + dp[i - 2])

print(dp[N] % MOD)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input())for i in range(M)]
MOD = 10 ** 9 + 7
ans = []
dp = [1] * N

dp[0] = 1 if 1 not in a else 0
dp[1] = (dp[0] + 1) if 2 not in a else 0
for i in range(2, N):
    if (i + 1) in a:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2])

print(dp[N-1] % MOD)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input())for i in range(M)]
MOD = 10 ** 9 + 7
dp = [0] * (N + 1)

dp[0] = 0
dp[1] = 1 if 1 not in a else 0
dp[2] = 1 if 2 not in a else 0
for i in range(3, N + 1):
    if i in a:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]

print(dp[N] % MOD)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input())for i in range(M)]
a.sort()
pattern = []
ans = 1

# フィボナッチ数列の関数
def fibonacci(n):
    f = ((1 + 5**0.5) / 2)**n / 5**0.5 + 0.5
    return int(f)

# 段の切れ目ごとの場合の数を算出
R = len(a) - 1
for i in range(R):
    x = a[i + 1] - a[i] -1
    pattern.append(fibonacci(x))

# 段の切れ目ごとの場合の数の積
for i in range(len(pattern)):
    ans = ans * pattern[i] % 1000000007

# 1段目まで、最終弾までの数
s1 = fibonacci(a[0])
s2 = fibonacci(N - a[-1])

# かける
ans = ans * s1 * s2 % 1000000007

# 2弾続けて壊れている場合はNG
for i in range(M - 1):
    if a[i] + 1 == a[i + 1]:
        ans = 0

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input())for i in range(M)]
a.sort()
pattern = []
ans = 1

# フィボナッチ数列の関数
def fibonacci(n):
    a, b = 0, 1
    for i in range(n):
        a, b = b, a + b
    return b

# 段の切れ目ごとの場合の数を算出
R = len(a) - 1
for i in range(R):
    x = a[i + 1] - a[i] -1
    pattern.append(fibonacci(x))

# 段の切れ目ごとの場合の数の積
for i in range(len(pattern)):
    ans = ans * pattern[i] % 1000000007

# 1段目まで、最終弾までの数
s1 = fibonacci(a[0])
s2 = fibonacci(N - a[-1])

# かける
ans = ans * s1 * s2 % 1000000007

# 2弾続けて壊れている場合はNG
for i in range(M - 1):
    if a[i] + 1 == a[i + 1]:
        ans = 0

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input())for i in range(M)]
a.sort()
pattern = []
ans = 1

# フィボナッチ数列の関数
def fibonacci(n):
    f = ((1 + 5**0.5) / 2)**n / 5**0.5 + 0.5
    return int(f)

# 段の切れ目ごとの場合の数を算出
R = len(a) - 1
for i in range(R):
    x = a[i + 1] - a[i] -1
    pattern.append(fibonacci(x))

# 段の切れ目ごとの場合の数の積
for i in range(len(pattern)):
    ans = ans * pattern[i] % 1000000007

# 1段目まで、最終弾までの数
s1 = fibonacci(a[0])
s2 = fibonacci(N - a[-1])

# かける
ans = ans * s1 * s2 % 1000000007

# 2弾続けて壊れている場合はNG
for i in range(M - 1):
    if a[i] + 1 == a[i + 1]:
        ans = 0

print(ans)
Problem p03041 (python)

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

for i in range(N):
	if i == (K - 1):
			S[i] = S[i].lower()

print(''.join(S))

Buggy submission (verdict: Runtime Error):
S = input()
S1 = S[:1]
S2 = S[2:]
month = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

if S1 in month and S2 in month:
	print('AMBIGUOUS')
elif S1 in month:
	print('MMYY')
elif S2 in month:
	print('YYMM')
elif S1 == '00': 
	print('YYMM')
elif: S2 == '00':
	print('MMYY')
else:
	print('NA')

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

for i in range(N-1):
	if i == 0:
		if i == (K - 1):
			ans = S[i].lower() + S[1:]
	else:
		if i == (K - 1):
			ans = S[:(i-1)] + S[i].lower() + S[(i+1):]		

print(S)
Problem p03042 (python)

Fixed submission:
S = input()
S1 = int(S[:2])
S2 = int(S[2:])

if (1 <= S1 <= 12) and (1 <= S2 <= 12):
	print('AMBIGUOUS')
elif (1 <= S1 <= 12):
	print('MMYY')
elif (1 <= S2 <= 12):
	print('YYMM')
else:
	print('NA')

Buggy submission (verdict: Runtime Error):
S = input()
S1 = S[:1]
S2 = S[2:]
month = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

if S1 in month and S2 in month:
	print('AMBIGUOUS')
elif S1 in month:
	print('MMYY')
elif S2 in month:
	print('YYMM')
elif S1 == '00': 
	print('YYMM')
elif: S2 == '00':
	print('MMYY')
else:
	print('NA')

Buggy submission (verdict: Runtime Error):
S = input()
S1 = S[:1]
S2 = S[2:]
month = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

if S1 in month and S2 in month:
	print('AMBIGUOUS')
elif S1 in month:
	print('MMYY')
elif S2 in month:
	print('YYMM')
elif S1 == '00': 
	print('MMYY')
elif: S2 == '00':
	print('YYMM')
else:
	print('NA')
Problem p02701 (python)

Fixed submission:
N = int(input())
l = []
for i in range(N):
    x = input()
    l.append(x)
s = set(l)
t = list(s)
print(len(t))

Buggy submission (verdict: Runtime Error):
N = int(input())
l = []
for i in range(N):
  x = input()
  l.append(x)
s = len(list(set(l))
print(s)
Problem p02546 (python)

Fixed submission:
S = input()
if S[-1] == 's':
    print(S+'es')
else:
    print(S+'s')

Buggy submission (verdict: Runtime Error):
#!/usr/local/bin/python3

N, X, M = map(int, input().split())

def f(x, m):
    return x**2 % m

check = [False for _ in range(M)]
d = [X]
max_x = 0
for _ in range(1, N+1):
    X = f(X, M)
    if check[X]:
        break
    else:
        check[X] = True
    d.append(X)

idx = d.index(X)
ans = sum(d[:idx])
N -= idx
d = d[idx:]

sumd = sum(d)
ans += N//len(d) * sumd

ans += sum(d[:N%len(d)])

print(ans)
Problem p03775 (python)

Fixed submission:
import math
N = int(input())


def digit(N):
    d = 0
    while N >= 1:
        N /= 10
        d += 1
    return d


f = []
for i in range(1, int(math.sqrt(N))+1):
    if N % i == 0:
        d1 = digit(i)
        d2 = digit(int(N/i))
        f.append(max(d1, d2))

print(min(f))

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


def digit(N):
    d = 0
    while N >= 1:
        N /= 10
        d += 1
    return d


f = []
for i in range(1, N):
    if i * i > N:
        break
    if N % i == 0:
        d1 = digit(i)
        d2 = digit(int(N/i))
        f.append(max(d1, d2))

print(min(f))
Problem p02729 (python)

Fixed submission:
import math
def j(n):
    return math.factorial(n) // (2*math.factorial(n-2))
n,m = map(int,raw_input().split())
if (n == 1 and m == 1)or(n == 0 and m == 0): 
    print 0
elif n == 1 or n == 0:
    print j(m)
elif m == 1 or m == 0:
    print j(n)
else:
    print j(n)+j(m)

Buggy submission (verdict: Runtime Error):
import math
def j(n):
    return math.factorial(n) // (2*math.factorial(n-2))
n,m = map(int,raw_input().split())
if n == 1 and m == 1: 
    print 0
else:
    print j(n)+j(m)
Problem p02571 (python)

Fixed submission:
S = input()
T = input()
ev = []
for i in range(len(S) - len(T) + 1):
  commit = 0
  for j in range(len(T)):
    if S[i + j] == T[j]:
      commit += 1
  ev.append(commit)

ev.sort(reverse=True)
print(len(T) - ev[0])

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
ev = [0] * (len(S) - len(T))
for i in range(len(S) - len(T)):
  commit = 0
  for j in range(len(T)):
    if S[i + j] == T[j]:
      commit += 1
  ev[i] = commit

ev.sort(reverse=True)
print(len(T) - ev[0])

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
ev = [0] * (len(S) - len(T))
for i in range(len(S) - len(T)):
  commit = 0
  for j in range(len(T)):
    if S[i + j] == T[j]:
      commit += 1
  ev[i] = commit

greatest = max(ev)
print(len(T) - greatest)
Problem p02659 (python)

Fixed submission:
a,b = input().split()
intA = int(a)
intB = int(b.replace(".",""))
print(intA*intB // 100)

Buggy submission (verdict: Runtime Error):
import math
a,b = map(float, input().split())
print(math.floor((a*(b*100)/100)

Buggy submission (verdict: Runtime Error):
import math
a,b = map(float, input().split())
print(math.floor((a*(b*100))/100)
Problem p02693 (python)

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

for i in range(A,B+1):
  if i % K == 0:
    flag = 1

if flag == 1:
  print("OK")
else:
  print("NG")

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

for i in range(A,B+1):
  if i % K == 0:
    isComplete = True
    break

if isComplete:
  print("OK")
else:
  print("NG")
Problem p02933 (python)

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

Buggy submission (verdict: Runtime Error):
a=input()
if a>=3200
	print("red")
else:
	b=input()
    print(b)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
if a>=3200:
	print(b)
else:
  print("red")
Problem p02552 (python)

Fixed submission:
# 整数の入力
a = int(input())

if a == 0:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))
 
# 整数の入力
N = int(input())
r = 2

print(combinations_count(N, r))
Problem p02549 (python)

Fixed submission:
MOD = 998244353

N, K = map(int, input().split())
seg = [tuple(map(int, input().split())) for _ in range(K)]
dp = [0] * (N+1)
dp[0] = 1
for i in range(N):
    for s, t in seg:
        if (i+s) <= N:dp[i+s] += dp[i]
        if (i+t+1) <= N:dp[i+t+1] -= dp[i]
    dp[0] = 0
    dp[i+1] += dp[i]
    dp[i+1] %= MOD
    
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
MOD = 998244353

N, K = map(int, input().split())
seg = [tuple(map(int, input().split())) for _ in range(K)]
dp = [0] * (N+1)
dp[0] = 1
for i in range(N):
    for s, t in seg:
        dp[i+s] += dp[i]
        dp[i+t;1] -= dp[i]
    dp[i+1] += dp[i]
    dp[i+1] %= MOD
    
print(dp[N-1])
Problem p02695 (python)

Fixed submission:
import itertools
N, M, Q = map(int, input().split())
l = []
for _ in range(Q):
    l.append(tuple(map(int, input().split())))
    
c = list(itertools.combinations_with_replacement(list(range(1, M+1)), N))

m = 0
for i in c:
    flag = True
    sum = 0
    for j in l:
        if i[j[1]-1] - i[j[0]-1] == j[2]:
            sum += j[3]
    m = max(m, sum)
        
print(m)

Buggy submission (verdict: Runtime Error):
import itertools
N, M, Q = map(int, input().split())
l = []
for _ in range(Q):
    l.append(tuple(map(int, input().split())))
    
c = itertools.combinations_with_replacement(list(range(1, M+1)), N)

m = 0
for i in c:
    flag = True
    sum = 0
    for j in l:
        if c[i[1]-1] - c[i[0]-1] == i[2]:
            sum += i[3]
    m = max(m, sum)
        
print(m)
Problem p02699 (python)

Fixed submission:
s, w = map(int, input().split())

if s <= w:
  print('unsafe')
else:
  print('safe')

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

l = [int(s[-1])]
d = 10
for i in range(len(s)-2, -1, -1):
  l.append((l[-1] + int(s[i])*d) % 2019)
  d *= 10
  d %= 2019
c = collections.Counter(l)
ans = 0  
for i in c.values():
  ans += i*(i-1)//2

ans += c[0]

print(ans)

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

if s =< w:
  print('unsafe')
else:
  print('safe')
Problem p02712 (python)

Fixed submission:
n = int(input())
sum = 0

for i in range(1, n+1):
  if i % 3 != 0 and i % 5 != 0:
    sum += i

print(sum)

Buggy submission (verdict: Runtime Error):
n = input()
sum = 0

for i in range(1, n+1):
  if i % 3 != 0 and i % 5 != 0:
    sum += i

print(sum)
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())

for i in range(3):
  if i+1 != a and i+1 != b:
    print(i+1)

Buggy submission (verdict: Runtime Error):
s = [1, 2, 3]
a = int(input())
b = int(input())

_ = s.pop(a-1)
_ = s.pop(b-1)

print(s[0])

Buggy submission (verdict: Runtime Error):
s = [1, 2, 3]
a = int(input())
b = int(input())

_ = s.pop(a)
_ = s.pop(b)

print(s[0])
Problem p03986 (python)

Fixed submission:
X = input()

s, t = 0, len(X)//2
cnt = 0
used = 0
for x in X:
    if x == 'S':
        s += 1
        if t-used > 0:
            cnt += 1
            used += 1
    else:
        used = max(0, used-1)
        t -= 1

print(len(X)-cnt*2)

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

idx = 0

while idx < len(X):
    print(idx, X)
    if X[idx] == 'S':
        if idx+1 < len(X) and X[idx+1] == 'T':
            X = X[:idx] + X[idx+2:]
            idx = max(-1, idx-2)
    idx += 1

print(len(X))
Problem p02833 (python)

Fixed submission:
from math import log2
N = int(input())
ans = 0
if(N % 2 == 0 and N != 0):
  for i in range(int(log2(N))):
    ans += (N // 5 ** (i+1)) // 2
  print(ans)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
from math import log2
N = int(input())
ans = 0
for i in range(int(log2(N))):
  ans += (N // 5 ** (i+1)) // 2
if(N % 2 == 0):
  print(ans)
else:
  print(0)
Problem p02881 (python)

Fixed submission:
N = int(input())
for i in range(int(N ** 0.5),0,-1):
  if(N % i == 0):
    print(i - 1 + N // i - 1)
    break

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(int(N ** 0.5),0,-1):
  if(N % i == 0):
    print(i - 1 + N // i - 1): 
    break
Problem p02912 (python)

Fixed submission:
import heapq
N, M = list(map(int,input().split()))
h = []
for x in input().split():
  heapq.heappush(h, -int(x))
for i in range(M):
  x = -heapq.heappop(h)
  x //= 2
  heapq.heappush(h,-x)
print(-sum(h))

Buggy submission (verdict: Runtime Error):
import heapq
N, M = list(map(int,input()))
h = []
for x in input().split():
  heappush(h, x)
print(heappop(h))
print(heappop(h))
Problem p02623 (python)

Fixed submission:
from bisect import bisect_right
from time import time

N, M, K = [int(x) for x in input().split()]

a_book = [0]
for index, i in enumerate(input().split(), 1):
    if a_book[index-1] + int(i) <= K:
        a_book.append(a_book[index-1] + int(i))
    else:
        N = index - 1
        break

b_book = [0]
for index, i in enumerate(input().split(), 1):
    if b_book[index-1] + int(i) <= K:
        b_book.append(b_book[index-1] + int(i))
    else:
        M = index - 1
        break

check = {}

max_books = 0

for i, a in enumerate(a_book):
    b_pos = bisect_right(b_book, K - a)

    if max_books < b_pos - 1 + i:
        max_books = b_pos - 1 + i

print(max_books)

Buggy submission (verdict: Runtime Error):
from collections import deque
from sys import exit

N, M, K = [int(x) for x in input().split()]

a_book = [0]
for index, i in enumerate(input().split(), 1):
    if a_book[index-1] + int(i) <= K:
        a_book.append(a_book[index-1] + int(i))
    else:
        break

b_book = [0]
for index, i in enumerate(input().split(), 1):
    if b_book[index-1] + int(i) <= K:
        b_book.append(b_book[index-1] + int(i))
    else:
        break

search = deque()
check = {}


def search_count(v):
    search.appendleft(v)
    while search:
        v = search.popleft()

        if not v in check:
            check[v] = v[0] + v[1]

            if not (v[0] + 1, v[1]) in check:
                if v[0] + 1 <= N:
                    if a_book[v[0] + 1] + b_book[v[1]] <= K:
                        search.appendleft((v[0] + 1, v[1]))

            if not (v[0], v[1] + 1) in check:
                if v[1] + 1 <= M:
                    if a_book[v[0]] + b_book[v[1] + 1] <= K:
                        search.appendleft((v[0], v[1] + 1))


search_count((0, 0))

print(max(check.values()))

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

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


def read_book(read_time, book_count, a_remain, b_remain):

    if a_remain:
        a = a_remain[0]
    else:
        a = 10**9

    if b_remain:
        b = b_remain[0]
    else:
        b = 10*9

    a_count = book_count
    b_count = book_count

    if read_time + a < K:
        a_count = read_book(read_time + a, book_count +
                            1, a_remain[1:], b_remain)

    if read_time + b < K:
        b_count = read_book(read_time + b, book_count +
                            1, a_remain, b_remain[1:])

    if a_count > b_count:
        return a_count

    return b_count


count = read_book(0, 0, A_BOOK, B_BOOK)

print(count)
Problem p02725 (python)

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

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

r_list = []

for i in range(N):
    if i == N - 1:
        r_list.append(A[0] + K - A[i])

    else:
        r_list.append(A[i + 1] - A[i])

r_list.sort()

print(sum(r_list[:-1]))

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

result = []

for i in range(N):
    if i == N - 1:
        result.append(K - A[i] + A[0])
    else:
        result.appnd(A[i + 1] - A[i])

result.sort()

print(sum(result[:-1]))
Problem p02820 (python)

Fixed submission:
N, K = [int(x) for x in input().split()]
r, s, p = [int(x) for x in input().split()]

win_point = {
    'r': r,
    's': s,
    'p': p,
}

next_hands = {
    'r': ['s', 'p'],
    's': ['r', 'p'],
    'p': ['r', 's'],
}

enemy_hands = input()


def can_win(enemy_hand, my_hands):
    # 勝てる場合にはTrueと勝てる手を教えてくれる
    if enemy_hand == 'r' and 'p' in my_hands:
        return True, 'p'
    if enemy_hand == 's' and 'r' in my_hands:
        return True, 'r'
    if enemy_hand == 'p' and 's' in my_hands:
        return True, 's'

    # 勝てる手がない場合
    return False, None


point = 0

for index in range(K):
    now_hands = ['r', 'p', 's']
    for i in range(index, N, K):
        win, hand = can_win(enemy_hands[i], now_hands)

        if win:
            point += win_point[hand]
            now_hands = next_hands[hand]
        else:
            # 勝てない場合次似邪魔しない手を選ぶ
            # 勝てない回の次は必ず勝てるため全手出せる前提とする
            now_hands = ['r', 'p', 's']

print(point)

Buggy submission (verdict: Runtime Error):
from collections import deque

N, K = [int(x) for x in input().split()]
r, s, p = [int(x) for x in input().split()]

win_point = {
    'r': r,
    's': s,
    'p': p,
}

next_hands = {
    'r': ['s', 'p'],
    's': ['r', 'p'],
    'p': ['r', 's'],
}

enemy_hands = input()


def can_win(enemy_hand, my_hands):
    # 勝てる場合にはTrueと勝てる手を教えてくれる
    if enemy_hand == 'r' and 'p' in my_hands:
        return True, 'p'
    if enemy_hand == 's' and 'r' in my_hands:
        return True, 'r'
    if enemy_hand == 'p' and 's' in my_hands:
        return True, 's'

    # 勝てる手がない場合
    return False, None


def choose_hand(enemy_hand, next_enemy_hand, now_hands):
    # 次の手に勝てるようにその手以外を選択する
    if next_enemy_hand == enemy_hand:
        # 次回も同じ手ならどっちでも良い
        return now_hands[0]

    win, hand = can_win(next_enemy_hand, enemy_hand)

    # 次の手と今の相手の手を戦わせる
    # 後の手が勝ったら今の手と同じものを出す
    # 今の手が勝ったら後の手と同じものと出す
    if win:
        return now_hands[enemy_hand]
    else:
        return now_hands[next_enemy_hand]


point = 0

for index in range(K):
    target = index
    now_hands = ['r', 'p', 's']
    for i in range(index, N, K):
        win, hand = can_win(enemy_hands[i], now_hands)

        if win:
            point += win_point[hand]
            now_hands = next_hands[hand]
        else:
            if i + K < N:
                next_enemy_hand = enemy_hands[i+K]
                now_hands = next_hands[choose_hand(
                    enemy_hands[i], next_enemy_hand, now_hands)]

print(point)
Problem p02598 (python)

Fixed submission:

n,k=map(int,input().split())
a=list(map(int,input().split()))
if k==0:
    print(max(a))
    exit()
a.sort()
left,right=0,a[n-1]
mid=right
while abs(right-left)>2:
    mid=(left+right)//2
    temp=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: left=mid
    else: right=mid
mid-=1
if mid<=0: mid=1
while True:
    temp=0
    flag=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: mid+=1
    else:
        flag=1
        break
    if flag: break
print(mid)

Buggy submission (verdict: Runtime Error):

n,k=map(int,input().split())
a=list(map(int,input().split()))
if k==0:
    print(max(a))
    exit()
a.sort()
left,right=0,a[n-1]
mid=right
while abs(right-left)>2:
    mid=(left+right)//2
    temp=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: left=mid
    else: right=mid
mid-=1
while True:
    temp=0
    flag=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: mid+=1
    else:
        flag=1
        break
    if flag: break
print(mid)

Buggy submission (verdict: Runtime Error):
from math import ceil
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k==0:
    print(max(a))
    exit()
a.sort()
left,right=0,a[n-1]
mid=right
while abs(right-left)>2:
    mid=(left+right)/2
    temp=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: left=mid
    else: right=mid
mid=int(mid)-1
while True:
    temp=0
    flag=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: mid+=1
    else:
        flag=1
        break
    if flag: break
print(mid)
Problem p02629 (python)

Fixed submission:
A="abcdefghijklmnopqrstuvwxyz"
n=int(input())
i=1
while n-26**i>0:
    n-=26**i
    i+=1
name=[]
n-=1
for j in range(i):
    temp=n%26
    name.append(A[temp])
    n//=26
for k in name[::-1]: print(k,end="")

Buggy submission (verdict: Runtime Error):
A="abcdefghijklmnopqrstuvwxyz"
n=int(input())-1
name=[]
while n>0:
    temp=n%26
    name.append(temp)
    n//=26
length=len(name)
for i in range(length-1):
    print(A[name[length-i-1]-1],end="")
print(A[name[0]])
Problem p02771 (python)

Fixed submission:
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
    if i==2:
        print("Yes")
        exit()
print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
	if i==2:
		print("Yes")
        exit()
print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
	if i==2:
		print("Yes")
    	exit()
print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
	if i==2:
      print("Yes")
	  exit()
print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
	if i==2:
	    print("Yes")
        exit()
print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
	if i==2:
	    print("Yes")
        exit()
print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values()
	if i==2:
	    print("Yes")
      	exit()
print("No")
Problem p02773 (python)

Fixed submission:
from collections import defaultdict
dic=defaultdict(int)
n=int(input())
for _ in range(n): dic[input()]+=1
lis=sorted(dic.items(),key=lambda x:x[1],reverse=True)
M=lis[0][1]
ans=[]
for i in range(len(lis)):
    if lis[i][1]==M: ans.append(lis[i][0])
    else: break
ans.sort()
for i in ans: print(i)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
dic=defaultdict(int)
n=int(input())
for _ in range(n): dic[input()]+=1
lis=sorted(dic.items(),key=lambda x:x[1],reverse=True)
M=lis[0][1]
ans=[]
for i in range(n):
    if lis[i][1]==M: ans.append(lis[i][0])
    else: break
ans.sort()
for i in ans: print(i)
Problem p02779 (python)

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
dic=Counter(a)
for val in dic.values():
    if val>=2:
        print("NO")
        exit()
print("YES")

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split())
dic=Counter(a)
for val in dic.values():
    if val>=2:
        print("NO")
        exit()
print("YES")
Problem p02790 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=input()
A=int(a*b)
B=int(b*a)
print(min(A,B))