• + 6 comments

    you should create a generator because when the test it have big number of queries your program delay too much.

    len_array, queries = map(int, raw_input().strip().split())
    array = [0]*len_array
    def generator_queries(queries):
        init = 0
        index = 0
        while index <  queries:
            yield map(int, raw_input().strip().split())
            index += 1
            
    for a, b, k in generator_queries(queries):
        for i in xrange(a-1,b): # another generator
            array[i] += k # maybe use threads here
    print max(array)