peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
s = input()
t = input()

for i in range(n):
    if s[i:] == t[:n-i]:
        print(n + i)
        exit()
else:
    print(n*2)
# Judge status: Wrong Answer
k,s = map(int,input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        z = s - x + y
        if 0<=z<=k:
            ans += 1
print(ans)
# Judge status: Accepted
abcd = list(input())
op = ['+', '-']

for op1 in op:
    for op2 in op:
        for op3 in op:
            formula = abcd[0] + op1 + abcd[1] + op2 + abcd[2] + op3 + abcd[3]
            if eval(formula) == 7:
                print(formula + '=7')
                exit()
# Judge status: Accepted
s=input()
l=len(s)
k=int(input())
z=''
for i in range(l):
  t=123-ord(s[i])
  if s[i]=='a':
    z+='a'
  elif t<=k:
    z+='a'
    k-=t
  else:
    z+=s[i]
v=ord(z[l-1])-97+k
z=z[:l-1]+chr(v%26+97)
print(z)
# Judge status: Wrong Answer
N,A,B=[int(i) for i in input().split()]

num_list=[]
for x in range(10):
    for y in range(10):
        num=10*x+y
        if 1<=num<=N and A<=(x+y)<=B:
            num_list.append(num)

print(sum(num_list))
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))

count = 0
for i in range(N):
    if P[i] != i + 1:
        count += count + 1
    if count > 2:
        print('No')
        exit()

print('Yes')
# Judge status: Accepted
N=int(input())
a=[]
for i in range(N):
    a.append(input())
a_uni=list(set(a))
print(len(a_uni))
# Judge status: Accepted
N,A,B=map(int,input().split())
div=N//(A+B)
mod=N%(A+B)
print(div*A+min(mod,A))
# Judge status: Accepted
a,b,k = map(int,input().split())
l= []
for i in range(1,max(a,b)+1):
  if a%i==0 and b%i==0:
    l.append(i)
l.sort(reverse=True)
print(l[k-1])
# Judge status: Accepted
A, B = map(int, input().split())

A -= 1
B -= 1
print(-(-B // A))
# Judge status: Accepted
n = int(input())
ac,wa,tle,re=0,0,0,0
for i in range(n):
    s = input()
    if(s=="AC"):
        ac+=1
    elif(s=="WA"):
        wa+=1
    elif(s=="TLE"):
        tle+=1
    else:
        re+=1
print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re)
# Judge status: Accepted
N = int(input())
x = N*800
y = (N//15)*200
Ans = x - y
print(Ans)
# Judge status: Accepted
n,k=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(n)]
AB.sort()
cnt=0
for i , j in AB:
    cnt+=j
    if k<=cnt:
        print(i)
        exit()
# Judge status: Wrong Answer
import numpy as np
ene=list(map(int, input().split()))
num=list(map(int, input().split()))
tmp = ene[0] - np.array(num).sum()
if tmp>0:
    print("NO")
else:
    print("Yes")
# Judge status: Accepted
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]

# A=[3,2,2,4,1]
# B=[1,2,2,2,1]
l_ans=[]
for i in range(len(A)):
    
    sum_num=sum(A[:i+1])+sum(B[i:])
    l_ans.append(sum_num)
print(max(l_ans))
# Judge status: Accepted
from collections import deque

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

ans=deque()
if n%2==0:
  for i in range(n):
    if i%2==0:
      ans.append(a[i])
    else:
      ans.appendleft(a[i])
else:
  for i in range(n):
    if i%2==0:
      ans.appendleft(a[i])
    else:
      ans.append(a[i])

print(*ans)
# Judge status: Accepted
s = str(input())
n = len(s)

X = ['']
temp = ''
for i in range(n):
    temp += s[i]
    if temp == X[-1]:
        continue
    else:
        X.append(temp)
        temp = ''
else:
    if temp != '':
        if temp == X[-1]:
            X[-1] += temp
        else:
            X.append(temp)

#print(X)
print(len(X)-1)
# Judge status: Wrong Answer
from bisect import bisect
from itertools import accumulate
N = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
D = tuple(accumulate(N - bisect(C, b) for b in reversed(B)))
print(sum(D[N - bisect(B, a) - 1] for a in A))
# Judge status: Accepted
A,B,K = map(int,input().split())

for a in range(A,min(A+K,B+1)):
  print(a)
for b in range(max(A+K,B-K+1),B+1):
  print(b)
# Judge status: Accepted
import math

n = int(input())
ans = 10 ** 15
for i in range(1, int(n ** 0.5)+1):
  if n % i == 0:
    ans = min(ans, i + n // i - 2)
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
if a == b:
  print(2*a)
else:
  print(2*max(a, b)-1)
# Judge status: Wrong Answer
inp = input('enter :')
inp = inp[0:3]
print(inp)
# Judge status: Accepted
N, *A = map(int, open(0).read().split())
ans = 0
for i in range(N):
    q, r = divmod(A[i], 2)
    ans += q
    if r == 0 or i == N - 1:
        continue
    elif A[i + 1] != 0:
        A[i + 1] += 1
print(ans)
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
if n < 3:
    print(ans)
else:
    for i in range(n-2):
        for j in range(i+1, n-1):
            for k in range(j+1, n):
                if l[k] < l[i] + l[j] and l[i] != l[j] and l[j] != l[k]:
                    ans += 1
                
    print(ans)
# Judge status: Accepted
x = int(input())

import bisect

ar = [0 for _ in range(8)]

for i in range(8):
    ar[i] = 400+200*i


num = bisect.bisect_right(ar,x)

#print(ar)
print(9-num)
# Judge status: Accepted


def solve():

    AB, BC, CA = map(int, input().split())
    print(AB*BC//2)


if __name__ == "__main__":
    solve()
# Judge status: Accepted
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]

mod = 10**9+7
dp = [-1]*(n+1)
dp[0] = 1
dp[1] = 1

for i in a:
    dp[i] = 0

for i in range(2, n+1):
    if dp[i] < 0:
        dp[i] = (dp[i-1] + dp[i-2])%mod

print(dp[n])
# Judge status: Accepted
X = int(input())
A = 0
B = 0
for i in range(1,10**5):
    if A < X:
        A+=i
    else:
        print(i-1)
        exit()
# Judge status: Accepted
import math
N = int(input())
sets = math.floor(N / 15)
discount = sets * 200
cost = N * 800 - discount
print(cost)
# Judge status: Accepted
def main():
    L = int(input())
    ans = (L/3.)**3
    print(ans)

    return

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
test = str(input())

if test.isupper():
    print('A')
else:
    print('b')
# Judge status: Accepted
S = input()
if S[2] == S[3] and S[4] == S[5]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())

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

point = 0
now = 10

while now <= n:
    point += n//now
    now *= 5

print(point)
# Judge status: Accepted
import collections
n = int(input())
s = list(input())
s_cnt = collections.Counter(s)

for i in range(n-1):
  tmp = input()
  for k in s_cnt:
    s_cnt[k] = min(s_cnt[k],tmp.count(k))

s_cnt=dict(sorted(s_cnt.items(), key=lambda x:x[0]))
ans = ""      
for k in s_cnt:
  ans += k*s_cnt[k]
print(ans)
# Judge status: Accepted
import sys
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(m)]
b=set()
c=set()
for l in a:
  if l[0]==1:
    b.add(l[1])
  elif l[1]==n:
    c.add(l[0])
for x in b:
  if x in c:
    print("POSSIBLE")
    sys.exit()
print("IMPOSSIBLE")
# Judge status: Accepted
# import math
n,m=map(int, raw_input().split())
arr=map(int, raw_input().split())
s=sum(arr)
arr.sort()
k=m
for i in xrange(n-1,-1,-1):
    if arr[i]>=s/(4.0*m) and k>0:
        k-=1
 
if k>0:
    print 'No'
else:
    print 'Yes'
# Judge status: Accepted
w, h, x, y = map(int, input().split())
hs = 0.5 * w * h
if x == w / 2 and y == h / 2:
    print("{:.10f}".format(hs), 1)
else:
    print("{:.10f}".format(hs), 0)
# Judge status: Accepted
def inpl():
    return list(map(int, input().split()))
 
 
S = input()
print(min(S.count('0'), S.count('1')) * 2)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
d4=len([i for i in A if i%4==0])
d2=len([i for i in A if i%2==0 and i%4!=0])

N=N-(d4*2)
if N==1:
    N=0
else:
    N-=d2

print("Yes" if N<=0 else "No")
# Judge status: Wrong Answer
n = int(input())
 
for _ in range(n):
    t, x, y = map(int, input().split())
    if  x + y > t or (t - x - y) % 2:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
A, B, C, X, Y = map(int, input().split())

pay = 0
same = min(X, Y)
pay += same * min(A + B, C * 2)

X -= same
Y -= same

pay += X * min(A, C * 2)
pay += Y * min(B, C * 2)

print(pay)
# Judge status: Wrong Answer
from collections import deque
N = int(input())
v = list(map(int, input().split()))
v.sort()
ans = deque()

while len(v) > 1:
    odd = []
    if len(v) % 2 == 1:
        odd.append(v[len(v) - 1])

    for i in range(1, len(v), 2):
        ans.append((v[i - 1] + v[i]) / 2)

    if len(odd) == 1:
        ans.append(odd[0])
    v = ans
    ans = deque()

print(v[0])
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1,n-1):
  if (p[i] > p[i-1]) and (p[i] < p[i+1]): cnt += 1
print(cnt)
# Judge status: Accepted
s = list(input())

flag = True

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == "L":
            flag = False
            break
    else:
        if s[i] == "R":
            flag = False
            break

if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,a,b = map(int,input().split())
if (b-a)%2==0:
    print((b-a)//2)
else:
    print(min(a+b-1, 2*n-a-b+1)//2)
# Judge status: Accepted
n = int(input())
l = [2,1]
if n == 0:
  print(2)
elif n == 1:
  print(1)
else:
  for i in range(n-1):
    l.append(l[-1]+l[-2])
  print(l[-1])
# Judge status: Accepted
s = input()
weather = ['Sunny', 'Cloudy', 'Rainy']
i = weather.index(s)
if (i == 0) | (i == 1):
    print(weather[i + 1])
else:
    print(weather[0])
# Judge status: Accepted
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

A,B,C = I()
if max(A,B,C) == A:
    print(A*10+B+C)
elif max(A,B,C) == B:
    print(B*10+A+C)
else:
    print(C*10+A+B)
# Judge status: Wrong Answer
N = int(input())
P = list(input().split())

count = 0
for i in range(N):
    FRAG_old = True
    for j in range(i+1):
        FRAG_new = (P[i] <= P[j])
        FRAG_new = FRAG_old*FRAG_new
        FRAG_old = FRAG_new
        if FRAG_new:
            pass
        
    if FRAG_new:
        count += 1
            
print(count)
# Judge status: Wrong Answer
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


N = I()
A = LI()

A.sort()
A = A[::-1]
alice = 0
bob = 0
flag = 0
for i in A:

    if flag % 2 == 0:
        alice += i
    else:
        bob += i
    flag += 1
print(alice, bob)
# Judge status: Wrong Answer
w,h,n = map(int,input().split())
width = w*[1]
height = h*[1]

for _ in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    width[:x] = [0]
  elif a == 2:
    width[x:] = [0]
  elif a == 3:
    height[:y] = [0]
  else:
    height[y:] = [0]
 
print(width.count(1)*height.count(1))
# Judge status: Wrong Answer
X, Y, A, B, C =map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
ate = p[0:X] +q[0:Y]
# print(ate)
for x in r:
    if x > ate[-1]:
        ate[-1] = x
        ate.sort()
print(sum(ate))
# Judge status: Accepted
a,b,c = input().split()

d = int

d = a
a = b
b = d 
d = c 
c = a
a = d
print(a,b,c)
# Judge status: Accepted
N = int(input())
P = list(map(int, input().split()))
now = P[0]
ans = 1
for i in range(1, N):
    if now >= P[i]:
        now = P[i]
        ans += 1
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

a, b = list(map(int, input().split()))

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")
# Judge status: Wrong Answer
S = input()
T = input()
l = len(T)
ans = l
for i in range(l):
  for j in range(l):
    if (i<=j):
      if T[i:j+1] in S:
        f = S.find(T[i:j+1])
        if f >= i and f + (l-j) <= len(S):
          ans = min(ans, l - (j+1-i))
print(ans)
# Judge status: Accepted
N = int(input())

for i in range(N, 0, -1):
    if (i ** 0.5).is_integer():
        print(i)
        break
# Judge status: Accepted
n,y=map(int,input().split())
for i in range(n+1):
    for j in range(n+1-i):
        k10=i*10000
        k5=j*5000
        k1=(n-i-j)*1000
        if k10+k5+k1==y:
            print(i,j,n-i-j)
            break
    else:
        continue
    break
else:
    print(-1,-1,-1)
# Judge status: Accepted
import sys

input = sys.stdin.readline


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

    L = len(str(N))
    ans = sum(map(int, str(N)))

    for d in range(L):
        if str(N)[d] == "0":
            continue
        m = sum(map(int, str(N)[:d + 1])) - 1 + 9 * (L - (d + 1))
        if m > ans:
            ans = m

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
points = []
for i in range(n):
    points.append(list(map(int, input().split(" "))))

t_pre, x_pre, y_pre = 0, 0, 0
reachable = False
for point in points:
    t, x, y = map(int, point)
    diff_t = t - t_pre
    p = x + y
    p_pre = x_pre + y_pre
    move = 0
    for _ in range(diff_t):
        move += 1 if p > (p_pre + move) else -1

    reachable = True if p - p_pre == move else False

    t_pre, x_pre, y_pre = t, x, y

print("Yes" if reachable == True else "No")
# Judge status: Accepted
a,b,c=map(int,input().split())
if b-a==c-b:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
x,y = tuple(map(int,input().split()))

for i in range(1,10*4):
  x<<=1
  if x>y:
    print(i)
# Judge status: Accepted
A, B=map(int, input().split())

def make_divisors(n):
  divisors = []
  for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n // i)
  #divisors.sort()
  return divisors

C = list(set(make_divisors(A)) & set(make_divisors(B)))
C.sort()

for i in range(1, len(C) - 1):
  a = C[i]
  for j in range(len(C) - 1, i, -1):
    if C[j] % a == 0:
      del C[j]
  if i + 1 >= len(C):
    break
    
print(len(C))
# Judge status: Accepted
N = int(input())

if N * 100 % 108 == 0:
    print(int(N / 1.08))
else:
    if int(N // 1.08 * 1.08) == N:
        print(int(N / 1.08))
    elif int((N // 1.08 + 1) * 1.08) == N:
        print(int(N / 1.08) + 1)
    else:
        print(":(")
# Judge status: Accepted
t = input()
ts = t.replace('?', 'D')
print(ts)
# Judge status: Accepted
N = int(input())
count = 0
for i in range(1,10):
    for j in range(1,10):
        if i*j == N:
            count = 1
if count > 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))
seconds = []
for a in range(0,n-2):
    num = [p[a],p[a+1],p[a+2]]
    num.sort()
    seconds.append(num[1])

print(len(set(seconds)))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
Asum1 = sum(A)
Asum2 = sum(A)-A[N-1]
J = N%2
B = N

if J == 0:
    for _ in range(N//2):
        Asum1 /= 2
    print(Asum1)
else:
    for _ in range((N-1)//2):
        Asum2 /= 2
    Asum2 = (Asum2+A[N-1])/2
    print(Asum2)
# Judge status: Accepted
n,a,b=map(int,input().split())
check=(b-a)%2
if check==0:
  ans=(b-a)//2
  print(ans)
else:
  ans=min(n-b,a-1)+1+(b-a-1)//2
  print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
x = c-a
y = d-b
ans = []
for i in range(x):
    ans.append('R')
for i in range(y):
    ans.append('U')
for i in range(x):
    ans.append('L')
for i in range(y+1):
    ans.append('D')
for i in range(x+1):
    ans.append('R')
for i in range(y+1):
    ans.append('U')
ans.append('L')
ans.append('U')
for i in range(x+1):
    ans.append('L')
for i in range(y+1):
    ans.append('D')
ans.append('R')
print(''.join(ans))
# Judge status: Wrong Answer
C=input()
chr(ord(C) + 1)
# Judge status: Accepted
a, b, c, k = map(int, input().split())
print(a-b) if k%2 == 0 else print(b-a)
# Judge status: Wrong Answer
#C - Average Length
import math
import itertools
N = int(input())
town = []
for i in range(N):
    x,y = map(int,input().split())
    town.append((x,y))

def dist(A,B):
    return math.sqrt((A[0]-B[0])**2 + (A[1]-B[1])**2)
route = list(itertools.permutations(town))
print(route)
tot = 0
for i in route:
    for j in range(len(i)-1):
        tot += dist(i[j],i[j+1])
ave = tot/len(route)
print(ave)
# Judge status: Accepted
# abc 135 A

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

res = a + b

if res % 2:
    print("IMPOSSIBLE")
else:
    print(res // 2)
# Judge status: Accepted
h,n=map(int,input().split())
s = sum(list(map(int,input().split())))

print("Yes" if s>=h else "No")
# Judge status: Accepted
n=int(input())
ans=0
for i in range(1,n+1):
    if i%3!=0 and i%5!=0:
      ans+=i
print(ans)
# Judge status: Accepted
from sys import exit

n = int(input())
s = sorted([int(input()) for _ in range(n)])

sum_s = sum(s)

if sum_s % 10 > 0:
  print(sum_s)
  exit()

for v in s:
  if (sum_s - v) % 10 > 0:
    print(sum_s - v)
    exit()

print(0)
# Judge status: Wrong Answer
n = input()
if '9' in n:
  print('yes')
else:
  print("No")
# Judge status: Accepted
A,B=input().split()
print(B+A)
# Judge status: Wrong Answer
D = int(input())
print("Christmas",(25-D)*"Eve")
# Judge status: Accepted
import itertools
x = int(input())
count = 0
coins = [ 100, 101 , 102 , 103 , 104 , 105]
for i in itertools.combinations_with_replacement(coins, x // 100):
  if sum(i) == x:
    count = 1
    break
print(count)
# Judge status: Accepted
import math
x = int(input())
ans = 0
for b in range(1, int(math.sqrt(x))+1):
    p = 1
    if b != 1:
        while b**p <= x:
            p += 1
    if b**(p-1) > ans:
        ans = b**(p-1)
print(ans)
# Judge status: Accepted
b=int(input())%2
from collections import deque
d=deque()
for e,i in enumerate(map(int,input().split())):
  if e%2: d.append(i)
  else: d.appendleft(i)
print(*list(d)[::b*2-1])
# Judge status: Accepted
N = input()
ans = 0

if N[1:] == "9" * (len(N) - 1):
    ans = int(N[0]) + (9 * (len(N) - 1))
else:
    ans = int(N[0]) + 9 * (len(N) - 1) - 1

print(ans)
# Judge status: Accepted
n, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
SUM = 0
for i in range(n):
    SUM += A[i]
    if SUM > x:
        print(i)
        break
    elif SUM == x:
        print(i + 1)
        break
else:
    print(n - 1)
# Judge status: Wrong Answer
s=input();n=len(s)
now=""
ans=set()
for i in range(n):
    now+=s[i]
    if not (now in ans):
        ans.add(now)
        now=""

ans1=set()
now=""
for i in range(n-1,-1,-1):
    now+=s[i]
    if not (now in ans1):
        ans1.add(now)
        now=""
print(max(len(ans),len(ans1)))
# Judge status: Accepted
lengh, count = map(int, input().split())
strlist = []
for i in range(0,lengh):
    strlist.append(input())
strlist.sort()
print("".join(strlist))
# Judge status: Accepted
n,m,q = [int(i) for i in input().split()]
p = []
for i in range(q):
  p.append([int(i) for i in input().split()])
dmax = 0
a = [1 for i in range(n)]
while True:
  d = 0
  for i in range(q):
    if a[p[i][1]-1]-a[p[i][0]-1] == p[i][2]:
      d += p[i][3]
  if d > dmax:
    dmax = d
  if a[0] == m:
    break
  c = 1
  l = a.pop()
  while l==m:
    l = a.pop()
    c += 1
  for i in range(c):
    a.append(l+1)
    
print(dmax)
# Judge status: Wrong Answer
from collections import Counter

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

acnt = Counter(a)
num = [0,0]
for i in acnt:
    if acnt[i] >= 4:
        num.append(i)
    if acnt[i] >= 2:
        num.append(i)
print(num[-1] * num[-2])
# Judge status: Accepted
from collections import deque
C=[list(map(int,input().split())) for _ in range(3)]

for i in range(C[0][0]+1):
    q=deque([C[0][0]-i,C[0][1]-i,C[0][2]-i,C[0][0]-i,C[0][1]-i,C[0][2]-i])
    flag=0
    for j in range(1,3):
        d=set()
        for k in range(3):
            d.add(C[j][k]-q.popleft())
        if len(d)==1:
            flag+=1
    if flag==2:
        print('Yes')
        exit()

print('No')
# Judge status: Accepted
def main():
    N, K = map(int, input().split())
    S = input()

    prev = "s"
    count = 0
    for s in S:
        if prev != s:
            count += 1
            prev = s
    print(min(N + 2 * K - count, N - 1))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import math
 
def round(R):
  return 2*R*math.pi
 
R = int(input())
round(R)
# Judge status: Accepted
s=list(input())
n=len(s)
dic={"0":"1","1":"0"}

temp=[]
temp.append(s[0])
ans=0
for i in range(1,n):
    temp.append(dic[temp[i-1]])

for i in range(n):
    if temp[i]!=s[i]:
        ans+=1
print(ans)
# Judge status: Accepted
a1,a2,a3 = map(int,input().split())

if a1 + a2 + a3 >= 22:
  print("bust")
else:
  print("win")
# Judge status: Wrong Answer
def main():
    s = int(input())
    mod = 10**9+7
    dp = [0] * (s+1)
    dp[0] = 1
    for i in range(1, s+1):
        for j in range(1, (i-3)+1):
            dp[i] += dp[j]
            dp[i] %= mod
    print(dp[s])

if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m,x,y=map(int,input().split())
xmax=max(list(map(int,input().split())))
ymin=min(list(map(int,input().split())))

if xmax>ymin: print('War')
else:
  ans='War'
  for i in range(xmax+1,ymin+1):
    if x<i<=y:
      ans='No War'
      break
  print(ans)
# Judge status: Wrong Answer
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
for i in a:
    if x-i>=0:
        x -= i
        count += 1


print(count)
# Judge status: Accepted
def main():
    N = int(input())
    a_list = list(map(int, input().split(' ')))
    broken_cnt = 0
    remain_max_number = 0
    for a in a_list:
        if a == remain_max_number + 1:
            remain_max_number += 1
        else:
            broken_cnt += 1
    answer = broken_cnt if broken_cnt < N else -1
    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N=int(input())
len({input() for i in range(N)})
# Judge status: Wrong Answer
N,D = map(int,input().split())
count = 0
for _ in range(N):
    a,b = map(int,input().split())
    val = (a ** 2 + b ** 2) ** 0.5
    if val >= D:
        count +=1
        
print(count)
# Judge status: Accepted
from collections import defaultdict

N = int(input())
a = list(map(int, input().split()))
anstable = [0] * (10 ** 6 + 1)
d = defaultdict(int)
for i in a:
    d[i] += 1

u = []
for i, v in d.items():
    if v == 1:
        u.append(i)
a = set(a)
for i in a:
    for j in range(i * 2, 10 ** 6 + 1, i):
        anstable[j] += 1

cnt = 0
for i in u:
    if anstable[i] == 0:
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
N = int(input())
lis = [1] * (10**7+1)
for i in range(2,10**7+1):
    for j in range(i,10**7+1,i):
        lis[j] += 1
ans = 0
for i in range(1,N+1):
    ans += lis[i] * i
print(ans)
# Judge status: Accepted
N = int(input())
T_arr = []
for _ in range(N):
    T_arr.append(int(input()))
    

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


print(lcm_list(T_arr))
# Judge status: Accepted
n = int(input())

ans = ""
while n != 0:
    rest = n % 2
    if rest == 1:
        ans += "1"
    else:
        ans += "0"

    n = (n - rest) // -2

if ans == "":
    ans += "0"

print(ans[::-1])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(i,i+2):
        dif = b[i] - a[j]
        if dif<0:
            ans+= b[i]
            b[i]=0
            a[j]=-dif
        elif dif >=0:
            ans+= a[j]
            b[i] = dif
            a[j] = 0
print(ans)