Average of subarrays of length k in C++
Generally the code is well written, there are only a few items that need commenting on.
Avoid Using Namespace std
If you are coding professionally you probably should get out of the habit of using the using namespace std; statement. The code will more clearly define where cout and other identifiers are coming from (std::cin, std::cout). As you start using namespaces in your code it is better to identify where each function comes from because there may be function name collisions from different namespaces. The identifier cout you may override within your own classes. This stack overflow question discusses this in more detail.
Use Braces Around Single Statements in Program Flow
Primarily for maintenance reasons it is a good habit to create code blocks within if statements, else clauses and within loops. Many bugs have been created during maintenance when one or more statements was added to an if statement or a loop.
From this code:
    for (const auto&amp; a: averages) cout &lt;&lt; a &lt;&lt; &quot; &quot;;

Would be better as
    for (const auto&amp; a: averages) {
        std::cout &lt;&lt; a &lt;&lt; &quot; &quot;;
    }

Then if someone needs to add a statement to the for loop at some point it is quite simple.
This Code Could Be Simplified
    vector&lt;double&gt; res (nums.size() - k + 1);
        ...

    size_t res_index = 0;
    res.at(res_index) = curr_sum / k;

    while (right_it != nums.end()) { 
        ...
        res.at(++res_index) = curr_sum / k;      
        ...  
    }

It's not clear why it was necessary to initialize the res vector to the proper size in the previous code. Since vectors are variable sized they don't need to be initialized with a size.
    std::vector&lt;double&gt; res;
        ...

    res.push_back(curr_sum / k);

    while (right_it != nums.end()) { 
        ...
        res.push_back(curr_sum / k);      
        ...  
    }

removes one variable and achieves the same result.