Buggy python submission (verdict: Runtime Error):
import math

INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)


def judge_max(x,y):
    
    if x > y :return x
    else:return y 

def judge_min(x,y):
    if x > y :return y
    else :return x



def update(x):
 
    for i in range(int(x*b),int(judge_min(n-1,(x+1)*b))):a[i]=l[int(x)]
    l[int(x)]=-1;
    return;
 

if __name__=='__main__':
    a = [INT_MAX for i in range(n)]
    l = [-1 for i in range(n)]
    
   
    for i in range(q):
        t, *com = (int(x) for x in input().split())
        if t : 
            x = com[0]
            if l[int(x/b)] != -1:update(x/b)
            print(a[x])
        else:
            x,y,z = com
            if l[int(x/b)] != -1:update(x/b)
            for i in range(x,int(judge_min(y,(x/b+1)*b))):a[i]=z
            for i in range(int(x/b)+1,int(y/b)):l[i]=z
            if l[int(y/b)] != -1:update(y/b)
            for i in range(int(judge_max(x,y/b**2)),y+1):a[i]=z

            




Fixed submission:
M = 2147483647
a = [M for i in range(500000)]

def j_min(x,y):
    if x < y:return x
    else: return y

def find(x,y,i,l,r):
    if r<=x or y<=l:return M
    if x<=l and r<=y: return a[i]
    return j_min(find(x,y,i*2,l,(l+r)/2),find(x,y,i*2+1,(l+r)/2,r))

if __name__=='__main__':
    n, m = (int(x) for x in input().split())
    t=1
    while t<n :t *= 2

    for i in range(m-1,-1,-1):
        com,x,y = (int(x) for x in input().split())
        if com :
            #continue
            print(find(x,y+1,1,0,t))
        else:
            x+=t
            a[x]=y
            while isinstance(x, int) or x >= 2:
               a[int(x/2)]=j_min(a[int(x)],a[int(x)^1])
               x/=2

Buggy python submission (verdict: Runtime Error):
M = 2147483647
a = [M for i in range(100000)]

def j_min(x,y):
    if x < y:return x
    else: return y

def find(x,y,i,l,r):
    if r<=x or y<=l:return M
    if x<=l and r<=y: return a[i]
    return min(find(x,y,i*2,l,(l+r)/2),find(x,y,i*2+1,(l+r)/2,r))

if __name__=='__main__':
    n, m = (int(x) for x in input().split())
    t=1
    while t<n :t *= 2

    for i in range(m-1,-1,-1):
        com,x,y = (int(x) for x in input().split())
        if com :
            #continue
            print(find(x,y+1,1,0,t))
        else:
            x+=t
            a[x]=y
            while isinstance(x, int) or x >= 2:
               a[int(x/2)]=j_min(a[int(x)],a[int(x)^1])
               x/=2



Fixed submission:
M = 2147483647
a = [M for i in range(500000)]

def j_min(x,y):
    if x < y:return x
    else: return y

def find(x,y,i,l,r):
    if r<=x or y<=l:return M
    if x<=l and r<=y: return a[i]
    return j_min(find(x,y,i*2,l,(l+r)/2),find(x,y,i*2+1,(l+r)/2,r))

if __name__=='__main__':
    n, m = (int(x) for x in input().split())
    t=1
    while t<n :t *= 2

    for i in range(m-1,-1,-1):
        com,x,y = (int(x) for x in input().split())
        if com :
            #continue
            print(find(x,y+1,1,0,t))
        else:
            x+=t
            a[x]=y
            while isinstance(x, int) or x >= 2:
               a[int(x/2)]=j_min(a[int(x)],a[int(x)^1])
               x/=2

Buggy python submission (verdict: Runtime Error):
M = 2147483647
a = [M for i in range(100000*2)]

def j_min(x,y):
    if x < y:return x
    else: return y

def find(x,y,i,l,r):
    if r<=x or y<=l:return M
    if x<=l and r<=y: return a[i]
    return min(find(x,y,i*2,l,(l+r)/2),find(x,y,i*2+1,(l+r)/2,r))

if __name__=='__main__':
    n, m = (int(x) for x in input().split())
    t=1
    while t<n :t *= 2

    for i in range(m-1,-1,-1):
        com,x,y = (int(x) for x in input().split())
        if com :
            #continue
            print(find(x,y+1,1,0,t))
        else:
            x+=t
            a[x]=y
            while isinstance(x, int) or x >= 2:
               a[int(x/2)]=j_min(a[int(x)],a[int(x)^1])
               x/=2



Fixed submission:
M = 2147483647
a = [M for i in range(500000)]

def j_min(x,y):
    if x < y:return x
    else: return y

def find(x,y,i,l,r):
    if r<=x or y<=l:return M
    if x<=l and r<=y: return a[i]
    return j_min(find(x,y,i*2,l,(l+r)/2),find(x,y,i*2+1,(l+r)/2,r))

if __name__=='__main__':
    n, m = (int(x) for x in input().split())
    t=1
    while t<n :t *= 2

    for i in range(m-1,-1,-1):
        com,x,y = (int(x) for x in input().split())
        if com :
            #continue
            print(find(x,y+1,1,0,t))
        else:
            x+=t
            a[x]=y
            while isinstance(x, int) or x >= 2:
               a[int(x/2)]=j_min(a[int(x)],a[int(x)^1])
               x/=2

Buggy python submission (verdict: Runtime Error):
M = 2147483647
a = [M for i in range(100000*2)]

def j_min(x,y):
    if x < y:return x
    else: return y

def find(x,y,i,l,r):
    if r<=x or y<=l:return M
    if x<=l and r<=y: return a[i]
    return j_min(find(x,y,i*2,l,(l+r)/2),find(x,y,i*2+1,(l+r)/2,r))

if __name__=='__main__':
    n, m = (int(x) for x in input().split())
    t=1
    while t<n :t *= 2

    for i in range(m-1,-1,-1):
        com,x,y = (int(x) for x in input().split())
        if com :
            #continue
            print(find(x,y+1,1,0,t))
        else:
            x+=t
            a[x]=y
            while isinstance(x, int) or x >= 2:
               a[int(x/2)]=j_min(a[int(x)],a[int(x)^1])
               x/=2



Fixed submission:
M = 2147483647
a = [M for i in range(500000)]

def j_min(x,y):
    if x < y:return x
    else: return y

def find(x,y,i,l,r):
    if r<=x or y<=l:return M
    if x<=l and r<=y: return a[i]
    return j_min(find(x,y,i*2,l,(l+r)/2),find(x,y,i*2+1,(l+r)/2,r))

if __name__=='__main__':
    n, m = (int(x) for x in input().split())
    t=1
    while t<n :t *= 2

    for i in range(m-1,-1,-1):
        com,x,y = (int(x) for x in input().split())
        if com :
            #continue
            print(find(x,y+1,1,0,t))
        else:
            x+=t
            a[x]=y
            while isinstance(x, int) or x >= 2:
               a[int(x/2)]=j_min(a[int(x)],a[int(x)^1])
               x/=2

Buggy python submission (verdict: Time Limit Exceeded):

A = []

def update(i, x):
    A[i] = x

def find(s, t):
    return min(A[s:t+1])

if __name__ == "__main__":
    n, q = map(int, input().split())
    A = [2**31 - 1] * n 
    for i in range(q):
        com, x, y = map(int, input().split())
        if com == 0:
            update(x, y)
        else:
            m = find(x, y)
            print(m)



Fixed submission:
import sys

INF = 2**31 - 1


class RMQ:

    def __init__(self, n):
        tmp = 1
        while tmp < n:
            tmp *= 2
        self.n = tmp * 2 - 1
        self.A = [INF] * (2 * self.n - 1)

    def update(self, i, x):
        i = self.n // 2 + i
        self.A[i] = x
        while i:
            i = (i - 1) // 2
            self.A[i] = min(self.A[i * 2 + 1], self.A[i * 2 + 2])

    def find(self, a, b, k, l, r):
        if r < a or b < l:
            return INF
        if a <= l and r <= b:
            return self.A[k]
        vl = self.find(a, b, k * 2 + 1, l, (l + r) // 2)
        vr = self.find(a, b, k * 2 + 2, (l + r) // 2 + 1, r)
        return min(vl, vr)


line = sys.stdin.readline()
n, q = map(int, line.split())
t = RMQ(n)
for i in range(q):
    line = sys.stdin.readline()
    com, x, y = map(int, line.split())
    if com == 0:
        t.update(x, y)
    else:
        print(t.find(x, y, 0, 0, t.n // 2))