peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
nums = list(map(int, list(input())))

flag = 7
while flag >= 0:
    S = []
    total = nums[0]
    bin_str = format(flag, "03b")
    for i, bit in enumerate(bin_str, 1):
        if int(bit):
            total += nums[i]
            S.append("+")
        else:
            total -= nums[i]
            S.append("-")
    if total == 7:
        break
    
    flag -= 1
print(f"{nums[0]}{S[0]}{nums[1]}{S[1]}{nums[2]}{S[2]}{nums[3]}=7")
# Judge status: Accepted
a,b,k=map(int,input().split())
ls = []
for i in range(1,101):
    if a % i == 0 and b % i == 0:
        ls.append(i)
print(ls[-k])
# Judge status: Wrong Answer
colors = list(map(int,input().split()))
print(len(colors))
# Judge status: Accepted
N,M=map(int,input().split())
if(N==M):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
c = [0 for _ in range(n+1)]
ans = 0
for i in range(n):
  if a[i] <= n:
    c[a[i]] += 1
  else:
    ans += 1
for i in range(n):
  if c[i] >= i:
    ans += c[i] - i
  else:
    ans += c[i]
print(ans)
# Judge status: Accepted
import collections
n = int(input())
a = [int(input()) for i in range(n)]
a = collections.Counter(a)
a = list(a.values())
cnt = 0
for i in range(len(a)):
    if a[i] % 2 == 1:
        cnt += 1
print(cnt)
# Judge status: Accepted
CONST = 10**9+7
n = int(input())
s = input()

chars = {}
for c in s:
    if c in chars:
        chars[c] += 1
    else:
        chars[c] = 1

val = 1
for i in chars.values():
    val = (val * (i+1)) % CONST
print(val-1)
# Judge status: Accepted
a,b = map(int,input().split())
n = b-a
h = n*(n+1)//2
snow = h-b
print(snow)
# 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):
    ans += min(A[i], B[i])
    B[i] = max(B[i] - A[i], 0)

    ans += min(A[i+1], B[i])
    A[i+1] = max(A[i+1] - B[i], 0)

print(ans)
#
# Judge status: Accepted
S=list(map(str,input()))
T=list(map(str,input()))
#print(T[0:-1])
print("Yes" if T[0:-1]==S else "No")
# Judge status: Wrong Answer
import math

n = int(input())
max = int(math.sqrt(n) + 1)
L = [0] * (n + 1)
for x in range(1, max):
    for y in range(1, max):
        for z in range(1, max):
            tmp = x * x + y * y + z * z + x * y + y * z + z * x
            if tmp > n:
                continue
            L[tmp] += 1

for i in range(1, n):
    print(L[i])
# Judge status: Wrong Answer
from collections import Counter

N = int(input())
data = list(map(int,input().split()))
Q = int(input())
pala = list()
for i in range(Q):
    b = list(map(int,input().split()))
    pala.append(b)

count = Counter(data)

sum = 0
for k , v in count.items():
    sum += (k * v)

for B,C in pala:
    diff = (C - B) * count[B]
    res = sum + diff
    print(res)
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))
dp = [float('inf')] * N
dp[0] = 0
for i in range(1, N):
    dp[i] = min(dp[i-1] + abs(H[i]-H[i-1]), dp[i-2] + abs(H[i]-H[i-2])
                ) if i >= 2 else dp[i-1] + abs(H[i] - H[i-1])
#print(*dp)
print(dp[N-1])
# Judge status: Accepted

X, K, D = map(int, input().split())

if K * D < abs(X):
    print(abs(X)-K*D)
    exit(0)

new_X = abs(X) % D
new_K = K - abs(X) // D

if new_K % 2 == 0:
    print(new_X)
else:
    print(abs(new_X-D))
# Judge status: Accepted
n,m=map(int,input().split())
l=[]
for x in range(n):
    a,b=map(int,input().split())
    l.append([a,b])
l=sorted(l)
r=0
for x in l:
    r+=min(m,x[1])*x[0]
    m-=x[1]
    if m<=0:break
print(r)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ans1 = max(a)
diff = min(ans1//2, ans1//2 + 1)
ans2 = ans1
for x in a:
  if x == ans1:
    continue
  d = min(abs(ans1//2 - x), abs(ans1//2 + 1 - x))
  if d <= diff:
    diff = d
    ans2 = x
print('{} {}'.format(ans1, ans2))
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for _ in range(n)]

tmp = 0
c = 0

while c != (n + 1):
    tmp = a[tmp-1]

    c += 1
    if tmp == 2:
        print(c+1)
        exit()
        

print(-1)
# Judge status: Accepted
def main():
    x = int(input())
    print(8-(x-400)//200)


if __name__ == "__main__":
    main()
# Judge status: Accepted
S = {
    'a': list(input()[::-1]),
    'b': list(input()[::-1]),
    'c': list(input()[::-1]),
}
 
s='a'
while True:
    if not S[s]:
        print(s.upper())
        exit()
    s = S[s].pop()
# Judge status: Accepted
def main():
    w = list(input())
    oklist=[]
    for i in range(len(w)):
        w1 = w.count(w[i])
        if w1 % 2 != 0:
            oklist.append(1)
    if oklist == []:
        print('Yes')
    else:
        print('No')
    
    
if __name__ == '__main__':
  main()
# Judge status: Accepted
a = list(map(int, input()))
ans = ""
for i in range(2 ** 3):
  b = [i for i in a]
  for j in range(3):
    if (i >> j) & 1:
      b[j + 1] *= -1
  if sum(b) == 7:
    ans += (str)(b[0])
    for j in range(1, 4):
      if b[j] >= 0:
        ans += "+" + (str)(b[j])
      else:
        ans += (str)(b[j])
    ans += "=7"
    break
else:
  print("none")
print(ans)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n=I()
count=0
anss=[]
for i in range(1,10):
    for j in range(1,10):
        anss.append(i*j)
for ans in anss:
    if ans==n:
        print("Yes")
    else:
        count+=1
if count==len(anss):
    print("No")
# Judge status: Accepted
n = int(input())
r, q = divmod(n, 2)
print((r + q) / n)
# Judge status: Accepted
a,b=[int(x) for x in input().split()]
ans=1
for i in range(1,30):
    c=a*1+(a-1)*(i-1)
    if c>=b:
        ans=i
        break
if b==1:
    print(0)
else:
    print(ans)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())

if A < C < B:
  print('Yes')
  
elif B < A < C:
  print('Yes')
  
else:
  print('No')
# Judge status: Accepted
s = input()[::-1]
l = len(s)
x = [0 for _ in range(2019)]
x[0] += 1
k = 0
p = 1
for si in s:
    k += int(si) * p % 2019
    k %= 2019
    x[k] += 1
    p *= 10
    p %= 2019
 
ans = 0
for xi in x:
    ans += max(0, xi * (xi - 1) // 2)
print(ans)
# Judge status: Accepted
n, l = map(int, input().split())
S = [input() for i in range(n)]
S.sort()
print("".join(S))
# Judge status: Wrong Answer
a = [int(i) for i in input().split()]
K=int(input())
a.sort()
ans = 0
for i in range(K):
  a[-1] = a[-1]**2
print(sum(a))
# Judge status: Accepted
def main():
    n, k = map(int, input().split())
    p = 10 ** 9 + 7
    ans = 0
    for i in range(k, n + 2):
        if i == n + 1:
            ans += 1
        else:
            ans += n * i - (i - 1) * i + 1

        ans %= p

    print(ans)


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

if a <= x <= a + b:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

a = 0
count = 0
N = [0]*len(A)

for i in range(len(A)):
    if A[i] % 2 == 0:
        A[i] /= 2
        N[i] += 1

print(min(N))
# Judge status: Wrong Answer
(a,b,c) = map(int,input().split())
if a <= c <= b:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n=int(input())
lst=[]

for i in range(n):
  a=list(map(int,input().split()))
  lst.append(a)
  
lst.sort(key=lambda x:x[1])

time=0

for i in lst:
  time+=i[0]
  if time>i[1]:
    print('NO')
    exit()
    
    
print('YES')
# Judge status: Accepted
N = int(input())
P = list(map(int, input().split()))
 
result = 0
mini = [P[0]]
 
for i in range(N-1):
    if mini[i]>P[i+1]:
        mini.append(P[i+1])
    else:
        mini.append(mini[i])
 
for i in range(N):
    if P[i]==mini[i]:
        result += 1
 
print(result)
# Judge status: Wrong Answer
x=int(input())
ans=2*(x//11)
x-=(ans//2)*11
if x<=6:
    ans+=1
elif x==0:
    pass
else:
    ans+=2
print(ans)
# Judge status: Wrong Answer
x = list(map(int, input().split()))

for i in range(5):
    if x[i] == 0:
        print(i)
# Judge status: Wrong Answer
import sys
input=sys.stdin.readline

s=int(input())

#0<= x,y <=10**9
#s/2

if s<=10**9:
    print(0,0,1,0,0,s)
    exit()

y=s//(10**9)
x=s%(10**9)

print(0,0,10**9,1,x,y)
# Judge status: Accepted
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = [0]*(n+1)
ans = 1

for i in range(1,n+1):
    d[i] = d[i-1]+l[i-1]
    if x < d[i]:
        break
    ans += 1

print(ans)
# Judge status: Accepted
n = int(input())
s = input()

if n%2==1:
    print('No')
    exit()

if s[:len(s)//2] == s[len(s)//2:]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
ans = 0
for i in range(min(N, K)): ans += X
N = max(0, N - K)
for i in range(N): ans += Y
print(ans)
# Judge status: Accepted
from sys import stdin
import sys
A,B = map(int, stdin.readline().rstrip().split())
sys.setrecursionlimit(2000)
def search(x):
    p = (x*0.08)//1
    q = (x*0.10)//1
    if p==A and q==B:
        print(x)
        exit()
    elif p > A and q > B:
        print(-1)
    else:
        search(x+1)

search(1)
# Judge status: Wrong Answer
s = input()
S = len(s)

for i in range(S-1):
    for j in range(i+1,S):
        if s[:i]+s[j:] == "keyence":
            print("YES")
            exit()

print("NO")
# Judge status: Accepted
S = str(input())
h = [int(x) for x in list(S)]
N = len(h)
a = [0] * 2019
a[0] = 1
T = 0
r = 1
c = 0
for i in range(N-1, -1, -1):
    T = (T + h[i] * r) % 2019
    r = r * 10
    r = r % 2019
    c += a[T]
    a[T] += 1
print(c)
# Judge status: Accepted
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

n=int(input())
a=[]
temp=int(input())
a.append(temp)
g=temp

for _ in range(n-1): #O(nlogt)
    temp=int(input())
    a.append(temp)
    gc=gcd(max(g,temp),min(g,temp))
    g=g*(temp//gc)

print(g)
# Judge status: Accepted
import math

input_list = input().split(' ')
a = input_list[0]
b = input_list[1]

N = math.sqrt(int(a+b))

if N.is_integer():
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
# =map(int,input().split())
r=int(input())
print((3.14)*(r**2))
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))
mini = a.index(1)
l = mini // (k-1)
lm = mini % (k-1)
r = (n - mini - 1) // (k-1)
rm = (n - mini - 1) % (k-1)
# print(l, r, lm, rm)
print(l + r + ((lm + rm + 1) // k + ((lm + rm + 1) % k != 0 and (lm + rm) != 0)))
# Judge status: Accepted


K=int(input())
A,B =map(int,input().split())
ans = K
i = 1
while True:
    if(ans >=A and ans<=B):
        print("OK")
        break
    if(ans > B):
        print("NG")
        break
    ans = K *i
    i += 1
# Judge status: Wrong Answer
a,b = map(int,input().split()) 
c=a*b
 
if(c%2==0):
  print("even")
else:
  print("odd")
# Judge status: Accepted
from decimal import Decimal

a,b = input().split(' ')
print(int(Decimal(a)*Decimal(b)))
# Judge status: Wrong Answer
N, x = map(int, input().split())
a = sorted(list(map(int, input().split())))

child = 0
candy = 0

print(a)

for i in a:
    candy += i
    if candy <= x:
        child += 1

if sum(a) < x:
    child -= 1

print(child)
# Judge status: Accepted
x = input()
di = {"Sunny":"Cloudy", "Cloudy":"Rainy", "Rainy":"Sunny"}
print(di[x])
# Judge status: Accepted
x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
    print("A")
else:
    print("B")
# Judge status: Wrong Answer
X = int(input('Enter Input: '))
if X > 5:
    a = int(X/500)
    b = X % 500
    c = int(b/5)
    d = a * 1000 + c * 5
    print(d)
else:
    print(0)
# Judge status: Accepted
n,m = map(int,input().split(" "))
ar = [[] for i in range(n)]
br = [0 for i in range(n)]
for i in range(m):
    x,y = map(int,input().split(" "))
    ar[x-1].append(y-1)
    ar[y-1].append(x-1)
cr = [0]
dr = []
for r in cr:
    for i in ar[r]:
        if br[i] == 0:
            br[i] = r + 1
            cr.append(i)
print("Yes")
for i in range(1,n):
    print(br[i])
# Judge status: Accepted
K = 1000000007
N = int(input())
A = [int(a) for a in input().split()]
li = [0] * 60
for n in range(N):
    li = [li[i] + (A[n] >> i & 1) for i in range(60)]
ans = 0
for i in range(60):
    ans += (1 << i) * li[i] * (N - li[i])
    ans %= K
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def main():
    N = int(input())
    B = list(map(int, input().split()))

    ans = B[0] + B[-1]
    for i in range(N-2):
        ans += min(B[i], B[i+1])

    print(ans)


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

MOD = 1000000007
ans = (pow(2, n, MOD) - 1) % MOD

def conv(n, k):
  x, y = 1, 1
  for i in range(k):
    x = x*(n-i) % MOD
    y = y*(i+1) % MOD
  return x*pow(y,MOD-2,MOD) % MOD

ans = (ans - conv(n, a) - conv(n, b)) % MOD
print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a+b+c >=22:
  print('bust')
else:
  print('win')
# Judge status: Accepted
#ABC145B
n = int(input())
s = input()
print("Yes" if s[:n//2]==s[n//2:] else "No")
# Judge status: Accepted
n, m = map(int, input().split())
if n > 2 and m > 2:
  print((n-2) * (m-2))
elif n == 2 or m == 2:
  print(0)
elif n == 1 and m == 1:
  print(1)
else:
  print(m*n-2)
# Judge status: Accepted
n = int(input())
l = [list(map(str, input().split())) for i in range(n)]
for row in l:
    row[1] = int(row[1])
    row.append(l.index(row))

s = sorted(l, key=lambda x:(x[0],-x[1]))

for i in s:
  print(i[2]+1)
# Judge status: Accepted
from fractions import gcd

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

left = [0]*n
right = [0]*n

for i in range(n-1):
    left[i+1] = gcd(left[i], A[i])
    right[n-i-2] = gcd(right[n-i-1], A[n-i-1])

ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i]))
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
ans=0
for i in range(60):
  x=1<<i
  o=sum(1 for j in a if j&x)
  ans+=x*o*(n-o)
  ans%=mod
print(ans)
# Judge status: Accepted
N=int(input())
*A,=map(int,input().split())

i1=len([i for i in A if i%2!=0])
i4=len([i for i in A if i%4==0])
i2=min(1,N-i1-i4)

# print(i1,i2,i4)
print('Yes' if (i1+i2-1)<=i4 else 'No')
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    A = tuple(map(int, input().split()))
    if len(set(A)) == len(A):
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))

p.sort()
print(sum(p[:3]))
# Judge status: Accepted
import math
a,b,c,d=map(int,input().split())
n,m,k=0,0,0

if a%c==0:
    n=b//c-a//c+1
else:
    n=b//c-a//c
if a%d==0:
    m=b//d-a//d+1
else:
    m=b//d-a//d
e=(c*d)//math.gcd(c,d)
if a%e==0:
    k=b//e-a//e+1
else:
    k=b//e-a//e
k=n+m-k
print(b-a-k+1)
# Judge status: Accepted
w,h,n = map(int,input().split())
x_min,x_max,y_min,y_max = 0,w,0,h
for i in range(n):
    x,y,a = map(int,input().split())
    if a==1:
        x_min = min(max(x_min,x),w)
    elif a==2:
        x_max = max(min(x_max,x),0)
    elif a==3:
        y_min = min(max(y_min,y),h)
    else:
        y_max = max(min(y_max,y),0)
print(max(0,x_max-x_min)*max(0,y_max-y_min))
# Judge status: Wrong Answer
a = input().split()
b = 0
for i in range(2):
    sorted(a)
    b = b + int(a[0])
    a[0] = str(int(a[0]) - 1)
print(b)
# Judge status: Wrong Answer
a,b,k=map(int, input().split())
for i in range(k):
    if a+i > b:
        break
    print(a+i)
for i in range(k-1,-1,-1):
    if b-i < a:
        break
    print((b-i))
# Judge status: Wrong Answer
import sys
import math

input = sys.stdin.readline
MOD = 1000000007

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

if X == 1 & Y == 1:
    print(0)
else:
    print(int(math.log2(Y//X))+1)
# Judge status: Accepted
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    a = readint()
    b = readint()
    h = readint()
    print((a + b) * h // 2)


if __name__ == "__main__":
    main()
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
a = int(input())

print("Yes" if n % 500 <= a else "No")
# Judge status: Wrong Answer
X,Y,Z = map(int, input().split())
print((X-2*Z)//Y)
# Judge status: Accepted
import numpy as np
import itertools

N, M, X = map(int, input().split())

As = []

for i in range(N) :
  As.append(list(map(int, input().split())))
  
L_As = len(As[0])
cal = np.zeros(L_As)
ans = []
for j in range(1, N+1) :
  for k in itertools.combinations(As, j) :
    for l in k :
      cal = cal + np.array(l)
    if min(cal[1:L_As]) >= X :
      ans.append(cal[0])
    cal = np.zeros(len(As[0]))

if len(ans) == 0 :
  print("-1")
else :
  print(int(min(ans)))
# Judge status: Accepted
N = int(input().rstrip())
d = {}
As = [int(x) for x in input().rstrip().split()]
for i in range(1, N+1):
    d[i] = 0
for n in As:
    d[n] += 1
for i in range(1, N+1):
    print(d[i])
# Judge status: Wrong Answer
n = int(input())

res = 0
for i in range(8,n+1,2):
    yakusu = 0
    for j in range(2,int(i/2)+1):
        if(i % j == 0):
            yakusu +=1
    if(yakusu == 8):
        res += 1

print(res)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
mx = max(a)
mn = min(a)
print(mx-mn)
# Judge status: Accepted
import itertools

N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
A = list(itertools.permutations(range(1,N+1)))
a = A.index(P) + 1
b = A.index(Q) + 1
print(abs(a-b))
# Judge status: Wrong Answer
s=input()
l=0
for i in s:
    if(i>='a' and i<='z'):
        l+=1

if l%2==0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N,M,X,Y = map(int, input().split())
list_x = list(map(float, input().split()))
list_y = list(map(float, input().split()))
if X<Y:
	if max(list_x)<min(list_y) and X<min(list_y) and Y>max(list_x):
	  print("No War")
	
	else:
		print("War")
      
    
else:
	if max(list_x)>min(list_y) and Y<min(list_x):
	  print("No War")
    
	else:
	  print("War")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

memo = {}
for i in range(N-1):
    Si = A[i]
    try:
        memo[Si] += 1
    except:
        memo[Si] = 1

for i in range(1, N+1):
    try:
        print(memo[i])
    except:
        print(0)
# Judge status: Accepted
a,b,c=map(int, input().split())
if a==b or b==c or a==c:
  if a==b==c:
    print('No')
  else:
    print('Yes')
else:
  print('No')
# Judge status: Accepted
from itertools import permutations
from math import sqrt

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

total = 0
for pattern in permutations(xy):
    dis = 0
    for j in range(n - 1):
        dis += sqrt((pattern[j][0] - pattern[j + 1][0]) ** 2 + (pattern[j][1] - pattern[j + 1][1]) ** 2)
    total += dis

ans = total / len(list(permutations(xy)))
print(ans)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
total = 0
for i in range(N):
    total += a[i*2 + 1]
print(total)
# Judge status: Accepted
n,k = map(int,input().split())
s=input()

print("{}{}{}".format(s[:k-1],s[k-1].lower(),s[k:]))
# Judge status: Accepted
import math

H, A = map(int, input().split())
print(math.ceil(H / A))
# Judge status: Accepted
N = int(input())
P = list(map(int, input().split()))

ans = 0
mn = 10**9
for i in range(N):
    if P[i] <= mn:
        mn = P[i]
        ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
S = list(input())

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

ans = r*g*b

for i in range(1,N-1):
  for j in range(1,min(i,N-i-1)+1):
    if S[i] != S[i-j] and S[i] != S[i+j] and S[i-j] != S[i+j]:
      ans -= 1
      
print(ans)
# Judge status: Accepted
N, M = tuple(map(int, input().split()))
A = set(map(int, [input() for _ in range(M)]))
MOD = 10 ** 9 + 7

dp = [0] * (N + 1)

#0段目と1段目は1通り（但し、１段目が壊れていない場合）（0 段目は「なにもしない」という から1 通り）
dp[:2] = 1, 1 if 1 not in A else 0 


for i in range(2, N + 1):
    if i in A:
        continue
    else:
        dp[i] = (dp[i - 1] + dp[i - 2])

print(dp[-1] % MOD)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
x = 0
for i in range(1, n):
  x = x^a[i]
  
l = [x]
for i in range(n-1):
  x = a[i]^a[i+1]
  l.append(l[i]^x)
print(l)
# Judge status: Accepted
from bisect import bisect_right

N = int(input())
A = [int(input()) for _ in range(N)]
INF = 10**18

dp = [INF] * N
for a in A:
    dp[bisect_right(dp, -a)] = -a
ans = N - dp.count(INF)
print(ans)
# Judge status: Accepted
s,c=map(int,input().split())
if s*2 >= c:
  print(c//2)
else:
  ans=s
  c=c-2*s
  ans += c//4
  print(ans)
# Judge status: Accepted
if __name__ == '__main__':

    S = list(input())
    T = list(input())

    len_s = len(S)
    len_t = len(T)

    ans = 0
    tmp = 0
    for i in range(len_s-len_t+1):
        A = S[i:i+len_t]
        for j,k in zip(A,T):
            if j == k:
                tmp+=1
        ans = max(ans,tmp)
        tmp = 0
    print(len_t-ans)
# Judge status: Accepted
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
N = int(input())
A = list(map(int, input().split()))

min_ = min(A)
cnt = 0
odd = 0
for a in A:
    if a %min_ == 0:
        cnt += 1
    if a%2 != 0:
        odd = 1

if cnt == N:
    print(A[0])
    exit()
if odd == 0:
    print(2)
elif odd == 1:
    print(1)
# Judge status: Accepted
import itertools


n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

permu_dict = list(itertools.permutations([i for i in range(1, n+1)]))
permu_dict = sorted(permu_dict)

print(abs(permu_dict.index(p)-permu_dict.index(q)))
# Judge status: Accepted
n,q = map(int,input().split())
s = str(input())
a = [0]
for i in range(1,n):
    if s[i-1] == "A" and s[i] == "C":
        a.append(a[-1]+1)
    else:
        a.append(a[-1])
for j in range(q):
    u,t = map(int,input().split())
    print(a[t-1]-a[u-1])
# Judge status: Accepted
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
import fractions
#from scipy.misc import comb

N = int(input())
T = [int(input()) for i in range(N)]

ans = T[0]
for t in T:
    ans = ans*t//fractions.gcd(ans,t)

print(ans)
# Judge status: Accepted
S = input()
a = 'Sunny'
b = 'Cloudy'
c = 'Rainy'

if S == a:
    print(b)
elif S == b:
    print(c)
else:
    print(a)
# Judge status: Accepted
import collections
n = int(input())
a = list(map(int, input().split()))

a_mod = list(map(lambda x:x%4, a))
c = collections.Counter(a_mod)

if c[2] == 0 and c[0] +1 == c[1] + c[3]:
  print("Yes")
elif c[0] >= c[1] + c[3]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n,m = map(int, input().split())

ans = 0
if n*2 <= m:
  ans += n
  m -= n*2
else:
  ans += m//2

if m >= 4:
  ans += m // 4
  
print(ans)
# Judge status: Accepted
N,W = map(int, input().split())
v = []
w = []
for i in range(N):
    a,b = map(int,input().split())
    w.append(a)
    v.append(b)

dp = [[0 for i in range(W+1)] for j in range(N+1)]

for j in range(N):
    for i in range(W):
        dp[j+1][i] = max(dp[j][i],dp[j+1][i])
        if i+w[j] <= W:
            dp[j+1][i+w[j]] = max(dp[j+1][i+w[j]],dp[j][i]+v[j])
        
print(max([max(item) for item in dp]))
# Judge status: Accepted
N,M=map(int,input().split())
R=[0]*(M-1)
L=list(map(int,input().split()))
L=sorted(L)
for i in range(M-1):
  R[i]=abs(L[i+1]-L[i])
c=max(L)-min(L)
R=sorted(R,reverse=True)
print(c-sum(R[:min(N-1,len(R))]))