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

Fixed submission:
import sys
import functools
from math import gcd


def lcm2(x, y):
    return x * y // gcd(x, y)


def lcm(x):
    return functools.reduce(lcm2, x)


def resolve(in_):
    N, M = map(int, next(in_).split())
    A = tuple(map(lambda x: int(x) // 2, next(in_).split()))

    a0 = A[0]
    x = 0
    while True:
        a0, b = divmod(a0, 2)
        if b:
            break
        x += 1
    x = 2 ** x
    for a in A[1:]:
        d, m = divmod(a, x)
        if m != 0 or not d % 2:
            return 0 

    l = lcm(A)
    l2 = l + l

    answer = len(range(l, M + 1, l2))

    return answer


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
import functools
import operator


def resolve(in_):
    N, M = map(int, next(in_).split())
    A = tuple(map(lambda x: int(x) // 2, next(in_).split()))

    max_a = max(A)
    temp = [0] * (max_a + 1)
    temp[1] = 1

    for i in range(2, max_a + 1):
        if temp[i]:
            continue

        j = i
        while j < max_a + 1:
            if not temp[j]:
                temp[j] = i
            j += i

    B = Counter()
    for a in A:
        C = Counter()
        while a > 1:
            C.update((temp[a],))
            a = a // temp[a]
        B |= C
    
    lcm = functools.reduce(operator.mul, (k * v for k, v in B.items()), 1)
    lcm2 = lcm + lcm

    answer = sum(1 for _ in range(lcm, M, lcm2))
    return answer


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


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

Fixed submission:
import sys
A, B, K= map(int, next(sys.stdin.buffer).split())
if K > A:
  a = 0
  b = max(0, B - (K - A))
else:
  a = A - K
  b = B

print(a, b)

Buggy submission (verdict: Runtime Error):
import sys
A, B, K= map(int, next(sys.stdin.buffer))
x = min(A, B, K)
print(A - x, B - x)

Buggy submission (verdict: Runtime Error):
import sys
A, B, K= map(int, sys.stdin.buffer)
x = min(A, B, K)
print(A - x, B - x)
Problem p02823 (python)

Fixed submission:
import sys
n, a, b = map(int, sys.stdin.readline().split())
c = b - a
if c % 2:
  d = min(a - 1, n - b)
  e = 1
  f = (b - a - 1) // 2
  print(d + e + f)
else:
  print(c // 2)

Buggy submission (verdict: Runtime Error):
5 2 3
Problem p03166 (python)

Fixed submission:
import sys
from collections import defaultdict


g = None
memo = None


def f(x):
    if memo[x] == -1:
        ret = 0
        for y in g[x]:
            ret = max(ret, f(y) + 1)
        memo[x] = ret
    return memo[x]


def resolve(in_):
    global g, memo
    n, m = map(int, next(in_).split())
    _g = defaultdict(list)
    for line in in_:
        x, y = map(int, line.split())
        _g[x - 1].append(y - 1)
    g = _g
    memo = [-1] * 100000
    return max(f(i) for i in range(n))


def main():
    sys.setrecursionlimit(1000000)
    ans = resolve(sys.stdin.buffer)
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from functools import lru_cache


g = None


@lru_cache(maxsize=100000)
def f(x):
    return max((f(y) + 1 for y in g[x]), default=0)


def resolve(in_):
    global g
    n, m = map(int, next(in_).split())
    _g = defaultdict(list)
    for line in in_:
        x, y = map(int, line.split())
        _g[x - 1].append(y - 1)
    g = _g
    return max(f(i) for i in range(n))


def main():
    sys.setrecursionlimit(100000)
    ans = resolve(sys.stdin.buffer)
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from functools import lru_cache


g = None


@lru_cache(maxsize=100000)
def f(x):
    return max((f(y) + 1 for y in g[x]), default=0)


def resolve(in_):
    global g
    n, m = map(int, next(in_).split())
    _g = defaultdict(list)
    for line in in_:
        x, y = map(int, line.split())
        _g[x - 1].append(y - 1)
    g = _g
    return max(f(i) for i in range(n))


def main():
    ans = resolve(sys.stdin.buffer)
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from functools import lru_cache


g = None


@lru_cache(maxsize=100000)
def f(x):
    return max((f(y) + 1 for y in g[x]), default=0)


def resolve(in_):
    global g
    n, m = map(int, next(in_).split())
    _g = defaultdict(list)
    for line in in_:
        x, y = map(int, line.split())
        _g[x - 1].append(y - 1)
    g = _g
    return max(f(i) for i in range(n))


def main():
    ans = resolve(sys.stdin.buffer)
    print(ans.decode())


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

Fixed submission:
import sys
sys.setrecursionlimit(int(1e9))

class UnionFind():
    def __init__(self, n):
        self.p = list(range(n))
    
    def find(self, x):
        if self.p[x] == x:  return x
        self.p[x] = self.find(self.p[x])
        return self.p[x]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x != y:  self.p[x] = y

N,M = map(int, input().split())
uf = UnionFind(N)
for i in range(M):
    a,b = map(int, input().split())
    uf.unite(a-1, b-1)

ans = 0
for i in range(1, N):
    if uf.find(0) != uf.find(i):
        uf.unite(0, i)
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.p = list(range(n))
    
    def find(self, x):
        if self.p[x] == x:  return x
        self.p[x] = self.find(self.p[x])
        return self.p[x]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x != y:  self.p[x] = y

N,M = map(int, input().split())
uf = UnionFind(N)
for i in range(M):
    a,b = map(int, input().split())
    uf.unite(a-1, b-1)

ans = 0
for i in range(1, N):
    if uf.find(0) != uf.find(i):
        uf.unite(0, i)
        ans += 1

print(ans)
Problem p03569 (python)

Fixed submission:
import sys 
S = input()
A = []
for i,s in enumerate(S):
    if s != 'x':  A.append(i)
if not A:
    print(0)
    sys.exit()
for i in range(len(A)//2):
    if S[A[i]] != S[A[-i-1]]:
        print(-1)
        sys.exit()
ans = abs((len(S)-1-A[-1])-A[0])
for i in range(len(A)//2):
    cnt = abs(A[i+1]-A[i] - (A[-1-i]-A[-2-i]))
    ans += cnt
print(ans)

Buggy submission (verdict: Runtime Error):
import sys 
S = input()
A = []
for i,s in enumerate(S):
    if s != 'x':  A.append(i)
for i in range(len(A)//2):
    if S[A[i]] != S[A[-i-1]]:
        print(-1)
        sys.exit()
ans = abs((len(S)-1-A[-1])-A[0])
for i in range(len(A)//2):
    cnt = abs(A[i+1]-A[i] - (A[-1-i]-A[-2-i]))
    ans += cnt
print(ans)
Problem p02632 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


class Combination:
    def __init__(self, n: int, mod: int):
        self.mod = mod
        self.fact = [0] * (n + 1)
        self.factinv = [0] * (n + 1)
        self.inv = [0] * (n + 1)
        
        self.fact[0] = self.fact[1] = 1
        self.factinv[0] = self.factinv[1] = 1
        self.inv[1] = 1
        for i in range(2, n + 1):
            self.fact[i] = (self.fact[i - 1] * i) % mod
            self.inv[i] = (-self.inv[mod % i] * (mod // i)) % mod
            self.factinv[i] = (self.factinv[i - 1] * self.inv[i]) % mod
    
    def ncr(self, n: int, r: int):
        if r < 0 or n < r:
            return 0
        r = min(r, n - r)
        return self.fact[n] * self.factinv[r] % self.mod * self.factinv[n - r] % self.mod
    
    def nhr(self, n: int, r: int):
        return self.ncr(n + r - 1, r)
    
    def npr(self, n: int, r: int):
        if r < 0 or n < r:
            return 0
        return self.fact[n] * self.factinv[n - r] % self.mod


def solve():
    K = int(rl())
    S = rl().rstrip()
    MOD = 10 ** 9 + 7
    
    com = Combination(2 * 10 ** 6, MOD)
    n = len(S)
    m = n + K
    ans = 0
    for i in range(n, m + 1):
        j = m - i
        ans += com.ncr(n + K - j - 1, n - 1) * pow(25, K - j, MOD) * pow(26, j, MOD)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


class Combination:
    def __init__(self, n: int, mod: int):
        self.mod = mod
        self.fact = [0] * (n + 1)
        self.factinv = [0] * (n + 1)
        self.inv = [0] * (n + 1)
        
        self.fact[0] = self.fact[1] = 1
        self.factinv[0] = self.factinv[1] = 1
        self.inv[1] = 1
        for i in range(2, n + 1):
            self.fact[i] = (self.fact[i - 1] * i) % mod
            self.inv[i] = (-self.inv[mod % i] * (mod // i)) % mod
            self.factinv[i] = (self.factinv[i - 1] * self.inv[i]) % mod
    
    def ncr(self, n: int, r: int):
        if r < 0 or n < r:
            return 0
        r = min(r, n - r)
        return self.fact[n] * self.factinv[r] % self.mod * self.factinv[n - r] % self.mod
    
    def nhr(self, n: int, r: int):
        return self.ncr(n + r - 1, r)
    
    def npr(self, n: int, r: int):
        if r < 0 or n < r:
            return 0
        return self.fact[n] * self.factinv[n - r] % self.mod


def solve():
    K = int(rl())
    S = rl().rstrip()
    MOD = 10 ** 9 + 7
    
    com = Combination(2 * 10 ** 5 + 10, MOD)
    n = len(S)
    m = n + K
    ans = 0
    for i in range(n, m + 1):
        j = m - i
        ans += com.ncr(n + K - j - 1, n - 1) * pow(25, K - j, MOD) * pow(26, j, MOD)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    solve()
Problem p02719 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, K = map(int, rl().split())
    if N % K == 0:
        print(0)
        exit()

    print(min(N % K, abs(N - K * (N // K + 1))))


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, K = map(int, rl().split())
    if N == 0 or K == 1:
        print(0)
        exit()
    """
    if N < abs(N - K):
        print(N)
        exit()
    """
    print(min(abs(N % (N - K)), abs(N - (N - K) * (N // K + 1))))


if __name__ == '__main__':
    solve()
Problem p02814 (python)

Fixed submission:
from fractions import gcd
from functools import reduce


def lcm(x, y):
    res = (x * y) // gcd(x, y)
    if 10 ** 9 < res:
        res = 0
    return res


def solve():
    N, M, *a = map(int, open(0).read().split())
    
    half_a = [ai // 2 for ai in a]
    half_lcm = reduce(lcm, half_a)
    
    for ai in half_a:
        if (half_lcm // ai) % 2 == 0:
            print(0)
            exit()
    
    if half_lcm == 0:
        ans = 0
    else:
        ans = (M // half_lcm) - (M // (2 * half_lcm))
    print(ans)


if __name__ == '__main__':
    solve()

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


def solve():
    N, M, *a = map(int, open(0).read().split())
    
    a_lcm = a[0]
    for i in range(1, N):
        a_lcm = (a_lcm * a[i]) // gcd(a_lcm, a[i])
    ans = 1 + (M - a_lcm / 2) // a_lcm
    if M < a_lcm / 2:
        ans = 0
    print(int(ans))


if __name__ == '__main__':
    solve()
Problem p02817 (python)

Fixed submission:
def solve():
    S, T = map(str, input().split())
    print(T+S)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    A, B, K = map(int, input().split())
    if K <= A:
        print(A-K, B)
    elif A+B <= K:
        print(0, 0)
    else:
        print(0, B-(K-A))


if __name__ == '__main__':
    solve()
Problem p02865 (python)

Fixed submission:
def solve():
    N = int(input())
    ans = 0
    if N % 2 == 0:
        ans = N // 2 - 1
    else:
        ans = N // 2
    print(ans)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys


def solve():
    MOD = 998244353
    N, *d_l = map(int, open(0).read().split())
    ans = 1
    
    if d_l[0] != 0:
        print(0)
        sys.exit()
    
    d_max = max(d_l)
    count_l = [d_l.count(1)]
    for i in range(2, d_max+1):
        count_l.append(d_l.count(i))
        ans *= count_l[i-2] ** count_l[i-1]
    print(ans%MOD)


if __name__ == '__main__':
    solve()
Problem p02927 (python)

Fixed submission:
import sys


def solve():
    M, D = input().split()
    ans = 0
    
    if int(D) < 22:
        print(0)
        sys.exit()
    
    m, d_1, d_2 = int(M), int(D[0]), int(D[1])

    if int(M) < 4 or d_1 < 2 and d_2 < 2:
        print(0)
        sys.exit()

    for i in range(4, m+1):
        for j in range(2, d_1+1):
            for k in range(2, 10):
                if j == d_1 and k > d_2:
                    break
                if i == j * k:
                    ans += 1
    print(ans)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys


def solve():
    M, D = input().split()
    ans = 0
    m, d_1, d_2 = int(M), int(D[0]), int(D[1])

    if int(M) < 4 or d_1 < 2 and d_2 < 2:
        print(0)
        sys.exit()

    for i in range(4, m+1):
        for j in range(2, d_1+1):
            for k in range(2, 10):
                if j == d_1 and k > d_2:
                    break
                if i == j * k:
                    ans += 1
    print(ans)


if __name__ == '__main__':
    solve()
Problem p02969 (python)

Fixed submission:
r = int(input())
answer = 3 * r ** 2
print(answer)

Buggy submission (verdict: Runtime Error):
def solve():
	N, *A = map(int, open(0).read().split())

	top = [A[0]]
	for i in range(1, N):
		da_min = 10**9
		color = -1
		for j in range(len(top)):
			da = A[i] - top[j]
			if da > 0:
				if da_min > da:
					da_min = da
					color = j
		if color != -1:
			top[color] = A[i]
		else:
			top.append(A[i])

	print(len(top))


if __name__ == '__main__':
	solve()
Problem p02995 (python)

Fixed submission:
import fractions

def solve():
    A, B, C, D = map(int, input().split())
    gcd = (C * D) // fractions.gcd(C, D)
    ans_sub = A-1 - ((A-1) // C + (A-1) // D - (A-1) // gcd)
    ans = B - (B // C + B // D - B // gcd) - ans_sub
    print(ans)

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import math

def solve():
    A, B, C, D = map(int, input().split())
    gcd = (C * D) // math.gcd(C, D)
    ans_sub = A-1 - ((A-1) // C + (A-1) // D - (A+1) // gcd)
    ans = B - (B // C + B // D - B // gcd) - ans_sub
    print(ans)

if __name__ == '__main__':
    solve()
Problem p03006 (python)

Fixed submission:
from collections import defaultdict


def solve():
    N = int(input())
    if N == 1:
        print(1)
        exit()
    xy = [[0, 0] for _ in range(N)]
    for i in range(N):
        xy[i][0], xy[i][1] = map(int, input().split())
    
    dxy = defaultdict(int)
    for i in range(N - 1):
        for j in range(i + 1, N):
            dxy[(xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])] += 1
            dxy[(xy[j][0] - xy[i][0], xy[j][1] - xy[i][1])] += 1
    
    zeros = max(dxy.values())
    print(N - zeros)


if __name__ == '__main__':
    solve()

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


def solve():
    N = int(input())
    xy = [[0, 0] for _ in range(N)]
    for i in range(N):
        xy[i][0], xy[i][1] = map(int, input().split())
    
    dxy = defaultdict(int)
    for i in range(N - 1):
        for j in range(i + 1, N):
            dxy[(xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])] += 1
            dxy[(xy[j][0] - xy[i][0], xy[j][1] - xy[i][1])] += 1
    
    zeros = max(dxy.values())
    print(N - zeros)


if __name__ == '__main__':
    solve()
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)

N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
    u, v, w = map(int, input().split())
    edges[u].append([v, w])
    edges[v].append([u, w])
ans = [-1 for _ in range(N)]


def dfs(edge, pd):
    for child, d in edges[edge]:
        if ans[child-1] != -1:
            continue
        cd = pd + d
        if cd % 2 == 0:
            ans[child-1] = 0
        else:
            ans[child-1] = 1
        dfs(child, cd)


def solve():
    dfs(1, 0)
    for i in range(N):
        print(ans[i])


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
    u, v, w = map(int, input().split())
    edges[u].append([v, w])
    edges[v].append([u, w])
parent = [[] for _ in range(N)]
ans = [0 for _ in range(N)]


def dfs(edge, pd):
    for child, d in edges[edge]:
        if edge in parent[child-1]:
            continue
        cd = pd + d
        if cd % 2 == 0:
            ans[child-1] = 0
        else:
            ans[child-1] = 1
        parent[child-1].append(edge)
        dfs(child, cd)


def solve():
    dfs(1, 0)
    for i in range(N):
        print(ans[i])


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
    u, v, w = map(int, input().split())
    edges[u].append([v, w])
    edges[v].append([u, w])
parent = [0 for _ in range(N)]
ans = [0 for _ in range(N)]


def dfs(edge, pd):
    for child, d in edges[edge]:
        if parent[child-1] == edge:
            continue
        cd = pd + d
        if cd % 2 == 0:
            ans[child-1] = 0
        else:
            ans[child-1] = 1
        parent[child-1] = edge
        dfs(child, cd)


def solve():
    dfs(1, 0)
    for i in range(N):
        print(ans[i])


if __name__ == '__main__':
    solve()
Problem p03166 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
graph = [[] for _ in range(N + 1)]
for _ in range(M):
    x, y = map(int, input().split())
    graph[x].append(y)

dp = [-1] * (10 ** 5 + 1)


def dfs(v):
    if dp[v] != -1:
        return dp[v]

    res = 0
    for child in graph[v]:
        res = max(res, dfs(child) + 1)
    dp[v] = res
    return res


def solve():
    ans = 0
    for v in range(1, N + 1):
        ans = max(ans, dfs(v))
    print(ans)


if __name__ == '__main__':
    solve()

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

dp = [-1] * (10 ** 5 + 1)


def dfs(v):
    if dp[v] != -1:
        return dp[v]

    res = 0
    for child in graph[v]:
        res = max(res, dfs(child) + 1)
    dp[v] = res
    return res


def solve():
    ans = 0
    for v in range(1, N+1):
        ans = max(ans, dfs(v))
    print(ans)


if __name__ == '__main__':
    solve()
Problem p03494 (python)

Fixed submission:
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    
    ans = 10 ** 9
    for i in range(N):
        cnt = 0
        ai = A[i]
        while 1:
            if ai % 2 == 0:
                ai //= 2
                cnt += 1
            else:
                break
        ans = min(ans, cnt)
    print(ans)


if __name__ == '__main__':
    solve()

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


def solve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    
    counter = defaultdict(int)
    for ai in A:
        counter[ai] += 1
    
    sorted_c = sorted(counter.values())
    ans = 0
    for i in range(len(counter) - K):
        ans += sorted_c[i]
    print(ans)


if __name__ == '__main__':
    solve()
Problem p03660 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    graph = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = map(lambda x: int(x) - 1, rl().split())
        graph[a].append(b)
        graph[b].append(a)
    
    fen_dist, sun_dist = [0] * N, [0] * N
    
    def dfs1(node, parent, dist):
        fen_dist[node] = dist
        for child in graph[node]:
            if child != parent:
                dfs1(child, node, dist + 1)
    
    def dfs2(node, parent, dist):
        sun_dist[node] = dist
        for child in graph[node]:
            if child != parent:
                dfs2(child, node, dist + 1)
    
    dfs1(0, -1, 0)
    dfs2(N - 1, -1, 0)
    
    cnt_fen, cnt_sun = 0, 0
    for i in range(N):
        if fen_dist[i] <= sun_dist[i]:
            cnt_fen += 1
        else:
            cnt_sun += 1
    
    if cnt_fen <= cnt_sun:
        print('Snuke')
    else:
        print('Fennec')


if __name__ == '__main__':
    solve()

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


def solve():
    N = int(rl())
    graph = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = map(lambda x: int(x) - 1, rl().split())
        graph[a].append(b)
        graph[b].append(a)
    
    fen_dist, sun_dist = [0] * N, [0] * N
    
    def dfs1(node, parent, dist):
        fen_dist[node] = dist
        for child in graph[node]:
            if child != parent:
                dfs1(child, node, dist + 1)
    
    def dfs2(node, parent, dist):
        sun_dist[node] = dist
        for child in graph[node]:
            if child != parent:
                dfs2(child, node, dist + 1)
    
    dfs1(0, -1, 0)
    dfs2(N - 1, -1, 0)
    
    cnt_fen, cnt_sun = 0, 0
    for i in range(N):
        if fen_dist[i] <= sun_dist[i]:
            cnt_fen += 1
        else:
            cnt_sun += 1
    
    if cnt_fen < cnt_sun:
        print('Snuke')
    else:
        print('Fennec')


if __name__ == '__main__':
    solve()
Problem p03695 (python)

Fixed submission:
def solve():
    _ = int(input())
    a = list(map(int, input().split()))
    
    counter = [0] * 9
    for ai in a:
        counter[min(8, ai // 400)] += 1
    
    ans_min = 0
    for i in range(8):
        if 0 < counter[i]:
            ans_min += 1
    
    ans_max = ans_min + counter[-1]
    if ans_min == 0:
        ans_min = 1
    print(ans_min, ans_max)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    _ = int(input())
    a = list(map(int, input().split()))
    
    counter = [0] * 9
    for ai in a:
        counter[ai // 400] += 1
    
    ans_min = 0
    for i in range(8):
        if 0 < counter[i]:
            ans_min += 1
    
    ans_max = min(8, ans_min + counter[-1])
    print(ans_min, ans_max)


if __name__ == '__main__':
    solve()
Problem p02534 (python)

Fixed submission:
k=int(input())
print('ACL'*k)

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

print('ACL'*K)
Problem p02548 (python)

Fixed submission:
N  =int(input())
c = 0
for i in range(N):
  c += (N-1)//(i+1)
print(c)

Buggy submission (verdict: Runtime Error):
N  =int(input())
c = 0
for i in range(N):
  c += N-1//i+1
print(c)

Buggy submission (verdict: Runtime Error):
N  =int(input())
c = 0
for i in range(N):
  c += n-1//i+1
print(c)
Problem p02584 (python)

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

X = abs(X)

if X-K*D <= 0:
    d = X//D
    if (K-d%2)%2:
        print(D-X%D)
    else:
        print(X%D)
else:
    print(X-K*D)

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

X = abs(X)

if X-K*D <= 0:
    d = X//D
    K -= d
    x -= D*d
    if K%2 == 0:
        print(a)
    else:
        print(abs(a-d))
else:
    print(X-K*D)
Problem p02621 (python)

Fixed submission:
a = int(input())

ans = a + a**2 + a**3

print(ans)

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

ans = a + a**2 + a**3

print(ans)
Problem p02639 (python)

Fixed submission:
x = list(map(int,input().split()))
 
print(x.index(0)+1)

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

print(x.index("0")+1)