peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
arr = list(map(int,input().strip().split(" ")))

dp = [0]*n
dp[0] = 0
dp[1] = abs(arr[0]-arr[1])
for i in range(2,n):
    p = abs(arr[i]-arr[i-1])
    q = abs(arr[i]-arr[i-2])
    dp[i] = min(p+dp[i-1],q+dp[i-2])
print(dp[n-1])
# Judge status: Accepted
a,b,c,d=map(int,input().split())
print('Yes' if (a+d-1)//d >= (c+b-1)//b else 'No')
# Judge status: Wrong Answer

h,a = map(int,input().split())
print((h//a)+1)
# Judge status: Wrong Answer
s = input()
for i in range(97, 114+1):
    if s.find(chr(i)) == -1:
        print(chr(i))
        exit()
    
print('None')
# Judge status: Accepted
N = int(input())

moneylist = [1]

money = 6

while money < 100000:
    moneylist.append(money)
    money = money*6

money = 9    

while money < 100000:
    moneylist.append(money)
    money = money*9
moneylist.sort()

dp = [10**6]*(N+1)
dp[0] = 0

for i in range(1,N+1): #お金
    for j in moneylist: #使えるお金
        if j <= i:
            dp[i] = min(dp[i],dp[i-j] + 1)
        
print(dp[-1])
# Judge status: Wrong Answer
mod = 10**9+7
n = int(input())
A = list(map(int,input().split()))
from collections import defaultdict
zero = defaultdict(int)
one = defaultdict(int)
for a in A:
    for i in range(60):
        if a &(1<<i):
            one[i] += 1
        else:
            zero[i] += 1
ans = 0
for a in A:
    for i in range(60):
        if a &(1<<i):
            ans += pow(2,i,mod)*zero[i]
        else:
            ans += pow(2,i,mod)*one[i]
        ans %= mod
print((ans//2)%mod)
# Judge status: Accepted
# A - Multiple Array
import numpy as np

N = int(input())
A = np.zeros(N, dtype=int)
B = np.zeros(N, dtype=int)
ans = 0

for i in range(N):
    A[i], B[i] = map(int, input().split())
for i in range(1,N+1):
    tmp = -(A[N-i] + ans) % B[N-i]
    ans += tmp
    
print(ans)
# 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
import math
A, B, H, M = map(int, input().split())
m = H*60 + M
a_rad = m / (60 * 12) * math.pi * 2
b_rad = M / 60 * math.pi * 2
ans = (A*A + B*B - 2*A*B*math.cos(a_rad-b_rad))**0.5
print(ans)
# Judge status: Wrong Answer
A,B = map(int,input().split())
print(A*B) if A >=9 and B >=9 else print('-1')
# Judge status: Accepted
S = input()
Q = int(input())

dir_changed = False
hd, ta = [], []

for _ in range(Q):
  A = list(input().split())
  if A == ["1"]:
    dir_changed = not dir_changed
    hd, ta = ta, hd
    continue
  F, C = int(A[1]), A[2]
  #if dir_changed:
  #  F = 3-F
  if F == 1:
    hd.append(C)
  else:
    ta.append(C)
    
if dir_changed:
  S = S[::-1]
print("".join(hd[::-1]) + S + "".join(ta))
# Judge status: Accepted
# coding: utf-8
import string

n = list(map(int,input().split()))
print(n[0]*n[1])
# Judge status: Accepted
s = input()

s = s.replace("eraser", "")
s = s.replace("erase", "")
s = s.replace("dreamer", "")
s = s.replace("dream", "")

if len(s) == 0:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
if 0 <= a and 0 <= c:
    print(b*d)
elif 0 <= a and d <= 0:
    print(a*d)
elif b <= 0 and 0 <= c:
    print(b*c)
elif b <= 0 and d <= 0:
    print(a * c)
# Judge status: Accepted
N=int(input())
ans=0
tmp=0
for i in range(N):
   s=int(input())
   if s!=0:
      tmp+=s
   else:
      ans+=tmp//2
      tmp=0
ans+=tmp//2
print(ans)
# Judge status: Wrong Answer
x= list(map(int, input().strip().split()))
for i in range(len(x)):
  if x[i]==3:
    print(i+1)
    break
# Judge status: Accepted
x = list(map(int,input().split()))
ans = x.index(0) + 1
print(ans)
# Judge status: Accepted
def gcd(x, y):
    x, y = max(x, y), min(x, y)
    while x % y > 0:
        x, y = y, x % y
    return y

A, B = list(map(int, input().split()))
g = gcd(A, B)
answer = int(A*B/g)
print(answer)
# Judge status: Accepted
a, v1 = map(int, input().split())
b, v2 = map(int, input().split())
t = int(input())
l = abs(a-b)
delta_v = v1-v2
if delta_v <= 0:
  print("NO")
  exit()

if delta_v * t >= l:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
def main():
  A,B,C = list(map(int, input().split()))

  ans = "NO"

  for i in range(1, B+1):
    if((A * i) % B == C):
      ans = "YES"
      break

  print(ans)

if __name__ == "__main__":
  main()
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())

print((a+b)*c//2)
# Judge status: Wrong Answer
N,Q = list(map(int,input().split()))
S = input()
lr = [list(map(int,input().split())) for i in range(Q)]

count = 0
countList = [0 for i in range(N)]
for i in range(1, N):
    if S[i - 1] == 'A' and S[i] == 'C':
        count += 1
    countList[i] = count

print(countList)

for i in range(Q):
    l = lr[i][0]
    r = lr[i][1]
    lCount = countList[l - 1]
    rCount = countList[r - 1]
    print(rCount - lCount)
# Judge status: Accepted
a, b, c = map(int, input().split())
count = 0
if a % 2 == 0 and a == b == c:
    print(-1)
    exit()

while a % 2 == 0 | b % 2 == 0 | c % 2 == 0:
    A = int((b + c) / 2)
    B = int((c + a) / 2)
    C = int((a + b) / 2)
    a = A
    b = B
    c = C
    count += 1
print(count)
# Judge status: Wrong Answer
def main():
	a,b,k = map(int, input().split())
	if k <= a:
		a = k-a
	else:
		if k-a <= b:
			b = b - (k-a)
			a=0
		else:
			a = 0
			b = 0
	print(a,b)

if __name__ == '__main__':
	main()
# Judge status: Accepted
s=input()
cnt=[0]*3
ans="YES"
for i in range(len(s)):
    cnt[ord(s[i])-97]+=1
if max(cnt)-min(cnt)>=2:
    ans="NO"
print(ans)
# Judge status: Accepted
N = int(input().strip())

map = {i: {j: 0 for j in range(1, 10)} for i in range(1, 10)}

div = 1
for n in range(1, N + 1):
  h = n // div
  if h >= 10:
    div *= 10
    h = n // div
  t = n % 10
  if t == 0:
    continue
  map[h][t] += 1

total = 0
for i in range(1, 10):
  for j in range(1, 10):
    total += map[i][j] * map[j][i]

print(total)
# Judge status: Accepted
N, X, T = map(int, input().split())

import math

ans = math.ceil(N/X)*T
print(ans)
# Judge status: Accepted
W, H, x, y = map(int, input().split())

print(W * H / 2, int(x == W / 2 and y == H / 2))
# Judge status: Accepted
n=input()
if "7" in n:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n, m = map(int, input().split())
li = []
for i in range(int(m**0.5) + 1, 0, -1):
    if m%i==0:
        li.append(i)
for i in li:
    if i <= m//n:
        print(i)
        exit()
# Judge status: Accepted
N = int(input())
ans = "Yes"
i = 0
while i < N:
    t,x,y = [int(num) for num in input().split()]
    if x+y <= t and (t-x-y)%2 == 0:
        i += 1
    else:
        ans = "No"
        break
print(ans)
# Judge status: Accepted
X,Y = map(int, input().split())
print(int(X+(Y/2)))
# Judge status: Accepted
hand = [input() for _ in range(3)]
pos = [0 for i in range(3)]

turn = 0
d = {c:i for i,c in enumerate('abc')}
while pos[turn] < len(hand[turn]):
    pos[turn], turn = pos[turn] + 1, d[hand[turn][pos[turn]]]
print('ABC'[turn])
# Judge status: Wrong Answer
import collections
N = int(input())
A = list(map(int, input().split()))
edge = collections.Counter(A)
a = 0
b = 0
for i in sorted(edge.items()):
    if i[1] >= 2:
        if i[0] > a:
            b = a
            a = i[0]

print(a * b)
# Judge status: Accepted
a = input()
b = input()

# print(a)
# print(b)
# c = 6-a-b
# print(c)
c = int(a)
d = int(b)
e = 6-c-d
print(e)
# Judge status: Accepted
A,B,C=list(map(int,input().split()))
K=int(input())
m=max([A,B,C])
k=m
for i in range(1,K+1):
    k=k*2
print(sum([A,B,C])-m+k)
# Judge status: Accepted
def gcd(n,m):return gcd(m,n%m) if m and n else n+m
n=int(input())
h=list(map(int,input().split()))
l=[0]*n
r=[0]*n
a,s=0,0
for i in range(n):
  l[i]=a
  a=gcd(a,h[i])
  r[-i-1]=s
  s=gcd(s,h[-i-1])
ans=1
for i in range(n):
  ans=max(ans,gcd(l[i],r[i]))
print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
road = ""

for _ in range(m):
    a, b = map(str, input().split())
    road += a + b
print(road)
for i in range(n):
    print(int(road.count(str(i+1))))
# Judge status: Wrong Answer
from copy import deepcopy


def main():
    n = int(input())
    x = list(map(int, input().split()))
    y = deepcopy(x)
    y.sort()
    median = y[n // 2]
    next_median = y[n // 2 - 1]
    for xx in x:
        if xx == median:
            print(next_median)
        else:
            print(median)


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

now = [0, 0]
for i in range(N):
  t, x, y = map(int, input().split())
  time = abs(x - now[0]) + abs(y - now[1])
  if t >= time and (t - time)%2==0:
    continue
  print('No')
  quit()

print('Yes')
# Judge status: Accepted
n, a, b = map(int, input().split())
c = n // (a+b)
d = n % (a+b)
if d > a:
    d = a
print(c*a+d)
# Judge status: Accepted
S=input()
S=str(S)
a=len(S)
if a==6:
    if S[2]==S[3]:
        if S[4]==S[5]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if (a==b==c):
  print(-1)
elif (a%2==1 or b%2==1 or c%2==1):
  print(0)
else:
  for i in range(1,10**9):
    a,b,c=(b//2+c//2),(a//2+c//2),(a//2+b//2)
    #print(a,b,c)
    if (a%2==1 or b%2==1 or c%2==1):
      print(i)
      break
# Judge status: Accepted
from collections import deque

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
g = [[] for _ in range(N+1)]

for a, b in AB:
  g[a].append(b)
  g[b].append(a)

d = deque([1])
l = [0]*(N+1)
while d:
  r = d.popleft()
  for s in g[r]:
    if l[s] == 0:
      d.append(s)
      l[s] = r

print("Yes", *l[2:], sep="\n")
# Judge status: Wrong Answer
s = input()
ans,cnt = 0,0
for l in s:
  if l=='R':
    cnt += 1
  else:
    ans = cnt
    cnt = 0
print(ans)
# Judge status: Wrong Answer
N = int(input())
S = input()
len_S = len(S)
count = 0

if len_S % 2 == 1:
    print('No')

else:
    for i in range(len_S//2):
        if S[i] == S[i+(len_S//2)]:
            count += 1
        else:
            print('No')
            break

if count == len_S//2:
    print('Yes')
# Judge status: Accepted
a = list(map(int, input().split()))
k = int(input())

a.sort()
a[-1] *= 2 ** k

print(sum(a))
# Judge status: Wrong Answer
[a,b,c,d]=[int(input()) for i in range(1,4+1)]
a1 = d // 500
b1 = d// 100
c1 = d// 50
value = 0
count = 0
for i in range(0,a1+1):
    value = value + 500*i
    for j in range(0,b1+1-5*i):
        value = value + 100*j
        for k in range(0,c1+1-10*i-2*j):
            value = value + 50*k
            if value == d :
                count = count+1
                break
            value = 0
print(count)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import Counter

n, *a = map(int, read().split())

c = Counter(a)
ans =0
for k, v in c.items():
    if v >= k:
        ans += v - k
    elif v < k:
        ans += v
print(ans)
# Judge status: Accepted
n=int(input())

s=[]
if n%2==0:
    s.append(0)
else:
    s.append(1)
nn=n
ii=0
while nn<=-1 or 2<=nn:
    nn=(nn-s[ii])//(-2)
    if nn%2==0:
        s.append(0)
    else:
        s.append(1)
    ii+=1

ss=""
for i in range(len(s)):
    ss=str(s[i])+ss
print(ss)
# Judge status: Accepted
from collections import Counter

n = int(input())

def factorize(n):
    b = 2
    factor = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            factor.append(b)
        b += 1
    if n > 1:
        factor.append(n)
    return factor

f = factorize(n)
c = Counter(f)

a = 0
for v in c.values():
    i = 1
    while v >= i:
        v -= i
        i += 1
        a += 1

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

for d in range(X + 1):
  for s in [- 1, 1]:
    a = X + s * d
    if p.count(a) == 0:
      print(a)
      exit(0)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, X = map(int, input().split())
    A = list(map(int, input().split())) + [0]

    result = 0
    for i in range(N):
        tmp = max(0, A[i] + A[i - 1] - X)
        result += tmp
        A[i] -= tmp
    print(result)


if __name__ == "__main__":
    main()
# Judge status: Accepted
S,T = input().split()
U = ""
U = U + T + S
print(U)
# Judge status: Wrong Answer
N,A,B=map(int,input().split())
if (A-B)%2==0:
  ans=int((A-B)/2)
else:
  ans=min(B-1,N-A)
print(ans)
# Judge status: Accepted
q,h,s,d=map(int,input().split())
n=int(input())
m=n//2*min(8*q,4*h,2*s,d)+n%2*min(4*q,2*h,s)
print(m)
# Judge status: Accepted
n = int(input())

temp_set = {n}
for i in range(2, 10 ** 6 + 1):
    if n % 2 == 0:
        n //= 2
    else:
        n = 3 * n + 1
    
    if n in temp_set:
        break
    
    temp_set.add(n)
print(i)
# Judge status: Accepted
a,b,c=map(int,input().split())
if a+b>=c:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

v=e-a

if v <=k:
  print('Yay!')
else:
  print(':(')
# Judge status: Accepted
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    for i in range(0, n-k):
        if a[i] < a[k+i]:
            print("Yes")
        else:
            print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    X, K, D = iim()

    r = 1
    if X < 0:
        r = -1
        X = -X
    a, b = divmod(X, D)

    diff = K - a
    if diff <= 0:
        print(abs(r*(X - K*D)))
        return

    if diff & 1:
        b -= D

    print(abs(r*b))



if __name__ == "__main__":
    resolve()
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
ans = int(n** 0.5)**2
print(ans)
# Judge status: Wrong Answer
S = input()
replaced_t = S.replace('dreamer','').replace('dream', '').replace('eraseer', '').replace('erase', '')
if replaced_t:
    print('NO')
else:
    print('YES')
# Judge status: Accepted
N = int(input())
A = [int(_) for _ in input().split()]
cnt = [0 for i in range(N+1)]
for a in A:
    cnt[a] += 1
for c in cnt[1:]:
    print(c)
# Judge status: Accepted
# -*- coding: utf-8 -*-
a, b = map(int, input().split())

for i in range(2000):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        exit()

print(-1)
# Judge status: Accepted
N,D = map(int,input().split())
X = [list(map(int, input().split())) for j in range(N)]

count_ = 0
for j in range(0,N):
  for i in range(j+1,N):
    sum_ = 0
    for d in range(D):
      sum_+=(X[i][d]-X[j][d])**2
    if (sum_**0.5)%1==0: count_+=1
print(count_)
# Judge status: Accepted
n = input()
if len(n)==1:
  print(n)
else:
  nines = 1
  for i in range(1,len(n)):
    if n[i]!="9":
      nines = 0
  if nines == 1:
    print((len(n)-1)*9+int(n[0]))
  else:
    print((len(n)-1)*9+(int(n[0])-1))
# Judge status: Accepted
#!/usr/bin/env python3

s = str(input())

a = s[0:2]

b = s[2:]


def div(a):
    a = int(a)
    if a <= 12 and a >= 1:
        return "BOTH"
    else:
        return "YY"


if div(a) == div(b):
    if div(a) == "YY":
        print("NA")
    else:
        print("AMBIGUOUS")
elif div(a) == "YY":
    print("YYMM")
else:
    print("MMYY")
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(len(p)-2):
  if p[i] < p[i+1] < p[i+2] or p[i] > p[i+1] > p[i+2]:
    ans += 1

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

cnt=1
n=n-k
while n>0:
    n-=k-1
    cnt+=1

print(cnt)
# Judge status: Wrong Answer
n=input()
s=list(input())
for i in range(len(s)):
    ord_s=int(ord(s[i]))
    ord_s+=int(n)
    s[i]=chr(ord_s)
print("".join(s))
# Judge status: Accepted
A, B = map(int, input().split())

for i in range(1, 1011):
    a = i * 0.08
    b = i * 0.1
    if A <= a < A+1 and B <= b < B + 1:
        print(i)
        exit()

print('-1')
# Judge status: Accepted
import sys

N = int(sys.stdin.readline().strip())
A = map(int, sys.stdin.readline().strip().split())

ans = 0
neg_count = 0
zero_count = 0
a_min = float("inf")
for a_i in A:
    ans += abs(a_i)
    a_min = min(a_min, abs(a_i))
    if a_i == 0:
        zero_count += 1
    elif a_i < 0:
        neg_count += 1

#print(ans)
if neg_count % 2 == 0 or zero_count > 0:
    print(ans)
else:
    #print(a_min)
    print(ans - 2 * a_min)
# Judge status: Accepted
s = input()
print(s.replace('?', 'D'))
# Judge status: Wrong Answer
k=int(input())
if k%2==1:
    print((k//2)*(k//2-1))
else:
    print((k//2)**2)
# Judge status: Accepted
import math
k=int(input())
print(math.ceil(k/2)*(k//2))
# Judge status: Wrong Answer
A, B, C, K = map(int, input().split())
sum = 0

if K >= A:
	sum = sum + A
	K = K - A
else:
	sum = sum + K
	K = 0
if K >= B and K >= 1:
	K = K - B
else:
	K = 0
if K >= 1:
	sum = sum - K
	K = K - C

if sum >= 1:
	print(sum)
else:
	print(0)
# Judge status: Accepted
N=int(input())
S=input()
leftblack=0
rightwhite=0
for i in range(0,N):
    if S[i]==".":
        rightwhite+=1
ans=leftblack+rightwhite
for i in range(0,N):
    if S[i]=='.':
        rightwhite-=1
    else:
        leftblack+=1
    test=leftblack+rightwhite
    if ans>test:
        ans=test

print(ans)
# Judge status: Accepted
s=list(list(input())[::-1])
t=list(list(input())[::-1])
s_len=len(s)
t_len=len(t)
for i in range(s_len-t_len+1):
    for j in range(t_len):
        if s[i+j]!="?" and t[j]!=s[i+j]:
            break
    else:
        s[i:i+t_len]=t 
        for k in range(s_len):
            if s[k]=="?":
                s[k]="a"
        print("".join(s[::-1]))
        exit()
print("UNRESTORABLE")
# Judge status: Accepted
n,m = map(int, input().split())
if n == m:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
w = input()

w_set = set(w)

if len(w) / 2 == len(set(w)):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import random

def Nickname():

    Name = str(input()) #入力回数を決める

    num = random.randint(0, len(Name) - 3)

    print(Name[num:num+3])

if __name__ == '__main__':
    Nickname()
# Judge status: Accepted
import sys
x,N=list(map(int, input().split()))
if N==0:
  print(x)
  sys.exit()
p=list(map(int, input().split()))


z=float("inf")
ans_temp=[0,0]
ans=[0,0]

y=[i for i in range(-1,102) if i not in p]

for i in y:
  if z>abs(x-i):
    ans[0]=abs(x-i)
    ans[1]=i
  elif z==abs(x-i):
    ans_temp[0]=abs(x-i)
    ans_temp[1]=i
    if ans_temp[1]<ans[1]:
      ans[1]=ans_temp[1]
  z=abs(x-i)
print(ans[1])
# Judge status: Accepted
N = int(input())
left = 0
right = 10000
while right - left > 1:
    mid = (left + right) // 2
    if mid * (mid + 1) // 2 < N:
        left = mid
    else:
        right = mid
ans = {i for i in range(1, right + 1)}
ans -= {right * (right - 1) // 2 - N + right}
print('\n'.join(map(str, ans)))
# Judge status: Wrong Answer
n = int(input())
a = [0]*n
for i in range(n):
  a[i] = int(input())

x = sorted(a, reverse = True)
  
max = x[0]
count = x.count(max)
for i in range(n):
  if a[i] == max:
      print(max)      
  else:
    print(x[1])
# Judge status: Wrong Answer
n = int(input())

for i in range(1, n):
    if round(i * 1.08) == n:
        print(i)
        exit()
print(':(')
# Judge status: Wrong Answer
a = list(map(str,input().split()))
b = list(map(str,input().split()))
count = 0
for i in range(0,len(a)) :
  if a[i] != b[i] :
    count = count + 1

print(count)
# Judge status: Accepted
N = int(input())
lis = [0,26]
num = 26
n = 1
while lis[-1]<N:
    num *= 26
    lis.append(lis[-1]+num)
    n += 1
c = N-lis[-2]-1
ans = ''
for i in range(n):
    ans = chr(c%26+ord('a')) + ans
    c //= 26
print(ans)
# Judge status: Accepted
n, x = map(int, input().split())
a = list(map(int, input().split()))

cnt = max(0, a[0] - x)
a[0] -= cnt
for i in range(1, n):
    cnt_now = max(0, a[i-1] + a[i] - x)
    a[i] -= cnt_now
    cnt += cnt_now

print(cnt)
# Judge status: Accepted
s=input()

if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a,b = map(lambda x:int(x) % 2, raw_input().split()) 
print 'Odd' if a == b else 'Even'
# Judge status: Accepted
a,b,n=map(int,input().split())
if n>=b-1:
  print(a*(b-1)//b)
else:
  print(a*n//b)
# Judge status: Wrong Answer
x, a, b = map(int, input().split())

if a>b:
  print("delicious")
else:
  if b-a<x:
    print("safe")
  else:
    print("dangerous")
# Judge status: Accepted
X=int(input())

a=False
for i in range(10**3):
    if a==False:
        for j in range(-10**3,10**3):
            if i**5-j**5==X:
                print(i,j)
                a=True
                break
# Judge status: Accepted
A, B = map(int, input().split())
if A <= 8 and B <= 8:
    print('Yay!')
else:
    print(':(')
# Judge status: Accepted
n,q = map(int,input().split())
s = input()
t_list = [0]*n
for i in range(len(s)-1):
    if (s[i] == 'A') and (s[i+1] == 'C'):
        t_list[i+1] = 1+t_list[i]
    else:
        t_list[i+1] = t_list[i]
        
for i in range(q):
    l,r =  map(int,input().split())
    print(t_list[r-1] - t_list[l-1])
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())
cnt = 0
while b <= a:
    cnt += 1
    b *= 2

while c <= b:
    cnt += 1
    c *= 2

print("Yes" if cnt <= k else "No")
# Judge status: Accepted
s1 =set([1,3,5,7,8,10,12])
s2 =set([4,6,9,11])
s3 =set([2])
a,b =map(int,input().split())
for i in [s1,s2,s3]:
  if a in i and b in i:
    print("Yes")
    break
else:
  print("No")
# 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):
	if A[i]>=B[i]:
		ans+=B[i]
		A[i]-=B[i]
	else:
		temp=B[i]-A[i]
		ans+=A[i]
		if A[i+1]>=temp:
			ans+=temp
			A[i+1]-=temp
		else:
			ans+=A[i+1]
			A[i+1]=0

print(ans)
# Judge status: Wrong Answer
import math

N = int(input())

a = pow(10,12)

is_not_prime = False
for k in range(2, int(math.sqrt(N)) + 1):
    if N % k == 0:
        is_not_prime = True
        break
if is_not_prime:
    for i in range(1, int(math.sqrt(N)) + 1):
        print(i)
        j = N/i
        if j.is_integer():

            if (i+int(j)) < a:
                a = i+int(j)
        if j < 2:
            break

    print(a - 2)
else:
    print(N - 1)
# Judge status: Accepted
n=int(input())
ans=n%9
if ans==0:
	print("Yes")
else:
	print("No")
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
if A == B and  B == C and C == A:
  print(-1)
else:
  count = 0
  while(A%2==0 and B%2 == 0 and C%2==0):
    A_ = A
    B_ = B
    A = (B+C)/2
    B = (A_+C)/2
    C = (A_+B_)/2
    count+=1
  print(count)
# Judge status: Accepted
n = int(input())
s = input()
if s[n//2:] == s[:n//2]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a,b = map(int,input().split())

if a > 0 or a == b:
  print('Positive')
elif a <= 0 <= b:
  print('Zero')
else:
  print('Positive' if (b - a) % 2 == 1 else 'Negative')
# Judge status: Accepted
x = int(input())


def prime(n):
    flag = ''
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            break
    else:
        flag = 'prime_number'

    return(flag)


if x == 2:
    print(2)
else:
    i = x + int(x % 2 == 0)

    while(prime(i) != 'prime_number'):
        i += 1

    print(i)
# Judge status: Accepted
D, T, S = map(int, input().split())
t = D / S
if t <= T:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import math
n,d = map(int,input().split())
math.ceil(n/(2*d+1))
# Judge status: Accepted
#!python3

# input
N, K = list(map(int, input().split()))


def main():
    if N % K == 0:
        ans = 0
    else:
        ans = 1
    print(ans)
    


if __name__ == "__main__":
    main()
# Judge status: Accepted
from fractions import gcd
from functools import reduce

n = int(input())
t = list(int(input()) for _ in range(n))

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

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

print(lcm_list(t))
# Judge status: Accepted
import heapq
import bisect
N=int(input())
A=[]

for i in range(N):
  a=int(input())
  A.append(a)
h=[]
c=0
for i in range(N-1,-1,-1):
  p=bisect.bisect_right(h,A[i])
  if p==len(h):
    h.append(A[i])
    c+=1
  else:
    h[p]=A[i]
print(c)