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

Fixed submission:
N,K = map(int,input().split())
mod_num = 10**9+7

def mul(a,b):
    return ((a % mod_num) * (b % mod_num)) % mod_num

def power(x,y):
    if y==0:                 
        return 1     
    elif y==1:                    
        return x % mod_num
    elif y%2 == 0:
        return power(x, y//2)**2 % mod_num
    else:
        return power(x, y//2)**2 * x % mod_num
    
def div(a,b):
    return mul(a, power(b, mod_num-2))


ans = N-K+1
ans %= mod_num
print(ans)

for i in range(1,K):
    if N-K+1-i>0:
        ans = mul(ans,K-i)
        ans = mul(ans,N-K+1-i)
        ans = div(ans,i)
        ans = div(ans,i+1)
        print(ans)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
mod_num = 10**9+7

ans = N-K+1
ans %= mod_num
print(ans)

for i in range(1,K):
    if N-K+1-i>0:
        ans = ans*(K-i)*(N-K+1-i)%mod_num   
        ans = ans*pow(b,mod_num-2)%mod_num
        print(ans)
    else:
        print(1)
Problem p03038 (python)

Fixed submission:
N,M = map(int,input().split())
A = [int(a) for a in input().split()]
BC = [[int(x) for x in input().split()] for _ in range(M)]

BC.sort(key=lambda x:x[1], reverse=True)

count = 0
Added_list = []
for i in range(M):
    B,C = BC[i]
    Added_list += [C]*B
    count += B
    if count>N:
        Added_list = Added_list[:N]
        break

A += Added_list
A.sort(reverse=True)
print(sum(A[:N]))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = [int(a) for a in input().split()]
BC = [[int(x) for x in input().split()] for _ in range(M)]

A.sort(reverse=True)
BC.sort(key=lambda x:x[1], reverse=True)

def bysectsearch(List,num,Left):
    Right = len(List)-1
    while True:
        Midle = (Left+Right)//2
        if List[Left]<=num:
            return Left
        if List[Right]>=num:
            return Right+1
        if Right-Left<=1:
            return Right
        if List[Midle]==num:
            return Midle
        if List[Midle]>num:
            Left = Midle
            continue
        if List[Midle]<num:
            Right = Midle
            continue

Left = 0
for B,C in BC:
    insert_point = bysectsearch(A,C,Left)
    if insert_point == N:
        break
    A = A[:insert_point]+[C]*B+A[insert_point:]
    A = A[:N]
    Left = insert_point + B
print(sum(A))
Problem p03045 (python)

Fixed submission:
N,M = map(int,input().split())
XYZ = [[int(x) for x in input().split()] for _ in range(M)]

par = [i for i in range(N)]
rank = [0]*N


def root(x):
    tmp = x
    while par[tmp]!=tmp:
        tmp = par[tmp]
    return tmp

def unite(x,y):
    rx = root(x)
    ry = root(y)
    if rx==ry:
        return
    if rank[rx] < rank[ry]:
        rx,ry = ry,rx
    if rank[rx] == rank[ry]:
        rank[rx] += 1
    par[ry] = rx

for x,y,z in XYZ:
    unite(x-1,y-1)

ans = 0
for i in range(N):
    if par[i] == i:
        ans += 1
print(ans)

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

par = [i for i in range(N)]
rank = [0]*N


def root(x):
    tmp = x
    while par[tmp]!=tmp:
        tmp = par[tmp]
    return tmp

def urite(x,y):
    rx = root(x)
    ry = root(y)
    if rx==ry:
        return
    if rank[rx] < rank[ry]:
        rx,ry = ry,rx
    if rank[rx] == rank[ry]:
        rank[rx] += 1
    par[ry] = rx

for xyz in XYZ:
    urite(x,y)

ans = 0
for i in N:
    if par[i] == i:
        ans += 1
print(ans)

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

par = [i for i in range(N)]
rank = [0]*N


def root(x):
    tmp = x
    while par[tmp]!=tmp:
        tmp = par[tmp]
    return tmp

def urite(x,y):
    rx = root(x)
    ry = root(y)
    if rx==ry:
        return
    if rank[rx] < rank[ry]:
        rx,ry = ry,rx
    if rank[rx] == rank[ry]:
        rank[rx] += 1
    par[ry] = rx

for xyz in XYZ:
    urite(x,y)

ans = 0
for i in N:
    if par[i] == i:
        ans += 1
print(ans)
Problem p03201 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
dic = {}
for a in A:
    dic[a] = dic.get(a,0)+1
ans = 0

for a in A:
    small = (1<<(len(format(a,"b")))) - a
    if small == a:
        if dic[a] >= 2:
            dic[a] -= 2
            ans += 1
        continue
    if dic.get(a,0)>0 and dic.get(small,0)>0:
        dic[a] -= 1
        dic[small] -= 1
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 0
L=0
t=31
while(t>0):
    if len(A) == 0:
        break
    if A[-1]<(1<<(t-1)) or (1<<t) <= A[-1]:
        t -= 1
        L = 0
        continue

    large = A.pop(-1)
    small = (1<<t)-large
    if small < A[0] or A[-1]< small:
        t -= 1
        L = 0
        continue
    tmp = bisect.bisect_left(A,(1<<t)-large,lo=L,hi=len(A))
    if tmp == len(A):
        t -= 1
        L = 0
        continue
    if A[tmp] == (1<<t)-large:
        del A[tmp]
        ans += 1
        L = max(0,tmp-1)

print(ans)
Problem p03209 (python)

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

PforL = [1]
HforL = [1]
for i in range(1,51):
    PforL.append(PforL[i-1]*2+1)
    HforL.append(HforL[i-1]*2+3)

ans = 0
while 0<X:
    if(X<((HforL[N]-3)/2)+1):
        X -= 1
        N -= 1
        continue
    if(X==((HforL[N]-3)/2+1)):
        ans+=PforL[N-1]
        break
    if(X==((HforL[N]-3)/2+2)):
        ans+=PforL[N-1]+1
        break
    if(X<HforL[N]-1):
        ans += PforL[N-1]+1
        X -= 2+HforL[N-1]
        N -= 1
        continue
    if(X<=HforL[N]):
        ans += PforL[N]
        break
print(ans)

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

PforL = [1]
HforL = [1]
for i in range(1,51):
    PforL.append(PforL[i-1]*2+1)
    HforL.append(HforL[i-1]*2+3)

def recursive(n,x):
    if x<=n:
        return 0
    if x<=HforL[n-1]+1:
        return recursive(n-1,x-1)
    else:
        return PforL[n-1]+1+recursive(n-1,x-HforL[n-1]-2)

print(recursive(N,X))

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

PforL = [1]
HforL = [1]
for i in range(1,51):
    PforL.append(PforL[i-1]*2+1)
    HforL.append(HforL[i-1]*2+3)

def recursive(n,x):
    if x<=n:
        return 0
    if x<=HforL[n-1]+1:
        return recursive(n-1,x-1)
    if x<HforL[n]:
        return PforL[n-1]+1+recursive(n-1,x-HforL[n-1]-2)

print(recursive(N,X))
Problem p03221 (python)

Fixed submission:
N,M = map(int,input().split())
PY = [list(map(int,input().split()))+[i] for i in range(M)]

num = [0]*N
ans = [""]*M

PY.sort(key = lambda x:x[1])

for p,y,i in PY:
    num[p-1] += 1
    ans[i] = str(p).zfill(6) + str(num[p-1]).zfill(6)

for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
from bisect import bisect,bisect_left


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

d1 = {}
d2 = {}
for i in range(M):
    PY = list(map(int,input().split()))
    tmp = d1.get(PY[0],[])
    ins_pos = bisect(tmp,PY[1])
    tmp.insert(ins_pos,PY[1])
    d1[PY[0]] = tmp

for py in PY:
    s1 = str(py[0])
    s1 = ("0"*(6-len(s1)))+s1
    s2 = str(bisect_left(d[py[0]],py[1])+1)
    s2 = ("0"*(6-len(s2)))+s2

    print(s1+s2)
Problem p03222 (python)

Fixed submission:
H,W,K = map(int,input().split())

dp = [[0]*10 for _ in range(H+1)]   
dp[0][1] = 1

    

for i in range(1,H+1):
    for x in range(2**(W-1)):           
        Alloc = [0]*9
        tmp = x
        for y in range(1,8):  
            Alloc[y] = tmp%2
            tmp //= 2 
        for y in range(0,9):
            if Alloc[y] == 1 and Alloc[y+1] == 1:
                break
        else:   
            for j in range(1,9):  
                if Alloc[j-1] == 1: 
                    dp[i][j] += dp[i-1][j-1]
                elif Alloc[j] == 1:
                    dp[i][j] += dp[i-1][j+1]
                else:
                    dp[i][j] += dp[i-1][j]
                dp[i][j] %= 1000000007

print(dp[H][K])

Buggy submission (verdict: Runtime Error):
H,W,K = map(int,input().split())

dp = [[0]*(W+2) for _ in range(H+1)]
dp[0][1] = 1

    

for i in range(1,H+1):
    for x in range(2**(W-1)):           
        Alloc = [0]*9
        tmp = x
        for y in range(1,8):  
            Alloc[y] = tmp%2
            tmp //= 2 
        for y in range(0,9):
            if Alloc[y] == 1 and Alloc[y+1] == 1:
                break
        else:   
            for j in range(1,9):  
                if Alloc[j-1] == 1: 
                    dp[i][j] += dp[i-1][j-1]
                elif Alloc[j] == 1:
                    dp[i][j] += dp[i-1][j+1]
                else:
                    dp[i][j] += dp[i-1][j]
                dp[i][j] %= 1000000007

print(dp[H][K])
Problem p03253 (python)

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

m = M
f = {}
while m%2==0:
    f[2] = f.get(2,0)+1
    m = m//2

l = int(m**0.5)+1
k = 3
while m != 1:
    if k>l:
        f[m] = f.get(m,0)+1
        break
    while m%k==0:
        f[k] = f.get(k,0)+1
        m = m//k
    k+=2
ans = 1
for k in f:
    for i in range(N-1+f[k],N-1,-1):
        ans = (ans * i) 
    for i in range(f[k]):
        ans = ans // (i+1)
    ans = ans % ((10**9)+7)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

D = {}
m = M
for i in range(2, int M):
    while m % i == 0:
        D[i] = D.get(i,0)+1
        m = m//i

d = []
for v in D.values():
    d.append(v)

tmp = [0] * len(d)
for i in range(len(d)):
    tmp[i] = (math.factorial(N-1+d[i]) // (math.factorial(N-1)*math.factorial(d[i])))%(10**9 + 7)

ans = 1
for i in range(len(tmp)):
    ans = ans*tmp[i]%(10**9 +7)
print(ans)

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

D = {}
m = M
for i in range(2, int(M**0.5)+2):
    while m % i == 0:
        D[i] = D.get(i,0)+1
        m = m//i
if D == {}:
    D[M] = 1

d = []
for v in D.values():
    d.append(v)

tmp = [0] * len(d)
for i in range(len(d)):
    tmp[i] = (math.factorial(N-1+d[i]) // (math.factorial(N-1)*math.factorial(d[i])))%(10**9 + 7)

ans = 1
for i in range(len(tmp)):
    ans = ans*tmp[i]%(10**9 +7)
print(ans)
Problem p03291 (python)

Fixed submission:
S = input()

A_left=[0]
C_left=[0]
Q_left=[0]

for (i,s) in enumerate(S):
    if s == "A":
        A_left.append(A_left[i]+1)
        C_left.append(C_left[i])
        Q_left.append(Q_left[i])
    elif s == "C":
        A_left.append(A_left[i])
        C_left.append(C_left[i]+1)
        Q_left.append(Q_left[i])
    elif s == "?":
        A_left.append(A_left[i])
        C_left.append(C_left[i])
        Q_left.append(Q_left[i]+1)
    else:
        A_left.append(A_left[i])
        C_left.append(C_left[i])
        Q_left.append(Q_left[i])

A_right = []
C_right = []
Q_right = []
for i in range(len(S)):
    A_right.append(A_left[-1] - A_left[i+1])
    C_right.append(C_left[-1] - C_left[i+1])
    Q_right.append(Q_left[-1] - Q_left[i+1])

ans = 0
for (i,s) in enumerate(S):
    if s == "B":
        ans = (ans + A_left[i] * C_right[i] * pow(3,Q_left[-1],10**9+7)) % (10**9+7)
        if Q_left[-1]>=1:
            ans = (ans + (Q_left[i] * C_right[i] + A_left[i] * Q_right[i]) * pow(3,(Q_left[-1]-1),10**9+7)) % (10**9+7)
        if Q_left[-1]>=2:
            ans = (ans + (Q_left[i] * Q_right[i]) * pow(3,(Q_left[-1]-2),10**9+7)) % (10**9+7)
    elif s == "?":
        if Q_left[-1]>=1:
            ans = (ans + A_left[i] * C_right[i] * pow(3,(Q_left[-1]-1),10**9+7)) % (10**9+7)
        if Q_left[-1]>=2:
            ans = (ans + (Q_left[i] * C_right[i] + A_left[i] * Q_right[i]) * pow(3,(Q_left[-1]-2),10**9+7)) % (10**9+7)
        if Q_left[-1]>=3:
            ans = (ans + (Q_left[i] * Q_right[i]) * pow(3,(Q_left[-1]-3),10**9+7)) % (10**9+7)

print(ans)

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

A_left=[0]
C_left=[0]
Q_left=[0]

for (i,s) in enumerate(S):
    if s == "A":
        A_left.append(A_left[i]+1)
        C_left.append(C_left[i])
        Q_left.append(Q_left[i])
    elif s == "C":
        A_left.append(A_left[i])
        C_left.append(C_left[i]+1)
        Q_left.append(Q_left[i])
    elif s == "?":
        A_left.append(A_left[i])
        C_left.append(C_left[i])
        Q_left.append(Q_left[i]+1)
    else:
        A_left.append(A_left[i])
        C_left.append(C_left[i])
        Q_left.append(Q_left[i])

A_right = []
C_right = []
Q_right = []
for i in range(len(S)):
    A_right.append(A_left[-1] - A_left[i+1])
    C_right.append(C_left[-1] - C_left[i+1])
    Q_right.append(Q_left[-1] - Q_left[i+1])

ans = 0
for (i,s) in enumerate(S):
    if s == "B":
        ans = (ans + A_left[i] * C_right[i] * pow(3,Q_left[-1],10**9+7)) % (10**9+7)
        ans = (ans + (Q_left[i] * C_right[i] + A_left[i] * Q_right[i]) * pow(3,(Q_left[-1]-1),10**9+7)) % (10**9+7)
        ans = (ans + (Q_left[i] * Q_right[i]) * pow(3,(Q_left[-1]-2),10**9+7)) % (10**9+7)
    elif s == "?":
        ans = (ans + A_left[i] * C_right[i] * pow(3,(Q_left[-1]-1),10**9+7)) % (10**9+7)
        ans = (ans + (Q_left[i] * C_right[i] + A_left[i] * Q_right[i]) * pow(3,(Q_left[-1]-2),10**9+7)) % (10**9+7)
        ans = (ans + (Q_left[i] * Q_right[i]) * pow(3,(Q_left[-1]-3),10**9+7)) % (10**9+7)

print(ans)
Problem p03329 (python)

Fixed submission:
SixNum = [i for i in range(0,100001)]
for i in range(1,7):
        for j in range(1,100001):
                SixNum[j] = min(SixNum[j],j//(6**i) + SixNum[j%(6**i)])

NineNum = [i for i in range(0,100001)]
for i in range(1,6):
        for j in range(1,100001):
                NineNum[j] = min(NineNum[j],j//(9**i) + NineNum[j%(9**i)])

N = int(input())
ans = 100001
for i in range(0,N+1):
        ans = min(ans,SixNum[i]+NineNum[N-i])
print(ans)

Buggy submission (verdict: Runtime Error):
num = [i for i in range(0,100001)]

for j in range(1,100001):
        num[j] = j//6 + num[j%6]

for j in range(1,100001):
        num[j] = min(num[j],j//9+num[j%9])

for j in range(1,100001):
        num[j] = min(num[j],j//36+num[j%36])

for j in range(81,324):
        num[j] = min(num[j],1+num[j-81])
for j in range(162,324):
        num[j] = min(num[j],2+num[j-162])
for j in range(243,324):
        num[j] = min(num[j],3+num[j-243])
for j in range(324,100001):
        num[j] = min(num[j],(j//324)*4 + num[j%234])

for j in range(216,648):
        num[j] = min(num[j],1+num[j-216])
for j in range(432,648):
        num[j] = min(num[j],2+num[j-216*2])
for j in range(648,100001):
        num[j] = min(num[j],(j//648)*3 + num[j%648])

for i in range(1,8):
        for j in range(729*i,729*8):
                num[j] = min(num[j],i+num[j-729*i])
for j in range(729*8,100001):
        num[j] = min(num[j],(j//(729*8))*8+num[j%(729*8)])

for i in range(1,9):
        for j in range((6**4)*i,(6**4)*9):
                num[j] = min(num[j],i+num[j-(6**4)*i])
for j in range((6**4)*9,100001):
        num[j] = min(num[j],(j//((6**4)*9))*9+num[j%((6**4)*9)])

for i in range(1,2**4):
        for j in range((9**4)*i,(9**4)*(2**4)):
                num[j] = min(num[j],i+num[j-(9**4)*i])
for j in range((9**4)*(2**4),100001):
        num[j] = min(num[j],(j//((9**4)*(2**4)))*(2**4)+num[j%((6**4)*(2**4))])

MoneyYouCanGet = [6**5,6**6,9**5]

for i in MoneyYouCanGet:
        for j in range(1,100001):
                k = 1
                while k*i<j:
                        num[j] = min(num[j],k+num[j-k*i])
                        k += 1

N = int(input())
print(num[N])
Problem p03634 (python)

Fixed submission:
import heapq
N = int(input())
node = [[] for _ in range(N)]
for _ in range(N-1):
  a,b,c = map(int,input().split())
  node[a-1].append([c,b-1])
  node[b-1].append([c,a-1])
Q,K = map(int,input().split())

flag = [True]*N
ques = [[0,K-1]]
D = [0]*N
while ques:
  d1,l1 = heapq.heappop(ques)
  if flag[l1]:
    flag[l1]=False
    D[l1] = d1
    for d2,l2 in node[l1]:
      if flag[l2]:
        heapq.heappush(ques,[d1+d2,l2])
for _ in range(Q):
  x,y = map(int,input().split())
  print(D[x-1]+D[y-1])

Buggy submission (verdict: Runtime Error):
import heapq
N = int(input())
node = [[] for _ in range(N)]
for _ in range(N-1):
  a,b,c = map(int,input().split())
  node[a-1].append([c,b-1])
  node[b-1].append([c,a-1])
Q,K = map(int,input().split())

flag = [True]*N
ques = [[0,K-1]]
D = [0]*N
while ques:
  d1,l1 = heapq.heappop(ques)
  if flag[l1]:
    flag[l1]=False
    D[l1] = d1
    for d2,l2 in node[l1]:
      if flag[l2]:
        heapq.heappush([d1+d2,l2])
for _ in range(Q):
  x,y = map(int,input().split())
  print(D[x-1]+D[y-1])
Problem p03785 (python)

Fixed submission:
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()

time=T[0]
count = 1
ans = 0

for i in range(1,N):
  if T[i]-time>K or count==C:
    time = T[i]
    count = 1
    ans += 1
  else:
    count += 1
if count>0:
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)].sort()

time=T[0]
count = 1
ans = 0

for i in range(1,N):
  if T[i]-time>K or count==C:
    time = T[i]
    count = 1
    ans += 1
  else:
    count += 1
if count>0:
  ans += 1
print(ans)
Problem p03803 (python)

Fixed submission:
A,B = map(int,input().split())
R = [0,13,1,2,3,4,5,6,7,8,9,10,11,12]
if R[A]>R[B]:
  print("Alice")
elif R[A]<R[B]:
  print("Bob")
else:
  print("Draw")

Buggy submission (verdict: Runtime Error):
A,B = map(int,input())
R = [0,13,1,2,3,4,5,6,7,8,9,10,11,12]
if R[A]>R[B]:
  print("Alice")
elif R[A]<R[B]:
  print("Bob")
else:
  print("Draw")
Problem p03834 (python)

Fixed submission:
s = input().split(",")
print(" ".join(s))

Buggy submission (verdict: Runtime Error):
s = input().split()
print(s.join(" "))
Problem p02695 (python)

Fixed submission:
import itertools
n, m, q = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(q)]

num = 0
nax = 0

nums = [i for i in range(1, m+1)]

for com in list(itertools.combinations_with_replacement(nums, n)):
    num = 0
    for j in range(q):
        if com[l[j][1]-1]-com[l[j][0]-1] == l[j][2]:
            num += l[j][3]
    nax = max(num, nax)
print(nax)

Buggy submission (verdict: Runtime Error):
4 6 10
2 4 1 86568
1 4 0 90629
2 3 0 90310
3 4 1 29211
3 4 3 78537
3 4 2 8580
1 2 1 96263
1 4 2 2156
1 2 0 94325
1 4 3 94328
Problem p02699 (python)

Fixed submission:
n,m=map(int,input().split())
if n>m:
  print("safe")
else:
  print("unsafe")

Buggy submission (verdict: Runtime Error):
s = input()
si = int(s)
ans = 0
 
 
for i in range(1,300000//2019):
    d = 0
    while 1:
        if s.find(str(2019*i), d) != -1:
            ans = ans+1
            d = s.find(str(2019*i), d)+1
        else:
            break
 
print(ans)
Problem p02779 (python)

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
d=list(set(s))
if len(s)==len(d):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
a = sum(p[0:k])
l = [a]
for i in range(n-k):
    a = a-p[i]+p[i+k]
    l.append(a)
print((max(l)+k)/2)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
a = sum(p[0:k])
l = [a]
for i in range(n-k):
    a = a-p[i]+p[i+k]
    l.append(a)
print(l)
print((max(l)+k)/2)
Problem p02594 (python)

Fixed submission:
temp = int(input())
if temp >= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
temp = input()
if temp >= 30:
  print("Yes")
else:
  print("No")
Problem p02595 (python)

Fixed submission:
i1 = input()
i2 = int(i1.split(" ")[0])
i3 = int(i1.split(" ")[1])
i4 = 0
i5 = 0
i6 = 0
li = []
for i in range(i2):
  i4 = input().split(" ")
  i5 = (float(i4[1]) ** 2 + float(i4[0]) ** 2) ** 0.5
  if i3 >= abs(i5):
    i6 += 1
print(i6)

Buggy submission (verdict: Runtime Error):
i1 = input()
i2 = int(i1.split(" ")[0])
i3 = float(i1.split(" ")[1])
i4 = 0
i5 = 0
i6 = 0
li = []
for i in range(i2):
  i4 = input().split(" ")
  i5 = ((i4[1]) ** 2 - int(i4[0]) ** 2) ** 0.5
  if (i3 >= i5):
    i6 += 1
print(i6)

Buggy submission (verdict: Runtime Error):
i1 = input()
i2 = int(i1.split(" ")[0])
i3 = int(i1.split(" ")[1])
i4 = 0
i5 = 0
i6 = 0
li = []
for i in range(i2):
  i4 = input().split(" ")
  i5 = (int(i4[1]) ** 2 - int(i4[0]) ** 2) ** 0.5
  if (i3 >= i5):
    i6 += 1
print(i6)

Buggy submission (verdict: Runtime Error):
i1 = input()
i2 = int(i1.split(" ")[0])
i3 = int(i1.split(" ")[1])
i4 = 0
i5 = 0
i6 = 0
li = []
for i in range(i2):
  i4 = input().split(" ")
  i5 = (int(i4[1]) ** 2 - int(i4[0]) ** 2) ** 0.5
  if (i3 >= i5) {
    i6 += 1
  }
print(i6)
Problem p02729 (python)

Fixed submission:
N , M = map(int,input().split())
ans = 0
ans += N * (N - 1) // 2
ans += M * (M - 1) // 2

print( ans )

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

ans += N * (N - 1) / 2
ans += M * (M - 1) / 2

print( ans )
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()

if len(S)<=K:
  print(S)
else:
  print(S[:K]+'...')

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

if len(N)<=K:
  print(S)
else:
  print(S[:K]+'...')
Problem p02552 (python)

Fixed submission:
x = int(input())
# h_list = list(map(int, input().split()))

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

Buggy submission (verdict: Runtime Error):
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import plotly.express as px
import statsmodels.api as sm


x = int(input())
# h_list = list(map(int, input().split()))

if x == 0:
    print(1)
else:
    print(0)
Problem p02695 (python)

Fixed submission:
import itertools
 
N, M, Q = map(int, input().split())
 
int_tuple_list = list()
for i in range(Q):
    int_tuple_list.append(tuple(map(int, input().split())))
 
m_list = [i for i in range(1, M + 1)]
# print(m_list)
all_sequence_list = list()
score_list = list()
for sequence in itertools.combinations_with_replacement(m_list, N):
    # print(sequence)
    score_tmp = 0
    for ai, bi, ci, di in int_tuple_list:
        if ci == sequence[bi - 1] - sequence[ai - 1]:
            score_tmp += di
 
    # print(score_tmp)
    score_list.append(score_tmp)
 
print(max(score_list))

Buggy submission (verdict: Runtime Error):
import itertools

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

int_tuple_list = list()
for i in range(Q):
    int_tuple_list.append(tuple(map(int, input().split())))

m_list = [i for i in range(1, M + 1)]
# print(m_list)
all_sequence_list = list()
score_list = list()
for sequence in itertools.combinations(m_list, N):
    # print(sequence)
    score_tmp = 0
    for ai, bi, ci, di in int_tuple_list:
        if ci == sequence[bi - 1] - sequence[ai - 1]:
            score_tmp += di

    # print(score_tmp)
    score_list.append(score_tmp)

print(max(score_list))

Buggy submission (verdict: Runtime Error):
import itertools

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

int_tuple_list = list()
for i in range(Q):
    int_tuple_list.append(tuple(map(int, input().split())))

m_list = [i for i in range(1, M + 1)]
# print(m_list)
all_sequence_list = list()
score_list = list()
for sequence in itertools.permutations(m_list, N):
    # print(sequence)
    score_tmp = 0
    for ai, bi, ci, di in int_tuple_list:
        if ci == sequence[bi - 1] - sequence[ai - 1]:
            score_tmp += di

    # print(score_tmp)
    score_list.append(score_tmp)

print(max(score_list))
Problem p02729 (python)

Fixed submission:
n, m = map(int, input().split())
print(n*(n-1)//2+m*(m-1)//2)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
print(n(n-1)//2+m(m-1)//2)
Problem p02754 (python)

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

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
print(n//(a+b))*a+min((n%(a+b), a)