Mapping & Sorting Randomly Generated Numbers
Include the right things

You're starting with:

#include &lt;bits/stdc++.h&gt;
using namespace std;


The second line is bad practice; avoid it. Typing std:: is not a burden. The former is definitely unacceptable - that's a compiler-specific file that you don't want to be including. Just include the actual headers you need:

#include &lt;iostream&gt;
#include &lt;algorithm&gt;
#include &lt;vector&gt;


Use algorithms and iterators

Rather than writing your own loop to perform a sum, you could use the standard algorithm for this: std::accumulate:

int sum = std::accumulate(v.begin(), v.end(), 0);


Also they wanted you to use iterators to find the median, which would be:

auto median_it = std::next(
    v.begin(),
    std::distance(v.begin(), v.end()) / 2);


Where's the rest?

There's a lot of text in that question that I don't think you addressed in your code. Looks like we need a std::map or something.