Please help me to find the mistake it is showing runtime error

submissionl link

Please fix this compiler warning:

[simon@simon-laptop][14:02:17]
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh 
Compiling prince_000-LFSTACK.cpp
+ g++ -std=c++14 prince_000-LFSTACK.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv -fno-sanitize-recover
prince_000-LFSTACK.cpp: In function ‘int main()’:
prince_000-LFSTACK.cpp:23:19: warning: ‘tot’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      for(int i=0;i<tot;i++)

Edit:

int maxs=1e6+7;
...
 vector<int> thread[maxs];

‘tot’ is not initialized

hello sir, i still dont get the mistake
i set vector arr[1000000]; it is showing AC of this guy submission link i use the approach similar to this guy
but instead of using recursion i use loop.

Initialize tot