UVa 3n+1 challenge : what's wrong with my program?
<p>I'm currently working on the 3n+1 problem at the UVa online judge and i've coded a program to solve it. I submitted it and tested the sample input and the answers are correct but the judge keeps rejecting my program (Wrong Answer). 
Here's the code:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

class Pair{
public:
Pair(int start,int end):m_start(start),m_end(end)
{

}
int m_start;
int m_end;
};

int main()
{
    vector&lt;Pair&gt; pairsTab;
    int nStart(0),nEnd(0);
    while(cin&gt;&gt;nStart&gt;&gt;nEnd)
    {
        Pair paire(nStart,nEnd);
        pairsTab.push_back(paire);
    }

    for(vector&lt;Pair&gt;::iterator it=pairsTab.begin();it!=pairsTab.end();it++)
    {
        int nMaxSeq(0);
        int mini,maxi;
        if(it-&gt;m_start&gt;it-&gt;m_end)
        {
            mini=it-&gt;m_end;
            maxi=it-&gt;m_start;
        }
        else
        {
            mini=it-&gt;m_start;
            maxi=it-&gt;m_end;
        }

        for(int i(mini);i&lt;=maxi;i++)
    {
        int n=i;
        int nSeq=1;
        do{
            if(n%2==0)
                n/=2;
            else
                n=n*3+1;
            nSeq++;
        }while(n!=1);
        nMaxSeq=max(nMaxSeq,nSeq);
    }

    cout&lt;&lt;it-&gt;m_start&lt;&lt;" "&lt;&lt;it-&gt;m_end&lt;&lt;" "&lt;&lt;nMaxSeq&lt;&lt;" "&lt;&lt;endl;
    }

    return 0;
}
</code></pre>

<p>And here's the sample input along with the correct output</p>

<pre><code>1 10
100 200
201 210
900 1000
1000 900
999999 999990

1 10 20
100 200 125
201 210 89
900 1000 174
1000 900 174
999999 999990 259
</code></pre>
