Code giving sigbart error

here is the code-
and here is the link to the problem-
can anyone tell me where is the problem?

Out-of-bounds access with sample input:

Compiling lives_in_virgo-NOCHANGE.cpp
Executing command:
  g++ -std=c++17 lives_in_virgo-NOCHANGE.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG    -fsanitize=undefined -ftrapv
lives_in_virgo-NOCHANGE.cpp: In function ‘int overpay(long long int, std::__debug::vector<long long int>, std::__debug::vector<int>&, std::__debug::vector<int>&, int, int)’:
lives_in_virgo-NOCHANGE.cpp:23:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<v.size();i++){
lives_in_virgo-NOCHANGE.cpp: In function ‘int main()’:
lives_in_virgo-NOCHANGE.cpp:68:37: warning: conversion to ‘int’ from ‘long long int’ may alter its value [-Wconversion]
     if (overpay(p,v,lookup,count,0,n)){
[~/devel/hackerrank/otherpeoples]>echo "3
> 2 10
> 1 5
> 2 4
> 1 5
> 3 25
> 3 5 10" | ./a.out
Error: attempt to subscript container with out-of-bounds index -1, but 
container only holds 11 elements.

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