<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> class Solution ( object ) : <EOL> def solve ( self , cipher ) : <EOL> """<STR_LIT>""" <EOL> N , M , queries = cipher <EOL> qry = [ ] <EOL> for query in queries : <EOL> qry . append ( ( query [ <NUM_LIT:0> ] , query [ <NUM_LIT:2> ] ) ) <EOL> qry . append ( ( query [ <NUM_LIT:1> ] + <NUM_LIT:1> , - query [ <NUM_LIT:2> ] ) ) <EOL> qry . sort ( key = lambda x : ( x [ <NUM_LIT:0> ] , x [ <NUM_LIT:1> ] ) ) <EOL> maxa = - <NUM_LIT:1> << <NUM_LIT:32> <EOL> cur = <NUM_LIT:0> <EOL> for q in qry : <EOL> cur += q [ <NUM_LIT:1> ] <EOL> maxa = max ( maxa , cur ) <EOL> return maxa <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> import sys <EOL> f = open ( "<STR_LIT>" , "<STR_LIT:r>" ) <EOL> N , M = map ( int , f . readline ( ) . strip ( ) . split ( '<STR_LIT:U+0020>' ) ) <EOL> queries = [ ] <EOL> for t in xrange ( M ) : <EOL> queries . append ( map ( int , f . readline ( ) . strip ( ) . split ( '<STR_LIT:U+0020>' ) ) ) <EOL> cipher = N , M , queries <EOL> s = "<STR_LIT>" % ( Solution ( ) . solve ( cipher ) ) <EOL> print s , </s>
