Problem Description

Each testcase has n numbers and q queries (l r, 1-based). Output sum for each query.

Input Format

First integer t. For each: n q, then n ints, then q lines l r.

Output Format

For each testcase, q lines sums.

Sample Test Case

Input:
1 5 3 1 2 3 4 5 1 3 2 5 4 4
Output:
6 14 4

Constraints

Sum of n+q over all testcases

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next