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

Fixed submission:
import sys

def check(operate_list, num_list):
    res = num_list[0]
    for i, op in enumerate(operate_list):
        if op == "+":
            res += num_list[i+1]
        elif op == "-":
            res -= num_list[i+1]
    return res == 7

def concat(operate_list, num_list):
    num_list = list(map(str, num_list))
    string = num_list[0]
    for op, num in zip(operate_list, num_list[1:]):
        # it is beautiful!
        string += op
        string += num
    string += "=7"
    return string

def main():
    line = sys.stdin.readline().strip()
    num_list = []
    for s in line:
        num_list.append(int(s))
    result = ""
    stack = []
    stack.append([])
    N = len(num_list)
    while(len(stack) != 0):
        l = stack.pop()
        if len(l) == N-1:
            if check(l, num_list):
                result = concat(l, num_list)
                break
        else:
            stack.append(l + ["+"]) # careful code
            stack.append(l + ["-"])

    print(result)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys

def check(operate_list, num_list):
    res = num_list[0]
    for i, op in enumerate(operate_list):
        if op == "+":
            res += num_list[i+1]
        elif op == "-":
            res -= num_list[i+1]
    return res == 7

def concat(operate_list, num_list):
    string = num_list[0]
    for op, num in zip(operate_list, num_list[1:]):
        # it is beautiful!
        string += op
        string =+ num
    string += "=7"
    return string

def main():
    line = sys.stdin.readline().strip()
    num_list = []
    for s in line:
        num_list.append(int(s))
    result = ""
    stack = []
    stack.append([])
    N = len(num_list)
    while(len(stack) != 0):
        l = stack.pop()
        if len(l) == N-1:
            if check(l, num_list):
                result = concat(l, num_list)
                break
        else:
            stack.append(l + ["+"]) # careful code
            stack.append(l + ["-"])

    print(result)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def check(operate_list, num_list):
    res = num_list[0]
    for i, op in enumerate(operate_list):
        if op == "+":
            res += num_list[i+1]
        elif op == "-":
            res -= num_list[i+1]
    return res == 7

def concat(operate_list, num_list):
    string = num_list[0]
    for op, num in zip(operate_list, num_list[1:]):
        # it is beautiful!
        string += op
        string =+ num
    string += "="
    return string

def main():
    line = sys.stdin.readline().strip()
    num_list = []
    for s in line:
        num_list.append(int(s))
    result = ""
    stack = []
    stack.append([])
    N = len(num_list)
    while(len(stack) != 0){
        l = stack.pop()
        if len(l) == N-1:
            if check(l, num_list):
                result = concat(l, num_list)
                break
        else:
            stack.append(l + ["+"]) # careful code
            stack.append(l + ["-"])
    }
    print(result)
Problem p03628 (python)

Fixed submission:
M = 10**9+7
n = int(input())
s = input()
t = input()
ans = 3 if s[0] == t[0] else 6
for i in range(1, n):
  if s[i-1] == s[i]:
    continue
  if s[i-1] == t[i-1]:
    ans = ans * 2 % M
  elif s[i] != t[i]:
    ans = ans * 3 % M
print(ans)

Buggy submission (verdict: Runtime Error):
M = 10**9+7
n = int(input())
s = input()
t = input()
ans = 3 if s[0] == t[0] else 6
for i in range(1, n):
  if s[i-1] == s[i]:
    continue
  if s[i-1] == t[i-1]:
    ans = ans * 2 % M
  else if s[i] != t[i]:
    ans = ans * 3 % M
print(ans)
Problem p03633 (python)

Fixed submission:
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a // gcd(a, b) * b

n = int(input())
ans = 1
for i in range(n):
    ans = lcm(ans, int(input()))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def lcm(a, b):
    return a // math.gcd(a, b) * b
n = int(input())
ans = 1
for i in range(n):
    ans = lcm(ans, int(input()))
print(ans)
Problem p03044 (python)

Fixed submission:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###
import sys
sys.setrecursionlimit(10000000)

N = int(input())

adj = [set() for _ in range(N)] #adj[i] = (i_adj, 距離0or1)
for _ in range(N-1):
  u, v, w = mi()
  #0スタートに
  u -= 1
  v -= 1
  adj[u].add((v, w%2))
  adj[v].add((u, w%2))

from collections import deque
q = deque([])

seen = [0] * N
bw = [0] * N

#とりあえずノード0から探索をスタートすることにする
#0の距離は0としておく
q.append(0)
bw[0] = 0 #必要無いが、分かりやすくするために
seen[0] = 1


def solve(): #前のノードまでの色（0or1）を引き継ぐ
  try: nownode = q.popleft()
  except: return
  nowcolor = bw[nownode]

  #今のノードから隣接しているものを探索
  for adjidx, w in adj[nownode]:
    if seen[adjidx]!=1:
      q.append(adjidx)
      seen[adjidx]=1
      bw[adjidx] = (nowcolor+w)%2

  solve()

solve()

for color in bw:
  print(color)

Buggy submission (verdict: Runtime Error):
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N = int(input())

adj = [set() for _ in range(N)] #adj[i] = (i_adj, 距離0or1)
for _ in range(N-1):
  u, v, w = mi()
  #0スタートに
  u -= 1
  v -= 1
  adj[u].add((v, w%2))
  adj[v].add((u, w%2))

from collections import deque
q = deque([])

seen = [0] * N
bw = [0] * N

#とりあえずノード0から探索をスタートすることにする
#0の距離は0としておく
q.append(0)
bw[0] = 0 #必要無いが、分かりやすくするために
seen[0] = 1


def solve(): #前のノードまでの色（0or1）を引き継ぐ
  try: nownode = q.popleft()
  except: return
  nowcolor = bw[nownode]

  #今のノードから隣接しているものを探索
  for adjidx, w in adj[nownode]:
    if seen[adjidx]!=1:
      q.append(adjidx)
      seen[adjidx]=1
      bw[adjidx] = (nowcolor+w)%2

  solve()

solve()

for color in bw:
  print(color)
Problem p03048 (python)

Fixed submission:
###template###
import sys
input = sys.stdin.readline
def mi(): return map(int, input().split())
###template###

Rt, Gt, Bt, N = mi()

R = max(Rt, Gt, Bt)
B = min(Rt, Gt, Bt)
G = Rt+Gt+Bt-R-B

cnt = 0
if G == 1 and B == 1:
  for i in range(N//R+1):
    cnt += (N-R*i)+1
  print(cnt)
  exit()

for i in range(N//R+1):
  for j in range((N-R*i)//G+1):
    #残り必要ボール数
    if (N - R*i - G*j)%B == 0:
      cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
R, G, B, N = map(int, input().split())

cnt = 0

maxr = N // R + 1
maxg = N // G + 1
maxb = N // B + 

for r in range(0, maxr+1):
  for g in range(0, maxg+1):
    for b in range(0, maxb+1):
      p = R*r + G*g + B*b
      if p == N:
        cnt += 1
        break
      elif p > N: break
        
print(cnt)
Problem p03078 (python)

Fixed submission:
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
#A~Cは降順でソート済み
lenA = X
lenB = Y
lenC = Z #分かりにくいので名前を変えただけ

AB = []

for i in range(0, min(K,lenA)):
  for j in range(0, min(K,lenB)):
      AB.append(A[i]+B[j])
AB.sort(reverse=True)

ABC = []

for j in range(0, min(K,len(AB))):
  for k in range(0, min(K,lenC)):
      ABC.append(AB[j]+C[k])
ABC.sort(reverse=True)

for i in range(K):
  print(ABC[i])

Buggy submission (verdict: Runtime Error):
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
#A~Cは降順でソート済み
lenA = X
lenB = Y
lenC = Z #分かりにくいので名前を変えただけ

#差分の配列を作る
difA = []
difB = []
difC = []
for i, a in enumerate(A):
  if i == 0:
    preA = a
    continue #0ならpreAに入れるだけ
  difA.append(preA - a)
  preA = a
for i, b in enumerate(B):
  if i == 0:
    preB = b
    continue #0ならpreBに入れるだけ
  difB.append(preB - b)
  preB = b
for i, c in enumerate(C):
  if i == 0:
    preC = c
    continue #0ならpreCに入れるだけ
  difC.append(preC - c)
  preC = c
#print(difA,difB,difC) #デバッグ用

cntA, cntB, cntC = sum(difA), sum(difB), sum(difC)
cntA, cntB, cntC = (1500*cntA)//(cntA+cntB+cntC),(1500*cntB)//(cntA+cntB+cntC),(1500*cntC)//(cntA+cntB+cntC)

setc = []
for i in range(0, min(cntA,lenA)):
  for j in range(0, min(cntB,lenB)):
    for k in range(0, min(cntC,lenC)):
      setc.append(A[i]+B[j]+C[k])
slist = sorted(setc,reverse=True)

for i in range(K):
  print(slist[i])

Buggy submission (verdict: Runtime Error):
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
#A~Cは降順でソート済み
lenA = X
lenB = Y
lenC = Z #分かりにくいので名前を変えただけ

#差分の配列を作る
difA = []
difB = []
difC = []
for i, a in enumerate(A):
  if i == 0:
    preA = a
    continue #0ならpreAに入れるだけ
  difA.append(preA - a)
  preA = a
for i, b in enumerate(B):
  if i == 0:
    preB = b
    continue #0ならpreBに入れるだけ
  difB.append(preB - b)
  preB = b
for i, c in enumerate(C):
  if i == 0:
    preC = c
    continue #0ならpreCに入れるだけ
  difC.append(preC - c)
  preC = c
#print(difA,difB,difC) #デバッグ用

nowsum = A[0]+B[0]+C[0]
print(nowsum)
del A[0]
del B[0]
del C[0]
#ここにi番目の美味しさ合計を入れていく
#初期値は一番美味しいケーキ3種の合計
for i in range(K-1): #[1]~[K-1]についてやればいい
  #delしていくから添字は気にしなくてもいい
  if difA[0] <= min(difB[0], difC[0]):
    nowsum -= difA[0]
    del difA[0]
    del A[0]
    if not difA: difA.append(10e9)
  elif difB[0] <= difC[0]:
    nowsum -= difB[0]
    del difB[0]
    del B[0]
    if not difB: difB.append(10e9)
  else:
    nowsum -= difC[0]
    del difC[0]
    del C[0]
    if not difC: difC.append(10e9)
  print(nowsum)
Problem p03160 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
#高さ。0~n-1でアクセス

#足場Nにたどり着くまでの最小コストを格納。アクセスは[N-1]
dp = [float("inf")] * n

dp[0] = 0
dp[1] = abs(h[0] - h[1])

import sys
sys.setrecursionlimit(10000000)
#足場x（0～n-1）にたどり着くまでの最小コストを返す関数。
def getdp(x):
    global dp #これでいいのか？
    if dp[x] != float("inf"): return dp[x] #0,1の場合と、既に求めた場合は値を返す
    dp[x] = min(getdp(x-2) + abs(h[x]-h[x-2]), getdp(x-1) + abs(h[x]-h[x-1]))
    #2つ左から飛ぶか1つ左から飛ぶかの最小値がxのdp。
    return(dp[x])

print(getdp(n-1))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
#高さ。0~n-1でアクセス

#足場Nにたどり着くまでの最小コストを格納。アクセスは[N-1]
dp = [float("inf")] * n

dp[0] = 0
dp[1] = abs(h[0] - h[1])

#足場x（0～n-1）にたどり着くまでの最小コストを返す関数。
def getdp(x):
    global dp #これでいいのか？
    if dp[x] != float("inf"): return dp[x] #0,1の場合と、既に求めた場合は値を返す
    dp[x] = min(getdp(x-2) + abs(h[x]-h[x-2]), getdp(x-1) + abs(h[x]-h[x-1]))
    #2つ左から飛ぶか1つ左から飛ぶかの最小値がxのdp。
    return(dp[x])

print(getdp(n-1))
Problem p03200 (python)

Fixed submission:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
import heapq
INF = float("inf")
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###


S = input()

prev = 0
sum = 0
for c in S:
  if c == 'B':
    prev += 1
  else:
    sum += prev
    
print(sum)

Buggy submission (verdict: Runtime Error):

###template###
import sys
def input(): return sys.stdin.readline().rstrip()
import heapq
INF = float("inf")
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###


S = ii()

prev = 0
sum = 0
for c in S:
  if c == 'B':
    prev += 1
  else:
    sum += prev
    
print(sum)
Problem p03219 (python)

Fixed submission:
a, b = map(int, input().split())
 
print(round(a + (b / 2)))

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

print(a + (b / 2))
Problem p03238 (python)

Fixed submission:
n = int(input())

if n == 1:
  print('Hello World')
else:
  print(int(input()) + int(input()))

Buggy submission (verdict: Runtime Error):
nab = [int(input()) for _ in range(3)]

if nab[0] == 1:
  print('Hello World')
else:
  print(nab[1]+nab[2])
Problem p03251 (python)

Fixed submission:
n,m,x,y = map(int,input().split())

xis = sorted(list(map(int,input().split())),reverse=True)
yis = sorted(list(map(int,input().split())))
 
ans = 'No War' if (xis[0] < yis[0]) and (x < yis[0] and xis[0] < y) else 'War'

print(ans)

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

xis = sorted(list(map(int,input().split())),reverse=True)
yis = sorted(list(map(int,input().split())))
 
ans = 'No War' (if xis[0] < yis[0]) and x < yis[0] and xis[0] < y else 'War'

print(ans)
Problem p03261 (python)

Fixed submission:
n  = int(input())
w = []

w.append(input())

ans = 'Yes'
for i in range(1,n,1):
  w.append(input())
  l = len(w[i-1])
  if w[i][0:1] != w[i-1][l-1:l]:
    ans = 'No'
    break
  for j in range(i):
    if w[i] == w[j]:
      ans = 'No'
      break

print(ans)

Buggy submission (verdict: Runtime Error):
n  = int(input())
w = []

w.append(input())

ans = 'Yes'
for i in range(1,n,1):
  w.append(input())
  l = len(w[j])
  if w[i][0:1] != w[j][l-1:l]: ans = 'No'
  for j in range(i):
    if w[i] == w[j]: ans = 'No'

print(ans)
Problem p03292 (python)

Fixed submission:
a = sorted(map(int,input().split()))

print(abs(a[0] - a[1]) + abs(a[1] - a[2]))

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

print(abs(a[0] - a[1]) + abs(a[1] - a[2]))

Buggy submission (verdict: Runtime Error):
a = sorted([int(input()) for _ in range(3)])

print(abs(a[0] - a[1]) + abs(a[1] - a[2]))
Problem p03294 (python)

Fixed submission:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
import heapq
INF = float("inf")
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###

N = ii()
As = list(map(lambda x : int(x) - 1, input().split()))

print(sum(As))

Buggy submission (verdict: Runtime Error):

###template###
import sys
def input(): return sys.stdin.readline().rstrip()
import heapq
INF = float("inf")
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###

N = ii()
As = [map(lambda x : int(x) - 1, input().split())]

print(sum(As))
Problem p03351 (python)

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

if abs(a-c) <= d:
  print('Yes')
elif (abs(a-b) <= d) and (abs(b-c) <= d):
  print('Yes')
else:
  print('No')

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

if abs(a-c) <= d:
  print('Yes')
elif (abs(a-b) <= d) && (abs(b-c) <= d):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input())

if abs(a-c) <= d:
  print('Yes')
elif (abs(a-b) <= d) && (abs(b-c) <= d):
  print('Yes')
else:
  print('No')
Problem p03369 (python)

Fixed submission:
s = input()

p = 700
for c in s:
  if c == 'o': p += 100

print(p)

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

p = 700
for c in s:
  p += 100 if c == 'o'

print(p)
Problem p03378 (python)

Fixed submission:
n, m, x = map(int,input().split())
a = set(map(int,input().split()))

b = a
for i in range(1,x,1):
  b = b - {i}

c = a
for i in range(x+1,n,1):
  c = c - {i}

print(min(len(b),len(c)))

Buggy submission (verdict: Runtime Error):
n, m, x = map(int,input().split())
a = set(map(int,input().split()))

b = a.copy
for i in range(1,x,1):
  b = b - {i}

c = a.copy
for i in range(x+1,n,1):
  c = c - {i}

print(min(len(b),len(c)))
Problem p03386 (python)

Fixed submission:
a, b, k = map(int,input().split())

ans = {i for i in range(a,min(a+k,b+1))}
ans2 = {i for i in range(b,max(b-k,a-1),-1)}

ans = ans | ans2
ans = sorted(list(ans))

for an in ans: print(an)

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

ans = {i for i in range(a,a+k)}
ans2 = {i for i in range(b,b-k,-1)}

ans.add(ans2)
ans = sorted(list(ans))

for an in ans: print(an)
Problem p03399 (python)

Fixed submission:
aa = [input() for _ in range(4)]

a,b,c,d = map(int, aa)

print(min(a,b) + min(c,d))

Buggy submission (verdict: Runtime Error):
aa = [int(input()) for _ in range(4)]

a,b,c,d = map(aa)

print(min(a,b) + min(c,d))
Problem p03403 (python)

Fixed submission:
n = int(input())
tmpa = list(map(int, input().split()))
A = [0] * (n+2)
A[0] = 0
A[n+1] = 0
for i in range(1,n+1,1): A[i] = tmpa[i-1]


#普通に総和を出す
sum = 0
for i, a in enumerate(A):
  if i == n+1: break #n+1はゴールなので先に行かない
  sum += abs(a - A[i+1]) #a:A[i]
  
#引いて足す
for i in range(1, n+1, 1): #1～Nを省いたとき
  nowsum = sum
  nowsum -= abs(A[i-1]-A[i])
  nowsum -= abs(A[i]-A[i+1])
  nowsum += abs(A[i-1]-A[i+1])
  print(nowsum)

Buggy submission (verdict: Runtime Error):
n = int(input)
A = [0] + list(map(int, input().split())) + [0]

#普通に総和を出す
sum = 0
for i, a in enumerate(A):
  if i == n+1: break #n+1はゴールなので先に行かない
  sum += abs(a - A[i+1]) #a:A[i]
  
#引いて足す
for i in range(1, n+1, 1): #1～Nを省いたとき
  nowsum = sum
  nowsum -= abs(A[i-1]-A[i])
  nowsum -= abs(A[i]-A[i+1])
  nowsum += abs(A[i-1]-A[i+1])
  print(nowsum)

Buggy submission (verdict: Runtime Error):
n = int(input
A = [0] + list(map(int, input().split())) + [0]

#普通に総和を出す
sum = 0
for i, a in enumerate(A):
  if i == n+1: break #n+1はゴールなので先に行かない
  sum += abs(a - A[i+1]) #a:A[i]
  
#引いて足す
for i in range(1, n+1, 1): #1～Nを省いたとき
  nowsum = sum
  nowsum -= abs(A[i-1]-A[i])
  nowsum -= abs(A[i]-A[i+1])
  nowsum += abs(A[i-1]-A[i+1])
  print(nowsum)
Problem p03485 (python)

Fixed submission:
import math
import statistics as st

a,b = map(int,input().split())

print(math.ceil(st.mean((a,b))))

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())

print(math.ceil(mean([a,b])))

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())

print(math.floor(mean((a,b))))

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())

print(math.floor(mean(a,b)))
Problem p03486 (python)

Fixed submission:
s = sorted(input())
t = sorted(input(),reverse=True)

ls = len(s)
lt = len(t)

p='No'
for i in range(100):
  if len(t)<=i:
    p = 'No'
    break
  if len(s)<=i:
    p = 'Yes'
    break 
  if s[i:i+1] > t[i:i+1]:
    p = 'No'
    break
  elif s[i:i+1] < t[i:i+1]:  
    p = 'Yes'
    break
   
print(p)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
S = []
T = []
for i in range(len(s)):
    S.append(ord(s[i:i+1]))
for i in range(len(t)):
    T.append(ord(t[i:i+1]))
S = sorted(S)
T = sorted(T, reverse=True)
for i in range(100-len(S)): 
    S.append(0)
for i in range(100-len(T)): 
    T.append(0)
for i in range(max(len(s),len(t))+1): 
    if S[i] > T[i]:
        print('No')
        break
    elif S[i] < T[i]:
        print('Yes')
        break
    elif S[i] == 0 and T[i] == 0: 
        print('No')
        break
    elif S[i] == 0: 
        print('Yes')
        break
    elif T[i] == 0: 
        print('No')
        break
Problem p03494 (python)

Fixed submission:

n = int(input().rstrip())
values = list(map(int,input().rstrip().split()))

m = 500000000 #max divide
for i in range(len(values)):
	nowV = values[i]
	nm = 0
	for j in range(500000000):
		if nowV % 2 == 0:
			nm += 1
			nowV = nowV / 2
		else:
			break 
	m = min(m,nm)
print(m)

Buggy submission (verdict: Runtime Error):
n = int(input().rstrip())
values = list(map(int,input().rstrip().
    ssplit()))

m = 500000000 #max divide
for i in range(len(values)):
	nowV = values[i]
	nm = 0
	for j in range(500000000):
		if nowV % 2 == 0:
			nm += 1
			nowV = nowV / 2
			m = min(m,n)
		else:
			break 
print(m)
Problem p03544 (python)

Fixed submission:
n = int(input())

if n == 0:
  print(2)
  exit()
if n == 1:
  print(1)
  exit()

xx = 2
x = 1
for i in range(n-1):
  ans = xx + x
  xx = x
  x = ans

print(ans)

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

if n = 0:
  print(2)
  exit()
if n = 1:
  print(1)
  exit()

xx = 2
x = 1
for i  in range(n-1):
  ans = xx + x
  xx = x
  x = ans

print(ans)
Problem p03607 (python)

Fixed submission:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N = int(input())

nset = set()

for _ in range(N):
  i = int(input())
  if i in nset: nset.remove(i)
  else: nset.add(i)

print(len(nset))

Buggy submission (verdict: Runtime Error):
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N = int(input())

nlist = [0] * (10**9+1)
for _ in range(N):
  i = int(input())
  nlist[i] = ~nlist[i]

print(nlist.count(~0))
Problem p03658 (python)

Fixed submission:
N,K = map(int,input().split())
L = sorted(list(map(int,input().split())), reverse=True)

print(sum(L[:K]))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
L = sorted(list[map(int,input().split())], reverse=True)

print(sum(L[:K]))
Problem p03693 (python)

Fixed submission:
a  = ''.join(list(input().split()))

print('YES' if (int(a))%4==0 else 'NO')

Buggy submission (verdict: Runtime Error):
a  = ''.join(list(map(input().split())))

print('YES' if (int(a))%4==0 else 'NO')

Buggy submission (verdict: Runtime Error):
a  = ''.join(list(map(input().split())))

print('YES' if int(a)%4==0 else 'NO')
Problem p03697 (python)

Fixed submission:
a, b = map(int, input().split())
 
print('error' if a+b >= 10 else a+b)

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

print('error' if a+b >= 10 else a+b
Problem p03778 (python)

Fixed submission:
w,a,b = map(int,input().split())
ma = max(a,b)
mi = min(a,b)
print(max(ma-(mi+w),0))

Buggy submission (verdict: Runtime Error):
w,a,b = map(int,input().split())
ma = max(a,b)
mi = min(a,b)
print(max(max-(mi+w),0))
Problem p03781 (python)

Fixed submission:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
MOD = 10**9 + 7
sys.setrecursionlimit(10**7)
# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###


X = ii()

for t in range(1, 1000000):
  if (t**2 + t) // 2 >= X:
    print(t)
    exit()

Buggy submission (verdict: Runtime Error):
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
MOD = 10**9 + 7
sys.setrecursionlimit(10**7)
# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###


N = ii()

print('1' + ''.join(['0'] * (N-1)))
Problem p03796 (python)

Fixed submission:
N = int(input())

mod = 10**9 + 7

ans = 1
for i in range(1, N+1):
  ans = (ans * i) % mod

print(ans)

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

mod = 10**9 + 7

ans = 1
for i in range(1, N+1):
  ans = (ans * i) % mod

print(ans)
Problem p03814 (python)

Fixed submission:
S = input()
a = S.find('A')

b = S[::-1].find('Z')

print(len(S)-a-b)

Buggy submission (verdict: Runtime Error):
S = input()
dAdAd1 1
a = S.find('A')

b = S.find('Z')

print(len(S)-a-b)
Problem p03845 (python)

Fixed submission:
N = int(input())
T = list(map(int,input().split()))
M = int(input())
P = []
X = []
for _ in range(M):
  p,x = map(int,input().split())
  P.append(p)
  X.append(x)

sumT = sum(T)

for p,x in zip(P,X):
  print(sumT - (T[p-1]-x))

Buggy submission (verdict: Runtime Error):
N = int(input())
T = list(map(int,input().split()))
M = int(input())
P = []
X = []
for _ in range(M):
  p,x = map(int,input().split())
  P.append(p)
  X.append(x)

sumT = sum(T)

for i,p,x in enumerate(zip(P,X)):
  print(sumT - (T[p]-x))