Harryxun/stf_run huggingface dataset:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    A = []
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()

    max_idx = 0
    max_mod = 0
    for i in range(5):
        if abs(10 - A[i] % 10)% 10> max_mod:
            max_mod = abs(10 - A[i] % 10) % 10
            max_idx = i
    time = 0
    for i in range(5):
        if i != max_idx:
            time += A[i] + (abs(10 - A[i] % 10)% 10)
    time += A[max_idx]
    print time


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import deque
import copy
import math

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    A = []
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))


    max_idx = 0
    max_mod = 0
    for i in range(5):
        if abs(10 - A[i] % 10)% 10> max_mod:
            max_mod = abs(10 - A[i] % 10) % 10
            max_idx = i
    time = 0
    for i in range(5):
        if i != max_idx:
            time += A[i] + (abs(10 - A[i] % 10)% 10)
    time += A[max_idx]
    print time


if __name__ == '__main__':
    main()
import sys,heapq,math,resource
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def setrlim():
  sys.setrecursionlimit(250000)
  soft,hard = resource.getrlimit(RLIMIT_STACK)
  # setrlimit works on ubuntu (and atcoder), but not on WSL
  resource.setrlimit(RLIMIT_STACK, (128*1024*1024,hard))

def dfs(i,fromup):
    y[i] = fromup + v[i]
    for d in dst[i]:
        dfs(d,y[i])

n,q = inm()
dst = [ [] for i in range(n) ]
for i in range(n-1):
    a,b = inm()
    a -= 1
    b -= 1
    dst[a].append(b)
v = [0]*n
for i in range(q):
    p,x = inm()
    p -= 1
    v[p] += x
y = [0]*n
dfs(0,0)
for i in range(n):
    printn((' ' if i>0 else '') + str(y[i]))
print("")


### FIXED CODE ###

import sys,resource
from collections import deque
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inm   = lambda:      map(int, input().split())
DBG = True # and False
R = 10**9 + 7

def setrlim():
  sys.setrecursionlimit(250000)
  soft,hard = resource.getrlimit(resource.RLIMIT_STACK)
  # setrlimit works on ubuntu (and atcoder), but not on WSL
  resource.setrlimit(resource.RLIMIT_STACK, (256*1024*1024,hard))

n,q = inm()
dst = [ [] for i in range(n) ]
for i in range(n-1):
    a,b = inm()
    a -= 1
    b -= 1
    dst[a].append(b)
v = [0]*n
for i in range(q):
    p,x = inm()
    p -= 1
    v[p] += x
y = [0]*n

d = deque([])
d.append(0)
while len(d)>0:
    i = d.popleft()
    for j in dst[i]:
        v[j] += v[i]
        d.append(j)

for i in range(n):
    printn((' ' if i>0 else '') + str(v[i]))
print("")
a,b,c = map(input().split())
print(a[0].upper() + b[0].upper() + c[0].upper())

### FIXED CODE ###

S = input().split()
print(S[0][0].upper() + S[1][0].upper() + S[2][0].upper())
n = int(input())
l = [int(input()) for i in range(5)]
ans = 0
ans += n//l[0]+1
for i in range(1,5):
  if l(i-1) > l(i):
    ans += (n-n//l(i-1)*l(i))//l(i)+1
  else:
    ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
l = [int(input()) for i in range(5)]
if n % min(l) == 0:
  print(n//min(l)+4)
else:
  print(n//min(l)+5)
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict,deque

H,W=map(int, sys.stdin.readline().split())
CH,CW=map(int, sys.stdin.readline().split())
CH-=1
CW-=1
DH,DW=map(int, sys.stdin.readline().split())
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(W) ]

D=[(0,1),(0,-1),(1,0),(-1,0)]
WARP=[]
for dh in range(-2,3):
    for dw in range(-2,3):
        if abs(dh)+abs(dw)<=1: continue
        WARP.append((dh,dw))

#visit=defaultdict(lambda: 0) #未訪問:0 訪問済み:1
d=defaultdict(lambda: float("inf"))

q=deque()
q.append((CH,CW))
d[(CH,CW)]=0

while q:
    fro_h, fro_w=q.popleft()
    #print "fro_h, fro_w, q :: ",fro_h, fro_w, q
    #print "fro_h, fro_w, q :: ",fro_h, fro_w
    #print "d :: ",d
    #歩いて移動
    for dh,dw in D:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W:
            if S[to_h][to_w]=="." and d[(fro_h, fro_w)]<d[(to_h, to_w)]:
                d[(to_h, to_w)]=d[(fro_h, fro_w)]
                q.appendleft((to_h, to_w))
        #ワープ
    for dh,dw in WARP:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W:
            if S[to_h][to_w]=="." and d[(fro_h, fro_w)]+1<d[(to_h, to_w)]:
                d[(to_h, to_w)]=d[(fro_h, fro_w)]
                q.append((to_h, to_w))

if d[(DH,DW)]==float("inf"):
    print -1
else:
    print d[(DH,DW)]


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque

H,W=map(int, sys.stdin.readline().split())
CH,CW=map(int, sys.stdin.readline().split())
CH-=1
CW-=1
DH,DW=map(int, sys.stdin.readline().split())
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(H) ]

D=[(0,1),(0,-1),(1,0),(-1,0)]
WARP=[]
for dh in range(-2,3):
    for dw in range(-2,3):
        if abs(dh)+abs(dw)<=1: continue
        WARP.append((dh,dw))

d=defaultdict(lambda: float("inf")) #スタート地点から各マスまでの距離

q=deque()
q.append((0,CH,CW))
d[(CH,CW)]=0

while q:
    kyori, fro_h, fro_w=q.popleft()
    if d[(fro_h, fro_w)]<kyori: continue
    #歩いて移動
    for dh,dw in D:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]==".":
            if kyori < d[(to_h, to_w)]:
                d[(to_h, to_w)]=kyori
                q.appendleft((kyori, to_h, to_w))
    #ワープ
    for dh,dw in WARP:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]==".":
            if kyori+1 < d[(to_h, to_w)]:
                d[(to_h, to_w)]=kyori+1
                q.append((kyori+1, to_h, to_w))

if d[(DH,DW)]==float("inf"):
    print -1
else:
    print d[(DH,DW)]
import numpy as np
import pandas as pd


N, M, K = map(int, input().split())
A = [int(n) for n in input().split()]
B = [int(n) for n in input().split()]

A = np.array(A)
B = np.array(B)

A = np.cumsum(A)
B = np.cumsum(B)

A1 = np.zeros((len(A),2))
A1[:,0] = A
A1[:,1] = np.arange(1,len(A)+1)

B1 = np.zeros((len(B),2))
B1[:,0] = B
B1[:,1] = np.arange(1,len(B)+1)

C1 = np.zeros((len(A)*len(B),2))
lenB = len(B)
for i in range(len(A)):
    for j in range(len(B)):
        C1[lenB*i+j,:] = A1[i,:] + B1[j,:]
C1 = pd.DataFrame(C1)
C1 = C1[C1[0] <= K]

print(int(C1[1].max()))

### FIXED CODE ###

import numpy as np

N, M, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

A = np.array(A).cumsum()
B = np.array(B).cumsum()

ans = 0
j = M
for i in range(N+1):
    if A[i] > K:
        break
    while B[j] > K - A[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
nCr={}
def cmb(n, r):
  if r==0 or r==n:
    return 1
  if r==1 or n-r==1:
    return n
  if (n,r) in nCr:
    return nCr[(n,r)]
  nCr[(n,r)] = cmb(n-1,r)+cmb(n-1,r-1)
  return nCr[(n,r)]

N=int(input())
S=input()
ans=N
for r in range(2, N+1):
  ans+=cmb(N, r)

str_num = {i: S.count(i) for i in set(S) if S.count(i) > 1}
for s, n in str_num.items():
  ans -= 2**(N-n)
if len(str_num) > 1:
  ans += 2**(N-sum(str_num.values()))

print(ans)

### FIXED CODE ###

N=int(input())
S=input()
ans=1
for c in set(S):
  ans *= (S.count(c)+1)
print((ans-1) % (10**9+7))
import math
N= n_in()
print(math.ceil(N/2))


### FIXED CODE ###

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

import math
N= n_in()
print(math.ceil(N/2))
N = int(input())
count = 0
COUNT = 0
A = [int(i) for i in input().split()]
while 1:
  for i in range(N):
    if A[i]%2==0:
      A[i]/=2
      count+=1
  if count == N:
    COUNT+=1
  else:
    break
print(COUNT)

### FIXED CODE ###

number = int(input())
count = 0
if number >= 50:
  count += 1
if number%100 >= 5:
  count += 1
if number%10 >= 0.5:
  count += 1
print(count)
H, W = map(int, input().split())

if H == 0 and W == 0:
   break

print("#" * W)

for i in range(1, H-1):
   print("#", end = "")
   for j in range(1, W-1):
      print(".", end = "")
   print("#", end = "")

print("#" * W)

print("")


### FIXED CODE ###

while True:
   H, W = map(int, input().split())

   if H == 0 and W == 0:
      break

   print("#" * W)

   for i in range(1, H-1):
      print("#" + "."*(W-2) + "#")

   print("#" * W)

   print("")
N, Q = map(int, input().split())
S = input()

cnt = [0] * 10010

for i in range(len(S) - 1):
    if S[i] == 'A' and S[i + 1] == 'C':
        cnt[i] += 1

s = [0] * 10010
flag = [0] * 10010
for i in range(len(cnt) - 1):
    if cnt[i] > 0 :
        flag[i + 1] = 1
    s[i + 1] = s[i] + cnt[i]

for i in range(Q):
    l, r = map(int, input().split())
    ans = s[r] - s[l - 1]
    if flag[r] != 0 : ans -= 1
    print("{}".format(ans))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

cnt = [0] * 200010

for i in range(len(S) - 1):
    if S[i] == 'A' and S[i + 1] == 'C':
        cnt[i] += 1

s = [0] * 200010
flag = [0] * 200010
for i in range(len(cnt) - 1):
    if cnt[i] > 0 :
        flag[i + 1] = 1
    s[i + 1] = s[i] + cnt[i]

for i in range(Q):
    l, r = map(int, input().split())
    ans = s[r] - s[l - 1]
    if flag[r] != 0 :
        ans -= 1
    print("{}".format(ans))
takahashi_h, takahashi_a, aoki_h, aoki_a = map(int, input().split())

if takahashi_h // aoki_a < aoki_h // takahashi_a:
    print("Yes")
elif takahashi_h // aoki_a > aoki_h // takahashi_a:
    print("No")
else:
    takahashi_h = takahashi_h - (aoki_a * (takahashi_h // aoki_a))
    aoki_h = aoki_h - (takahashi_a * (aoki_h // takahashi_a))
    
    if aoki_h > 0 and takahashi_h == 0:
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

S, W = map(int, input().split())
if S > W:
    print("safe")
else:
    print("unsafe")
import sys
N = int(input())
A = list(map(int, input().split()))

if N == 1:
    print(1)
    sys.exit(0)
    
cnt = [0 for _ in range(10**5)]
for a in A:
    if a == 0:
        cnt[a] += 1
        cnt[a+1] += 1
    else:
        cnt[a-1] += 1
        cnt[a] += 1
        cnt[a+1] += 1
    
print(max(cnt))

### FIXED CODE ###

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

if N == 1:
    print(1)
    sys.exit(0)
    
cnt = [0 for _ in range(10**5+1)]
for a in A:
    if a == 0:
        cnt[a] += 1
        cnt[a+1] += 1
    else:
        cnt[a-1] += 1
        cnt[a] += 1
        cnt[a+1] += 1
    
print(max(cnt))
from fractions import gcd

def solve():
    N, M = map(int, input().split())
    S = list(input())
    T = list(input())

    k = N * M // gcd(N, M)

    S_new = ''.join([c + ' '*(k//N-1) for c in S])
    T_new = ''.join([c + ' '*(k//M-1) for c in T])

    for i in range(N):
        idx = i*(k//N)
        if S_new[idx] != ' ' and T_new[idx] != ' ' and S_new[idx] != T_new[idx]:
            print(-1)
            return
    for i in range(M):
        idx = i*(k//M)
        if S_new[idx] != ' ' and T_new[idx] != ' ' and S_new[idx] != T_new[idx]:
            print(-1)
            return
    
    print(k)

solve()

### FIXED CODE ###

#!/usr/bin/env python

from fractions import gcd

N, M = map(int, input().split())
S = list(input())
T = list(input())

g = int(gcd(N, M))
l = N * M // g

for i, j in zip(S[::N//g], T[::M//g]):
    if i != j:
        print(-1)
        break
else:
    print(l)
N, Y = map(int, input().split())

x = -1
y = -1
z = -1

for a in range(N):
    for b in range(N):
        c = N - a -b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            x, y, z = a, b, c
            print(f"{x} {y} {z}")
            exit()
print(f"{x} {y} {z}")

### FIXED CODE ###

N, Y = map(int, input().split())

x = -1
y = -1
z = -1

for a in range(N+1):
    for b in range(N-a+1):
        c = N - a -b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            x, y, z = a, b, c
            print("{} {} {}".format(x, y, z))
            exit()
print("{} {} {}".format(x, y, z))
import math

H,N = map(int,input().split())
ab = [list(map(int,input().split()))for _ in range(N)]

dp=[[[float('INF'),0] for _ in range(H+1)]for i in range(N+1)]
dp[0]=[[0,0]for _ in range(H+1)]
for i in range(1,N+1):
  a = ab[i-1][0]
  b = ab[i-1][1]
  for j in range(1,H+1):
    limit = math.floor(j/a)+2
    for k in range(limit):
        mana = dp[i-1][j-(a*k)][0]+b*k
        damage = dp[i-1][j-(a*k)][1]+(a*k)
        if damage >= j:
            if dp[i][j][0] > mana:
                dp[i][j]=[mana,damage]
        

print(dp[N][H][0])

### FIXED CODE ###

#モンスターの体力は H
#トキはN種類の魔法が使え、
#i番目の魔法を使うと、モンスターの体力を Ai減らすことができますが、
#トキの魔力を Bi消耗します。

#dp[i] = モンスターの体力を i 減らすため消耗する魔力の最小値
#dp[i+1] = min(dp[i-Ai]+Bi,dp[i])
#dp[0]=0

import numpy as np
 
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab = np.array(ab)
 
a = ab[:, 0]
b = ab[:, 1]
 
dp = np.zeros(100001, dtype=np.int)
for i in range(1, h+1):
    dp[i] = (dp[i-a]+b).min()
print(dp[h])
s = input()
k = int(input())

for i in range(min(k, len(s))):
    if s[i] != "1":
        ans = s[i]
        break

print(ans)


### FIXED CODE ###

s = input()
k = int(input())

ans = s[0]
for i in range(min(k, len(s))):
    if s[i] != '1':
        ans = s[i]
        break

print(ans)
n,m=map(int,input().split())
ab=sorted([list(map(int,input().split())) for i in range(n)])
shop,cost,rest=m,0,0
while True:
    if ab[shop][1]<rest:
        cost+=ab[shop][1]*ab[shop][0]
        rest-=ab[shop][1]
        shop+=1
    else:
        cost+=ab[shop][0]*rest
        break
print(cost)

### FIXED CODE ###

n,m = map(int,input().split())
ab = sorted([list(map(int,input().split())) for i in range(n)])
shop,cost,rest=0,0,m
while True:
    if ab[shop][1]<rest:
        cost += ab[shop][1]*ab[shop][0]
        rest -= ab[shop][1]
        shop+=1
    else:
        cost+=ab[shop][0]*rest
        break
print(cost)
x=int(integer)
  if 400<=x and x<=599:
    print("8")
  elif 600<=x and x<=799:
    print("7")
  elif 800<=x and x<=999:
    print("6")
  elif 1000<=x and x<=1199:
    print("5")
  elif 1200<=x and x<=1399:
    print("4")
  elif 1400<=x and x<=1599:
    print("3")
  elif 1600<=x and x<=1799:
    print("2")
  elif 1800<=x and x<=1999:
    print("1")


### FIXED CODE ###

x=int(input())
if (x>=400 and x<=599):
  print("8")
elif (x>=600 and x<=799):
  print("7")
elif (x>=800 and x<=999):
  print("6")
elif (x>=1000 and x<=1199):
  print("5")
elif (x>=1200 and x<=1399):
  print("4")
elif (x>=1400 and x<=1599):
  print("3")
elif (x>=1600 and x<=1799):
  print("2")
elif (x>=1800 and x<=1999):
  print("1")
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

s=input()+"T"
N=len(s)
x,y=MI()

F=[[],[]]

temp=0
bit=0
for i in range(N):
    if s[i]=="F":
        temp+=1
    else:
        if temp!=0:
            F[bit].append(temp)
        bit=(bit+1)%2
        temp=0
        
        
Nx=len(F[0])
Ny=len(F[1])

        
#i番目の文字で，位置x [-N~N]につけるかどうか
dpx=[[False]*(2*N+1) for _ in range(Nx+1)]
dpy=[[False]*(2*N+1) for _ in range(Ny+1)]

dpx[0][N]=True
dpy[0][N]=True

if Nx>=1:
    dpx[1][N]=False
    dpx[1][N+F[0][0]]=True
    if s[0]=="T":
        dpx[1][N-F[0][0]]=True

MA=F[0][0]+1

for i in range(1,Nx):
    MA+=F[0][i]
    a=min(N-MA,0)
    b=max(N+MA+1,2*N+1)
    for j in range(a,b):
        if dpx[i][j]:
            jj=j+F[0][i]
            jjj=j-F[0][i]
            dpx[i+1][jj]=True
            idpx[i+1][jjj]=True
                
if Ny>=1:   
    MA=F[1][0]+1

for i in range(Ny):
    MA+=F[1][i]
    a=min(N-MA,0)
    b=max(N+MA+1,2*N+1)
    for j in range(a,b):
        if dpy[i][j]:
            jj=j+F[1][i]
            jjj=j-F[1][i]
            dpy[i+1][jj]=True
            dpy[i+1][jjj]=True

if dpx[-1][N+x] and dpy[-1][N+y]:
    print("Yes")
else:
    print("No")





### FIXED CODE ###

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

s=input()+"T"
N=len(s)
x,y=MI()

F=[[],[]]

temp=0
bit=0
for i in range(N):
    if s[i]=="F":
        temp+=1
    else:
        if temp!=0:
            F[bit].append(temp)
        bit=(bit+1)%2
        temp=0
        
XY=[set([0]), set([0])]
    
for bit in range(2):
    for i in range(len(F[bit])):
        temp=set([])
        a=F[bit][i]
        b=-a
        if bit==0 and i==0 and s[0]=="F":
            b=a
        for j in range(len(XY[bit])):
            aaa=XY[bit].pop()
            temp.add(aaa+a)
            temp.add(aaa+b)
        XY[bit]=temp
        
if (x in XY[0] ) and (y in XY[1] ):
    print("Yes")
else:
    print("No")
#ABC105-D Candy Distribution
"""
al~arの合計がmの倍数となる通り数を調べる。
愚直に累積和をとって判定するには、O(n(n+1)/2)で不十分
実は、al~arの合計がmの倍数になる条件は、累積和をbとして、
b(l-1),brのmod m が同値になることである。
よって、累積和のmod mの個数をdictで保存しておいて、
同じ値のnC2つまり、n(n-1)//2の合計が答えとなる。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,m = map(int,readline().split())
lst1 = list(map(int,readline().split()))
def cumsum(lst): #元のリストを保持
    res = lst[:]
    for i in range(1,len(res)):
        res[i] += res[i-1]
    return res
lst2 = cumsum(lst1)

dic1 = dict()
for i in lst2:
    res = i%m
    if res in dic1:
        dic1[res] += 1
    else:
        dic1[res] = 1

ans = 0
for i in dic1.values():
    if i >= 2:
        ans += i*(i-1)//2

print(ans+dic1[0])


### FIXED CODE ###

#ABC105-D Candy Distribution
"""
al~arの合計がmの倍数となる通り数を調べる。
愚直に累積和をとって判定するには、O(n(n+1)/2)で不十分
実は、al~arの合計がmの倍数になる条件は、累積和をbとして、
b(l-1),brのmod m が同値になることである。
よって、累積和のmod mの個数をdictで保存しておいて、
同じ値のnC2つまり、n(n-1)//2の合計が答えとなる。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,m = map(int,readline().split())
lst1 = list(map(int,readline().split()))
def cumsum(lst): #元のリストを保持
    res = lst[:]
    for i in range(1,len(res)):
        res[i] += res[i-1]
    return res
lst2 = cumsum(lst1)

dic1 = dict()
for i in lst2:
    res = i%m
    if res in dic1:
        dic1[res] += 1
    else:
        dic1[res] = 1

ans = 0
for i in dic1.values():
    if i >= 2:
        ans += i*(i-1)//2

res = 0 if 0 not in dic1 else dic1[0]
print(ans+res)
n = int(input())
l = [list(list(input())) for _ in range(n)]
for i in range(n):
    l[i].sort()

x = []
for i in range(len(l[0])):
    if l[0][i] == l[1][i] == l[2][i]:
        x.append(l[1][i])

print(''.join(sorted(x)))

### FIXED CODE ###

n = int(input())
l = [list(list(input())) for _ in range(n)]

l = sorted(l, key = len)

x = []
for i in range(len(l[0])):
    y = 0
    for j in range(n):
        if l[0][i] in l[j]:
            y +=1
            if y == n:
                x.append(l[0][i])
                for k in range(1, n):
                    l[k].remove(l[0][i])

print(''.join(sorted(x)))
N, Q = input().split(" ")
N, Q = int(N), int(Q)
S = input()
s = S.replace("AC", "__")
counts = range(Q)
for i in range(Q):
    li, ri = [int(lr) for lr in input().split(" ")]
    print(s[li, ri].count("__"))


### FIXED CODE ###

N, Q = [int(nq) for nq in input().split(" ")]
S = input()
t = [0] * (N)
for i in range(1, N):
  t[i] = t[i-1] + (1 if (S[i-1] == "A" and S[i] == "C") else 0)
for _ in " " * Q:
  l, r = [int(lr) for lr in input().split(" ")]
  print(t[r-1]-t[l-1])
n = int(input())
print(replace("9","a").replace("1","9").replace("a","9"))


### FIXED CODE ###

n = input()
print(n.replace("9","a").replace("1","9").replace("a","1"))
n = int(input())

class cell:
    def __init__(self, data, before, _next):
        self.data = data
        self.before = before
        self._next = _next

def search(ddl, data):
    for ind,item in enumerate(ddl):
        if item.data == data:
            return ind
    return None

def getItem(ddl, index):
    if len(ddl) > index and index >= 0:
        return ddl[index]
    return None

ddl = []
for i in range(n):
    inp = input().split()
    if len(inp) == 2:
        op, data = inp
        data = int(data)
    else: op, data = inp[0], None
    if op == 'insert':
        if len(ddl) == 0:
            _next = None
        else:
            _next = ddl[0]
        c = cell(data, None, _next)
        ddl = [c] + ddl
    elif op == 'delete':
        ind = search(ddl, data)
        if ind != None:
            ddl[ind - 1].next = getItem(ddl, ind + 1)
            if getItem(ddl, ind+1) is not None:
                ddl[ind + 1].prev = getItem(ddl, ind - 1)
            ddl = ddl[:ind] + ddl[ind+1:]
    elif op == 'deleteFirst':
        ddl = ddl[1:]
        ddl[0].prev = None
    elif op == 'deleteLast':
        ddl = ddl[:-1]
        if len(ddl) != 0:
         ddl[-1]._next = None

print(' '.join([str(item.data) for item in ddl]))

### FIXED CODE ###

from collections import deque
from sys import stdin
n = int(input())
line = stdin.readlines()
ddl = deque()
for i in range(n):
    inp = line[i].split()
    if len(inp) == 2:
        op, data = inp
        data = int(data)
    else: op, data = inp[0], None
    if op == 'insert':
        ddl.appendleft(data,)
    elif op == 'delete':
        try:
            ddl.remove(data)
        except ValueError:
            pass
    elif op == 'deleteFirst':
        ddl.popleft()
    elif op == 'deleteLast':
        ddl.pop()

print(' '.join([str(item) for item in ddl]))
a,b=map(int, input().split())
print(b+a)

### FIXED CODE ###

a,b=map(str, input().split())
print(b+a)
N = int(input())
a = list(map(int, input().split()))
res = 0
a.sort()

for i in range(N):
    X = a.count(i+1)
    if a[i] > N:
        res += N - i
        break
        
    elif X < i+1:
        res += X
        i = i  + X
        
    else:
        res += X - (i+1)
        i = i  + X
        
print(res)

### FIXED CODE ###

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

if c%2 == 0:
    print(int(c/2))
    
else:
    print(int(c/2)+1)