Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
li_a = list(map(int, input().split()))
li_b = list(map(int, input().split()))
li_c = list(map(int, input().split()))
ans = 0
for i in range(n):
  ans += li_b[li[i]]
  if i-1 >= 0:
      if li_a[i] == li_a[i-1]:
        ans += li_c[i-1]
print(ans)

Fixed submission:
n = int(input())
aaa = list(map(int, input().split()))
li_a = []
for i in aaa:
  i -= 1
  li_a.append(i)
li_b = list(map(int, input().split()))
li_c = list(map(int, input().split()))
ans = 0
for i in range(n):
  ans += li_b[li_a[i]]
  if i-1 >= 0:
      if li_a[i] == li_a[i-1]+1:
        ans += li_c[li_a[i-1]]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
b = list(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[i] = max(ans[i], b[i])
  if i >= 1:
    ans[i] = max(ans[i], b[i-1])
print(sum(ans))

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
ans = [0]*n
ans[0] = b[0]
for i in range(1, n-1):
  ans[i] = min(b[i-1], b[i])
ans[n-1] = b[n-2]
print(sum(ans))
Buggy python submission (verdict: Runtime Error):
x = input()
y = input()
ans = 0
for i in range(len(x)):
  for j in range(len(y)):
    if i == j:
      if li[i] == li[j]:
        ans += 1
print(ans)


Fixed submission:
x = input()
y = input()
ans = 0
for i in range(len(x)):
  for j in range(len(y)):
    if i == j:
      if x[i] == y[j]:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
x = input()
y = input()
ans = 0
for i in range(len(x)):
  for j in range(len(y)):
    if i == j:
      if li[i] != li[j]:
        ans += 1
print(ans)

Fixed submission:
x = input()
y = input()
ans = 0
for i in range(len(x)):
  for j in range(len(y)):
    if i == j:
      if x[i] == y[j]:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
s1 = list(map(str, input().split()))
s2 = list(map(str, input().split()))
ans = 0
for i in range(3):
  if s1[i] == s2[i]:
    ans += 1
print(ans)

Fixed submission:
x = input()
y = input()
ans = 0
for i in range(len(x)):
  for j in range(len(y)):
    if i == j:
      if x[i] == y[j]:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
from collections import deque, defaultdict
n, q = map(int, input().split())
#隣接リスト
G = defaultdict(lambda:[])
#################################
for _ in range(n-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    G[a].append(b)
    G[b].append(a)
    
#################################

#深さ優先探索でトポロジカル順序を決める
#右奥から調べていく
parent = [0]*n #p[i]:頂点iの親
order = [] #トポロジカル順序
def dfs():
    parent[0] = -1
    stack = []
    u = 0
    stack.append(u)
    while stack:
        x = stack.pop()
        order.append(x)
        for v in G[x]:
            if v == parent[x]:
                continue
            parent[v] = x
            stack.append(v)

dfs()
################################
point = [0]*n
def f(p, x):
    p -=1
    ind = order.index(p)
    order1 = order[ind:]
    order2 = order[:ind]
    order2.append(-1)
    for i in order1:
        if i == p:
            point[i] += x
        else:
            if parent[i] not in order2:
                point[i] += x
            else:
                break
    
for i in range(q):
    p, x = map(int, input().split())
    f(p, x)

print(*point)

Fixed submission:
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
from collections import deque, defaultdict
n, q = map(int, input().split())
#隣接リスト
G = defaultdict(lambda:[])
#################################
for _ in range(n-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    G[a].append(b)
    G[b].append(a)
    
#################################

#深さ優先探索でトポロジカル順序を決める
#右奥から調べていく
parent = [0]*n #p[i]:頂点iの親
order = [] #トポロジカル順序
def dfs():
    parent[0] = -1
    stack = []
    u = 0
    stack.append(u)
    while stack:
        x = stack.pop()
        order.append(x)
        for v in G[x]:
            if v == parent[x]:
                continue
            parent[v] = x
            stack.append(v)

dfs()
################################
point = [0]*n
for i in range(q):
    p, x = map(int, input().split())
    p -=1
    point[p] += x

for i in order:
    if parent[i] != -1:
        point[i] += point[parent[i]]

print(*point)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input())
vv = max(x+y, x-y)
vv = max(vv, x*y)
print(vv)

Fixed submission:
x, y = map(int, input().split())
vv = max(x+y, x-y)
vv = max(vv, x*y)
print(vv)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
n = int(input())
li = []
for _ in range(n):
  s = input()
  temp = []
  dd = defaultdict(lambda:0)
  for i in s:
    dd[i] += 1
  for key in dd:
    temp.append((key, dd[key]))
  temp.sort()
  li.append(temp)
li.sort()
ans = 0
k = 0
for i in range(n):
  if i == n-1:
    ans += (k*(k+1))//2
  else:
    if li[i] == li[i+1]:
      k += 1
    else:
      ans += (k*(k+1))//2
      k = 0
print(ans)

Fixed submission:
from collections import defaultdict
n = int(input())
li = []
for _ in range(n):
  s = input()
  temp = []
  dd = defaultdict(lambda:0)
  for i in s:
    dd[i] += 1
  for key in dd:
    temp.append((key, dd[key]))
  temp.sort()
  li.append(temp)
li.sort()
ans = 0
k = 0
for i in range(n):
  if i == n-1:
    ans += (k*(k+1))//2
  else:
    if li[i] == li[i+1]:
      k += 1
    else:
      ans += (k*(k+1))//2
      k = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
k -= 1
if s[k] == 'A':
  s[k] = 'a'
elif s[k] == 'B':
  s[k] = 'b'
else:
  s[k] = 'c'
print(s)

Fixed submission:
n, k = map(int, input().split())
s = list(input())
k -= 1
if s[k] == 'A':
  s[k] = 'a'
elif s[k] == 'B':
  s[k] = 'b'
else:
  s[k] = 'c'
ans = ''
for i in s:
  ans += i
print(ans)
Buggy python submission (verdict: Runtime Error):
s = list(input())
year = int(s[:4])
manth = int(s[5:7])
day = int(s[9:])
if year > 2019:
  print('TBD')
elif year < 2019:
  print('Heisei')
else:
  if month > 4:
    print('TBD')
  elif month < 4:
    print('Heisei')
  else:
    if day > 30:
      print('TBD')
    else:
      print('Heisei')

Fixed submission:
s = input()
year = int(s[:4])
month = int(s[5:7])
day = int(s[9:])
if year > 2019:
  print('TBD')
elif year < 2019:
  print('Heisei')
else:
  if month > 4:
    print('TBD')
  elif month < 4:
    print('Heisei')
  else:
    if day > 30:
      print('TBD')
    else:
      print('Heisei')
Buggy python submission (verdict: Runtime Error):
import math.gcd
a, b = map(int, input.split())
if gcd(a, b) != 1:
  print(b-a)
else:
  print(a+b)


Fixed submission:
a, b = map(int, input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)

Buggy python submission (verdict: Runtime Error):
import fanctions.gcd
a, b = map(int, input.split())
if gcd(a, b) != 1:
  print(b-a)
else:
  print(a+b)

Fixed submission:
a, b = map(int, input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

x, y  = map(int, input().split())
li =[]
for i in range(x):
    l = list(map(int, input().split()))
    li.append(l)
dp = [[0]*(y+1) for _ in range(x+1)]
for i in range(x):
    for j in range(1, y+1):
        if j - li[i][0] >= 0:
            dp[i+1][j] = max(dp[i][j],dp[i][j - li[i][0] ]+ li[i][1])
        else:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])
print(dp[x][y])


Fixed submission:
import sys
input = sys.stdin.readline

x, y  = map(int, input().split())
li =[]
for i in range(x):
    l = list(map(int, input().split()))
    li.append(l)
dp = [[0]*(y+1) for _ in range(x+1)]
for i in range(x):
    for j in range(1, y+1):
        if j - li[i][0] >= 0:
            dp[i+1][j] = max(dp[i][j],dp[i][j - li[i][0] ]+ li[i][1])
        else:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])
print(dp[x][y])
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

x, y  = map(int, input().split())
li =[]
for i in range(x):
    l = list(map(int, input().split()))
    li.append(l)
dp = [[0]*(y+1) for _ in range(x+1)]
for i in range(x):
    for j in range(1, y+1):
        if j - li[i][0] >= 0:
            dp[i+1][j] = max(dp[i][j],dp[i][j - li[i][0] ]+ li[i][1])
        else:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])
print(dp[x][y])

Fixed submission:
n, W = map(int, input().split())
w = [0]*n
v = [0]*n
for i in range(n):
    w[i], v[i] = map(int, input().split())
    
INF = 10 ** 15
dp = [[INF]*(10**5+1) for _ in range(n+1)]
dp[0][0] = 0

for i in range(n):
    for sum_v in range(10**5+1):
        if sum_v - v[i] >= 0:
            dp[i+1][sum_v] = min(dp[i][sum_v], dp[i][sum_v - v[i]]+w[i] )
        else:
            dp[i+1][sum_v] = dp[i][sum_v]

max_v =0
for sum_v in range(10**5+1):
    if dp[n][sum_v] <= W:
        max_v = sum_v

print(max_v)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = n//2
k = s-k
print(s*k)

Fixed submission:
n = int(input())
s = n//2
k = n-s
print(s*k)
Buggy python submission (verdict: Runtime Error):
a, b = int(input())
s = a+b
t = a-b
p = a*b
li = [s, t, p]
li.sort()
print(li[-1])

Fixed submission:
a, b = map(int, input().split())
s = a+b
t = a-b
p = a*b
li = [s, t, p]
li.sort()
print(li[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
min_ = 10**12
for i in range(n):
    s1 =s[:i]
    s2 =s[i:]
    hantai = 0
    for k in s1:
        if k == 'W':
            hantai += 1
    for k in s2:
        if k == 'E':
            hantai += 1
    min_ = min(min_, hantai)
    
print(min_)

Fixed submission:
n = int(input())
s = input()
INF = 10**12
li = [INF]*n
c = 0
for i in range(len(s)):
    if i == 0:
        continue
    else:
        if s[i] == 'E':
            c+=1
li[0] = c
for i in range(n):
    if i == 0:
        continue
    else:
        li[i] = li[i-1]
        if s[i] == 'E':
            li[i] -= 1
        if s[i-1] == 'W':
            li[i] += 1

print(min(li))
Buggy python submission (verdict: Time Limit Exceeded):

s = input()
k = int(input())
dd = {}
if len(s) == 1:
    print(s)
    exit()
for i in range(len(s)):
    dd[s[i]] = 1
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        dd[s[i:j+1]] = 1
li = []
for key in dd:
    li.append(key)
li.sort()
print(li[k-1])

Fixed submission:
from collections import defaultdict
s = input()
k = int(input())
dd = {}
if len(s) == 1:
    print(s)
    exit()
for i in range(len(s)):
    dd[s[i]] = 1
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        if j-i+1 <= k:
            dd[s[i:j+1]] = 1
li = []
for key in dd:
    li.append(key)
li.sort()
print(li[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
s = input()
k = int(input())
dd = {}
if len(s) == 1:
    print(s)
    exit()
for i in range(len(s)):
    dd[s[i]] = 1
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        dd[s[i:j+1]] = 1
li = []
for key in dd:
    li.append(key)
li.sort()
print(li[k-1])

Fixed submission:
from collections import defaultdict
s = input()
k = int(input())
dd = {}
if len(s) == 1:
    print(s)
    exit()
for i in range(len(s)):
    dd[s[i]] = 1
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        if j-i+1 <= k:
            dd[s[i:j+1]] = 1
li = []
for key in dd:
    li.append(key)
li.sort()
print(li[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
s = input()
k = int(input())
dd = defaultdict(lambda:0)
if len(s) == 1:
    print(s)
    exit()
for i in range(len(s)):
    dd[s[i]] = 1
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        dd[s[i:j+1]] = 1
li = []
for key in dd:
    li.append(key)
li.sort()
print(li[k-1])

Fixed submission:
from collections import defaultdict
s = input()
k = int(input())
dd = {}
if len(s) == 1:
    print(s)
    exit()
for i in range(len(s)):
    dd[s[i]] = 1
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        if j-i+1 <= k:
            dd[s[i:j+1]] = 1
li = []
for key in dd:
    li.append(key)
li.sort()
print(li[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
s = input()
k = int(input())
dd = defaultdict(lambda:0)
if len(s) == 1:
    print(s)
    exit()
for i in range(len(s)):
    dd[s[i]] = 1
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        dd[s[i:j+1]] = 1
li = []
for key in dd:
    li.append(key)
li.sort()
print(li[k-1])

Fixed submission:
from collections import defaultdict
s = input()
k = int(input())
dd = {}
if len(s) == 1:
    print(s)
    exit()
for i in range(len(s)):
    dd[s[i]] = 1
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        if j-i+1 <= k:
            dd[s[i:j+1]] = 1
li = []
for key in dd:
    li.append(key)
li.sort()
print(li[k-1])
Buggy python submission (verdict: Runtime Error):
a, b, x = int(input())
if x < a:
  print('NO')
elif a+b < x:
  print('NO')
else:
  print('YES')

Fixed submission:
a, b, x = map(int, input().split())
if x < a:
  print('NO')
elif a+b < x:
  print('NO')
else:
  print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_right, bisect_left
n = int(input())
li_a = list(map(int, input().split()))
li_b = list(map(int, input().split()))
li_c = list(map(int, input().split()))
li_a.sort()
li_b.sort()
li_c.sort()
relation_bc = [] #relation_bc[i] : 大きい方からi番目のbより大きいcがいくつあるか
for i in range(n):
    i += 1
    j = li_b[(-1)*i]
    k = bisect_right(li_c, j)
    relation_bc.append(len(li_c)-k)
ans = 0
for i in li_a:
    p = bisect_right(li_b, i) # i より大きいbがいくつあるか調べる
    p = n - p
    if p >= 1:
        s = 0
        for j in range(p):
            s += relation_bc[j]
        ans += s
    else:
        continue
print(ans)

Fixed submission:
from bisect import bisect_right, bisect_left
from itertools import accumulate
n = int(input())
li_a = list(map(int, input().split()))
li_b = list(map(int, input().split()))
li_c = list(map(int, input().split()))
li_a.sort()
li_b.sort()
li_c.sort()
relation_bc = [] #relation_bc[i] : 大きい方からi番目のbより大きいcがいくつあるか
for i in range(n):
    i += 1
    j = li_b[(-1)*i]
    k = bisect_right(li_c, j)
    relation_bc.append(len(li_c)-k)
ans = 0
li = list(accumulate(relation_bc))
for i in li_a:
    p = bisect_right(li_b, i) # i より大きいbがいくつあるか調べる
    p = n - p
    if p >= 1:
        ans += li[p-1]
    else:
        continue
print(ans)
Buggy python submission (verdict: Runtime Error):
s = list(input())
if '9' in li:
  print('Yes')
else:
  print('No')

Fixed submission:
li = list(input())
if '9' in li:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = int(int, input().split())
machi = []
li_x = []
li_y = []
for i in range(n):
    x, y = map(int, input().split())
    li_x.append((x, i))
    li_y.append((y, i))
    machi.append((x, y, i))
li_x.sort()
li_y.sort()
edge = [[] for _ in range(n)]
for i in range(n-1):
    edge[li_x[i][1]].append((li_x[i+1][0]-li_x[i][0], li_x[i+1][1]))
    edge[li_x[i+1][1]].append((li_x[i+1][0]-li_x[i][0], li_x[i][1]))
    edge[li_y[i][1]].append((li_y[i+1][0]-li_y[i][0], li_y[i+1][1]))
    edge[li_y[i+1][1]].append((li_y[i+1][0]-li_y[i][0], li_y[i][1]))

import heapq
def prim_heap(edge, n):
    used = [True] * n # True ：　不使用husiyou
    edgelist = []
    for e in edge[0]:
        heapq.heappush(edgelist, e)
    used[0] = False
    res = 0
    while len(edgelist) != 0:
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist, e)
        res += minedge[0]
    return res
print(prim_heap(edge, n))

Fixed submission:
n = int(input())
machi = []
li_x = []
li_y = []
for i in range(n):
    x, y = map(int, input().split())
    li_x.append((x, i))
    li_y.append((y, i))
    machi.append((x, y, i))
li_x.sort()
li_y.sort()
edge = [[] for _ in range(n)]
for i in range(n-1):
    edge[li_x[i][1]].append((li_x[i+1][0]-li_x[i][0], li_x[i+1][1]))
    edge[li_x[i+1][1]].append((li_x[i+1][0]-li_x[i][0], li_x[i][1]))
    edge[li_y[i][1]].append((li_y[i+1][0]-li_y[i][0], li_y[i+1][1]))
    edge[li_y[i+1][1]].append((li_y[i+1][0]-li_y[i][0], li_y[i][1]))

import heapq
def prim_heap(edge, n):
    used = [True] * n # True ：　不使用husiyou
    edgelist = []
    for e in edge[0]:
        heapq.heappush(edgelist, e)
    used[0] = False
    res = 0
    while len(edgelist) != 0:
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist, e)
        res += minedge[0]
    return res
print(prim_heap(edge, n))
Buggy python submission (verdict: Runtime Error):
x = list(input())
cnt = 0
for i in x:
  if x == 'S':
    cnt += 1
  elif y == 'T':
    if cnt > 0:
      cnt -= 1
    else:
      continue
print(len(x)-cnt)

Fixed submission:
x = list(input())
cnt = 0
a = 0
for i in x:
  if i == 'S':
    cnt += 1
  elif i == 'T':
    if cnt > 0:
      cnt -= 1
    else:
      a += 1
print(a+cnt)
Buggy python submission (verdict: Runtime Error):
X, N = [int(i) for i in input().split()]
if N==0:
    P = list(range(1, 101))
else:
    P = list(set(range(1, 101)) - {int(i) for i in input().split()})
P.sort()

D = [abs(P[i]-X) for i in range(len(P))]

print(P[D.index(min(D))])

Fixed submission:
X, N = [int(i) for i in input().split()]
if N==0:
    print(X)
    quit()
P = list(set(range(-10, 110)) - {int(i) for i in input().split()})
# X = 10
# P = list(set(range(-10, 110)) - set(range(1, 101)))

P.sort()

D = [abs(P[i]-X) for i in range(len(P))]

print(P[D.index(min(D))])
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

has_snack = set()
for i in range(K):
    d = int(input())
    A = set(map(int, input().split()))
    has_snack += A

print(N-len(has_snack))

Fixed submission:
N, K = [int(i) for i in input().split()]
S = {i for i in range(1, N+1)}

for i in range(K):
    d = int(input())
    A = set([int(i) for i in input().split()])
    S = S - (S & A)

print(len(S))
Buggy python submission (verdict: Time Limit Exceeded):

for i in range(10**11):
    pass



Fixed submission:
S = input()
if S[2]==S[3] and S[4]==S[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
from heapq import heappush, heappop

N, X, Y = [int(i) for i in input().split()]
X -= 1
Y -= 1
G = [[] for _ in range(N)]
for i in range(N):
    if i!=0: G[i].append((i-1, 1))
    if i!=N-1: G[i].append((i+1, 1))
G[X].append((Y, 1))
G[Y].append((X, 1))

INF = 10**30
def Johnson(G, N):
    h = [0]*N

    update = 1
    for i in range(N):
        update = 0
        for v in range(N):
            d = h[v]
            for w, c in G[v]:
                if c + d < h[w]:
                    h[w] = d + c
                    update = 1
        if not update:
            break
    else:
        return None

    for v in range(N):
        d = h[v]
        g = G[v]
        for j, (w, c) in enumerate(g):
            g[j] = (w, c + d - h[w])

    D = []
    for i in range(N):
        dst = [INF]*N
        dst[i] = 0
        que = [(0, i)]
        while que:
            cost, v = heappop(que)
            if dst[v] < cost:
                continue
            for w, c in G[v]:
                if cost + c < dst[w]:
                    dst[w] = r = cost + c
                    heappush(que, (r, w))
        v = h[i]
        for j in range(N):
            if dst[j] == INF:
                dst[j] = INF
            else:
                dst[j] -= v - h[j]
        D.append(dst)

    return D
res = [0]*(N+2)
D = Johnson(G, N)
for i in range(N):
    for j in range(i+1, N):
        res[D[i][j]] += 1

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

Fixed submission:
from collections import deque
N, X, Y = [int(i) for i in input().split()]
X -= 1
Y -= 1
G = [[] for _ in range(N)]
for i in range(N):
    if i!=0: G[i].append(i-1)
    if i!=N-1: G[i].append(i+1)
G[X].append(Y)
G[Y].append(X)


def bfs(G, N, s):
    dist = [-1]*N
    que = deque([s])
    dist[s] = 0
    while que:
        v = que.popleft()
        d = dist[v]
        for w in G[v]:
            if dist[w] > -1:
                continue
            dist[w] = d + 1
            que.append(w)
    return dist

res = [0]*(N+1)
for i in range(N):
    d = bfs(G, N, i)
    for j in range(i+1, N):
        res[d[j]] += 1

for i in range(1, N):
    print(res[i])
Buggy python submission (verdict: Runtime Error):
H, W = [int(i) for i in input().split()]

if H==1 or W==1:
    print(1)
    quit()
if H%2==0:
    H //= 2
    print(H*W)
elif W%2==0:
    W //= 2
    print(H*W)
else:
    W -= 1
    c = (W//2)*H
    c += H//2 + 1
    print(c)


Fixed submission:
print([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][int(input())-1])
Buggy python submission (verdict: Runtime Error):
A, B, M = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
mina, minb = min(a), min(b)
minv = mina+minb
for _ in range(M):
    x, y, c = [int(i) for i in input().split()]
    x -= 1
    y -= 1
    minv = min(minv, a[x]+a[y]-c)


print(minv)

Fixed submission:
A, B, M = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
mina, minb = min(a), min(b)
minv = mina+minb
for _ in range(M):
    x, y, c = [int(i) for i in input().split()]
    x -= 1
    y -= 1
    minv = min(minv, a[x]+b[y]-c)


print(minv)

Buggy python submission (verdict: Runtime Error):
A, B ,M = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
mina, minb = min(a), min(b)
minv = 10000000000
for _ in range(M):
    x, y, c = [int(i) for i in input().split()]
    x -= 1
    y -= 1
    minv = min(minv, a[x]+a[y]-c)


print(min(minv, mina+minb))

Fixed submission:
A, B, M = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
mina, minb = min(a), min(b)
minv = mina+minb
for _ in range(M):
    x, y, c = [int(i) for i in input().split()]
    x -= 1
    y -= 1
    minv = min(minv, a[x]+b[y]-c)


print(minv)
Buggy python submission (verdict: Runtime Error):
n = int(input())
S=input()
c=0
for i in range(n):
    if S[i]=="A":
        if S[i+1]=="B":
            if S[i+2]=="C":
                c+=1
print(c)

Fixed submission:
n = int(input())
S=input()
c=0
for i in range(n-2):
    if S[i]=="A":
        if S[i+1]=="B":
            if S[i+2]=="C":
                c+=1
print(c)