#pragma GCC optimize ("Ofast") #include using namespace std; inline void rd(int &x){ int k; int m=0; x=0; for(;;){ k = getchar_unlocked(); if(k=='-'){ m=1; break; } if('0'<=k&&k<='9'){ x=k-'0'; break; } } for(;;){ k = getchar_unlocked(); if(k<'0'||k>'9'){ break; } x=x*10+k-'0'; } if(m){ x=-x; } } inline void wt_L(char a){ putchar_unlocked(a); } inline void wt_L(int x){ int s=0; int m=0; char f[10]; if(x<0){ m=1; x=-x; } while(x){ f[s++]=x%10; x/=10; } if(!s){ f[s++]=0; } if(m){ putchar_unlocked('-'); } while(s--){ putchar_unlocked(f[s]+'0'); } } template inline S chmax(S &a, T b){ if(a 1){ if(N%2){ N =3*N+1; } else{ N =N/2; } res1++; chmax(res2, N); } wt_L(res1); wt_L('\n'); wt_L(res2); wt_L('\n'); return 0; } // cLay varsion 20190919-1 [beta] // --- original code --- // int N; // { // int res1, res2; // rd(N); // res1 = 0; // res2 = N; // while(N > 1){ // N = if[N%2, 3N+1, N/2]; // res1++; // res2 >?= N; // } // wtLn(res1, res2); // }