peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
dp = [[0, 0, 0] for _ in range(n+1)]
for i in range(n):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i+1][j] = max(dp[i+1][j], dp[i][k]+a[i][j])
print(max(dp[n]))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    if a[i+1] > a[i]:
        ans += a[i+1] - a[i]
print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

print("YES" if abs(b-a) == abs(c-b) else "NO")
# Judge status: Wrong Answer
import math

x,y = map(int,input().split())
print(math.floor(math.log2(y//x))+1)
# Judge status: Accepted
n = int(input())
print(len(list(filter(lambda x : len(str(x)) % 2 & 1, range(1, n+1)))))
# Judge status: Wrong Answer
n=input()

if "9" in n:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
count=0
for i in range(0,N,2):
    if i%2==0 and A[i]%2==1:
        count+=1
print(count)
# Judge status: Accepted
a,b=map(int, input().split())

A = int(a/0.08)
B = int((b+1)/0.1)
l =['-1']

for i in range(A,B+1):
    if int(i*0.08) == a and int(i*0.1) == b:
        l.append(i)
        break
        
print(l[-1])
# Judge status: Accepted
def low_element(p):
    min = 2*10**5+1
    c = 0
    for p_i in p:
        if p_i <= min:
            min = p_i
            c += 1
    return c

n = input()
p = [int(i) for i in input().split()]

print(low_element(p))
# Judge status: Wrong Answer
num_list = list(map(int, input().split()))
k = int(input())

max = 0
index = 0
for i in num_list:
    if max < i:
        max = i
        index = num_list.index(i)

maximize = max * (2*k)
num_list[index] = maximize
sum = 0
for j in num_list:
    sum += j

print(sum)
# Judge status: Wrong Answer
s = input()

if(s[0] == "A" and s.count("A") == 1):
    if(s[2:len(s)-1].count("C") == 1 and s.count("C") == 1):
        s.strip("C")
        s.strip("A")
        if(s.islower):
            print("AC")
        else:
            print("WA")
    else: 
        print("WA")
else:
    print("WA")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = A[0]
ans = 0
for i in range(N):
  if B > A[i]:
    ans += abs(A[i] - B)
  B = max(A[i],B)
print(ans)
# Judge status: Accepted
a,b,c =input().split()
a=int(a)
b=int(b)
c=int(c)
f=0
for num in range(1,b):
	d=a*num
	d%=b
	if d==c :
		f=1
if f:	
	print("YES")
else:
	print("NO")
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]
A = Counter(a)
ans = 0
for x in A:
    ans += min(abs(x-A[x]), A[x])
print(ans)
# Judge status: Wrong Answer
#全体のgcdをとる際に最小にしてくるものを、他の全てのgcdに入れ替えてやる
import math
n = int(input())
a_lis = list(map(int, input().split()))
a_lis.sort()
ans = a_lis[0]
ans_list = []

for i in a_lis[1:]:
    an = math.gcd(ans, i) 
    ans_list.append(an)
    ans = an
    
#print(ans_list)
ts = ans_list.index(ans_list[-1]) +1
a_lis.pop(ts)
ans_0 = a_lis[0]
for i in a_lis[1:]:
  ans_0 = math.gcd(i,ans_0)
print(ans_0)
# Judge status: Accepted
S = input()
A = sorted(S)
hantei = "".join(A)
#print(hantei)
                 
if hantei == "abc" :
    result = "Yes"
else:
    result ="No"
print(result)
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
if A > B:
  print(0)
elif A == B:
  print(1)
elif B-A >=N:
  print(0)
else:
  X = N-B+A  
  print((B-A)*X+1)
# Judge status: Wrong Answer
s = input()
n = len(s)
k = int(input())

d = [0] * n
for i in range(n):
    if s[i] != 'a':
        d[i] = ord('z') - ord(s[i]) + 1

ans = list(s)
for i in range(n):
    if d[i] != 0 and d[i] <= k:
        k -= d[i]
        ans[i] = 'a'
    if k == 0: break
    if i == n-1:
        ans[i] = chr(ord(s[i]) + k % 26)

print(''.join(ans))
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**9)
X = int(input())
for i in range(-300, 300):
    for j in range(-300, 300):
        if i**5 - j**5 == X:
            print(i, j)
            sys.exit()
# Judge status: Accepted
n = list(input())
if n.count('a')==1 and n.count('b')==1:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import numpy as np
n = int(input())
A = list(map(int, input().split()))
a = list(np.cumsum(A))
r = sum(A)-A[0]
l = A[0]
ans = abs(r-l)
for i in range(1,len(a)):
    r -= a[i]
    l += a[i]
    ans = min(ans, abs(l-r))
print(ans)
# Judge status: Accepted
n = int(input())
ans = set([0])
for i in range(1, n+1):
    ans.add(i)
    n -= i
    if n<=0:
        break

ans = list(ans)
ans.remove(0)
if n!=0:
    ans.remove(-n)

for a in ans:
    print(a)
# Judge status: Accepted
n, m = map(int, input().split())
number = [0] * n
cou = [0] * n
#logging.debug(number)#

for i in range(m):
    s, c = map(int, input().split())
    s -= 1
    if cou[s] > 0 and c != number[s]:
        print(-1)
        exit()
    else:
        cou[s] += 1
        number[s] = c
    #logging.debug("number = {}, cou = {}".format(number, cou))

if n > 1 and number[0] == 0 and cou[0] >= 1:
    print(-1)
    exit()
elif n > 1 and number[0] == 0:
    number[0] = 1

number = map(str, number)
print(''.join(number))
# Judge status: Wrong Answer
A,B,C =map(int,input().split())
print(C - (A-B))
# Judge status: Accepted
N = int(input())
Robot = []
for i in range(N):
    a, b = map(int, input().split())
    Robot.append((a - b, a + b))
now = -10000000000
Robot.sort(key=lambda x: x[1])
ans = 0

for i in range(N):
    if Robot[i][0] >= now:
        ans +=1
        now = Robot[i][1]

print(ans)
# Judge status: Accepted
n = int(input())
for i in range(1,8):
    if n == i:
        ans = 1
        break
    if 2**i > n:
        ans =2**(i-1)
        break
print(ans)
# Judge status: Wrong Answer
n, k = (int(x) for x in input().split())
r, s, p = (int(x) for x in input().split())
t_ch = input()
t=[]
for i in range(n):
    t.append(t_ch[i])


for i in range(k-1, n):
    if t[i] == t[i-k]:
        t[i]=0
print(t)
for i in range(0,n):
    if t[i]=="r":
        t[i]=p
    elif t[i]=="p":
        t[i]=s
    elif t[i]=="s":
        t[i]=r
print(sum(t))
# Judge status: Accepted
a,s=map(int,input().split())
print(a+s//2)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    import itertools
    ac = [0] + list(itertools.accumulate(A))
    bc = [0] + list(itertools.accumulate(B))
    ans, j = 0, M
    for i, a in enumerate(ac):
        if a > K:
            break
        while a + bc[j] > K:
            j -= 1
        ans = max(ans, i+j)
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b = map(int, input().split())

if a == b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def resolve():
    a = int(input())
    s = input()
    if a >= 3200:
        print(s)
    else:
        print("red")


resolve()
# Judge status: Wrong Answer
n,x = map(int,input().split())
a_list = list(map(int,input().split()))
a_list.sort()
count = 0
for i in range(n):
    if a_list[i] <= x:
        count += 1
        x = x-a_list[i]
    else:
        break
if x > 0:
    if count == 0:
        print(0)
    else:
        print(count-1)
else:
    print(count)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, *b = map(int, read().split())

a = [b[0]]
for i in range(1, n-1):
    a.append(min(b[i - 1], b[i]))
a.append(b[-1])
print(sum(a))
# Judge status: Accepted
n,m=map(int,input().split())
print(m//2 if m<=2*n else(2*n+m)//4)
# Judge status: Wrong Answer
K = int(input())
a = [[1], [1, 2], [1, 2, 3], [2, 3, 4], [
    3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9], [8, 9]]
result = []
stack = list(range(0, 10))
i = -1
while len(result) < K:
    i += 1
    l = []
    for j in stack:
        for k in a[j // (10**i)]:
            l.append((10**(1+i))*k+j)

    result += stack[:]
    stack = l[:]
l = sorted(result)
print(l[K])
# Judge status: Accepted
N = int(input())
count = 1+N
for i in range(1,int(N**0.5)+1):
  if N % i == 0 and i + N/i < count:
    count = i+ N/i
count = int(count)
print(count-2)
# Judge status: Accepted
from collections import defaultdict

n = int(input())
d = defaultdict(int)

for x in range(n+1):
    s = str(x)
    a = s[0]
    b = s[-1]
    if int(a) and int(b):
        d[(a, b)] += 1

num = '123456789'
res = 0
for i in num:
    for j in num:
        res += d[(i, j)] * d[(j, i)]

print(res)
# Judge status: Accepted
a, b = map(int, input().split())

if (a+b) % 2 == 0:
    print((a+b) // 2)
else:
    print((a+b+1) // 2)
# Judge status: Accepted
import math

r = int(input())
print(2*r*math.pi)
# Judge status: Wrong Answer
if __name__ == '__main__':
    b, c = map(int, input().split())
    num = b*3 -c
    if num == 0 or c ==0:
        num =1
    else:
        if num > b:
            num = b*3
        else:
            num = num*3
    print(num)
# Judge status: Accepted
n = int(input())
s = input()

b_cnt = [0] * (n + 1)
for i in range(n):
    if s[i] == '#':
        b_cnt[i + 1] = b_cnt[i] + 1
    else:
        b_cnt[i + 1] = b_cnt[i]

ans = n
for i in range(n + 1):
    ans = min(ans, ((n - i) - (b_cnt[n] - b_cnt[i])) + b_cnt[i])

print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
N = int(input())

ans = 0
for i in range(1, 10**5):
    n = i ** 2
    if n <= N:
        ans = n
    else:
        break
print(ans)
# Judge status: Wrong Answer
T = list(str(input()))
X = ''
for i in range(len(T)):
    if T[i] == 'P' :
        X += 'P'
    elif T[i] == 'D' :
        X += 'D'
    elif T[i] == '?' :
        if T[i-1] == 'D' :
            X += 'P'
        elif T[i-1] == 'P' :
            X += 'D'
        elif T[i-1] == '?':
            X += 'D'
            
print(X)
# Judge status: Accepted
n=int(input())
ans = [0 for _ in range(n+1)]
for i in range(1,int((n+1)**0.5)):
    for j in range(1,n+1):
        for k in range(1,n+1):
            v = i*i+j*j+k*k+i*j+j*k+k*i
            if v > n:
                break
            ans[v]+=1
for i in range(n):
    print(ans[i+1])
# Judge status: Wrong Answer
n,m = map(int,input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        cnt = 0
        for k in range(m):
            if a[i+k][j:j+m] == b[k]:
                cnt += 1
            if cnt == m:
                print("YES")
                exit()
print("NO")
# Judge status: Accepted
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
b = 0
c = 1
for i in range(n):
    if b + l[i] <= x:
        b += l[i]
        c += 1
    else:
        break
print(c)
# Judge status: Accepted
r1=[input() for _ in range(int(input()))];r2=[input() for _ in range(int(input()))];ans=0
for i in set(r1): ans=max(ans,r1.count(i)-r2.count(i))
print(ans)
# Judge status: Wrong Answer
# ABC136 C-City Savers
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0

for i in range(n):
    ans+=min(b[i],a[i+1])
    b[i]-=min(b[i],a[i+1])
    ans+=min(b[i],a[i])
    b[i]-=min(b[i],a[i])
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())

sm = 0

for x in range(1, 1000):
    sm += x
    if sm > a:
        print(sm-a)
        break
# Judge status: Accepted
from sys import stdin

k,n = [int(x) for x in stdin.readline().strip().split()]
a_lst = [int(x) for x in stdin.readline().strip().split()]
diff_lst = [a_lst[i+1] - a_lst[i] for i in range(len(a_lst)-1)] + [k - a_lst[-1] + a_lst[0]]

print(k - max(diff_lst))
# 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:
  while True:
    if a % b == c:
      print('YES')
      break
    a += num
# Judge status: Accepted
def main():
    s = list(input())
    ans = 0

    for i in range(len(s)):
        if s[i] != s[-i - 1]:
            s[i] = s[-i - 1]
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N, Y =  map(int, input().split())
for i in range(N+1):
    for j in range(N-i-1):
        k = N- i - j
        if  k >= 0 and 10000*i + 5000*j + 1000*k == Y:
            print(i, j, k)
            exit()
print('-1 -1 -1')
# Judge status: Accepted
f, *n = str(int(input())+1)
print(int(f) + 9*len(n) - 1)
# Judge status: Wrong Answer
n=int(input())
s=input()
S=s.split("()")
L,R=0,0
for i in S:
    for j in i:
        if j==")":L +=1
        else:R +=1

print("("*L+s+")"*R)
# Judge status: Accepted
import sys
from collections import Counter


input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    C = Counter(A)

    ans = 0
    for k in C.keys():
        if k > C[k]:
            ans += C[k]
        else:
            ans += C[k] - k
    print(ans)


    
    

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
for r in {A.count(i) for i in range(1, N + 1)}:
    print(r)
# Judge status: Accepted

def resolve():
    ks = input().split(" ")
    k = int(ks[0])
    s = int(ks[1])

    n = 0

    for zz in range(k+1):
        for yy in range (k+1):
                if (0 <= s-(yy+zz) <= k):
                    n += 1

    print(n)

if __name__ == "__main__":
    resolve()
# Judge status: Accepted
a=[int(input()) for i in range(6)]
for i in range(5):
    for j in range(4):
        if abs(a[i]-a[j+1])>a[5]:
            print(":(")
            exit()
print("Yay!")
# Judge status: Wrong Answer
K, N = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
Ar = [i for i in A]
for i,a in enumerate(A):
    if K - a < a:
        Ar[i] = a - K
print(min(max(A) - min(A), max(Ar) - min(Ar)))
# Judge status: Accepted
n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
    x = 0
    while i < k:
        i *= 2
        x += 1
    ans += 1/n*(1/2)**x
print(ans)
# Judge status: Wrong Answer
s = int(input())
print(0,0,int(s**0.5),0,s//int(s**0.5),0)
# Judge status: Accepted
import collections

N = int(input())

l = list()
for i in range(N):
    l.append(int(input()))

c = collections.Counter(l)

la = list(c.values())
M = len(la)
ans = 0
for i in range(M):
    if la[i] % 2 == 1:
        ans += 1

print(ans)
# Judge status: Accepted
#A
A=int(input())
B=int(input())
K=[A,B]
for i in range(1,4):
    if not i in K:
        print(i)
# Judge status: Accepted
from itertools import permutations

S=input()
a,b,c="a","b","c"
D={a:0,b:0,c:0}

for s in S:
    D[s]+=1

X=min(D.values())
Y=max(D.values())

if Y-X<=1:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
def collatz(n):
    if n%2==0:
        return int(n/2)
    else:
        return 3*n+1
    
a=int(input())
cnt=1
if a==1 or a==2:
    ans=cnt+3
else:
    while a !=4:
        a=collatz(a)
        cnt+=1
    ans=cnt+3  

print(ans)
# Judge status: Accepted
from collections import Counter
N = int(input())
a = [int(i) for i in input().split()]

ans = 0
m = Counter(a)
for x, y in m.items():
    if x == y:
        continue
    elif x < y:
        ans += abs(y-x)
    else:
        ans += y
print(ans)
# Judge status: Wrong Answer
N=int(input())
A=[list((input().split())) for i in range(N)]
for num in range(N):
  A[num][1]=int(A[num][1])
for num in range(N):
  A[num].append(num+1)
from operator import itemgetter
A.sort(key=itemgetter(0,1))
for num in range(N):
  A[num].append(num+1)
A.sort(key=itemgetter(2))
for num in range(N):
  print(A[num][3])
# Judge status: Accepted
import collections
N = int(input())
# 社員番号1以外のN-1人分担当上司番号を入力する
A = list(map(int, input().split()))
# 出現回数を数えてくれる
count = collections.Counter(A)
for n in range(N):
#   数が足りないから+1する。
  print(count[n+1])
# Judge status: Accepted
N, K = list(map(int, input().split()))
s = input()

for i in range(N):
    if i != K-1:
        print(s[i], end='')
    else:
        print(str.swapcase(s[i]), end='')
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=sorted(A)[::-1]
cnt=1
a=0
C=[]
for i in B:
  if a==i:
    cnt+=1
    if cnt==2:
      cnt=0
      C.append(a)
    if len(C)==2:
      print(C[0]*C[1])
      exit()
  else:
    a=i
    cnt=1
print(0)
# Judge status: Accepted
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, C = il()
    print('Yes' if A <= C <= B else 'No')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
flag = False
for i in range(10000):
    if (i*b+c)%a==0:
        flag = True
        break
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
k=int(input())
a,b=map(int,input().split())

if a%k==0:
    print(("OK"))
else:
    if b//k-a//k>=1:
        print("OK")
    else:
        print("NG")
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print('Yes' if b - a == c - a else 'No')
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
ans = 1
X = []
for i in range(N):
  for j in range(i):
    if A[i] == ans:
      ans += 1
      X.append(i+1)
print(''.join(map(str,X)))
# Judge status: Accepted
A = list(map(int, input().split()))
A.sort()
if A[0] % 2 == 0 or A[1] % 2 == 0 or A[2] % 2 == 0:
  ans = 0
else:
  ans = A[0] * A[1]
print(ans)
# Judge status: Accepted
import numpy as np

W,H,N = map(int,input().split())
l = np.zeros((H,W)) #	要素0のH×W配列

for i in range(N):
  x,y,a = map(int,input().split())

  if a==1:
    l[:,:x] = 1
    #print(l[:,x:])
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
#print(H*W-int(l.sum().sum()))
print(H*W-int(l.sum()))
# Judge status: Wrong Answer
a = int(input())
s = 0
for i in range(1,a):
  s+=i
  if s>=a:
    print(i)
    break
# Judge status: Accepted
from heapq import heappop, heappush

k = int(input())

q = []

for i in range(9):
    heappush(q, i+1)

for _ in range(k - 1):
    x = heappop(q)
    if x % 10 != 0:
        heappush(q, 10 * x + (x % 10) - 1)
    if x % 10 != 9:
        heappush(q, 10 * x + (x % 10) + 1)
    heappush(q, 10 * x + (x % 10))

print(heappop(q))
# Judge status: Accepted
n,m = map(int,input().split())
L = [i for i in range(1,m+1)]
for j in range(n):
    l = list(map(int,input().split()))
    del l[0]
    L = set(l) & set(L)
print(len(L))
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
MOD = 10**9+7


def modcmb(n, k, mod):
    rtn = n
    for i in range(1, k):
        rtn = (rtn * (n-i) * pow(i+1, mod-2, mod)) % mod

    return rtn


ans = pow(2, n, MOD) - 1 - modcmb(n, a, MOD) - modcmb(n, b, MOD)
print(ans if ans >= 0 else ans + MOD)
# Judge status: Wrong Answer
a,b,c,d,e=map(int,input().split())

x=((c*60-d)-(a*60+b))-e

if x<0:
    x=x+1440
print(x)
# Judge status: Accepted
N=int(input())

P=list(map(int,input().split()))
Q=list(map(int,input().split()))

import itertools
itertools.permutations(P)
l=list(itertools.permutations(P))
l.sort()
P=tuple(P)
Q=tuple(Q)

p=l.index(P)
q=l.index(Q)

print(abs(p-q))
# Judge status: Accepted
print('YNeos'[input().replace('hi','')!=''::2])
# Judge status: Wrong Answer
n = int(input())
import itertools

a = [3,5,7,11]
ax = 3*5*7*11
b = []
for i in range(4):
    b.append(ax//a[i])
c = list(itertools.combinations([0, 1, 2, 3], 2))
for j in range(len(c)):
    b.append(a[c[j][0]]**3 * a[c[j][1]])

ans = 0
for i in b:
    if n >= i:
        ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
li = list(map(int, input().split()))

li.sort(reverse=True)

check = -1
flag = 0
ans = []

for i in li:
    if len(ans) == 2:
        break
    
    if flag == 0:
        check = i
        flag = 1
        continue
    
    if check == i:
        ans.append(i)
        flag = 0
    else:
        check = i

if len(ans) < 2:
    print(0)
else:
    print(ans[0] * ans[1])
# Judge status: Accepted
ss=['A','G','C','T']
s=list(input())
ans=0
for i in range(len(s)):
  if s[i] in ss:
    j=i
    cnt=0
    while j<len(s):
      if s[j] in ss:
        cnt+=1
        j+=1
      else:
        break
      
    ans=max(ans,cnt)
      
print(ans)
# Judge status: Accepted
def main():
  k = int(input())
  num = 7 % k
  first = num
  ans = 1
  while num != 0:
    ans += 1
    num = (num*10 + 7)%k
    if num == first or ans > 2000000:
      ans = -1
      break
  print(ans)
    
    
if __name__ == "__main__":
  main()
# Judge status: Accepted
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    s=str(i)
    t=0
    for ss in s:
        t+=int(ss)
    if a<=t<=b:
        ans+=int(i)
print(ans)
# Judge status: Accepted
h = int(input())
w = int(input())
n = int(input())
a = max(h,w)
b = a
count = 0
if h*w == n:
  print(h)
elif b >= n:
  print(1)
else:
 while b*count < n:
   count += 1
 print(count)
# Judge status: Accepted
# Bingo
A = []
for _ in range(3):
    A += list(map(int, input().split()))
N = int(input())
for _ in range(N):
    b = int(input())
    if b in A:
        A[A.index(b)] = -1
        
# check
diag = (sum(A[0::4]) == -3) | (sum(A[2:8:2]) == -3)
rows = (sum(A[:3]) == -3) | (sum(A[3:6]) == -3) | (sum(A[6:]) == -3)
cols = (sum(A[:7:3]) == -3) | (sum(A[1:8:3]) == -3) | (sum(A[2::3]) == -3)
ans = diag | rows | cols
print(['No', 'Yes'][ans])
# Judge status: Accepted
N, D = map(int, input().split())
X = [0]*N
Y = [0]*N
for i in range(N):
    X[i], Y[i] = map(int, input().split())

count = 0
D2 = D**2

for i in range(N):
    temp = X[i]**2 + Y[i]**2
    if temp<=D2:
        count += 1

print(count)
# Judge status: Accepted
a = {'Sunny':'Cloudy', 'Cloudy':'Rainy', 'Rainy':'Sunny'}
print(a[input()])
# Judge status: Accepted
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


N, T = map(int, input().split())
a = 10000
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        a = min(a, c)
if a == 10000:
    print('TLE')
else:
    print(a)
# Judge status: Wrong Answer
n = int(input())

s = []

for i in range(n):
    s.append(int(input()))

s = sorted(s)

total = 0
for i in range(n):
    total += s[i]

i = 0
while total > 0 and total%10 == 0:
    total -= s[i]
    i += 1

print(total)
# Judge status: Wrong Answer
import numpy as np

N = int(input())

count = 0
for i in range(1, (N+1)//2+1):
  count += int(np.ceil((N+1)/i)) * (N - (N)%i) // 2 


print(count)
# Judge status: Accepted
h, m, h2, m2, k = map(int, input().split())
ans = (h2 * 60 + m2) - (h * 60 + m) - k
print(ans)
# Judge status: Accepted
n = int(input())
d = len(str(n))
n_sum = 0
for i in range(d):
    n_sum += int(str(n)[i])
def judge(n):
    for i in range(1, len(n)):
        if n[i] != "9":
            return True
    return False
print(n // (10 ** (d - 1)) - 1 + 9 * (d - 1) if judge(str(n))  else n_sum)
# Judge status: Accepted
n, m, x = map(int, input().split())
ca_list = [[int(i) for i in input().split()] for _ in range(n)]
ans = 999999999999999
flag = 0

for i in range(2**n):
  bin_str = format(i, '0'+str(n)+'b')
  skill_list = [0]*m
  cost = 0
  for j, ca in enumerate(ca_list):
    if bin_str[j] == "1":
      cost += ca[0]
      for k in range(m):
        skill_list[k] += ca[k+1]
  if all([i >= x for i in skill_list]):
    ans = min(ans, cost)
    flag = 1
print(ans if flag == 1 else -1)
# Judge status: Accepted
N,K = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
total = 0

for i in range(K):
  total += p[i]

print(total)
# Judge status: Wrong Answer
k=int(input().split(" ")[0])
a = list(map(lambda x: int(x), input().split("\n")[0].split(" ")))
df = max(a) - min(a)
print(min(df, k - df))
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(n)]

maximum = max(a)
ans = [maximum]*n
if a.count(maximum) ==1:
    maximum_index = a.index(maximum)
    ans[maximum_index] = max(
        a[:maximum_index]+a[maximum_index+1:]
    )
for i in range(n):
    print(ans[i])