spoj; improve the solution to "subarrays"

- use `max` algorithm
- the template was unnecessary
- typedef long types
- use the word `get` instead of `query` for answering queries