title: why is my 3n+1 problem solution wrong
body: <p>I have recently started reading "Programming Challenges" book by S. Skiena and believe or not I am kind of stuck in the very first problem.</p>
  
  <p>Here's a link to the problem: <a href="http://www.programming-challenges.com/pg.php?page=downloadproblem&amp;probid=110101&amp;format=html" rel="nofollow">3n+1 problem</a></p>
  
  <p>Here's my code:</p>
  
  <pre><code> #include &lt;stdio.h&gt;
  
  long get_cycle(long input){
      if (input == 1){
          return 1;
      }
      else{
          if (input &amp; 1){
              return 2 + get_cycle((3*input+1)&gt;&gt;1);
          }
          else{
              return 1 + get_cycle(input &gt;&gt; 1);
          }
      }
  }
  
  long get_range_cycle(int k, int j){
      int i;
      int max = 0;
      int current_cycle;
      int to = k &gt; j ? k : j;
      int from = k &lt; j ? k : j;
      for (i=from; i&lt;=to; ++i){
          current_cycle = get_cycle(i);
          if (current_cycle &gt; max){
              max = current_cycle;
          }
      }
      return max;
  }
  
  int main(){
      long p, q;
      long re[100][3];
      int i = 0;
      while (scanf("%ld %ld",&amp;p,&amp;q) == 2){
          re[i][0] = p;
          re[i][1] = q;
          re[i][2] = get_range_cycle(p,q);
          ++i;
      }
      int j;
      for (j=0; j&lt;i; ++j){
          printf("%ld %ld %ld\n",re[j][0],re[j][1],re[j][2]);
      }
  }
  </code></pre>
  
  <p>what is wrong with my code? the input and out is exactly the same with sample.But the submission result is always run time error! </p>