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

Fixed submission:
n, m = [int(i) for i in input().split()]
b = [0] * (n+1)
b[0],b[1]=1,1
c = [0]*(n+1)
a = [int(input()) for _ in range(m)]
for i in a:
    c[i] = 1
    b[i]=0
for i in range(2, n+1):
    if c[i] == 0:
        b[i] = b[i - 1] + b[i - 2]
print(b[-1]%(10**9+7))

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
b = [0] * n
b[0], b[1] = 1, 2
c = [0]*n
a = [int(input()) for _ in range(m)]
for i in a:
    c[i - 1] = 1
    b[i - 1] = 0
for i in range(2, n):
    if c[i] == 0:
        b[i] = b[i - 1] + b[i - 2]
print(b[-1])

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
b = [0] * n
b[0], b[1] = 1, 2
c = [0]*n
a = [int(input()) for _ in range(m)]
for i in a:
    c[i - 1] = 1
    b[i - 1] = 0
for i in range(2, n):
    if c[i] == 0:
        b[i] = b[i - 1] + b[i - 2]
print(b[-1])
Problem p03075 (python)

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

Buggy submission (verdict: Runtime Error):
a=[]
for i invrangr(6):
  a.append(int(input()))
if a[4]-a[0]>a[5]:
  print(":(")
else:
  print("Yay!")
Problem p03250 (python)

Fixed submission:
n = [int(i) for i in input().split()]
n.sort(reverse=True)
print(n[0]*10+n[1]+n[2])

Buggy submission (verdict: Runtime Error):
n = [input(i) for i in input().split()]
n.sort(reverse=True)
print(n[0]*10*n[1]+n[2])
Problem p03253 (python)

Fixed submission:
n, m = [int(i) for i in input().split()]
prime = 10 ** 9 + 7

def fact(x):
    a = []
    for i in range(2, int(x ** 0.5) + 1):
        if x % i == 0:
            j = 0
            while x % i == 0:
                x //= i
                j += 1
            a.append((i, j))
    if x != 1:
        a.append((x,1))
    return a


f = fact(m)
def kai(x):
    a = 1
    for i in range(a, x + 1):
        a *= i
        a %= prime
    return a

def conv(a, b):
    c = kai(b)
    c *= pow(kai(a), prime - 2, prime)
    c %= prime
    c *= pow(kai(b - a), prime - 2, prime)
    return c % prime


ans = 1
for i in f:
    ans *= conv(n - 1, n + i[1] - 1)
    ans %= prime
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]


def fact(x):
    a = []
    for i in range(2, int(x ** 0.5) + 1):
        if x % i == 0:
            j = 0
            while x % i == 0:
                x //= i
                j += 1
        a.append((i, j))
    if x != 1:
        a.append((x,1))
    return a


f = fact(m)


def conv(a, b):
    c = 1
    for i in range(b, b - a, -1):
        c *= i
    for i in range(1, a + 1):
        c //= i
    return c % (10 ** 9 + 7)


ans = 1
for i in f:
    ans *= conv(n - 1, n + i[1] - 1)
    ans %= 10 ** 9 + 7
print(ans)
Problem p02594 (python)

Fixed submission:
x = int(input())

if(x >= 30):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x = input()
if(x>=30):
    print("Yes")
if(x<30):
    print("No")
Problem p02624 (python)

Fixed submission:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

ans = 0
for k in range(1,n+1):
    ans += (k*(n//k)*(n//k + 1))//2
print(ans)

Buggy submission (verdict: Runtime Error):
n = ni()

ans = 0
for i in range(1,n+1):
    ans += (i*(n//i)*(n//i + 1))//2
print(ans)
Problem p02685 (python)

Fixed submission:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m,k = na()
mod = 998244353


fact = [0] * 220000
invfact = [0] * 220000
 
fact[0] = 1
for i in range(1, 220000):
    fact[i] = fact[i-1] * i % mod
 
invfact[220000 - 1] = pow(fact[220000 - 1], mod-2, mod)
 
for i in range(220000 - 2, -1, -1):
    invfact[i] = invfact[i+1] * (i+1) % mod
 
def nCk(n, k):
    if k < 0 or n < k:return 0
    return fact[n] * invfact[k] * invfact[n-k] % mod
 
ans = 0

for i in range(k+1):
    ans += pow(m-1,n-i-1,mod)*nCk(n-1,i)

print(ans*m%mod)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m,k = na()
mod = 998244353
aall = pow(m,n,mod)

p = n-k+1


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


N = 10**3*3
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 )

if n//2 > k:
    print(aall-cmb(n+p,p,mod))
    exit()

print(aall)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m,k = na()
mod = 998244353
aall = pow(m,n,mod)

p = n-k+1


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**3*3
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 )

if n//2 > k:
    print(aall-cmb(n+p,p,mod))
    exit()

print(aall)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m,k = na()
mod = 998244353
aall = pow(m,n,mod)

p = n-k+1


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**3*3
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 )

print(aall-cmb(n+p,p,mod))
Problem p02753 (python)

Fixed submission:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

s = ns()
ss = list(s)
a = 'No' if ss[0] == ss[1] and ss[1] == ss[2] else 'Yes'
print(a)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,p = na()
s = ns()
s = list(s)
ans = 0

seenRemainders = [[] for k in range(n)] #長さn
for i in range(n):
    remainder = 0
    prefixesFound = 0
    for j in range(i,n):
        remainder = (10 * remainder + int(s[j])) % p
        if remainder in seenRemainders[j]:
            break
        seenRemainders[j].append(remainder)
        if remainder == 0:
            prefixesFound+=1
    ans += prefixesFound * (prefixesFound + 1) // 2

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

ss = nn()
a = 'No' if ss[0] == ss[1] and ss[1] == ss[2] else 'Yes'
print(a)
Problem p02759 (python)

Fixed submission:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
print((n+1)//2)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

a1 = na()
a2 = na()
a3 = na()

A = a1+a2+a3
C = [0,0,0,0,0,0,0,0,0]

n = ni()

for i in range(n):
    b = ni()
    if b in A:
        C[A.index(b)] = 1
    if sum(C[0:3]) == 3 or sum(C[3:6])==3 or sum(C[6:9]) == 3 or sum(C[::4]) == 3 or sum(C[2:7:2]) == 3 or sum(C[0::3]) == 3 or sum(C[1::3]) == 3 or sum(C[2::3]) == 3:
        print('Yes')
        exit()

print("No")
Problem p02793 (python)

Fixed submission:
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
sys.setrecursionlimit(10**6)
from fractions import gcd

mod = 10**9+7

n = ni()
a = na()
b,c = 1,0

def lcm(m,n):
    return (m*n)//gcd(m,n)

for i in a:
    b=lcm(b,i)

for i in a:
    c+=b//i

print(c%mod)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
sys.setrecursionlimit(10**6)

from fractions import Fraction

mod = 10**9+7

n = ni()
a = na()
b,c = 1,0

def lcm(m,n):
    return (m*n)//Fraction.gcd(m,n)

for i in a:
    b=lcm(b,i)

for i in a:
    c+=b//i

print(c%mod)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
sys.setrecursionlimit(10**6)

import math

mod = 10**9+7

n = ni()
a = na()
b,c = 1,0

def lcm(m,n):
    return (m*n)//math.gcd(m,n)

for i in a:
    b=lcm(b,i)

for i in a:
    c+=b//i

print(c%mod)
Problem p03201 (python)

Fixed submission:
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

import heapq

n = ni()
a = na()
ls = []

for i in a:
    heapq.heappush(ls,-i)

s = {}
ans = 0

for _ in range(n):
    m = -heapq.heappop(ls)
    if m in s and s[m] > 0:
        s[m] -= 1
        ans += 1
        continue
    dif = 2**m.bit_length()-m
    if dif in s:
        s[dif] += 1
    else:
        s[dif] = 1

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

import heapq
import bisect

n = ni()
a = na()
ls = []
nibeki = [2**i for i in range(1,31)]

for i in a:
    heapq.heappush(ls,-i)

s = {}
ans = 0

for _ in range(n):
    m = -heapq.heappop(ls)
    if m in s and s[m] > 0:
        s[m] -= 1
        ans += 1
        continue
    b = bisect.bisect_right(nibeki,m)
    dif = 0 if b > 0 and nibeki[b-1] == m else nibeki[b]-m
    if m in s:
        s[dif] += 1
    else:
        s[dif] = 1

print(ans)
Problem p02623 (python)

Fixed submission:
from bisect import *
 
N, M, K =map(int, input().split())
A  = list(map(int, input().split()))
B  = list(map(int, input().split()))

A_= [0]
for a in A:
  A_.append(A_[-1] + a)
#print(A_)

b_sum = 0
ans = 0
b_cnt = 0

while True:
  if b_sum > K:
    break
  else:
    k = K - b_sum
    ans = max(bisect_right(A_, k)-1 + b_cnt, ans)
    #print(bisect_right(A_, k)-1 + b_cnt, ans,  b_cnt)
    if b_cnt == M:
      break
    b_sum += B[b_cnt]
    b_cnt += 1
    

print(ans)

Buggy submission (verdict: Runtime Error):
from  collections import deque
 
N, M, K =map(int, input().split())
A  = list(map(int, input().split()))
B  = list(map(int, input().split()))
 
A = deque(A)
B = deque(B)
 
def check(n, A_, B_):
  if len(A_) >= n and len(B_) >= n:
    if A_[n-1] > B_[n-1]:
      return 'B'
    elif A_[n-1] < B_[n-1]:
      return 'A'
    else:
      check(n+1, A_, B_)
  elif len(A_) < n and len(B_) <  n:
    return 'A'
  elif len(A_) < n:
    return 'B'
  else:
    return 'A'
  
#print(check(1, A, B))


ans = 0
while True:
  if A:
    a = A[0]
  else:
    a = 10**9+7
  if B:
    b = B[0]
  else:
    b = 10**9+7
  if min(a, b) > K:
    break
  elif len(A) == 0 and len(B) == 0:
    break
  else:
    j =check(1, A, B)
    if j ==  'A':
      K -= A.popleft()
      ans += 1
    else:
      K -= B.popleft()
      ans += 1
      
print(ans)

Buggy submission (verdict: Runtime Error):
from  collections import deque
 
N, M, K =map(int, input().split())
A  = list(map(int, input().split()))
B  = list(map(int, input().split()))
 
A = deque(A)
B = deque(B)
 
def check(n, A_, B_):
  if len(A_) >= n and len(B_) >= n:
    if A_[n-1] > B_[n-1]:
      return 'B'
    elif A_[n-1] < B_[n-1]:
      return 'A'
    else:
      check(n+1, A_, B_)
  elif len(A_) < n and len(B_) <  n:
    return 'A'
  elif len(A_) < n:
    return 'B'
  else:
    return 'A'
  
#print(check(1, A, B))


ans = 0
while True:
  if A:
    a = A[0]
  else:
    a = 10**9+7
  if B:
    b = B[0]
  else:
    b = 10**9+7
  if min(a, b) > K:
    break
  else:
    j =check(1, A, B)
    if j ==  'A':
      K -= A.popleft()
      ans += 1
    else:
      K -= B.popleft()
      ans += 1
      
print(ans)

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

N, M, K =map(int, input().split())
A  = list(map(int, input().split()))
B  = list(map(int, input().split()))

A = deque(A)
B = deque(B)

ans = 0
while True:
  a = A[0]
  b = B[0]
  if min(a, b) > K:
    break
  else:
    if a <  b:
      a = A.popleft()
      K -= a
      ans += 1
    else:
      b = B.popleft()
      K -= b
      ans += 1
  #print(ans,  K)
      
      
print(ans)
Problem p02685 (python)

Fixed submission:
N, M, K = map(int, input().split())
MOD = 998244353

ans = 0

class combination():
    def __init__(self, n):
        self.fact = [1] * (n+1)
        self.ifact = [1] * (n+1)
        for i in range(1, n+1):
            self.fact[i] = self.fact[i-1]*i % MOD
        self.ifact[n] = pow(self.fact[n], MOD-2, MOD)
        for i in range(n, 0, -1):
            self.ifact[i-1] = self.ifact[i]*i % MOD
    def comb(self, n, k):
        if k < 0 or k > n: return 0
        comb = self.fact[n]*self.ifact[k]*self.ifact[n-k] %MOD
        return comb
comb = combination(N)

  
for k in range(K+1):
  # M x (N-1)Ck x (M-1) ^ (N - 1 - k)
  ans += (comb.comb(N-1, k) * pow(M-1, N-1-k, MOD)) % MOD
  
print(ans * M % MOD)

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

CONV = 1
KAIJ = (M - 1) ** (N - 1)
ans = 0

for k in range(K + 1):
  # M x (N-1)Ck x (M-1) ^ (N - 1 - k)
  ans += (M * CONV * KAIJ) % MOD
  CONV = CONV * (N - 1 - k) // (k + 1)
  KAIJ = KAIJ // (M - 1)
  
print(ans % MOD)
Problem p02701 (python)

Fixed submission:
N = int(input())
S = [ input() for _ in range(N) ]
print(len(set(S)))

Buggy submission (verdict: Runtime Error):
S = [ input() for _ in range(N) ]
print(len(set(S)))
Problem p02712 (python)

Fixed submission:
N = int(input())
 
ans = 0
for i in range(1, N+1):
  if i % 3 != 0 and i % 5 != 0:
    ans += i
print(ans)

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

ans = 0
for i in range(1, N+1):
  if i % 3 != 0 and i % 5 != 0:
    ans += i
print(ans)
Problem p02793 (python)

Fixed submission:
from fractions import gcd
 
N=int(input())
a_list = tuple(int(i) for i in input().split())
MOD = 10**9+7

def cal_lcm(a, b):
  return int(a*b//gcd(a,b))

lcm = 1
for i in range(N):
  lcm = cal_lcm(lcm, a_list[i])
  
ans = 0
for i in range(N):
  ans += lcm//a_list[i]
print(ans%MOD)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

N=int(input())
a_list = list(map(int, input().split()))
MOD = 10**9+7


def cal_lcm(a, b):
  return int(a*b/gcd(a,b))


lcm = 1
ans = 0
for i in range(N):
  lcm_ = cal_lcm(lcm, a_list[i])
  ans = ans*int(lcm_/lcm) % MOD
  ans = (ans + int(lcm_/a_list[i])) % MOD
  lcm = lcm_

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from fractions import gcd

N=int(input())
a_list = list(map(int, input().split()))
MOD = 10**9+7


def cal_lcm(a, b):
  return int(a*b/gcd(a,b))


lcm = 1
ans = 0
for i in range(N):
  lcm_ = cal_lcm(lcm, a_list[i])
  ans = ans*int(lcm_/lcm) % MOD
  ans = (ans + int(lcm_/a_list[i])) % MOD
  lcm = lcm_

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from fractions import gcd

N=int(input())
a_list = list(map(int, input().split()))
MOD = 10 ** 9+ 7

def cal_lcm(a, b):
  return int(a*b/gcd(a,b))


lcm = 1
sum_b = 0
ans = 0
for i in range(N):
  lcm_ = cal_lcm(lcm, a_list[i])
  ans = ans*int(lcm_/lcm) % MOD
  ans = (ans + int(lcm_/a_list[i])) % MOD
  lcm = lcm_

print(ans)
Problem p02984 (python)

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

ans_list = [0]*N

not1_list = [ a_list[i] for i in range(1, N, 2) ]
ans_list[0] = sum(a_list) - 2 * sum(not1_list)
for i in range(1,N):
  ans_list[i] = a_list[i-1] * 2 - ans_list[i-1]
print(*ans_list)

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

a_array = np.zeros((N,N))

for i in range(N):
  a_array[i-1][i] = 0.5
  a_array[i-1][i-1] = 0.5
  
a = np.linalg.solve(a_array, a_list).astype(int)
print(*a)
Problem p02571 (python)

Fixed submission:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    S = input()
    T = input()
    ls = len(S)
    lt = len(T)

    ans = INF
    for i in range(ls - lt + 1):
        cur = 0
        for j in range(lt):
            if S[i + j] != T[j]:
                cur += 1
        ans = min(ans, cur)

    print(ans)


if __name__ == '__main__':
    main()

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

ans = 1000000  # 適当に1001以上を初期値にしておきます

# Tが1文字のときlen(S)回、2文字のときlen(S) - 1回 …… なので、
# len(S) - len(T) + 1 パターンあります

for i in range(len(S) - len(T) + 1):
    score = 0
    U = S[i:i + len(T)]  # Sのi文字目から連続するlen(T)文字を、Uとします
    for j in range(len(T)):
        if U[j] != T[j]:
            score += 1
    ans = min(ans, cur)

print(ans)
Problem p02577 (python)

Fixed submission:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = input()
    cur = 0

    for x in n:
        cur += int(x)

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


if __name__ == '__main__':
    main()

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

for x in n:
  cur += int(x)

  if cur % 9 == 0:
    print("Yes")
    else:
      print("No")
Problem p02595 (python)

Fixed submission:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, d = map(int, readline().split())

    ans = 0

    for _ in range(n):
        x, y = map(int, readline().split())
        if (x ** 2 + y ** 2) <= d ** 2:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

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

ans = 0

for _ in range(n):
    x, y = map(int, readline().split())
    if x ** 2 + y ** 2 <= d ** 2:
        ans += 1

print(ans)
Problem p02682 (python)

Fixed submission:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, c, k = list(map(int, readline().split()))
    if a + b >= k:
        print(min(a, k))
    else:
        print(a - (k - a - b))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, c, k = list(map(int, readline().split()))
    s = [1] * a + [0] * b + [-1] * c
    ans = sum(s[:k])
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, c, k = list(map(int, readline().split()))
    s = [1] * a + [0] * b + [-1] * c
    print(s)
    ans = sum(s[:k])
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, c, k = list(map(int, readline().split()))
    s = [1] * a + [0] * b + [-1] * c
    ans = sum(s[::k])
    print(ans)


if __name__ == '__main__':
    main()
Problem p02777 (python)

Fixed submission:
s , t = [str(i) for i in input().split()]
a , b =[int(i) for i in input().split()]
u = str(input())

if u == s:
    a = a - 1
else:
    b = b - 1

print(a, b)

Buggy submission (verdict: Runtime Error):
s, t = [str(i) for i in input().split()]
a , b =[int(i) for i in input().split()]
u = str(input())

if u == s:
    a = a - 1
else:
    b = b - 1

print(f'{a} {b}')
Problem p02779 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

a.sort()

for i in range(n-1):
    if a[i] == a[i+1]:
        print('NO')
        break
else:
    print('YES')

Buggy submission (verdict: Runtime Error):
n =int(input())
a = [int(i) for i in input().split()]
is_same = False

for i in range(n):
    for j in range(i+1, n+1):
        if a[i] == a[j]:
            is_same = True

if is_same:
    print('NO')
else:
    print('YES')
Problem p02781 (python)

Fixed submission:
# import bisect
from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = input()
    p = int(input())
    l = len(n)

    n_0 = int(str(n)[0])

    dp = [[[0] * 2 for _ in range(p + 2)] for __ in range(l)]
    dp[0][0][0] = 0
    dp[0][0][1] = 1
    dp[0][1][0] = 1
    dp[0][1][1] = (n_0 - 1)

    for i in range(l - 1):
        a = int(n[i + 1])
        if a != 0:
            for j in range(p + 1):
                dp[i + 1][j + 1][0] += dp[i][j][0]
                dp[i + 1][j + 1][1] += 9 * dp[i][j][1] + (a - 1) * dp[i][j][0]
                dp[i + 1][j][1] += dp[i][j][0] + dp[i][j][1]
        else:
            for j in range(p + 1):
                dp[i + 1][j + 1][1] += 9 * dp[i][j][1]
                dp[i + 1][j][0] += dp[i][j][0]
                dp[i + 1][j][1] += dp[i][j][1]

    print(dp[l - 1][p][0] + dp[l - 1][p][1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
k = int(input())

digit_num = math.floor(math.log10(n)) + 1
count = [0 for _ in range(n)]
# 1桁少ないとこまで
for i in range(digit_num-1):
    j = i + 1
    if j > k:
        temp = ((j*j + 3*j + 2) * 9^(j-2))  /2
        count[i] = temp

b = 0

for i in range(digit_num,k,-1):
    s = int(str(n)[i])
    if s > 1:
        temp = (s-1) * count[i+1]
        b = b + temp

ans = sum(count)+b

print(b)