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

Fixed submission:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


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

    if a > b:
        return gcd(b, a % b)
    else:
        return gcd(a, b % a)


def gcd_multi(nums):
    if len(nums) == 0:
        return 0
    if len(nums) == 1:
        return nums[0]

    ret = gcd(nums.pop(), nums.pop())
    while len(nums) > 0:
        ret = gcd(ret, nums.pop())
    return ret


def solve(inputs):
    monsters = string_to_int(inputs[0])
    return gcd_multi(monsters)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

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

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def gcd_multi(nums):
    if len(nums) == 0:
        return 0
    if len(nums) == 1:
        return nums[0]

    ret = math.gcd(nums.pop(), nums.pop())
    while len(nums) > 0:
        ret = math.gcd(ret, nums.pop())
    return ret


def solve(inputs):
    monsters = string_to_int(inputs[0])
    return gcd_multi(monsters)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

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

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def gcd_multi(nums):
    if len(nums) == 0:
        return 0
    if len(nums) <= 2:
        return min(nums)

    ret = math.gcd(nums.pop(), nums.pop())
    while len(nums) > 0:
        ret = math.gcd(ret, nums.pop())
    return ret


def solve(inputs):
    monsters = string_to_int(inputs[0])
    return gcd_multi(monsters)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)
Problem p03329 (python)

Fixed submission:
import sys
from collections import deque
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    n = int(inputs[0])
    LIMIT = 100000
    sixs = [6]
    nines = [9]
    while sixs[-1] <= LIMIT:
        sixs.append(6 * sixs[-1])
    sixs.pop()
    while nines[-1] <= LIMIT:
        nines.append(9 * nines[-1])
    nines.pop()

    choises = [1]
    choises.extend(sixs)
    choises.extend(nines)

    # [count]
    dp = [0]

    for i in range(1, n+1):
        candidates = []
        for c in choises:
            if i - c >= 0:
                candidates.append(dp[i-c] + 1)
        dp.append(min(candidates))

    return dp[-1]


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    n = int(inputs[0])
    LIMIT = 100000
    sixs = [6]
    nines = [9]
    while sixs[-1] <= LIMIT:
        sixs.append(6 * sixs[-1])
    sixs.pop()
    while nines[-1] <= LIMIT:
        nines.append(9 * nines[-1])
    nines.pop()

    choises = [1, *sixs, *nines]
    # [count]
    dp = [0]

    for i in range(1, n+1):
        candidates = []
        for c in choises:
            if i - c >= 0:
                candidates.append(dp[i-c] + 1)
        dp.append(min(candidates))

    return dp[-1]


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)
Problem p03804 (python)

Fixed submission:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def is_match(parent, child, pi, pj):
    for ci in range(len(child)):
        for cj in range(len(child[ci])):
            # c = child[ci][cj]
            # p = parent[pi+ci][pj+cj]
            if child[ci][cj] != parent[pi+ci][pj+cj]:
                return False
    return True


def solve(N, M, inputs):
    map_parent = list(map(list, inputs[:N]))
    map_child = list(map(list, inputs[N:]))

    for pi in range(0, N-M+1):
        for pj in range(0, N-M+1):
            if is_match(map_parent, map_child, pi, pj):
                return 'Yes'
    return 'No'


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    [N, M] = string_to_int(input())
    ret = solve(N, M, inputs(N+M))
    print(ret)

Buggy submission (verdict: Runtime Error):
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def is_match(parent, child, pi, pj):
    for ci in range(len(child)):
        for cj in range(len(child[ci])):
            # c = child[ci][cj]
            # p = parent[pi+ci][pj+cj]
            if child[ci][cj] != parent[pi+ci][pj+cj]:
                return False
    return True


def solve(N, M, inputs):
    map_parent = list(map(list, inputs[:N]))
    map_child = list(map(list, inputs[N:]))

    for pi in range(0, M):
        for pj in range(0, M):
            if is_match(map_parent, map_child, pi, pj):
                return 'Yes'
    return 'No'


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    [N, M] = string_to_int(input())
    ret = solve(N, M, inputs(N+M))
    print(ret)
Problem p03805 (python)

Fixed submission:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(N, M, inputs):
    relations = {}
    visited_all = (2 ** N) - 1
    for i in range(1, N + 1):
        relations[i] = []

    for i in inputs:
        [parent, child] = string_to_int(i)
        relations[parent].append(child)
        relations[child].append(parent)

    routes = 0
    queue = deque([[1, 0]])
    while len(queue) > 0:
        [node, visited] = queue.popleft()

        if visited & (1 << (node - 1)) != 0:
            continue

        visited = visited + (1 << (node - 1))

        if visited == visited_all:
            routes += 1
            continue

        for next in relations[node]:
            queue.append([next, visited])
    return routes


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N, M] = string_to_int(input())
    ret = solve(N, M, inputs(M))
    print(ret)

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

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(N, M, inputs):
    relations = {}
    visited_all = (2 ** N) - 1
    for i in range(1, N + 1):
        relations[i] = []

    for i in inputs:
        [parent, child] = string_to_int(i)
        relations[parent].append(child)
        relations[child].append(parent)

    routes = 0
    queue = deque([[1, 0]])
    while len(queue) > 0:
        [node, visited] = queue.popleft()

        if visited & (1 << (node - 1)) != 0:
            continue

        visited = visited + (1 << (node - 1))

        if visited == visited_all:
            routes += 1
            continue

        for next in relations[node]:
            queue.append([next, visited])
    return routes


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N, M] = string_to_int(input())
    ret = solve(inputs(M))
    print(ret)
Problem p03835 (python)

Fixed submission:
def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [K, S] = list(map(lambda x: int(x), inputs[0].split()))
    pattern = 0
    for x in range(0, K + 1):
        for y in range(0, K + 1):
            tmp_z = S - x - y
            if tmp_z <= K and tmp_z >= 0:
                pattern += 1

    return pattern


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Buggy submission (verdict: Runtime Error):
import math


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    points = list(map(lambda x: sp(x), inputs))
    N = len(points)
    distances = []
    for i, _ in enumerate(points):
        for j in range(i + 1, N):
            distances.append(
                math.sqrt(
                    (points[i][0] - points[j][0]) ** 2
                    + (points[i][1] - points[j][1]) ** 2
                )
            )
    max = 0
    for d in distances:
        max = d if max < d else max
    return "%.6f" % max


def sp(s):
    new_s = s.split()
    return list(map(lambda x: int(x), new_s))


if __name__ == "__main__":
    N = int(input())
    ret = solve(inputs(N))
    print(ret)
Problem p02659 (python)

Fixed submission:
a,b =  input().split()
a=int(a);b,d=map(int,b.split('.'))
print(a*b+a*d//100)

Buggy submission (verdict: Runtime Error):
a,b =  input().split()
a=int(a);b,d=map(int,b.spit('.'))
print(a*b+a*d//100)
Problem p02688 (python)

Fixed submission:
n,k = list(map(int,input().split()))
s=set()
for i in range(k):
  int(input())
  j=set(map(int,input().split()));s=s.union(j)
print(n-len(s))

Buggy submission (verdict: Runtime Error):
n,k = list(map(int,input().split()))
s=set()
for i in range(k):
  s.append(int(input()))
  j=list(map(int,input().split()))
print(n-len(s))
Problem p02723 (python)

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

Buggy submission (verdict: Runtime Error):
s=input()
if s[2]==s[3] ans s[4]==s[5]:
  print("Yes")
else:
  print("No")
Problem p02829 (python)

Fixed submission:
x = int(input())
y = int(input())
k = [1,2,3]
k.remove(x)
k.remove(y)
print(k[0])

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  if a==0:
    return b
  return gcd(b%a,a)
a,b = map(int,input().split())

print((a*b)//gcd(a,b))
Problem p02831 (python)

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

a,b = map(int,input().split())
print((a*b)//gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())

print((a*b)//math.gcd(a,b))
Problem p02847 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,x = list(map(int,input().split()))
if a*10**9+b*10 <= x:
  print(10**9)
elif a+b > x:
  print(0)
else:
  for i in range(9,0,-1):
    y = (x - i*b)//a
    if len(str(y))==i:
      print(max(0,y))
      break
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
a,b,x = list(map(int,input().split()))
if a*10**9+b*10 <= x:
  print(10**9)
elif a+b > x:
  print(0)
else:
  for i in range(9,0,-1):
    y = (x - i*b)//a
    if len(str(y))==i:
      if y<0:
        continue
      print(y)
      break
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
s = input()
x = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
print(7-x.find(s))
Problem p02659 (python)

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

Buggy submission (verdict: Runtime Error):
import decimal
a,b = map(decimal,input().split())
print(int(a*b))
Problem p02881 (python)

Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
L = len(make_divisors(n))
i,j = make_divisors(n)[L//2-1], make_divisors(n)[L//2]

if (n**0.5).is_integer():
    print(int(2*(n**0.5-1)))
else:
    print(i+j-2)

Buggy submission (verdict: Runtime Error):
import sympy
sympy.divisors(10**9)

n = int(input())
L = len(sympy.divisors(n))
i,j = sympy.divisors(n)[L//2-1], sympy.divisors(n)[L//2]

if (n**0.5).is_integer():
    print(int(2*(n**0.5-1)))
else:
    print(i+j-2)
Problem p03307 (python)

Fixed submission:
a = 2
N = int(input())

#最大公約数
def gcd(a,N):
    while N!=0:
        a,N = N, a%N
    return a
##2つの整数a,bに対し，最大公約数g,最小公倍数lとおくと，
##ab=gl
print(int(a*N/gcd(a,N)))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

##2つの整数a,bに対し，最大公約数g,最小公倍数lとおくと，
##ab=gl

g = math.gcd(2,N)
l = 2*N/g

print(int(l))
Problem p02834 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N, s, t = map(int, input().split())
s -= 1
t -= 1
to = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)

def dfs(dist, v, d=0, p=-1):
    dist[v] = d
    for u in to[v]:
        if u == p:
            continue
        dfs(dist, u, d+1, v)

def calcDist(s):
    dist = [0] * N
    dfs(dist, s)
    return dist

distS = calcDist(s)
distT = calcDist(t)

mx = 0
for i in range(N):
    if distS[i] < distT[i]:
        mx = max(mx, distT[i])
ans = mx - 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, s, t = map(int, input().split())
s -= 1
t -= 1
# to = [[] for _ in range(N)]
to = [[] for _ in range(100005)]
for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)

def dfs(dist, v, d=0, p=-1):
    dist[v] = d
    for u in to[v]:
        if u == p:
            continue
        dfs(dist, u, d+1, v)

def calcDist(s):
    dist = [0] * N
    dfs(dist, s)
    return dist

distS = calcDist(s)
distT = calcDist(t)

mx = 0
for i in range(N):
    if distS[i] < distT[i]:
        mx = max(mx, distT[i])
ans = mx - 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, s, t = map(int, input().split())
s -= 1
t -= 1
to = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)

def dfs(dist, v, d=0, p=-1):
    dist[v] = d
    for u in to[v]:
        if u == p:
            continue
        dfs(dist, u, d+1, v)

def calcDist(s):
    dist = [0] * N
    dfs(dist, s)
    return dist

distS = calcDist(s)
distT = calcDist(t)

mx = 0
for i in range(N):
    if distS[i] < distT[i]:
        mx = max(mx, distT[i])
ans = mx - 1
print(ans)
Problem p02925 (python)

Fixed submission:
def main():
    n = int(input())
    a = [list(map(lambda x : int(x)-1, input().split())) for _ in range(n)]
    for i in range(n):
        a[i].reverse()
    # print(a)
    s = set()

    def check(i, s):
        if len(a[i]) == 0:
            return
        j = a[i][-1]
        if len(a[j]) == 0:
            return
        if a[j][-1] == i:
            if i < j:
                s.add((i, j))
            else:
                s.add((j, i))
    
    for i in range(n):
        check(i, s)
    day = 0
    while s:
        day += 1
        prevS = set()
        s, prevS = prevS, s
        for p in prevS:
            i = p[0]
            j = p[1]
            a[i].pop()
            a[j].pop()
        for p in prevS:
            i = p[0]
            j = p[1]
            check(i, s)
            check(j, s)
    
    for i in range(n):
        if len(a[i]):
            print(-1)
            return
    print(day)
    return

main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = [list(map(lambda x: int(x)-1, input().split())) for _ in range(n)]
    id = [[0]*n for _ in range(n)]
    V = 0
    for i in range(n):
        for j in range(n):
            if i<j:
                id[i][j] = V
                V += 1
    def toID(i, j):
        if i<j:
            return id[i][j]
        else:
            return id[j][i]
    
    to = [[] for _ in range(V)]
    for i in range(n):
        for j in range(n-1):
            a[i][j] = toID(i, a[i][j])
        for j in range(n-2):
            to[a[i][j+1]].append(a[i][j])

    dp, visited, calculated = [1] * V, [0] * V, [0] * V

    def dfs(v, dp, visited, calculated):
        if visited[v]:
            if not calculated[v]:
                return -1
            return dp[v]
        visited[v] = 1
        for u in to[v]:
            res = dfs(u, dp, visited, calculated)
            if res == -1:
                return -1
            dp[v] = max(dp[v], res+1)
        calculated[v] = 1
        return dp[v]

    ans = 0
    for v in range(V):
        res = dfs(v, dp, visited, calculated)
        if res == -1:
            print(-1)
            return
        ans = max(ans, res)
    print(ans)
    return

main()
Problem p03045 (python)

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

def dfs(x, g, vis):
    if vis[x]:
        return
    vis[x] = 1
    for y in g[x]:
        dfs(y, g, vis)

def main():
    N, M = map(int, input().split())
    g = [[] for _ in range(N)]
    for i in range(M):
        X, Y, Z = map(int, input().split())
        X -= 1
        Y -= 1
        g[X].append(Y)
        g[Y].append(X)
    vis = [0] * N

    ans = 0
    for i in range(N):
        if vis[i] == 0:
            dfs(i, g, vis)
            ans += 1
    print(ans)

main()

Buggy submission (verdict: Runtime Error):
def dfs(x, g, vis):
    if vis[x]:
        return
    vis[x] = 1
    for y in g[x]:
        dfs(y, g, vis)

def main():
    N, M = map(int, input().split())
    g = [[] for _ in range(N)]
    for i in range(M):
        X, Y, Z = map(int, input().split())
        X -= 1
        Y -= 1
        g[X].append(Y)
        g[Y].append(X)
    vis = [0] * N

    ans = 0
    for i in range(N):
        if vis[i] == 0:
            dfs(i, g, vis)
            ans += 1
    print(ans)

main()
Problem p03075 (python)

Fixed submission:
l = [int(input()) for _ in range(5)]
k = int(input())
if max(l) - min(l) > k:
    print(':(')
else:
    print('Yay!')

Buggy submission (verdict: Runtime Error):
import itertools

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

AB = []
for p in itertools.product(A, B):
    AB.append(sum(p))
AB.sort(reverse=True)
AB = AB[:K]

l = []
for p in itertools.product(AB, C):
    l.append(sum(p))
l.sort(reverse=True)
for i in range(K):
    print(l[i])
Problem p03104 (python)

Fixed submission:
A, B = map(int, input().split())
def xorchk(n):
    if n%4 == 0:
        return n
    elif n%4 == 1:
        return 1
    elif n%4 == 2:
        return n+1
    else:
        return 0
print(xorchk(A-1)^xorchk(B))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
l = []
keta = int(math.log2(B)) + 1
fmt = '0' + str(keta) + 'b'
for i in range(A, B+1):
    l.append(format(i, fmt))
bbin = ['0'] * keta
for j in range(keta):
    for i in range(A, B+1):
        if l[i-A][j] == '1':
            if bbin[j] == '0':
                bbin[j] = '1'
            else:
                bbin[j] = '0'
print(int("".join(bbin), 2))
Problem p02546 (python)

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

Buggy submission (verdict: Runtime Error):
if S[-1] == "s":
  print(S + "es")
else:
  print(S + "s")

Buggy submission (verdict: Runtime Error):
if S[-1] == s:
  print(S + "es")
else:
  print(S + "s")
Problem p02547 (python)

Fixed submission:
cnt = 0
zorome = 0
num = int(input())

while cnt < num:
  mass = input().split()
  
  if(mass[0] == mass[1]):
    zorome += 1
    
    if(zorome >= 3):
      break
  else:
    zorome = 0
  
  cnt += 1

print("Yes" if zorome >= 3 else "No")

Buggy submission (verdict: Runtime Error):
cnt = 0
zorome = 0
num = input()

while cnt < num:
  mass = input().split()
  
  if(mass[0] == mass[1]):
    zorome += 1
    
    if(zorome >= 3):
      break
  else:
    zorome = 0
  
  cnt += 1

print("Yes" if zorome >= 3 else "No")

Buggy submission (verdict: Runtime Error):
cnt = 0
zorome = 0
num = input()

while cnt < num:
  mass = input().split()
  
  if(mass[0] == mass[1]):
    zorome += 1
    
    if(zorome >= 3):
      break
  
  cnt += 1

print("Yes" if zorome >= 3 else "No")
Problem p02577 (python)

Fixed submission:
import math

n = input()

n_list = map(int, list(n))
ans = sum(n_list)

print("Yes" if (ans % 9) == 0 else "No")

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

n_list = list(n)
ans = sum(n_list)

print("Yes" if (ans % 9) == 0 else "No")
Problem p02793 (python)

Fixed submission:
from fractions import gcd

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

n = int(input())
a = list(map(int,input().split()))
g = a[0]
for i in range(n):
  g = lcm(g,a[i])
ans = 0
for i in range(n):
  ans += g // a[i]
print(ans%1000000007)

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

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

n = int(input())
a = list(map(int,input().split()))
g = a[0]
for i in range(n):
  g = lcm(g,a[i])
ans = 0
for i in range(n):
  ans += g/a[i]
print(int(ans%1000000007))
Problem p02676 (python)

Fixed submission:
K, S = int(input()), input()
if len(S) <= K:
  print(S)
else:
  print(S[:K] + "...")

Buggy submission (verdict: Runtime Error):
K, S = int(input()), input()
if len(S) <= K:
  print(S)
else:
  print(S[:K] + ...)
Problem p02682 (python)

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

Buggy submission (verdict: Runtime Error):
A, B, C, K = map(int, input().split())
lst = [1] * A + [0] * B + [-1] * C
print(sum(sorted(lst)[-K:]))
Problem p02701 (python)

Fixed submission:
N = int(input())
gacha = set()
for _ in range(N):
  gacha.add(input())
print(len(gacha))

Buggy submission (verdict: Runtime Error):
N = int(input())
gacha = set()
for _ in range(N):
  gacha.append(input())
print(len(gacha))
Problem p02916 (python)

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

ans = sum(B)
for i in range(N-1):
  if A[i]+1 == A[i+1]:
    ans += C[A[i]-1]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = sum(B) + sum(C) - C[A[N-1] - 1]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N-1):
  ans += B[A[i]-1] + C[A[i]-1]
ans += B[A[i]-1]
print(ans)
Problem p02831 (python)

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

Buggy submission (verdict: Runtime Error):
from fractions import gcd
a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) // fractions.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 p02833 (python)

Fixed submission:
N = int(input())
n = N
count = 0
i = 0
if n%2 == 0:
    while n >= 10*(5**i):
        count += n//(10*(5**i))
        n = N
        i += 1
    print(count)
else:
    print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
def F(n):
    if n < 2:
        return 1
    return n*F(n-2)
i = 0
f = F(n)
while f%2==0:
    f=f/2
    i += 1

j = 0
while f%5==0:
    f=f/5
    j += 1
print(min(i,j))