Why is this giving the RE(SIGSEGV) error please help!

https://www.codechef.com/viewsolution/38095045

@k_purushottam i dont really know c but the runtime error here is because u are trying to access something out of the memory scope which u never assumed to be there!
https://www.google.com/search?q=sigsegv+error&rlz=1C1RXQR_enIN949IN949&oq=sigs&aqs=chrome.2.69i57j0i433j0l4j0i10j69i60.3697j0j4&sourceid=chrome&ie=UTF-8
can read here!

This is from ages ago, but:

[simon@simon-laptop][07:59:08]
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh 
Compiling k_purushottam-CSUM.cpp
+ g++ -std=c++17 k_purushottam-CSUM.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv
k_purushottam-CSUM.cpp: In function ‘int main()’:
k_purushottam-CSUM.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&t);
     ~~~~~^~~~~~~~~
k_purushottam-CSUM.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&n,&k);
         ~~~~~^~~~~~~~~~~~~~
k_purushottam-CSUM.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&arr1[h]);
         ~~~~~^~~~~~~~~~~~~~~
+ set +x
Successful
[simon@simon-laptop][07:59:10]
[~/devel/hackerrank/otherpeoples]>cat failed_test_case.txt
1
4 141
1 1 2 2
[simon@simon-laptop][07:59:15]
[~/devel/hackerrank/otherpeoples]>cat failed_test_case.txt | ./a.out 
k_purushottam-CSUM.cpp:22:19: runtime error: index 16 out of bounds for type 'int [*]'
k_purushottam-CSUM.cpp:23:19: runtime error: index 16 out of bounds for type 'int [*]'
Segmentation fault (core dumped)
[simon@simon-laptop][07:59:18]