Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import heapq
# dijkstra
# edges = |V|のリスト
# 頂点iから頂点jにコストwで移動可能な場合：edges[i] = [(j, w)]

def dijkstra(n, edges, start):
    INF = float('inf')
    vertices = [INF] * n # 初期化
    vertices[start] = 0 # スタートの距離はゼロ
    hq = [(0, start)]
    heapq.heapify(hq)

    while q:
        cost, v = heapq.heappop(hq)
        
        for to, w in edges[v]:
            if cost + w >= vertices[to]:
                continue
            vertices[to] = cost + w
            heapq.heappush(hq, (vertices[to], to))
    
    return vertices

# input
n, m, s, t = map(int, input().split())
G = [list(map(int, input().split())) for _ in range(m)]

G_yen = [[] for _ in range(n)]
G_snu = [[] for _ in range(n)]

s, t = s - 1, t - 1

for u, v, a, b in G:
    G_yen[u - 1].append((v - 1, a))
    G_yen[v - 1].append((u - 1, a))
    G_snu[u - 1].append((v - 1, b))
    G_snu[v - 1].append((u - 1, b))

yen = dijkstra(n, G_yen, s)
snu = dijkstra(n, G_snu, t)

ans = [INF]

for i in reversed(range(n)):
    tmp = snu[i] + yen[i]
    ans.append(min(ans[-1], tmp))

for i in reversed(ans[1:]):
    print(10 ** 15 - a)

Fixed submission:
import heapq
# dijkstra
# edges = |V|のリスト
# 頂点iから頂点jにコストwで移動可能な場合：edges[i] = [(j, w)]

def dijkstra(n, edges, start):
    INF = float('inf')
    vertices = [INF] * n # 初期化
    vertices[start] = 0 # スタートの距離はゼロ
    hq = [(0, start)]
    heapq.heapify(hq)

    while hq:
        cost, v = heapq.heappop(hq)
        
        for to, w in edges[v]:
            if cost + w >= vertices[to]:
                continue
            vertices[to] = cost + w
            heapq.heappush(hq, (vertices[to], to))
    
    return vertices

# input
n, m, s, t = map(int, input().split())
G = [list(map(int, input().split())) for _ in range(m)]
INF = float('inf')


G_yen = [[] for _ in range(n)]
G_snu = [[] for _ in range(n)]

s, t = s - 1, t - 1

for u, v, a, b in G:
    G_yen[u - 1].append((v - 1, a))
    G_yen[v - 1].append((u - 1, a))
    G_snu[u - 1].append((v - 1, b))
    G_snu[v - 1].append((u - 1, b))

yen = dijkstra(n, G_yen, s)
snu = dijkstra(n, G_snu, t)

ans = [INF]

for i in reversed(range(n)):
    tmp = snu[i] + yen[i]
    ans.append(min(ans[-1], tmp))

for i in reversed(ans[1:]):
    print(10 ** 15 - i)
Buggy python submission (verdict: Runtime Error):
import math
# input
N = input()

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

print(lcm_base(2, N))

Fixed submission:
# input
N = int(input())

if N % 2 == 0:
    print(N)
else:
    print(N * 2)
Buggy python submission (verdict: Runtime Error):
import statistics

# input
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
    A[i] = A[i] - (i + 1)

b = median_low(A)
ans = 0

for i in range(N):
    ans += abs(A[i] - b)

print(ans)



Fixed submission:
from statistics import median_low

# input
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
    A[i] = A[i] - (i + 1)

b = median_low(A)
ans = 0

for i in range(N):
    ans += abs(A[i] - b)

print(ans)
Buggy python submission (verdict: Runtime Error):
# input
A, B = map(int, input().input())

if A >= 9 or B >= 9:
    print(':(')
else:
    print('Yay')

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

if A >= 9 or B >= 9:
    print(':(')
else:
    print('Yay!')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())

nW = 0
nE = 0

for i in range(N):
    if S[i] == 'E':
        nE += 1
    else:
        nW += 1

count = N

for i in range(N):
    if S[i] == 'E':
        temp = 1
    else: 
        temp = 0
    tempW = 0
    tempE = 0
    for j in range(i):
        if S[j] == 'W':
            tempW += 1
        else:
            tempE += 1
    if tempW + nE - tempE - temp < count:
        count = tempW + nE - tempE - temp

print(count)

Fixed submission:
import math
import numpy as np

N = int(input())
S = list(input())

nW = [0 for i in range(N)] #iまでのWの数
nE = [0 for i in range(N)] #iまでのEの数

if S[0] == 'W':
    nW[0] = 1
else:
    nE[0] = 1

for i in range(1, N):
    if S[i] == 'W':
        nW[i] = nW[i-1] + 1
        nE[i] = nE[i-1]
    else:
        nW[i] = nW[i-1]
        nE[i] = nE[i-1] + 1

if nE[N-1] - nE[0] < nW[N-1]:
    count = nE[N-1] - nE[0]
else:
    count = nW[N-1]

for i in range(1,N-1):
    if nW[i-1] + nE[N-1] - nE[i] < count:
        count = nW[i-1] + nE[N-1] - nE[i]

print(count)

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

N = int(input())
S = list(input())

nW = [0 for i in range(N)]
nE = [0 for i in range(N)]

if S[0] == 'W':
    nW[0] = 1

if S[N-1] == 'E':
    nE[N-1] = 1

for i in range(1, N):
    if S[i] == 'W':
        nW[i] = nW[i-1] + 1
    else:
        nW[i] = nW[i-1]

for i in range(N-2,-1,-1):
    if S[i] == 'E':
        nE[i] = nE[i+1] + 1
    else:
        nE[i] = nE[i+1]

if nE[0] > nW[N-1]:
    count = nW[n-1]
else:
    count = nE[0]

for i in range(1,N-1):
    if nW[i-1] + nE[i+1] < count:
        count = nW[i-1] + nE[i+1]


print(count)

Fixed submission:
import math
import numpy as np

N = int(input())
S = list(input())

nW = [0 for i in range(N)] #iまでのWの数
nE = [0 for i in range(N)] #iまでのEの数

if S[0] == 'W':
    nW[0] = 1
else:
    nE[0] = 1

for i in range(1, N):
    if S[i] == 'W':
        nW[i] = nW[i-1] + 1
        nE[i] = nE[i-1]
    else:
        nW[i] = nW[i-1]
        nE[i] = nE[i-1] + 1

if nE[N-1] - nE[0] < nW[N-1]:
    count = nE[N-1] - nE[0]
else:
    count = nW[N-1]

for i in range(1,N-1):
    if nW[i-1] + nE[N-1] - nE[i] < count:
        count = nW[i-1] + nE[N-1] - nE[i]

print(count)
Buggy python submission (verdict: Runtime Error):
# input
N = int(input())
A = list(map(int, input().split()))

l, r, sum, ans = 0, 0, 0, 0
 
while r < N:
    if sum + A[r] == num ^ A[r]:
        sum += A[r]
        ans += r - l + 1
        r += 1
    else:
        sum -= A[l]
        l += 1
 
print(ans)

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

l, r, sum, ans = 0, 0, 0, 0
 
while r < N:
    if sum + A[r] == sum ^ A[r]:
        sum += A[r]
        ans += r - l + 1
        r += 1
    else:
        sum -= A[l]
        l += 1
 
print(ans)

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

l, r, sum, ans = 0, 0, 0, 0
 
while r < N:
    if num + A[r] == num ^ A[r]:
        num += A[r]
        ans += r - l + 1
        r += 1
    else:
        num -= A[l]
        l += 1
 
print(ans)

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

l, r, sum, ans = 0, 0, 0, 0
 
while r < N:
    if sum + A[r] == sum ^ A[r]:
        sum += A[r]
        ans += r - l + 1
        r += 1
    else:
        sum -= A[l]
        l += 1
 
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

# input
X = int(input())

ans = 1

for b in range(2, math.sqrt(X)):
    p = 1
    while b ** p <= X:
        if b ** p > ans:
            ans = b ** p
        p += 1

Fixed submission:
import math

# input
X = int(input())

ans = 1

for b in range(2, 32):
    p = 2
    while b ** p <= X:
        if b ** p > ans:
            ans = b ** p
        p += 1

print (ans)
Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())

sub = set()

for i in range(len(s)):
	for j in range(i + 1,i + K + 1):
		sub.add(s[i:j])

ans = list(sorted(sub))

print(sub[K - 1])

Fixed submission:
s = input()
K = int(input())

sub = set()

for i in range(len(s)):
	for j in range(i + 1,i + K + 1):
		sub.add(s[i:j])

ans = list(sorted(sub))

print(ans[K - 1])
Buggy python submission (verdict: Runtime Error):
# input
S = input()

ans = 0

for i in range(3):
    if S[i] == o:
        ans += 1

print(ans)

Fixed submission:
# input
S = input()

ans = 0

for i in range(3):
    if S[i] == 'o':
        ans += 1

ans = ans * 100 + 700

print(ans)
Buggy python submission (verdict: Runtime Error):
# input
S = set(input())

if S = set(a, b, c):
    print('Yes')
else:
    print('No')

Fixed submission:
# input
S = set(input())

if S == set(['a', 'b', 'c']):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for i in [0, A+1]:
    for j in [0, B+1]:
        for k in [0, C+1]:
            int tmp = i * 500 + j * 100 + k * 50
            if (tmp == X):
                ans += 1

print(ans)


Fixed submission:
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for i in range(0, A+1):
    for j in range(0, B+1):
        for k in range(0, C+1):
            tmp = i * 500 + j * 100 + k * 50
            if (tmp == X):
                ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
import math

def is_prime_sqrt(q): #合成数xはp<=sqrt(x)を満たす素因子pを持つ
    if q == 1: #1は素数ではない
        return False
    if q == 2: #2は素数
        return True
    elif q % 2 == 0: #2以外の偶数は合成数
        return False
    for divisor in range(3, math.floor(math.sqrt(q))+1, 2): #繰り返しの上限は平方根
        if q % divisor == 0: #平方根までに約数があれば合成数
            return False
    return True

Q = int(input())

for i in range(Q):
    l, r = map(int, input().split())
    n = 0
    for q in range(l,r+1,2):
        if is_prime_sqrt(q) and is_prime_sqrt((q+1)/2):
            n += 1
    print(n)


Fixed submission:
a = int(input())
print(48-a)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = input()
try:
    first, second = s.split("-")
    if len(first) == a and len(second) == b:
        print("Yes")
    else:  
        print("No")
except:
    print("No")

Fixed submission:
a = int(input())
print(48-a)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = input()
first, second = s.split("-")
if len(first) == a and len(second) == b:
    print("Yes")
else:
    print("No")


Fixed submission:
a = int(input())
print(48-a)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = input()
first, second = s.split("-")
if len(first) == a and len(second) == b:
    print("Yes")
else:
    print("No")


Fixed submission:
a, b = map(int, input().split())
s = input()
try:
    first, second = s.split("-")
    if len(first) == a and len(second) == b:
        print("Yes")
    else:  
        print("No")
except:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math

X, Y = map(int, input().split())
k = math.floor(math.log(Y/X, 2) + 1)
print(k)


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

if A + B > C + D:
    print("Left")
elif A + B < C + D:
    print("Right")
else:
    print("Balanced")
Buggy python submission (verdict: Runtime Error):
import math

s = list(input())
t = list(input())
s.sorted()
t.sorted()
if s < t:
    print('Yes')
else:
    print('No')


Fixed submission:
import math

s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
if s < t:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import math

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

def f7(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

a_unique = f7(a)

d = 0

for ai in a_unique:
    ni = a.count(ai)
    if ni < ai:
        d += ni
    else:
        d += ni - ai

print(d)



Fixed submission:
import math

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

#リストから重複を取り除く
def f7(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

d = 0

a_unique = {}

for i in range(0,len(a)):
    if a[i] in a_unique:
        a_unique[a[i]] += 1
    else:
        a_unique[a[i]] = 1

for ai in a_unique.keys():
    if a_unique[ai] >= ai:
        d += a_unique[ai] - ai
    else:
        d += a_unique[ai]

print(d)

Buggy python submission (verdict: Time Limit Exceeded):
import math

N = input()
a = list(map(int, input().split()))
a_unique = list(set(a))
d = 0

for ai in a_unique:
    ni = a.count(ai)
    if ni < ai:
        d += ni
    else:
        d += ni - ai

print(d)



Fixed submission:
import math

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

#リストから重複を取り除く
def f7(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

d = 0

a_unique = {}

for i in range(0,len(a)):
    if a[i] in a_unique:
        a_unique[a[i]] += 1
    else:
        a_unique[a[i]] = 1

for ai in a_unique.keys():
    if a_unique[ai] >= ai:
        d += a_unique[ai] - ai
    else:
        d += a_unique[ai]

print(d)
Buggy python submission (verdict: Runtime Error):
import math

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

#keyはA[i]、valueは登場回数
A_unique = {}
 
for i in range(0,len(A)):
    if A[i] in A_unique:
        A_unique[A[i]] += 1
    else:
        A_unique[A[i]] = 1
v = list(A_unique.values())
v.sort() #登場回数が少ない順に書き換えていく
A_length = len(A_unique.keys()) #元々のAの長さ
d = 0

for k in v:
    if  A_length - d < K:
        print(d)
        break
    else:
        d += A_unique[k] 


Fixed submission:
s = input()
num = list(map(int, str(s)))
print(num.count(1))
Buggy python submission (verdict: Runtime Error):
import math

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

#keyはA[i]、valueは登場回数
A_unique = {}
 
for i in range(0,len(A)):
    if A[i] in A_unique:
        A_unique[A[i]] += 1
    else:
        A_unique[A[i]] = 1
v = list(A_unique.values())
v.sort() #登場回数が少ない順に書き換えていく
A_length = len(A_unique.keys()) #元々のAの長さ
d = 0

for k in v:
    if  A_length - d < K:
        print(d)
        break
    else:
        d += A_unique[k] 


Fixed submission:
import math

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

#keyはA[i]、valueは登場回数
A_unique = {}
 
for i in range(0,len(A)):
    if A[i] in A_unique:
        A_unique[A[i]] += 1
    else:
        A_unique[A[i]] = 1
v = list(A_unique.values())
v.sort() #登場回数が少ない順に書き換えていく
A_length = len(A_unique.keys()) #元々のAに含まれる数字の種類
d = 0
n = 0

for k in v:
    if  A_length - n <= K:
        print(d)
        break
    else:
        d += k #d個を書き換え
        n += 1 #数字が1種類減る
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
l = [int(x) for x in list(str(N))]

if X%sum(l) == 0:
    print('Yes')
else:
    print('No')



Fixed submission:
import math

N = int(input())
l = [int(x) for x in list(str(N))]

if N%sum(l) == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
# input
N = [int(x) for x in list(input()]

if N[1] == N[2]:
    if N[0] == N[1] or N[2] == N[3]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Fixed submission:
# input
N = [int(x) for x in list(input())]

if N[1] == N[2]:
    if N[0] == N[1] or N[2] == N[3]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
# input
N = int(input())
L = [int(x) for x in list(str(N))]
ans = 0

if L[0] + L[1] + L[2] + L[3] == 7:
    print("%d+%d+%d+%d=7" % (L[0], L[1], L[2], L[3]))
else:
    if L[0] - L[1] + L[2] + L[3] == 7:
        print("%d-%d+%d+%d=7" % (L[0], L[1], L[2], L[3]))
    else:
        if L[0] + L[1] - L[2] + L[3] == 7:
            print("%d+%d-%d+%d=7" % (L[0], L[1], L[2], L[3]))
        else:
            if L[0] + L[1] + L[2] - L[3] == 7:
                print("%d+%d+%d-%d=7" % (L[0], L[1], L[2], L[3]))
            else:
                if L[0] - L[1] - L[2] + L[3] == 7:
                    print("%d-%d-%d+%d=7" % (L[0], L[1], L[2], L[3]))
                else:
                    if L[0] - L[1] + L[2] - L[3] == 7:
                        print("%d-%d+%d-%d=7" % (L[0], L[1], L[2], L[3]))
                    else:
                        if L[0] + L[1] - L[2] - L[3] == 7:
                            print("%d+%d-%d-%d=7" % (L[0], L[1], L[2], L[3]))
                        else:
                            if L[0] - L[1] - L[2] - L[3] == 7:
                                print("%d-%d-%d-%d=7" % (L[0], L[1], L[2], L[3]))



Fixed submission:
# input
L = [int(x) for x in list(input())]
ans = 0

if L[0] + L[1] + L[2] + L[3] == 7:
    print("%d+%d+%d+%d=7" % (L[0], L[1], L[2], L[3]))
else:
    if L[0] - L[1] + L[2] + L[3] == 7:
        print("%d-%d+%d+%d=7" % (L[0], L[1], L[2], L[3]))
    else:
        if L[0] + L[1] - L[2] + L[3] == 7:
            print("%d+%d-%d+%d=7" % (L[0], L[1], L[2], L[3]))
        else:
            if L[0] + L[1] + L[2] - L[3] == 7:
                print("%d+%d+%d-%d=7" % (L[0], L[1], L[2], L[3]))
            else:
                if L[0] - L[1] - L[2] + L[3] == 7:
                    print("%d-%d-%d+%d=7" % (L[0], L[1], L[2], L[3]))
                else:
                    if L[0] - L[1] + L[2] - L[3] == 7:
                        print("%d-%d+%d-%d=7" % (L[0], L[1], L[2], L[3]))
                    else:
                        if L[0] + L[1] - L[2] - L[3] == 7:
                            print("%d+%d-%d-%d=7" % (L[0], L[1], L[2], L[3]))
                        else:
                            if L[0] - L[1] - L[2] - L[3] == 7:
                                print("%d-%d-%d-%d=7" % (L[0], L[1], L[2], L[3]))
Buggy python submission (verdict: Time Limit Exceeded):
# input
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

# lst_A = list(range(N))
lst_B = list(range(N))

ans = 0

# for i in range(N):
#    for j in range(N):
#        if B[j] > A[i]:
#            for k in range(N):
#                if C[k] > B[j]:
#                    ans += N - k
#                    break

j, k = 0, 0

for i in range(N):
    while j < N and C[j] <= B[i]:
        j += 1
    lst_B[i] = N - j

for i in range(N):
    while k < N and B[k] <= A[i]:
        k += 1
    if k == N:
        ans += 0
    else:
        for l in range(k, N):
            ans += lst_B[l]

print(ans)


Fixed submission:
import bisect as bi

# input
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

count = 0

for b in B:
    i = bi.bisect_left(A, b) # A[0],...,A[i - 1] < b
    k = bi.bisect_right(C, b) # b < C[k],...C[N-1]
    count += i * (N - k)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# input
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

ans = 0

for i in range(N):
    for j in range(N):
        if B[j] > A[i]:
            for k in range(N):
                if C[k] > B[j]:
                    ans += N - k
                    break

print(ans)


Fixed submission:
import bisect as bi

# input
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

count = 0

for b in B:
    i = bi.bisect_left(A, b) # A[0],...,A[i - 1] < b
    k = bi.bisect_right(C, b) # b < C[k],...C[N-1]
    count += i * (N - k)

print(count)
Buggy python submission (verdict: Runtime Error):
# input
N_lst = [int(x) for x in list(input())]

if N_lst[0] == 9 or N_lst[1] == 9:
    print('Yes')
else:
    print('No')

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

ans = 0

for i in range(N):
    if X[i] >= K - X[i]:
        ans += 2 * (K - X[i])
    else:
        ans += 2 * X[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
# input
N_lst = [int(x) for x in list(input()]

if N_lst[0] == 9 or N_lst[1] == 9:
    print('Yes')
else:
    print('No')

Fixed submission:
# input
N_lst = [int(x) for x in list(input())]

if N_lst[0] == 9 or N_lst[1] == 9:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
# input
N = int(input())
L = [list(map(int, input().split()))]

ans = 0

for i in range(N):
    ans += L[i][1] - L[i][0] + 1

print(ans)

Fixed submission:
# input
N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]

ans = 0

for i in range(N):
    ans += L[i][1] - L[i][0] + 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# input
N = int(input())
A = [int(input()) for _ in range(N)]

Paper = []

for i in range(N):
    if A[i] in Paper:
        Paper.remove(A[i]) 
    else:
        Paper.append(A[i])

print(len(Paper))


Fixed submission:
# input
N = int(input())
A = [int(input()) for _ in range(N)]

A = sorted(A)
i = 0
ans = 0

while i < N:
    k = 1
    while (i + k) < N and A[i] == A[i + k]:
        k += 1
    if (k - 1) % 2 == 0:
        ans += 1
    i = i + k

print(ans)
Buggy python submission (verdict: Runtime Error):
import math

# input
s = input()

ans = ''

for i in range(math.ceil(len(s) // 2):
    ans = ans + s[2 * i]

print(ans)

Fixed submission:
import math

# input
s = input()

ans = ''

for i in range(math.ceil(len(s) / 2)):
    ans = ans + s[2 * i]

print(ans)

Buggy python submission (verdict: Runtime Error):
# input
s = input()

ans = ''

for i in range(len(s) // 2 + 1):
    ans = ans + s[2 * i]

print(ans)

Fixed submission:
import math

# input
s = input()

ans = ''

for i in range(math.ceil(len(s) / 2)):
    ans = ans + s[2 * i]

print(ans)
Buggy python submission (verdict: Runtime Error):
# input
s = input()

ans = s[0] + str(len(s) - 2) + s[len(str) - 1]

print(ans)

Fixed submission:
# input
s = input()

ans = s[0] + str(len(s) - 2) + s[len(s) - 1]

print(ans)
Buggy python submission (verdict: Runtime Error):
# input
N = int(input())
a = [int(input()) for _ in range(N)]

# 4の倍数, 奇数の数
i, j = 0, 0

for i in range(N):
    if a[i] % 4 == 0:
        i += 1
    elif a[i] % 2 == 1:
        j += 1

if j >= i + 2:
    print('No')
else:
    print('Yes')

Fixed submission:
# input
N = int(input())
a = list(map(int, input().split()))

# 4の倍数, 4の倍数でない偶数, 奇数の数
i, j, k = 0, 0, 0

for n in range(N):
    if a[n] % 4 == 0:
        i += 1
    elif a[n] % 2 == 0:
        j += 1
    else:
        k += 1

if k >= i + 2:
    print('No')
elif k == i + 1 and j >= 1:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
# input
N = int(input())
A = list(map(int, input().split()))

sum_A = sum(A)
ans = abs(2 * A[0] - sum_A)

for i in range(1, N - 1):
    temp = 0
    for j in range(i):
        temp += A[j]
    temp = abs(2 * temp - sum_A)
    if temp < ans:
        ans = temp

print(ans)



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

sum_A = sum(A)
temp = 2 * A[0] - sum_A
ans = abs(temp)

for i in range(1, N - 1):
    temp = temp + 2 * A[i]
    if abs(temp) < ans:
        ans = abs(temp)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# input
N = int(input())
A = [int(input()) for _ in range(N)]

reachable = []
i = 0
count = 1

while A[i] != 2:
    if A[i] in reachable:
        print(-1)
        exit()
    else:
        reachable.append(A[i])
        i = A[i] - 1
        count += 1

print(count)

Fixed submission:
# input
N = int(input())
A = [int(input()) for _ in range(N)]

b = []
count = 0
i = 0

while count < N:
    b.append(A[i])
    i = A[i] - 1
    count += 1

if 2 in b:
    for i in range(N):
        if b[i] == 2:
            print(i + 1)
            break
else:
    print(-1)