peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import math

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

t_list = [A, B, C, D, E]
min_t = 10*18
min_i = 0
for i in range(5):
    if t_list[i]<min_t:
        min_i = i
        min_t = t_list[i]

t_1 = int((N+min_t-1) / min_t)
print(t_1+4)
# Judge status: Accepted
N,P=map(int,input().split())
A=list(map(int,input().split()))
if all(a%2==0 for a in A):
    print(0 if P else 2**N)
else:
    print(2**(N-1))
# Judge status: Wrong Answer
N = input()
lenN = len(N)
h = lenN
cnt = 0
if lenN >= 6:
  h = lenN // 2
  
for i in range(0,h-3):
  for j in range(i + 3,h+1):
    p = int(N[i:j])
    if p % 2019 == 0:
      print("{} : {}".format(i,j))
      cnt += 1
if lenN >= 6:
  for i in range(h-3,lenN-3):
    for j in range(i + 3,lenN+1):
      p = int(N[i:j])
      if p % 2019 == 0:
        print("{} : {}".format(i,j))
        cnt += 1

print(cnt)
# Judge status: Accepted
n=int(input())
A=[int(input()) for i in range(n)]
B=sorted(A,reverse=True)
amax=B[0]
asec=B[1]
for a in A:
    if a==B[0]:
        print(asec)
    else:
        print(amax)
# Judge status: Accepted
import math
s=int(input())
up=int(math.sqrt(s))+1
if s==1000000000000000000:
    print("0 0 1000000000 0 0 1000000000")
    exit()
print("{} {} {} {} {} {}".format(0,0,1,up,up,up*up-s))
# Judge status: Accepted
import sys
N = int(input())
if N < 1 or N > 10 ** 5:
    sys.exit()

int_array = []
for I in range(N):
    int_array.append(int(input()))
if len(int_array) < 0 or len(int_array) > N:
    sys.exit()

next = int_array[0]
count = 1
for L in range(N):
    if next == 2:
        print(count)
        sys.exit()
    next = int_array[next-1]
    count += 1
print("-1")
# Judge status: Accepted
n,k = map(int,input().split())
x = list(map(int,input().split()))

ans = 114514191981036436433-4

for i in range(n+1-k):
    a,b = x[i],x[i+k-1]
    if a < 0 and b < 0:
        ans = min(ans,abs(a))
    elif a >= 0 and b >= 0:
        ans = min(ans,abs(b))
    else:
        ans = min(ans,min(abs(a)+abs(b)*2,abs(b)+abs(a)*2))
        
print(ans)
# Judge status: Accepted
X,Y =map(int,input().split())

if (Y % 2 == 0) and (4*X >= Y >=2*X):
    print('Yes')

else:
    print('No')
# Judge status: Wrong Answer
#97 B - Exactly N points
N = int(input())

A = []
num = 1
cnt = 0
for _ in range(N):
    A.append(num)
    cnt += 1
    if num == cnt:
        cnt = 0
        num += 1

ans = [A[-1]]
tgt = N - A[-1]
for i in range(1,A[-1]):
    if tgt < A[-1]:
        ans.append(tgt)
        break
    tgt -= i
    ans.append(i)

for a in ans:
    print(a)
# Judge status: Wrong Answer
n, m = list(map(int, input().split(' ')))
aaa = [0] * (n + 3)
for i in range(m):
    aaa[int(input())] = True

dp = [1] * (n + 3)
for i in range(1, n+1):  # 1e5
    if not aaa[i]:
        dp[i]  = dp[i-1]
        dp[i] += dp[i-2]
        dp[i] = dp[i] % int(1e9 + 7)
    else:
        dp[i] = 0
print(dp[n])
# Judge status: Accepted
def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    ans=n-sum(a)
    if ans<0:
        ans=-1
    print(ans)
if __name__=="__main__":
    main()
# Judge status: Wrong Answer
n, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
def euclid(a,b):
    if a % b == 0:
        return b
    else:
        return euclid(b, a%b)

now = abs(x[0] -x[1])
for i in range(1, len(x)-2):
    r = euclid(now, abs(x[i] - x[i+1]))
    if r < now:
        now = r
print(now)
# Judge status: Accepted
def have_eight_divisor_odd(n):
    have_eight_divisor_odd_count = 0
    for i in range(1, n+1):
        count = 0
        if i % 2 == 1:
            for j in range(1, i+1):
                if i % j == 0:
                    count += 1
        if count == 8:
            have_eight_divisor_odd_count += 1
    return have_eight_divisor_odd_count

N = int(input())
result = have_eight_divisor_odd(N)
print(result)
# Judge status: Wrong Answer
X = int(input())
for A in range(1000):
    for B in range(1000):        
        if A**5 - B**5 == X:
            print(A, B)
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]
AMax = max(A)
x = A.index(AMax)
Aelse = A[:x]+A[x+1:]
AelseMax = max(Aelse)
if AMax == AelseMax:
    for i in range(N):
        print(AMax)
else:
    for i in range(N):
        if x == i:
            print(AelseMax)
        else:
            print(AMax)
# Judge status: Accepted
import sys
import io

f = sys.stdin.buffer
n = int(f.readline())
h = list(map(int, f.readline().split()))
p0, p1 = 0, abs(h[1] - h[0])
for i in range(2, n):
    p2 = min(p1 + abs(h[i] - h[i - 1]), p0 + abs(h[i] - h[i - 2]))
    p0, p1 = p1, p2
print(p1)
# Judge status: Accepted
n,l=map(int,input().split())
k=[input() for i in range(n)]
k.sort()
print("".join(k))
# Judge status: Accepted
a, b = map(int, input().split())
if a + b >= 24:
    print(a+b-24)
else:
    print(a+b)
# Judge status: Accepted
a,b,c,k = map(int, input().split())
cheak = 10**18
ans = a-b
def calc(a,b,c,k):
    if a == b:
        return 0
    elif ans < 0:
        if k % 2 == 1:
            return -ans
        else:
            return ans
    else:
        if k % 2 == 1:
            return -ans
        else:
            return ans
ans_n = calc(a,b,c,k)
if ans_n > cheak:
    print("Unfair")
else:
    print(ans_n)
# Judge status: Accepted
a, b = map(int, input().split())

if 0 < a and 0 < b:
    print("Positive")
elif a <= 0 and 0 <= b:
    print("Zero")
else:
    if (a + b) % 2 == 0:
        print("Negative")
    else:
        print("Positive")
# Judge status: Accepted
A,B,C,D=map(int,input().split())
 
while True:
    C=C-B
    if C<=0:
        break
    A=A-D
    if A<=0:
        break
 
if C<=0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n,m = map(int,input().split())
graph = {i:[] for i in range(1,n+1)}

for _ in range(m):
  a,b = map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
if len(set(graph[1]).intersection(set(graph[n]))) > 0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
import re

sp=input()
t=input()

strlst=[]

def makeStrLex(i):
    s=sp[:i]+t+sp[i+len(t):]
    s=s.replace('?','a')

    return s

for i in range(len(sp)-len(t)+1):
    spat=sp[i:i+len(t)].replace('?','.')
    repat=re.compile(spat)
    
    if repat.match(t):
        strlst.append(makeStrLex(i))

if len(strlst)>0:
    print(sorted(strlst)[0])
else:
    print('UNRESTORABLE')
# Judge status: Accepted
D,T,S = map(int, input().split())
if D<=T*S:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a,b,c=(int(x) for x in input().split())
if a==b==c:
    print(1)
elif a!=b!=c:
    print(3)
else:
    print(2)
# Judge status: Accepted
a,b,c=map(int,input().split())
ans='NO'
for i in range(1,b+1):
  if c==(a*i)%b:
    ans='YES'
print(ans)
# Judge status: Accepted
n = int(input())

ans = 0
for i in range(1,n):
  ans += n // i
  
  if n % i == 0:
    ans -= 1
    
print(ans)
# Judge status: Accepted
from collections import Counter

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

ACounter=Counter(A)

ans=0
for k,v in ACounter.items():
    if k<=v: ans+=(v-k)
    elif k>v: ans+=v
    
print(ans)
# Judge status: Accepted
import math
a,b,c,d=map(int,input().split())
lcm=(c*d)//math.gcd(c,d)
ans=(b-a)-((b//c-(a-1)//c)+(b//d-(a-1)//d)-(b//lcm-(a-1)//lcm))+1
print(ans)
# Judge status: Accepted
#abc149d
n,k=map(int,raw_input().split())
r,s,p=map(int,raw_input().split())
t=map(str,raw_input().rstrip())
pt={'r':p,'s':r,'p':s,'':0}
res=0
for i in range(n):
 x=i-k
 if x>=0 and t[x]==t[i]:
  t[i]=''
 res+=pt[t[i]]
print res
# Judge status: Wrong Answer
x=int(input())

for i in range(x, 0, -1):
    for j in range(1, int(i**(1/2))+1):
        if i/j == j:
            print(i)
            exit()
# Judge status: Wrong Answer
import math
A, B, H, M = map(int, input().split())
KAKUDO=min(abs((H*30)-(M*6)),abs((M*6)-(H*30)))
KAKUDO=min(KAKUDO,(360-(H*30))+(M*6),)
ANS= (A**2)+(B**2)-(2*A*B*math.cos(math.radians(KAKUDO)))
print(math.sqrt(ANS))
# Judge status: Accepted
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import copy

sys.setrecursionlimit(10**9)
mod = 998244353
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

h,n = LI()
a = LI()

if sum(a)>=h:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
A = list(map(int, input().split()))

ans = 10**1000
tmp = 0

for i in range(3):
    for j in range(i+1, 2):
        tmp = A[i] + A[j]
        ans = min(ans, tmp)

print(ans)
# Judge status: Wrong Answer
def main():
    N, T = map(int, input().split())
    C = []
    for _ in range(N):
        c, t = map(int, input().split())
        if t <= T:
            C.append(c)
    if len(C) == 0:
        print("LTE")
    else:
        print(min(C))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
print(N*800 - (N//15 * 200))
# Judge status: Accepted
N , K ,S =map(int,input().split())
if S != 10**9:
  ans = [S]*K  + [10**9]*(N-K)
else:
  ans = [S]*K + [1]*(N-K)
print(" ".join(map(str,ans)))
# Judge status: Accepted
Atcoder,s,Contest=raw_input().split()
print Atcoder[0]+s[0].upper()+Contest[0]
# Judge status: Wrong Answer
a, b, m = map(int, input().split())
a_price = list(map(int, input().split()))
b_price = list(map(int, input().split()))
m_prices = []
for i in range(m):
  m_prices.append(list(map(int, input().split())))

ref = min(a_price)
mi = min(b_price)
c = []
for i in range(m):
  temp = dict.fromkeys(m_prices[i])
  if len(temp) != 1:
  	c.append(m_prices[i][2])

if len(c) != 0:
  print(ref + mi - max(c))
else:
  print(ref + mi)
# Judge status: Wrong Answer
def main():
    n = int(input())
    a = list(map(int, input().split()))
    s = [abs(i) for i in a]
    print(sum(s) - 2*min(s))

if __name__ == "__main__":
    main()
# Judge status: Accepted
l = sorted([int(input()) for _ in range(5)])
n = int(input())

if max(l) - min(l) > n:
    print(':(')
else:
    print('Yay!')
# Judge status: Accepted
from collections import Counter

alpha = [float('inf')] * 26
n = int(input())

for _ in range(n):
    dic = Counter(list(input()))
    for i in range(26):
        if chr(i + 97) not in dic:
            alpha[i] = 0
        elif dic[chr(i + 97)] < alpha[i]:
            alpha[i] = dic[chr(i + 97)]

ans = ''
for i in range(26):
    ans += chr(i + 97) * alpha[i]

print(ans)
# Judge status: Wrong Answer
N = int(input())
W = list(input() for _ in range(N))

cnt = 0
for i in range(N-1):
	first = W[i]
	next = W[i+1]
	if first[-1] == next[0]:
		cnt += 1
	else:
		cnt = cnt

if cnt == N-1:
	print('Yes')
else:
	print('No')
# Judge status: Wrong Answer
n,m = map(int, input().split())
A = [int(input()) for i in range(m)]
if m == 0:
  Fib = [1,2]
  for i in range(2,n+1):
    Fib.append(Fib[i-2]+Fib[i-1])
  print(Fib)
  print(Fib[n]%1000000007)
  exit()

B = [A[i+1]- A[i] for i in range(m-1)]
B.insert(0,A[0]+1)
B.append(n+1-A[m-1])

M = max(A)

Fib = [0,1]
for i in range(2,M+10):
  Fib.append(Fib[i-2]+Fib[i-1])

ans = 1
for i in range(len(B)):
  ans = (ans * Fib[B[i]-1])%1000000007
  
print(ans)
# Judge status: Wrong Answer
from sys import stdin
data = stdin.readlines()

n = int(data[0].split()[0])
a = [int(s) for s in data[1].split()]
a = sorted(a)

max = a[-1]
print(max)

l = [0]*(max+1)

for i in a:
    l[i] += 1
    if l[i] == 1:
        for j in range(i*2,max+1,i):
            l[j] = 2
print(l.count(1))
# Judge status: Accepted
ab,bc,ac=map(int,input().split())
print(min(ab+bc, ab+ac, bc+ac))
# Judge status: Accepted
def howmanytimesdisible(n):
  ans = 0
  while n%2==0:
    n/=2
    ans+=1
  return ans

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

ans = min(map(howmanytimesdisible,li))

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

ans = []
for i in range(len(s)):
    if s[i] == "0":
        ans.append("0")
    elif s[i] == "1":
        ans.append("1")
    else:
        if len(ans) == 0:
            pass
        else:
            ans.pop(-1)

print("".join(ans))
# Judge status: Accepted
A,B,C = map(int, input().split())


if A==B & B==C & C==A:
    print('No')

elif A!=B & B!=C & C!=A:
    print('No')

else:
    print('Yes')
# Judge status: Wrong Answer
n, m = map(int, input().split())
if n == 1 and m == 1:
  print(1)
  exit(0)

w = n - 2
h = m - 2
if w < 1 or h < 1:
  print(max(w, h))
  exit(0)
  
print(w*h)
# Judge status: Accepted
s = input().split()

n = int(s[0])
a = int(s[1])
b = int(s[2])

count = 0

for i in range(1,n+1):
    s = list(str(i))
    g = 0
    for stri in s:
        g += int(stri)
    if g >= a and g <= b:
        count += i

print(count)
# Judge status: Accepted
S=input()
if S=="ARC":
    print("ABC")
else:
    print("ARC")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ans = 0
t = 1
s = []
for i in a:
  if i != t: ans += 1
  else:
    t += 1
    s.append(i)

if s == []:
  print(-1)
else:
  print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
cnt = 0
for i in range(a,b+1):
    i = str(i)
    if i == i[::-1]:
        cnt +=1
print(cnt)
# Judge status: Accepted
sa = input()
sb = input()
sc = input()

card = sa[0]
sa = sa[1:]
  
while sa or sb or sc:
  if card == 'a':
    if len(sa) >= 1:
      card = sa[0]
      sa = sa[1:]
    else:
      print('A')
      quit()
  elif card == 'b':
    if len(sb) >= 1:
      card = sb[0]
      sb = sb[1:]
    else:
      print('B')
      quit()
  else:
    if len(sc) >= 1:
      card = sc[0]
      sc = sc[1:]
    else:
      print('C')
      quit()
# Judge status: Accepted
N,M=map(int,input().split())
A=list(list(input()) for _ in range(N))
B=list(list(input()) for _ in range(M))
flag=False
for i in range(0,N-M+1):
    for j in range(0,N-M+1):
        sub=True
        for x in range(0,M):
            for y in range(0,M):
                if A[i+x][j+y]!=B[x][y]:
                    sub=False
        flag=flag or sub
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#!/usr/bin/env python

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**6)
INF = float("inf")

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

    ans = 0
    for i in range(N):
        if i%2 == 0 and A[i]%2 == 1:
            ans += 1
    
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n, m = list(map(int, input().split()))
nn = min(n, m)
mm = max(n, m)

if nn == mm:
  if nn == 1:
    print(1)

  else:
    print(max(nn-2, 0) * max(mm-2, 0))
  
else:
  if n != 2:
    print(max(nn-2, 1) * max(mm-2, 1))
  else:
    print(0)
# Judge status: Wrong Answer
from math import sqrt
a, b, c = [int(i) for i in input().split()]
if sqrt(a) + sqrt(b) - sqrt(c) < 1e-21:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def resolve():
    n = int(input())
    a = list(map(int, input().split()))

    ans = 0
    mod = (10 ** 9) + 7
    csum = sum(a)

    for i in range(n):
        csum -= a[i]
        ans += a[i] * csum

    ans = int(ans % mod)
    print(ans)
 
resolve()
# Judge status: Wrong Answer
s = "".join(input().split())
print(max(int(s[0])+int(s[1:]),int(s[-1])+int(s[:2])))
# Judge status: Accepted
n=int(input())
l=[int(x) for x in input().rstrip().split() if int(x)%2==0]

cnt = 0
for i in l:
    if i%3 == 0 or i%5==0:
        cnt += 1
    else:
        break

if cnt == len(l):
    print("APPROVED")
else:
    print("DENIED")
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

_min = p[0]
ans = 0

for i in range(n):
    if _min >= p[i]:
        ans += 1
    _min = min(_min, p[i])
print(ans)
# Judge status: Accepted
import math
a, b, x = map(int, input().split())

V = a * a * b

if x > V/2:
    c = (x / a) * 2 / a - b
    print(math.degrees(math.atan((b-c)/a)))
else:
    c = (x / a) * 2 / b
    print(math.degrees(math.atan(b/c)))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
res = False
for i in range(a, a * b + 1):
    if i % b == c:
        res = True

print("YES" if res == True else "NO")
# Judge status: Wrong Answer
N, K, S = map(int, input().split())
A = []
for i in range(K):
  A.append(S)
for i in range(K, N):
  A.append(S+1)
print(*A)
# Judge status: Accepted
l,r=map(int, input().split())

k=0

can=[]
while l+k<=r and k<2020:
    can.append((l+k)%2019)
    k+=1
ans=2020
import itertools

for seq in itertools.combinations(range(len(can)),2):
    ans=min(ans,(can[seq[0]]*can[seq[1]])%2019)
print(ans)
# Judge status: Wrong Answer
s = input()
K = int(input())

for i,c in enumerate(s):
	x = ord('z')-ord(c)+1
	if x <= K:
		s = s[:i]+'a'+s[i+1:]
		K -= x

print(s[:-1]+chr((ord(s[-1])+K%26-ord('a'))%26+ord('a')))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
if a[0]:
    print(0)
    exit()
a.sort()
j=0
l=list()
#print(a)
for i in range(max(a)+1):
    k=0
    while j<n and a[j]==i:
        j+=1
        k+=1
        #print(l,j,k)
    l.append(k)
#print(l)
p=l[0]==1
mod=998244353
for i in range(len(l)-1):
    #print(p)
    p=(p*pow(l[i],l[i+1],mod))%mod
print(p%mod)
# Judge status: Accepted
def q2():
    """ B - Golden Apple """
    N, D = (int(i) for i in input().split())
    d, m = divmod(N, D*2+1)
    if m > 0:
        d += 1
    print(d)


if __name__ == '__main__':
    q2()
# Judge status: Wrong Answer
k, x = map(int, input().split())
if 500*k >= x:
    print("yes")
else:
    print("no")
# Judge status: Accepted
N=int(input())
S = ""
while N != 0:
  if N%2==0:
    S = "0" + S
  else:
    S = "1" + S
    N -= 1
  N /= -2
if S == "": S = "0"
print(S)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

chk = [0]*(N+1)
town = 1
rt = []
roop = 0

while True:
    if chk[town] == 1:
        break
    rt.append(town)
    chk[town] = 1
    town = A[town-1]

if K <= rt.index(town):
    print(rt[K])
else:
    roop = (K-rt.index(town)) % (len(rt)-rt.index(town))
    print(rt[rt.index(town)+roop])
# 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: Wrong Answer
N,M = map(int,input().split())
print(int(N*(N+1)/2+M*(M+1)/2))
# Judge status: Accepted
A, B, C = map(int, input().split())
res = 0
while True:
    if A%2 + B%2 + C%2 > 0:
        break
    A, B, C = B//2 + C//2, C//2 + A//2, A//2 + B//2
    if A == B and B == C:
        res = -1
        break
    res += 1
print(res)
# Judge status: Accepted
a,b,c = list(map(int,input().split()))
print(['No','Yes'][int(a+b>=c)])
# Judge status: Wrong Answer
n=int(input())

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

cnt=0

for i in range(n):
    if i%2!=0 and a[i]%2!=0:
        cnt+=1

print(cnt)
# Judge status: Accepted
N = int(input())
S = input()
hidari = 0
migi = 0
for i in range(N):
  if S[i] == '(':
    hidari += 1
  else:
    if hidari > 0:
      hidari -= 1
    else:
      migi += 1
S = '(' * migi + S + ')' * hidari
print(S)
# Judge status: Accepted
x=int(input())
num1=-((x%100)//-5)
num2=x//100
if num1>num2:
    print(0)
else:
    print(1)
# Judge status: Accepted
i = list(map(int, input().split()))
A=i[0]
B=i[1]

if A==B:
    print("Draw")
elif A>B and B!=1:
    print("Alice")
elif A<B and A!=1:
    print("Bob")
elif A>B and B==1:
  print("Bob")
elif A<B and A==1:
  print("Alice")
# Judge status: Wrong Answer
a, b, k = map(int, input().split())

l = [i for i in range(a, b+1)]

if b - a < k:
    for i in l:
        print(i)
else:
    for i in l[:k]:
        print(i)
    for i in l[-k:]:
        print(i)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
print('Yes' if abs(a-c) <= d or abs(a-b) <= d and abs(b-c) <= d else 'No')
# Judge status: Wrong Answer
n = int(input())
s = []
for i in range(n):
    S = int(input())
    s.append(S)
s.sort()
count = 0
for i in range(n):
    ans = sum(s[i:])
    if ans %10 ==0:
        count +=1
    else:
        print(sum(s[i:]))
        break
if count == len(s):
    print(0)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

student_dic = {}
for i in range(N):
    student_dic[A[i]] = i+1


tmp = sorted(student_dic.items())
for i in range(N):
    if i == N-1:
        print(tmp[i][1])
    else:
        print(tmp[i][1], end=" ")
# Judge status: Wrong Answer
N = int(input())
hw = [[int(i) for i in input().split()] for _ in range(N)]

minD = 2 * 10**9
min = 0
maxD = 0
max = 0

for i in range(N):
    if (minD > (hw[i][0] + hw[i][1])):
        minD = hw[i][0] + hw[i][1]
        min = i
    if (maxD < hw[i][0] + hw[i][1]):
        maxD = hw[i][0] + hw[i][1]
        max = i

print(abs(hw[max][0] - hw[min][0]) + abs(hw[max][1] - hw[min][1]))
# Judge status: Accepted
n, k = map(int, input().split())
l = [0]*100010
cnt = 0

for i in range(n):
    a, b = map(int, input().split())
    l[a] += b

for i in range(100010):
    cnt += l[i]
    if k <= cnt:
        print(i)
        exit()
# Judge status: Wrong Answer
h, n = map(int, input().split())


l = []
for i in range(n):
  a, b = map(int, input().split())
  l.append((a, b))
m = max(l, key=lambda x: x[0])[0]
dp = [1]*(h+m+1)
dp[0] = 0
for i in range(1, h+m+1):
  dp[i] = min([dp[i-l[j][0]]+l[j][1] for j in range(n)])
# Judge status: Accepted
a, b, c = map(int, input().split())
t = b // a
if t > c:
    print(c)
else:
    print(t)
# Judge status: Wrong Answer
a, b = map(int,input().split())

c = max(a,b)

if c <= 16:
  print("Yay!")
  
else:
  print(":(")
# Judge status: Accepted
n, q = map(int, input().split())
s = input().rstrip()

ns = [None] * n
ns[0] = 0
nn = 0
for i in range(n - 1):
    if s[i] == 'A' and s[i + 1] == 'C':
        nn += 1
    ns[i + 1] = nn
for i in range(q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1

    print(ns[r] - ns[l])
# Judge status: Accepted
a, b, c = map(int, input().split())
print('bust') if a+b+c > 21 else print('win')
# Judge status: Wrong Answer
n,q=map(int,input().split())
l=[0 for i in range(n)]
for i,v in enumerate(list(input().replace("AC","X!"))):
    l[i]=l[i-1]+(v=="!")
print(l)
for c in range(q):
    h,m=map(int,input().split())
    print(l[m-1]-l[h-1])
# Judge status: Wrong Answer
x,a,b = map(int, input().split())
if b-a < 1:
    print("delicious")
elif b-a == 1:
    print("safe")
else:
    print("dangerous")
# Judge status: Wrong Answer
a, b, x = map( int, input().split())

print( a//x - b//x +1)
# Judge status: Wrong Answer
n, c, k = map(int, input().split())
t = []    
for _ in range(n):
    t.append(int(input()))
t.sort()
first = t[0]
wait = 1
need = 1
for i in t:
    if first + k < i or wait > c:
        need += 1
        wait = 1
        first = i
        continue
    wait += 1
print(need)
# Judge status: Accepted
import itertools
import math
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
s = list(range(N))
sum = 0
for v in itertools.permutations(s):
    for i in range(N-1):
        distance = math.sqrt((xy[v[i]][0]-xy[v[i+1]][0])**2 + (xy[v[i]][1]-xy[v[i+1]][1])**2)
        sum += distance
print(sum/math.factorial(N))
# Judge status: Accepted
n,m = map(int,input().split())
t = []
l = [0]*(n+1)
for i in range(n+1):
    t.append([])
for i in range(m):
    a,b = map(int,input().split())
    t[a].append(b)
    t[b].append(a)
x = [1]
p = 0
while(p < n):
    for i in range(len(t[x[p]])):
        c = t[x[p]][i]
        if(l[c] == 0):
            x.append(c)
            l[c] = x[p]
    p += 1
print("Yes")
for i in range(2,n+1):
    print(l[i])
# Judge status: Accepted
S = input()
A = S[0::2].count("1") + S[1::2].count("0")
B = S[0::2].count("0") + S[1::2].count("1")
  
print(min(A,B))
# Judge status: Wrong Answer
S = list(input().split('/'))
A = S[0]+S[1]+S[2]
print(A)
if int(A) > 20190430:
  print("TBD")
else:
  print("Heisei")