Harryxun/stf_run huggingface dataset:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    T = [ii() for _ in range(N)]

    ret = lcm(T[0], T[1])
    for t in T:
        ret = lcm(ret, t)
    print(ret)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue
import fractions

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

# lcm = lambda x, y: (x * y) // math.gcd(x, y)
lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    T = [ii() for _ in range(N)]

    ret = lcm(T[0], T[1]) if len(T) > 1 else T[0]
    for t in T:
        ret = lcm(ret, t)
    print(ret)


if __name__ == '__main__':
    main()
h = int(input())
a = int(input())
print(h // a + 1)

### FIXED CODE ###

nums = input().strip().split()
h = int(nums[0])
a = int(nums[1])
if h % a == 0:
    print(h // a)
else:
    print(h // a + 1)
mod = 10 ** 9 + 7
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
A_minus = []
A_plus = []
for i in A:
    if i < 0:
        A_minus.append(i)
    elif i >= 0:
        A_plus.append(i)

len_plus = len(A_plus)
len_minus = len(A_minus)
plus = True
if (K > len_plus):
    if K % 2 == 1:
        if len_plus > 0:
                len_plus -= 1
                K -= 1
    K -= (len_plus // 2) * 2
    if K < len_minus:
        plus = False
ans = 1
if plus:
    A_plus.sort(reverse=True)
    A_minus.sort()
    for i in range(K):
        if ans < 0:
            ans *= A_minus.pop()
            continue
        if i < K - 1:
            if (len(A_plus) > 0) & (len(A_minus) > 0):
                if A_plus[0] < abs(A_minus[0]):
                    ans *= A_minus.pop()
                    continue
            if len(A_plus) > 0:
                ans *= A_plus.pop()
else:
    A_plus.sort()
    A_minus.sort(reverse=True)
    for i in range(K):
        if ans < 0:
            ans *= A_minus.pop()
            continue
        if i < K - 1:
            if (len(A_plus) > 0) & (len(A_minus) > 0):
                if A_plus[0] < abs(A_minus[0]):
                    ans *= A_minus.pop()
                    continue
            if len(A_plus) > 0:
                ans *= A_plus.pop()
print(ans % mod)

### FIXED CODE ###

def solve():
    can_positive = False
    if len(P) > 0:
        if k < n:
            can_positive = True
        else:
            can_positive = len(M) % 2 == 0
    else:
        can_positive = k % 2 == 0
    if not can_positive:
        return sorted(P + M, key=lambda x: abs(x))[:k]
    P.sort()
    M.sort(reverse=True)
    a = [P.pop()] if k % 2 else [1]
    while len(P) >= 2:
        a.append(P.pop() * P.pop())
    while len(M) >= 2:
        a.append(M.pop() * M.pop())
    return a[:1] + sorted(a[1:], reverse=True)[:(k - k%2) // 2]

n, k = map(int, input().split())
P, M = [], []
for a in map(int, input().split()):
    if a < 0:
        M.append(a)
    else:
        P.append(a)
ans, mod = 1, 10 ** 9 + 7
for a in solve():
    ans *= a
    ans %= mod
print(ans)
number =int(input())
orders =input().rstrip().split(" ")
studentnumbers =[]

for j in range(number):
  for i in range(len(orders)):
    if int(orders[i])==j+1:
      studentnumbers.append(i+1)
      print(i+1 ,end=" ")

### FIXED CODE ###

number = int(input())
if number%2 ==0:
  child = number/2
elif number%2==1:
  child = (number+1)/2
value =child/number
print(value)
n,q=map(int,raw_input().split())
exist=set([1])
cup=range(n+2)
now=1
exist.add(cup[now-1])
exist.add(cup[now+1])
for i in xrange(q):
    a,b=map(int,raw_input().split())
    if now==a:now=b
    elif now==b:now=a
    tmp=cup[a]
    cup[a]=cup[b]
    cup[b]=tmp
    exist.add(cup[now-1])
    exist.add(cup[now+1])
exist.add(now-1)
exist.add(now+1)
exist=list(exist)
ans=0
for i in xrange(len(exist)):
    if exist[i]!=0 and exist[i]!=n+1:ans+=1
print ans

### FIXED CODE ###

n,q=map(int,raw_input().split())
exist=set([1])
cup=range(n+2)
now=1
exist.add(cup[now-1])
exist.add(cup[now+1])
for i in xrange(q):
    a,b=map(int,raw_input().split())
    if now==a:now=b
    elif now==b:now=a
    tmp=cup[a]
    cup[a]=cup[b]
    cup[b]=tmp
    exist.add(cup[now-1])
    exist.add(cup[now+1])
exist=list(exist)
ans=0
for i in xrange(len(exist)):
    if exist[i]!=0 and exist[i]!=n+1:ans+=1
print ans
import sys
from collections import deque
readline = sys.stdin.readline

N = int(readline())
P = list(map(int, readline().split()))

geta = N+2
G = [0]*(geta*geta)

for v in range(-1-(-N//2), -1, -1):
    l = v+1
    r = N-v
    for i in range(geta):
        G[i*geta+l] = v
        G[i*geta+r] = v
        G[l*geta+i] = v
        G[r*geta+i] = v

for i in range(geta):
    G[i*geta] = -1
    G[i*geta + geta-1] = -1
    G[i] = -1
    G[geta*(geta-1)+i] = -1

Pn = []

for p in P:
    a, b = divmod(p-1, N)
    Pn.append((1+a)*geta+1+b)

DIREC = [1, -1, geta, -geta]
ans = 0
used = [False]*(geta*geta)
for p in Pn:
    ans += G[p]
    res = G[p]
    for d in DIREC:
        res = min(res, G[p+d])
    if G[p] != res:
        G[p] = res
        
        while Q:
            vn = Q.pop()
            for d in DIREC:
                vf = vn + d
                if not used[vf]:
                    if G[vf] > G[vn] + 1:
                        G[vf] = G[vn] + 1
                        Q.appendleft(vf)
                else:
                    if G[vf] > G[vn]:
                        G[vf] = G[vn]
                        Q.appendleft(vf)
                    
    used[p] = True
print(ans)

### FIXED CODE ###

import sys
from collections import deque
readline = sys.stdin.readline

N = int(readline())
P = list(map(int, readline().split()))

geta = N+2
G = [0]*(geta*geta)

for v in range(-1-(-N//2), -1, -1):
    l = v+1
    r = N-v
    for i in range(geta):
        G[i*geta+l] = v
        G[i*geta+r] = v
        G[l*geta+i] = v
        G[r*geta+i] = v

for i in range(geta):
    G[i*geta] = -1
    G[i*geta + geta-1] = -1
    G[i] = -1
    G[geta*(geta-1)+i] = -1

Pn = []

for p in P:
    a, b = divmod(p-1, N)
    Pn.append((1+a)*geta+1+b)

DIREC = (1, -1, geta, -geta)
ans = 0
used = [False]*(geta*geta)
for p in Pn:
    ans += G[p]
    res = G[p]
    for d in DIREC:
        res = min(res, G[p+d])
    if G[p] != res:
        G[p] = res
        Q = [p]
        while Q:
            vn = Q.pop()
            for d in DIREC:
                vf = vn + d
                if not used[vf]:
                    if G[vf] > G[vn] + 1:
                        G[vf] = G[vn] + 1
                        Q.append(vf)
                else:
                    if G[vf] > G[vn]:
                        G[vf] = G[vn]
                        Q.append(vf)
                    
    used[p] = True
print(ans)
a=input()
if a[-1]==3: print('bon')
elif: a[-1]==0 or a[-1]==1 or a[-1]==6 or a[-1]==8: print('pon')
else: print('hon')


### FIXED CODE ###

a=input()
if a[-1]=='3': print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8': print('pon')
else: print('hon')
import sys

sys.setrecursionlimit(100000)

def calc_state_number(stair_num, now_stair, damaged_step_list, memo):
    # print(str(now_stair) + '/' + str(stair_num))
    if memo[now_stair-1] != -1:
        return memo[now_stair-1]
    if now_stair in damaged_step_list:
        memo[now_stair-1] = 0
        return memo[now_stair-1]
    if now_stair > stair_num:
        return 0
    if now_stair == stair_num:
        memo[now_stair-1] = 1
        return memo[now_stair-1]
    memo[now_stair-1] = (calc_state_number(stair_num, now_stair+1, damaged_step_list, memo) + calc_state_number(stair_num, now_stair+2, damaged_step_list, memo))%1000000007
    return memo[now_stair-1]

if __name__ == '__main__':
    N, M = map(int, input().split())
    a = [int(input()) for _ in range(M)]
    a = sorted(a)

    memo = [-1] * (N+2)

    answer = 1
    if a[-1::] == N:
        answer = 0

    for i in range(1, M):
        if a[i-1] + 1 == a[i]:
            answer = 0

    if answer != 0:
        answer = calc_state_number(N, 0, a, memo)

    print(answer)


### FIXED CODE ###

if __name__ == '__main__':
   n, m = map(int,input().split())
   a = set([int(input()) for i in range(m)])

   MOD = 1000000007

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

   for i in range(2,n+1):
      if (i-1 in a) and (i-2 in a):
         dp[i] = 0
      elif i-1 in a:
         dp[i] = dp[i-2] % MOD
      elif i-2 in a:
         dp[i] = dp[i-1] % MOD
      else:
         dp[i] = (dp[i-1] + dp[i-2]) % MOD

   print(dp[n])
n,m=map(int,input().split())
H=list(map(int,input().split()))
ans=[i  for i in range(1,n+1)]
low=[]
load=[map(int,input().split()) for j in range(m)]
for i in range(m):
    if H[load[i][0]-1]==H[load[i][1]-1]:
        low.append(load[i][0])
        low.append(load[i][1])
    elif  H[load[i][0]-1]>H[load[i][1]-1]:
        low.append(load[i][1])
    else:
        low.append(load[i][0])
low=list(set(low))
for k in low:
    ans.remove(k)
print(len(ans))

### FIXED CODE ###

n,m=map(int,input().split())
H=list(map(int,input().split()))
ans=[i  for i in range(1,n+1)]
low=[]
for i in range(m):
    x,y=map(int,input().split())
    if H[x-1]==H[y-1]:
        low.append(x)
        low.append(y)
    elif  H[x-1]>H[y-1]:
        low.append(y)
    else:
        low.append(x)
low=list(set(low))
print(len(ans)-len(low))
h,w,d = map(int,input().split())
l = [list(map(int,input().split())) for i in range(h)]
ans = [[0]*(h*w) for i in range(d)]

for i in range(h):
    for j in range(w):
        ans[l[i][j]%d][l[i][j]//d] = (l[i][j],i,j)

count =[0]*(h*w+1)
for i in range(2,len(ans[0])):
    if ans[0][i] == 0:
        break
    count[ans[0][i][0]] = count[ans[0][i-1][0]] + abs(ans[0][i][1]-ans[0][i-1][1])+abs(ans[0][i][2]-ans[0][i-1][2])
for i in range(1,d):
    for j in range(1,len(ans[i])):
        if ans[i][j] == 0:
            break
        count[ans[i][j][0]] = count[ans[i][j-1][0]] + abs(ans[i][j][1]-ans[i][j-1][1])+abs(ans[i][j][2]-ans[i][j-1][2])

n = int(input())
for i in range(n):
    a,b = map(int,input().split())
    print(count[b]-count[a])

### FIXED CODE ###

h,w,d = map(int,input().split())
px = [0]*(h*w+1)
py = [0]*(h*w+1)
for i in range(h):
    l = list(map(int,input().split()))
    for j in range(w):
        px[l[j]],py[l[j]] = i,j  

count =[0]*(h*w+1)
for i in range(d+1,h*w+1):
    count[i] = count[i-d]+abs(px[i]-px[i-d])+abs(py[i]-py[i-d])

n = int(input())
for i in range(n):
    a,b = map(int,input().split())
    print(count[b]-count[a])
n=int(input())
m=int(input())
ans = ((n*(n-1))+(m*(m-1)))//2
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
 
ans = ((n*(n-1))+(m*(m-1)))//2
 
print(ans)
N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [False for _ in range(N)]

i = 1
c = 0
jun = []
while True:
    if i == A[i-1]:
        print(i)
        exit()
    if visited[i-1]:
        lp = i
        break
    else:
        visited[i - 1] = True
        jun.append(i)
        i = A[i-1]
        c += 1
ji = jun.index(lp)
K -= len(jun[:ji])
jun = jun[lp:]

kai = K % c

if kai == len(jun) + 1:
    print(jun[0])
else:
    print(jun[kai-1])

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [False for _ in range(N)]

i = 1
c = 0
jun = []

if K <= N:
    while True:
        K -= 1
        i = A[i-1]
        if K == 0:
            print(i)
            exit()


while True:
    if i == A[i-1]:
        print(i)
        exit()
    if visited[i-1]:
        lp = i
        break
    else:
        visited[i - 1] = True
        jun.append(i)
        i = A[i-1]
        c += 1
ji = jun.index(lp)
K -= len(jun[:ji])
jun = jun[ji:]

kai = K % len(jun)
if kai == len(jun):
    print(jun[0])
else:
    print(jun[kai])
EdgeLength=input()
edgeLength=[int(i) for i in EdgeLength]

sorted.edgeLength()

sumL = 0
sumLength = [sumL += edgeLength[i] for i in range(1,len(edgeLength))]

if edgeLength[0] < sumL:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n = input()
EdgeLength=input().split()
#print(EdgeLength)
N = int(n)
EdgeLength = [int(i) for i in EdgeLength]

#list(map(int, EdgeLength))

EdgeLength.sort()
#print(EdgeLength)

sumL = sum(EdgeLength) - EdgeLength[N-1]
#print(sumL)


if EdgeLength[N-1] < sumL:
    print("Yes")
else:
    print("No")
r=int(input())
p=3.14159265359
a=r*r*p
b=p*r*2
print('{:.6f}'.format(a),'{:.6f}'.format(b)) 


### FIXED CODE ###

from math import pi
r = float(input())
s = "{:.6f}".format(r ** 2 * pi) 
l = "{:.6f}".format(r * 2 * pi)
print(s, l)
n, x = map(int, input().split())
L = list(map(int, input().split()))
if sum(L) < x:
    print(n + 1)
else:
    i = 0
    d = 0
    while d <= x:
        d += L[i]
        i += 1
    print(i)

### FIXED CODE ###

n, x = map(int, input().split())
L = list(map(int, input().split()))
if sum(L) <= x:
    print(n + 1)
else:
    i = 0
    d = 0
    while d <= x:
        d += L[i]
        i += 1
    print(i)
a,b,import numpy as np
import itertools
n, m, x = map(int, input().split())
a = np.dot([i for i in itertools.product([0, 1], repeat = n)],
           [list(map(int, input().split())) for _ in range(n)])
b = np.prod(a[:, 1:(m + 1)] >= x, axis = 1, dtype = bool)
print(min(a[:, 0][b]) if b.sum() else '-1')

### FIXED CODE ###

import numpy as np
import itertools
n, m, x = map(int, input().split())
a = np.dot([i for i in itertools.product([0, 1], repeat = n)],
           [list(map(int, input().split())) for _ in range(n)])
b = np.prod(a[:, 1:(m + 1)] >= x, axis = 1, dtype = bool)
print(min(a[:, 0][b]) if b.sum() else '-1')
N, R = map(int, input().split()))
 
if N >= 10: print(K)
else: print(100*(10-K))

### FIXED CODE ###

N, R = map(int, input().split())
 
if N >= 10: print(R)
else: print(R + 100*(10-N))
a,b=input().split()
c=b+b
if(a-b!=0):
    print(int(a-b))
else:
    print(0)



### FIXED CODE ###

a,b=[int(a)for a in input().split()]

c=b+b
if(a-c!=0)and(a-c>=0):
    print(a-c)
else:
    print(0)

#print(type(c))
import numpy as np
A,B,X=map(int,input().split())
rad = np.arctan((A*B-X)/(A*A)*2)
print(np.rad2deg(rad))

### FIXED CODE ###

import numpy as np
A,B,X=map(int,input().split())
X/=A
if A*B/2<=X:
	print(np.rad2deg(np.arctan(2*(A*B-X)/(A*A))))
else:
    print(np.rad2deg(np.arctan(B*B/(2*X))))
code = str(input())
if code[0]==code[1] or code[1]==code[2] or code[2]==code[3]:
  print("Bad")
else:
  print("Good")

### FIXED CODE ###

s = raw_input()
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
  print('Bad')
else:
  print('Good')
def resolve():
  N = int(input())
  prime_factors = factorization(N)
  tri_dict = {
    1 :  1,
    2 :  1,
    3 :  2 ,
    4 :  2 ,
    5 :  2 ,
    6 :  3 ,
    7 :  3 ,
    8 :  3 ,
    9 :  3 ,
    10 :  4 ,
    11 :  4 ,
    12 :  4 ,
    13 :  4 ,
    14 :  4 ,
    15 :  5 ,
    16 :  5 ,
    17 :  5 ,
    18 :  5 ,
    19 :  5 ,
    20 :  5 ,
    21 :  6 ,
    22 :  6 ,
    23 :  6 ,
    24 :  6 ,
    25 :  6 ,
    26 :  6 ,
    27 :  6 ,
    28 :  7 ,
    29 :  7 ,
    30 :  7 ,
    31 :  7 ,
    32 :  7 ,
    33 :  7 ,
    34 :  7 ,
    35 :  7 ,
    36 :  8 ,
    37 :  8 ,
    38 :  8 ,
    39 :  8 ,
    40 :  8
  }
  result = 0

  for prime_factor in prime_factors:
    if prime_factor[0] > 1:
      result += tri_dict[prime_factor[1]]

  print(result)
 
if __name__ == "__main__":
    resolve()

### FIXED CODE ###

# https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8

def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp //= i
      arr.append([i, cnt])

  if temp!=1:
    arr.append([temp, 1])

  if arr==[]:
    arr.append([n, 1])

  return arr

def resolve():
  N = int(input())
  prime_factors = factorization(N)
  tri_dict = {
    1 :  1,
    2 :  1,
    3 :  2,
    4 :  2,
    5 :  2,
    6 :  3,
    7 :  3,
    8 :  3,
    9 :  3,
    10 :  4,
    11 :  4,
    12 :  4,
    13 :  4,
    14 :  4,
    15 :  5,
    16 :  5,
    17 :  5,
    18 :  5,
    19 :  5,
    20 :  5,
    21 :  6,
    22 :  6,
    23 :  6,
    24 :  6,
    25 :  6,
    26 :  6,
    27 :  6,
    28 :  7,
    29 :  7,
    30 :  7,
    31 :  7,
    32 :  7,
    33 :  7,
    34 :  7,
    35 :  7,
    36 :  8,
    37 :  8,
    38 :  8,
    39 :  8,
    40 :  8,
    41 :  8,
    42 :  8,
    43 :  8,
    44 :  8,
    45 :  9,
    46 :  9,
    47 :  9,
    48 :  9,
    49 :  9,
    50 :  9,
    51 :  9,
    52 :  9,
    53 :  9,
    54 :  9,
    55 :  9,
    56 :  9,
    57 :  9,
    58 :  9,
    59 :  9
  }
  result = 0

  for prime_factor in prime_factors:
    if prime_factor[0] > 1:
      result += tri_dict[prime_factor[1]]

  print(result)


if __name__ == "__main__":
    resolve()
n,m,c=map(int, raw_input().split())
b=list(map(int,raw_input().split()))
a=[]
for i in range(n):
    a.append(list(map(int,raw_input().split())))
counter=0
for i in range(n):
    d=0
    for k in range(m):
        d+=a[i][k]*b[k]
    if d+c>0:
        counter+=1
print counter



### FIXED CODE ###

n,m,c=map(int, raw_input().split())
b=list(map(int,raw_input().split()))
a=[]
for i in range(n):
    a.append(list(map(int,raw_input().split())))
counter=0
for i in range(n):
    d=0
    for k in range(m):
        d+=a[i][k]*b[k]
    if d+c>0:
        counter+=1
print counter
while True:
    try:
        h, w = map(int, (raw_input()).split())
        if h == 0 and w == 0:
            break
        elif 3 <= h <= 100 and 3 <= w <= 100:
            print "{}".format("#" * w)
            for i in range((h - 2)):
                print "{}{}{}".format("#", "." * (w - 2), "#")
            print "{}".format("#" * w)
            print

### FIXED CODE ###

while True:
    try:
        h, w = map(int, (raw_input()).split())
        if h == 0 and w == 0:
            break

        for i in range(h):
            if i == 0 or i == (h - 1):
                print "{}".format("#" * w)
            else:
                print "{}{}{}".format("#", "." * (w - 2), "#")
        print

    except EOFError:
        break
lis = [a,b,c,d,e,k] 
for i in lis:
  i = input()
if e-a<=k:
  print('Yay!')
else:
  print(':(')

### FIXED CODE ###

lists = [0,0,0,0,0,0]
for i in range(len(lists)):
        lists[i] = int(input())

if lists[4]-lists[0]<=lists[5]:
        print("Yay!")
else:
        print(":(")
import math

a,b,x = map(int,input().split())

xdash = x / a
FULL = a * b

if FULL / 2 == xdash:
    print(math.degrees(math.atan2(b,a)))
elif FULL / 2 > xdash:
    print(90-math.degrees(math.atan(2*xdash/b/b)))
else:
    print(90-math.degrees(math.atan(a*a/2/(a*b-xdash))))


### FIXED CODE ###

import math

a,b,x = map(int,input().split())

xdash = x / a
FULL = a * b

if xdash == FULL:
    print(0)
elif FULL / 2 == xdash:
    print(math.degrees(math.atan2(b,a)))
elif FULL / 2 > xdash:
    print(90-math.degrees(math.atan(2*xdash/b/b)))
else:
    print(90-math.degrees(math.atan(a*a/2/(a*b-xdash))))
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
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 II(): return int(sys.stdin.readline())
def SI(): return input()
from bisect import bisect

def main():
    N, Q = LI()
    XST = []
    ts = []
    for _ in range(N):
        s, t, x = LI()
        s -= x
        t -= x
        XST.append([x, s, t])
        ts.append(s)
        ts.append(t)
    ts.sort()
    ts.append(INF)
    D = []
    for _ in range(Q):
        D.append(II())
    xs = [INF] * (N * 2 + 1)
    XST.sort(reverse=True)
    for x, s, t in XST:
        s0 = bisect(ts, s)
        t0 = bisect(ts, t)
        for i in range(s0, t0):
            xs[i] = x
    for d in D:
        y = bisect(ts, d)
        y = xs[y]
        if y == INF:
            y = -1
        print(y)
        ts = ts[y:]
        xs = xs[y:]
    return

main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
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 II(): return int(sys.stdin.readline())
def SI(): return input()
from bisect import bisect_left

def main():
    N, Q = LI()
    XST = []
    for _ in range(N):
        s, t, x = LI()
        s -= x
        t -= x
        XST.append([x, s, t])
    D = []
    for _ in range(Q):
        D.append(II())
    ans = [-1] * Q
    nexts = [-1] * Q
    XST.sort()
    for x, s, t in XST:
        i = bisect_left(D, s)
        end = bisect_left(D, t)
        while i < end:
            if nexts[i] == -1:
                ans[i] = x
                nexts[i] = end
                i += 1
            else:
                i = nexts[i]
    for y in ans:
        print(y)
    return

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

ans = 1
for a in A:
    ans *= a
    if ans == 0:
        break
    elif ans > 10**18:
        ans = -1
        break

print(ans)

### FIXED CODE ###

A, B = map(int,input().split())
print(A*B)
from sys import stdin
from math
def LF(): return list(map(float,stdin.readline().rstrip().split()))

tmp = LF()
ans = tmp[0]*tmp[1]
print(math.floor(ans))

### FIXED CODE ###

from decimal import Decimal
from sys import stdin
def LD(): return list(map(Decimal,stdin.readline().rstrip().split()))
 
tmp = LD()
ans = int(tmp[0]*tmp[1])
print(ans)
h,w=map(int,input().split())
result=[]
k=[]
def get_bomb(i,j):
  count=0
  for x in (i-1,i,i+1):
    for y in (j-1,j,j+1):
      if 0<=x<=h-1 and 0<=y<=w-1:
        if mapdata[x][y]=='#':
          count+=1
  return count
for i in range(h):
  line=list(input())
  mapdata.append(line)
for i in range(h):
  for j in range(w):
    if mapdata[i][j]=='.':
      k.append(str(get_bomb(i,j)))
    else:
      k.append('#')
  result.append(k)
  k=[]
for i in range(len(result)):
  result2=''.join(result[i])
  print(result2)


### FIXED CODE ###

h,w=map(int,input().split())
mapdata=[]
for i in range(h):
  line=(str(input()))
  line2=list(line)
  mapdata.append(line2)
result=[]
k=[]
def get_bomb(i,j):
  count=0
  for x in (i-1,i,i+1):
    for y in (j-1,j,j+1):
      if 0<=x<=h-1 and 0<=y<=w-1:
        if mapdata[x][y]=='#':
          count+=1
  return count
for i in range(h):
  for j in range(w):
    if mapdata[i][j]=='.':
      k.append(str(get_bomb(i,j)))
    else:
      k.append('#')
  result.append(k)
  k=[]
for i in range(len(result)):
  result2=''.join(result[i])
  print(result2)
N,X,T=map(input().split())
if N%X==0:
    print(N//X*T)
elif N%X!=0:
    print((N//X+1)*T)

### FIXED CODE ###

N,X,T=map(int,input().split())
if N%X==0:
    print(N//X*T)
elif N%X!=0:
    print((N//X+1)*T)