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

Fixed submission:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    N = int(input())

    alf = [chr(ord('a') + i) for i in range(26)]

    maxdigit = 1
    pre = 0

    while N - pre > 26 ** maxdigit:
        pre += 26 ** maxdigit
        maxdigit += 1


    # print(maxdigit,pre)

    N -= pre

    res = ''

    for d in range(1,maxdigit+1):
        for i in range(26):
            if N <= 26 ** (maxdigit - d) * (i + 1):
                res += alf[i]
                N -= 26 ** (maxdigit - d) * i
                break

    print(res)



main()

Buggy submission (verdict: Runtime Error):
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    N = int(input())

    alf = [chr(ord('a') + i) for i in range(26)]

    maxdigit = 1

    while N > 26 ** maxdigit:
        maxdigit += 1

    c = 26 ** (maxdigit - 1)

    res = ''

    for d in range(1,maxdigit+1):
        if d == maxdigit:
            res += alf[N-1]
            break
        for i in range(26):
            if N < c * (i+1):
                res += alf[i-1]
                N -= c * i
                c //= 26
                break

    print(res)



main()
Problem p02726 (python)

Fixed submission:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    N,X,Y = map(int,input().split())

    cost = [0 for i in range(N)]

    for i in range(1,N):
        for j in range(i,N+1):
            temp1 = abs(j-i)
            temp2 = abs(X-i) + 1 + abs(j-Y)
            temp3 = abs(Y-i) + 1 + abs(j-X)
            temp = min(temp1,temp2,temp3)
            cost[temp] += 1

    for k in range(1,N):
        print(cost[k])



main()

Buggy submission (verdict: Runtime Error):
import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    N,X,Y = map(int,input().split())

    d = [ [ 0 for j in range(N) ] for i in range(N) ]
    d = np.array(d)

    for i in range(N-1):
        for j in range(i,N):
            temp1 = abs(j-i)
            temp2 = abs(X-i) + 1 + abs(j-Y)
            temp3 = abs(Y-i) + 1 + abs(j-X)
            d[i,j] = min(tem1,temp2,temp3)

    for k in range(1,N):
        res = np.count_nonzero(d == k)
        print(res)



main()
Problem p02659 (python)

Fixed submission:
A,B = input().split()
B = B[:-3] + B[-2:]
C = int(A) * int(B) // 100
print(C)

Buggy submission (verdict: Runtime Error):
import math
A,B = input().split()

if (float(B) - (int(float(B)))) * 100 * 100 == 28.99999999999999:
    D = 29 + int(float(B)) * 100
elif (float(B) - (int(float(B)))) * 100 * 100 == 57.99999999999999:
    D = 58 + int(float(B)) * 100
else:
    D = int(float(B) * 100)

C = math.floor(int(A) * int(B) / 100)
print(C)
Problem p02723 (python)

Fixed submission:
S=input()
if S[2] == S[3]:
    if S[4] == S[5]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S=input()
if S[3] == S[4]:
    if S[5] == S[6]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Problem p02831 (python)

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

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

lcm = A * B // gcd(A,B)
print(lcm)

Buggy submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
lcm = A * B // math.gcd(A,B)
print(lcm)

Buggy submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
print(int(A * B / math.gcd(A,B)))
Problem p02622 (python)

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

ans = 0

for i in range(len(S)):
  ans += (S[i]!=T[i])

print(ans)

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

ans = 0

for i in range(len(S)):
  ans += (S[i]=T[i])

print(ans)
Problem p02623 (python)

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


def Cum(X):
    temp = 0
    Cum = [0]*len(X)
    for i in range(len(X)):
        temp += X[i]
        Cum[i] += temp
    return Cum

a = Cum(A)
a.insert(0,0)
b = Cum(B)
b.insert(0,0)

na = 0
for i in range(N+1):
    if i == N and a[i]<=K:
        na = N
    elif a[i]<=K and a[i+1]>K:
        na = i

ans = na

nb = 0
for i in range(na,-1,-1):
    temp = K-a[i]
    for j in range(nb,M+1):
        if j == M and b[j] <= temp:
            nb = M
            ans = max(ans,i+nb)
        elif b[j]<=temp and b[j+1]>temp:
            nb = j
            ans = max(ans,i+nb)
            break
        
print(ans)

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


def Cum(X):
    temp = 0
    Cum = [0]*len(X)
    for i in range(len(X)):
        temp += X[i]
        Cum[i] += temp
    return Cum

a = Cum(A)
a.insert(0,0)
b = Cum(B)
b.insert(0,0)

na = 0
for i in range(N+1):
    if i == N and a[i]<=K:
        na = N
    elif a[i]<=K and a[i+1]>K:
        na = i

ans = na
temp = K-a[na]
nb = 0
for i in range(na,-1,-1):
    for j in range(nb,M+1):
        if j == M and b[i] <= temp:
            nb = M
        elif b[j]<=temp and b[j+1]>temp:
            nb = j
        ans = max(ans,i+nb)
print(ans)

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


def Cum(X):
    temp = 0
    Cum = [0]*len(X)
    for i in range(len(X)):
        temp += X[i]
        Cum[i] += temp
    return Cum

a = Cum(A)
a = a.insert(0,0)
b = Cum(B)
b = b.insert(0,0)


def f(X,x,target):
    return X[x]-target

def nibutan(X):
    num = list(range(len(X)))
    lo = 0
    hi = len(X)
    while hi-lo>=2:
        mid = (lo+hi)//2
        if f(X,mid,Y)<=0:
            lo = mid
        else:
            hi = mid
    return lo

ans = 0
for i in range(N):
    if K-a[i]>=0:
        Y = K-a[i]
        ans = max(nibutan(b)+i,ans)
    else:
        break
print(ans)
Problem p02757 (python)

Fixed submission:
from collections import Counter

N, P = map(int, input().split())
S = list(map(int,list(input())))

def solve_2(S):
    ind = (i for i, x in enumerate(S, 1) if x % 2 == 0)
    return sum(ind)

def solve_5(S):
    ind = (i for i, x in enumerate(S, 1) if x % 5 == 0)
    return sum(ind)

def solve(S,P):
    if P == 2:
        return solve_2(S)
    if P == 5:
        return solve_5(S)
    S = S[::-1]
    T = [0] * len(S)
    T[0] = S[0] % P
    power = 1
    for i in range(1, len(S)):
        power *= 10
        power %= P
        T[i] = T[i-1] + power * S[i]
        T[i] %= P
    counter = Counter(T)
    return sum(x * (x - 1) // 2 for x in counter.values()) + counter[0]


print(solve(S,P))

Buggy submission (verdict: Runtime Error):
dp = [[0 for i in range(N-j)] for j in range(N)]
dp
for j in range(N):
    dp[j][0]=(int(S[j])%mod)
    for i in range(1,N-j):
        dp[j][i]=((dp[j][i-1]*10+int(S[j+i]))%mod)
ans = 0
for i in range(N):
    ans += dp[i].count(0)
    
print(ans)
Problem p02762 (python)

Fixed submission:
class UnionFind(object):
    def __init__(self, n=0):
        self.par = [i for i in range(n)]
        self.rank = [-1 for _ in range(n)] 

    def find(self, x):
        if self.rank[x] < 0:
            return x
        else:
            self.rank[x] = self.find(self.rank[x])
            return self.rank[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return 0

        if abs(x) < abs(y): 
            x, y = y, x 
        self.rank[x] += self.rank[y]
        self.rank[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def size(self, x):
        return -self.rank[self.find(x)]

n,m,k=map(int, input().split())
uf=UnionFind(n)
friend = [0]*n
for i in range(m):
    a,b=map(int, input().split())
    friend[a-1] +=1
    friend[b-1] +=1
    uf.union(a-1,b-1)

block = [[] for _ in range(n)]
for i in range(k):
    x,y=map(int, input().split())
    block[x-1].append(y-1)
    block[y-1].append(x-1)

ans = [0]*n
for i in range(n):
    ans[i] = uf.size(i)-1-friend[i]
    for j in block[i]:
        if uf.same(i,j):
            ans[i] -= 1
    ans[i] = str(ans[i])
    
print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
class UnionFind(object):
    def __init__(self, n=0):
        self.par = [i for i in range(n)]
        self.rank = [-1 for _ in range(n)]
        
    def find(self, x):
        if self.rank[x] < 0:
            return x
        else:
            self.rank[x] = self.find(self.rank[x])
            return self.rank[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if abs(x) < abs(y):
            x, y = y, x
        self.rank[x] += self.rank[y]
        self.rank[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

n,m,k=map(int, input().split())
uf=UnionFind(n)
friend = [0]*n
for i in range(m):
    a,b=map(int, input().split())
    friend[a-1] +=1
    friend[b-1] +=1
    uf.union(a-1,b-1)

block = [[] for _ in range(n)]
for i in range(k):
    x,y=map(int, input().split())
    block[x-1].append(y-1)
    block[y-1].append(x-1)

ans = [0]*n
for i in range(n):
    ans[i] = uf.size(i)-1-friend[i]
    for j in block[i]:
        if uf.same(i,j):
            ans[i] -= 1
    ans[i] = str(ans[i])
    
print(" ".join(ans))
Problem p02831 (python)

Fixed submission:
A, B = map(int, input().split())
import fractions
print(A*B//fractions.gcd(A,B))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
import math
print(A*B//math.gcd(A,B))
Problem p02832 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
c = 0
for a in A:
    if a == c + 1:
        c = a
    
if c == 0:
    print(-1)
else:
    print(N-c)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = set(sorted(A))
k = 1
a = 0
b = []
for i in B:
    if i != k:
        break
    j = A.index(i)
    a += j+1
    b.append(a)
    A = A[j+1:]
    if a == N:
        break
    k += 1
    
if b == []:
    print(-1)
else:
    print(N-len(b))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = set(sorted(A))
k = 1
a = 0
b = []
for i in B:
    j = A.index(i)
    if i != k:
        break
    a += j+1
    b.append(a)
    A = A[j+1:]
    if a == N:
        break
    k += 1
    
if b == []:
    print(-1)
else:
    print(N-len(b))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
C = sort(A)
B = set(C)
K = len(set(A))
k = 1
a = 0
b = []
while i in B:
    j = A.index(i)
    if i != k:
        break
    a += j+1
    b.append(a)
    a = A[j+1:]
    if a == N:
        break
    k += 1
    
if b == []:
    print(-1)
else:
    print(N-len(b))
Problem p02880 (python)

Fixed submission:
N = int(input())
ans = 0

for i in range(1,10):
    for j in range(1,10):
        if N == i*j:
            ans += 1

if ans >= 1:
    print("Yes")
else:
    print("No")

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

for i in range(1,10):
    for j in range(1,10):
        if N = i*j:
            ans += 1

if ans >= 1:
    print("Yes")
else:
    print("No")
Problem p02831 (python)

Fixed submission:
import fractions
A, B = map(int, input().split())
print(A * B // fractions.gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(A * B // math.gcd(A, B))

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

import math 

print(A * B // math.gcd(A, B))
Problem p02881 (python)

Fixed submission:
N = int(input())

i = int(N ** (1/2))
ans = 10 **13

while i > 0:
  if N % i == 0:
    ans = min(ans, i + N // i -2)
  i -= 1


print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = []
for a in range(1, int(N ** (1/2))):
  if N % a == 0:
    ans.append(a + N // a - 2)
print(min(ans))
Problem p02951 (python)

Fixed submission:
A,B,C = map(int,input().split())
if C-(A-B)>=0:
    print(C-(A-B))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if C-(a-B)>=0:
    print(C-(A-B))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if C-(a-B)=>0:
    print(C-(A-B))
else:
    print(0)
Problem p02572 (python)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
B = [0] * (N+1)  # 累積和テーブル B[i] = sum(A[:i])
mod = 10**9 + 7
ans = 0

for i in range(N):
    B[i+1] = B[i] + A[i]  # 累積和

for i in range(N):
    sum = (B[N] - B[i+1]) % mod
    ans += A[i] * sum
    ans %= mod

print(int(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = []  # 累積和テーブル B[i] = sum(A[:i])
mod = 10**9 + 7
ans = 0

for i in range(N):
    B[i+1] = B[i] + A[i]  # 累積和

for i in range(N):
    sum = (B[N] - B[i+1]) % mod
    ans += A[i] * sum
    ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split())
B = []  # 累積和テーブル B[i] = sum(A[:i])
mod = 10**9 + 7
ans = 0

for i in range(N+1):
    B.append(sum(A[:i]))  # 累積和

for i in range(N):
    sum = (B[N] - B[i+1]) % mod
    ans += A[i] * sum
    ans %= mod

print(ans)
Problem p02549 (python)

Fixed submission:
N,K = map(int,input().split())
LR = [list(map(int,input().split())) for i in range(K)]
LR.sort()
mod = 998244353
ma = [0] * N
ma[0] = 1
for i in range(N):
    if i >1:
        ma[i] += ma[i-1]
    p = ma[i]%mod
    if p != 0:
        for l,r in LR:
            if i+l <N:
                ma[i+l] += p
            else:
                break
            if i+r+1<N:
                ma[i+r+1] -= p
print(ma[N-1]%mod)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
LR = [list(map(int,input().split())) for i in range(K)]
LR.sort()
mod = 998244353
ma = [0] * N
ma[0] = 1
for i in range(N):
    if ma[i] != 0:
        for l,r in LR:
            for j in range(l,r+1):
                if i+j < N:
                    ma[i+j] += ma[i]
                else:
                    f = 1
                    break
            if f:
                break
print(ma[N-1]%mod)
Problem p03013 (python)

Fixed submission:
N,M = map(int,input().split())
A = [int(input()) for i in range(M)]
n = 0
if M != 0:
    a = b = A[0]
else:
    a = b = -2
c = 0
ans = [0,1]
for i in range(1,N+1):
    if  i == a:
        c = 0
        n += 1
        b = a
        if n <= M-1:
            a = A[n]
    elif i-2 == b:
        c = ans[-1]
    elif i-1 == b :
        c = ans[-2]
    else:
        c  = ans[-1] + ans[-2]
    c %= 10**9 + 7
    ans.append(c)
print(ans[-1])

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = [int(input()) for i in range(M)]
a = b = A[0]
n = 0
c = 0
ans = [0,1]
for i in range(1,N+1):
    if  i == a:
        c = 0
        n += 1
        b = a
        if n <= M-1:
            a = A[n]
    elif i-2 == b:
        c = ans[-1]
    elif i-1 == b :
        c = ans[-2]
    else:
        c  = ans[-1] + ans[-2]
    c %= 10**9 + 7
    ans.append(c)
print(ans[-1])
Problem p03835 (python)

Fixed submission:
K,S = map(int,input().split())
x = y = S//3
z = S - x - y
if z < y:
    x = z
    z = y
ans = 0
while 0 <= x <= y and 0<= y <=K and z <= K:
    while 0 <= x and z <= K:
        if x == y == z:
            ans += 1
        elif x == y or y == z:
            ans += 3
        else:
            ans += 6
        x -= 1
        z += 1
    y -= 1
    x = y
    z = S - x - y
    if z < y:
        x = z
        z = y
x = y = S//3 + 1
z = S - x - y
if z < y:
    x = z
    z = y
while 0 <= x <= y and 0 <= y <= K and y <= z <= K:
    while 0 <= x and z <= K:
        if x == y == z:
            ans += 1
        elif x == y or y == z:
            ans += 3
        else:
            ans += 6
        x -= 1
        z += 1
    y += 1
    x = y
    z = S - x - y
    if z < y:
        x = z
        z = y
print(ans)

Buggy submission (verdict: Runtime Error):
x = y = S//3 + 1
z = S - x - y
if z < y:
    x = z
    z = y
while 0 <= x <= y and 0 <= y <= K and y <= z <= K:
    while 0 <= x and z <= K:
        if x == y == z:
            ans += 1
        elif x == y or y == z:
            ans += 3
        else:
            ans += 6
        x -= 1
        z += 1
    y += 1
    x = y
    z = S - x - y
    if z < y:
        x = z
        z = y
print(ans)
Problem p02695 (python)

Fixed submission:
import sys
input = sys.stdin.readline
from collections import deque
ANS = 0
SUM = 0
def dfs(arr, l):
    global SUM, ANS
    # print(arr)
    if l == N:
        for i in range(Q):
            # print(arr[A[i][1]-1]-arr[A[i][0]-1])

            if arr[A[i][1]-1]-arr[A[i][0]-1] == A[i][2]:
                SUM += A[i][3]
            ANS = max(SUM, ANS)
        SUM = 0
        return
    else:
        for i in range(arr[l-1], M+1):
            arr.append(i)
            l = len(arr)
            # print(arr)
            dfs(arr,l)
            arr.pop()

    return ANS

if __name__ == '__main__':
    N, M ,Q = map(int, input().split())
    A = [list(map(int, input().split())) for i in range(Q)]
    ARR = deque([1])
    dfs(ARR,1)
    print(ANS)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def main():
    N, M, Q = map(int, input().split())
    R = [list(map(int, input().split())) for i in range(Q)]
    ARR = [0]*N
    SUM = 0
    ANS = 0
    for i in nums:
        if ARR[R[i][0]-1] != 0:
            A = ARR[R[i][0]-1] 
        else:
            ARR[R[i][0]-1] = 1 
            A = ARR[R[i][0]-1] 
        if ARR[R[i][1]-1] != 0:
            B = ARR[R[i][1]-1]
        else:
            ARR[R[i][1]-1] = ARR[R[i][0]-1] + R[i][2]
        if ARR[R[i][1]-1]-ARR[R[i][0]-1] == R[i][2]:
            SUM += R[i][3]
        if max(ARR) - min(ARR) <= M:
            ANS = max(ANS, SUM)
        SUM = 0
    print(ANS)

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

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

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
row = str('b')*a
while len(row) < n:
    if a == 0:
        print(0)
        break

    row += str('r')*b + str('b')*a
ans = row[0:n].count('b')
print(ans)
Problem p02831 (python)

Fixed submission:
import fractions
A, B = map(int, input().split())
ans = A*B//fractions.gcd(A,B)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
ans = int(A*B/math.gcd(A,B))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
ans = int(A*B/math.gcd(A,B))
print(ans)
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()
if N%2 == 0:
  if S[:N//2] == S[N//2:]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
if N%2 == 0:
  if S[:N//2+1] == [N//2:]:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Problem p02879 (python)

Fixed submission:
A, B = map(int, input().split())
if A<10 and B<10:
  print(A*B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
A, B = map(input().split())
if A<10 and B<10:
  print(A*B)
else:
  print(-1)
Problem p02880 (python)

Fixed submission:
n = int(input())
flag = False
for i in range(1,10):
  if n%i == 0 and 0 < n/i < 10:
    flag = True
    break
if flag:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
flag = false
for i in range(1,10):
  if n%i == 0 and 0 < n/i < 10:
    flag = True
    break
if flag:
  print("Yes")
else
  print("No")
Problem p02951 (python)

Fixed submission:
A, B, C = map(int, input().split())
print(max(C - (A-B), 0))

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
print(max(C - (A-B), 0)
Problem p03072 (python)

Fixed submission:
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    H = list(map(int, input().split()))
    if N == 1:
        return print(1)
    CNT = 1
    High = H[0]
    for i in range(1,N):
        if H[i] >= High:
            CNT += 1
            High = H[i]
        
    return print(CNT)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    H = list(map(int, input().split()))
    CNT = 1
    if H[1] >= H[0]:
        CNT += 2
        High = H[1]
    else:
        High = H[0]
    for i in range(2,N):
        if H[i]>=H[i-1] and H[i]>=High:
            CNT += 1
    print(CNT)

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

Fixed submission:
import sys
input = sys.stdin.readline
def gdc(p, q):
    if q == 0:
        return p
    return gdc(q, p%q)

def main():
    N = int(input())
    A = list(map(int, input().split()))
    if N == 1:
        print(A[0])
        return
    res = A[0]
    for i in range(1,N):
        res = gdc(res, A[i])
    print(res)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def gdc(p, q):
    if q <= 0:
        return p
    p -= q
    return gdc(max(p,q), min(p,q))

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A_sorted = sorted(A)
    print(gdc(A[1], A[0]))


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

Fixed submission:
k, s = map(int, input().split())
arr = [1 for x in range(k+1) for y in range(k+1) if k >= s-x-y >= 0]
print(sum(arr))

Buggy submission (verdict: Runtime Error):
k, s = map(int, input().split())
ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if k >= z >= 0:
            ans += 1
print(ans))

Buggy submission (verdict: Runtime Error):
k, s = map(int, input().split())
ans = 0
for x in range(k+a):
    for y in range(k+1):
        z = s-x-y
        if k >= z >= 0:
            ans += 1
print(ans))
Problem p02577 (python)

Fixed submission:
if int(input()) % 9 == 0 : print("Yes")
else : print("No")

Buggy submission (verdict: Runtime Error):
if int(input()) % 9 == 0 : print("Yes")
else print("No")
Problem p03774 (python)

Fixed submission:
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]

for a, b in ab:
    dis = 4 * 10**8
    for i in range(m):
        (c, d) = cd[i]
        tmp = abs(a-c)+abs(b-d)
        if dis > tmp:
            ans = i
            dis = tmp
    print(ans+1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]

for a, b in ab:
    res = 10**8
    for i in range(m):
        (c, d) = cd[i]
        dist = abs(a-c)+abs(b-d)
        if dist < res:
            ans = i
        res = min(res, dist)
    print(ans+1)
Problem p02594 (python)

Fixed submission:
A = int(input())
if 30 <= A:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A = input(int())
if 30 <= A:
    print("Yes")
else:
    print("No")
Problem p02659 (python)

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

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