peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from itertools import accumulate
import bisect

N,M,K = map(int,input().split())

A = list(map(int,input().split()))
B = list(map(int,input().split()))


#累積和
a_acc =[0] + list(accumulate(A))
b_acc =list(accumulate(B))

ans = 0

for an in range(len(a_acc)):
    rem = K - a_acc[an]
    if rem < 0:
        break
    
    bn  = bisect.bisect_right(b_acc, rem)

    ans = max(ans, an+bn)
    
    
print(ans)
# Judge status: Accepted
a,b,k=map(int,input().split())
if k>(b-a):
    k=b-a
list1=[i for i in range(a,a+k)]
list1.extend([i for i in range(b-k+1,b+1)])
ans=list(set(list1))
ans.sort()
if a==b:
    ans=[a]
for i in range(len(ans)):
    print(ans[i])
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline

from itertools import combinations_with_replacement

N, M, Q = map(int, input().split()) 
ABCD = [list(map(int, input().split())) for _ in  range(Q)]

lst = list(combinations_with_replacement(range(1, M + 1), N))

ans = 0
for l in lst:
    tmp = 0
    for a, b, c, d in ABCD:
        if l[b - 1] - l[a - 1] == c:
            tmp += d
    ans = max(tmp, ans)
    
print(ans)
# Judge status: Accepted
import bisect
n, *a = map(int, open(0).read().split())
a = a[::-1]
INF = 1 << 30
dp = [INF] * (n + 1)

for e in a:
    dp[bisect.bisect_right(dp, e)] = e
print(bisect.bisect_left(dp, INF))
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]

box = [0] * n
ans = []
for i in range(n, 0, -1):
    if sum(box[i - 1:n:i]) % 2 != a[i - 1]:
        box[i - 1] = 1
        ans.append(i)

print(len(ans))
print(*ans)
# Judge status: Wrong Answer
def main():
    N, M = map(int, input().split(" "))
    i = M // N
    while True:
        if M % i == 0:
            break
        elif i == 2:
            break
        else:
            i -= 1
    print(i)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import math
m = [int(input()) for i in range(5)]

last = min((m[i] - 1) % 10 +1 for i in range(5))
last1 = int(str(last)[-1])
sum = sum(math.ceil(m[i] / 10) * 10 for i in range(5))

print(sum+last1-10)
# Judge status: Wrong Answer
mod = 10 ** 9 + 7


def f(n, r):
    X = 1
    Y = 1
    for i in range(r):
        X *= n - i    # nCr の分子
        X %= mod
        Y *= i + 1    # nCr の分母
        Y %= mod

    # フェルマーの小定理より (X/Y)%mod = X*Y^(mod - 2) % mod
    return X * pow(Y, mod - 2, mod) % mod


N, A, B = map(int, input().split())
res = pow(2, N, mod) - 1

for i in [A, B]:
    res -= f(N, i)

print(res)
# Judge status: Accepted
# ABC141
# A Weather Prediction
s = input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
# Judge status: Wrong Answer
import math
N = int(input())
ans = 0
for i in range(1,N+1):
    if i % 10 == 0:
        continue
    x = int(math.log10(i))
 
    if i // (10 ** x) == i % 10:  
        ans += 1
        
    if N > (i % 10) * 10:
        ans += 1
    if N > (i % 10) * 100:
        ans += 10
    if N > (i % 10) * 1000:
        ans += 100
    if N > (i % 10) * 10000:
        ans += 1000
    if N > (i % 10) * 100000:
        ans += 10000

print (ans)
# Judge status: Accepted
import string

s = list(input())
flag = True
if s[0] != "A":
    flag = False
count = 0
for i in range(1, len(s)):
    if s[i] in string.ascii_uppercase:
        if i == 1 or i == len(s) - 1 or s[i] != "C":
            flag = False
        count += 1

if flag and count == 1:
    print("AC")
else:
    print("WA")
# Judge status: Wrong Answer
w,h,x,y = map(int,input().split())

left = x * h
right = (w - x)*h
under = w * y
top = w * (h - y)
arr = [left,right,under,top]
arr.sort()
if arr[0]==arr[1]:
    print(arr[1],1)
else:
    print(arr[1],0)
# Judge status: Accepted
a,b,c,d=map(int,input().split());print(max(0,min(b,d)-max(a,c)))
# Judge status: Accepted
#!/usr/bin/env pytHon3
# -*- coding: utf-8 -*-


def main():
    N, M = map(int, input().split())

    if M - 2 * N > 0:
        x = (M - 2 * N) // 4
        print(N + x)
    else:
        print(M // 2)


if __name__ == "__main__":
    main()
# Judge status: Accepted
a, b = map(int, input().split())
c = max(a,b)
print(max((2*c-1, a+b)))
# Judge status: Accepted
import statistics

n = int(input())
a = []
j = 1
for i in list(map(int, input().split())):
    a.append(i - j)
    j += 1
b = statistics.median((a))
res = 0
for i in range(n):
    res += abs(a[i] - b)

print(int(res))
# Judge status: Accepted
O=input()
E=input()
ans=""
for i in range(len(E)):
    ans+=O[i]+E[i]
if len(O)>len(E):
    ans+=O[-1]
print(ans)
# Judge status: Wrong Answer
n=int(input())
min1=9999999999999999999
for i in range(5):
    a=int(input())
    min1=min(min1,a)
print((n//min1+1)+4)
# Judge status: Accepted
D,N = list(map(int, input().split()))
if N == 100: N += 1
print(N*(100**D))
# Judge status: Accepted
n=int(input())
a=[int(input())for _ in range(n)]
dp=[2]*(n+1)
from bisect import bisect_left,bisect_right
for i in a:
  dp[bisect_left(dp,-i+1)]=-i
print(dp.index(2))
# Judge status: Accepted
import queue

q = queue.Queue()
N, M = map(int, input().split())

ans = [-1 for i in range(N+1)]
path = [[] for i in range(N+1)]

for i in range(M):
  A, B = map(int, input().split())
  path[A].append(B)
  path[B].append(A)
q.put(1)
COUNTER = 0
while not q.empty() :
  now = q.get()
  for p in path[now]:
    if ans[p]==-1:
      ans[p]=now
      q.put(p)
      #print(COUNTER, now,p)
      COUNTER+=1
      
print("Yes")
for i in ans[2:]:
  print(i)
# Judge status: Accepted
def answer(n: int) -> int:
    q = n // 111
    if n % 111 != 0:
        q += 1

    return 111 * q


def main():
    n = int(input())
    print(answer(n))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S=input()
s=set(S)
if len(s)==3:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s=input()
a=0
if s=='hi':
  print('Yes')
elif s=='hihi':
  print('Yes')
elif s=='hihihi':
  print('Yes')
elif s=='hihihihi':
  print('Yes')
elif s=='hihihihihi':
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
S = input()
s = list(S)
p = 1
for i in range(3):
    if s[i] == s[i+1]:
        p = 0
        print('Bad')
if p == 1:
    print('Good')
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
num = a
if (a % 2 == 1 and c % 2 == 0) or (a % 2 == 0 and c % 2 == 1):
  print('NO')
else:
  print('YES')
# Judge status: Accepted
from collections import Counter

N = int(input())
As = [int(n) for n in input().split()]

C = Counter(As)

ans = sum(v * (v - 1) // 2 for k, v in C.items())
M = [C[a] - 1 for a in As]

for m in M:
    print(ans - m)
# Judge status: Wrong Answer
N = int(input())

if N%2==0:
  print(N/2)
else:
  print((N+1)/2)
# Judge status: Wrong Answer
# 現在の時刻aと何時間後にコンテストが始めるかbを整数で入力
a,b = map(int,input().split())
# a+bが24より大きければ-24して表示
start_time = a + b
if start_time >24:
    print(start_time - 24)
# a+bが24より小さければそのまま表示
else:
    print(start_time)
# Judge status: Accepted
N=input()
ans=["a","i","u","e","o"]
if N in ans:
  print("vowel")
else:
  print("consonant")
# Judge status: Accepted
def actual(K, S):
    count = 0

    for x in range(K + 1):
        for y in range(K + 1):
            z = S - (x + y)

            if 0 <= z <= K:
                count += 1

    return count

K, S = map(int, input().split())
print(actual(K, S))
# Judge status: Accepted
print("Yes" if len(set(input())) == 3 else "No")
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
l=[x // 400 for x in a if x < 3200]
free=len([x for x in a if x >= 3200])
from collections import Counter
c=Counter(l)
print(max(len(c), 1), len(c) + free)
# Judge status: Wrong Answer
from collections import deque

S = input()
Q = int(input())

deque = deque([S])
for _ in range(Q):
  pack = input().split()

  T = int(pack[0])
  if T == 1:
    deque[0], deque[-1] = deque[-1], deque[0]

  if T == 2:
    F, C = int(pack[1]), pack[2]
    if F == 1:
      # 最初に追加するパターン
      deque.appendleft(C)
    if F == 2:
      # 最後尾に追加するパターン
      deque.append(C)

print("".join(deque))
# Judge status: Accepted
n = int(input())
d = dict()
res = 0
for _ in range(n):
    s = input()
    s = list(s)
    s.sort()
    s = "".join(s)
    if s in d:
        res += d[s]
        d[s] += 1
    else:
        d[s] = 1
print(res)
# Judge status: Accepted
N , K = map(int,input().split())
h = [int(input()) for i in range(N)]
h.sort()
print(min(h[i + K - 1] - h[i] for i in range(N - K + 1)))
# Judge status: Accepted
n = int(input())
A1 = tuple(map(int, input().split()))
A2 = tuple(map(int, input().split()))

from itertools import accumulate
A1S = [0] + list(accumulate(A1))
A2S = [0] + list(accumulate(A2))

ma = 0
for i in range(1, n+1):
    ma = max(ma, A1S[i] + A2S[-1] - A2S[i-1])
print(ma)
# Judge status: Accepted
a,b,c=map(int,input().split())
if a+b>=c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
c,a,b = map(int, input().split())
print((c*a)//2)
# Judge status: Accepted
s = input()
print('Yes') if s[0] == '9' or s[1] == '9' else print('No')
# Judge status: Accepted
S=str(input())
n = len([1 for x in S if x=='1'])
print(n)
# Judge status: Wrong Answer
import math
N = int(input())
print((math.factorial(N))%(10^9+7))
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	n=II()
	A=[II() for _ in range(5)]
	print(5+(n-1)//min(A))









if __name__ == "__main__":
	main()
# Judge status: Accepted
from itertools import combinations
n = int(input())
s = sorted([int(input()) for _ in range(n)])

ans = sum(s)
if ans % 10 != 0: print(ans)
elif all(i%10 == 0 for i in s): print(0)
else:
  for i in range(1,n):
    for j in combinations(s,i):
      t = sum(j)
      if (ans-t)%10 != 0:
        print(ans-t)
        exit()
# Judge status: Wrong Answer
def main():
    l = int(input())

    print((l//3)**3)

if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
s = input().strip()

if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
X,Y,A,B,C = list(map(int,input().split()))
p = sorted(list(map(int,input().split())),key=lambda x:-x)
q = sorted(list(map(int,input().split())),key=lambda x:-x)
r = sorted(list(map(int,input().split())))

pq = sorted(p[:X] + q[:Y],lambda x:-x)
for i in range(X+Y):
  if r[i] < pq[i]:
    break
print(sum(r[:i] + pq[i:]))
# Judge status: Wrong Answer
d, t, s = map(int, input().split())

res = d / t

if s <= res:
    print("no")
else:
    print("yes")
# Judge status: Accepted
x=int(input())
ans=2*(x//11)
if x%11 == 0:
  print(ans)
elif x%11 <= 6:
  print(ans+1)
else:
  print(ans+2)
# Judge status: Accepted
N,D = map(int,input().split())
ans = 0
D **= 2
for i in range(N):
    X,Y = map(int,input().split())
    if D >= X**2 + Y**2:
        ans += 1
print(ans)
# Judge status: Wrong Answer
S = input()
T = input()

Min = 100000

for i in range(len(S) - len(T) + 1):
    count = 0
    for n in range(len(T)):
        if S[i + n] != T[n]:
            count += 1
    if count < Min:
        Min = count

print(count)
# Judge status: Accepted
N = int(input())
ans = 0
for a in range(1,N+1):
    for b in range(1,int(N/a)+1):
        if a*b<N:
            ans += 1 
print(ans)
# Judge status: Accepted
H1,M1,H2,M2,K = map(int,input().split())
start = H1*60 + M1
finish = H2*60 + M2 - K

if finish - start >= 0:
  print(finish - start)
else:
  print(0)
# Judge status: Accepted
a, b = map(int, input().split())
a_prime_factor = []
b_prime_factor = []
for i in range(2, int(a ** 0.5) + 1):
    if a % i == 0:
        a_prime_factor.append(i)
    while a % i == 0:
        a //= i
if a != 1:
    a_prime_factor.append(a)
for i in range(2, int(b ** 0.5) + 1):
    if b % i == 0:
        b_prime_factor.append(i)
    while b % i == 0:
        b //= i
if b != 1:
    b_prime_factor.append(b)
ans = 1
for i in a_prime_factor:
    if i in b_prime_factor:
        ans += 1
print(ans)
# Judge status: Accepted
# abc166 D
x = int(input())

for a in range(-118, 120):
    ans = False
    for b in range(-119, 119):
        if a ** 5 - b** 5 == x:
            print("{} {}".format(a, b))
            ans = True
            break
    if ans:
        break
# Judge status: Accepted
n=int(input())
if n%2==0:
    print(1/2)
else:
    print(((n-1)/2+1)/n)
# Judge status: Accepted
a, b = input().split()
s = int(a+b)**0.5
if s.is_integer():
    print('Yes')
else:
    print('No')
# Judge status: Accepted
with open(0) as f:
    N, *a = map(int, f.read().split())

from itertools import count
p = 0
seen = {0}
for i in count(1,1):
    p = a[p]-1
    if p == 1:
        ans = i
        break
    if p in seen:
        ans = -1
        break
    seen.add(p)
print(ans)
# Judge status: Accepted
def main():
    L = int(input())
    print((L / 3) ** 3)


if __name__ == '__main__':
    main()
# Judge status: Accepted
W, a, b = map(int, input().split())
print(max(0, max(a, b) - (min(a, b) + W)))
# Judge status: Accepted
a, b, c = map(int, input().split())

if (c >= a) and (c <= b):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A, B = map(int, input().split())
result = int(A*B) if A <= 9 and B <= 9 else -1
print(result)
# Judge status: Accepted
n=input()
z=[0]*(n+1)
z[0]=1
for i in xrange(1,n+1):
  s=0
  if i-3>=0:
    s=z[i-3]
  z[i]=(z[i-1]+s)%(pow(10,9)+7)
print (z[-1]-z[-2])%(pow(10,9)+7)
# Judge status: Wrong Answer
n = int(input())
a = set(map(int, input().split()))

iter = 0

for i in a:
  lst = [i%j for j in a]
  if lst.count(0) == 1:
    iter = iter + 1
print(iter)
# Judge status: Accepted
X = int(input())

if(0 <= X%100 <= 5*(X//100)):
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
N = int(input())
P = input().split(" ")

count = 1

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

print (count)
# Judge status: Wrong Answer
si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
lmsi = lambda: list(map(str, input().split()))
smii = lambda: sorted(map(int, input().split()))

# ----------

x = ii()

d = x // 11
m = x % 11
ans = 2 * d
if m > 0:
    ans += 1
    if m > 5:
        ans += 1
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if (a + b) % 2 == 0:
    print((a + b) / 2)
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
N = int(input())
cnt_max = 0
ans = 1

for i in range(1, N + 1):
    cnt = 0
    num = i
    while True:
        if num % 2 == 0:
            cnt += 1
            num /= 2
        else:
            break
    if cnt_max < cnt:
        cnt_max = cnt
        ans = i

print(ans)
# Judge status: Wrong Answer
W, a, b = map(int,input().split())
 
if (a+W)<=b:
  print(b-(a+W))
elif (a<= b)and (b<a):
  print(0)
elif b<(a-W):
  print(a-(b+W))
# Judge status: Wrong Answer
A = []
for i in range(3):
  A.append(list(map(int, input().split())))
B = [[0]*3]*3
N = int(input())
for i in range(N):
  b = int(input())
  for j in range(3):
    for k in range(3):
      if A[j][k] == b:
        B[j][k] = 1
c = []
for i in range(3):
  c.append(B[i][0] | B[i][1] | B[i][2])
  c.append(B[0][i] | B[1][i] | B[2][i])
c.append(B[0][0] | B[1][1] | B[2][2])
c.append(B[0][2] | B[1][1] | B[2][0])
if sum(c) > 0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,m = list(map(int, input().split()))
#data={}
#l=[]
data = [tuple(map(int, input().split())) for _ in range(m)]
#for i in range(m):
#    tup = tuple(map(int, input().split()))
#    data[i]=tup
#    l.append(tup)

m={}
n=0
p=None
for t in sorted(data):
#    print('p=',p,'t[0]=',t[0])
    if p!=t[0]:
        p=t[0]
        n=1
    m[t]='%06d%06d' % (t[0], n)
    n+=1
#print(m)
for k in data:
    print(m[k])
# Judge status: Accepted
N,K=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
while True:
  N=N-K
  cnt+=1
  if N<=0:
    break
  else:
    N=N+1
print(cnt)
# Judge status: Accepted
S = input()[::-1]
l = len(S)
dp = [[0]*2 for _ in range(l+1)]
dp[1][0]=dp[0][0]+int(S[0])
dp[1][1]=dp[0][1]+10-int(S[0])
for i in range(1,l):
  dp[i+1][0]=min(dp[i][0]+int(S[i]),dp[i][1]+int(S[i])+1)
  dp[i+1][1]=min(dp[i][0]+10-int(S[i]),dp[i][1]+10-int(S[i])-1)
  
print(min(dp[-1][0],dp[-1][1]+1))
# Judge status: Accepted
def main():
    N = int(input())
    S = input()
    Ws = [0]*(N+1)
    Bs = [0]*(N+1)
    for i in range(1, N + 1):
        Bs[i] = Bs[i - 1] + (1 if S[i-1] == '#' else 0)
        Ws[N - i] = Ws[N + 1 - i] + (1 if S[N - i] == '.' else 0)
    # print(Ws[:10], Bs[:10])
    ans = Bs[0] + Ws[0]
    for i in range(1, N + 1):
        ans = min(ans, Bs[i] + Ws[i])
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
from itertools import product
n, k = input().split()
a = list(input().split())
l = set([str(i) for i in range(10)]).difference(a)
ni = int(n)
for j in range(len(n), len(n)+2):
    for i in product(l, repeat=j):
        t = ''.join(i)
        if int(t) >= ni:
            print(t)
            exit()
# Judge status: Accepted
import sys
a, b, c, k = map(int, input().split())

if abs(b-a) >= 10**18: print('Unfair')
elif k%2 == 1: print(b-a)
else: print(a-b)
# Judge status: Wrong Answer
X = int(input())
X_ = X % 101
N = X // 101
ans = 0
for i in range(6):
    if X_ > N:
        X_ -= N
    else:
        print(1)
        break
else:
    print(0)
# Judge status: Accepted
n=int(input())
n-=1
c=[0]*n
s=[0]*n
f=[0]*n
for i in range(n):
    c[i],s[i],f[i]=map(int,input().split())
for i in range(n):
    t=0
    for j in range(i,n):
        if t<s[j]:
            t=s[j]
        elif t%f[j]==0:
            pass
        else:
            t=t+f[j]-t%f[j]
        t+=c[j]
    print(t)
print(0)
# Judge status: Wrong Answer
n = int(input())
a, b = [input() for i in range(2)]
for i in range(n+1):
  if a[i:] == b[:n-i]:
    print(i + n)
# Judge status: Accepted
w, a, b = map(int, input().split())

if b > a:
    print(max(0, b - a - w))
else:
    print(max(0, a - b - w))
# Judge status: Accepted
a = int(input())

t =1 
rps = 0
while a > rps:
    rps+=t
    t+=1
d = rps - a
for i in range(1,t):
    if i!=d:
        print(i)
# Judge status: Wrong Answer
s = list(input())
# print(''.join(s[0:3]))
A = []
for i in range(0, len(s) - 2):
    A.append(abs(int(''.join(s[i:i+3])) - 753))
for i in range(0, len(s) - 4):
    A.append(abs(int(''.join(s[i:i+4])) - 753))
print(min(A))
# Judge status: Wrong Answer
sa = input()
sb = input()
sc = input()
now = sa[0]

for i in range(320):
    if now == 'a':
        sa = sa[1:]
    elif now == 'b':
        sb = sb[1:]
    elif now == 'c':
        sc = sc[1:]

    if len(sa) == 0:
        print('A')
        break
    elif len(sb) == 0:
        print('B')
        break
    elif len(sc) == 0:
        print('C')
# Judge status: Accepted
from itertools import*;*a,s=list(accumulate(map(int,open(0).read().split()[1:])));print(min(abs(s-x*2)for x in a))
# Judge status: Accepted
from decimal import Decimal
a, b, c = map(Decimal, input().split())

ans = (c - a - b)**2 > 4 * a * b

if c - a - b < 0:
    ans = False

print("Yes" if ans else "No")
# Judge status: Accepted
def solve():
    N, M = map(int, input().split())
    if N > 0:
        return 'Positive'
    elif N <= 0 <= M:
        return 'Zero'
    else:
        
        if (-(N-M)+1) % 2 == 0:
            return 'Positive'
        else:
            return 'Negative'
            
    return 0

print(solve())
# Judge status: Wrong Answer
x, k, d = map(int, input().split())

if x > 0:
    sgn_x = 1
    x_greedy = x - k * d
else:
    sgn_x = -1
    x_greedy = x + k * d

if x_greedy > 0:
    sgn_x_greedy = 1
else:
    sgn_x_greedy = -1

if sgn_x == sgn_x_greedy:
    print(abs(x_greedy))
    exit()

x_r = x % d
x_l = -(x_r - d)
print(min(x_r, x_l))
# Judge status: Wrong Answer
z,a,b=map(int,input().split());print('AB'[(z-a)//(z-b)!=0])
# Judge status: Accepted
N=int(input())
S=input()
left=0
right=S[1:N].count('E')
ans=left+right
for i in range(1,N):
    if S[i-1]=='W':
        left+=1
    if S[i]=='E':
        right-=1
    ans=min(ans,left+right)
print(ans)
# Judge status: Wrong Answer
N, M = map(int, input().split())

X = list(map(int, input().split())) 
X = sorted(X)

diff = []
for i in range(len(X)-1):
    diff.append(X[i+1] - X[i])

diff_sort = sorted(diff)


if M == 1:
    print(0)    
else:
    print(sum(diff_sort[0:N+1]))
# Judge status: Wrong Answer
n,m = map(int, input().split())
r = 1
b0 = [1]*(n+1)
rb = [0]*(n+1)
for i in range(m):
    x,y = map(int, input().split())
    b0[x] -= 1
    b0[y] += 1
    if x == r:
        r = y
        rb[r] = 1
ans = 0
for j in range(n+1):
    if rb[j] == 1 and b0[j] >0:
        ans += 1
print(ans)
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
if b-a<=2*k:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
# Judge status: Wrong Answer
N,C,K = map(int, input().split())
L = [int(input()) for i in range(N)]
cap = 0
begin = 0
count = 1

for i in range(N):
  a = L[i]
  if begin == 0:
    begin = a
  elif a <= begin + K and cap < C:
    cap += 1
  else:
    cap = 1
    begin = a
    count += 1
print(count)
# Judge status: Accepted
N = int(input())

n = N % 10

if n == 3 :
    print("bon")

elif n in(0,1,6,8) :
    print("pon")

elif n in (2,4,5,7,9):
    print("hon")
# Judge status: Accepted
pow2 = [2 ** i for i in range(0, 7)]
n = int(input())
res = max([i for i in pow2 if i <= n])
print(res)
# Judge status: Wrong Answer
n = int(input())
s = input()
if n % 2 == 1:
    print('No')
    exit()
else:
    if s[:n // 2] == s[n // 2 + 1:]:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
a, b, c = [int(i) for i in input().split()]
if a == b == c and a % 2 == 0:
    print(-1)
    exit()
if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
    print(0)
    exit()
cnt = 0
while True:
    ta, tb, tc = a, b, c
    ta = (b + c) // 2
    tb = (a + c) // 2
    tc = (a + b) // 2
    cnt += 1
    if ta % 2 == 1 or tb % 2 == 1 or tc % 2 == 1:
        print(cnt)
        break
    a, b, c = ta, tb ,tc
# Judge status: Wrong Answer
N = int(input())
a = [int(input()) for _ in range(N)]

n = 0
count = 0
for i in range(N):
  count += 1
  n = a[n] - 1
  if n == 1:
    print(count)
    break  

print(count if n == 1 else -1)
# Judge status: Wrong Answer
a,b,m = map(int,input().split())
alist = list(map(int,input().split()))
blist = list(map(int,input().split()))
mlist = [list(map(int,input().split())) for s in range(m)]
for m in mlist:
	tmp = alist[m[0]-1] + blist[m[1]-1] -m[2]
	ans = [tmp]
for a in alist:
	for b in blist:
		ans.append(a + b)
print(min(ans))
# Judge status: Accepted
X = int(input())
k = 0
x = X%100
while x!=0:
    k+=1
    for i in range(5,0,-1):
        if i<=x:
            x-=i
            break
X //= 100
print(1 if k<=X else 0)
# Judge status: Accepted
N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]

def calc_score(A):
  score = 0
  for a, b, c, d in abcd:
    if A[b-1] - A[a-1] == c:
      score += d
  return score

ans = 0
def dfs(A):
  global ans
  if len(A) == N:
    ans = max(ans, calc_score(A))
  else:
    last_a = A[-1]
    for a in range(last_a, M+1):
      dfs(A + [a])

dfs([1])
print(ans)
# Judge status: Accepted
def II(): return int(input())
N=II()
d=2
ans=0
while d*d<=N:
  if N%d!=0:
    d+=1
    continue
  z=d
  while N%z==0:
    ans+=1
    N//=z
    z*=d
  while N%d==0:
    N//=d
if N!=1:
  ans+=1
print(ans)
# Judge status: Accepted
X,Y = map(int,input().split())
M = X+Y
mod = 10**9 + 7
kaijou = [1]
for i in range(1,10**6+1):
    kaijou.append((kaijou[-1]*i)%mod)


def C(n,k):
    return (kaijou[n]*pow(kaijou[k],mod-2,mod)*pow(kaijou[n-k],mod-2,mod))%mod

    

if M%3!=0:
    print(0)
elif X<M//3 or Y<M//3:
    print(0)
else:
    print(C(M//3, X-M//3))