peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N = int(input())
count = 0
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        count += 1
    if count == 3:
        print('Yes')
        break
    if i == N-1:
        print('No')
# Judge status: Wrong Answer
N,X,T = map(int, input().split())
print(((N+X-1)/X)*T)
# Judge status: Wrong Answer
s=input()

ans=10**10

for i in range(len(s)):
  try:
    ans=min(ans,abs(int(s[i:i+1])-753))    
    ans=min(ans,abs(int(s[i:i+2])-753))
    ans=min(ans,abs(int(s[i:i+3])-753))
    ans=min(ans,abs(int(s[i:i+4])-753))
  except:pass
print(ans)
# Judge status: Accepted
s = input()
if s in ['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']:
  ans = 'a'
else:
  ans = 'A'
print(ans)
# Judge status: Accepted
from math import sqrt as s

N = int(input())
x, y = [], []
for i in range(1, int(s(N))+1):
  if N % i == 0:
    x.append(i)
    y.append(N // i)

ans, M = float("INF"), len(x)
for i in range(M):
  ans = min(ans, x[i] + y[i] - 2)

print(ans)
# Judge status: Accepted

from collections import defaultdict

S = input()
n = len(S)

mod = 2019
d = defaultdict(int)
d[0] = 1
num = 0
for i in reversed(range(n)):
    num += int(S[i]) * pow(10, n - i - 1, mod)
    num %= mod
    d[num] += 1

ans = 0
for v in d.values():
    ans += v * (v - 1) // 2
print(ans)
# Judge status: Wrong Answer
N=int(input())
L=[]
L.append(N)
i=0
while(1):
	if L[i]==4:
		break
	if L[i]%2==0:
		L.append(L[i]//2)
	if L[i]%2==1:
		L.append(L[i]*3+1)
	i+=1
print(i+4)
# Judge status: Accepted
n = int(input())
a = int(input())

if n%500 > a:
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
L = [a*b, a*c, a*d, b*c, b*d, c*d]
print(max(L))
# Judge status: Accepted
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

print('Yes' if s < t else 'No')
# Judge status: Accepted
from collections import defaultdict

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

count=defaultdict(int)
count3200=0
for i in range(N):
  if a[i] < 3200:
    count[a[i] // 400] += 1
  else:
    count3200 += 1
    
print(max(len(count),1),len(count)+count3200)
# Judge status: Accepted
a,b,x = map(int,input().split())

if a > x or a+b < x:
  print("NO")
else:
  print("YES")
# 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: Accepted
n = int(input())
a = [int(input()) for _ in range(n)]

count = 1
i = 0

while count < n:
  i = a[i] - 1
  if i == 1:
    print(count)
    break
  count += 1
if count >= n:
  print(-1)
# Judge status: Accepted
#!/usr/bin/python3
# -*- coding:utf-8 -*-

from functools import reduce

def main():
  n = int(input())
  la = list(map(int, input().strip().split()))
  x = reduce(lambda x, y: x ^ y, la)
  print(' '.join([str(x ^ a) for a in la]))

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

ans=0
for i in range(1,n+1):
    p=0
    for j in range(1,i+1):
        if i%j==0:
            p+=1
    if p==8 and j%2!=0:
        ans+=1

print(ans)
# Judge status: Wrong Answer
k = int(input())
s = input()

slist = list(s)
if len(slist) > k:
  l = ''
  for i in range(k):
    l += slist[i]
  print('...' + l)
else:
  print(s)
# Judge status: Accepted
N = int(input())
P = [list(map(int, input().split())) for _ in range(N)]

ans = 'Yes'
for t, x, y in P:
    if x + y > t:
        ans = 'No'
        break
    if (x + y) % 2 != t % 2:
        ans = 'No'
        break

print(ans)
# Judge status: Wrong Answer
n,x = map(int,input().split())
A = list(map(int,input().split()))
B = A.copy()
B = reversed(B)
ans = 0
tmp = 0
for i in range(n-1):
    if A[i] + A[i+1] >x:
        d = A[i] + A[i+1]
        tmp+= d-x
        if A[i+1] >=d:
            A[i+1] -=d
        else:
            A[i] = A[i] - (d-A[i+1])
            A[i+1] = 0
print(tmp)
# Judge status: Wrong Answer
n,k = map(int,input().split())
A = list(input().split())

place_1 = A.index("1")
L = place_1
R = n - L - 1

print(-(-L//(k-1)) + -(-R//(k-1)))
# Judge status: Accepted
n, m, x = map(int, input().split())
c = [0] * n
a = [[]] * n
for i in range(n):
	c[i], *a[i] = map(int, input().split())
ans = 2**32
for mask in range(1 << n):
	res = [0] * m
	cost = 0
	for i in range(n):
		if mask >> i & 1:
			cost += c[i]
			for j in range(m):
				res[j] += a[i][j]
	if all(v >= x for v in res):
		ans = min(ans, cost)
print(ans if ans != 2**32 else -1)
# Judge status: Accepted
S,K=list(input()),int(input())
for i in S:
    K-=1
    if i!='1'or K==0:
        print(i)
        exit()
# Judge status: Wrong Answer
n,lim = map(int,input().split())

ans = 10000

for i in range(n):
    cost,time = map(int,input().split())
    
    if time <= lim and cost < ans:
        ans = cost

if ans != 10000:
    print("TLE")
else:
    print(ans)
# Judge status: Wrong Answer
N, H = map(int, input().split())
A = 0
B = []

for i in range(N):
    a, b = map(int, input().split())
    A = max(A, a)
    B.append(b)

B = sorted(B, reverse=True) + [0]

i = 0
while B[i] >= A:
    i += 1
B = B[:i]

for i in range(len(B)):
    H -= B[i]
    if H < 0:
        print(i + 1)
        exit()
print(i + 1 + (H - 1) // A + 1)
# Judge status: Wrong Answer
a,b = map(int,input().split())

cnt = a
ans = 1
while(True):
    if(cnt >= b):
        break
    cnt -= 1
    cnt += a
    ans += 1
print(ans)
# Judge status: Accepted
k=int(input())
print((k//2)*(k//2+k%2))
# Judge status: Accepted
N,M = map(int, input().split())
t=[0 for _ in range(N)]

for i in range(M):
	a,b = map(int, input().split())
	t[a-1]+=1
	t[b-1]+=1

for i in range(N):
	print(t[i])
# 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: Accepted
n, a, b, c, d = map(int, input().split())
s = input()

if '##' in s[a-1:c] or '##' in s[b-1:d]:
    print('No')
else:
    if d<c and '...' not in s[b-2:d+1]:
        print('No')
    else:
        print('Yes')
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
p2 = sorted(p)
num_diff = 0
for i in range(n):
    if p[i] != p2[i]:
        num_diff += 1
if num_diff == 0 or num_diff == 2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
s=input()
ans=int(0)
n=len(s)
b=int(0)
w=int(0)
for i in range(n):
    if s[i]=='0':
        b+=1
    else:
        w+=1

if b<w:
    print(2*b)
else:
    print(2*w)
# Judge status: Wrong Answer
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
ans = 0
li = li[::-1]

for l in li:
    x = l[0]
    y = l[1]
    x += ans
    ans += y - x%y
    #print(ans)

print(ans)
# Judge status: Wrong Answer
N = int(input())

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

max_x = max(x_list)
min_x = min(x_list)

each_value_list = []
min_value = 10e1000
for i in range(min_x, max_x + 1):
    print(i)
    tmp_sum = 0
    for x in x_list:
        tmp_sum += (x - i)**2
    if min_value > tmp_sum:
        min_value = tmp_sum

print(min_value)
# Judge status: Wrong Answer
from math import ceil, sqrt

n = int(input())

ans = n - 1
for i in range(2, ceil(sqrt(n))):
    j, mod = divmod(n, i)
    if mod == 0:
        temp = i + j - 2
        if temp < ans:
            ans = temp
print(ans)
# Judge status: Accepted
k = int(input())
odd = 0
even = 0

for i in range(k + 1)[1:]:
  if i % 2 == 0:
    even += 1
  elif i % 2 == 1:
    odd += 1
print(odd * even)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())

if a>= c and c<=b:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
# A - Divide a Cuboid

a, b, c = map(int, input().split())
if (a*b*c)%2==0:
    print(0)
else:
    print(min(a*b,b*c,c*a))
# Judge status: Accepted
n=int(input())
s=input()
W=[0]*(n+1) #Wについての累積和
E=[0]*(n+1) #Eについての累積和
e=0
w=0
for i in range(n):
    if s[i]=="W":
        w += 1
    else:
        e += 1
    
    W[i+1] = w
    E[i+1] = e
ans = 10**10
for i in range(n):
    tmp = W[i] + (E[n]-E[i+1])
    ans = min(ans,tmp)
print(ans)
# Judge status: Accepted
N = int(input())
count = 0
for i in range(1,N+1,2):
    temp = 0
    for j in range (1,i+1):
        if i%j == 0:
            temp+=1
    if temp == 8:
        count+=1
print(count)
# Judge status: Accepted
import math

a, b = input().split() # a = result * 0.08, b = result * 0.1
a, b = int(a), int(b)
 
result_a = int(math.ceil(a / 0.08))
result_b = int(math.ceil(b / 0.1))
 
if result_a < 0 or result_b < 0:
  print(-1)
elif result_a > result_b:
  c = int(result_a * 0.1)
  if b == c:
    print(result_a)
  else:
    print(-1)
else:
  c = int(result_b * 0.08)
  if a == c:
    print(result_b)
  else:
    print(-1)
# Judge status: Accepted
import math

a = int(input().replace(' ', ''))
b = math.sqrt(a)
r = 'Yes' if (b.is_integer()) else 'No'
print(r)
# Judge status: Accepted
def main():
  S = input()
  while len(S)>=5:
    if len(S)>=7 and S[-7:]=="dreamer":
      S = S[:-7]
      continue
    
    elif len(S)>=6 and S[-6:]=="eraser":
      S = S[:-6]
      continue
    elif S[-5:]=="dream" or S[-5:]=="erase":
      S = S[:-5]
      continue
    else:
      break
  if len(S)==0:
    print('YES')
  else:
    print('NO')
    
main()
# Judge status: Wrong Answer
sx,sy,tx,ty = map(int,input().split())
going1 = ''
returning1 = ''
going2 = ''
returning2 = ''
going1 = 'R' * (tx - sx) + 'U' * (ty - sy)
returning1 = 'L' * (tx -sy) + 'D' * (ty - sy)
going2 = 'D' + 'R' * (tx - sx + 1) + 'U' * (ty - sy + 1) + 'L'
returning2 = 'U' + 'L' * (tx - sx + 1) + 'D' * (ty - sy + 1) + 'R' 
print(going1 + returning1 + going2 + returning2)
# Judge status: Accepted
n=int(input())
S=list(input() for _ in range(n))

T="abcdefghijklmnopqrstuvwxyz"
for c in T:
    x=50
    for s in S:
        x=min(x,s.count(c))
    print(c*x,end='')
print()
# Judge status: Wrong Answer
W, H, N = map(int, input().split())
min_H = 0
min_W = 0
max_H = H
max_W = W

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

    if a == 1:
        min_W = x
    elif a == 2:
        max_W = x
    elif a == 3:
        min_H = y
    else:
        max_H = y

print((max_H - min_H) * (max_W - min_W))
# Judge status: Accepted
N, M = map(int, input().split())
from collections import*
c = Counter(map(int, input().split()))
for _ in range(M):
    B, C = map(int, input().split())
    c[C] = c[C] + B if C in c else B
c = sorted(c.items(), reverse=True)
s = 0
for i in c:
    s += i[0] * min(i[1],N)
    N -= min(i[1],N)
print(s)
# Judge status: Accepted
n = int(input())
d = list(map(int, input().split()))
mod = 998244353

a = [0] * n
for d_ in d:
    a[d_] += 1

res = d[0] == 0 and a[0] == 1
for i, j in zip(a, a[1:]):
    res = res * i ** j % mod

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

if s == u:
    print(a-1, b)
else:
    print(a, b-1)
# Judge status: Accepted
S = input()
if 'a' in S and 'b' in S and 'c' in S:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=0
for i in range(N-1):
    ans+=B[int(A[i])-1]
    if int(A[i])+1==int(A[i+1]):
        ans+=C[int(A[i])-1]
print(ans+B[int(A[N-1])-1])
# Judge status: Wrong Answer
a, b, c, k = map(int, input().split())

flag = True
for i in range(10**18):
    if k == 0:
        break
    if a == b and b == c:
        break
    A = a
    B = b
    C = c
    a = B + C
    b = A + C
    c = A + B
    if i == k - 1:
        break
    if a > 10**18:
        flag = False
        break
if flag:
    print(a - b)
else:
    print('Unfair')
# Judge status: Accepted
A,B,K=map(int,input().split())
ans=[]
for i in range (1,min(A,B)+1):
    if A%i==0 and B%i==0:
        ans.append(i)

print(ans[-K])
# Judge status: Wrong Answer
a, b, n = map(int, input().split())

n = b if n > b else n
ans = 0
for x in range(n, 0, -1):
    if x > b:
        continue
    ans = max(a * x // b - a * (x // b), ans)
    break

print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
k = int(input())

ans = 0
sub = a + b + c
ans = max(a * (2 * k) + sub, b * (2 * k) + sub, c * (2 * k) + sub)
print(ans)
# Judge status: Accepted
def p_d():
    n, m = map(int, input().split())
    max_candidate = m // n
    for i in reversed(range(1, max_candidate + 1)):
        diff = m - n * i
        if diff % i == 0:
            print(i)
            break
            
p_d()
# Judge status: Wrong Answer
A,B,C = map(int,input().split())

def main(a,b,c):
  if a == b and b == c:
    return -1
  if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
      return 0   
  
  cnt = 0
  while True:
    #print(a,b,c)
    a1,b1,c1 = a,b,c
    a = (b1+c1)//2
    b = (a1+c1)//2
    c = (a1+b1)//2
    cnt += 1
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
      return cnt    
    

ans = main(A,B,C)
print(ans)
# Judge status: Accepted
def I(): return int(input())
def MI(): return map(int, input().split())
def LMI(): return list(map(int, input().split()))
MOD = 10 ** 9 + 7


N, M = MI()
if abs(N - M) > 1:
    print(0)
    exit(0)

f = [1]
for n in range(1, max(N, M) + 1):
    f.append(f[n - 1] * n % MOD)
print(f[N] * f[M] * (2 if abs(N - M) == 0 else 1) % MOD)
# Judge status: Accepted
def main():
        N = int(input())
        A = list(map(int, input().split()))

        l = [0]*N

        for a in A:
                l[a-1] += 1

        ans = "\n".join([str(x) for x in l])
        print(ans)

if __name__=="__main__":
        main()
# Judge status: Accepted
t=input()
t=t.replace('?','D')
print(t)
# Judge status: Accepted
import bisect
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for i in range(N):
  a=bisect.bisect_left(A,B[i])
  b=N-bisect.bisect_right(C,B[i])
  if b==0:
    break
  ans+=a*b
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=1
c=0
pas=a[0]
for i in range(1,n):
  now=a[i]
  if c==0:
    if pas<now:
      c=1
    if pas>now:
      c=2
  if c==1:
    if pas>now:
      ans+=1
      c=0
  if c==2:
    if pas<now:
      ans+=1
      c=0
  pas=now
print(ans)
# Judge status: Wrong Answer
q, h, s, d = map(int, input().split())
n = int(input())

q /= 0.25
h /= 0.5
s /= 1
d /= 2

li = [(q, 0.25), (h, 0.5), (s, 1), (d, 2)]
li.sort()

ans = 0
for i in range(len(li)):
    if n < li[i][1]:
        continue
    n, r = divmod(n, li[i][1])
    ans += n * li[i][0] * li[i][1]
    if r == 0:
        break
print(int(ans))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline


def log(*args):
    print(*args, file=sys.stderr)


def main():
    N, A, B, C, D = map(int, input().split())
    log(N, A, B, C, D)
    S = input()
    if "##" in S:
        print("No")
        return
    if C < D:
        print("Yes")
        return
    if "..." in S[B-2:D+1]:
        print("Yes")
        return
    print("No")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
a = [int(i) for i in input().split()]
mn1 = min(a)
a.remove(mn1)
mn2 = min(a)
if mn2%mn1==0:
    print(mn1)
else:
    print(1)
# Judge status: Accepted
W, a, b = map(int, input().split())

if a+W < b:
    print(b-(a+W))
elif b < a-W:
    print((a-W)-b)
else:
    print(0)
# Judge status: Accepted
n = int(input())
s = input()

x = 0
ans = 0
for i in range(n):
    if s[i] == "I":
        x += 1
    elif s[i] == "D":
        x -= 1
    ans = max(ans, x)
print(ans)
# Judge status: Accepted
N = input()

sumRes = sum(list(map(int, N)))

print('Yes' if sumRes % 9 == 0 else 'No')
# Judge status: Wrong Answer
N,K = list(map(int, input().split()))
S = str(input())
s = (S[K-1].lower)
print(s)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if (a>b):
    s=a+b
    s=s%24
if (b>=a):
    s=a-b
if (s<=0):
    s=s*-1

print(s)
# Judge status: Wrong Answer
given = [x for x in input()]
rets  = ''
for i, v in  enumerate(given):
    if v in ["1", "0"]:
        rets += v
    elif v == "B" and len(rets) > 0:
        rets = rets[:-1]
    else:
        rets += v
print(rets)
# Judge status: Accepted
def main():
    n = int(input())
    result = 0
    while True:
        if n > 0:
            n = n - 2
            result += 1
        else:
            break
    print(result)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
A, B = map(int, input().split())

if A >= 13:
    print(B)
else:
    print(B//2)
# Judge status: Accepted
a,b,c,d = map(int,input().split())

if abs(a-c)<=d:
  print("Yes")
elif abs(a-b)<=d and abs(b-c)<=d:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
k=[]
for i in range(1,n+1):
    k.append(i)

c=0
for i in range(n):
    if k[i]!=l[i]:
        c+=1

if c==0 or c==2:
    print('YES')
else:
    print('NO')
# 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())
L=list(map(int,input().split()))
L=sorted(L)
if sum(L[:-1])>L[-1]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a, b, c = map(int, input().split())
for i in range(1, b + 1):
    if a * i % b == c:
        print("YES")
        break
else:
    print("NO")
# Judge status: Accepted
N = int(input())
res = 0
for i in range(1,N+1):
    if N%i ==0 and N//i>=2:
        res += N//i-1
    elif N%i!=0:
        res += N//i
print(res)
# Judge status: Wrong Answer
#DPでしょ、DPなんでしょ！？お姉さん知ってるんだから！ﾌﾟﾘﾌﾟﾘ
# Judge status: Accepted
s = input()
t = input()
if len(s) <= len(t):
    a = s; s = t; t = a
res = 0
for i in range(len(s)-len(t)+1):
    temp = 0
    for j in range(len(t)):
        if s[j+i] == t[j]:
            temp+=1
    res = max(temp, res)

ans =len(t) - res
print(ans)
# Judge status: Accepted
a = input().split()
if a.count('5') == 2 and a.count('7'):
  print('YES')
else:
  print('NO')
# Judge status: Accepted
a,b,c=map(int,input().split())
if a+b>=c:
    print('No')
else:
    flg = 4*a*b < (c-a-b)**2
    print('Yes' if flg else 'No')
# Judge status: Wrong Answer
from fractions import gcd

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

L=[0]*n
R=[0]*n
L[0]=A[0]
R[n-1]=A[n-1]
res=0

for i in range(1,n):
	L[i]=gcd(L[i-1],A[i])
for i in range(0,n-1):
	R[n-i-2]=gcd(R[n-i-1],A[n-i-2])

for i in range(1,n-1):
	res=max(res,gcd(L[i-1],R[i+1]))
	
print(max(res,L[n-1],R[1]))
# Judge status: Wrong Answer
N = int(input())
s = [0,1]
for i in range(2,N):
    for j in range(2,int(i**0.5 + 1)+1):
        if i % j == 0:
            k = i//j
            s.append(2*s[k])
            break
    if len(s) != i+1:
        s.append(1)
print(sum(s))
# Judge status: Accepted
S = list(input())

cnt = 0
for i, s in enumerate(S):
  if s == 'R' and cnt == 0:
    cnt +=  1
  elif s == 'R' and cnt >= 1 and S[i-1] == 'R':
    cnt += 1

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

n = sum(b) - sum(a)
c = 0
for i in range(N):
    if a[i] < b[i]:
        c += (b[i] - a[i] + 2 - 1) // 2
print('Yes' if c <= n else 'No')
# Judge status: Accepted
# A

Q,H,S,D = map(int,input().split())
N = int(input())

print((N//2) * min(8*Q,4*H,2*S,D) + (N % 2) * min(4*Q,2*H,S))
# Judge status: Accepted
s = input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
# Judge status: Accepted
n=input()
for i in range(2**3):
    ans=''
    for j in range(4):
        ans+=n[j]
        if j==3:
            continue
        if (i>>j)&1:
            ans+='+'
        else:
            ans+='-'
    if eval(ans)==7:
        print(ans+'=7')
        break
# Judge status: Accepted
from math import ceil
n=int(input())
min_val=min(int(input()),int(input()),int(input()),int(input()),int(input()))
m=ceil(n/min_val)
print(5+m-1)
# Judge status: Accepted
answer = 0
pf     = {}
m=int(input())
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:
  pf[m]=1

for i, j in pf.items():
  temp = j
  for k in range(1, j+1):
    temp   -= k
    if temp < 0:
      break
    else:
      answer += 1
      
print(answer)
# Judge status: Wrong Answer
x = int(input())
ans = x // 11 * 2
nokori = x % 11
if nokori > 6:
    print(ans + 2)
else:
    print(ans + 1)
# Judge status: Wrong Answer
r, g, b = input().split()

number = int(r+g+b)
if number % 4 ==0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
x,y=map(int,input().split())

if (2*y-x)%3!=0 or (2*x-y)%3!=0:
    ans=0
else:
    a=(2*y-x)//3
    b=(2*x-y)//3
    n=a+b
    ans=1
    for i in range(min(a,b)):
        ans*=(n-i)
        ans%=(10**9+7)
        ans*=pow(i+1,10**9+5,10**9+7)
print(ans%(10**9+7))
# Judge status: Wrong Answer
import collections
N=int(input())
a=[input() for i in range(N)]
print(collections.Counter(a))
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
from collections import defaultdict
d=defaultdict(int)
for i in a:
  d[i]+=1
if len(d)<=k:
  print(0)
else:
  print(sum(sorted(list(d.values()))[:len(d)-k]))
# Judge status: Accepted
s,a,u=open(0);i=u in s;print(int(a[:2])-1+i,int(a[2:])-i)
# Judge status: Accepted
N = int(input())
S = input()

if N % 2 != 0:
    print('No')
else:
    if S[:int(N/2)] == S[int(N/2):]:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
n,m=map(int, input().split())
ans=0

if n==1 and m==1:
    ans=1
elif n==1:
    ans=m-2
elif m==1:
    ans=n-2
else:
    ans=(n-2)*(m-2)

print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    minimum = min(a_lst)
    maximum = max(a_lst)

    cost = 10 ** 9
    for i in range(maximum - minimum + 1):
        tmp_cost = 0
        std = minimum + i
        for j in range(n):
            a = a_lst[j]
            tmp_cost += (a - std) ** 2
        cost = min(tmp_cost, cost)

    print(cost)


if __name__ == '__main__':
    main()
# Judge status: Accepted
S=str(input())
T="2018"+S[4:]
print(T)
# Judge status: Accepted
c = set(input())
s = {"a","i","u","e","o"}
w = c|s
if len(w) == 5 :
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
#!/usr/bin/env python3
n,m = map(int,input().split())
digit = [-1]*3
for i in range(m):
    s,c =map(int,input().split())
    if digit[s-1] == -1: digit[s-1] = c
    elif digit[s-1] != c: 
        print(-1)
        exit()
if digit[0] == 0 and n != 1:
    print(-1)
    exit()
if (digit[0] == 0 and n == 1) or (n == 1 and m == 0):
    print(0)
    exit()
for i in range(n):
    if digit[i] == -1:
        print(max(1-i,0),end="")
    else: print(digit[i],end="")
# Judge status: Wrong Answer
w,a,b=map(int,input().split())
print(b-a-w)
# Judge status: Wrong Answer
a, b, n = map(int, input().split())
ans = int((a * n) / b) - a * int(n / b)

for i in range(0, 100):
  n = n - 1
  ans=max(ans, int((a * i) / b) - a * int(i / b))
print(ans)
# Judge status: Wrong Answer
n=int(input())
h=list(map(int,input().split()))
for i in range(n-1):
    if h[i]>h[i+1]:
        h[i]-=1
if max(h)-min(h)==1:
    print("Yes")
    quit()
for i in range(n-1):
    if h[i]>h[i+1]:
        print("No")
        quit()
print("Yes")
# Judge status: Accepted
k, n = map(int, input().split())
L = list(map(int, input().split()))
b = k - L[n-1] + L[0]
for i in range(n-1):
    R = L[i+1] - L[i]
    if R > b:
      b = R
print(k - b)
# Judge status: Accepted
N = int(input())
S = [input() for i in range(N)]
c0, c1, c2, c3 = 0, 0, 0, 0
for i in S:
    if i == 'AC':
        c0 += 1 
    if i == 'WA':
        c1 += 1
    if i == 'TLE':
        c2 += 1
    if i == 'RE':
        c3 += 1
print('AC','x',c0)
print('WA','x',c1)
print('TLE','x',c2)
print('RE','x',c3)
# Judge status: Accepted
N,K=map(int, input().split())
a_ls=list(map(int, input().split()))

j=1
step=0
s=set([])
l=[]
loop_s=-1
loop_g=-1

while True:
	s.add(j)
	l+=[j]
	j=a_ls[j-1] #update
	if j in s:
		loop_s=l.index(j)
		loop_g=len(l)
		break


#print(l)
#print(loop_s)
#print(loop_g)

if K<loop_s:
	print(l[K])
elif (K+1-loop_s)%(loop_g-loop_s)!=0:
	print(l[loop_s+(K+1-loop_s)%(loop_g-loop_s)-1])
else:
	print(l[-1])
# Judge status: Accepted
from math import gcd
X = int(input())
print(360 // gcd(X, 360))
# Judge status: Accepted
a, b, c, d = map(int, input().split())
if abs(a-c) <= d:
    print('Yes')
elif abs(a-b) <= d and abs(b-c) <= d:
    print('Yes')
else:
    print('No')