peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
W, H, N = [int(i) for i in input().split()]

xya = []

for _ in range(N):
    xya.append([int(i) for i in input().split()])

xmin = 1
ymin = 1
xmax = W
ymax = H

for i in xya:
    if i[2] == 1:
        xmin = min(xmin, i[0])
    elif i[2] == 2:
        xmax = max(xmax, i[0])
    elif i[2] == 3:
        ymin = min(ymin, i[1])
    else:
        ymax = max(ymax, i[1])

s = (xmax - xmin) * (ymax - ymin)

if s > 0:
    print(s)
else:
    print(0)
# Judge status: Wrong Answer
def judge_47(n):
    if n < 4:
        return False
    if 4 < n < 7:
        return False
    if n % 4 == 0 or n % 7 == 0:
        return True
    if n % 4 == 3:
        return (n - ((n // 4) - 1) * 4) % 7 == 0
    if n % 4 < 3:
        return (n - ((n // 4) - 2) * 4) % 7 == 0


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

    if judge_47(n):
        print('Yes')
    else:
        print('No')



if __name__ == '__main__':
    main()
# Judge status: Accepted
#!/usr/bin/env python3

def main():
    di = {"Sunny": "Cloudy",
        "Cloudy": "Rainy",
        "Rainy": "Sunny"}
    print(di[input()])

if __name__ == "__main__":
    main()
# Judge status: Accepted
K = int(input())
A,B = map(int, input().split())
str = "NG"
for i in range(A, B+1):
    if i % K == 0:
        str = "OK"
print(str)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if 2 * a**0.5 * b**0.5 < c-a-b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def match(y, x):
    ret = True
    for i in range(M):
        for j in range(M):
            if A[y + i][x + j] != B[i][j]:
                ret = False
    return ret
N, M = map(int, input().split())
A = []
for i in range(N):
    A.append(list(input()))
B = []
for i in range(M):
    B.append(list(input()))
flg = False
for i in range(N - M + 1):
    for j in range(N - M + 1):
        if match(i, j):
            flg = True
print("Yes" if flg else "No")
# Judge status: Wrong Answer
import sys
import fractions
from functools import reduce
from copy import copy
input = sys.stdin.readline

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int,input().split()))
ans = gcd_list(a)

for i in range(n):
    l = copy(a)
    l.pop(i)
    if ans < gcd_list(l):
        ans = gcd_list(l)
        break

print(ans)
# Judge status: Accepted
A, B = map(int, input().split())
S = list(input())

for i in range(len(S)):
    if i <= A-1:
        if S[i] not in [str(i) for i in range(10)]:
            print('No')
            exit()
    if i == A:
        if S[i] != '-':
            print('No')
            exit()
    else:
        if S[i] not in [str(i) for i in range(10)]:
            print('No')
            exit()

print('Yes')
# Judge status: Wrong Answer
n,k = map(int,input().split())
p = list(map(int,input().split()))
max=0
sump=0
mxpst=0
ans=0
for i in range(k):
    max+=p[i]
sump=max
for i in range(n-k):
    sump=p[i+k]+max-p[i]
    if sump>max:
        max=sump
        mxpst=i+1
for i in range(k):
    for j in range(1,p[mxpst+i]+1):
        ans+=j/p[mxpst+i]
print(ans)
# Judge status: Wrong Answer
# その19 ABC112 B - Time Limit Exceeded

N,T = map(int,input().split())
C = []
D = []

for i in range(N):
    A,B = map(int,input().split())
    C.append(A)
    D.append(B)
if min(D) > T:
    print('TLE')
else :
    F=[]
    for i in range(N):
        if min(D) == D[i]:
            F.append(C[i])
    print(min(F))
# Judge status: Wrong Answer
N = int(input())
n = N - 1
A = list(str(n))
A = list(int(n) for n in A)
ans1 = sum(A) + 1

n = N // 2
A = list(str(n))
A = list(int(n) for n in A)
ans2 = 2 * sum(A)

ans = min(ans1, ans2)

print(ans)
# Judge status: Accepted
# https://takeg.hatenadiary.jp/entry/2019/11/22/212816
# https://drken1215.hatenablog.com/entry/2019/10/20/032700

import bisect

N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0

for a in range(N):
    for b in range(a+1, N):
        c = bisect.bisect_left(L, L[a] + L[b])
        # print(a, b, c)
        ans += max(c-(b+1), 0)
        # print(ans)

print(ans)
# Judge status: Accepted
S = list(input())

if len(S) != len(set(S)): print('no')
else: print('yes')
# Judge status: Accepted
s=input()
t=input()
s+=s
print("Yes" if t in s else "No")
# Judge status: Accepted
n = int(input())
s = input()
num = []
#Aは６５番,Zは90番
for i in s:
    num.append(ord(i))

for i in range(len(num)):
    if num[i]+n>90:
        num[i] = chr(num[i]+n-90+64)
    else:
        num[i] = chr(num[i]+n)
a = ""
for i in num:
    a += i
print(a)
# Judge status: Accepted
n, x, *a = map(int, open(c:=0).read().split())
for i in range(n - 1):
    s = max(a[i] + a[i + 1] - x, 0)
    a[i + 1] -= s
    if a[i + 1] < 0:
        a[i] += a[i + 1]
        a[i + 1] = 0
    c += s
print(c)
# Judge status: Accepted
n = int(input())
s = input()

ans = float('inf')
w_left = [0]
e_right = [0]*n

for i in range(1,n):
  if s[i-1] == 'W':
    w_left.append(w_left[i-1]+1)
  else :
    w_left.append(w_left[i-1])
      
for i in range(1,n):
  if s[n-i] == 'E':
    e_right[n-i-1] = e_right[n-i]+1
  else :
    e_right[n-i-1] = e_right[n-i]

for i in range(n):
    ans = min(ans , w_left[i]+e_right[i])
print(ans)
# Judge status: Accepted
N=int(input())
if(N%2==1):
  print(N//2+1)
else:
  print(N//2)
# Judge status: Accepted
S=input()
a=int(S[:2])
b=int(S[2:])
if 1<=a<=12 and 1<=b<=12:
  print("AMBIGUOUS")
elif 1<=a<=12:
  print("MMYY")
elif 1<=b<=12:
  print("YYMM")
else:
  print("NA")
# Judge status: Accepted
MOD = 10 ** 9 + 7
s = int(input())

if s == 0 or s == 1:
    print(0)
else:
    ans = [1, 0, 0]
    for i in range(3, s + 1):
        ans.append(ans[i - 1] + ans[i - 3])
    print(ans[-1] % MOD)
# Judge status: Wrong Answer
def abc166_c():
  n, m = map(int, input().split())
  H = list(map(int, input().split()))
  path = dict([(i, []) for i in range(n)])
  for _ in range(m):
    a, b = map(int, input().split())
    path[a-1].append(b-1)
    path[b-1].append(a-1)

  ans = 0
  for i in range(n):
    my_h = H[i-1]
    if len(path[i]) == 0:
      ans += 1
    else:
      adj_h = [H[j] for j in path[i]]
      if my_h > max(adj_h):
        ans += 1

  print(ans)

abc166_c()
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1,n+1):
    if i > n:
        break
    ans += n//i
    if n//i * i == n:
        ans -= 1
print(ans)
# Judge status: Accepted
N, A, B = map(int, open(0).read().split())

MOD = 10 ** 9 + 7

def comb(n, k):
    ret = 1
    for i in range(1, k + 1):
        ret = ret * (n - i + 1) % MOD        
        ret = ret * pow(i, MOD - 2, MOD) % MOD

    return ret

print((pow(2, N, MOD) - 1 - comb(N, A) - comb(N, B)) % MOD)
# Judge status: Wrong Answer
from math import floor,ceil
X = input()
X = int(X)
cash = 100
count = 0
while cash <= X:
    cash*=1.01
    count += 1
print(count)
# Judge status: Accepted
# coding: utf-8
A, B = map(int, input().split())
if (A > B and B != 1) or (A == 1 and B != 1):
    print('Alice')
elif A == B:
    print('Draw')
else:
    print('Bob')
# Judge status: Accepted
import numpy

n,k = map(int,input().split())
li = [(int(x)*(int(x)+1))/(2*int(x)) for x in input().split()]
a = numpy.cumsum(li)
ans = 0
for i in range(n-k+1):
    if i == 0:
        ans = a[i+k-1]
    else:
        if ans < (a[i+k-1] - a[i-1]):
            ans = a[i+k-1] - a[i-1]
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
ans = s.count('R') * s.count('G') * s.count('B')
for i in range(n-2):
  for j in range(i+1, n-1):
    if j - i > n - j - 1:
      break
    if s[i] != s[j] and s[j] != s[2*j-i] and s[2*j-i] != s[i]:
      ans -= 1
print(ans)
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))

for i in range(len(H)-2, -1, -1):
    if H[i] - H[i+1] == 1:
        H[i] -= 1
    elif  H[i] - H[i+1] >= 2:
        print("No")
        exit()
    else:
        continue

print("Yes")
# Judge status: Accepted
#C
N = int(input())
memo = {}
max_word = 1
for i in range(N):
    Si = input()
    try:
        memo[Si] += 1
        max_word = max(max_word, memo[Si])
    except:
        memo[Si] = 1
        
keys = [k for k, v in memo.items() if v == max_word]
keys.sort()
for item in keys:
  print(item)
# Judge status: Accepted
n = int(input())
P = list(map(int,input().split()))

cnt = 0
for i in range(1,n-1):
    if min(P[i-1],P[i],P[i+1]) < P[i] and max(P[i-1],P[i],P[i+1]) > P[i]:
        cnt += 1

print(cnt)
# Judge status: Accepted
S = input()
if int(S[:2]) != 0 and int(S[:2]) <= 12:
  if int(S[2:]) != 0 and int(S[2:]) <= 12: print("AMBIGUOUS")
  else:print("MMYY")
else:
  if int(S[2:]) != 0 and int(S[2:]) <= 12: print("YYMM")
  else:print("NA")
# Judge status: Accepted
n=int(input())
s=input()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b
for i in range(n):
    for j in range(n):
        if i+j+j>=n:
            break
        s1=s[i]
        s2=s[i+j]
        s3=s[i+j*2]
        if s1!=s2 and s2!=s3 and s1!=s3:
            ans-=1
print(ans)
# Judge status: Wrong Answer
n = int(input())
for i in range(n):
  for j in range(n):
    if 3*i+7*j == n:
      print('Yes')
    else:
      print('No')
# Judge status: Accepted
import math

A, B, H, M = map(int, input().split())

KA = H / 12 * 360 + ((M / 60) * (360 / 12))
KB = M / 60 * 360

K = abs(KA - KB)
if K > 180:
    K = 360 - K
# if K == 180:
#     print(A + B)
#     exit()
# if K == 0:
#     print(abs(B - A))
#     exit()
cosB = round(math.cos(math.radians(K)), 13)
cc = A ** 2 + B ** 2 - (2 * B * A * cosB)
print(math.sqrt(cc))
# Judge status: Accepted
a, b = map(int, input().split())
print("Possible" if a % 3 == 0 or b % 3 == 0 or (a+b)%3 == 0 else "Impossible")
# Judge status: Wrong Answer
x_s, y_s, x_t, y_t = map(int, input().split())
dist_x, dist_y = x_t - x_s, y_t - y_s

ans = ""
ans += ("R" * dist_x)
ans += ("U" * dist_y)
ans += ("L" * dist_x)
ans += ("D" * dist_y)
ans += "U"
ans += ("R" * (dist_x + 1))
ans += ("U" * (dist_y + 1))
ans += "LL"
ans += ("L" * (dist_x + 1))
ans += ("D" * (dist_y + 1))
ans += "R"

print(ans)
# Judge status: Wrong Answer
D  = int(input())
print("Christmas"+" Eve"*(D-25))
# Judge status: Wrong Answer
h, attack = map(int, input().split())
if h%attack != 0:
  ans = h//attack + 1
else:
  ans = h/attack
  
print(ans)
# Judge status: Accepted
s = int(input())
count = 0

for i in range(s):
  dice1, dice2 = map(int, input().split())
  if dice1 == dice2:
    count += 1
    if count >= 3:
      print("Yes")
      break
  else:
    count = 0
else:
  print("No")
# Judge status: Wrong Answer
n, m, k = map(int, input().split())

for i in range(1, n + 1):
    for j in range(1, m + 1):
        if i * (m - j) + (n - i) * j == k:
            print('Yes')
            exit()
print('No')
# Judge status: Wrong Answer
s = input()
print("Heisei" if s<"2019/04/30" else "TBD")
# Judge status: Accepted
x, y = map(int, input().split())
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]

flag = False
if x in group1 and y in group1:
    flag = True
elif x in group2 and y in group2:
    flag = True
    
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, t = map(int, input().split())
INF = 10**10
min_c = 10**10
for _ in range(n):
    ci, ti = map(int, input().split())
    if ti > t:
        continue
    min_c = min(ci, min_c)
if min_c == INF:
    print('TLE')
    exit()
print(min_c)
# Judge status: Accepted
n, t = map(int, input().split())
cost = 10**4
for _ in range(n):
    c, tt = map(int, input().split())
    if tt <= t:
        cost = min(cost, c)
print('TLE') if cost == 10**4 else print(cost)
# Judge status: Accepted
x=int(input())
for i in range(1001):
  for j in range(100*i,105*i+1):
    if x==j:
      print(1)
      exit(0)
print(0)
# Judge status: Wrong Answer
S = input()

#print(len(S))
flag= 0
for i in range(len(S)):
	#print(i,S[i])
	if i % 2 == 0:
		if S[i] != "L" and S[i] != "U" and  S[i] != "D":
			#print(i,S[i])
			flag = 1
	elif i % 2 !=0:
		if S[i] != "R" and S[i] != "U" and  S[i] != "D":
			#print(i,S[i])
			flag = 1

if flag == 0:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
import bisect
n = int(input())
h = list(map(int, input().split()))
ans = 0
i = 0
lmax = 0
while i < n:
    if i+1 < n and h[i] >= h[i+1]:
        lmax+=1
        ans = max(ans, lmax)
    else:
        lmax = 0
    i+=1
print(ans)
# Judge status: Accepted
A,B=map(int,input().split())
socket=1
tap=0

while socket<B:
    socket+=A-1
    tap+=1
    
print(tap)
# Judge status: Accepted
import sys

def main():
    k = input().replace('\n','').split()
    a = input().replace('\n','').split()
    u = input().replace('\n','')
    a[k.index(u)]=int(a[k.index(u)]) - 1
    print(str(a[0]) + ' ' + str(a[1]))
if __name__ == '__main__':
    input = sys.stdin.readline
    main()
# Judge status: Accepted
S = input()

A = [-1, ] * (len(S) + 1)
cnt = 0
for i in range(0, len(S)):
    if S[i] == '<':
        A[i] = cnt
        cnt += 1
        A[i + 1] = cnt
    else:
        cnt = 0

cnt = 0
for i in range(len(S) - 1, -1, -1):
    if S[i] == '>':
        A[i + 1] = cnt
        cnt += 1
        A[i] = max(cnt, A[i])
    else:
        cnt = 0

print(sum(A))
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
ans = 0
for k, v in counter.items():
    if 2 <= v:
        ans += v * (v - 1) // 2
for a in A:
    if a in counter and 2 <= counter[a]:
        v = counter[a]
        diff = v * (v - 1) // 2 - ((v- 1) * (v - 2) // 2)
        print(ans - diff)
    else:
        print(0)
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
rec = []
for p in range(1,101):
    s = 0
    for i in x:
        s += (i-p)**2
    rec.append(s)
rec.sort()
print(rec[0])
# Judge status: Accepted
N = int(input())
S = list(input())
r,g,b = 0,0,0
k = 0
buf = 0

for i in range(N) :
    if S[i] == 'R' :
        r += 1
    elif S[i] == 'G' :
        g += 1
    else :
        b += 1

for j in range(N) :
    for i in range(j) :
        k = 2 * j - i
        if k <= N-1 :
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k] :
                buf += 1

print(r*g*b - buf)
# Judge status: Wrong Answer
import collections
n = int(input())
l =[]
for i in range(n):
    t = input()
    l.append(t)
d = collections.Counter(l)
m = max(d.values())
for k,v in d.items():
    if v == m:
        print(k)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

lst = [0] * 8
s = 0

for i in a:
    if i >= 3200:
        s += 1
    else:
        i //= 400
        lst[i] += 1

colour = 0
for i in lst:
    if i >= 1:
        colour += 1

m = max(1, colour)
M = colour + s

print(m, M)
# Judge status: Accepted
n = int(input())
if n==0:
    print('0')
    exit(0)
i = 1
s = []
while n!=0:
    if n%2**i>0:
        s.append('1')
        n -= (-2)**(i-1)
    else:
        s.append('0')
    i += 1
print(''.join(s[::-1]))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n):
    ans += a[-(i+1)*2]
print(ans)
# Judge status: Accepted
A,B,K = (int(x) for x in input().split())

if A > K:
  print(A-K,B)
  
elif A+B>K:
  print(0,B-K+A)
else:
  print(0,0)
# Judge status: Accepted
H = int(input())

def f(n):
    if n == 1:
        return 1
    else:
        return 2*f(int(n//2)) + 1

print(f(H))
# Judge status: Accepted
n, k = map(int, input().split())
p = list(map(int, input().split()))
def expect(a):
  return 0.5 * (a+1)

total = 0
for i in range(k):
  total += expect(p[i])

r = [total]

for j in range(n-k):
  total = total-expect(p[j])+expect(p[j+k])
  r.append(total)

print(max(r))
# Judge status: Wrong Answer
x = int(input())
for i in range(x, 2*x):
  n = 0
  if i % 2 == 0:
    pass
  else:
    for j in range(2, i+1):
      if i % j == 0:
        n += 1
  if n == 1:
    print(i)
    break
# Judge status: Wrong Answer
N,M = map(int,input().split())

ds = set()
n = 1
while n*n <= M:
    if M%n==0:
        ds.add(n)
        ds.add(M//n)
    n += 1

ans = 1
for d in ds:
    if d <= N:
        ans = max(ans, d)
print(ans)
# Judge status: Accepted
x = int(input())
print(int(not x))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
cnt1=0#奇数
cnt2=0#2で一回割れる。隣り合うと4の倍数
cnt4=0#4で一回割れる。隣がなんでも4の倍数
for i in range(n):
  if a[i]%2==1:
    cnt1+=1
  elif format(a[i], 'b')[::-1].find('1')==1:
    cnt2+=1
  else:
    cnt4+=1

if cnt2>=2:
  print('Yes') if cnt4>=(n-cnt2%2)//2 else print('No')

else:
  print('Yes') if cnt4>=n//2 else print('No')
# Judge status: Accepted
import sys
 
def LI():
  return [int(s) for s in input().split()]
 
N,M = LI()

check = {}
 
for i in range(M):
  s,c = LI()
  if N >= 2 and s == 1 and c == 0:
    print(-1)
    sys.exit()
  
  if s in check.keys():
    if check[s] != c:
      print(-1)
      sys.exit()
      
  check[s] = c

answer = ['0']*N
if len(answer) > 1:
	answer[0] = '1'

for s,c in check.items():
  answer[s-1] = str(c)

print(int(''.join(answer)))
# Judge status: Wrong Answer
icase=0    
if icase==0:
    a,b,c=map(int,input().split())
    if a<=c and c<=b:
        print("YES")
    else:
        print("NO")
# Judge status: Accepted
n,k = map(int,input().split())
p = list(map(int,input().split()))

pp = list(map(lambda x:(x+1)/2,p))

p_rui = [pp[0]]
for i in range(1,n):
    p_rui.append(p_rui[i-1]+pp[i])



walist=[p_rui[k-1]]
for i in range(0,n-k):
    walist += [p_rui[k+i]-p_rui[i]]

print(max(walist))
# Judge status: Accepted
N,K = map(int,input().split())
S = input()

score = 0
for i in range(N-1):
  if S[i] == S[i+1]: score += 1

ans = min(score+2*K, N-1)
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())

n=b-a
ans=n*(n-1)//2-a

print(ans)
# Judge status: Wrong Answer
D, N = map(int, input().split())

if N < 100:
    ans = N * 100 ** D
else:
    ans = N * 100 ** D + 1
print(ans)
# Judge status: Accepted
def main():
    name = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    N = int(input())
    y = N
    ans = []
    for i in range(100):
        y -= 1
        x = y%26
        y = y//26
        ans.insert(0,name[x])
        if y == 0:
            break
    
    
    print(''.join(ans))
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
R = [0 for i in range(9)]
for i in range(n):
    if A[i] < 3200: R[A[i]//400] += 1
    else: R[8] += 1
mi = 0
for i in range(8):
    if R[i] > 0: mi += 1
if mi == 0 and R[8] > 0:
    print(mi+1, mi+R[8])
else:
    print(mi, mi+R[8])
# Judge status: Accepted
import re
S = input()
s = set(S)
m = re.findall(S[0],S)
m

if len(s) == 2:
    if len(m) == 2:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
a3=list(map(int,input().split()))
n=int(input())
a=a1+a2+a3
b=set([int(input()) for _ in range(n)])

c1=set(a[0::3])
c2=set(a[1::3])
c3=set(a[2::3])
c4=set([a1[0],a2[1],a3[2]])
c5=set([a1[2],a2[1],a3[0]])
c=[set(a1),set(a2),set(a3),c1,c2,c3,c4,c5]
j = any(len(b&x)==3 for x in c)
print('Yes' if j else 'No')
# Judge status: Accepted
import numpy as np

N = int(input())
N = bin(N)
x = len(str(N)) - 2

print(2 ** x - 1)
# Judge status: Wrong Answer
q,h,s,d = map(int,input().split())
n = int(input())
p = []
p.append([q*8,q,0.25])
p.append([h*4,h,0.5])
p.append([s*2,s,1])
p.append([d,d,2])
p.sort()
ans = 0

for i in range(4):
    if n%p[i][2] == 0:
        ans += n//p[i][2]*p[i][1]
        print(int(ans))
        exit()
    else:
        ans += n//p[i][2]*p[i][1]
        n %= p[i][2]
# Judge status: Wrong Answer
import sys
n = int(input())
a = [int(input()) for a in range(n)]
cnt = 1
a.insert(0,0)
sel = a[1]
for i in range(n+1):
	if a[sel] == 2:
		cnt += 1
		print(cnt)
		sys.exit()
	else:
		cnt += 1
		sel = a[sel]
print(-1)
# Judge status: Accepted
S={abc:list(input()) for abc in "abc"}
s="a"
while S[s]:
    s=S[s].pop(0)
print(s.upper())
# Judge status: Wrong Answer
n = ''
command = input()
for i in command:
  if i =="B":
    n=n[:-1]
  else:
    n+=i
print(n)
# Judge status: Wrong Answer
N=int(input())
l=[]
m=[]
while N>0:
    a=input()
    l.append(a)
    N-=1
M=int(input())
while M>0:
    b=input()
    m.append(b)
    M-=1
print(sorted(l))
print(sorted(m))
# Judge status: Accepted
N = int(input())
a=0
for i in range(N+1):
    a = a + i
print(a)
# Judge status: Accepted
h,w = map(int,input().split())
ans = (h*w)//2
if h%2 == 1 and w%2 == 1: ans += 1
if h == 1 or w == 1: ans = 1
print(ans)
# Judge status: Accepted
a,b,x = map(int,input().split())
print((b//x)-((a-1)//x))
# Judge status: Wrong Answer
n = int(input())

dp = [0] * (n + 1)

for i in range(n):
  if n >= i + 4:
    dp[i + 4] = dp[i] + 1
  if n >= i + 7:
    dp[i + 7] = dp[i] + 1
if dp[n] == 0:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
N = int(input())
C = list(input())

w = C[:N//2].count("W")

if N%2 == 0:
  r = C[N//2:].count("R")  
else:
  r = C[N//2+1:].count("R")
  
print(max(w,r))
# Judge status: Accepted
n, x, t = map(int, input().split())

if n % x == 0:
    print((n//x) * t)
else:
    print((n//x+1)*t)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

tmp = [0] * n
tmp2 = [0] * n
for i, j in enumerate(a):
    if i + j < n:
        tmp[i + j] += 1
    if 0 <= i - j:
        tmp2[i - j] += 1

cnt = 0
for i in range(n):
    cnt += tmp[i] * tmp2[i]
print(cnt)
# Judge status: Accepted
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()

L = [0]*(M-1)
for i in range(M-1):
    L[i] = X[i+1]-X[i]
L.sort(reverse=True)

print(X[M-1]-X[0]-sum(L[:N-1]))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

left = 0
right = 0
center = 0
sum_a = sum(a)
flg = False
for i in range(n):
    if left + a[i] > sum_a/2 and flg is False:
        flg = True
        center = a[i]
        right -= a[i]
    elif left + a[i] == sum_a // 2:
        print(0)
        exit()
    if flg is False:
        left += a[i]
    else:
        right += a[i]
print(left, center, right)

print(min(left+center-right, right+center-left))
# Judge status: Wrong Answer
n=int(input())
z=4
sumi=0
for i in range(n):
    a=list(map(int,input().split()))
    maxi=max(a)
    if z==a.index(maxi):
        a.pop(z)
        sumi=sumi+max(a)
        z=a.index(max(a))
    else:
        sumi=sumi+max(a)
        z = a.index(max(a))
print(sumi)
# Judge status: Wrong Answer
N = int(input())
AB = [list(map(int, input().split())) for i in range(N)][::-1]

ans = 0
for a, b in AB:
  ans += b - (a + ans) % b

print(ans)
# Judge status: Accepted
import sys
import math 
from collections import deque

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

a=[0]
b=[0]

for i in range(n):
    a.append(A[i]+a[i])
for i in range(m):
    b.append(B[i]+b[i])

ans,j=0,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)
# Judge status: Accepted
n,k,*a=map(int,open(0).read().split())
for _ in range(k):
  b=[0]*n
  for i,q in enumerate(a):
    b[max(0,i-q)]+=1
    if i+q+1<n:
      b[i+q+1]-=1
  for i in range(1,n):
    b[i]+=b[i-1]
  if a==b:
    break
  a=b[:]
print(*a)
# Judge status: Wrong Answer
x, k, d = map(int, input().split())

result = 0

firstNearestIterNum = x // d

if k < firstNearestIterNum:
	result = (abs(x) - abs(d * k))
else:
	if (k - firstNearestIterNum) % 2 == 1:
		result = (abs(x) - abs(d * (firstNearestIterNum + 1)))
	else:
		result = (abs(x) - abs(d * firstNearestIterNum))

print(abs(result))
# Judge status: Wrong Answer
X = int(input())
A = 2000 - X
if A % 200 == 0:
    print(str(A // 200) + "級") 
else:
    print(str(A // 200 + 1) + "級")
# Judge status: Accepted
s=list(input())
t=list(input())

c=0

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

print(c)
# Judge status: Wrong Answer
n,k = map(int,input().split())
h = [int(input()) for _ in range(n)]
h.sort()

ans = 10**9
for i in range(n-k):
    ans = min(ans,h[i+k-1]-h[i])
print(ans)
# Judge status: Accepted
n = int(input())

if n%2 != 0:
    print(0)
    exit(0)

num = 2*5
ans = 0

while n>=num:
    ans += n//num
    num *= 5

print(ans)