What is wrong in my code

I am trying to solve the problem DQUERY from spoj. I am using Mo’s algorithm but instead of using frequency array I am using unordered_map but getting segmentation fault. I cannot figure it out, any help would be appreciated.
Code link - glcbor - Online C++0x Compiler & Debugging Tool - Ideone.com

[simon@simon-laptop][17:26:58]
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh 
Compiling sayang992-blah.cpp
+ g++ -std=c++14 sayang992-blah.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv
sayang992-blah.cpp: In function ‘void solve()’:
sayang992-blah.cpp:9:21: warning: conversion to ‘__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}’ from ‘std::__cxx1998::map<int, long long int, std::less<int>, std::allocator<std::pair<const int, long long int> > >::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
 #define sz(x) x.size()
                     ^
sayang992-blah.cpp:103:28: note: in expansion of macro ‘sz’
             ans[Q[i].id] = sz(m);
                            ^~
sayang992-blah.cpp: In function ‘int main()’:
sayang992-blah.cpp:112:13: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
     clock_t start, end;
             ^~~~~
sayang992-blah.cpp:112:20: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]
     clock_t start, end;
                    ^~~
+ set +x
Successful
[simon@simon-laptop][17:27:08]
[~/devel/hackerrank/otherpeoples]>echo "5
1 1 2 1 3
3
1 5
2 4
3 5" | ./a.out
/usr/include/c++/7/bits/stl_algo.h:4866:
Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).

Objects involved in the operation:
    instance "functor" @ 0x0x7ffebca78f80 {
      type = bool (*)(query&, query&);
    }
    iterator::value_type "ordered type" {
      type = query;
    }
Aborted (core dumped)

I cannot figure out what is the error can you please specify where my code fails and that core dumped came from because in my local machine i am using Atom editor and it worked fine so i am confused.