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

Fixed submission:
N, K = map(int, input().split())
mem = set()
for _ in range(K):
  _ = input()
  mem = mem | set(map(int, input().split()))

mem_count = len(mem)
print(N-mem_count)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
mem = set()
for _ in range(K):
  _ = input()
  mem = mem | {input().split()}

mem_count = len(mem)
print(N-mem_count)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
mem = set()
for _ in range(K):
  _ = input()
  mem = mem | {input().split()}
mem_count = len(mem)
print(N-mem_count)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
mem = {}
for _ in range(K):
  _ = input()
  mem = mem | {input().split()}

mem_count = len(mem)
print(N-mem_count)
Problem p02571 (python)

Fixed submission:
s = input()
t = input()

s_len =len(s)
t_len =len(t)
count = 0
ans = []



for i in range(s_len - t_len + 1):
    for j in range(t_len):
        if s[i:t_len + i][j] != t[j]:
            count += 1
    ans.append(count)
    count = 0

min_ans = min(ans)
print(min_ans)

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

s_len =len(s)
t_len =len(t)
count = 0
ans = []



for i in range(s_len - t_len):
    for j in range(t_len):
        if s[i:t_len + i][j] != t[j]:
            count += 1
    ans.append(count)
    count = 0

min_ans = min(ans)
print(min_ans)

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

s_len =len(s)
t_len =len(t)
count = 0



for i in range(s_len - t_len):
    for j in range(t_len):
        if s[i:t_len][j] != t[j]
            count += 1
    print(count)
Problem p02659 (python)

Fixed submission:
from math import floor
from decimal import Decimal
a, b = input().split()
a = int(a)
b = Decimal(b)
print(floor(a * b))

Buggy submission (verdict: Runtime Error):
A = int(input()) #ここで標準入力
B = float(input()) #ここで標準入力


output = A * B
print(int(output))
Problem p02682 (python)

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

if K - A - B > 0:
    print(1 * A - (K - A - B) * 1)

elif K - A < 0:
    print(1 * K)

elif K - A - B <= 0:
    print(1 * A)

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

if K - A - B > 0:
    print(1 * A - (K - A - B) * 1)

elif K - A < 0:
    print(1 * K)

else K - A - B <= 0:
    print(1 * A)
Problem p02546 (python)

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

print (solution())

Buggy submission (verdict: Runtime Error):
S = input()
if S[-1] = 's':
  return S + 'es'
else:
  return S + 's'
Problem p02552 (python)

Fixed submission:
def a():
  x :int = int(input())
  if x == 1:
    return 0
  else:
    return 1

if __name__ == '__main__':
  print(a())

Buggy submission (verdict: Runtime Error):
input = int(input())
if input == 0: return 1
return 0
Problem p02578 (python)

Fixed submission:
n = int(input())

a = list(map(int, input().split()))


highest = 0
ans = 0

for i in a:
    if i > highest:
        highest = i
    ans += highest - i

print(ans)

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

a = list(map(int, input().split()))

n = max(a)

highest = 0
last = 0
for i in range(n):
    if a[i] >= highest:
        highest = a[i]
        last = i

shortest = highest
for j in range(0, i):
    if a[j] <= shortest:
        shortest = a[j]
        #print(shortest)

print(highest - shortest)
Problem p02580 (python)

Fixed submission:
h, w, m = map(int, input().split())
h_l = [[] for i in range(h + 1)]
w_l = [[] for i in range(w + 1)]
max_h = 0
max_h_l = []
max_w = 0
max_w_l = []
inputs = {}
for _ in range(m):
    h, w = map(int, input().split())
    inputs.setdefault(h, set([w]))
    inputs[h].add(w)

    if h_l[h] :
        h_l[h][1].add(w)
        h_l[h][0] += 1
    else:
        h_l[h] = [1, set([w])]
        
    if h_l[h][0] > max_h:
        max_h_l = [h]
        max_h = h_l[h][0]
    elif h_l[h][0] == max_h:
        max_h_l.append(h)
 
        
    if w_l[w]:
        w_l[w][1].add(h)
        w_l[w][0] += 1
    else:
        w_l[w] = [1, set([h])]
    if w_l[w][0] > max_w:
        max_w_l = [w]
        max_w = w_l[w][0]
    elif w_l[w][0] == max_w:
        max_w_l.append(w)

ans = max_h + max_w -1
flag = 0
for i in max_h_l:
    if flag == 1:
        break
    for j in max_w_l:
        if j not in inputs[i]:
            ans = max_h + max_w
            flag = 1
            break
        
print(ans)

Buggy submission (verdict: Runtime Error):
h, w, m = map(int, input().split())
h_l = [[] for i in range(h + 1)]
w_l = [[] for i in range(w + 1)]
max_h = 0
max_h_l = []
max_w = 0
max_w_l = []
for _ in range(m):
    h, w = map(int, input().split())
    if h_l[h] :
        h_l[h][1].append(w)
        h_l[h][0] += 1
    else:
        h_l[h] = [1, [w]]
        
    if h_l[h][0] > max_h:
        max_h_l = [h]
        max_h = h_l[h][0]
    if h_l[h][0] == max_h:
        max_h_l.append(h)
            
 
        
    if w_l[w]:
        w_l[w][1].append(h)
        w_l[w][0] += 1
    else:
        w_l[w] = [1, [h]]
    if w_l[w][0] > max_w:
        max_w_l = [w]
        max_w = w_l[w][0]
    if w_l[w][0] == max_w:
        max_w_l.append(w)
 
 
flag = 0
ans = 0
for i in max_h_l:
    if flag == 1:
        break
    for j in max_w_l:
        if flag == 1:
            break
        if j in h_l[i][1]:
            ans = max_h + max_w - 1
        else:
            ans = max_h + max_w
            flag = 1
print(ans)
h, w, m = map(int, input().split())
h_l = [[] for i in range(h + 1)]
w_l = [[] for i in range(w + 1)]
max_h = 0
max_h_l = []
max_w = 0
max_w_l = []
for _ in range(m):
    h, w = map(int, input().split())
    if h_l[h] :
        h_l[h][1].append(w)
        h_l[h][0] += 1
    else:
        h_l[h] = [1, [w]]
        
    if h_l[h][0] > max_h:
        max_h_l = [h]
        max_h = h_l[h][0]
    if h_l[h][0] == max_h:
        max_h_l.append(h)
            

        
    if w_l[w]:
        w_l[w][1].append(h)
        w_l[w][0] += 1
    else:
        w_l[w] = [1, [h]]
    if w_l[w][0] > max_w:
        max_w_l = [w]
        max_w = w_l[w][0]
    if w_l[w][0] == max_w:
        max_w_l.append(w)


flag = 0
ans = 0
for i in set(max_h_l):
    if flag == 1:
        break
    for j in set(max_w_l):
        if flag == 1:
            break
        if j in h_l[i][1]:
            ans = max_h + max_w - 1
        else:
            ans = max_h + max_w
            flag = 1
print(ans)
Problem p02594 (python)

Fixed submission:
n = int(input())

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

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))

floor = 0
ceil = max(a)


def cut(long, logs):
    cnt = 0
    for i in logs:
        cnt += math.ceil(i / long) - 1
    return cnt


while ceil - floor > 1:
    L = (ceil + floor)//2
    num = cut(L, a)
    if num <= k:
        ceil = L
    else:
        floor = L

print(ceil)
Problem p02729 (python)

Fixed submission:
import  math

n,m = map(int,input().split())

def ans(a):
    if a<2:
        return 0
    else:
        return math.factorial(a) // (math.factorial(a - 2) * math.factorial(2))

print(int(ans(n) + ans(m)))

Buggy submission (verdict: Runtime Error):
import  math

n,m = map(int,input().split())

ans = (math.factorial(n) // (math.factorial(n - 2) * math.factorial(2)))  + (math.factorial(m) // ((math.factorial(m - 2) * math.factorial(2))))
print(ans)
Problem p02831 (python)

Fixed submission:
import math

a,b = map(int,input().split())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a_ = prime_factorize(a)
b_ = prime_factorize(b)

for i in a_:
    if i in b_:
        b_.remove(i)

for j in b_:
    a *= j

print(a)

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())



def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))
Problem p02897 (python)

Fixed submission:
n = int(input())

if n % 2 == 0:
    print("0.5")
else:
    print(((n - 1)/2 + 1)/n)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
cnt = 0
ans = []

for i in range(n):
    cnt += 1
    ind = a.index(cnt)
    ans.append(str(ind + 1))

print(" ".join(ans))
Problem p03011 (python)

Fixed submission:
a=list(map(int,input().split()))
a.remove(max(a))
print(sum(a))

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
a.pop(max(a))
print(sum(a))
Problem p03036 (python)

Fixed submission:
r,d,x = map(int,input().split())
 
for i in range(10):
  x = r*x - d
  print(x)

Buggy submission (verdict: Runtime Error):
r,d,x = map(int,input())

for i in range(10):
  x = r*x - d
  print(r)
Problem p03250 (python)

Fixed submission:
a = list(map(int,input().split()))
 
print(max(a) * 9 + sum(a))

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

print(max(a) * 9 + sum(a))

Buggy submission (verdict: Runtime Error):
S = str(input())
T = str(input())
S_d = {}
T_d = {}
for i,j in zip(S,T):
    if i in S_d and j in T_d:
        if S_d[i] == T_d[j]:
            pass
        else:
            print("No")
            break
    else:
        if i in S_d or j in T_d:
            print("No")
            break
        else:
            S_d[i] = S.count(S)
            T_d[j] = T.count(T)
        
else:
    print("Yes")
Problem p03053 (python)

Fixed submission:
from collections import deque
H,W = map(int,input().split())
maze = []
for i in range(H):
    maze.append(input())
q = deque()
saitan = [1000000]*H*W
for i in range(H):
    for k in range(W):
        if maze[i][k] == '#':
            q.append(i*W+k)
            saitan[i*W+k] = 0
len_q = len(q)

#print(start)
def bfs(h,w,q,Saitan,len_Q):
    
    dx = [1,-1,0,0]
    dy = [0,0,1,-1]
    while len(q)>0 and len_Q < h * w:
        j = q.popleft()
        y = int(j/w)
        x = j%w
        #print(saitan)
        for k in range(4):
            my = y + dy[k]
            mx = x + dx[k]
            #print(sx,sy,j,x,y,mx,my)
            if not((0 <=my <= h-1) and (0 <= mx <= w-1)):
                #print('q')
                continue
            if saitan[(my*w + mx)] <= saitan[y*w + x] + 1:
                #print('c')
                continue
                
            saitan[(my*w + mx)] = saitan[y*w + x] + 1
            q.append(my*w + mx)
            len_Q += 1
            #Sumi.append(my*w + mx)
    return max(saitan)

print(bfs(H,W,q,saitan,len_q))
#print(saitan)

Buggy submission (verdict: Runtime Error):
from collections import deque
H,W = map(int,input().split())
maze = []
for i in range(H):
    maze.append(input())
q = deque()
saitan = [1000000]*H*W
start = []
for i in range(H):
    for k in range(W):
        if maze[i][k] == '#':
            start.append(i*W+k)

for i in start:
    q.append(i)
    saitan[i] = 0
#print(start)
def bfs(h,w,q,Saitan):
    
    dx = [1,-1,0,0]
    dy = [0,0,1,-1]
    while len(q)>0:
        j = q.popleft()
        y = int(j/w)
        x = j%w
        #print(saitan)
        for k in range(4):
            my = y + dy[k]
            mx = x + dx[k]
            #print(sx,sy,j,x,y,mx,my)
            if not((0 <=my <= h-1) and (0 <= mx <= w-1)):
                #print('q')
                continue
            if saitan(my*w + mx) != 1000000:
                #print('b')
                continue
            if saitan[(my*w + mx)] <= saitan[y*w + x] + 1:
                #print('c')
                continue
                
            saitan[(my*w + mx)] = saitan[y*w + x] + 1
            q.append(my*w + mx)
            #Sumi.append(my*w + mx)
    return max(saitan)

print(bfs(H,W,q,saitan))
#print(saitan)
Problem p03835 (python)

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

#count
counter = 0
for x in range(0,K+1):
    for y in range(0,K+1):
        z = S - x - y
        if 0 <= z <= K:
            counter = counter + 1

#print
print(counter)

Buggy submission (verdict: Runtime Error):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    ts=LIST()
    m=INT()
    xs=[0]*m
    for i in range(m):
        p,x=INTM()
        xs[i]=ts[p-1]-x
    tst=sum(ts)
    for i in range(m):
        #print(xs[i])
        print(tst-xs[i])
    #print(ts)
if __name__ == '__main__':
    do()
Problem p02577 (python)

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

Buggy submission (verdict: Runtime Error):
N = input()
tmp = 0
while N > 0:
    tmp += (N % 10)
    N /= 10
if tmp % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = input()
tmp = 0
while N > 0:
  tmp += (N % 10)
  N /= 10
if tmp % 9 == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
tmp = 0
while N > 0:
  tmp += (N % 10)
  N /= 10
if tmp % 9 == 0:
  print("Yes")
else:
  print("No")
Problem p02578 (python)

Fixed submission:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = MAP()
prev = -INF
ans = 0
for a in A:
    if a < prev:
        ans += (prev - a)
    else:
        prev = a
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
tmp = 0
while N > 0:
    tmp += (N % 10)
    N /= 10
if tmp % 9 == 0:
    print("Yes")
else:
    print("No")
Problem p02726 (python)

Fixed submission:
N, X, Y = list(map(int, input().split()))
res = [0] * N
for i in range(1, N + 1):
    for j in range(1, N + 1):
        if i >= j:
            continue
        if i == X and Y == j:
            key = 1
        else:
            key = int(min(j - i, abs(X - i) + abs(Y - j) + 1))
        res[key] += 1

for i in range(1, N):
    print(res[i])

Buggy submission (verdict: Runtime Error):
N, X, Y = list(map(int, input().split()))
res = [0] * (n-1)
for i in range(1, N + 1):
    for j in range(1, N + 1):
        if i >= j:
            continue
        if i == X and Y == j:
            key = 1
        else:
            key = int(min(j - i, abs(X - i) + abs(Y - j) + 1))
        res[key] += 1

for i in range(1, N):
    print(res[i])
Problem p02763 (python)

Fixed submission:
from bisect import insort_left, bisect_left
n = int(input())
s = list(input())
Q = int(input())
query = [input() for _ in range(Q)]
dic = {chr(i+ord('a')):[] for i in range(26)}
for ind, c in enumerate(s):
    dic[c].append(ind)

for q in query:
    t, a, b = q.split()
    a = int(a)-1
    if t=='1':
        if s[a]==b:
            continue
        ind = bisect_left(dic[s[a]], a)
        dic[s[a]].pop(ind)
        insort_left(dic[b], a)
        s[a] = b
    else:
        b = int(b)-1
        tmp = 0
        for li in dic.values():
            if li and a<=li[-1] and li[bisect_left(li, a)] <= b:
                tmp += 1
        print(tmp)

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

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

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

    indices_dict = {a: [] for a in characters}
    for i, s in enumerate(S):
        indices_dict[s].append(i + 1)

    for i in range(Q):
        a, b, c = input().split()
        if int(a) == 2:
            l, r = int(b), int(c)
            cnt = 0
            for c in characters:
                if len(indices_dict[c]) > 0 and \
                    l <= indices_dict[c][-1] and \
                    indices_dict[c][bisect_left(indices_dict[c], l)] <= r:
                    cnt += 1
            print(cnt)
        else:
            from_c = S[ind - 1]
            ind, to_c = int(b), c
            if from_c == to_c:
                continue
            insort_left(indices_dict[to_c], ind)
            indices_dict[from_c].pop(bisect_left(indices_dict[from_c], ind))
            S[ind] = to_c

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import bisect

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

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

    indices_dict = {a: [] for a in characters}
    for i, s in enumerate(S):
        indices_dict[s].append(i + 1)

    for i in range(Q):
        a, b, c = input().split()
        if int(a) == 2:
            l, r = int(b), int(c)
            cnt = 0
            for c in characters:
                l_ind = bisect.bisect_left(indices_dict[c], l)
                r_ind = bisect.bisect_right(indices_dict[c], r)
                if l_ind != r_ind:
                    cnt += 1
            print(cnt)
        else:
            ind, to_c = int(b), c
            bisect.insort_left(indices_dict[to_c], ind)
            from_c = S[ind - 1]
            indices_dict[from_c].pop(bisect.bisect_left(indices_dict[from_c], ind))

if __name__ == "__main__":
    main()
Problem p02550 (python)

Fixed submission:
n, x, m = map(int,input().split())
rem = [0] * m
chk = [0] * (m + 1)
rem[0] = x
if x == 0:
  print(0)
  exit()

for i in range(1,m):
  rem[i] = (rem[i - 1] ** 2) % m
  if chk[rem[i - 1] ** 2 % m] > 1:
    temp1 = (rem[i - 1] ** 2) % m
    temp2 = i
  else:
    temp1 = (rem[i - 1] ** 2) % m
    temp2 = i

for i in range(m):
  if rem[i] == temp1:
    temp3 = i
    break

if temp2 != temp3:
  num = (n - temp3) // (temp2 - temp3)
  S = sum(rem[:temp3]) + sum(rem[temp3:temp2]) * num + sum(rem[temp3:n - (num * (temp2 - temp3))])
  print(S)
else:
  print(sum(rem))

Buggy submission (verdict: Runtime Error):
n, x, m = map(int,input().split())
rem = [0] * m
chk = [0] * (m + 1)
rem[0] = x
for i in range(1,m):
  rem[i] = (rem[i - 1] ** 2) % m
  if chk[rem[i - 1] ** 2 % m] > 1:
    temp1 = (rem[i - 1] ** 2) % m
    temp2 = i
  else:
    temp1 = (rem[i - 1] ** 2) % m
    temp2 = i

for i in range(m):
  if rem[i] == temp1:
    temp3 = i
    break

if temp2 != temp3:
  num = (n - temp3) // (temp2 - temp3)
  S = sum(rem[:temp3]) + sum(rem[temp3:temp2]) * num + sum(rem[temp3:n - (num * (temp2 - temp3))])
  print(S)
else:
  print(sum(rem))

Buggy submission (verdict: Runtime Error):
n, x, m = map(int,input().split())
rem = [0] * m
chk = [0] * (m + 1)
rem[0] = x

for i in range(1,m):
  rem[i] = (rem[i - 1] ** 2) % m
  chk[rem[i - 1] ** 2 % m] += 1
  if chk[rem[i - 1] ** 2 % m] > 1:
    temp1 = rem[i - 1] ** 2 % m
    temp2 = i
    break

for i in range(m):
  if rem[i] == temp1:
    temp3 = i
    break

num = (n - temp3) // (temp2 - temp3)   

S = sum(rem[:temp3]) + sum(rem[temp3:temp2]) * num + sum(rem[temp3:n - (num * (temp2 - temp3))])
print(S)
Problem p02629 (python)

Fixed submission:
n=int(input())
m=n
A=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range(1,12):
  n-=26**i
  if n<=0:
    count=i
    break
n=m

for i in range(1,count):
  n-=26**i
n-=1

B=[]
for i in range(count-1,0,-1):
  B.append(n//(26**i))
  n-=(n//(26**i))*(26**i)
B.append(n)

C=[]
for i in B:
  C.append(A[i])
print(''.join(C))

Buggy submission (verdict: Runtime Error):
n=int(input())
m=n
A=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range(1,11):
  n-=26**i
  if n<=0:
    count=i
    break
n=m

for i in range(1,count):
  n-=26**i
n-=1

B=[]
for i in range(count-1,0,-1):
  B.append(n//(26**i))
  n-=(n//(26**i))*(26**i)
B.append(n)

C=[]
for i in B:
  C.append(A[i])
print(''.join(C))
Problem p02699 (python)

Fixed submission:
S,W = map(int,input().split())
if S>W:
  print('safe')
else:
  print('unsafe')

Buggy submission (verdict: Runtime Error):
S = str(input())
s = int(S)
n = len(S)
count = 0
for i in range(1,n+1):
    for j in range(i+4,n+1):
        si = s%10**(n-i+1)
        sij = si//10**(n-j)
        if sij % 2019 == 0:
            count+=1
            i+=4
            j+=4

print(count)
Problem p02729 (python)

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

Buggy submission (verdict: Runtime Error):
N,M=int(input())
n=N*(N-1)/2
m=M*(M-1)/2
print(n+m)

Buggy submission (verdict: Runtime Error):
N,M=int(input())
n=N*(N-1)/2
m=M*(M-1)/2
print(n+m)

Buggy submission (verdict: Runtime Error):
N,M=int(input())
n=n*(n-1)/2
m=m*(m-1)/2
print(n+m)
Problem p02777 (python)

Fixed submission:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if s==u:
  print(a-1,b)
else:
  print(a,b-1)

Buggy submission (verdict: Runtime Error):
s,t=map(input().split())
a,b=map(int,input().split())
u=input()
if s==u:
  print(a-1,b)
else:
  print(a,b-1)
Problem p02879 (python)

Fixed submission:
a,b = map(int,input().split())
if a > 9 or b > 9:
  print(-1)
  exit()
print(a*b)

Buggy submission (verdict: Runtime Error):
a,b = map(input().split())
if a > 9 or b > 9:
  print(-1)
  exit()
print(a*b)
Problem p02951 (python)

Fixed submission:
a, b, c = map(int,input().split())
print(max(0,c-a+b))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
print(max(0,c - (a - b))
Problem p02831 (python)

Fixed submission:
from sys import stdin
import math

def gcd(a,b):
  if (b == 0):
    return a

  return gcd(b, a % b)


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

A, B= [int(x) for x in stdin.readline().rstrip().split()]



print(lcm(A,B))

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math


def lcm(a,b):
  return int(a * b / math.gcd(a, b))

A, B= [int(x) for x in stdin.readline().rstrip().split()]



print(lcm(A,B))
Problem p02951 (python)

Fixed submission:
li = list(map(int,input().split()))
ans=li[2]-(li[0]-li[1])
if ans>=0:
    print(ans)
else:
    print("0")

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
ans=li[2]-(li[0]-li[1])
if ans>=0:
  print(ans)
elif:
  print("0")
Problem p02595 (python)

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

cnt = 0
for i in range(N):
    X, Y = map(int, input().split())
    if X**2 + Y**2 <= D**2:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N, D = map(int, input().split())
X, Y = [map(int, input().split()) for i in range(N)]

cnt = 0
for i in range(N):
    if X[i]**2 + Y[i]**2 < D**2:
        cnt += 1
print(cnt)
Problem p02693 (python)

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

for i in range(A, B+1):
    if i % K == 0:
       c += 1
if c > 0:
    print("OK")
else:
    print("NG")

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input())
c = 0

for i in range(A, B+1):
    if i % K == 0:
       c += 1
if c > 0:
    print("OK")
else:
    print("NG")