Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
INF = 1<<31
import numpy as np
from bisect import bisect_left

def main():
    N,Q = map(int,input().split())
    roadwork = [tuple(map(int,input().split())) for _ in range(N)]
    roadwork.sort(key = lambda x:-x[2])
    D = [int(input()) for _ in range(Q)]
    ans = np.full(Q,INF,np.int64)
    for s,t,x in roadwork:
        L = bisect_left(D,s - x)
        R = bisect_left(D,t - x)
        ans[L:R] = x
    ans[ans == INF] = -1
    ans = ans.astype(str)
    print('\n'.join(ans))
if __name__ == '__main__':
    main()

Fixed submission:
import sys
input = sys.stdin.readline
INF = (1<<31)
from bisect import bisect_left

class LazySegmentTree():

    def __init__(self,Q):
        self.N = Q
        self.tree = [INF]*(2*self.N)
        self.lazy = [INF]*(2*self.N)
   
    def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == INF:
                continue
            self.tree[h] = min(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = INF
    
    def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1])

    def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        #self._evaluate(L0)
        #self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
    def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        v = INF
        while L < R:
            if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
            if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
            L >>= 1
            R >>= 1
        return v
    '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    '''
    def debug(self):
        print(self.lazy)
        print(self.tree)
    
    def __str__(self):
        for i in range(self.N):
            self.tree[i] = min(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = INF
        for i in range(self.N,self.N*2):
            self.tree[i] = min(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]]))


N,Q = map(int,input().split())
roadwork = [tuple(map(int,input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]
st = LazySegmentTree(Q)

for s,t,x in roadwork:
    l = bisect_left(D,s - x)
    r = bisect_left(D,t - x)
    st.range_update(l,r,x)
print(str(st))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = (1<<31) - 1
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from bisect import bisect_left

class LazySegmentTree():
    fx = min
    fa = min
    fm = min

    unit_x = INF
    unit_m = INF

    def __init__(self,Q):
        self.N = Q
        self.tree = [self.unit_x]*(2*self.N)
        self.lazy = [self.unit_m]*(2*self.N)
        #self._build(array)
    
    def _build(self,array):
        for i,value in enumerate(array,self.N):
            self.tree[i] = value
        for i in range(self.N - 1,0,-1):
            self.tree[i] = self.fx(self.tree[i << 1],self.tree[i << 1|1])
   
    def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == self.unit_m:
                continue
            self.tree[h] = self.fa(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = self.fm(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = self.fm(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = self.unit_m
    
    def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            a = self.fa(self.tree[K << 1],self.lazy[K << 1])
            b = self.fa(self.tree[K << 1|1],self.lazy[K << 1|1])
            self.tree[K] = self.fx(a,b)

    def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        #self._evaluate(L0)
        #self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = self.fm(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = self.fm(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
    def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        vl = self.unit_x
        vr = self.unit_x
        while L < R:
            if L&1:
                vl = self.fx(vl,self.fa(self.tree[L],self.lazy[L]))
                L += 1
            if R&1:
                R -= 1
                vr = self.fx(self.fa(self.tree[R],self.lazy[R]),vr)
            L >>= 1
            R >>= 1
        return self.fx(vl,vr)
    '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    '''
    def debug(self):
        print(self.lazy)
        print(self.tree)
    
    def __str__(self):
        for i in range(self.N):
            self.tree[i] = self.fa(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = self.fm(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = self.fm(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = self.unit_m
        for i in range(self.N,self.N*2):
            self.tree[i] = self.fa(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]]))


N,Q = map(int,input().split())
roadwork = [tuple(map(int,input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]
st = LazySegmentTree(Q)

for s,t,x in roadwork:
    l = bisect_left(D,s - x)
    r = bisect_left(D,t - x)
    st.range_update(l,r,x)
print(str(st))

Fixed submission:
import sys
input = sys.stdin.readline
INF = (1<<31)
from bisect import bisect_left

class LazySegmentTree():

    def __init__(self,Q):
        self.N = Q
        self.tree = [INF]*(2*self.N)
        self.lazy = [INF]*(2*self.N)
   
    def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == INF:
                continue
            self.tree[h] = min(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = INF
    
    def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1])

    def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        #self._evaluate(L0)
        #self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
    def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        v = INF
        while L < R:
            if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
            if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
            L >>= 1
            R >>= 1
        return v
    '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    '''
    def debug(self):
        print(self.lazy)
        print(self.tree)
    
    def __str__(self):
        for i in range(self.N):
            self.tree[i] = min(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = INF
        for i in range(self.N,self.N*2):
            self.tree[i] = min(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]]))


N,Q = map(int,input().split())
roadwork = [tuple(map(int,input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]
st = LazySegmentTree(Q)

for s,t,x in roadwork:
    l = bisect_left(D,s - x)
    r = bisect_left(D,t - x)
    st.range_update(l,r,x)
print(str(st))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = (1<<31) - 1
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from bisect import bisect_left

class LazySegmentTree():
    fx = min
    fa = min
    fm = min

    unit_x = INF
    unit_m = INF

    def __init__(self,array):
        self.N = len(array)
        self.tree = [self.unit_x]*(2*self.N)
        self.lazy = [self.unit_m]*(2*self.N)
        #self._build(array)
    
    def _build(self,array):
        for i,value in enumerate(array,self.N):
            self.tree[i] = value
        for i in range(self.N - 1,0,-1):
            self.tree[i] = self.fx(self.tree[i << 1],self.tree[i << 1|1])
   
    def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == self.unit_x:
                continue
            self.tree[h] = self.fa(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = self.fm(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = self.fm(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = self.unit_m
    
    def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            a = self.fa(self.tree[K << 1],self.lazy[K << 1])
            b = self.fa(self.tree[K << 1|1],self.lazy[K << 1|1])
            self.tree[K] = self.fx(a,b)

    def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = self.fm(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = self.fm(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
    def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        vl = self.unit_x
        vr = self.unit_x
        while L < R:
            if L&1:
                vl = self.fx(vl,self.fa(self.tree[L],self.lazy[L]))
                L += 1
            if R&1:
                R -= 1
                vr = self.fx(self.fa(self.tree[R],self.lazy[R]),vr)
            L >>= 1
            R >>= 1
        return self.fx(vl,vr)
    '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    '''
    def debug(self):
        print(self.lazy)
        print(self.tree)
    
    def __str__(self):
        for i in range(self.N):
            self.tree[i] = self.fa(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = self.fm(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = self.fm(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = self.unit_m
        for i in range(self.N,self.N*2):
            self.tree[i] = self.fa(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]]))


N,Q = map(int,input().split())
roadwork = [tuple(map(int,input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]
st = LazySegmentTree([INF] * Q)

for s,t,x in roadwork:
    l = bisect_left(D,s - x)
    r = bisect_left(D,t - x)
    st.range_update(l,r,x)
print(str(st))

Fixed submission:
import sys
input = sys.stdin.readline
INF = (1<<31)
from bisect import bisect_left

class LazySegmentTree():

    def __init__(self,Q):
        self.N = Q
        self.tree = [INF]*(2*self.N)
        self.lazy = [INF]*(2*self.N)
   
    def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == INF:
                continue
            self.tree[h] = min(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = INF
    
    def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1])

    def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        #self._evaluate(L0)
        #self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
    def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        v = INF
        while L < R:
            if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
            if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
            L >>= 1
            R >>= 1
        return v
    '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    '''
    def debug(self):
        print(self.lazy)
        print(self.tree)
    
    def __str__(self):
        for i in range(self.N):
            self.tree[i] = min(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = INF
        for i in range(self.N,self.N*2):
            self.tree[i] = min(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]]))


N,Q = map(int,input().split())
roadwork = [tuple(map(int,input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]
st = LazySegmentTree(Q)

for s,t,x in roadwork:
    l = bisect_left(D,s - x)
    r = bisect_left(D,t - x)
    st.range_update(l,r,x)
print(str(st))