• + 1 comment

    The code below solves the first four test cases but timeout for the rest. Any idea about improving the speed?

        for i in range(q):
            operation=list(map(int, input().rstrip().split()))
            if operation[0]==3:
                print(min(box[operation[1]:operation[2]+1]))
            elif operation[0]==4:
                print(sum(box[operation[1]:operation[2]+1]))
            else:
                for z in range (operation[1], operation[2]+1):
                    if operation[0]==1:
                        box[z]+=operation[3] 
                    else:
                        box[z]=math.floor(box[z]/operation[3])