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

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
x=0
for i in range(0,n-1):
  if a[i]+1==a[i+1]:
    x+=c[a[i]-1]
y=sum(b)
print(x+y)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
x=0
for i in range(0,n-1):
  if a[i]=a[i+1]:
    x+=int(c[int(a[i])-1])
y=sum(b)
print(x+y)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
x=0
for i in range(0,n-1):
  if a[i]=a[i+1]:
    x+=c[a[i]-1]
y=sum(b)
print(x+y)
Problem p02959 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt = 0
for i in range(n):
  if a[i] <= b[i]:
    cnt += a[i]
    b[i] -= a[i]
    if b[i] >= a[i+1]:
      cnt += a[i+1]
      a[i+1]=0
    else:
      cnt += b[i]
      a[i+1] -= b[i]
  else:
    cnt += b[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
m=0
t=len(B)
for i in range(t)
if a[i]>=b[i]:
  m+=b[i]
  if a[i]-b[i]>=b[i+1]:
    m+=b[i+1]
    b[i+1]=0
  else:
    m+=a[i]-b[i]
    b[i+1]-=a[i]-b[i]
else:
  m+=a[i]
Problem p03011 (python)

Fixed submission:
'''A - Airplane
https://atcoder.jp/contests/abc129/tasks/abc129_a

>>> main(1, 3, 4)
4
>>> main(3, 2, 3)
5

in5.txt
>>> main(99, 62, 92)
154'''

from itertools import permutations


def main(p, q, r):
    _max = 999

    for p in permutations([p, q, r], 2):
        if _max > sum(p):
            _max = sum(p)

    print(_max)


if __name__ == '__main__':
    p, q, r = map(int, input().split(' '))
    main(p, q, r)

Buggy submission (verdict: Runtime Error):
'''A - Airplane
https://atcoder.jp/contests/abc129/tasks/abc129_a

>>> main(1, 3, 4)
4
>>> main(3, 2, 3)
5
'''

from itertools import permutations


def main(p, q, r):
    _max = 100

    for p in permutations([p, q, r], 2):
        if _max > sum(p):
            _max = sum(p)

    print(_max)


if __name__ == '__main__':
    p, q, r = map(int, input().split(' '))
    main()
Problem p03208 (python)

Fixed submission:
def main(n: int, k: int, h: list):
    h.sort()

    print(min([h[i + k - 1] - h[i] for i in range(n - k + 1)]))


if __name__ == "__main__":
    n, k = map(int, input().split())
    h = [int(input()) for _ in range(n)]

    main(n, k, h)

Buggy submission (verdict: Runtime Error):
def main(n: int, k: int, h: list):
    h.sort()

    print(min([h[i + k - 1] - h[i] for i in range(n - k + 1)]))


if __name__ == "__main__":
    n, k = map(int, input().split())
    h = [input() for _ in range(n)]

    main(n, k, h)
Problem p03272 (python)

Fixed submission:
'''A - Train
https://atcoder.jp/contests/abc107/tasks/abc107_a

>>> main(4, 2)
3
>>> main(1, 1)
1
>>> main(15, 11)
5'''


def main(n, i):
    print(n - i + 1)


if __name__ == '__main__':
    n, i = map(int, input().split(' '))
    main(n, i)

Buggy submission (verdict: Runtime Error):
'''A - Train
https://atcoder.jp/contests/abc107/tasks/abc107_a

>>> main(4, 2)
3
>>> main(1, 1)
1
>>> main(15, 11)
5'''


def main(n, i):
    print(n - i + 1)


if __name__ == '__main__':
    main(map(int, input().split(' ')))
Problem p03617 (python)

Fixed submission:
def main(q: int, h: int, s: int, d: int, n: int):
    print((n // 2) * min(q * 8, h * 4, s * 2, d) + (n % 2) * min(q * 4, h * 2, s))


if __name__ == "__main__":
    q, h, s, d = map(int, input().split())
    n = int(input())

    main(q, h, s, d, n)

Buggy submission (verdict: Runtime Error):
def main(q: int, h: int, s: int, d: int, n: int):
    print((n // 2) * min(q * 8, h * 4, s * 2, d) + (n % 2) * min(q * 4, h * 2, s))


if __name__ == "__main__":
    q, h, s, d = map(int, input().split())
    n = int(input)

    main(q, h, s, d, n)
Problem p03705 (python)

Fixed submission:
def main(n: int, a: int, b: int):
    if a > b:
        print(0)
        return

    if n == 1:
        if a == b:
            print(1)
        else:
            print(0)
        return

    if n == 2:
        if a > b:
            print(0)
        else:
            print(1)
        return

    print((n - 2) * (b - a) + 1)


if __name__ == "__main__":
    n, a, b = map(int, input().split())

    main(n, a, b)

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


def main(n: int, a: int, b: int):

    if a > b:
        print(0)
        return
    elif a == b:
        print(1)
        return

    if n < 3:
        if n == 1:
            print(0)
        elif n == 2:
            print(2)

        return

    ans = 2
    ans += sum(1 for _ in combinations(range(a, b + 1), n - 2))

    print(ans)


if __name__ == "__main__":
    n, a, b = map(int, input().split())

    main(n, a, b)
Problem p03803 (python)

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

def re_define(input_):
    '''強さ順にする'''
    if input_ == 1:
        return 13
    
    return input_ - 1

A = re_define(A)
B = re_define(B)

if A > B:
    print('Alice')
elif A < B:
    print('Bob')
else:
    print('Draw')

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

def re_define(input_):
    '''強さ順にする'''
    if input_ == 1:
        return 13
    
    return input_ - 1

A = re_define(A)
B = re_define(B)

if A > B:
    print('Alice')
elif A < B:
    print('Bob')
else:
    print('Draw')
p
Problem p02594 (python)

Fixed submission:
if int(input())>29:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
if int(input())>29:
  print(Yes)
else:
  print(No)
Problem p02834 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

def dfs_a(N,v,adjlist,cur):
    global depth_a
    depth_a[v]=cur
    for node in adjlist[v]:
        if depth_a[node]<0:
            dfs_a(N,node,adjlist,cur+1)
def dfs_t(N,v,adjlist,cur):
    global depth_t
    depth_t[v]=cur
    for node in adjlist[v]:
        if depth_t[node]<0:
            dfs_t(N,node,adjlist,cur+1)
    
    
    

from collections import deque

N,u,v=map(int,input().split())
adjlist=[[] for _ in range(N)]
for _ in range(N-1):
    a,b=map(int,input().split())
    adjlist[a-1].append(b-1)
    adjlist[b-1].append(a-1)
depth_a=[-1]*N
depth_t=[-1]*N
dfs_a(N,v-1,adjlist,0)
dfs_t(N,u-1,adjlist,0)
M=0
for i in range(N):
    if depth_a[i]>depth_t[i]:
        curm=depth_a[i]-1
        if curm>M:
            M=curm
print(M)

Buggy submission (verdict: Runtime Error):
def dfs_a(N,v,adjlist,cur):
    global depth_a
    depth_a[v]=cur
    for node in adjlist[v]:
        if depth_a[node]<0:
            dfs_a(N,node,adjlist,cur+1)
def dfs_t(N,v,adjlist,cur):
    global depth_t
    depth_t[v]=cur
    for node in adjlist[v]:
        if depth_t[node]<0:
            dfs_t(N,node,adjlist,cur+1)
    
    
    

from collections import deque

N,u,v=map(int,input().split())
adjlist=[[] for _ in range(N)]
for _ in range(N-1):
    a,b=map(int,input().split())
    adjlist[a-1].append(b-1)
    adjlist[b-1].append(a-1)
depth_a=[-1]*N
depth_t=[-1]*N
dfs_a(N,v-1,adjlist,0)
dfs_t(N,u-1,adjlist,0)
M=0
for i in range(N):
    if depth_a[i]>depth_t[i]:
        curm=depth_a[i]-1
        if curm>M:
            M=curm
print(M)
Problem p02990 (python)

Fixed submission:
import sys
sys.setrecursionlimit(2000000)

def comb(n,k):
    if n==k or k==0:
        return 1
    elif lis[n][k]>0:
        return lis[n][k]
    else:
        lis[n][k]=comb(n-1,k)+comb(n-1,k-1)%1000000007
        return lis[n][k]
    
    

def divide(k,i):
    return comb(k-1,i-1)
n,k = map(int,input().split())
lis = [[0]*i for i in range(1,n+1)]

for i in range(1,k+1):
    if i-1 <= n-k:
        print(divide(k,i)*comb(n-k+1,i)%1000000007)
    else:
        print(0)

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

def comb(n,k):
    if n==k or k==0:
        return 1
    elif lis[n][k]>0:
        return lis[n][k]
    else:
        lis[n][k]=comb(n-1,k)+comb(n-1,k-1)%1000000007
        return lis[n][k]
    
    

def divide(k,i):
    return comb(k-1,i-1)
n,k = map(int,input().split())
lis = [[0]*i for i in range(1,n+1)]

for i in range(1,k+1):
    print(divide(k,i)*comb(n-k+1,i)%1000000007)

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

def comb(n,k):
    if n==k or k==0:
        return 1
    elif lis[n][k]>0:
        return lis[n][k]
    else:
        lis[n][k]=comb(n-1,k)+comb(n-1,k-1)%1000000007
        return lis[n][k]
    
    

def divide(k,i):
    return comb(k-1,i-1)
n,k = map(int,input().split())
lis = [[0]*i for i in range(1,n+1)]

for i in range(1,k+1):
    print(divide(k,i)*comb(n-k+1,i)%1000000007)

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

def comb(n,k):
    if n==k or k==0:
        return 1
    elif lis[n][k]>0:
        return lis[n][k]
    else:
        lis[n][k]=comb(n-1,k)+comb(n-1,k-1)%1000000007
        return lis[n][k]
    
    

def divide(k,i):
    return comb(k-1,i-1)
n,k = map(int,input().split())
lis = [[0]*i for i in range(1,n+1)]

for i in range(1,k+1):
    print(divide(k,i)*comb(n-k+1,i)%1000000007)
Problem p03013 (python)

Fixed submission:
import sys
sys.setrecursionlimit(200000)

lis = [1,1,2]
def num(n):
    if len(lis) >= n+1:
        return lis[n]
    else:
        res = num(n-2) + num(n-1)
        lis.append(res)
        return res

N,M = map(int,input().split())
count = 1
pre = 0
for i in range(M+1):
    if i == M:
        cur = N+1
    else:
        cur = int(input())
    number = cur-1-pre
    if number >= 0:
        count = count * num(number) % 1000000007
    else:
        count = 0
        break
    pre = cur + 1
print(count%1000000007)

Buggy submission (verdict: Runtime Error):
lis = [1,1,2]
def num(n):
    if len(lis) >= n+1:
        return lis[n]
    else:
        res = num(n-2) + num(n-1)
        lis.append(res)
        return res

N,M = map(int,input().split())
count = 1
pre = 0
for i in range(M+1):
    if i == M:
        cur = N+1
    else:
        cur = int(input())
    number = cur-1-pre
    if number >= 0:
        count = count * num(number) % 1000000007
    else:
        count = 0
        break
    pre = cur + 1
print(count%1000000007)
Problem p02711 (python)

Fixed submission:
N = input()
judge = "No"
for i in N:
  if i == "7":
    judge = "Yes"
    break
print(judge)

Buggy submission (verdict: Runtime Error):
N = input()
judge = "No"
for i in 3:
  if N[i] == 7:
    judge = "Yes"
    break
print(judge)
Problem p02595 (python)

Fixed submission:
import math

list = input().split(' ')
num = int(list[0])
d = int(list[1])
ans = 0

for i in range(num):
  list2 = input().split(' ')
  x = int(list2[0])
  y = int(list2[1])
  distance = math.sqrt(x**2 + y**2)
  if distance <= d:
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import math

list = input().split(' ')
num = int(list[0])
d = int(list[1])
ans = 0

for i in num:
  list2 = input().split(' ')
  x = list2[0]
  y = list2[1]
  distance = math.sqrt(x**2 + y**2)
  if distance <= d:
    ans += 1

print(ans)
Problem p02622 (python)

Fixed submission:
S = list(input())
T = list(input())

count = 0
for i in range(len(S)):
  if S[i] == T[i]:
  	continue
  else:
    S[i] = T[i]
    count += 1
print(count)

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

count = 0
for i in range(len(S)):
  if S[i] == T[i]:
  	continue
  else:
    S[i] = T[i]
    count += 1
return count
Problem p02627 (python)

Fixed submission:
α = input()
 
if α == α.upper():
  print('A')
elif α == α.lower():
  print('a')

Buggy submission (verdict: Runtime Error):
α = int(input())
 
if α == α.upper():
  return print('A')
elif α == α.lower():
  return print('a')

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

if α == α.upper():
  print('A')
elif α == α.lower():
  print('a')

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

if a == a.upper():
  print("A")
elif a == a.lower():
  print("a")

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

if a == a.upper():
  return "A"
elif a == a.lower():
  return "a"

Buggy submission (verdict: Runtime Error):
if α==α.upper():
  return "A"
if α==α.lower():
  return "a"
Problem p02629 (python)

Fixed submission:
N = int(input())

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

print(num2alpha(N).lower())

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

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

return num2alpha(N)

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

if N<=26:
	return chr(64+num)
elif N%26==0:
    return num2alpha(N//26-1)+chr(90)
else:
    return num2alpha(N//26)+chr(64+N%26)

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

num=0
for index, item in enumerate(list(N)):
	num += pow(26,len(N)-index-1)*(ord(item)-ord('A')+1)


if num<=26:
	return chr(64+num)
elif num%26==0:
    return num2alpha(num//26-1)+chr(90)
else:
    return num2alpha(num//26)+chr(64+num%26)
Problem p02723 (python)

Fixed submission:
s = list(input())

if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")

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

if s[2] == s[3] & s[4] == s[5]:
  print("Yes")
else:
  print("No")
Problem p02777 (python)

Fixed submission:
a,b = input().split()
c,d = map(int,input().split())
e = input()

if a == e:
  print("{} {}".format(c-1,d))
else:
  print("{} {}".format(c,d-1))

Buggy submission (verdict: Runtime Error):
a,b = input().split
c,d = map(int,input().split())
e = input()

if a == e:
  print("{} {}".format(c-1,d))
else:
  print("{} {}".format(c,d-1))

Buggy submission (verdict: Runtime Error):
a,b = input().split
c,d = map(int,input().split())
e = input()

if a == e:
  print(c-1 d)
else:
  print(c d-1)
Problem p03041 (python)

Fixed submission:
n,k = map(int,input().split())
s = input()
ls = list(s)
ls[k-1] = ls[k-1].lower()
print("".join(ls))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
ls = list(s)
ls[k] = ls[k-1].lower()
print("".join(ls))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
ls = list(s)
ls[k] = ls[k].lower()
print("".join(ls))
Problem p03075 (python)

Fixed submission:
a,b,c,d,e = [int(input()) for _ in range(5)]
k = int(input())

if abs(a-b) >k or abs(a-c) >k or abs(a-d) >k or abs(a-e) >k or abs(b-c) >k or abs(b-d) >k or abs(e-b) >k or abs(c-d) >k or abs(c-e) >k or abs(d-e) >k :
  print(":(")
else:
  print("Yay!")

Buggy submission (verdict: Runtime Error):
a,b,c,d,e = [int(input()) for _ in range(4)]
k = int(input())

if abs(a-b) >k or abs(a-c) >k or abs(a-d) >k or abs(a-e) >k or abs(b-c) >k or abs(b-d) >k or abs(e-b) >k or abs(c-d) >k or abs(c-e) >k or abs(d-e) >k :
  print(":(")
else:
  print("Yay!")
Problem p02779 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(5, [2, 6, 1, 4, 5])
    YES
    >>> print_ans(6, [4, 1, 3, 1, 6, 2])
    NO
    >>> print_ans(2, [10000000, 10000000])
    NO
    """
    br = set(ar)
    print("YES" if len(br) == N else "NO")
    

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int,input().rstrip().split()))
    print_ans(N, ar)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    b_list = np.zeros(10**9 + 1, dtype = int)
    flg = True
    for a in ar:
        if b_list[a] == 1:
            flg = False
            break
        b_list[a] = 1
    if flg:
        print("YES")
    else:
        print("NO")
    
    

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int,input().rstrip().split()))
    print_ans(N, ar)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(5, [2, 6, 1, 4, 5])
    YES
    >>> print_ans(6, [4, 1, 3, 1, 6, 2])
    NO
    >>> print_ans(2, [10000000, 10000000])
    NO
    """
    b_list = np.zeros(10**9 + 1, dtype = int)
    flg = True
    for a in ar:
        if b_list[a] == 1:
            flg = False
            break
        b_list[a] = 1
    if flg:
        print("YES")
    else:
        print("NO")
    
    

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int,input().rstrip().split()))
    print_ans(N, ar)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(5, [2, 6, 1, 4, 5])
    YES
    >>> print_ans(6, [4, 1, 3, 1, 6, 2])
    NO
    >>> print_ans(2, [10000000, 10000000])
    NO
    """
    b_list = np.zeros(10**9 + 1, dtype = int)
    flg = True
    for a in ar:
        if b_list[a] == 1:
            flg = False
            break
        b_list[a] = 1
    if flg:
        print("YES")
    else:
        print("NO")
    
    

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int,input().rstrip().split()))
    print_ans(N, ar)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(5, [2, 6, 1, 4, 5])
    YES
    >>> print_ans(6, [4, 1, 3, 1, 6, 2])
    NO
    >>> print_ans(2, [10000000, 10000000])
    NO
    """
    b_list = np.zeros(10**9 + 1, dtype = int)
    flg = True
    for a in ar:
        if b_list[a] == 1:
            flg = False
            break
        b_list[a] = 1
    if flg:
        print("YES")
    else:
        print("NO")
    
    

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int,input().rstrip().split()))
    print_ans(N, ar)
Problem p02862 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np
from math import factorial
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
def print_ans(X, Y):
    """Test Case
    >>> print_ans(3, 3)
    2
    >>> print_ans(2, 2)
    0
    >>> print_ans(999999, 999999)
    151840682
    """
    A = np.array([[1, 2],[2, 1]])
    B = np.array([X, Y])
    X = np.linalg.solve(A, B)
    if X[0].is_integer() and X[1].is_integer() :
        # ans1 = factorial(X[0] + X[1])
        # ans2 = factorial(X[0])
        # ans3 = factorial(X[1])
        # mod =  (10**9+7)
        # print((ans1 // ans2 * ans3 ) % mod)
        print(cmb(int(X[0] + X[1]),int(X[0]),mod))
        # print(math.factorial(X[0] + X[1]) // (math.factorial(X[0]) * math.factorial(X[1])))
    else:
        print("0")


if __name__ == '__main__':
    X, Y = map(int, input().rstrip().split())
    print_ans(X, Y)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
from math import factorial
def print_ans(X, Y):
    """Test Case
    >>> print_ans(3, 3)
    2
    >>> print_ans(2, 2)
    0
    >>> print_ans(999999, 999999)
    151840682
    """
    A = np.array([[1, 2],[2, 1]])
    B = np.array([X, Y])
    X = np.linalg.solve(A, B)
    if X[0].is_integer() and X[1].is_integer() :
        ans1 = factorial(X[0] + X[1])
        ans2 = factorial(X[0])
        ans3 = factorial(X[1])
        mod =  (10**9+7)
        print((ans1 // ans2 * ans3 ) % mod)
        # print(math.factorial(X[0] + X[1]) // (math.factorial(X[0]) * math.factorial(X[1])))
    else:
        print("0")


if __name__ == '__main__':
    X, Y = map(int, input().rstrip().split())
    print_ans(X, Y)
Problem p02970 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import math
def print_ans(N, D):
    """Test Case
    >>> print_ans(6, 2)
    2
    >>> print_ans(14, 3)
    2
    >>> print_ans(20, 4)
    3
    """
    print(math.ceil(N / (D * 2 + 1)))
    

if __name__ == '__main__':
    N, D = map(int,input().rstrip().split())
    print_ans(N, D)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import math
def print_ans(N, D):
    """Test Case
    >>> print_ans(6, 2)
    2
    >>> print_ans(14, 3)
    2
    >>> print_ans(20, 4)
    3
    """
    print(math.ceil(N / (D * 2 + 1)))
    

if __name__ == '__main__':
    N, D = map(int,input().rstrip().sprit())
    print_ans(N, D)
Problem p02595 (python)

Fixed submission:
N, D = list(map(int, input().split()))
 
cnt = 0
 
for i in range(N):
  x, y = list(map(int, input().split()))
  
  if x**2 + y**2 <= D**2:
    cnt += 1
 
print(cnt)

Buggy submission (verdict: Runtime Error):
N, D = list(map(int, input()))

cnt = 0

for i in range(N):
  x, y = list(map(int, input()))
  
  if x**2 + y**2 <= D**2:
    cnt += 1

print(cnt)
Problem p02701 (python)

Fixed submission:
a,*b=map(str, open(0).read().split())
s=set(b)
print(min(int(a),len(s)))

Buggy submission (verdict: Runtime Error):
a=int(input())
*b,=map(open(0))
s=set(b)
print(min(a,len(s)))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=[input() for _ in range(10)]
s=set(b)
print(min(a,len(s)-1) if '' in b else min(a,len(s)))
Problem p03307 (python)

Fixed submission:
import fractions
n=int(input())
print((2*n)//fractions.gcd(2,n))

Buggy submission (verdict: Runtime Error):
import math as m
n=int(input())
print((2*n)//m.gcd(2,n))

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
print((2*n)//math.gcd(2,n))
Problem p02598 (python)

Fixed submission:
#import numpy as np
import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N,K = map(int, input().split())
    A = list(map(int, input().split()))

    def check(x):
        if x <= 0:
            return False
        else:
            return N+K >= sum(map(lambda a: math.ceil(a/x), A))

    s = max(A)//2
    h = s//2
    c = check(s)
    last = c
    while True:
        if c:
            s -= max(1,h)
        else:
            s += max(1,h)
        h //= 2
        last = c
        c = check(s)
        if h <= 0 and last != c:
            if last:
                s += 1
            break
    print(s)

main()

Buggy submission (verdict: Runtime Error):
#import numpy as np
import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N,K = map(int, input().split())
    A = list(map(int, input().split()))

    def check(x):
        return N+K >= sum(map(lambda a: math.ceil(a/x), A))

    s = max(A)//2
    h = s//2
    c = check(s)
    while h > 0 or not c:
        if c:
            s -= h
        else:
            s += max(1,h)
        h //= 2
        c = check(s)
    print(s)

main()