Unidentified behavior on using prefix sum array

Hey everyone! My first post here.
Problem : Problem - B - Codeforces
Submission : Submission #144094131 - Codeforces
I am getting WA on a larger input value , but I have checked my code thoroughly - I have used long long to store values so how am I getting an overflow? I even compared my code with a lot of other editorials and they pretty much similar.
Please help. TIA.

constexpr long long sz = 2e5;
{   ll dp[sz][20]; 


And an index-out-of-bounds access with the sample test input (after converting dp to a vector<vector<ll>>:

Compiling x_muigoku_x-1615B.cpp
Executing command:
  g++ -std=c++17 x_muigoku_x-1615B.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG    -fsanitize=undefined -ftrapv
[~/devel/hackerrank/otherpeoples]>echo "5
1 2
2 8
4 5
1 5
100000 200000" | ./a.out
In function:
    std::__debug::vector<_Tp, _Allocator>::reference 
    _Allocator>::size_type) [with _Tp = std::__debug::vector<long long int>; 
    _Allocator = std::allocator<std::__debug::vector<long long int> >; 
    std::__debug::vector<_Tp, _Allocator>::reference = 
    std::__debug::vector<long long int>&; std::__debug::vector<_Tp, 
    _Allocator>::size_type = long unsigned int]

Error: attempt to subscript container with out-of-bounds index 200000, but 
container only holds 200000 elements.

Objects involved in the operation:
    sequence "this" @ 0x0x7ffe683473f0 {
      type = std::__debug::vector<std::__debug::vector<long long, std::allocator<long long> >, std::allocator<std::__debug::vector<long long, std::allocator<long long> > > >;
Aborted (core dumped)