Harryxun/stf_run huggingface dataset:
from collections import deque
from bisect import bisect_left
from copy import deepcopy
n = int(input())
a = list(map(int, input().split()))

result = [-1 for _ in range(n)]
tree = [[] for _ in range(n)]
for _i in range(n-1):
    u, v = map(int, input().split())
    u, v = u-1, v-1
    tree[u].append(v)
    tree[v].append(u)

dp = [float('inf') for _i in range(n)]
q = [[0, dp]]
q = deque(q)
while q:
    p, d = q.popleft()
    i = bisect_left(d, a[p])
    d[i] = a[p]
    result[p] = d.index(float('inf')-1)
    for i in tree[p]:
        if result[i] < 0:
            q.append([i, deepcopy(d)])

for i in result:
    print(i)

### FIXED CODE ###

from bisect import bisect_left
import sys
sys.setrecursionlimit(10 ** 9)
n = int(input())
a = list(map(int, input().split()))

result = [-1 for _ in range(n)]
tree = [[] for _ in range(n)]
for _i in range(n-1):
    u, v = map(int, input().split())
    u, v = u-1, v-1
    tree[u].append(v)
    tree[v].append(u)
INF = float('inf')
dp = [INF for _i in range(n+1)]


def dfs(p, x):
    i = bisect_left(dp, a[p])
    old = dp[i]
    dp[i] = a[p]
    result[p] = bisect_left(dp, INF)
    for j in tree[p]:
        if j != x:
            dfs(j, p)
    dp[i] = old
    

dfs(0, -1)

for i in result:
    print(i)
math = input()
for i in range(2**3):
  op = format(i,"03b")
  op = op.replace('1', '+').replace('0', '-')
  ans = math[0]+op[0]+math[1]+op[1]+math[2]+op[3]+math[3]
  if eval(ans) == 7:
    print(ans+"=7")
    break


### FIXED CODE ###

math = input()
for i in range(2**3):
  op = format(i,"03b")
  op = op.replace('1', '+').replace('0', '-')
  ans = math[0]+op[0]+math[1]+op[1]+math[2]+op[2]+math[3]
  if eval(ans) == 7:
    print(ans+"=7")
    break
N, M = map(int, input())

if N == M:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

if N == M:
  print("Yes")
else:
  print("No")
def C():
    N = int(input())

    word_dict = dict()
    count = 0

    for i in range(N):
        word = sorted(input())
        if word not in word_dict:
            word_dict[word] = 1
        else:
            count += 1

    print(count)
    
if __name__ == '__main__':
    C()


### FIXED CODE ###

def C():
    N = int(input())

    word_dict = dict()
    count = 0

    for i in range(N):
        word = ''.join(sorted(input()))
        if word not in word_dict.keys():
            word_dict[word] = 1
        else:
            count += word_dict[word]
            word_dict[word] += 1

    print(count)

if __name__ == '__main__':
    C()
def main():
    int(input())
    d = {}
    ans = 0
    for i, height in enumerate(input().split()):
        d[i + height] += 1
        ans += d[i - height]


if __name__ == '__main__':
    print(main())


### FIXED CODE ###

class Map(dict):
    def __missing__(self, key):
        default_value = 0
        self[key] = default_value
        return default_value


def main():
    int(input())

    d = Map()
    ans = 0
    for i, height in enumerate(input().split()):
        height = int(height)
        d[i + height] += 1
        ans += d[i - height]

    return ans


if __name__ == '__main__':
    print(main())
def main ():
N = int(input())
A = list(map(int,input(). split ()))
if 0 in A:
print(0)
return
prod = 1
for a in A:
prod *= a
if prod > 1000000000000000000:
print(-1)
return
print(prod)
main ()

### FIXED CODE ###

a, b = map(int, input().split(' '))
print(a*b)
#import math
from functools import reduce

def gcd(a,b):
    if b>a:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

def gcds(nums):
    return reduce(gcd, nums)

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

ans = 0
for i in range(len(a)):
    aa = a[:i] + a[(i+1):]
    if ans < gcds(aa):
        ans = gcds(aa)
print(ans)

### FIXED CODE ###

a, b, t = map(int, input().split())
ans = t // a * b
print(ans)
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str[i+2] == "C"):
        ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str_list[i+2] == "C"):
        ans += 1

print(ans)
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
import itertools

sys.setrecursionlimit(500*500)

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n,m,q=map(int, readline().rstrip().split())

    aa=[0]*q
    bb=[0]*q
    cc=[0]*q
    dd=[0]*q

    for i in range(q):
        aa[i],bb[i],cc[i],dd[i]=map(int, readline().rstrip().split())

    max_score=0
    for a in itertools.combinations_with_replacement(list(range(1,m+1)),m):
        score=0
        for i in range(q):
            if (a[bb[i]-1]-a[aa[i]-1])==cc[i]:
                score+=dd[i]
        max_score=max(max_score,score)

    print(max_score)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()


### ----------------
### ここまで 
### ----------------

### FIXED CODE ###

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
import itertools

sys.setrecursionlimit(500*500)

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n,m,q=map(int, readline().rstrip().split())

    aa=[0]*q
    bb=[0]*q
    cc=[0]*q
    dd=[0]*q

    for i in range(q):
        aa[i],bb[i],cc[i],dd[i]=map(int, readline().rstrip().split())

    max_score=0

    for a in itertools.combinations_with_replacement(list(range(1,m+1)),n):
        score=0
        for i in range(q):
            if (a[bb[i]-1]-a[aa[i]-1])==cc[i]:
                score+=dd[i]
        max_score=max(max_score,score)

    print(max_score)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()


### ----------------
### ここまで 
### ----------------
N,M=map(int,input().split())
section=[[] for i in range(M+1)]
for i in range(N):
  l,r=map(int,input().split())
  section[r-l+1].append((l,r))

def add(B,a,s):
    x=a
    while x<=len(B):
        B[x]+=s
        x+=x&(-x)
        
def sums(B,a):
    x=a
    S=0
    while x!=0:
        S+=B[x]
        x-=x&(-x)
    return S

Line=[0]*(M+2)
K=N
for d in range(1,M+1):
  for l,r in section[d]:
    add(Line,l,1)
    add(Line,r+1,-1)
    K-=1
  ans=K
  for s in range(M//d+1):
    ans+=sums(Line,s*d)
  print(ans)





### FIXED CODE ###

N,M=map(int,input().split())
section=[[] for i in range(M+1)]
for i in range(N):
  l,r=map(int,input().split())
  section[r-l+1].append((l,r))

def add(B,a,s):
    x=a
    while x<=len(B)-1:
        B[x]+=s
        x+=x&(-x)
        
def sums(B,a):
    x=a
    S=0
    while x!=0:
        S+=B[x]
        x-=x&(-x)
    return S

Line=[0]*(M+2)
K=N
for d in range(1,M+1):
  for l,r in section[d]:
    add(Line,l,1)
    add(Line,r+1,-1)
    K-=1
  ans=K
  for s in range(M//d+1):
    ans+=sums(Line,s*d)
  print(ans)
M, N = map(int, input().split())
A, B = map(int, input().split())

if M < A + B:
  print(-1)
else:
  print(M - A - B)

### FIXED CODE ###

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

if M < sum(l):
  print(-1)
else:
  print(M - sum(l))
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
if e - a > k :
    print(':(')
else :
    print('Yey!')


### FIXED CODE ###


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e-a > k:
  print(":(")
else:
  print("Yay!")
math.ceil((B-1)/A)

### FIXED CODE ###

A,B=input().split()
import math
print(math.ceil((int(B)-1)/(int(A)-1)))
X, A = map(int, input().split())
print(0 if x < A else 10)

### FIXED CODE ###

X, A = map(int, input().split())
print(0 if X < A else 10)
n = int(input())
s = input()
dp = [[0 for i in range(5001)] for j in range(5001)]

for i in range(n-1,-1,-1):
	for j in range(n-1,-1,-1):
		if s[i] != s[j]:
			dp[i][j] = 0
		else:
			dp[i][j] = dp[i+1][j+1] + 1

res = 0
for i in range(n):
	for j in range(n):
		if i >= j:
			continue
		x = min(dp[i][j], j-i)
		res = max(x,res)
print (res)

### FIXED CODE ###

import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = [-i for i in a]
heapq.heapify(b)
for i in range(m):
	c = heapq.heappop(b)
	c *= -1
	c //= 2
	heapq.heappush(b,-c)
s = -sum(b)
print (s)
num = input()
return num ** 3


### FIXED CODE ###

num_str = input()
num = int(num_str)
print(num ** 3)
h, w = map(int, input().split())
a = [input() for _ in range(h)]
mod = 10**9+7

dp = [[0 for _ in range(h+1)] for _ in range(w+1)]
dp[0][0] = 1

for i in range(h):
    for j in range(w):
        if (i+1 < h) and (a[i+1][j] == '.'):
            dp[i+1][j] += dp[i][j]
            dp[i+1][j] %= mod
        if (j+1 < w) and (a[i][j+1] == '.'):
            dp[i][j+1] += dp[i][j]
            dp[i][j+1] %= mod

print(dp[h-1][w-1])

### FIXED CODE ###

h, w = map(int, input().split())
a = [input() for _ in range(h)]
mod = 10**9+7

dp = [[0 for _ in range(w+1)] for _ in range(h+1)]
dp[0][0] = 1

for i in range(h):
    for j in range(w):
        if i+1 < h and a[i+1][j] == '.':
            dp[i+1][j] += dp[i][j]
            dp[i+1][j] %= mod
        if j+1 < w and a[i][j+1] == '.':
            dp[i][j+1] += dp[i][j]
            dp[i][j+1] %= mod

print(dp[h-1][w-1])
import sys

sys.setrecursionlimit(10**7)

def dfs(x):
    uni[cnt].append(x)
    seen[x-1]=1
    for i in fri[x-1]:
        if seen[i-1]==0:
            dfs(i)
    

n,m,k=map(int,input().split())

fri=[[] for i in range(n)]
blk=[[] for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    fri[a-1].append(b)
    fri[b-1].append(a)

for i in range(k):
    c,d=map(int,input().split())
    blk[c-1].append(d)
    blk[d-1].append(c)


seen=[0 for i in range(n)]

uni=[]
cnt=0
for i in range(1,n+1):
    if seen[i-1]==0:
        uni.append([])
        dfs(i)
        cnt+=1

seq=[0 for i in range(n)]

for unii in uni:
    for j in unii:
        cj=len(unii)-len(fri[j-1])-len(set(unii)&set(blk[j-1]))-1
        seq[j-1]=cj

print(*seq)


### FIXED CODE ###

n=int(input())
print((n+1)//2)
H, W = list(map(int, input().split()))
s = []
s.append(['.']*(W+2))
for i in range(H):
    #二次元配列に入力を入れる
    array =['.']
    array.extend(list(input()))
    array.extend(['.'])
    s.append(array)
s.append(['.']*(W+2))
#print(s)
count = 0
for i in range(1,W+1):
    for j in range(1,H+1):
        if(s[i][j] == '#' and s[i][j-1] != '#' and s[i][j+1] != '#' and s[i-1][j] != '#' and s[i+1][j] != '#'):
            count += 1

if (count==0):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

H, W = list(map(int, input().split()))
s = []
s.append(['.']*(W+2))
for i in range(H):
    #二次元配列に入力を入れる
    array =['.']
    array.extend(list(input()))
    array.extend(['.'])
    s.append(array)
s.append(['.']*(W+2))
#print(s)
count = 0
for i in range(1,H+1):
    for j in range(1,W+1):
        if(s[i][j] == '#' and s[i][j-1] != '#' and s[i][j+1] != '#' and s[i-1][j] != '#' and s[i+1][j] != '#'):
            count = count+1

if (count==0):
    print("Yes")
else:
    print("No")
a,b = map(int,input().split())
if a>=13:
  print(b)
elif a>=6 and a<=12
  print(int(b/2))
else 
  print(0)
    


### FIXED CODE ###

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

if a>=13:
  print(b)
elif a>=6:
  print(b//2)
else:
  print(0)
S = input()
if S.count(7)==0:
  print(No)
else:
  print(Yes)
  

### FIXED CODE ###

S = list(input())
if S.count('7'):
  print('Yes')
else:
  print('No')
a = [int(input()) for i in range(3)]
b = a[1]
c = a[1]
d = a[2]
if b == 7 or c == 7 or d == 7:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a = str(input())
b = a[0]
c = a[1]
d = a[2]
if b == "7" or c == "7" or d == "7":
    print("Yes")
else:
    print("No")
def main():
    import math
    import collections
    import numpy as np

    def combinations_count(n, r):
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

    As = np.tile(A, (N, 1))

    for i, A in enumerate(As):
        A[i] = 0
        tmp_A = collections.Counter(A)
        su = 0
        for pairs in sorted(tmp_A.values(), reverse=True):
            if pairs >= 2:
                su += combinations_count(pairs, 2)
            else:
                break
        print(su)


if __name__ == '__main__':
    main()


### FIXED CODE ###



def main():
    import collections

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

    allc = collections.Counter(A)
    # all_list = [0]*N
    allsu = 0
    for pairs in sorted(allc.values(), reverse=True):
        allsu += pairs*(pairs-1)//2

    for a in A:
        num = allc[a]
        print(allsu - (num-1))

    # for i in range(N):
    #     x = A[i]
    #     A[i] = 0
    #     tmp_A = cc(A)
    #     su = 0
    #     for pairs in sorted(tmp_A.values(), reverse=True):
    #         if pairs >= 2:
    #             su += pairs*(pairs-1)//2
    #         else:
    #             break
    #     A[i] = x
    #     print(su)


if __name__ == '__main__':
    main()
n = int(input())

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

ans = 0
for i in range(n):
  if i >= 1 and a[i - 1] + 1 == a[i]:
    ans += c[i - 1]
  ans += b[i]

print(ans)

### FIXED CODE ###


n = int(input())

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

ans = 0
for i in range(n):
  if i >= 1 and a[i - 1] + 1 == a[i]:
    ans += c[a[i - 1] - 1]
  ans += b[a[i] - 1]

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

import collections
A_c = collections.Counter(A)
A_A = A_c.most_common()

ans = 0
for i in range(len(A_A)):
  if i >K-1:
    ans += list(A_A[i])[1]

if A_A<=K:
  print(0)
else:
  print(ans)

### FIXED CODE ###

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

import collections
A_c = collections.Counter(A)
A_A = A_c.most_common()

ans = 0
for i in range(len(A_A)):
  if i >K-1:
    ans += list(A_A[i])[1]

if len(A_A)<=K:
  print(0)
else:
  print(ans)
n,t=map(int, input().split())
l=[input().split() for i in range(n)]

k=[]

for x in range(n):
  if (int(l[x][1])<=t):
    k.append(l[x][0])
  
if (k==[]):
  print('TLE')
else:  
  print(min(k))


### FIXED CODE ###

n=int(input())
if (n==1):
  print('Hello World')
else:
  a=int(input())
  b=int(input())
  print(a+b)
while True:
    s=input().split()
    t=[int(s) for i in s]
    if t[0]==0:
        break
    else:
        for i in range(t[0]):
            print("#"*t[1])
            print(" ")
    


### FIXED CODE ###

while True:
    s=input().split()
    t=[int(l) for l in s]
    if t[0]==0:
        break
    else:
        for i in range(t[0]):
            print("#"*t[1])
        print()
a,b,c,d = map(int, raw_input().split())
print min(a,b) + min(c,d)

### FIXED CODE ###

ais = [int(raw_input()) for jj in range(4)]
print min(ais[:2]) + min(ais[2:])
N, X = map(int,input().split())
L = list(map(int,input().split()))
count = 0
tmp = 0
i = 0
while(tmp<=X):
    tmp += L[i]
    count += 1
    i += 1
print(count)

### FIXED CODE ###

N, X = map(int,input().split())
L = list(map(int,input().split()))
count = 1
now = 0
for i in range(N):
    if now+L[i]>X:
        break
    else:
        now += L[i]
        count += 1
print(count)
a=input()
s=list(map(int, input().split()))
bad=0
for i in s:
    if s%2==0:
        if s%3!=0 or s%5!=0:
            bad+=1
if bad>0:
    print('DENIED') 
    else:
        print('APPROVED')



### FIXED CODE ###

a=int(input())
s=list(map(int,input().split()))
count=0
good=0
for i in s:
    if i%2==0:
        count+=1
        if i%3==0 or i%5==0:
            good+=1
if good==count:
    print('APPROVED')
else:
    print('DENIED')
kazu = {"A":10,"B":11,"C":12,"D":13,"E":14,"F":15}
x, y = input().split()
if kazu[x] > kazu[y]:
  print(">")
elif kazu[x] = kazu[y]:
  print("=")
elif kazu[x] < kazu[y]:
  print("<")

### FIXED CODE ###

kazu = ["A","B","C","D","E","F"]
X, Y = input().split()
x = kazu.index(X)
y = kazu.index(Y)
if x > y:
  print(">")
elif x == y:
  print("=")
elif x < y:
  print("<")
n = input()
x = 1
ans = ''
while 1:
  if x > n:
     break
  if ( x % 3 == 0 ) or ( '3' in str(x) ):
     ans = ans + x
  x += 1
  print ans

### FIXED CODE ###

n = input()
ans = '' 
for i in range(3,n+1):
    if i%3 == 0 or '3' in str(i):
        ans += ' ' + str(i)
print ans
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
# map(int, input().split())
# int(input())
# input().split()
# mojiretu = ','.join(str_list)
# sorted(input())

n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
now = 0
while True:
    if now > x:
        print(ans)
        sys.exit()
    now += a[ans]
    ans += 1

### FIXED CODE ###

import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
# map(int, input().split())
# int(input())
# input().split()
# mojiretu = ','.join(str_list)
# sorted(input())

n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
now = 0
d = []
d.append(0)
for i in range(len(a)):
    d.append(d[i] + a[i])
for k in d:
    if k <= x:
        ans += 1
print(ans)
s = sum(input().split())
print('bust' if s >= 22 else 'win') 

### FIXED CODE ###

s = sum(int(x) for x in input().split())
print('bust' if s >= 22 else 'win')
N = int(input())
A = [int(x) for x in input().split()]
if 0 in A:
	print("-1")
	exit(0)
ans = 1
lim = 10**18
for a in A:
	ans *= a
    if ans > lim:
      print("-1")
      exit(0)
print(ans)

### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]
if 0 in A:
  print("0")
  exit(0)
ans = 1
lim = 10**18
for a in A:
  ans *= a
  if ans > lim:
    print("-1")
    exit(0)
print(ans)
N = int(input())
K = int(input())

if (2 * K - 1 <= N):
    print("YES")
else: 
    print("NO")


### FIXED CODE ###

N = list(map(int, input().split()))
if (2 * N[1] - 1 <= N[0]):
    print("YES")
else: 
    print("NO")
import math

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

print((a * b) // math.gcd(a, b))

### FIXED CODE ###

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

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

print((a * b) // gcd(a, b))
import sys

alphas = [chr(i) for i in range(ord('a'), ord('z') +1)]
for alpha in sys.stdin:
	print(alphas[alphas.index(alpha)+1])

### FIXED CODE ###

alpha = input()
print(chr(ord(alpha)+1))
sum = input()

if sum[0] == 1:
  cnt += 1:
endif

if sum[1] == 1:
  cnt += 1:
endif

if sum[2] == 1:
  cnt += 1:
endif

print(cnt)

### FIXED CODE ###

sum = input()
cnt = 0
  
if sum[0] == '1' :
  cnt += 1
 
if sum[1] == '1':
  cnt += 1
 
if sum[2] == '1':
  cnt += 1

print(cnt)
#include<bits/stdc++.h>
using namespace std;
typedef long long int INT;

INT pow(int n,int k)
{
    INT a=1;
    for (int i=1;i<=k;i++){
        a*=n;
    }
    return a;
}

int main()
{
    INT n;
    int k;
    cin>>n>>k;
    int i=0;
    while(1){
        if(n<pow(k,i)){
            cout<<i<<endl;
            break;
        }
        ++i;
    }
}

### FIXED CODE ###

n,k=map(int,input().split())
cnt=0
i=1
 
while True:
    p=n//k**i
    if p==0:
        print(i)
        break
    else:
        i+=1
a,b = map(int,input().split())
if a <= b:
    print('unsafe')
elif:
    print('safe')

### FIXED CODE ###

a,b = (map(int,input().split()))
if a <= b:
    print('unsafe')
if a > b:
    print('safe')
a,b = [int(e) for e in input().split()]
print(a*b)2 5

### FIXED CODE ###

a,b = [int(e) for e in input().split()]
print(a*b)
n = input()
a = input().split()
s = 0
m = a[0]
M = a[0]
for i in range(0,n):
    s = s + a[i]
    if m > a[i]:
        m = a[i]
    if M < a[i]:
        M = a[i]
print m,M,s

### FIXED CODE ###

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

wa = 0
minimum = suretsu[0]
maximum = suretsu[0]

for i in range(n):
    wa += suretsu[i]
    if suretsu[i] > maximum:
        maximum = suretsu[i]
    if suretsu[i] < minimum:
        minimum = suretsu[i]
    
print (minimum,maximum,wa)
N = int(input())
a = list(int(i) for i in input().split())  

sum = 0
for k in range(N):
  if k == 0:
    sum += abs(a[k])
  elif k == (N-1):
    sum += abs(a[k] - a[k-1]) + abs(a[k])
  else:
    sum += abs(a[k] - a[k-1])

for j in range(N):
  if j == 0:
    if (a[j+1] - a[j]) * (a[j] -0) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]),abs(a[j]-a[j+1])))
  elif j == N-1:  
    if (a[j] - a[j-1]) * (0 - a[j]) >= 0:
      print(sum)
    else:
      print(sum - 2 * mins(abs(a[j]-a[j-1]),abs(a[j]-a[j+1])))
  else:
    if (a[j] - a[j-1] ) * (a[j+1] - a[j]) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]-a[j-1]),abs(a[j+1]-a[j])))
    

### FIXED CODE ###

a = [int(input()) for i in range(2)]
b = [int(input()) for i in range(2)]
print(min(a)+min(b))
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
H = sorted(H,reverse = True)
Flag = False
if len(H)<=(K):
        H.clear()
        Flag = True
        print("0")
        
if Flag == False:
    for i in range(K):
        H.remove(H[i])
    print(sum(H))

### FIXED CODE ###

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

A.sort(reverse=True)
print(sum(A[K:]))
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 LLI(): return [int(x) for x in sys.stdin.readlines()]
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()
        XST.append([x, s, t])
    XST.sort()
    D = LLI()
    ans = [-1] * Q
    nexts = [-1] * Q
    for x, s, t in XST:
        i = bisect_left(D, s - x)
        end = bisect_left(D, t - x)
        to = end
        while nexts[to] != -1:
            to = nexts[to]
        while i < end:
            if nexts[i] == -1:
                ans[i] = x
                nexts[i] = to
                i += 1
            else:
                i = nexts[i]
    for y in ans:
        print(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()
A, B = map(int,input().split())
if A < 6:
  print(0)
elif A > 12:
  print(B)
else:
  print(int(B/2)

### FIXED CODE ###

A, B = map(int,input().split())
if A < 6:
  print(0)
elif A > 12:
  print(B)
else:
  print(int(B/2))