peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
S = input()
T = input()

count = 0
for i in range(len(S)):
  if S[i] != T[i]:
    count+=1
print(count)
# Judge status: Accepted
N = int(input())
S = []
for i in range(N):
    S.append(''.join(sorted(list(input()))))
S.sort()
#print('S', S)

count=0
n=1
for i in range(1,N):
    if S[i-1] == S[i]:
        n+=1
    else:
        count+= n*(n-1)*0.5
        n=1
count+=n*(n-1)*0.5
print(int(count))
# Judge status: Accepted
from heapq import heappush, heappop

K = int(input())
hq = []
for i in range(1,10):
  heappush(hq,i)
cnt = 0
while(cnt < K):
  x = heappop(hq)
  cnt += 1
  for i in [-1,0,1]:
    d = (x%10)+i
    if 0 <= d <= 9:
      heappush(hq,x*10+d)
print(x)
# Judge status: Accepted
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=[0]*n
if a[0]>x:
    ans[0]=x
else:
    ans[0]=a[0]
for i in range(1,n):
    ans[i]=min(a[i],x-ans[i-1])
print(sum(a)-sum(ans))
# Judge status: Wrong Answer
n=int(input())
s=input()
# 数値(1〜26)→アルファベット(a〜z)
n2a = lambda c: chr(c+64).lower()
al=[]
for i in range(1,27):
  c=s.count(n2a(i))
  if c!=0:
    al.append(c)
base=2**len(al)
ans=base-1
for i in range(len(al)):
  if al[i]==1:
    continue
  a=base//2
  ans+=a
  ans%=10**9+7
print(ans)
# Judge status: Accepted
t=1
for i in range(365):
  print(t)
  if t == 26:
    t = 1
  else:
    t +=1
# Judge status: Accepted
a, b, c = map(int, input().split())
if (b-a==c-b):
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
a=int(input())
n=2*a//11+a%11//7+min(0,a%11)
print(n)
# Judge status: Accepted
if __name__ == '__main__':

    N = int(input())
    x = []
    y = []

    for _ in range(N):
        x_, y_ = map(int, input().split())
        x.append(x_)
        y.append(y_)
    xpy = [a + b for a, b in zip(x, y)]
    xmy = [a - b for a, b in zip(x, y)]
    max_1 = max(xpy)
    min_1 = min(xpy)
    max_2 = max(xmy)
    min_2 = min(xmy)
    print(max(max_1 - min_1,max_2 - min_2))
# Judge status: Accepted
def resolve():
    import math
    k = int(input())
    ans = 0
    for i in range(1, k+1):
        for j in range(1, k+1):
            gcd1 = math.gcd(i,j)
            for l in range(1, k+1):
                gcd = math.gcd(l, gcd1)
                ans += gcd
    print(ans)
resolve()
# Judge status: Accepted
S = input()
f, l = S[:2], S[2:]

if 1 <= int(f) <= 12 and 1 <= int(l) <= 12:
    print('AMBIGUOUS')
elif 1 <= int(f) <= 12:
    print('MMYY')
elif 1 <= int(l) <= 12:
    print('YYMM')
else:
    print('NA')
# Judge status: Accepted
S,T=input(),input()
s,t=len(S),len(T)

for i in range(s-t+1):
  if all(c in "?"+d for c,d in zip(S[-i-t:],T)):
    S=S.replace("?","a")
    print(S[:-i-t]+T+S[s-i:])
    quit()

print("UNRESTORABLE")
# Judge status: Accepted
d=int(input())
c=list(map(int,input().split()))


ss=[list(map(int,input().split())) for i in range(d)]

for i in range(d):
    print(i%26+1)
# Judge status: Wrong Answer
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
x = len(a) // n
l = []
for i in range(n):
    for j in range(x):
        l.append(a[i::x-1])
      
ans = 0
for i in range(n):
    ans += l[i][1]
print(ans)
# Judge status: Wrong Answer
import sys
S = str(input())

if len(S) < 2 or len(S) > 200:
    sys.exit()
if not S.islower():
    sys.exit()

for I in range(len(S)):
    length = len(S) - I
    if (not I == 0)and length % 2 == 0 and S[0:int(length / 2)] == S[int(length / 2):length]:
        print(length)
# Judge status: Accepted
n = int(input())
flag = False
for i in range(1,10):
  if n%i == 0 and 0 < n/i < 10:
    flag = True
    break
if flag:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import math

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

lis = []
for index, i in enumerate(li):
  lis.append(i - (index + 1))

lis.sort()
x = lis[math.floor(N/2)]

ans = 0
for i in lis:
  ans += max(x - i, -x + i)

print(ans)
# Judge status: Accepted
n=int(input())//2
S=input()
print('Yes'if S[:n]==S[n:]else'No')
# Judge status: Accepted
#136_A
a,b,c=map(int,input().split())
print(max(0,c-(a-b)))
# Judge status: Accepted
n = int(input())
lst1 = list(map(int,input().split()))
s = sum(lst1)
abs_ = 10**18
now = 0
i = 0
while True:
    now += lst1[i]
    if i >= n-1:
        break
    else:
        abs_ = min(abs_,abs(now-(s-now)))
    i += 1

print(abs_)
# Judge status: Accepted
X,Y = map(int,input().split())

tmp = X
ans = [X]
for i in range(int(1e5)):
    tmp *= 2
    if tmp > Y:
        break
    ans.append(tmp)

print(len(ans))
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 11 01:37:10 2020

@author: liang
"""

S = input()
N = len(S)
ans = 0
for i in range(N):
    if i%2 == 0 and S[i] == "0":
        ans += 1
    if i%2 == 1 and S[i] == "1":
        ans += 1
ans = min(ans, N - ans)
print(ans)
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = list(map(int, input().split()))

count = 0
allpoint = 0

for i in A:
    allpoint += i

for i in A:
    if i >= (allpoint * (1 // (4 * M))):
        count += 1

if  M > 0 and count >= M:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
S=list(input())
tmp=""
ans="No"
for s in S:
    if(tmp==""):
        tmp=s
    else:
        if(s=='i' and tmp=='h'):
            ans="Yes"
            tmp=''
        else:
            ans="No"
            break
print(ans)
# Judge status: Wrong Answer
X = list(map(int,input()))
print(X)
sn = []
for i in range(len(X)):
  sn.append(sum(X[0:i+1]))
ssn = []
for i in range(len(X)):
  ssn.append(sn[i]-1 + 9*(len(X)-1-i))
print(max(ssn))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
c = [0] * 9
for i in a:
    if i < 3200:
        c[i // 400] += 1
    else:
        c[8] += 1
ans = 0
for i in range(8):
    if c[i] != 0:
        ans += 1
if ans == 0:
    print(1, c[8])
else:
    print(ans, ans + c[8])
# Judge status: Accepted
n=int(input())

a=[int(input()) for i in range(n)]

dic={}

for i in range(n):
    if a[i] not in dic:
        dic[a[i]]=1
    else:
        dic[a[i]]+=1

ans=0

for val in dic.values():
    if val%2==1:
        ans+=1

print(ans)
# Judge status: Accepted
a,b,c=[int(x) for x in input().split()]
if a==b and b!=c:
  print("Yes")
elif b==c and a!=b:
  print("Yes")
elif a==c and a!=b:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n, m= map(int,input().split())
lista=list(map(int, input().split()))
eq= 0
eq2= 0

for i in range(m):
	eq+= lista[i]

eq2= n-eq
if eq2==0:
	print("0")
elif eq<0:
	print("-1")
else:
	print(eq2)
# Judge status: Accepted
N, A, B = map(int, input().split())
print(A*(N//(A+B)) + min(A, N%(A+B)))
# Judge status: Wrong Answer
n = int(input())
count =[0] * n

for f in range(1,n+1):
    for x in range(1, f//5):
        for y in range(1, f//5):
            for z in range(1, f//5):
                if(x*x+y*y+z*z+x*y+y*z+z*x == f):
                    count[f-1]+=1

for i in range(n):
    print(count[i])
# Judge status: Accepted
a, b, c, d = map(int, input().split())
if (abs(a - b) <= d and abs(b - c) <= d) or abs(a - c) <= d:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
X,K,D = map(int,input().split())
A = abs(X)
if A > D:
    if A//D > K:
        A = A - (D * K)
        K = 0
    else:
        A = A - (A//D)*D
        K = K - (A//D)

if K > 0:
    if K%2 == 1:
        A = A - D

print(abs(A))
# Judge status: Wrong Answer
import math

n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in range(n):
    for j in range(i+1, n):
        dis = 0
        for k in range(d):
            dis += (x[i][k]-x[j][k])**2
            if math.sqrt(dis) % 1 == 0:
                cnt += 1
print(cnt)
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M = map(int, readline().split())

    if N >= M // 2:
        ans = M // 2
    else:
        ans = N
        L = M - 2 * N
        ans += L // 4

    print(ans)
    return


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

if a >= b-1:
    print(k+1)
else:
    if k <= a-1:
        print(k+1)
    else:
        k -= a
        k += 1
        if k % 2 == 1:
            print(k//2*(b-a)+a+1)
        else:
            print(k//2*(b-a)+a)
# Judge status: Wrong Answer
ab = list(list(map(int, input().split())) for _ in range(3))
B = sum(ab[0])
ab2 = sum(ab[1])
ab3 = sum(ab[2])

if (ab2-B)%3 != 0 or (ab3-B)%3 != 0:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
n = int(input())
s = list(input())
total = s[1:].count('E')
ans = total
for i in range(n-1):
    if s[i]=='W':
        total += 1
    if s[i+1]=='E':
        total -= 1
    ans = min(ans, total)
print(ans)
# Judge status: Accepted

s=input()
ans=-10000
M=753
for i in range(len(s)-2):
    res=(int)(s[i:i+3])
    if(abs(ans-M)>abs(res-M)):
       ans=res
print(abs(M-ans))
# Judge status: Accepted
def nCr(n,r):
  dividend = 1
  divisor = 1
  MOD = 10**9+7
  d1 = n
  for i in range(1,r+1):
    dividend *= d1
    divisor *= i
    d1 -= 1
    dividend %= MOD
    divisor %= MOD

  return (dividend * pow(divisor, MOD-2, MOD)) % MOD

X,Y = map(int,input().split())

if (X+Y) % 3 != 0:
  print(0)
  exit()

n = (-X+2*Y) // 3
m = (2*X-Y) // 3

if n<0 or m<0:
  print(0)
else:
  print(nCr(n+m, n))
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

def f(m):
    res = sum([-(-x//m)-1 for x in a])
    return res <= k

l, r = 0, 10**9+10

while r-l > 1:
    x = (l+r)//2
    if f(x): r = x
    else: l = x

print(r)
# Judge status: Accepted
def getInts():
    return [ int(x) for x in input().split() ]

[L,R,d] = getInts()

c = 0
for i in range(L, R+1):
    if i%d==0:
        c+=1
print(c)
# Judge status: Accepted
N,X = map(int, input().split())
l = list(map(int,input().split()))
count = 1
d = 0
for i in range(N):
  d = d + l[i]
  if d <= X:
    count += 1
print(count)
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))

#hyouten = []


for i in range(n-k+1):

    
    if i>0:
        score_old = a[i-1]
        score = a[i+k-1]
#        print(score_old,score)
        if score >score_old:
            print("Yes")
        else:
            print("No")
# Judge status: Accepted
x, y, a, b, c = map(int, input().split())

p = sorted(list(map(int, input().split())), reverse=True)[:x]
q = sorted(list(map(int, input().split())), reverse=True)[:y]
r = sorted(list(map(int, input().split())))


print(sum(sorted(p + q + r, reverse=True)[:x+y]))
# Judge status: Accepted
S = input()
a = [s for s in "abcdefghijklmnopqrstuvwxyz"]

for s in list(set(S)):
    if(s in a):
        a.remove(s)
if(a == []):
    print("None")
else:
    print(a[0])
# Judge status: Accepted
n = int(input())
cnt = 0
for i in range(n):
    a, b = map(int, input().split())
    if a == b:
        cnt += 1
        if cnt == 3:
            print("Yes")
            exit()
    else:
        cnt = 0

print("No")
# Judge status: Wrong Answer
import numpy as np
import math
import collections
import fractions
import itertools

def iput(): return int(input())
def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))

def solve():
    n = int(input())
    cost = 0
    for i in range(n):
        a, b = mput()
        mult = math.ceil(a/b)*b
        cost += mult - a
    print(cost)
    return 0


if __name__ == "__main__":
    solve()
# Judge status: Accepted
a, b = map(int, input().split())
print( (a+b+1)//2 )
# Judge status: Accepted
s = input()


def solve(query):
    while 1:
        for frag in ("erase", "eraser", "dream", "dreamer"):
            if query.endswith(frag):
                query = query[:-len(frag)]
                break
        else:
            print("NO")
            break
        if not query:
            print("YES")
            break



solve(s)
# Judge status: Accepted
x = int(input())
#ゴリ押し解法
mny = 100
count = 0
while(x > mny):
	mny += int(mny*0.01)
	count += 1
print(count)
# Judge status: Accepted
#!/usr/bin/env python3

N = int(input())

print(N*(N+1)//2)
# Judge status: Accepted
from collections import Counter
n = int(input())
l = list(map(int,input().split()))
c = Counter(l)
mod = 998244353
if l.count(0) != 1 or l[0] != 0:
    print(0)
    exit()
ans = 1
for i in l[1:]:
    ans *= c[i-1]
    ans %= mod
print(ans%mod)
# Judge status: Wrong Answer
x=int(input())
ans=2*(x//11)
rem=x%11
if rem<=6:
    ans+=1
else:
    ans+=2
print(ans)
#print(2*ans) if x%11==0 else print(2*ans+1)
# Judge status: Accepted
import math
A, B, N = map(int, input().split())

x = min(B-1, N)
print(math.floor(A*x/B) - A*math.floor(x/B))
# Judge status: Accepted
a,b = map(int,input().split())
s = input()

 
if s.count("-") ==1:
  s1,s2 = s.split("-")
  if a == len(s1) and b == len(s2):
    print("Yes")
  else:
    print("No")
 
else:
  print("No")
# Judge status: Accepted
N, X, T = map(int, input().split())
count = 1
check = X
if X > 1:
    while True:
        value = int(N / X)
        re = N % X
        if re == 0:
            count = value
            TotalTime = T * count
            break
        else:
            count += value
            TotalTime = T * count
            break
else:
    TotalTime = T * N

print(TotalTime)
# Judge status: Accepted
t = input()
s = t.replace('?', 'D')
print(s)
# Judge status: Wrong Answer
N=int(input())
T,A=map(int, input().split())
p=0
cc=10**6
A*=1000
for i, T in enumerate(map(lambda h:12000-int(h)*6,input().split())):
    d=abs(T - A)
    if cc > d:
        cc=d
        p=i+1
print(p)
# Judge status: Accepted
import sys
n,q=map(int,input().split())
s=input()
c=[0]*n
for i in range(2,n+1):
  if s[i-2:i]=='AC':
    c[i-1]=c[i-2]+1
  else:
    c[i-1]=c[i-2]
lr=sys.stdin.readlines()
for i in lr:
  l,r=map(int,i.split())
  print(c[r-1]-c[l-1])
# Judge status: Accepted
S = input()
T = input()
ans = 0
for i in range(len(S)-len(T)+1):
    s = S[i:i+len(T)]
    num = 0
    for j in range(len(T)):
        if s[j] == T[j]:
            num += 1
    if num>ans:
        ans = num
print(len(T)-ans)
# Judge status: Wrong Answer
x = int(input())
if x == 1:
  print("1")
  exit()
  
ans = 0
for b in range(2,x):
  for p in range(2,1000):
    tmp = pow(b,p)
    if tmp<=x:
      ans = max(ans,pow(b,p))
      break
      
print(ans)
# Judge status: Wrong Answer
S = list(input())
K = int(input())

l = 0
for i, s in enumerate(S):
    if ord('z') - ord(s) + 1 <= K:
        S[i] = 'a'
        K -= ord('z') - ord(s) + 1
    else:
        l = i
else:
    if K > 0:
        S[-1] = chr(ord(S[-1]) + K % 26)

print("".join(S))
# Judge status: Wrong Answer

a,b,c = map(int,input().split())
l = []

if a % 2 == 0:
    print("NO")
else:
    for i in range(1,b+1):
        l.append((a * i) % b)
#    print(l)

    if l.count(c) != 0:
        print("YES")
    else:
        print("NO")
# Judge status: Accepted
from collections import Counter
N= int(input())
a = list(map(int, input().split()))

b = a[:]
c = a[:]
for i in range(N):
    b[i] += i
    c[i] -= i

cnt1 = Counter(b)
cnt2 = Counter(c)

lst = list(cnt1.keys())
lst.sort()

ans = 0

for i in range(len(lst)):
    ans += cnt1[lst[i]] * cnt2[-lst[i]]

print(ans)
# Judge status: Accepted
a,x=input().split()
a=int(a)
b,c=map(int,x.split('.'))
b=b*100+c
print((a*b)//100)
# Judge status: Accepted
from math import sqrt
n = int(input())
cnt = [0]*1000000
ans = 0
for i in range(2,int(sqrt(n))):
    if(n==1): break
    j = 1
    while n%i==0:
        n = n//i
        cnt[i-1]+=1
        if cnt[i-1]==j:
            ans+=1
            j+=1
            cnt[i-1]=0
if n!=1: ans+=1
print(ans)
# Judge status: Wrong Answer
N , M = input().split(" ")
A = input()
Ai = A.split(" ")
tm = 0
for i in Ai:
    tm = tm + int(i)
print(int(N)-tm)
# Judge status: Wrong Answer
A,x,C = input ().split ()
n = x[:1]
print ('A',n,'C')
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy

ans =''
ans += 'R'*dx + 'U'*dy
ans += 'L'*dx + 'D'*dy
ans += 'D' + 'R'*(dx+1) + 'U'*(dy+1) + 'L'
ans += 'U' + 'L'*(dx+1) + 'D'*(dy+1) + 'R'

print(ans)
# Judge status: Wrong Answer
n=int(input())
k=0
for i in range(n):
  a,b=map(int,input().split())
  if(a==b):
    k+=1
if(k>=3):
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
import numpy as np

N, K = map(int, input().split())
A = np.array([int(i) for i in input().split()])

for i in range(N-K):
  if np.prod(A[i:i+K]) < np.prod(A[i+1:i+K+1]):
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
K = int(input())
if K % 2 == 0:
  r = (K // 2) **2
else:
  r = K // 2 * (K // 2 + 1)
print(int(r))
# Judge status: Accepted
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = list("x" * K + input())

win = {"r":P,"s":R,"p":S,"x":0}

ans = 0
for i in range(len(T)):
  if T[i] == T[i - K]:
    T[i] = "x"
  else:
    ans += win[T[i]]

print(ans)
# Judge status: Accepted
N,M=map(int,input().split())
ans=abs(N-2)*abs(M-2)
print(ans)
# Judge status: Accepted
s=input()
k=ord(s)
print(chr(k+1))
# Judge status: Accepted
a, b = list(map(int, input().split()))

diff = b - a

x = 1
y = 3
i = 3

while True:
  if y - x == diff:
    break
  
  x = y
  y = y + i
  i = i + 1

print(y - b)
# Judge status: Wrong Answer
N = int(input())

cnt = 0
i = 0
for i in range(0, 5, 2):
  m = 10 ** i
  print(m)
  if len(str(m)) > len(str(N)):
    break
  M = int("9" * (i + 1))
  print(M)
  
  if M > N:
    M = N
  print(M)
  
  cnt += M - m + 1

print(cnt)
# Judge status: Accepted
def f(x):
  if x==1:
    return 1
  else:
    return 2*f(x//2)+1
print(f(int(input())))
# Judge status: Accepted
k,x = map(int,input().split())
ans = [i for i in range(x-k+1, x+k)]
print(' '.join(map(str,ans)))
# Judge status: Accepted
s = input()
sets = set()
for v in s:
    sets.add(v)
    
ans = "Yes"
if "N" in sets and "S" not in sets:
    ans = "No"
if "S" in sets and "N" not in sets:
    ans = "No" 
if "E" in sets and "W" not in sets:
    ans = "No" 
if "W" in sets and "E" not in sets:
    ans = "No"    
print(ans)
# Judge status: Wrong Answer
X = int(input())
if 400<=X<=599:
    print('8')
elif 600<=X<=799:
    print('7')
elif 800<=X<=999:
    print('6')
elif 1000<=X<1199:
    print('5')
elif 1200<=X<=1399:
    print('4')
elif 1400<=X<=1599:
    print('3')
elif 1600<=X<1799:
    print('2')
elif 1800<=X<1999:
    print('1')
# Judge status: Wrong Answer
import math
n,d=map(int,input().split())
za=[list(map(int,input().split())) for i in range(n)]
ans=0
lon=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(d):
            lon+=(za[i][k]-za[j][k])**2
            lon=math.sqrt(lon)
        else:
            if lon==int(lon):
                ans+=1
            lon=0
print(ans)
# Judge status: Wrong Answer
N,M,Q = map(int,input().split())
List = [list(map(int, input().split())) for i in range(Q)]
ListA = [1]*(N+1)
ListB = []
S = 0


for a in range(N):
  for ListA[N-a] in range(ListA[N-1-a], M+1):
    for i in range (Q):
      if ListA[List[i][1]]-ListA[List[i][0]] == List[i][2]:
        S += List[i][3]
    ListB.append(S)
    S = 0
  
print(max(ListB))
# Judge status: Accepted
N,M = map(int, input().split())
Key = [0 for i in range(N+1)]
for _ in range(M):
    L,R = map(int,input().split())
    L -= 1
    R -= 1
    Key[L] += 1
    Key[R+1] -= 1
count = 0
sum = 0
for i in range(len(Key)):
    sum += Key[i]
    if sum == M:
        count += 1
print(count)
# Judge status: Accepted
a,b,c,d,e,f =input()

if c == d and e == f :
  print("Yes")
else: print("No")
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
s=input()
cnt=0
cnt_f=0
for i in range(n):
    if s[i] == 'a' and cnt < a+b:
        print('Yes')
        cnt+=1
    elif s[i] == 'b' and cnt < a+b and cnt_f <= b:
        print('Yes')
        cnt+=1
        cnt_f+=1
    elif s[i] == 'c':
        print('No')
    else:
        print('No')
# Judge status: Wrong Answer
a = input().split()

s = [input() for i in range(int(a[0]))]
b = ''

s.sort()
print(s)

for i in range(int(a[0]),0):
  b = s[i] + b
  
print(b)
# Judge status: Accepted
N, K = map(int, input().split())
ans = 0

for i in range(1, N + 1):
    tmp = 1 / N
    now = i
    while now < K:
        now *= 2
        tmp /= 2
    
    ans += tmp
        
print(ans)
# Judge status: Accepted
a, b = input().split()
X = int(a+b)
i = 1
while i*i <= X:
    if i*i == X:
        print('Yes')
        break
        
    else:
        i += 1
else:
    print('No')
# Judge status: Accepted
n = int(input())
i = True
c = 1

while i:
    c *= 2
    if c > n:
        c = c // 2
        i = False

print(c)
# Judge status: Wrong Answer
import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(20000000)
n = int(input())
a = []
b = []
for i in range(n):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)

a.sort()
b.sort()
if n % 2 == 0:
    tmp = [a[n//2-1], a[n//2], b[n//2-1], b[n//2]]
    tmp.sort()
    print((tmp[1] + tmp[3]) - (tmp[0] + tmp[2]) + 1)
else:
    mid_l = a[n//2]
    mid_r = b[n//2]
    print(mid_r - mid_l + 1)
# Judge status: Accepted
n=int(input())
if n==1:
    print(1)
else:
    l=[2,1]
    for i in range(2,n+1):
        l_i=l[i-2]+l[i-1]
        l.append(l_i)
    print(l[n])
# Judge status: Accepted
X, A, B = list(map(int,input().split()))
print('delicious' if -A+B <= 0 else 'safe' if B-A <= X else 'dangerous')
# Judge status: Accepted
q, h, s, d = (int(i) for i in input().split())
n = int(input())
x = min(4*q, 2*h, s)
y = min(2*x, d)
print( (y*(n-n%2)//2) + x*(n%2) )
# Judge status: Accepted
a, b, k = map(int, input().split())
s = set(range(a, min(b + 1, a + k)))
s.update(range(b, max(a - 1, b - k), -1))
s = sorted(s)
print('\n'.join(map(str, s)))
# Judge status: Accepted
a,b = map(int, input().split())
if a > 0:
  ans = "Positive"
elif b >= 0:
  ans = "Zero"
elif (b-a)%2 == 0:
  ans = "Negative"
else:
  ans = "Positive"
print(ans)
# Judge status: Accepted
a,b = map(int,input().split())
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
    print("Possible")
else:
    print("Impossible")
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import defaultdict, Counter

N = int(input())
n = int((2*N)**0.5)
while n*(n+1) < 2*N:
    n += 1
for i in range(n, 0, -1):
    if N >= i:
        print(i)
        N -= i
# Judge status: Wrong Answer
S = str(input())
S = S[:-2]

for _ in range(len(S)//2-2):
  
  if S[:len(S)//2] == S[len(S)//2:]:
    print(len(S))
    break
  else:
    S = S[:-2]
# Judge status: Wrong Answer
s,w = map(int,input().split())

if w >= s/2:
	print('unsafe')
else:
	print('safe')
# Judge status: Accepted
X = map(int, input().split())
for i, x in enumerate(X, 1):
    if not x:
        print(i)
# Judge status: Wrong Answer
n=int(input())
ans=0
if n % 2==0:
    for i in range(1,100):
        waru = 2*5**i
        if n < waru:
            break
        else:
            tmp = n/waru
            ans += int(tmp)
print(str(ans))
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count=0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      ans = 500*i + 100*j + 50*k
      if ans==int(x):
        count+=1
      
print(count)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

min_cost=10000000000

for x in range(-100,101):
    i=0
    for y in a:
        i+=(y-x)**2
    min_cost=min(min_cost,i)
    
print(min_cost)
# Judge status: Accepted
x = int(input())

from math import gcd
def lcm(x,y):
    return x // gcd(x, y) * y

print(lcm(360,x)//x)
# Judge status: Accepted
n = int(input())
ans = 0
r = 0
for i in range(n):
    a = int(input())
    if a == 0:
        r = 0
        continue
    else:
        ans += (a + r) // 2
        r = (a + r) % 2
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())

ball = [1 for _ in range(N)]
red = [0 for _ in range(N)]
red[0] = 1

now_red = 0

for i in range(M):
    xx, yy = map(int, input().split())
    x = xx-1
    y = yy-1
    
    ball[x] -= 1
    ball[y] += 1
    
    if red[x]:
        if ball[x] == 0:
            red[x] = 0

        red[y] = 1
        now_red = y
    # print("ball", ball)
    # print("red", red)
    # print("now_red", now_red)

print(sum(red))