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

Fixed submission:
K=int(input())

if K%2==0:
    even=K/2
    ans=even**2
else:
    even=K//2
    ans=even*(even+1)
print(int(ans))

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

if K%2==0:
    even=K/2
    ans=even**2
    else:
        even=K//2
        ans=even**2+1
print(ans)
Problem p03273 (python)

Fixed submission:
H,W=map(int,input().split())
hw=[]
for _ in range(H):
    hw.append(input())

yoko_list=[]
tate_list=[]
for i in range(H):
    for j in range(W):
        if hw[i][j]=="#":
            break
        elif j==W-1:
            yoko_list.append(i)

for i in range(W):
    for j in range(H):
        if hw[j][i]=="#":
            break
        elif j==H-1:
            tate_list.append(i)

for i in range(H):
    if not i in yoko_list:
        p=0
        for j in range(W):
            if not j in tate_list:
                p+=1
                if p==W-len(tate_list):
                    print(hw[i][j])
                else:
                    print(hw[i][j],end="")

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
hw=[]
for _ in range(H):
    hw.append(input())

yoko_list=[]
tate_list=[]
for i in range(H):
    for j in range(W):
        if hw[i][j]=="#":
            break
        elif j==W-1:
            yoko_list.append(i)

for i in range(W):
    for j in range(H):
        if hw[j][i]=="#":
            break
        elif j==H-1:
            tateH,W=map(int,input().split())
Problem p03281 (python)

Fixed submission:
N=int(input())
if N>=195:
    print(5)
elif N>=189:
    print(4)
elif N>=165:
    print(3)
elif N>=135:
    print(2)
elif N>=105:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
if N>=189:
    print(3)
elif N>=165:
    print(2)
elif N>=105:
    print(1)
else:
    print(0)
Problem p03360 (python)

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

print(A+B+C+max(A,B,C)*(2**K-1))

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

print(A+B+C+max(A,B,C)*(2**K-1)
Problem p03387 (python)

Fixed submission:
abc=[int(i) for i in input().split()]

abc.sort()

def func(a,b,c):
    return int((c-a)/2+(c-b)/2)

if abc[0]%2==abc[1]%2:
    if abc[0]%2!=abc[2]%2:
        print(func(abc[0]+1,abc[1]+1,abc[2])+1)
    else:
        print(func(abc[0],abc[1],abc[2]))
else:
    if abc[0]%2==abc[2]%2:
        print(func(abc[0]+1,abc[1],abc[2]+1)+1)
    else:
        print(func(abc[0],abc[1]+1,abc[2]+1)+1)

Buggy submission (verdict: Runtime Error):
abc=[int(i) for i in input().split()]

abc.sort()

def func(a,b,c):
    return int((c-a)/2+(c-b)/2)


if abc[0]%2==abc[1]%2:
    if abc[0]%2!=abc[2]%2:
        print(func(abc[0]+1,abc[1]+1,abc[2])+1)
    else:
        print(func(abc[0],abc[1],abc[2]))
else:
    if abc[0]%2==abc[2]%2:
        print(func(abc[0]+1,abc[1],abc[2]+1)+1)
    else:
        print(func(abc[0],abc[1]+1,abc[2+1])+1)
Problem p04043 (python)

Fixed submission:
abc=[int(i) for i in input().split()]
num_five=0
num_seven=0

for i in range(3):
  if abc[i]==5:
    num_five+=1
  elif abc[i]==7:
    num_seven+=1

if num_five==2 and num_seven==1:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
abc=[int(i) for i in input().split()]
num_five=0
num_seven=0
for i in range(3):
  if abc[i]==5:
    num_five+=1
  elif abc[i]==7:
    num_five+=1

if num_five==2 and num_seven==1:
  print("YES")
 else:
  print("NO")
Problem p02713 (python)

Fixed submission:
K = int(input())
# K = 2
import math
import itertools

def better_gcd(a,b,c):
    tup = set((a,b,c))
    kinds = len(tup)
    if kinds == 3:
        return math.gcd(a, math.gcd(b, c)) * 6
    elif kinds == 2:
        return math.gcd(*tup) * 3
    else:
        return a

ans = 0
cands = list(itertools.combinations_with_replacement(range(1,K+1), 3))
for c in cands:
    ans += better_gcd(*c)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

def better_gcd(a,b,c):
    tup = set((a,b,c))
    kinds = len(tup)
    if kinds == 3:
        return math.gcd(a, math.gcd(b, c)) * 6
    elif kinds == 2:
        return math.gcd(*tup) * 3
    else:
        return a

ans = 0
cands = list(itertools.combinations_with_replacement(range(200), 3))
for c in cands:
    ans += better_gcd(*c)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

def better_gcd(a,b,c):
    tup = set((a,b,c))
    kinds = len(tup)
    if kinds == 3:
        return math.gcd(a, math.gdc(b, c))
    elif kinds == 2:
        return math.gcd(*tup)
    else:
        return a

K = int(input())
ans = 0
for i in range(1, 1+K):
    for j in range(1, 1+K):
        for k in range(1, 1+K):
            ans += better_gcd(i,j,k)
print(ans)
Problem p02719 (python)

Fixed submission:
N, K = map(int, input().split())
if N >= 2*K:
    s = N // K
    print(min(abs(N - s * K), abs(N- (s+1) * K)))
else:
    print(min(abs(N-K), abs(abs(N-K)-K)))

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
while(1):
    new_N = abs(N-K)
    if new_N >= N:
        print(N)
        break
    else:
        N=new_N
Problem p02802 (python)

Fixed submission:
_, M = map(int, input().split())
PS = [tuple(input().split()) for _ in range(M)]
result = dict()
AC, WA = 0, 0
for p,s in PS:
    i = int(p)
    if not (i in result):
        if s == "WA":
            result[i] = 1
        elif s == "AC":
            AC += 1
            result [i] = "AC"
    else:
        if result[i] != "AC":
            if s == "WA":
                result[i] += 1
            if s == "AC":
                AC += 1
                WA += result[i]
                result[i] = s
print(AC, WA)

Buggy submission (verdict: Runtime Error):
result = dict()
AC, WA = 0, 0
for p,s in PS:
    p = int(p)
    if not (p in result):
        result [p] = s
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
    elif result[p] == "AC":
        continue
    else:
        result[p] = s
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
print(AC, WA)
Problem p03149 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
k = [a, b, c, d]
k.sort()

if [1, 4, 7, 9] == k:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
if list(map(int,inpust().split())).sort()==[1,4,7,9]:print("YES")
else:print("NO")

Buggy submission (verdict: Runtime Error):
import sys

"""テンプレ"""

# 高速
input = sys.stdin.readline

# 1行を空白でリストにする(int)
def intline():
    return list(map(int, input().split()))


# 上のstrヴァージョン
def strline():
    return list(map(str, input().split()))


# 1列に並んだ数
def intlines(n):
    return [int(input() for _ in range(n))]


# 上の文字列ヴァージョン
def lines(n):
    return [input() for _ in range(n)]
    

"""ここからメインコード"""

k = intline().sort()
if k = [1, 4, 7, 9]:print("YES")
else:print("NO")
Problem p03210 (python)

Fixed submission:
n = int(input())
if n == 3 or n == 5 or n == 7:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 3 or n == 5 or b == 7:
    print("YES")
else:
    print("NO")
Problem p03214 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ave = sum(a) / n
b = 10000000
c = 0
for i in range(n):
    if b > abs(ave - a[i]):
        b = abs(ave - a[i])
        c = i
print(c)

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
c = []
i = 0
while i < k*10:
    m = n - i
    for j in range(i+1):
        c = a[j:j + m]
        if sum(c) != 0:
            b.append(sum(c))
    i += 1
d = sorted(b, reverse=True)
for i in range(k):
    c.append(d[i])

ans = d[0]
for i in range(k):
    if i+1 == len(c):
        break
    ans = ans & c[i+1]
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
c = []
i = 0
while i < n*(n-1)//2:
    m = n - i
    for j in range(i+1):
        c = a[j:j + m]
        if sum(c) != 0:
            b.append(sum(c))
    i += 1
d = sorted(b, reverse=True)
for i in range(k):
    c.append(d[i])

ans = d[0]
for i in range(k):
    if i+1 == len(c):
        break
    ans = ans & c[i+1]
print(ans)
Problem p03220 (python)

Fixed submission:
n = int(input())
t,a = map(int,input().split())
h = list(map(int, input().split()))
k = []
for i in h:
  k.append(abs(t - a - i * 0.006))
print(k.index(min(k))+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
t,a = map(int,input().split())
h = list(map(int, input().split()))
k = []
for i in h:
  k.append(abs(t - a - i * 0.006))
print(hh.index(min(k))+1)
Problem p03660 (python)

Fixed submission:
import sys
N = int(input())
g = [[] for _ in range(N + 5)]
Fennec = [0]*(N+10)
Sunuke = [0]*(N+10)
sys.setrecursionlimit(10**8)

def dfs(r,f,d,dist):
	dist[r]=d
	for x in range(len(g[r])):
		if g[r][x]==f : continue
		else : dfs(g[r][x],r,d+1,dist)

# main

for i in range(N-1):
	a,b=map(int,input().split())
	a-=1
	b-=1
	g[a].append(b)
	g[b].append(a)
dfs(0,-1,0,Fennec)
dfs(N-1,-1,0,Sunuke)
ans = int(0)

for i in range(N):
	if Fennec[i]<=Sunuke[i] : ans+=1
	else : ans-=1
if(ans>0):
	print("Fennec")
else:
	print("Snuke")

Buggy submission (verdict: Runtime Error):
N = int(input())
g = [[] for _ in range(N + 5)]
#g = [[0 for i in range(N+1)] for j in range(N+1)]
Fennec = [0]*(N+1)
Sunuke = [0]*(N+1)
mass = [0]*(N+1)

def dFs(r,f,d):
	Fennec[r]=int(d)
	for x in range(len(g[r])):
		if g[r][x]!= f:
			dFs(g[r][x],r,d+1)

def dfS(r,f,d):
	Sunuke[r]=int(d)
	for x in range(len(g[r])):
		if g[r][x]!= f:
			dfS(g[r][x],r,d+1)

# main

for i in range(N-1):
	a,b=map(int,input().split())
	a-=1
	b-=1
	g[a].append(b)
	g[b].append(a)
dFs(0,-1,0)
dfS(N-1,-1,0)
ans = int(0)

for i in range(N):
	if Fennec[i]<=Sunuke[i] : ans+=1
	else : ans-=1
if(ans>0):
	print("Fennec")
else:
	print("Snuke")
Problem p02705 (python)

Fixed submission:
import math
R = int(input())
ans = 2 * math.pi * R
print(ans)

Buggy submission (verdict: Runtime Error):
import math
ans = 2 * math.pi * R
print(ans)
Problem p02743 (python)

Fixed submission:
a,b,c = map(int,input().split())
if c-a-b < 0:
    print('No')
elif (c-a-b)**2-4*a*b > 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
import math
import decimal
decimal.getcontext().prec = 15
if decimal(math.sqrt(a))+decimal(math.sqrt(b)) < decimal(math.sqrt(c)):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
%%time
a,b,c = map(int,input().split())
import math
if (math.sqrt(a)+math.sqrt(b)) ** 2 < (numpy.sqrt(c) ** 2):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
import math
if (math.sqrt(a)+math.sqrt(b)) ** 2 < numpy.sqrt(c) ** 2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
import sympy
if sympy.sqrt(a)+sympy.sqrt(b) < sympy.sqrt(c):
    print('Yes')
else:
    print('No')
Problem p02761 (python)

Fixed submission:
N,M = map(int,input().split())
ls_1 = []
ls_2 = []
ls_3 = []
for i in range(M):
    s,c = map(int,input().split())
    if s == 1:
        ls_1.append(c)
    elif s == 2:
        ls_2.append(c)
    else:
        ls_3.append(c)
if len(set(ls_1)) > 1 or len(set(ls_2)) > 1 or len(set(ls_3)) > 1 or (N > 1 and len(ls_1) > 0 and sum(ls_1)==0):
    print(-1)
else:
    if len(ls_1) == 0:
        if N > 1:
            ls_1.append(1)
        else:
            ls_1.append(0)
    if len(ls_2) == 0:
        ls_2.append(0)
    if len(ls_3) == 0:
        ls_3.append(0)
    
    ans = (10 **(N-1)) * ls_1[0] + (10**((N-2)*(N-1)// 2)) * ls_2[0] + ((N-2)*(N-1) // 2) * ls_3[0]
    print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
ls_1 = []
ls_2 = []
ls_3 = []
for i in range(M):
    s,c = map(int,input().split())
    if s == 1:
        ls_1.append(c)
    elif s == 2:
        ls_2.append(c)
    else:
        ls_3.append(c)
if len(set(ls_1)) > 1 or len(set(ls_2)) > 1 or len(set(ls_3)) > 1 or ls_1[0] == 0:
    print(-1)
else:
    if len(ls_1) == 0:
        if N > 1:
            ls_1.append(1)
        else:
            ls_1.append(0)
    if len(ls_2) == 0:
        ls_2.append(0)
    if len(ls_3) == 0:
        ls_3.append(0)
    
    ans = (10 **(N-1)) * ls_1[0] + (10**((N-2)*(N-1)// 2)) * ls_2[0] + ((N-2)*(N-1) // 2) * ls_3[0]
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
ls_1 = []
ls_2 = []
ls_3 = []
for i in range(M):
    s,c = map(int,input().split())
    if s == 1:
        ls_1.append(c)
    elif s == 2:
        ls_2.append(c)
    else:
        ls_3.append(c)
if len(set(ls_1)) > 1 or len(set(ls_2)) > 1 or len(set(ls_3)) > 1 or ls_1[0] == 0:
    print(-1)
    sys.exit()
if len(ls_1) == 0:
    ls_1.append(1)
if len(ls_2) == 0:
    ls_2.append(0)
if len(ls_3) == 0:
    ls_3.append(0)
    
ans = (10 **(N-1)) * ls_1[0] + (10**((N-2)*(N-1)// 2)) * ls_2[0] + ((N-2)*(N-1) // 2) * ls_3[0]
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
ls_1 = []
ls_2 = []
ls_3 = []
for i in range(M):
    s,c = map(int,input().split())
    if s == 1:
        ls_1.append(c)
    elif s == 2:
        ls_2.append(c)
    else:
        ls_3.append(c)
if len(set(ls_1)) > 1 or len(set(ls_2)) > 1 or len(set(ls_3)) > 1 or ls_1[0] == 0:
    print(-1)
    sys.exit()
if len(ls_1) == 0:
    ls_1.append(1)
if len(ls_2) == 0:
    ls_2.append(0)
if len(ls_3) == 0:
    ls_3.append(0)
    
ans = 100 * ls_1[0] + 10 * ls_2[0] + ls_3[0]
print(ans)
Problem p02817 (python)

Fixed submission:
S,T = input().split()
print(T+S)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
print(T,S,sep='')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
print(t,s)
Problem p02936 (python)

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

N,Q = map(int,input().split())
AB = [[int(i) for i in input().split()] for _ in range(N-1)]
PX = [[int(j) for j in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)
    
counters = [0] * (N+1)
for p,x in PX:
    counters[p] += x
    
def dfs(v,parent,add):
    counters[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,counters[v])

dfs(1,0,0)

ans = ' '.join(map(str,counters[1:]))
print(ans)

Buggy submission (verdict: Runtime Error):
N,Q = map(int,input().split())
AB = [[int(i) for i in input().split()] for _ in range(N-1)]
PX = [[int(j) for j in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)
    
counters = [0] * (N+1)
for p,x in PX:
    counters[p] += x
    
def dfs(v,parent,add):
    counters[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,counters[v])

dfs(1,0,0)

ans = ' '.join(map(str,counters[1:]))
print(ans)
Problem p03086 (python)

Fixed submission:
import re
S = input()
ACGT = re.findall('[ACGT]+',S)
if len(ACGT) > 0:
    print(max([len(s) for s in ACGT]))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import re
S = input()
print(max([len(s) for s in re.findall('[ACGT]+',S)]))
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
s1,s2,s3 = map(int,input().split())
print(s1+s2+s3)
Problem p03544 (python)

Fixed submission:
import numpy as np
N = int(input())
L = np.zeros(87,np.int64)
L[0] = 2
L[1] = 1

def luca(n):
    if n == 0:
        return L[0]
    elif n == 1:
        return L[1]
    if L[n] != 0:
        return L[n]
    L[n] =luca(n-1) + luca(n-2)
    return L[n]
print(luca(N))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
L = np.zeros(86,np.int64)
L[0] = 2
L[1] = 1

def luca(n):
    if n == 0:
        return L[0]
    elif n == 1:
        return L[1]
    if L[n] != 0:
        return L[n]
    L[n] =luca(n-1) + luca(n-2)
    return L[n]
print(luca(N))
Problem p03071 (python)

Fixed submission:
a, b = map(int, input().split())
print(max(max(a, b) + max(a, b) - 1, a + b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
print(max(a + a - 1, a + b))
Problem p03503 (python)

Fixed submission:
N = int(input())
F = [int("".join(input().split()), 2) for i in range(N)]
P = [list(map(int, (input().split()))) for i in range(N)]

ans = float('-inf')
for bit in range(1,1024):
    sum_p = 0
    for shop in range(N):
        time = bin(F[shop] & bit).count('1')
        sum_p += P[shop][time]

    ans = max(sum_p, ans)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
F = [int("".join(input().split()), 1) for i in range(N)]
P = [list(map(int, (input().split()))) for i in range(N)]

ans = float('-inf')
for bit in range(1,1024):
    sum_p = 0
    for shop in range(N):
        time = bin(F[shop] & bit).count('1')
        sum_p += P[shop][time]

    ans = max(sum_p, ans)
print(ans)
Problem p03565 (python)

Fixed submission:
def main():
	s = input()
	t = input()
 
	for i in reversed(range(len(s) - len(t) + 1)):
		if checker(s[i:(i + len(t))], t):
			s = s.replace("?", "a")
			print(s[:i] + t + s[i+len(t):])
			return
	print("UNRESTORABLE")
 
def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True
 
if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

for i in reversed(range(len(S) - len(T) + 1)):
    if checker(S[i:(i + len(T))], T):
        S = S.replace('?', 'a')
        print(S[:i] + T + S[i + len(T):])
        exit()
print('UNRESTORABLE')
exit()
def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

for i in reversed(range(len(S) - len(T) + 1)):
    if checker(S[i:(i + len(T)), T]):
        S = S.replace('?', 'a')
        print(S[:i] + T + S[i + len(T):])
        exit()
print('UNRESTORABLE')
exit()
def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

for i in reversed(range(len(S) - len(T) + 1)):
    if checker(S[i:(i + len(T)), T]):
        S = S.replace('?', 'a')
        print(S[:i] + T + S[i + len(T):])
        return
    print('UNRESTORABLE')

def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True
Problem p03599 (python)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
ans = [100 * A, 0]
c = 0

for i in range(1, F // (100 * A) + 1):
    for j in range((F - 100 * A * i) // (100 * B) + 1):
        a = 100 * A * i + 100 * B * j
        if a > F:
            break
        for k in range((F - a) // C + 1):
            for l in range((F - a - C * k) // D + 1):
                b = k * C + l * D
                concentration = 100 * b / (a + b)
                if (A * i + B * j) * E >= b and a + b <= F:
                    if concentration > c:
                        c = concentration
                        ans = [a + b, b]
                else:
                    break

print(' '.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
ans = [100 * A, 0]
c = 0

for i in range(1, F // (100 * A) + 1):
    for j in range((F - 100 * A * i) // (100 * B) + 1):
        a = 100 * A * i + 100 * b * j
        if a < F:
            break
        for k in range((F - a) // C + 1):
            for l in range((F - a - C * k) // D + 1):
                b = C * k + D * l
                conc = 100 * b / (a + b)
                if b <= (A * i + B * j) * E and a + b < F:
                    if conc > c:
                        c = conc
                        ans = [a + b, b]
                else:
                    break
print(' '.join(map(str, ans)))
Problem p03607 (python)

Fixed submission:
from collections import Counter
N = int(input())
A = []
for i in range(N):
    ai = int(input())
    A.append(ai)
dic = Counter(A)
cnt=0
for idx, val in dic.items():
    if val%2 != 0:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
content = [0]*(10**9+2)
for i in range(N):
    ai = int(input())
    if content[ai]==1:
        content[ai]=0
    else:
        content[ai]=1
print(sum(content))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N = int(input())
content = [0]*(10**9+2)
for i in range(N):
    ai = int(input())
    if content[ai]==1:
        content[ai]=0
    else:
        content[ai]=1
print(sum(content))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N = int(input())
content = [0]*(10**6+2)
for i in range(N):
    ai = int(input())
    if content[ai]==1:
        content[ai]=0
    else:
        content[ai]=1
print(sum(content))
Problem p03721 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################
 
N, K = map(int, input().split())
 
ans = [0] * (10**5+1)
for i in range(N):
    a, b = map(int, input().split())
    ans[a] += b
 
remain = K
for i in range(10**5+1):
    if ans[i] == 0:
        continue
 
    remain -= ans[i]
    if remain <= 0:
        print(i)
        exit()

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
ans=[0]*10**13
for i in range(N):
    a,b=map(int,input().split())
    ans[a]+=b
for i in range(len(ans)):
    cnt+=ans[i]
    if cnt<K:
        continue
    else:
        print(ans[i])
        exit()
Problem p03778 (python)

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

Buggy submission (verdict: Runtime Error):
W,a,b = map(int, input().split())
if (a<=b<=a+W):
    print(0)
elif (a=<b+W<=a+W):
    print(0)
elif a<=b:
    print(b-a-W)
else:
    print(a-b-W)
Problem p03814 (python)

Fixed submission:
string = input()
for i in range(len(string)):
    if string[i] == 'A':
        start=i
        break
for j in reversed(range(start+1, len(string))):
    if string[j]=='Z':
        end=j
        break
print(len(string[i:j+1]))

Buggy submission (verdict: Runtime Error):
string = input()
ans=[]
for i in range(len(string)):
    if string[i] == 'A':
        ans.append(string[i])
        start=i
        break
for j in range(start+1,len(string)):
    if string[j]=='Z':
        ans.append(string[j])
        if string[j+1] not in 'Z':
            break
    else:
        ans.append(string[j])
print(len(ans))