peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n,p = map(int, input().split())
a = list(map(int,input().split()))
if all(i%2==0 for i in a):
    print(0 if p==1 else 2**n)
else:
    print(2**(n-1))
# Judge status: Wrong Answer
s = input()
 
oddStep = ['R','U','D']
evenStep = ['L','U','D']
CNST_NO = 'No'
CNST_YES = 'Yes'
good_step = CNST_YES
 
for i in range( len( s )):
  if i % 2 == 0:
    if not ( s[ i ] in evenStep ):
      good_step = CNST_NO
  else:
    if not( s[ i ] in oddStep ):
      good_step = CNST_NO
  if good_step == CNST_NO:
    break
print( good_step )
# Judge status: Accepted
import fractions
A,B,C,D=map(int,input().split())
A-=1
E=C*D//fractions.gcd(C,D)
print(B-B//C-B//D+B//E-A+A//C+A//D-A//E)
# Judge status: Wrong Answer
n = int(input())
t, a = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

l = [abs(a-(12-i*0.006)) for i in h]
print(l.index(min(l))+1)
# Judge status: Accepted
a, b = map(int,input().split())
if a*b % 2 != 0:
  print('Odd')
else:
  print('Even')
# Judge status: Accepted
a,b,c = map(int,input().split())
k = int(input())
ans = a+b+c-max(a,b,c)
ans += max(a,b,c)*2**k
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    A, B, C, K=MI() 

    if K<=A:
        print(K)
    elif K>A and K<= A+B:
        print(A)
    elif K >= A + B:
        print(A -(K-A-B))

    


if __name__ == "__main__":
	main()
# Judge status: Accepted
n=int(input())
l=[0]*n
for i in range(1,n):
  c,s,f=map(int,input().split())
  for j in range(i): l[j]=max(-(-l[j]//f)*f,s)+c
print(*l,sep='\n')
# Judge status: Wrong Answer
S = list(input())

s = set(S)

if len(s) == len(S):
    print("yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
cnt4,cnt2=0,0
for i in a:
    if i % 4 == 0:
        cnt4 += 1
    elif i % 2 == 0:
        cnt2 += 1

cnt2 = max(1,cnt2)
print('Yes' if 2 * cnt4 + cnt2 >= n else 'No')
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    X = str(input())
    stack = 0
    pop = 0
    for i in range(len(X)):
        if X[i] == 'S':
            stack += 1
        elif X[i] == 'T' and stack > 0:
            pop += 1
            stack -= 1
    print(len(X)-pop*2)

resolve()
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))
cnt = 0

while True:
    cnt += 1
    tmp = ((K - 1) * cnt) + 1
    if N <= tmp:
        break
print(cnt)
# Judge status: Wrong Answer
import math
radius = int(input())
answer = math.pi * radius * radius
print(answer)
# Judge status: Accepted
#! /usr/bin/env python3

import sys
import numpy as np
from itertools import combinations
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, P, *A, = map(int, read().split())

n_odd = 0
n_even = 0
for a in A:
    if a % 2 == 0:
        n_even += 1
    else:
        n_odd += 1

if n_even == N:
    if P == 0:
        print(pow(2, N))
    else:
        print(0)
else:
    print(pow(2, (N - 1)))
# Judge status: Accepted
N = int(input())
x = list(map(int, input().split()))
hp_list = [sum([(xx-p)**2 for xx in x]) for p in range(min(x), max(x)+1)]
print(min(hp_list))
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

c1, c2 = [list(readline().decode().rstrip()) for _ in range(2)]
ans = 'YES' if c1 == c2[::-1] and c2 == c1[::-1] else 'NO'
print(ans)
# Judge status: Accepted
a,b = [int(x) for x in input().split()]

if a == b:
    print("Draw")
elif a == 1:
    print("Alice")
elif b == 1:
    print("Bob")
elif a > b:
    print("Alice")
else:
    print("Bob")
# Judge status: Accepted
# -*- coding : utf-8 -*-

S = str(input())

w = ""

for i in range(len(S)) :
  if S[i] == "B" :
    if w == "":
      w = ""
    else :
      w = w[:-1]
  else :
    w = w + S[i]
    
print(w)
# Judge status: Accepted
a,b=input().split()
x=int(a)*10**len(b)+int(b)

for i in range(0,1000):
    if i*i==x:
        print("Yes")
        break
else:
    print("No")
# Judge status: Accepted
S = input()
T = input()

N = len(S)
M = len(T)
ans = M
for i in range(N-M+1):
    cnt = 0
    for j in range(M):
        if T[j] != S[i:i+M][j]:
            cnt += 1
    ans = min(ans, cnt)

print(ans)
# Judge status: Accepted
from fractions import gcd
from functools import reduce

def main():
    def lcm(x, y):
        return x * y // gcd(x, y)

    n = int(input())
    a = list(map(int, input().split()))
    mod = 10 ** 9 + 7
    x = reduce(lcm, a)
    print(sum(x // i for i in a) % mod)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())

for i in range(n//7+1):
    if (n-i*7) % 4 == 0:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
n,m = map(int, input().split())

wc = [0 for i in range(n)]
ac = [0 for i in range(n)]

n_wc = 0
n_ac = 0

for i in range(m):
    num,j = input().split()
    num = int(num)

    if j == 'AC' and ac[num-1] == 0:
        n_ac += 1
        ac[num-1] = 1
        n_wc += wc[num-1]
    else:
        wc[num-1] += 1

print(n_ac,n_wc)
# Judge status: Accepted
import numpy as np


n = int(input())
a = list(map(int, input().split()))
a = np.array(a, int)
count = 0
while True:
    if not (a%2).any():
        a //= 2
        count += 1
    else:
        break
print(count)
# Judge status: Accepted
# -*- coding: utf-8 -*-
N = int(input())
S = input()
x = 0
maxx = 0
for c in S:
    x += [-1, 1][c == 'I']
    maxx = max(maxx, x)

print(maxx)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = list(set(a))
import collections

c = collections.Counter(a)
g = []
for i in range(len(b)):
    if c[b[i]] >= 2:
        g.append(b[i])
if len(g) <=1:
    print(0)
else:
    g = sorted(g,reverse = True)
    print(g[0]*g[1])
# Judge status: Accepted
a = list(map(int,input().split()))
 
if 500*a[0] >= a[1]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import numpy as np
N,K=map(int,input().split())
A=list(map(int,input().split()))
B=np.zeros(N)
for i in A:
  B[i-1]+=1
C=sorted([i for i in B if i != 0])
ans=0
for i in range(len(C)-K):
  ans+=C[i]
# Judge status: Accepted
D = int(input())
for i in range(D):
    print(i%26+1)
# Judge status: Accepted
def f(a):
	r = []
	for d in range(1,int(a ** 0.5) + 1):
		if a % d == 0:
			r.append(d)	
			if d * d != a: r.append(a/d)
	return r if r else [1]
a,b,k = map(int, raw_input().split(' '))
r = []
for d in f(a):
	if d in f(b):
		r.append(d)

r.sort()

print r[-k]
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
ans = 0
maxh = 0
for i in range(len(a)-1):
    if a[i] > a[i+1]:
        if maxh < a[i]:
            maxh = a[i]
        ans += maxh - a[i+1]


print(ans)
# Judge status: Wrong Answer
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, *H = map(int, read().split())
dp = [INF] * N
dp[0] = 0

for i in range(0, N-2):
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(H[i] - H[i + 1]))
    dp[i + 2] = min(dp[i + 2], dp[i] + abs(H[i] - H[i + 2]))

print(dp[N-1])
# Judge status: Wrong Answer
n=int(input())
i=0
while i*(i+1)//2<n:
  i+=1
no=n-i*(i+1)//2
for j in range(1,i+1):
  if j!=no:
    print(j)
# Judge status: Accepted
n=int(input())
print("{}".format((n+1)//2))
# Judge status: Accepted
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict


n=IN()
a=LI()
q=IN()
d=defaultdict(int)
for i in range(n):
    d[a[i]]+=1
s=sum(a)
for i in range(q):
    x,y=MAP()
    s+=(y-x)*d[x]
    d[y]+=d[x]
    d[x]=0
    print(s)
# Judge status: Accepted
s = input()
for i in range(len(s) - 1):
    print("x",end="")
print("x")
# Judge status: Accepted
def main():
    t = int(input())
    print(t * 2 * 3.14)

if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()

if S.endswith('s'):
    print(S + 'es')
else:
    print(S + 's')
# Judge status: Wrong Answer
k = int(input())
a = 7
for i in range(1, k):
    if a % k == 0:
        print(i)
        exit()
    a = (10 * a + 7) % k
print(-1)
# Judge status: Accepted
n,k=map(int,input().split())
p=list(map(int,input().split()))

tmp=0
for i in p[:k]:
    tmp+=(1+i)/2
li=[tmp]

for i in range(0,n-k):

    tmp=li[i]
    tmp-=(1+p[i])/2
    tmp+=(1+p[k+i])/2
    
    li.append(tmp)


print(max(li))
# Judge status: Wrong Answer
import sys
import math
import itertools

n=int(input())
if n==5 or n==7 or n==3 :
	print("Yes")
else :
	print("No")
# Judge status: Accepted
N,*A = map(int, open(0).read().split())
ans = 0
cum = 0
for i in range(N):
    if A[i] > 0:
        cum += A[i]
    else:
        ans += cum // 2
        cum = 0
print(ans+cum//2)
# Judge status: Accepted
S = input().strip()
print("2018"+S[4:])
# Judge status: Wrong Answer
a,b,c = map(int, input().split())
print("Yes" if min(a,b) < c and max(a,b) > c else "no")
# Judge status: Accepted
# input
L = int(input())

print((L / 3) ** 3)
# Judge status: Wrong Answer
x,y,ak,bk,ck = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort()

ab = a[:x]+b[:y]
ab.reverse()
j=0
for i in range(x+y):
    if ab[i] >= max(c):
        break
    while j <= ck-1:
        if c[j] > ab[i]:
            ab[i] = c[j]
            break
        j+=1

ans = sum(ab)
print(ans)
# Judge status: Accepted
a ,b, x = map(int,input().split())
if a <= x and (a + b) > x:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n = int(input())

print(800*n-(n//15)*200)
# Judge status: Accepted
A,B=map(int,input().split())

if A>9 or B>9:
  print(-1)
else:
  print(A*B)
# Judge status: Wrong Answer
N,P=map(int,input().split())
A=list(map(int,input().split()))

odd=0
even=0
for i in range(0,N):
    if A[i]%2==1:
        odd=odd+1
    else:
        even=even+1

print((2**(odd-1))*(2**(even)))
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a_gap = 0
b_gap = 0
for i in range(n):
    if A[i]>B[i]:
        a_gap+=A[i]-B[i]
    if A[i]<B[i]:
        b_gap+=(B[i]-A[i])//2

if b_gap-a_gap<0:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
S=str(input())
a=S.count('hi')
if a*2==len(S):
    print('Yes')
else:
    print("No")
# Judge status: Wrong Answer
from collections import defaultdict
from collections import deque
n , m = map(int , input().split())
g = defaultdict(list)
for i in range(m):
	u , v = map(int , input().split())
	g[u].append(v)
	g[v].append(u)
#print(g)
visited = [False]*(n+1)
a = [10**10]*(n+1)
q = deque()
q.append(1)
while q:
	node = q.popleft()
	visited[node] = True
	for ele in g[node]:
		if not visited[ele]:
			if a[ele] != 10**10: 
				continue
			a[ele] = node
			q.append(ele)
#print(ans)
#print(a)
print("YES")
for i in a[2:]:
	print(i)
# Judge status: Wrong Answer
x = int(input())
rx = int(x**(1/2)) + 1
P = [2] + [2*i+1 for i in range(1, rx//2)]
while True:
    flag = True
    for i in P:
        if x % i == 0:
            flag = False
            break
    if flag:
        print(x)
        break
    P.append(int(x**(1/2))+2)
    x += 1
# Judge status: Accepted
def inputlist(): return [int(j) for j in input().split()]
N,X,T =inputlist()
a = (N//X) + int(N % X != 0)
print(a*T)
# Judge status: Accepted
x,y = map(int,input().split())
if x%y == 0:
  print(0)
else:
  print(1)
# Judge status: Accepted
n, k = map(int,input().split())
i = 1
while n >= k:
  n = n//k
  i += 1
print(i)
# Judge status: Accepted
import sys
input = sys.stdin.readline
n = int(input())
s = input().rstrip()
mod = 10**9+7

from collections import Counter
c = Counter(s)
ans = 0
for i in s:
  chk = 1
  for j,v in c.items():
    if j == i:
      continue
    chk *= v+1
  ans += chk
  ans %= mod
  c.update({i:-1})
  
print(ans%mod)
# Judge status: Wrong Answer
A=int(input())
sums=0
for i in range(1,4):
  sums += A**i
  print(sums)
print(sums)
# Judge status: Accepted

N = int(input())

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

ans = 1
q = []

for i,a in enumerate(A):

    if len(q) != 0 and ( (q[0] < q[-1] and q[-1] > a) or (q[0] > q[-1] and q[-1] < a) ):
        q = [a]
        ans += 1

    else:
        q.append(a)

print (ans)
# Judge status: Accepted
n = int(input())
SMs = []
for i in range(2, n // 2 + 2):
    SMs.append(sum(list(map(int, str(i)))) + sum(list(map(int, str(n-i)))))
print(min(SMs))
# Judge status: Wrong Answer
N, A, B, C, D = map(int, input().split())
S = input()


#%%
flag = True
# A -> Cの間に#が二連続するパターン
if '##' in S[A:C]:
    flag = False
# B -> Dの間に#が二連続するパターン
if '##' in S[B:D]:
    flag = False

# A, Bの位置交換が必要な時
if C > D:
    if '...' not in S[B-1:D+1]:
    # B,Dの間に連続する3つの'.'が必要
        flag = False

if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s,a=',036,048,246,258,345,678,',open(0).read().split()
for i in a[9:]:s=s.replace(str(a.index(i)),'')
print('NYoe s'[',,'in s::2])
# Judge status: Accepted
N, x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ans = 0
for a in A[:-1]:
    if a <= x:
        ans += 1
        x -= a
print(ans + 1 if A[-1] == x else ans)
# Judge status: Accepted
N = int(input())
ans = 1
inf = 10**9+7
for i in range(N):
  ans = (ans*(i+1))%inf
print(ans)
# Judge status: Wrong Answer
n, c, k = map(int, input().split())

t = [0] * n
for i in range(n):
    t[i] = int(input())
t = sorted(t)
ans = 0
i = 0
while i < n:
    j = 0
    while i + j < n and t[i + j] < t[i] + k and j < c:
        j += 1
    i += j
    ans += 1 
print(ans)
# Judge status: Accepted
x,y=map(int, input().split()) 

tmp=x
cnt=0
while(tmp<=y):
    cnt+=1
    tmp = tmp*2
print(cnt)
# Judge status: Accepted
#!/usr/bin python3
# -*- coding: utf-8 -*-

n, d = map(int, input().split())
dd = d*d
ret = 0
for _ in range(n):
    x, y = map(int,input().split())
    if x*x + y*y <= dd:
        ret += 1
print(ret)
# Judge status: Accepted
N = int(input())
P = [int(_) for _ in input().split()]
cnt = 0

for i in range(N):
    p = P[i]
    ni = (i + 1) % N
    if p == (i + 1):
        cnt += 1
        P[i], P[ni] = P[ni], P[i]

print(cnt)
# Judge status: Accepted
v = [0] * 100001
n, k = map(int, input().split())
for i in range(n):
  a, b = map(int, input().split())
  v[a] += b
s = 0
for i in range(100001):
  s += v[i]
  if s >= k:
    print(i)
    break
# Judge status: Wrong Answer
import math
import numpy as np
N, K=map(int, input().split())
if N>=K:
  p1=(N-K)/N
  klist=list(range(1,K))
else:
  p1=0
  klist=list(range(1,N+1))

def calc(x):
  y=math.ceil((np.log(K)-np.log(x))/np.log(2))
  p=((0.5)**y)
  
  return p

plist=list(map(calc, klist))
p2=sum(plist)/N
print(p2+p1)
# Judge status: Accepted
#create date: 2020-07-07 11:02

import sys
stdin = sys.stdin
from heapq import heapify, heappush, heappop

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    a = list()
    for _ in range(n):
        a.append(ni())
    b = sorted(a, reverse=True)
    amax = b[0]
    asec = b[1]
    for ai in a:
        if ai == amax:
            print(asec)
        else:
            print(amax)


if __name__ == "__main__":
    main()
# Judge status: Accepted
s = input()

dir = [0 for i in range(4)]
for i in range(len(s)):
    if s[i] == "N":
        dir[0] += 1
    elif s[i] == "W":
        dir[1] += 1
    elif s[i] == "S":
        dir[2] += 1
    elif s[i] == "E":
        dir[3] += 1

if 0 not in dir:
    print("Yes")
elif dir.count(0) == 3:
    print("No")
elif dir[0] == 0 and dir[2] == 0 or dir[1] == 0 and dir[3] == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
tmp1=N//7
tmp2=N//4
for i in range(tmp1+1):
  for j in range(tmp2+1):
    if i*7+j*4==N:
      print('Yes')
      exit()
print('No')
# Judge status: Accepted
v=[0 for i in range(100001)]
n=int(input())
ar=list(map(int,input().split()))
s=0
for i in ar:
    s+=i
    v[i]+=1
q=int(input())
for i in range(q):
    a,b=map(int,input().split())
    s-=a*v[a]
    s+=b*v[a]
    v[b]+=v[a]
    v[a]=0
    print(s)
# Judge status: Wrong Answer
a,b = map(int,input().split())
n = 100**a
print(n*b)
# Judge status: Accepted
A, B = map(int,input().split())
if A == 1:
    A = 14

if B == 1:
    B = 14

if A > B:
    print('Alice')
elif A < B:
    print('Bob')
elif A == B:
    print('Draw')
# Judge status: Wrong Answer
x,y=map(int,input().split())
if x*4>=y and y%2==0 and x*2<=y:print("是")
else:print("没有")
# Judge status: Wrong Answer
A,B = [int(s) for s in input().split()]

print('Yay!') if A <= 8 and B <= 8 else print(':)')
# Judge status: Accepted
n, *hh = map(int, open(0).read().split())

pre = hh[0]

tmp = 0

ans = 0

for h in hh[1:]:
    if pre>=h:
        tmp += 1
        ans = max(tmp, ans)
    else:
        tmp = 0
    pre = h

print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]

ans, buy = 0, 0
for i, j in sorted(a, key=lambda x:x[0]):
    tmp = min(m-buy, j)
    ans += tmp*i
    buy += tmp
    if buy == m: break

print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
S={}
for i in range(N):
  a,b=map(int,input().split())
  if a in S:
    S[a]+=b
  else:
    S[a]=b
T=sorted(S.items())
count=0
for i in range(len(T)):
  count+=T[i][1]
  if count>=K:
    print(T[i][0])
    break
# Judge status: Accepted
A,B,C = map(int,input().split())
a = "NO"

for n in range(10000):
  if n%A==0 and n%B==C:
    a = "YES"

print(a)
# Judge status: Accepted
n=int(input())
x=list(map(int,input().split()))
sorted_x=sorted(x)
min_m,max_m=sorted_x[n//2-1],sorted_x[n//2]

for i in range(n):
  if x[i]<=min_m:
    print(max_m)
  else:
    print(min_m)
# Judge status: Accepted
n, p = int(input()), list(map(int, input().split()))
px = sorted(p)
a = 0
for i in range(n):
  if p[i] != px[i]:
    a += 1
if a/2 <= 1:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n, a, b = map(int, input().split())
ans = max(0, (b - a) * (n - 2) + 1)
print(ans)
# Judge status: Accepted
N = int(input())
S = [input().split() for i in range(N)]
for i in range(N):
  S[i][1] = int(S[i][1])
  S[i][1] = S[i][1]*-1
  S[i].append(int(i+1))
S.sort()
for i in range(N):
  print(S[i][2])
# Judge status: Accepted
n = int(raw_input())
a = [int(x) for x in raw_input().split()]
q = int(raw_input())
op = []
for _ in xrange(q):
    v = raw_input().split()
    op.append([int(x) for x in v])

d = {}
total = 0
for v in a:
    d[v] = d.get(v, 0) + 1
    total += v

for src, dest in op:
    c = d.pop(src, 0)
    d[dest] = d.get(dest, 0) + c
    total += c * (dest - src)
    print total
# Judge status: Accepted
l = [int(x) for x in input().split(' ')]
if abs(l[0]-l[1]) < abs(l[0]-l[2]):
  print('A')
else:
  print('B')
# Judge status: Wrong Answer
N = int(input())
lArr = list(map(int, input().split(" ")))
lArr.sort()

ans = 0

for i in range(N):
  for j in range(i + 1, N):
    for k in range(j + 1, N):
      if lArr[i] != lArr[j] and lArr[i] != lArr[k]:
        if lArr[i] + lArr[j] > lArr[k]:
          ans += 1

print(ans)
# Judge status: Wrong Answer
from math import factorial as f


N, M = map(int, input().split())
broken = [int(input()) for _ in range(M)] + [N+1]
tmp = 0
ans = 1
FLG = True

for a in broken:
    if a == 1:
        tmp = a + 1
        continue
    if a == tmp:
        FLG = False
        break

    interval = a - tmp - 1
    ans *= sum(int(f(j)/(f(i)*f(j-i))) for i,j in enumerate(range(interval, (interval+1)//2 - 1, -1)))
    tmp = a + 1

if FLG:
    print(ans % 1000000007)
else:
    print(0)
# Judge status: Wrong Answer
n,x,t=map(int,input().split())
time=(n//x+1)*t
print(time)
# Judge status: Accepted
a, b = map(int, input().split())

ans = 0
for n in range(a, b+1):
    s = str(n)
    if (s[0] == s[-1]) and (s[1] == s[-2]):
        ans += 1
print(ans)
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))

index = A.index(1)  + 1

import math
ans = math.ceil((N - index) /(K-1) + (index-1)/(K-1))

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

tp=0
up=0

for i in range(n):
  if tp >= a+b:
    print('No')
  elif s[i]=='a':
    print('Yes')
    tp+=1
  elif s[i]=='b':
    if up < b:
      print('Yes')
      tp+=1
      up+=1
    else:
      print('No')
  else:
    print('No')
# Judge status: Wrong Answer
# C - Linear Approximation

N = int(input())
A = list(int(a) for a in input().split())


A_diff = []
b = 0
for i, a in enumerate(A, 1):
    tmp = a - i
    A_diff.append(tmp)
    b += tmp
b //= N

ans = 0
for a in A_diff:
    ans += abs(a - b)

print(ans)
# Judge status: Accepted
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
d = 0
count = 1
for li in l:
    d += li
    if d <= x:
        count += 1
print(count)
# Judge status: Accepted
s = list(input())
alpha = [chr(i) for i in range(97, 97+26)]

flag = True
if s[0] != "A" or (not "C" in s[2:-1]):
  flag = False
  
else:
  cin = s.index("C")
  for i in range(len(s)):
    if i == 0 or i == cin:
      continue

    if (not s[i] in alpha):
      flag = False
      break
    
print("AC" if flag else "WA")
# Judge status: Accepted
n, a, b = map(int, input().split())
# 偶奇一致
if a % 2 == b % 2:
    print((b - a) // 2)
else:
    # left = a - 1
    # right = n - b

    # if left > right:
    #     cnt = right + 1
    #     left = min(a + cnt, n)
    #     print((n - left) // 2 + cnt)
    # else:
    #     cnt = left + 1
    #     right = max(b - cnt, 1)
    #     print((right - 1) // 2 + cnt)

    print(min(a - 1, n - b) + 1 + (b - a - 1) // 2)
# Judge status: Accepted


s = input().split();
n = int(s[0])
k = int(s[1])

A= [0 for i in range(n)]
ans = n
for i in range(k):
	d = input() 
	d = int(d)
	a =  list(map(int, input().split()))
	
	for j in range(d):
		if A[a[j]-1]== 0:
			A[a[j]-1]=1
			ans = ans -1
		else:
			continue

print(ans)
# Judge status: Accepted
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
jc=[0]*n
for i in range(n):
    jc[i]+=i+1-a[i]
jcc=Counter(jc)
count=0
for j in range(n):
    count+=jcc[a[j]+j+1]
print(count)
# Judge status: Accepted
import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    print(n * (n - 1) // 2)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())

if N % 2:
    print(0)
    exit()

ans = 0
div = 10
while(div <= N):
    ans += N // div
    div *= 5
print(ans)
# Judge status: Wrong Answer
a, b, c, k = map(int, input().split())
if k <= a:
  print(k)
elif a < k and k - a <= b:
  print(a)
elif a == 0 and b ==0:
  print(-k)
elif k == 0:
  print(0)
else:
  print(k-c)
# Judge status: Wrong Answer
A, B = map(int, input().split())
count = 0
for i in range(B - A):
    letter = list(str(A+i))
    if letter[0]==letter[-1] and letter[1] == letter[-2]:
        count += 1
print(count)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
c=[a[i]-i-1 for i in range(n)]
cum_c=[0]*n
c.sort()
cum_c[0]=c[0]
for i in range(1,n):
  cum_c[i]=cum_c[i-1]+c[i]
ans=min(cum_c[n-1]-n*c[0],n*c[n-1]-cum_c[n-1])
for i in range(1,n):
  ans=min(ans,cum_c[n-1]-2*cum_c[i-1]+(2*i-n)*c[i-1])
  ans=min(ans,cum_c[n-1]-2*cum_c[i-1]+(2*i-n)*c[i])
print(ans)
# Judge status: Accepted
a=input()
b=[]
c=0
for i in range(len(a)):
  b.append(a[i])
b.sort()
for i in range(len(a)-1):
  if b[i]==b[i+1]:
    c=c+1
if c==0:
  print("yes")
else:
  print("no")