Getting a count of intervals
OK. Since this is homework I am going to limit my points to hints (I may add more in a week or so).


Why are you doing this?

if(file.is_open())

This is an anti-pattern (in every language not just C++):
Remember the eof (part of not being good) does not happen until you read past the end of line.

Lots of examples on SO (go look it up).

    while(file.good())
    {
        getline(file, line);

You are doing too much work here:

There is an easy way to read integers from a stream.  Lots of examples on SO (go look it up).

    getline(file, line);
    string::size_type pos = line.find(' '); 
    left = line.substr(0, pos);
    right = line.substr((++pos));   // Also this is wrong if no space was found.
    int ll = atoi(left);
    int up = atoi(right);

Why do a 2-phase compare?

    if(it != extents.end()) 
    {
        if(it-&gt;second.first != up){
            extents.insert(make_pair&lt;const int, pair&lt;int, int&gt; &gt;(ll, make_pair&lt;int, int&gt;(up, ++count)));
        }
        else{
            it-&gt;second.second += 1 ;
        }
    }
    else
    {
        extents.insert(make_pair&lt;const int, pair&lt;int, int&gt; &gt;(ll, make_pair&lt;int, int&gt;(up, ++count)));
    }


If you make the key std::pair&amp;lt;left, right&amp;gt; then you only need to do one test. Not this complicated mess. It also makes more sense to keep the left and right together.
Don't do this: (see Implementation using fstream failed evaluation)

fclose(inp_file);


Same comments about the second loop:

This is not wrong. But when I compare a number against two others of a range I put the value that is being tested for inclusion in the range in the middle of the comparison. I personally find it nicer to read this way:

 if((var &gt;= it-&gt;first ) &amp;&amp; (var &lt;= it-&gt;second.first))

 // I prefer

 if ((it-&gt;first &lt;= var) &amp;&amp; (var &lt;= it-&gt;second.first))