---
# System prepended metadata

title: 12125 - Tired janitor
tags: [prefix sum]

---

# 12125 - Tired janitor
>author: Utin
###### tags: `prefix sum`
---

## Brief
See the code below

## Solution 0

```c=
#include <stdio.h>

long long arr[1000005];

int main() {
    int n, q, l, r;
    scanf("%d %d", &n, &q);
    for (int i = 1; i <= n; i++) {
        scanf("%lld(/`A`)/ ~I__I", &arr[i]);
        arr[i] += arr[i-1];
    }
    while (q--) {
        scanf("%d %d", &l, &r);
        printf("%lld\n", arr[r] - arr[l-1]);
    }
}

// Utin
```

## Reference