peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
t=list(input())
pre_p=False
for i,tt in enumerate(t):
  if tt == 'P':
    pre_p=True
  elif tt == 'D':
    pre_p=False
  elif pre_p:
    t[i] = 'D'
  elif i < len(t)-1:
    if t[i+1] == 'D':
      t[i] = 'P'
    else:
      t[i] = 'D'
  else:
    t[i] = 'D'
    
print(''.join(t))
# Judge status: Accepted
n = int(input())
s = list(map(int, input().split()))

res = 10**9
for i in range(1,n):
    a = sum(s[:i])
    b = sum(s[i:])
    res = min(res, abs(a-b))
print(res)
# Judge status: Accepted
w,h,x,y = map(int, input().split())
if (x,y) == (w/2, h/2): print(w*h/2, 1)
else: print(w*h/2, 0)
# Judge status: Wrong Answer
import numpy as np

N=int(input())
A=np.array([int(x) for x in input().split()])

ans=0
M=pow(10,9)+7
for i in range(100):
  one=np.sum((A>>i)&1)
  zero=N-one
  ans+=(one*zero)*pow(2,i)
  ans%=M
  #print(one,zero)
print(int(ans))
# Judge status: Accepted
a=input()
b=input()
la,lb = len(a), len(b)
if a==b:
    print('No')
elif (la< lb and set(a)==set(b)):
    print('Yes')
else:
    sa = sorted(a)
    sb = sorted(b, reverse = True)
    if (sa[:lb] < sb):
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
def main():
    n,c,k=map(int,input().split())
    t=[]
    for i in range(n):
        ti=int(input())
        t.append(ti)
    t.sort()
    ans=0
    i=0
    while i<n:
        j=1
        while j<c and i+j<n:
            if t[i+j]>t[i]+k:
                break
            j+=1
        ans+=1
        i+=j
    print(ans)
if __name__=="__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
t, a = map(int,input().split())
min = 10000

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

for i in range(n):
    if(min > a - (t - h[i]*0.006)):
        min = a - (t - h[i]*0.006)
        ans = i+1

print(ans)
# Judge status: Accepted
n = int(input())
if n % 111 == 0:
    x = n
while n % 111 != 0:
    x = n+1
    n += 1

print(x)
# Judge status: Accepted
import heapq

n, m = map(int, input().split())
ab = []
for i in range(n):
    ab.append(list(map(int, input().split())))
ab.sort()
ans = 0
num = 0
queue = []
heapq.heapify(queue)
for i in range(1, m + 1):
    if num < n:
        while ab[num][0] <= i:
            heapq.heappush(queue, [-ab[num][1], ab[num][0]])
            num += 1
            if num == n:
                break
    if len(queue):
        temp = heapq.heappop(queue)
        ans += -temp[0]
print(ans)
# Judge status: Wrong Answer
x = list(map(int,input().split()))

zero = 0
for i in range(5):
    if x[i] == 0:
        zero += 1

print(zero)
# Judge status: Accepted

ns=input()

for i in range(2**(len(ns))):
    ops=["+"]*(len(ns)-1)
    for j in range(len(ops)):
        if((i>>j)&1):
            ops[j]="-"
            
    siki=""
    for x,y in zip(ns,ops+[""]):
        siki+=x+y
        
    if eval(siki)==7:
        print(siki+"=7")
        break
# Judge status: Accepted
A = sorted([int(input()) for _ in range(5)])
k = int(input())
print('Yay!' if A[4]-A[0] <= k else ':(')
# Judge status: Wrong Answer
a,b,c,k = map(int, input().split())

if a >= k:
  an = k
  bn = 0
  cn = 0
elif a+b >= k:
  an = a
  bn = k - (a)
  cn = 0
else:
  an = a
  bn = b
  cn = k - (a+b+c)
  
print(an-cn)
# Judge status: Wrong Answer
import re
text = input()
b_length = int(re.sub('B', '', text))
for _ in range(b_length):
    text = re.sub('(0|1)??B', '', text, 1)
print(text)
# Judge status: Accepted
def main():
    k = int(input())
    if k % 2 == 0:
        even = k // 2
        odd = even
    else:
        even = k // 2
        odd = k - even

    print(even * odd)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
S = list(input())
N = int(input())

'''
ordの位置
#z = 122
#a = 97
左の文字からNで'a'に出来るかを確認
aに出来るならaにして使った分をNから引く
繰り返して行き一番最後にあまりをすべて使う'''
  
for i, s in enumerate(S):
  if ord(s) - 97 > 0  and 122 - ord(s) < N:
    S[i] = "a"
    N -= 123 - ord(s)
else:
  print(chr(ord(S[i]) + N % 122 ))
  
  
print("".join(S))
# Judge status: Accepted
#入力
S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())

#出力
if S == U:
    print( A-1,B )
else:
    print( A, B-1 )
# Judge status: Accepted
from heapq import heappop,heappush
n,m=map(int,input().split())
L=[[] for _ in range(m)]
for _ in range(n):
  a,b=map(int,input().split())
  if a<=m:
    L[m-a].append(b)
s=0
h=[]
for i in range(m-1,-1,-1):
  for l in L[i][::-1]:
    heappush(h,-l)
  if len(h)>0:
    s-=heappop(h)
print(s)
# Judge status: Accepted
import re
n = input()

if re.search(r'(\d)\1{2,}', n):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())

x = len(str(n))

ans = 0

if x%2 == 0:
    for i in range(1,x+1,2):
        ans += 10**i*(9/10)
else:
    for i in range(1,x,2):
        ans += 10**i*(9/10)
    ans += n-10**(x-1)+1
    
print(int(ans))
# Judge status: Accepted
#AGC031 A Colorful Subsequence
# Answer
N = int(input())
S = input()
alpha = [0]*26
mod = 10**9+7

for n in S:
    num = ord(n)-97
    alpha[num] += 1
    
ans = 1
for i in range(26):
    ans *= (alpha[i]+1)

# ans %= mod
print((ans-1)%mod)
# Judge status: Wrong Answer
n=int(input())
import itertools
a=list(map(int,input().split()))
s=0

for i in itertools.combinations(a,2):
    if i[0]==i[1]:
        continue
    else:
        s+=i[0]*i[1]

print(s%(10**9+7))
# Judge status: Accepted
s=input()
l=len(s)
a=[0 for i in range(l+1)]
for i in range(l):
    if s[i]=='<':
        a[i+1]=max(a[i+1],a[i]+1)
        #print(a)
for i in range(l-1,-1,-1):
    if s[i]=='>':
        a[i]=max(a[i+1]+1,a[i])
        #print(a)
print(sum(a))
# Judge status: Wrong Answer
S = input()

print('Heisei' if S <= '2019/4/30' else "TBD")
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
num = N // (A + B) * A
num += N % (A + B)
print(num)
# Judge status: Accepted
S = str(input())
if S == 'ABC':
    print('ARC')
elif S == 'ARC':
    print('ABC')
# Judge status: Wrong Answer
s,t = map(str, input().split())
print(s+t)
# Judge status: Accepted
s = input()
hitachi = 'hi'
l = len(s) // 2
print('Yes' if hitachi*l == s else 'No')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
S = sum(a)
sum =[0]*n
sum[0] = a[0]
su =0
ar =0

min = 10**20

for i in range(1,n):
    sum[i] = sum[i-1] + a[i]
    su = sum[i-1]
    ar = S - su
    if abs(su-ar) < min:
        min = abs(su-ar)

print(min)
# Judge status: Accepted
N = int(input())
S = sorted([int(input()) for _ in range(N)])
sumofS = sum(S)
if sumofS % 10 != 0:
    print(sumofS)
    quit()

for s in S:
    if s % 10 != 0:
        print(sumofS-s)
        quit()

print(0)
# Judge status: Wrong Answer
from math import ceil

A, B, C, D = map(int, input().split())


Cdiff = ceil(B/C) - ceil((A-1)/C)
Ddiff = ceil(B/D) - ceil((A-1)/D)

CDdiff = ceil(B/(C*D) ) - ceil((A-1)/(C*D))

res = Cdiff+Ddiff-CDdiff
print((B-A)-res)
# Judge status: Wrong Answer
import math
X = int(input())
m = math.sqrt(X * 2)
if int(m) * (int(m) + 1) == X * 2:
  print(int(m))
else:
  print(math.ceil(m))
# Judge status: Accepted
import fractions
N = int(input())
A = list(map(int, input().split()))

DP_first = [0] * N
DP_last = [0] * N

DP_first[0] = A[0]
DP_last[0] = A[-1]

for i in range(1, N):
    DP_first[i] = fractions.gcd(DP_first[i-1], A[i])
    DP_last[i] = fractions.gcd(DP_last[i-1], A[-1-i])

ans = max(DP_first[N-2], DP_last[N-2])
for i in range(1, N-1):
    ans = max(ans, fractions.gcd(DP_first[i-1], DP_last[N-2-i]))
print(ans)
# Judge status: Wrong Answer
from math import tan, atan2, pi, degrees


def f(theta):
    if theta < thres:
        return V - a ** 3 * tan(theta) / 2
    else:
        return a * b * b / tan(theta) / 2


eps = 1e-7
a, b, x = map(int, input().split())
V = a * a * b
thres = atan2(b, a)

bad, good = pi / 2, 0
while bad - good > eps:
    mid = (bad + good) / 2
    if f(mid) >= x:
        good = mid
    else:
        bad = mid
print(degrees(good))
# Judge status: Accepted
s = list(input())
t = list(input())

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

if ("".join(s) < "".join(t)):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from sys import stdin
from collections import defaultdict as dd
from collections import deque as dq
import itertools as it
from math import sqrt, log, log2
from fractions import Fraction

a = input()
print(a.swapcase())
# Judge status: Accepted
#!/usr/bin/env python3

A, B, K = list(map(int, input().split()))
nokori = K
if A > 0:
    if K <= A:
        nokori = 0
        A = A - K
    else:
        nokori = K - A
        A = 0
if nokori > 0 and B > 0:
    if nokori <= B:
        B = B - nokori
        nokori = 0
    else:
        nokori -= B
        B = 0

ans = "{} {}".format(A, B)

print(ans)
# Judge status: Wrong Answer
N = int(input())
S = input()
ans=0
for i in range(1,N-1):
  for j in range(i+1,N):
    for k in range(j+1,N+1):
      if S[i-1] != S[j-1] and S[i-1] != S[k-1] and S[j-1] != S[k-1]:
        ans+=1
print(ans)
# Judge status: Accepted
N,R = map(int,input().split())
if N>=10:
  Ans = R
else:
  Ans = R+100*(10-N)
print(Ans)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())

if abs(a-b) <= d and abs(b-c) <= d:
  print("Yes")
print("No")
# Judge status: Wrong Answer
N,M=map(int,input().split())
AC=WA=[0] * (N + 1)
cnt_AC=cnt_WA=0

for i in range(M):
  p,s=input().split()
  p=int(p)
  if AC[p]==0:
    if s=='WA':
      cnt_WA+=1
    if s=='AC':
      AC[p]=1
cnt_AC=sum(AC)
print(cnt_AC,cnt_WA)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
a = A[0]
for i in range(1,N) :
    a = a*A[i]
    if a > 10**18:
        print(-1)
        break 
    else :
        continue 
        print(a)
# Judge status: Wrong Answer
n = int(input())

a = 2
b = n - 2

def sum_dig(dig):
    dig = str(dig)
    soma = 0
    for d in dig:
        soma += int(d)

    return soma

st = 0
if(n != 2):
    menor_s = 10^5
else:
    menor_s = 2
while(a < b):
    st = sum_dig(a) + sum_dig(b)
    if(st < menor_s):
        menor_s = st

    a += 1
    b -= 1

print(menor_s)
# Judge status: Accepted
N = int(input())
input_array = list(map(int, input().split()))

upper = False
lower = False
res = 1
for i in range(len(input_array) - 1):
    if input_array[i] == input_array[i + 1]:
        continue
    elif input_array[i] < input_array[i + 1]:
        upper = True
    else:
        lower = True

    if upper is True and lower is True:
        res += 1
        upper = False
        lower = False

print(res)
# Judge status: Accepted
#ABC132 A

S = str(input())
T = [S[0],S[1],S[2],S[3]]
T.sort()
if T[0] == T[1] and T[2] == T[3] and T[1] != T[2]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n , m = map(int,input().split())
arr = list(map(int,input().split()))
add = sum(arr)
miniVotes = add/(4*m)
cnt = 0
for i in range(len(arr)):
	if arr[i]>=miniVotes:
		cnt+=1
if(cnt>=m):
	print("Yes")
else:
	print("No")
# Judge status: Accepted
def main():
    x=list(map(int,input().split()))
    for i in range(5):
        if x[i] == 0:
            print(i+1)
main()
# Judge status: Accepted
N,M=map(int,input().split())
ac=[0]*N
wa=[0]*N

for i in range(M):
  p,s=input().split()
  if s=="WA" and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac[int(p)-1]==0:
    ac[int(p)-1]+=1

penalty=[wa[k] for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" % (sum(ac),sum(penalty)))
# Judge status: Wrong Answer
a,b=map(int,input().split())
print("Yes" if a==b else "Np")
# Judge status: Accepted

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

if sum(A) > N:
    print(-1)
else:
    print(N - sum(A))
# Judge status: Wrong Answer
NM = list(map(int, input().split()))
N = NM[0]
M = NM[1]
sc = []
for i in range(M):
    addList = list(map(int, input().split()))
    sc.append(addList)
a = 10**(N-1)
while a < 10**N:
    j = str(a)
    bingo = True
    for l in sc:
        if int(j[l[0]-1]) != l[1]:
            bingo = False
    if bingo:
        break
    else:
        a += 1
if a == 10**N and bingo == False:
    print(-1)
else:
    print(a)
# Judge status: Accepted
T = sorted(list(map(int,input().split())))
print(T[0]+T[1])
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
answer = 10 ** 15
for i in range(-100,101):
    tmp = 0
    for m in A:
        tmp += (m-i) ** 2
    answer = min(answer, tmp)
print(answer)
# Judge status: Accepted
k = int(input())
a, b = map(int, input().split())

for i in range(a, b+1):
    if i % k == 0:
        print('OK')
        exit()
print('NG')
# Judge status: Wrong Answer
n = int(input())
a = []
b = []
for i in range(n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)
a = a[::-1]
b = b[::-1]

ans = 0
tmp = 0
for i in range(n):
    if b[i]==1:
        continue
    else:
        t = (a[i]+ans) % b[i]
        ans += b[i]-t

print(ans)
# Judge status: Accepted
X = int(input())
money = 100
for i in range(10**12):
    money = int(money * 1.01)
    if money >= X:
        print(i+1)
        break
# Judge status: Wrong Answer
import collections

c = collections.Counter(list(map(int, list(input()))))
print("Yes" if(c.most_common()[0][1] >= 3) else "No")
# Judge status: Accepted
n, k, x = map(int,input().split())
if n == 0:
  print(k//x + 1)
else:
  if n%x == 0:
    print(k//x - n//x + 1)
  else:
    print(k//x - n//x)
# Judge status: Wrong Answer
n,m = map(int,input().split())
if abs(n-m) > 1:
  print(0)
elif n == m:
  cnt = 1
  for i in range(2,n+1):
    cnt *= i
  print((cnt**2)*2 % 1000000007)
else:
  a = max(n,m)
  cnt = 1
  for i in range(2,a+1):
    cnt *= i
  b = min(n,m)
  cnt2 = 1
  for i in range(2,b+1):
    cnt2 *= i
  print(cnt*cnt2 % 100000007)
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
A=[0]*(N+1)
B=sum(a)
for i in range(N):
  A[i+1]=A[i]+a[i]
t=10**15
for i in range(1,N):
  t=min(t,abs(2*A[i]-B))
print(t)
# Judge status: Wrong Answer
s=input()
c=0
ans=0
for i in range(len(s)):
  if(s[i]=='R'):
    c+=1
  else:
    ans=max(ans,c)
if(c):    
  ans=max(ans,c)
print(ans)
# Judge status: Wrong Answer
input()
num_list = list(map(int, input().split()))
max_cnt = 0
for num in num_list:
  num_cnt = 0
  while True:
    if num % 2 == 1:
      if num_cnt > max_cnt: max_cnt = num_cnt
      break
    else:
      num = num / 2
      num_cnt += 1
print(max_cnt)
# 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
# 入力 : a b c
a, b, c = map(int, input().split())

# ペンキの色の種類の個数を出力せよ。
set = {a,b,c}
print(len(set))
# Judge status: Accepted
import sys
input = sys.stdin.readline
from heapq import heappush
N, M = map(int, input().split())
H = list(map(int, input().split()))
x = [True] * N
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if H[a] == H[b]:
        x[a] = False
        x[b] = False
    elif H[a] > H[b]:
        x[b] = False
    else:
        x[a] = False
ans = 0
for i in range(N):
    if x[i]:
        ans += 1
print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    p = list(map(int, input().split()))

    diff = 0
    for i in range(N):
        if (i+1) != p[i]:
            diff += 1
    if (diff == 2) | (diff == 0):
        return "YES"
    return "NO"
if __name__ == '__main__':
    print(main())
# Judge status: Wrong Answer
n = input()
int_n = int(n)

sum = 9
for i in range(1,len(n),1):
  if i%2 == 0:
    if i == (len(n)-1):
      sum += int_n - int("9"*i)
    else:
      sum += int("9"*(i+1)) - int("9"*i)
      
print(sum)
# Judge status: Accepted
A,B,C,K=list(map(int,input().split()))
if A+B>=K:
    if A>K:
        print(K)
    else:
        print(A)
else:
    F=K-(A+B)
    print(A-F)
# Judge status: Accepted
N = int(input())
a = [int(input()) - 1 for _ in range(N)]
seen = [0] * N
seen[0] = 1
i = 0
ans = 1
while a[i] != 1:
    i = a[i]
    if not seen[i]:
        ans += 1
        seen[i] = 1
    else:
        break
else:
    print(ans)
    exit()
print(-1)
# Judge status: Accepted
N = int(input())

ans = 0

for n in range(1, N+1, 2):
    c = 0
    for i in range(1, n+1):
        if n % i == 0:
            c += 1

    if c == 8:
        ans += 1

print(ans)
# Judge status: Accepted
N,A = (int(input()) for i in range(2))
 
B = N % 500

if B <= A:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
S = ""
#素因数分解
while N:
    if N%(-2) == 0:
        S = "0"+S
    else:
        S = "1"+S
        #余りとなった部分を引く
        N -= 1
    N = N/(-2)

if S=="":
    S="0"

print(S)
# Judge status: Accepted
import sys

N = int(sys.stdin.readline().strip())

data = []
for _ in range(N):
    a, b = map(int, sys.stdin.readline().strip().split())
    data.append((a, b))

ans = 0
adds = 0
for i in range(N):
    a, b = data[N-1-i]
    a += adds
    r = (a - 1) // b
    target = b * (r + 1)
    tmp = target - a
    ans += tmp
    adds += tmp

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

ok = 1

while ok:
    for i in range(2,ans+1):
        if ans % i == 0:
            ok = 0
    if ok == 0:
        print(ans)
    else:
        ans+=1
# Judge status: Wrong Answer
def run_length(s) -> list:
  res = [[s[0], 1]]
  for i in range(1, len(s)):
    if res[-1][0] == s[i]:
      res[-1][1] += 1
    else:
      res.append([s[i], 1])
  return res

N, K = map(int, input().split())
S = input()

RL = run_length(S)

tmp = 0
for r, l in RL:
  tmp += l - 1

if K >= len(RL) - 2:
  answer = N - 1
else:
  answer = tmp + K * 2
  
print(answer)
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))
ans=0

for i in range(N):
    for j in range(N):
        for k in range(N):
            a,b,c=L[i],L[j],L[k]
            if i<j<k and a!=b and b!=c and c!=a:
                if a+b>c and b+c>a and c+a>b:
                    ans+=1
                    #print(a,b,c)

print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

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

l = a[0]
for x in a:
    l = lcm(l, x)

law = 10 ** 9 + 7
ans = 0
for x in a:
    ans += l // x
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
s = [0]
for i in range(n):
    s.append(a[i]+s[i])
m = 100000000000000
for i in range(len(s)):
	m = min(m, abs((s[i] - s[0]) - (s[len(s) - 1] - s[i])))
print(m)
# Judge status: Wrong Answer
import sys
# input=sys.stdin.readline

val = input()

array = val.split(' ')
a = array[0]*500

if a<array[1]:
    print("Yes")
else:
    print("No")

sys.exit()
# Judge status: Wrong Answer
A, B, K = map(int, input().split())

if abs(A - B) >= 2 * K:
  for i in range(K):
    print(A + i)
  for j in range(K):
    print(B - j)
else:
  for k in range(A, B+1):    
    print(k)
# Judge status: Wrong Answer
s=input()
t=input()
d=dict(zip(s, t))
judge=0
for i in d:
    for j in d:
        """if d[i]==j:
            if i!=d[j]:
                judge+=1"""
        if i==j:
            judge+=1
        if d[i]==d[j]:
            judge+=1    
if judge==0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s = int(input())

table = [1, 0, 0]
for i in range(s):
  table.append(table[i]+table[i+2])
print(table[s])
# Judge status: Accepted
def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    XL = []
    for i in range(N):
        x, l = map(int, input().split())
        XL.append((x, l))
    XL.sort(key=lambda p: p[1] + p[0])

    ans = 0
    prev = -10**10
    for i in range(N):
        x, l = XL[i]
        if x - l >= prev:
            ans += 1
            prev = x + l
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import numpy as np
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
h=np.array(H)
a=np.zeros(N)
t=np.zeros(N)
res=0
for i in range(N):
  t[i]=T
for j in range(N):
  a[j]=A
s=(t-(a-0.006*h))**2
c=sorted(s)
for k in range(N):
  if s[k]==c[0]:
    res=k+1
print(res)
# Judge status: Accepted
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  count = 0
  for i in range(1, n+1):
    if len(str(i)) % 2 == 1:
      count += 1
  print(count)

if __name__=='__main__':
  main()
# Judge status: Wrong Answer
import sys
N,M,X,Y = map(int,input().split())
x =  list(map(int,input().split()))
y =  list(map(int,input().split()))

for Z in range(X+1,Y+1):
    if max(x) >= Z and Z <= min(y):
        print("No War")
        sys.exit()
print('War')
# Judge status: Accepted
import bisect, collections

n = int(input())
num = collections.deque([])
for i in range(n):
    a = int(input())
    temp = bisect.bisect_left(num, a)
    if temp == 0:
        num.appendleft(a)
    else:
        num[temp - 1] = a
print(len(num))
# Judge status: Wrong Answer
s = print()
if s == "ABC":
    print("ARC")
else:
    print("ABC")
# Judge status: Wrong Answer
a = list(input())
b = list(input())

def big(a,b):
    if a > b:
        return a
    else:
        return b

def plus(a,b):
    c = a[i]
    d = b[i]
    return c+d

e = ""
for i in range(len(big(a,b))):
    e += plus(a,b)

print(e)
# Judge status: Wrong Answer
# coding: utf-8
# Your code here!
n = int(input())
l = list(map(int, input().split()))
m = sum(l)
a = 0
for i in range(n):
    if l[i] >= m - l[i]:
        print("NO")
        a = 1
        break
if a == 0:
    print("YES")
# Judge status: Accepted
s=input()
n=len(s)
print('x'*n)
# Judge status: Wrong Answer

def getDivCount( a, b, x ):
    count=0
    if a==0 :
        count+=1

    if a<=x :
        ai = x
    else:
        ai = (a//x)*x
        if ai<a :
            ai +=x
    if ai<=b :
        count+=1
        count+=(b-ai)//x
    return count

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

count = b-a+1
count -= getDivCount(a,b,c)
if c!=d :
    count -= getDivCount(a,b,d)
    count += getDivCount(a,b,c*d)
print(count)
# Judge status: Wrong Answer
import fractions

def a(A, B):
    C = fractions.gcd(A, B)
    return (A * B)/C

N = int(input())

T = []

for _ in range(N):
    T.append(int(input()))

T = sorted(T)
C = T[0]

if N > 1:
    for i in range(1, N):
        C = a(C, T[i])
print(C)
# Judge status: Accepted
N = int(input())
v = list(map(int, input().split()))
v = sorted(v)
ans = v[0]
for i in v[1:]:
    ans = (ans + i) / 2
print(ans)
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
A = []
maximum = 0
minimum = float('inf')
count = 0
for i in range(N):
    a = int(input())
    A.append(a)
    maximum = max(maximum,a)
    if a <= minimum:
        minimum = a
        count += 1
c = Counter(A)
print(max(count,max(c.values())))
# Judge status: Wrong Answer
n=int(input())
s=input()
count = 0
for i in range(n-1):
  a=s[:i + 1]
  b=s[i+1:]
  temp = 0
  for j in range(26):
    if chr(96+j) in a and chr(96+j) in b:
      temp += 1
  count = max(temp, count)
print(count)
# Judge status: Accepted
_,k,*a=map(int,open(0).read().split());a=[0]+a;p=1
while k:p=~-k%2*p or a[p];a=[a[b]for b in a];k//=2
print(p)
# Judge status: Accepted
a, b, c, x, y = map(int, input().split())

num = min(a + b, c * 2)
a = min(a, c * 2)
b = min(b, c * 2)
s = min(x, y)

if x > y:
    print(num * s + a * (x - s))
else:
    print(num * s + b * (y - s))
# Judge status: Accepted
from itertools import combinations
n,m,q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]

ans = 0
for case in combinations([i for i in range(1,n+m)],n):
    now = 0
    A = [x-i for i,x in enumerate(case)]
    for i in range(q):
        a,b,c,d = abcd[i]
        if A[b-1]-A[a-1] == c:
            now += d
    ans = max(now,ans)

print(ans)
# Judge status: Accepted
s = input()
t = input()
ans = "No"
for _ in range(len(s)+1):
    s = s[-1] + s[:-1]
    if s == t:
        ans = "Yes"
        break
print(ans)
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a>12:
    print(b)
elif a>5:
    print(b/2)
else:
    print(0)
# Judge status: Wrong Answer
import sys
import fractions
sys.setrecursionlimit(200000000)

N = int(input())
NUMS = [int(input()) for _ in range(N)]
NUMS = list(set(NUMS))

def gcd(num1, num2):
    if num2 == 0:
        return num1
    else:
        return gcd(num2, num1 % num2)


res = NUMS[0]
for num in NUMS[1:]:
    res = res * num / max(fractions.gcd(res, num), 1)

print(int(res))
# Judge status: Wrong Answer
S='coffee'
a=S[2]
b=S[3]
c=S[4]
d=S[5]
if  a == b and c == d:
    print("yes")
else:
    print("no")