title: Array Manipulation Hackerrank using python
body: <p>This logic is working for most of the test cases but not all. What I am doing wrong?</p>
  
  <pre><code>def arrayManipulation(n, queries, m):
      li = []
      for j in range(0, m):
          p = queries[j][0]
          r = queries[j][1]
          v = queries[j][2]
  
          lo = []
          for i in range(0, n):
              lo.append(0)
  
          for i in range(p - 1, r):
              lo[i] = lo[i] + v
  
          li.append(lo)
  
      for i in range(1, m):
          for j in range(0, n):
              li[i][j] = li[i-1][j] + li[i][j]
      return max(max(li))
  
  if __name__ == '__main__':
      fptr = open(os.environ['OUTPUT_PATH'], 'w')
      nm = input().split()
      n = int(nm[0])
      m = int(nm[1])
  
      queries = []
      for _ in range(m):
          queries.append(list(map(int, input().rstrip().split())))
  
      result = arrayManipulation(n, queries,m)
      print(result)
      fptr.write(str(result) + '\n')
      fptr.close()
  </code></pre>