Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(20000)
def update(Set,x,y,z):
    for i in range(x,y+1):
        Set[i] = z

def lazy_update(Set,x,y,z):
    left = int(x/4)
    if((x%4)!=0):
        left = left + 1
    right = int(y/4)
    for i in range(left,right):
        Set[i] = z
    return left*4,right*4

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    A = [2**31 - 1]*_N
    N = 1
    while True:
        if(N*4 >= _N):
            break
        N += 1
    lazy_A = [None]*N
    #print(A,lazy_A)
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            if(lazy_A[int(query[1]/4)] is not None or lazy_A[int(query[2]/4)] is not None):
                for i in range(int(query[1]/4),int(query[2]/4)+1):
                    if(lazy_A[i] is None):
                        continue
                    A[i*4:i*4+4] = [lazy_A[i]]*4
                    lazy_A[i] = None
                #print("A update from lazy")
                #print(A)
                #print(lazy_A)
                update(A,query[1],query[2],query[3])
                #print("update A")
                #print(A)
            if(lazy_A[int(query[1]/4)] is None or lazy_A[int(query[2]/4)] is None):
                if(query[2] - query[1] < 4):
                    update(A,query[1],query[2],query[3])
                    #print("A update")
                    #print(A)
                else:
                    right, left = lazy_update(lazy_A,query[1],query[2],query[3])
                    #print("lazy update")
                    #print(lazy_A)
                    if(right > 0):
                        #print("A left update")
                        update(A,query[1],right-1,query[3])
                        #print(A)
                    if(left > 0):
                        #print("A right update")
                        update(A,left,query[2],query[3])
                        #print(A)
        # find
        if(query[0]==1):
            if(lazy_A[int(query[1]/4)] is not None):
                A[int(query[1]/4)*4:int(query[1]/4)*4+4] = [lazy_A[int(query[1]/4)]]*4
                lazy_A[int(query[1]/4)] = None
                #print("A update from lazy")
                #print(A)
            print(A[query[1]])



Fixed submission:
import sys
import math
import time
sys.setrecursionlimit(20000)
INT_MAX = 2**31 - 1

def update(tree,x,y,z,N):
    left = x + N #- 1
    right = y + N#- 1

    while True:
        if(left >= right):
            break
        if(right % 2 == 1):
            right -= 1
            tree[right - 1] = z
        if(left % 2 == 1):
            tree[left - 1] = z
            left += 1

        #left += 1#math.floor((left + 1)/2)
        #right -= 1#math.floor((right - 1)/2)
        left >>= 1
        right >>= 1

def find(tree,x,N):
    x += N - 1
    s = (INT_MAX, -1)
    while True:
        if(x < 0):
            break
        if(tree[x][0] is not None and (tree[x][1] > s[1])):
            s = tree[x]
        x = math.floor((x - 1)/2)
    return s[0]

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    N = 1
    while True:
        if(N >= _N):
            break
        N *= 2
    A = [(None,-1)]*(2*N - 1)

    #start = time.time()
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            update(A,query[1],query[2]+1,(query[3],i),N)
            #print(A)
        # find
        if(query[0]==1):
            #z = find(A,lazy_A,query[1],query[1]+1,0,0,N,N)
            z = find(A,query[1],N)
            print(z)
    #elapsed_time = time.time() - start
    #print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import time
sys.setrecursionlimit(20000)
def update(Set,x,y,z):
    for i in range(x,y+1):
        Set[i] = z

def lazy_update(Set,x,y,z):
    left = int(x/4)
    if((x%4)!=0):
        left = left + 1
    right = int(y/4)
    for i in range(left,right):
        Set[i] = z
    return left*4,right*4

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    A = [2**31 - 1]*_N
    N = 1
    while True:
        if(N*4 >= _N):
            break
        N += 1
    lazy_A = [None]*N
    #start = time.time()
    #print(A,lazy_A)
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            if(lazy_A[int(query[1]/4)] is not None or lazy_A[int(query[2]/4)] is not None):
                for i in range(int(query[1]/4),int(query[2]/4)+1):
                    if(lazy_A[i] is None):
                        continue
                    A[i*4:i*4+4] = [lazy_A[i]]*4
                    lazy_A[i] = None
                #print("A update from lazy")
                #print(A)
                #print(lazy_A)
                update(A,query[1],query[2],query[3])
                #print("update A")
                #print(A)
            elif(lazy_A[int(query[1]/4)] is None or lazy_A[int(query[2]/4)] is None):
                if(query[2] - query[1] < 4):
                    update(A,query[1],query[2],query[3])
                    #print("A update")
                    #print(A)
                else:
                    right, left = lazy_update(lazy_A,query[1],query[2],query[3])
                    #print("lazy update")
                    #print(lazy_A)
                    if(right > 0):
                        #print("A left update")
                        update(A,query[1],right-1,query[3])
                        #print(A)
                    if(left > 0):
                        #print("A right update")
                        update(A,left,query[2],query[3])
                        #print(A)
        # find
        if(query[0]==1):
            if(lazy_A[int(query[1]/4)] is not None):
                A[int(query[1]/4)*4:int(query[1]/4)*4+4] = [lazy_A[int(query[1]/4)]]*4
                lazy_A[int(query[1]/4)] = None
                #print("A update from lazy")
                #print(A)
            print(A[query[1]])
    #elapsed_time = time.time() - start
    #print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")



Fixed submission:
import sys
import math
import time
sys.setrecursionlimit(20000)
INT_MAX = 2**31 - 1

def update(tree,x,y,z,N):
    left = x + N #- 1
    right = y + N#- 1

    while True:
        if(left >= right):
            break
        if(right % 2 == 1):
            right -= 1
            tree[right - 1] = z
        if(left % 2 == 1):
            tree[left - 1] = z
            left += 1

        #left += 1#math.floor((left + 1)/2)
        #right -= 1#math.floor((right - 1)/2)
        left >>= 1
        right >>= 1

def find(tree,x,N):
    x += N - 1
    s = (INT_MAX, -1)
    while True:
        if(x < 0):
            break
        if(tree[x][0] is not None and (tree[x][1] > s[1])):
            s = tree[x]
        x = math.floor((x - 1)/2)
    return s[0]

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    N = 1
    while True:
        if(N >= _N):
            break
        N *= 2
    A = [(None,-1)]*(2*N - 1)

    #start = time.time()
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            update(A,query[1],query[2]+1,(query[3],i),N)
            #print(A)
        # find
        if(query[0]==1):
            #z = find(A,lazy_A,query[1],query[1]+1,0,0,N,N)
            z = find(A,query[1],N)
            print(z)
    #elapsed_time = time.time() - start
    #print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import time
sys.setrecursionlimit(20000)
def update(Set,x,y,z):
    for i in range(x,y+1):
        Set[i] = z

def lazy_update(Set,i,x):
    Set[i] = x

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    N = 1
    sqrtN = 1
    while True:
        if(N >= _N):
            break
        sqrtN += 1
        N = sqrtN**2
    A = [2**31 - 1]*N
    lazy_A = [None]*sqrtN
    #start = time.time()
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            for i in range(0,sqrtN):
                if((i+1)*sqrtN <= query[1] or query[2] <= i*sqrtN):
                    pass
                if(query[1] <= i*sqrtN and (i+1)*sqrtN <= query[2]):
                    if not (lazy_A[i] == query[3]):
                        lazy_update(lazy_A,i,query[3])
                else:
                    if(lazy_A[i] is not None):
                        A[i*sqrtN:(i+1)*sqrtN] = [lazy_A[i]]*sqrtN
                        lazy_A[i] = None
                    n = max(query[1],i*sqrtN)
                    m = min(query[2],(i+1)*sqrtN)
                    #print("max from {0} {1}".format(query[1],i*sqrtN))
                    #print("min from {0} {1}".format(query[2],(i+1)*sqrtN))
                    #print(n,m)
                    update(A,n,m,query[3])
                    #update(A,(i+1)*sqrtN+1,query[2],query[3])
            #print(A)
        # find
        if(query[0]==1):
            if(lazy_A[int(query[1]/sqrtN)] is not None):
                A[int(query[1]/sqrtN)*sqrtN:int(query[1]/sqrtN)*sqrtN+sqrtN] = [lazy_A[int(query[1]/sqrtN)]]*sqrtN
                lazy_A[int(query[1]/sqrtN)] = None
                #print("A update from lazy")
                #print(A)
            print(A[query[1]])
    #elapsed_time = time.time() - start
    #print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")



Fixed submission:
import sys
import math
import time
sys.setrecursionlimit(20000)
INT_MAX = 2**31 - 1

def update(tree,x,y,z,N):
    left = x + N #- 1
    right = y + N#- 1

    while True:
        if(left >= right):
            break
        if(right % 2 == 1):
            right -= 1
            tree[right - 1] = z
        if(left % 2 == 1):
            tree[left - 1] = z
            left += 1

        #left += 1#math.floor((left + 1)/2)
        #right -= 1#math.floor((right - 1)/2)
        left >>= 1
        right >>= 1

def find(tree,x,N):
    x += N - 1
    s = (INT_MAX, -1)
    while True:
        if(x < 0):
            break
        if(tree[x][0] is not None and (tree[x][1] > s[1])):
            s = tree[x]
        x = math.floor((x - 1)/2)
    return s[0]

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    N = 1
    while True:
        if(N >= _N):
            break
        N *= 2
    A = [(None,-1)]*(2*N - 1)

    #start = time.time()
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            update(A,query[1],query[2]+1,(query[3],i),N)
            #print(A)
        # find
        if(query[0]==1):
            #z = find(A,lazy_A,query[1],query[1]+1,0,0,N,N)
            z = find(A,query[1],N)
            print(z)
    #elapsed_time = time.time() - start
    #print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import time
sys.setrecursionlimit(20000)

def lazy_tree_merge(lazy,tree,i,N):
    if(lazy[i][0] is not None):
        tree[i] = lazy[i]
        if(i < N-1):
            lazy[i*2+1] = lazy[i]
            lazy[i*2+2] = lazy[i]
        lazy[i] = (None,-1)

def update(tree,lazy,x,y,k,l,r,i,z,N):
    if (r <= x or y <= l):
        lazy_tree_merge(lazy,tree,k,N)
        return True
    if ( x <= l and r <= y):
        lazy[k] = (z,i)
        lazy_tree_merge(lazy,tree,k,N)
        return True

    lazy_tree_merge(lazy,tree,k,N)
    update(tree, lazy, x, y, k*2 + 1, l, int((l+r)/2), i, z, N)
    #update(tree, lazy, x, y, k*2 + 2, l, int((l+r)/2), i, z, N)
    update(tree, lazy, x, y, k*2 + 2, int((l+r)/2), r, i, z, N)
    if(tree[k*2+1][1] < tree[k*2+2][1]):
        tree[k] = tree[k*2+2]
    else:
        tree[k] = tree[k*2+1]
    #tree[k] = min(tree[k*2+1], tree[k*2+2])

def find(tree,lazy,x,y,k,l,r,N):

    if (r <= x or y <= l):
        return 2**31 - 1
    if ( x <= l and r <= y):
        lazy_tree_merge(lazy,tree,k,N)
        return tree[k][0]

    lazy_tree_merge(lazy,tree,k,N)
    v_left = find(tree, lazy_A, x, y, k*2 + 1, l, int((l+r)/2), N)
    v_right = find(tree, lazy_A, x, y, k*2 + 2, int((l+r)/2), r, N)
    #print(v_left)
    #print(v_right)
    return min(v_left, v_right)

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    INT_MAX = 2**31 - 1
    N = 1
    while True:
        if(N >= _N):
            break
        N *= 2
    if not (N == 1):
        A = [(INT_MAX,-1)]*(2*N - 1)
        lazy_A = [(None,-1)]*(2*N - 1)
    else:
        A = [(INT_MAX,-1)]*(2*N)
        lazy_A = [(None,-1)]*(2*N)

    #start = time.time()
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            update(A,lazy_A,query[1],query[2]+1,0,0,N,i,query[3],N)
            #print(A,lazy_A)
        # find
        if(query[0]==1):
            z = find(A,lazy_A,query[1],query[1]+1,0,0,N,N)
            print(z)
    #elapsed_time = time.time() - start
    #print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")



Fixed submission:
import sys
import math
import time
sys.setrecursionlimit(20000)
INT_MAX = 2**31 - 1

def update(tree,x,y,z,N):
    left = x + N #- 1
    right = y + N#- 1

    while True:
        if(left >= right):
            break
        if(right % 2 == 1):
            right -= 1
            tree[right - 1] = z
        if(left % 2 == 1):
            tree[left - 1] = z
            left += 1

        #left += 1#math.floor((left + 1)/2)
        #right -= 1#math.floor((right - 1)/2)
        left >>= 1
        right >>= 1

def find(tree,x,N):
    x += N - 1
    s = (INT_MAX, -1)
    while True:
        if(x < 0):
            break
        if(tree[x][0] is not None and (tree[x][1] > s[1])):
            s = tree[x]
        x = math.floor((x - 1)/2)
    return s[0]

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    N = 1
    while True:
        if(N >= _N):
            break
        N *= 2
    A = [(None,-1)]*(2*N - 1)

    #start = time.time()
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            update(A,query[1],query[2]+1,(query[3],i),N)
            #print(A)
        # find
        if(query[0]==1):
            #z = find(A,lazy_A,query[1],query[1]+1,0,0,N,N)
            z = find(A,query[1],N)
            print(z)
    #elapsed_time = time.time() - start
    #print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
sys.setrecursionlimit(20000)
INT_MAX = 2**31 - 1
lazy_init = (None,-1)
def lazy_tree_merge(lazy,tree,i,N):
    if(lazy[i][0] is not None):
        tree[i] = lazy[i]
        if(i < N-1):
            lazy[i*2+1] = lazy[i]
            lazy[i*2+2] = lazy[i]
        lazy[i] = lazy_init

def update(tree,lazy,x,y,k,l,r,i,z,N):
    if (r <= x or y <= l):
        lazy_tree_merge(lazy,tree,k,N)
        return True
    if ( x <= l and r <= y):
        lazy[k] = (z,i)
        lazy_tree_merge(lazy,tree,k,N)
        return True

    lazy_tree_merge(lazy,tree,k,N)
    center = int((l+r)/2)
    update(tree, lazy, x, y, k*2 + 1, l, center, i, z, N)
    #update(tree, lazy, x, y, k*2 + 2, l, int((l+r)/2), i, z, N)
    update(tree, lazy, x, y, k*2 + 2, center, r, i, z, N)
    if(tree[k*2+1][1] < tree[k*2+2][1]):
        tree[k] = tree[k*2+2]
    else:
        tree[k] = tree[k*2+1]

def find(tree,lazy,x,y,k,l,r,N):

    if (r <= x or y <= l):
        return INT_MAX
    if ( x <= l and r <= y):
        lazy_tree_merge(lazy,tree,k,N)
        return tree[k][0]

    lazy_tree_merge(lazy,tree,k,N)
    v_left = find(tree, lazy_A, x, y, k*2 + 1, l, int((l+r)/2), N)
    v_right = find(tree, lazy_A, x, y, k*2 + 2, int((l+r)/2), r, N)
    return min(v_left, v_right)

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    N = 1
    while True:
        if(N >= _N):
            break
        N <<= 1
    if not (N == 1):
        A = [(INT_MAX,-1)]*(2*N - 1)
        lazy_A = [lazy_init]*(2*N - 1)
    else:
        A = [(INT_MAX,-1)]*(2*N)
        lazy_A = [lazy_init]*(2*N)

    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            update(A,lazy_A,query[1],query[2]+1,0,0,N,i,query[3],N)
            #print(A,lazy_A)
        # find
        if(query[0]==1):
            z = find(A,lazy_A,query[1],query[1]+1,0,0,N,N)
            print(z)



Fixed submission:
import sys
import math
import time
sys.setrecursionlimit(20000)
INT_MAX = 2**31 - 1

def update(tree,x,y,z,N):
    left = x + N #- 1
    right = y + N#- 1

    while True:
        if(left >= right):
            break
        if(right % 2 == 1):
            right -= 1
            tree[right - 1] = z
        if(left % 2 == 1):
            tree[left - 1] = z
            left += 1

        #left += 1#math.floor((left + 1)/2)
        #right -= 1#math.floor((right - 1)/2)
        left >>= 1
        right >>= 1

def find(tree,x,N):
    x += N - 1
    s = (INT_MAX, -1)
    while True:
        if(x < 0):
            break
        if(tree[x][0] is not None and (tree[x][1] > s[1])):
            s = tree[x]
        x = math.floor((x - 1)/2)
    return s[0]

if __name__ == '__main__':
    _N,query_num = map(int, input().split())
    N = 1
    while True:
        if(N >= _N):
            break
        N *= 2
    A = [(None,-1)]*(2*N - 1)

    #start = time.time()
    for i in range(query_num):
        query = list(map(int,input().split()))
        # update
        if(query[0]==0):
            update(A,query[1],query[2]+1,(query[3],i),N)
            #print(A)
        # find
        if(query[0]==1):
            #z = find(A,lazy_A,query[1],query[1]+1,0,0,N,N)
            z = find(A,query[1],N)
            print(z)
    #elapsed_time = time.time() - start
    #print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")