Google Kickstart Round A 2019 - Training
First of all, this looks good to me! I have some minor comments.

General comments


Consider compiling with -Wconversion. It will give you a couple of hints where you implicitly convert between std::vector::size_type (usually std::size_t) and int. Whether you work with unsigned data types for skills and quantities might be a matter of taste, but I think you should be aware of the conversion issue. Also, this compiler flags gives you (on my machine)


  implicit conversion loses integer precision: unsigned long to int [-Wshorten-64-to-32]

int remainingPossibilities = skills.size() - p;



which should definitely worth tackling even if the problem description specifies input characteristics that make a digit loss impossible.
Not that this will be an issue for this example, but when you want to be as fast as possible, don't use &lt;iostream&gt;, but &lt;cstdio&gt; instead.


Input handling/parameter types


When retrieving the input data, don't pass non-const references, but prefer returning by value instead. (N)RVO will make sure there is no overhead. As you have more than one value, define a small, custom type for this. So, I'd suggest going with

struct TestCaseInput {
   int nToChoose;
   std::vector&lt;int&gt; skills;
};

TestCaseInput getData();
int minTrainingTime(TestCaseInput&amp; input);


cf. the Core Guidelines on this topic, F.20 and F.21
std::vector::emplace_back makes sense when you can in-place construct an object with given parameters, but when you pass the already existing object to this function, it's probably clearer to use push_back. In the case of an integral value, it doesn't matter anyhow whether you move-construct or copy it. As an alternative, you could also

std::vector&lt;int&gt; skills(n); // Allocates and set all values to zero

for (int i = 0; i &lt; n; i++)
    std::cin &gt;&gt; skills[i]; // No temporary variable required


And also have a look at the combination of std::copy_n and std::istream_iterator that @papagaga suggests to eliminate the manual loop here.


Main function minTrainingTime


In the first loop, you read skills[high] in every iteration, even though this value doesn't change. Instead, just read it once and save it in a variable. Or, leave it as it is and verify that the compiler optimizes this away anyway.
You can also replace this whole first loop by including &lt;numeric&gt; and using std::accumulate with an initial value high*skills[high] and std::minus&lt;&gt;{} as the binary operation parameter.
If you can const-qualify a variable, do so:

const int remainingPossibilities = skills.size() - p;

But if can alternative reduce the scope of such a variable and by that even eliminate another one (the loop counter i), do so instead (as long as the negative influence on the readability is not too big, which I think is ok here):

// remainingPossibilities is now superfluous, just use the for loop for
// the initialization and count differently:
for (int n = skills.size() - p; n != 0; n--) { /* ... */ }

You might want to consider an additional level of indirection for the function minTrainingTime here, as it can equally well operate on random access iterators instead of indices. This way, you eliminate the dependency of this function on the actual value type that you are using (which also considerably reduces the number of -Wconversion warnings at one go), as well as the dependency on the container type. Using some of the above hints, the resulting function template looks e.g. like this:

template &lt;class RandomAccesIt, class T&gt;
auto minTrainingTime(RandomAccesIt first, RandomAccesIt last, T p)
{
    using value_type = typename RandomAccesIt::value_type;
    auto low = first, high = std::next(first, p - 1);
    const value_type init = std::distance(low, high)*(*high);

    value_type currentResult = std::accumulate(first, high, init, std::minus&lt;&gt;{});
    value_type minResult = currentResult;

    for (auto n = std::distance(first, std::prev(last, p)); n != 0; --n) {
        currentResult -= *++high - *low++;
        currentResult += p*(*high - *std::prev(high));
        minResult = std::min(minResult, currentResult);
    }

    return minResult;
}


and can be deduced and invoked by minTrainingTime(skills.begin(), skills.end(), p).