Finding the horse number you will get
Use portable constructs

Variable-length arrays are not standard C++.  Using such non-standard extensions hampers your code because you can't easily use different compilers (this can possibly even exclude entire target platforms).

Avoid importing all of std into the global namespace

Namespaces provide us with an important service, separating the large and growing set of identifiers in std from those of our own code.  It's actively harmful to reverse that benefit with using namespace std.

Always test for errors when reading

Formatted input such as std::cin &gt;&gt; n &gt;&gt; k should always test the state of the stream before using the read values.

Use clearer names

We don't have to use names like t just because that's what the question uses to describe the number of test cases.  Similarly, hrs took me much longer to comprehend than would horse - and that's not going to push your line lengths.

Know your standard library

What we have is a priority queue of horses, ordered by the time they next return, with the horse's number as tie-breaker.  We have std::priority_queue with insertion/removal times that scale as O(log n), so iterating over the k previous riders to find which horse we get will scale as O(k log n).

The algorithm is pretty simple - for each member of the queue in front of us, take the next horse from the stable (a std::priority_queue), add its running time to its next-available time, and insert it back into the stable.  The horse at the front of the stable after k-1 iterations will be ours.