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

Fixed submission:
n = int(input())
n -= 1
for i in range(1, 15):
    if n >= 26**i :
        n -= 26**i
        continue 
    ans = ""
    for j in range(i):
        d = n % 26
        ans += chr(ord("a")+d)
        n //= 26
    ans = ans[::-1]
    break
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools 
x = int(input())
list_ = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "y", "w", "z" ]
len(list_)
kara = []
if x >= 1 and x <= 26 :
    ans = 0
    for i in itertools.product(list_, repeat = 1):
        ans += 1
        if ans == n:
            print(*i, sep = '')
elif 27<=x and x<= 702:
    ans = 26
    for i in itertools.product(list_, repeat = 2):
        ans += 1
        if ans == n:
            print(*i, sep = '')
elif 703<=x and x<=18278:
    ans = 702
    for i in itertools.product(list_, repeat = 3):
        ans += 1
        if ans == n:
            print(*i, sep='')
elif x <= 475254:
    ans = 18278
    for i in itertools.product(list_, repeat = 4):
        ans += 1
        if ans == n:
            print(*i, sep='')
elif x <= 12356630:
    ans =475254
    for i in itertools.product(list_, repeat = 5):
        ans += 1
        if ans == n:
            print(*i, sep='')
elif x <= 321272406:
    ans = 12356630
    for i in itertools.product(list_, repeat = 6):
        ans += 1
        if ans == n:
            print(*i, sep='')
elif x <= 8353082582:
    ans = 321272406
    for i in itertools.product(list_, repeat = 7):
        ans += 1
        if ans == n:
            print(*i, sep='')
elif x <= 217180147158:
    ans = 8353082582
    for i in itertools.product(list_, repeat = 8):
        ans += 1
        if ans == n:
            print(*i, sep='')
elif x <= 5646683826134:
    ans = 217180147158
    for i in itertools.product(list_, repeat = 9):
        ans += 1
        if ans == n:
            print(*i, sep='')
elif x <= 146813779479510:
    ans = 5646683826134
    for i in itertools.product(list_, repeat = 10):
        ans += 1
        if ans == n:
            print(*i, sep='')
elif x <= 3817158266467286:
    ans = 5646683826134
    for i in itertools.product(list_, repeat = 11):
        ans += 1
        if ans == n:
            print(*i, sep='')
Problem p02659 (python)

Fixed submission:
a, b = input().split()
b = int(b.replace(".", ""))
a = int(a)
print(a*b//100)

Buggy submission (verdict: Runtime Error):
a, b = input().split()
b.replace(".", "")
a = int(a)
b = int(b)
print(a*b//100)
Problem p02707 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
l = [0]*n
for i in range(n-1):
    j = a[i]
    l[j-1] += 1
for i in range(n):
    print(l[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
l = [0]*n
for i in range(n-1):
    j = A[i]
    l[j-1] += 1
for i in range(n):
    print(l[i])
Problem p02754 (python)

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

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
blue='c'*a
red='r'*b
s = str(blue+red)*(100*1000)
ss=s[:n]
print(ss.count('r'))

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
blue='b'*a
red='r'*b
s = str(blue+red)*100
print(s.count('b', 0, n))

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
blue='b'*a
red='r'*b
s = str(blue+red)*100
ss=s[:n]
print(ss.count('b'))

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
blue='b'*a
red='r'*b
s = str(blue+red)*n
ss=s[:n]
print(ss.count('b'))

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
blue='b'*a
red='r'*b
s = str((blue+red)*n)[:n]
print(s.count('b'))
Problem p02777 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n-1):
  if a[i]==a[i+1]:
    print("NO")
    break
print("YES")
Problem p02785 (python)

Fixed submission:
n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
if n<=k :
    print(0)
else :
    sm = 0
    for i in range(n-k):
        sm += l[i]
    print(sm)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
if n<=k :
    print(0)
else :
    sm = 0
    for i in range(n-k):
        sm += l[i]
    pritn(sm)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split())).sort()
if n<=k :
    print(0)
else :
    sm = 0
    for i in range(n-k):
        sm += l[i]
    pritn(sm)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l)
if n<=k :
    print(0)
else :
    sm = 0
    for i in range(n-k):
        sm += l[i]
    pritn(sm)
Problem p02831 (python)

Fixed submission:
import fractions
a, b = map(int, input().split())
def lcm(aa, bb):
    return (aa*bb)//fractions.gcd(aa, bb)
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
def lcm(aa, bb):
    return (aa*bb)//math.gcd(aa, bb)
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
def lcm(aa, bb):
    return (aa*bb)//math.gcd(aa, bb)
print(lcm(a, b))
Problem p02835 (python)

Fixed submission:
a, b, c = map(int, input().split())
print('win' if a+b+c<=21 else 'bust')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [[] for _ in range(n)]
for i in range(n):
  num = int(input())
  for j in range(num):
    person, state = map(int, input().split())
    a[i].append([person-1, state])
honest = 0
for i in range(1, 2**n):
  flag = True
  for j in range(n):
    if (i>>j)&1 == 1:
      for x, y in a[j]:
        if (i>>x)&1 != y:
          flag = False
          break
  if flag:
    honest = max(honest, bin(i)[2:].count('1'))
print(honest)
Problem p02847 (python)

Fixed submission:
s = input()
l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
for i in range(7):
    if s == 'SUN':
        print(7)
        break
    else:
        if s == l[i]:
            print(7-i)

Buggy submission (verdict: Runtime Error):
s = input()
l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
for i in range(7):
    if s == l[i]:
        print(7%i)
Problem p03072 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
l = [str(h[0])]
for i in h[1:]:
        if i>=int(sorted(l)[-1]):
            i = str(i)
            l.append(i)
print(len(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
l = [h[0]]
ans = 1
for i in h[1:]:
        if i>=sorted(l)[-1]:
            l.append(i)
print(len(i))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
l = [h[0]]
ans = 1
for i in h[1:]:
    for j in l:
        if i>=j:
            l.append(i)
print(len(i))
Problem p02598 (python)

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

ok = 10 ** 9  # 解が存在する値
ng = 0  # 解が存在しない値


def solve(x):
    """
    一番長いのをx以下にできるか
    → 全部をx以下にするのに切る回数 <= K
    """
    res = 0
    for i in range(N):
        res += (A[i] - 1) // x

    return res <= K


while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if solve(mid):
        ok = mid
    else:
        ng = mid

print(ok)

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

ok = 10 ** 9  # 解が存在する値
ng = -1  # 解が存在しない値


def solve(x):
    """
    一番長いのをx以下にできるか
    → 全部をx以下にするのに切る回数 <= K
    """
    res = 0
    for i in range(N):
        res += (A[i] - 1) // x

    return res <= K


while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if solve(mid):
        ok = mid
    else:
        ng = mid

print(ok)
Problem p02726 (python)

Fixed submission:
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
import numpy as np
from collections import Counter

N, X, Y = map(int, input().split())
F = [[0 for i in range(N)] for j in range(N)]

for i in range(N - 1):
    F[i][i + 1] = 1
    F[i + 1][i] = 1
F[X - 1][Y - 1] = 1
F[Y - 1][X - 1] = 1

G = csgraph_from_dense(F, null_value=0)
d = dijkstra(G)

# print(F)
# print(d)

# print(np.count_nonzero(d == 1))
s = Counter(d.flatten().astype(np.int64))
# print(s)
for i in range(1, N):
    if i in s:
        print(s[i] // 2)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
import numpy as np

N, X, Y = map(int, input().split())
F = [[0 for i in range(N)] for j in range(N)]

for i in range(N - 1):
    F[i][i + 1] = 1
    F[i + 1][i] = 1
F[X - 1][Y - 1] = 1
F[Y - 1][X - 1] = 1

G = csgraph_from_dense(F, null_value=0)
d = dijkstra(G)

# print(F)
# print(d)

# print(np.count_nonzero(d == 1))
for i in range(1, N):
    print(np.count_nonzero(d == i) // 2)
Problem p03265 (python)

Fixed submission:
import numpy as np

x1, y1, x2, y2 = map(int, input().split())

a = np.array([[x1], [y1]])
b = np.array([[x2], [y2]])

rot = np.array([[0, -1], [1, 0]])
ab = b - a
bc = np.dot(rot, ab)

c = b + bc
d = a + bc

# print(a, b)
# print(c, d)

print(*c.flatten(), end=" ")
print(*d.flatten())

Buggy submission (verdict: Runtime Error):
import numpy as np

x1, y1, x2, y2 = map(int, input().split())

a = np.array([[x1], [y1]])
b = np.array([[x2], [y2]])

rot = np.array([[0, -1], [1, 0]])
ab = b - a
bc = np.dot(rot, ab)

c = b + bc
d = a + bc

# print(a, b)
# print(c, d)

print(*c.flatten()+' '+*d.flatten())

Buggy submission (verdict: Runtime Error):
import numpy as np

x1, y1, x2, y2 = map(int, input().split())

a = np.array([[x1], [y1]])
b = np.array([[x2], [y2]])

rot = np.array([[0, -1], [1, 0]])
ab = b - a
bc = np.dot(rot, ab)

c = b + bc
d = a + bc

# print(a, b)
# print(c, d)

print(*c.flatten(), *d.flatten(), sep=" ")
Problem p03345 (python)

Fixed submission:
from sys import exit

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


if A == B:
    print(0)
    exit()

if abs(A - B) > 10 ** 18:
    print("Unfair")
    exit()

sign = (A - B) // abs(A - B)


if K % 2 == 0:
    print(abs(A - B) * sign)
else:
    print(abs(A - B) * sign * (-1))

Buggy submission (verdict: Runtime Error):
from sys import exit

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

if A == B == C:
    print(0)
    exit()

if abs(A - B) > 10 ** 18:
    print("Unfair")
    exit()

sign = A - B // abs(A - B)

if K % 2 == 0:
    print(abs(A - B) * sign)
else:
    print(abs(A - B) * sign * (-1))
Problem p02550 (python)

Fixed submission:
'''
Doubling

nxt[i][r] = the value of r mod M after 2 ** i squaring
dp[i][r] = the sum of sequence of lenght 2 ** i starting from r

We split sequence A into multiple disjoint parts, 
where the lengths of each parts are the binary decomposition of N.

e.g.
N = 11 = 1 + 2 + 8
A = A[0:1], A[1:3], A[3:11]
Sum of each parts are:
sum(A[0:1]) = dp[0][A[0] % M]
sum(A[1:3]) = dp[1][A[1] % M]
sum(A[3:11]) = dp[3][A[3] % M]
'''

import math

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

H = math.ceil(math.log2(N)) + 1

nxt = [[0] * M for _ in range(H)]
dp = [[0] * M for _ in range(H)]
nxt[0] = [r ** 2 % M for r in range(M)]
dp[0] = list(range(M))

for i in range(1, H):
    for r in range(M):
        nxt[i][r] = nxt[i - 1][nxt[i - 1][r]]
        dp[i][r] = dp[i - 1][r] + dp[i - 1][nxt[i - 1][r]]

ans = 0
r = X % M
for i in range(H):
    if N & (1 << i):
        ans += dp[i][r]
        r = nxt[i][r]
print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

A = [X]
vis = [-1] * M
vis[X] = 0
for i in range(1, M):
    X = X ** 2 % M
    if vis[X] != -1:
        pref = A[:vis[X]]
        cycle = A[vis[X]:]
        break
    A.append(X)
    vis[X] = i

n_full_period = (N - len(pref)) // len(cycle)
suffix_length = N - len(pref) - n_full_period * len(cycle)

ans = 0
ans += sum(pref)
ans += sum(cycle) * n_full_period
ans += sum(cycle[:suffix_length])
print(ans)
Problem p02623 (python)

Fixed submission:
from itertools import accumulate

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

a_cumsum = [0] + list(accumulate(a))
b_cumsum = [0] + list(accumulate(b))
j = m
res = 0
for i in range(n+1):
    if a_cumsum[i] > k:
        break
    while a_cumsum[i] + b_cumsum[j] > k:
        j -= 1
    if (v := i + j) > res:
        res = v
print(res)

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

n, m, k = map(int, input().split())
a = deque(map(int, input().split()))
b = deque(map(int, input().split()))

t = 0
res = 0
while a or b:
    if not a:
        if t + b[0] > k:
            break
        else:
            t += b.popleft()
    elif not b:
        if t + a[0] > k:
            break
        else:
            t += a.popleft()
    else:
        if t + a[0] > k and t + b[0] > k:
            break
        if a[0] < b[0]:
            t += a.popleft()
        elif a[0] > b[0]:
            t += b.popleft()
        else:
            if a[1] < b[1]:
                t += a.popleft()
            else:
                t += b.popleft()
    res += 1
print(res)
Problem p02847 (python)

Fixed submission:
days = ['SUN','MON','TUE','WED','THU','FRI','SAT']
S = input()
print(7-days.index(S))

Buggy submission (verdict: Runtime Error):
days = ['SUN','MON','TUE','WED','THU','FRI','SAT']
S = input()
if days.get(S) == 0:
  print(7)
else:
  print(days.get(S))
Problem p02891 (python)

Fixed submission:
from itertools import groupby

s = input()
k = int(input())

cont = [sum(1 for _ in it) for k, it in groupby(s)]

if len(cont) == 1:
    res = len(s) * k // 2
else:
    res = k-1 if s[0] == s[-1] and cont[0] % 2 == 1 and cont[-1] % 2 == 1 else 0
    for c in cont:
        if c != 1:
            res += c // 2 * k

print(res)

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

s = input()
k = int(input())

t = s * k
cont = [sum(1 for _ in it) for k, it in groupby(t)]

res = 0
for c in cont:
    if c != 1:
        res += c // 2

print(res)
Problem p03013 (python)

Fixed submission:
n, m = [int(i) for i in input().split()]
a = []
broken = [False] * max(n+1, 3)
for _ in range(m):
    i = int(input())
    a.append(i)
    broken[i] = True

ways = [0] * 3
ways[1] = 0 if broken[1] else 1
ways[2] = 0 if broken[2] else ways[1] + 1
for i in range(3, n+1):
    if broken[i]:
        ways.append(0)
    else:
        ways.append((ways[-2]+ways[-1])%(10**9+7))

print(ways[n])

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
a = []
broken = [False] * (n+1)
for _ in range(m):
    i = int(input())
    a.append(i)
    broken[i] = True

ways = [0] * 3
ways[1] = 0 if broken[1] else 1
ways[2] = 0 if broken[2] else ways[1] + 1
for i in range(3, n+1):
    if broken[i]:
        ways.append(0)
    else:
        ways.append((ways[-2]+ways[-1])%(10**9+7))

print(ways[n])

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

ways = [0] * 3
ways[1] = 0 if 1 in a else 1
ways[2] = 0 if 2 in a else ways[1] + 1
for i in range(3, n+1):
    if i in a:
        ways.append(0)
    else:
        ways.append((ways[-2]+ways[-1])%(10**9+7))
    print(ways)

print(ways[n])
Problem p03108 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10**5)


class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return
        if self.parents[x] > self.parents[y]:
            rx, ry = ry, rx
        self.parents[rx] += self.parents[ry]
        self.parents[ry] = rx

    def same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry

    def size(self, x):
        return -self.parents[self.root(x)]


n, m = map(int, input().split())
bridges = [tuple((int(i)-1 for i in input().split())) for _ in range(m)]
islands = UnionFind(n)
res = [n*(n-1)//2]
for a, b in bridges[:0:-1]:
    if islands.same(a, b):
        res.append(res[-1])
    else:
        res.append(res[-1] - islands.size(a) * islands.size(b))
        islands.unite(a, b)
print('\n'.join(map(str, res[::-1])))

Buggy submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return
        if self.parents[x] > self.parents[y]:
            rx, ry = ry, rx
        self.parents[rx] += self.parents[ry]
        self.parents[ry] = rx

    def same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry

    def size(self, x):
        return -self.parents[self.root(x)]


n, m = map(int, input().split())
bridges = [tuple((int(i)-1 for i in input().split())) for _ in range(m)]
islands = UnionFind(n)
res = [n*(n-1)//2]
for a, b in bridges[:0:-1]:
    if islands.same(a, b):
        res.append(res[-1])
    else:
        res.append(res[-1] - islands.size(a) * islands.size(b))
        islands.unite(a, b)
print('\n'.join(map(str, res[::-1])))
Problem p02629 (python)

Fixed submission:
N=int(input())
ans=''
while N>0 :
  N-=1
  ans += chr(ord('a')+N%26)
  N//=26
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = ''
for i in range(1, 99):
 if N <= 26 ** i:
 N -= 1
 for j in range(i):
 ans += chr(ord('a') + N % 26)
 N //= 26
 break
 else:
 N -= 26 ** i
 print(ans[::-1]) # reversed

Buggy submission (verdict: Runtime Error):
1 N = int(input())
2 ans = ''
3 while N > 0:
4 N -= 1
5 ans += chr(ord('a') + N % 26)
6 N //= 26
7 print(ans[::-1])
Problem p02571 (python)

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

ans = len(t)
long = ans

for i in range(len(s)+1-long):
    count = 0
    for j in range(long):
        if s[i+j] != t[j]:
            count += 1
    if count < ans:
        ans = count

print(ans)

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

ans = len(t)
long = ans

for i in range(len(t)):
    tc = t[i]
    for j in range(0+i,len(s)):
        if tc == s[j]:
            count = 1
            for k in range(1,len(t)-i):
                if t[i+k] == s[j+k]:
                    count += 1
                else:
                    if ans > long - count:
                        ans = long - count
                    break

print(ans)
Problem p02954 (python)

Fixed submission:
def lrCount(rCount,lCount,ansList,i):
    count = rCount + lCount
    c = 0
    if i == len(s) - 1:
        c = 1
    if count % 2 == 0:
        ansList[i - lCount + c] = count // 2
        ansList[i - lCount - 1 + c] = count // 2
    else:
        if rCount % 2 == 1:
            ansList[i - lCount + c] = count // 2
            ansList[i - lCount - 1 + c] = count // 2 + 1
        else:
            ansList[i - lCount + c] = count // 2 + 1
            ansList[i - lCount - 1 + c] = count // 2

import sys

s = input()

if s == "RL":
    print("1 1")
    sys.exit()

check = "N"
ansList = [0 for i in range(len(s))]

for i in range(len(s)):
    if check == "N":
        count = 0
        check = "R"
        rCount = 1
        
    else:
        if s[i] == check and i != len(s) - 1:
            if s[i] == "R":
                rCount += 1
            else:
                lCount += 1
        elif i == len(s) - 1:
            if s[i-1] == "R":
                lCount = 1
            else:
                lCount += 1
            lrCount(rCount,lCount,ansList,i)
        else:
            if s[i] == "L":
                check = "L"
                lCount = 1
            if s[i] == "R":                
                lrCount(rCount,lCount,ansList,i)
                check = "R"
                rCount = 1
                count = 0

for i in range(len(ansList)):
    if i == 0:
        ans = str(ansList[0])
    else:
        ans = ans + " " + str(ansList[i])

print(ans)

Buggy submission (verdict: Runtime Error):
def lrCount(rCount,lCount,ansList,i):
    count = rCount + lCount
    c = 0
    if i == len(s) - 1:
        c = 1
    if count % 2 == 0:
        ansList[i - lCount + c] = count // 2
        ansList[i - lCount - 1 + c] = count // 2
    else:
        if rCount % 2 == 1:
            ansList[i - lCount + c] = count // 2
            ansList[i - lCount - 1 + c] = count // 2 + 1
        else:
            ansList[i - lCount + c] = count // 2 + 1
            ansList[i - lCount - 1 + c] = count // 2


s = input()
check = "N"
ansList = [0 for i in range(len(s))]

for i in range(len(s)):
    if check == "N":
        count = 0
        check = "R"
        rCount = 1
        
    else:
        if s[i] == check and i != len(s) - 1:
            if s[i] == "R":
                rCount += 1
            else:
                lCount += 1
        elif i == len(s) - 1:
            lCount += 1
            lrCount(rCount,lCount,ansList,i)
        else:
            if s[i] == "L":
                check = "L"
                lCount = 1
            if s[i] == "R":                
                lrCount(rCount,lCount,ansList,i)
                check = "R"
                rCount = 1
                count = 0

for i in range(len(ansList)):
    if i == 0:
        ans = str(ansList[0])
    else:
        ans = ans + " " + str(ansList[i])

print(ans)
Problem p02570 (python)

Fixed submission:
def abc177a():
    d, t, s = map(int, input().split())
    if d / s <= t:
        print('Yes')
    else:
        print('No')


abc177a()

Buggy submission (verdict: Runtime Error):
def abc177d():
    n, m = map(int, input().split())
    check = [-1] * n
    pair = []
    group_no = 0
    group = {}
    for i in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        if check[a] == check[b]:
            if check[a] == -1:
                group[group_no] = {a, b}
                check[a] = check[b] = group_no
                group_no += 1
        elif check[a] == -1:
            group[check[b]].add(a)
            check[a] = check[b]
        elif check[b] == -1:
            group[check[a]].add(b)
            check[b] = check[a]
        else:
            re = min(check[a], check[b])
            de = max(check[a], check[b])
            for v in group[de]:
                check[v] = re
            group[re] = group[re] | group[de]
            del group[de]
    max_val = 1
    for k in group:
        max_val = max(max_val,len(group[k]))
    print(max_val)
abc177d()
Problem p02831 (python)

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

def abc148c_snack():
    a, b = map(int, input().split())
    print(lcm(a, b))

abc148c_snack()

Buggy submission (verdict: Runtime Error):
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def abc148c_snack():
    a, b = map(int, input().split())
    print(lcm(a, b))

abc148c_snack()
Problem p02546 (python)

Fixed submission:
a=input()
print(a+"s" if a[-1]!="s" else a+"es")

Buggy submission (verdict: Runtime Error):
import numpy as np
P=998244353
N,K=map(int,input().split())
LR=[]
for _ in range(K):
  l,r=map(int,input().split())
  LR+=range(l,r+1)
LR=list(set(LR))
LR=np.array(LR)
c=[0]*N
c[0]=1
for k in range(N):
  S=list(LR[LR<=k])
  while len(S):
    c[k]+=c[k-S[-1]]%P
    S.pop()
print(c[-1]%P)

Buggy submission (verdict: Runtime Error):
import numpy as np
P=998244353
N,K=map(int,input().split())
LR=[]
for _ in range(K):
  l,r=map(int,input().split())
  LR+=range(l,r+1)
LR=list(set(LR))
LR=np.array(LR)
c=[0]*N
c[0]=1
for k in range(N):
  S=LR[LR<=k]
  while len(S):
    c[k]+=c[k-S[-1]]%P
    S=S[:-1]
print(c[-1]%P)