criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <algorithm>

using namespace std;

int main(int argc, char* argv[]) {

	LL S;
	int cnt = 1;
	int flg1 = 2;
	int flg2 = 2;
	int flg4 = 2;

	cin >> S;

	while (flg1 > 0 && flg2 > 0 && flg4 > 0 ) {

		if (S % 2 == 0) {
			S /= 2;
		}
		else {
			S = 3 * S + 1;
		}

		if (S == 4) {
			flg4--;
		}

		if (S == 2) {
			flg2--;
		}

		if (S == 1) {
			flg1--;
		}

		cnt++;
	}

	cout << cnt << endl;

	return 0;

}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:12:9: error: 'LL' was not declared in this scope
   12 |         LL S;
      |         ^~
a.cc:18:16: error: 'S' was not declared in this scope
   18 |         cin >> S;
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  
  vector<int> vec(1000000);
 
  vec.at(1)=x;
  
  int N;
  
 bool flag=false;
  
  for(int i=2;i<1000000;i++){
if(x%2==0){
  x=(x/2);
  
  vec.at(i)=x;
 
}
    else{
      x=(3*x+1);
      
      vec.at(i)=x;
      
     
    }
    
  
  for(int j=1;j<i;j++){
    if(vec.at(j)==vec.at(i)){
      cout<<i<<endl;
      
      flag=true;
      break;
    
  }
  }
  }
  
    
    
    if(flag){
      break;
    
  }
    
}
  

    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:48:7: error: break statement not within loop or switch
   48 |       break;
      |       ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  
  vector<int> vec(1000000);
 
  vec.at(1)=x;
  
  int N;
  
 bool flag=false;
  
  for(int i=2;i<1000000;i++){
if(x%2==0){
  x=(x/2);
  
  vec.at(i)=x;
 
}
    else{
      x=(3*x+1);
      
      vec.at(i)=x;
      
     
    }
    
  
  for(int j=1;j<i;j++){
    if(vec.at(j)==vec.at(i)){
      N=i;
      
      flag=true;
      break;
    
  }
  }
  }
  
    
    
    if(flag){
      break;
    
  }
    
}
  

    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:48:7: error: break statement not within loop or switch
   48 |       break;
      |       ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  
  vector<int> vec(1000000);
 
  vec.at(1)=x;
  
  int N;
  
 bool flag=false;
  
  for(int i=2;i<1000000;i++){
if(x%2==0){
  x=(x/2);
  
  vec.at(i)=x;
 
}
    else{
      x=(3*x+1);
      
      vec.at(i)=x;
      
     
    }
    
  
  for(int j=1;j<i;j++){
    if(vec.at(j)==vec.at(i)){
      N=i;
      
      flag=true;
      break;
    
  }
    
    if(flag=true){
      break;
    
  }
    
}
  

    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:48:2: error: expected '}' at end of input
   48 | }
      |  ^
a.cc:18:29: note: to match this '{'
   18 |   for(int i=2;i<1000000;i++){
      |                             ^
a.cc:48:2: error: expected '}' at end of input
   48 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  
  vector<int> vec(1000000);
 
  vec.at(1)=x;
  
  int N;
  
 bool flag=false;
  
  for(int i=2;i<1000000;i++){
if(x%2==0){
  x=(x/2);
  
  vec.at(i)=x;
 
}
    else{
      x=(3*x+1);
      
      vec.at(i)=x;
      
     
    }
    
  
  for(int j=1;j<i;j++){
    if(vec.at(j)==vec.at(i)){
      N=i;
      
      flag=true;
      break;
    
  }
    
    if(flag=true){
      break;
    
  }
}
  }
  

    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:48:4: error: expected '}' at end of input
   48 |   }
      |    ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  
  vector<int> vec(1000000);
 
  vec.at(1)=x;
  
  int N;
  
 bool flag=false;
  
  for(int i=2;i<1000000;i++){
if(x%2==0){
  x=(x/2);
  
  vec.at(i)=x;
 
}
    else{
      x=(3*x+1);
      
      vec.at(i)=x;
      
     
    }
    
  
  for(int j=1;j<i;j++){
    if(vec.at(j)==vec.at(i)){
      N=i;
      
      flag=true;
      break;
    
  }
    
    if(flag=true){
      break;
    
  }
}

    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:47:2: error: expected '}' at end of input
   47 | }
      |  ^
a.cc:18:29: note: to match this '{'
   18 |   for(int i=2;i<1000000;i++){
      |                             ^
a.cc:47:2: error: expected '}' at end of input
   47 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  
  vector<int> vec(1000000);
 
  vec.at(1)=x;
  
 bool flag=false;
  
  for(int i=2;i<1000000;i++){
if(x%2==0){
  x=(x/2);
  
  vec.at(i)=x;
 
}
    else{
      x=(3*x+1);
      
      vec.at(i)=x;
      
     
    }
    
  
  for(int j=1;j<i;j++){
    if(vec.at(j)==vec.at(i)){
      
      flag=true;
    
  }
    
  }
}
  
  if(true){
    cout<<i<<endl;
       }

    
    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:43:11: error: 'i' was not declared in this scope
   43 |     cout<<i<<endl;
      |           ^
a.cc:44:9: error: expected '}' at end of input
   44 |        }
      |         ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  
  vector<int> vec(N);
 
  vec.at(1)=x;
  
 bool flag=false;
  
  for(int i=2;i<N;i++){
if(x%2==0){
  x=(x/2);
  
  vec.at(i)=x;
 
}
    else{
      x=(3*x+1);
      
      vec.at(i)=x;
      
     
    }
    
  
  for(int j=1;j<i;j++){
    if(vec.at(j)==vec.at(i)){
    cout<<i<<endl;
      
      flag=true;
    
  }
    
  }
}
       }

    
    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: 'N' was not declared in this scope
   10 |   vector<int> vec(N);
      |                   ^
Language: C++


#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  int N;
  
  vector<int> vec(N);
 
  vec.at(1)=x;
  
  for(int i=2;i<N;i++){
if(x%2==0){
  x=(x/2);
  
  vec.at(i)=x;
 
}
    else{
      x=(3*x+1);
      
      vec.at(i)=x;
      
     
    }
    
  
  for(int j=1;j<i;j++){
    if(vec.at(j)==vec.at(i){
    cout<<i<<endl;
    
  }
    
  }
}
       }

    
    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:33:28: error: expected ')' before '{' token
   33 |     if(vec.at(j)==vec.at(i){
      |       ~                    ^
      |                            )
a.cc:38:3: error: expected primary-expression before '}' token
   38 |   }
      |   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  int N;
  
  vector<int> vec(N);
 
  
  for(int i=0;i<N;i++){
if(x%2==0){
  x=(x/2);
  
  vec.at(i)=x;
  
  cin>>vec.at(i);
}
    else{
      x=(3x+1);
      
      vec.at(i)=x;
      
      cin>>vec.at(i);
      
    }
    
  
  for(int j=0;j<N;j++){
    if(vec.at(j)==vec.at(i))
    cout<<i<<endl;
    
  }
    
  }
}


    
    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:23:10: error: unable to find numeric literal operator 'operator""x'
   23 |       x=(3x+1);
      |          ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  int N;
  
  vector<int> vec(N);
 
  
  for(int i=0;i<N;i++){
if(x%2==0){
  x=(x/2);
  
  vec.at(i)=x;
  
  cin>>vec.at(i);
}
    else{
      x=3x+1;
      
      vec.at(i)=x;
      
      cin>>vec.at(i);
      
    }
    
  
  for(int j=0;j<N;j++){
    if(vec.at(j)==vec.at(i))
    cout<<i<<endl;
    
  }
    
  }
}


    
    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: unable to find numeric literal operator 'operator""x'
   23 |       x=3x+1;
      |         ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  
  int x=s;
  
  int N;
  
  vector<int> vec(N);
 
  
  for(int i=0;i<N;i++){
if(X%2==0){
  x==(x/2);
  
  vec.at(i)=x;
  
  cin>>vec.at(i);
}
    else{
      x==3x+1;
      
      vec.at(i)=x;
      
      cin>>vec.at(i);
      
    }
    
  
  for(int j=0;j<N;j++){
    if(vec.at(j)==vec.at(i))
    cout<<i<<endl;
    
  }
    
  }
}


    
    
    
  
  
  
  


 


Compiler output:
a.cc: In function 'int main()':
a.cc:15:4: error: 'X' was not declared in this scope
   15 | if(X%2==0){
      |    ^
a.cc:23:10: error: unable to find numeric literal operator 'operator""x'
   23 |       x==3x+1;
      |          ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int func(int n){
  if(n%2 == 1){
    return 3n+1;
  }else{
    return n/2;
  }
}

int main(){
  int s,ans=0; cin>>s;
   vector<int> a;
  a.at(0) = s;
  for(int i=1;;i++){
    a.at(i) = func(a.at(i-1));
    for(int j=0;j<i;j++){
      if(a.at(i) == a.at(j)){
        ans = i+1;
        break;
      }
    }
    if(ans != 0){
      break;
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int func(int)':
a.cc:6:12: error: unable to find numeric literal operator 'operator""n'
    6 |     return 3n+1;
      |            ^~
Language: C++

#include <iostream>

int main() {
  int s;
  std::cin >> s;
  int cnt = 1;
  while(true){
    if(s==4){
      std::cout << cnt+3;
      return;
    }
    if(s&1)
      s = 3*s+1;
    else
      s /= 2;    
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: return-statement with no value, in function returning 'int' [-fpermissive]
   10 |       return;
      |       ^~~~~~
Language: C

#include <stdio.h>
int main(void){
  int s,x;
  int data[1000000];
  scanf("%d",&s);
  data[0] = s;
  x = s;
  for(int i = 1;i < 1000000;i++){
    if(x%2 == 0){
      data[i] = x/2;
    }else{
      data[i] = 3*x+1;
    }
    x = data[i];
  }
  //ここから配列の同じ要素を探す
  for(int i = 0;i < 1000000;i++){
    for(int j = i+1;j < 1000000;j++){
      if(data[i] == data[j]){
        printf("%d",j+1);
        return 0;
      }
    }
  }
  return 0;
}
提出情報

Compiler output:
main.c:27:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
   27 | 提出情報
      | ^~~~~~~~
Language: C

#include <stdio.h>
int main(void){
  int s,x;
  int data[1000000];
  scanf("%d",&s);
  data[0] = s;
  x = s;
  for(i = 1;i < 1000000;i++){
    if(x%2 == 0){
      data[i] = x/2;
    }else{
      data[i] = 3*x+1;
    }
    x = data[i];
  }
  //ここから配列の同じ要素を探す
  for(int i = 0;i < 1000000;i++){
    for(int j = i+1;j < 1000000;j++){
      if(data[i] == data[j]){
        printf("%d",j+1);
        return 0;
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:7: error: 'i' undeclared (first use in this function)
    8 |   for(i = 1;i < 1000000;i++){
      |       ^
main.c:8:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

include<stdio.h>
int main(void){
	int a,i=1;
    scanf("%d",&s);
    if(s<3) {
    	printf("1");
    	return 0;
    }
    while(s!=4){
    	if(s%2)s=3*s+1;
        else s/=2;
        i++;
    }
    printf("%d",i);
    return 0;
}


Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
int main(){
    int N;
    cin>>N;
    set<int>St;
    int x=N;
    while(st.count(x)==0){
        st.insert(x);
        if(x%2==0){
            x/=2
        }else{
            x=x*3+1
        }
    }
    cout<<st.size()+1<<endl;
    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'st' was not declared in this scope; did you mean 'St'?
   12 |     while(st.count(x)==0){
      |           ^~
      |           St
a.cc:15:17: error: expected ';' before '}' token
   15 |             x/=2
      |                 ^
      |                 ;
   16 |         }else{
      |         ~        
a.cc:17:20: error: expected ';' before '}' token
   17 |             x=x*3+1
      |                    ^
      |                    ;
   18 |         }
      |         ~           
a.cc:20:11: error: 'st' was not declared in this scope; did you mean 'St'?
   20 |     cout<<st.size()+1<<endl;
      |           ^~
      |           St
Language: C++

#include <iostream>

using namespace std;

int main(){

  int s;
  cin >> s;
  const int n=1000000;  
  int a[n],counts[n]={0};
  
  a[0]=s;
  for(int i=1;i<n;i++){
  
    if(a[i-1]%2==0){
    a[i]=a[i-1]/2;
    }
    else{
    a[i]=3*a[i-1]+1;
    }
    if(count[a[i]]==1){ 
     cout << i+1 <<endl;
      break;
    }
    count[a[i]]++;
  }  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:8: error: 'count' was not declared in this scope; did you mean 'counts'?
   21 |     if(count[a[i]]==1){
      |        ^~~~~
      |        counts
a.cc:25:5: error: 'count' was not declared in this scope; did you mean 'counts'?
   25 |     count[a[i]]++;
      |     ^~~~~
      |     counts
Language: C

#include <stdio.h>

int main() {
    int s = 0;
    scanf("%d", &s);
    int count[1000000];
    for (int i=0; i<1000000; i+) {
        count[i] = 0;
    }
    int buf = s;
    while (1) {
        count[buf]++;
        if (count[buf] > 1) break;
        if (buf&2 == 0) buf = buf/2;
        else buf = 3*buf+1;
    }
    printf("%d\n", buf);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:32: error: expected expression before ')' token
    7 |     for (int i=0; i<1000000; i+) {
      |                                ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
  int s; cin >> s;
  vector<int>a(1000000);
  a[0] = s;
  for(int i = 0;i < 1000000;i++){
    if(a[i] % 2 == 0){
      a[i+1] = a[i]/2;
    }else{
      a[i+1] = a[i]*3+1;
    }
  }
  int m = 0;
  for(int i = 0;i < 1000000;i++){
    for(int j = 0;j < i,j++){
      if(a[j] == a[i]){
        m = i;
        break;
      }
    }
    if(m != 0){
      break;
    }
  }
  cout << m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:28: error: expected ';' before ')' token
   17 |     for(int j = 0;j < i,j++){
      |                            ^
      |                            ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int s;
  cin >> s;
  vector<int> a = {s};
  int n = s;
      int i;
  while(1){
    if(n %2 == 0){
      n = n/2;
    }else{
      n = 3n+1;
    }

    for(i = 0;i < a.size();i++){
      if(a[i] == n){
        cout << a.size() + 1 << endl;
        return 0;
      }
    }
    a.push_back(n);
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: unable to find numeric literal operator 'operator""n'
   14 |       n = 3n+1;
      |           ^~
a.cc:24:4: error: expected '}' at end of input
   24 |   }
      |    ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

vector<bool> checked(1000001) = {false};

long long int f(long long int a){
  if(checked[a]){
  return a;
  }
  checked[a] = true;
  long long int ans = 0;
  if(a % 2 == 0){
    ans = f(a/2);
  }else{
    ans = f(3 * a + 1);
  }
  return ans;
}

int main(){
  int s = 0;
  cin >> s;
  long long int ans = f(s);
  
  cout << ans;
}

Compiler output:
a.cc:6:31: error: expected ',' or ';' before '=' token
    6 | vector<bool> checked(1000001) = {false};
      |                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int s;
  cin >> s;
  vector<int> a;
  if(s == 1 || s == 2 || s == 4){
    cout << '4' << endl;
  }
  else{
    for(ini = 0; ; i++) {
      if(i == 0){
        a.at(i) = s;
      }
      else {
        if(a.at(i-1)%2 == 0){
          a.at(i) = a.at(i-1)/2;
        }
        else{
          a.at(i) = 3*a.at(i-1) +1;
        }
      }
      if(a.at(i) == 1 || a.at(i) == 2 || a.at(i)== 4){
    cout << i+3 << endl;
      }
    }
  }
}

        
    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'ini' was not declared in this scope; did you mean 'int'?
   12 |     for(ini = 0; ; i++) {
      |         ^~~
      |         int
a.cc:12:20: error: 'i' was not declared in this scope
   12 |     for(ini = 0; ; i++) {
      |                    ^
Language: C++

using namespace std;
int main(void){
  int n;
  cin >> n;
  
  int ans = 0;
  if(n == 1||n == 2)
    int ans = 1;
  
  int p = 0;
  
  while(1){
    if(n % 2 == 0){
      n = n / 2;
      p++;
    }
    else{
      n = n * 3 + 1;
      p++;
    }
    if(n == 4)
      break;
  }
  
  if(ans)
    cout << 4 << endl;
  else
   cout << p+4 << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin >> n;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:26:5: error: 'cout' was not declared in this scope
   26 |     cout << 4 << endl;
      |     ^~~~
a.cc:26:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:26:18: error: 'endl' was not declared in this scope
   26 |     cout << 4 << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:28:4: error: 'cout' was not declared in this scope
   28 |    cout << p+4 << endl;
      |    ^~~~
a.cc:28:4: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:19: error: 'endl' was not declared in this scope
   28 |    cout << p+4 << endl;
      |                   ^~~~
a.cc:28:19: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
 int a,b;
  cin>>a;
  vector<int> n(1000000),p(1000000);
 
  for(int i=0;i<1000000;i++){
 n[i]=0;
    }
  n[0]=a;
  p[a]=1;
  for(int i=0;i<1000000;i++){
if(n[i]%2==0){
  n[i+i]=n[i]/2;
}
    else{
    n[i+1]=3*n[i]+1
    }
   if(p[n[i+1]]==1){
     b=i;
     break;
   }
    else{
      p[n[i+1]]++;
    }
  }
  cout<<b<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:20: error: expected ';' before '}' token
   19 |     n[i+1]=3*n[i]+1
      |                    ^
      |                    ;
   20 |     }
      |     ~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  	int s;
  	cin >> s;
  	map<int, int> a;
  	a[s] = 1;
  	int i=2;
  	int before = s;
  	while(true){
      	int tmp;
    	if(before%2 == 0){
          	tmp = before/2;
        }else{
          	tmp = 3*before+1
        }
      	if(a[tmp] != 0){
        	break;
        }
      	a[tmp] = i;
      	before = tmp;
      	i++;
    }
  	cout << i << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'map' was not declared in this scope
    9 |         map<int, int> a;
      |         ^~~
a.cc:4:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    3 | #include <algorithm>
  +++ |+#include <map>
    4 | using namespace std;
a.cc:9:13: error: expected primary-expression before 'int'
    9 |         map<int, int> a;
      |             ^~~
a.cc:10:9: error: 'a' was not declared in this scope
   10 |         a[s] = 1;
      |         ^
a.cc:18:33: error: expected ';' before '}' token
   18 |                 tmp = 3*before+1
      |                                 ^
      |                                 ;
   19 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int s;
  cin >> s;
  int n=1;
  while (s!=1){
    s=s%2==0?s/2:s*3+1;
    n++;
  }
  n=s<3?:3:n
  cout << n+1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: expected ';' before ':' token
   12 |   n=s<3?:3:n
      |           ^
      |           ;
Language: C++

#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
using namespace std;
int main() {
    int s;
	cin >> s;
	int a[110];
	int ans = 0;

	a[1] = s;

	for (int i = 2; i <= INFINITY; i++) {
		if (a[i - 1] % 2 == 0)a[i] = a[i - 1] / 2;
		else a[i] = 3 * a[i - 1] + 1;
		if (a[i] == 4) {
			ans = i + 3;
			break;
		}
	}

	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:30: error: 'INFINITY' was not declared in this scope
   14 |         for (int i = 2; i <= INFINITY; i++) {
      |                              ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
    vector<int> vec;
    int s, e;
    cin >> s;
    vec.push_back(s);
    bool flag = true;
    while(flag){
        if(s % 2 == 0) e = s / 2;
        else e = 3 * s + 1;
        vec.push_back(e);
        for(int i = 0; i < vec.size() - 1; i++){
            if(vec[i] == e) flag = false;
        }
        s = e;
    }
    cout << vec.size() << endl;
    return 0;
}#include <bits/stdc++.h>
using namespace std;

int main(){
    vector<int> vec;
    int s, e;
    cin >> s;
    vec.push_back(s);
    bool flag = true;
    while(flag){
        if(s % 2 == 0) e = s / 2;
        else e = 3 * s + 1;
        vec.push_back(e);
        for(int i = 0; i < vec.size() - 1; i++){
            if(vec[i] == e) flag = false;
        }
        s = e;
    }
    cout << vec.size() << endl;
    return 0;
}

Compiler output:
a.cc:21:2: error: stray '#' in program
   21 | }#include <bits/stdc++.h>
      |  ^
a.cc:21:3: error: 'include' does not name a type
   21 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:24:5: error: redefinition of 'int main()'
   24 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
int s;
  cin >> s;
int a[1000010];
  for(int i = 0;i < 1000010;i++){
  a[i] = 2;
  }
  
  for(int i = 0; i < 1000010;i++){
  if((a[s - 1] == 0){
  cout << i << endl;
    break;
  }
    
  else if(i == 0){
  a[s - 1] = 1;
  }  

  else if(s % 2 == 0){
    s /= 2;
    a[s - 1]--;
  }
  else if(s % 2 == 1){
  s = s * 3 + 1;
   a[s * 3] = 0; 
    } 

  }    
  
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: expected ')' before '{' token
   13 |   if((a[s - 1] == 0){
      |     ~               ^
      |                     )
a.cc:31:3: error: expected primary-expression before '}' token
   31 |   }
      |   ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll=long long;  
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
	cin >> N;
	vector<int> a;
	a.push_back(N);
	size_t i=1;
	while(1){
		if(N%2==0){ 
			a.push_back(N/2);
			N/=2;
		}
		else{
			a.push_back(N*3+1);
			N=N*3+1
		}  
		
		if(a.size()>=3){
			if(a[i]==1&&a[i-1]==2&&a[i-2]==4){
				cout << i+2 <<endl;
				return 0;
			}
			
		}
		i++;
	}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:32: error: expected ';' before '}' token
   45 |                         N=N*3+1
      |                                ^
      |                                ;
   46 |                 }
      |                 ~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
	vector<int> a(1000100);
	cin >> a[0];
	if((a[0]-2)a[0](a[0]-4) == 0){
		cout << 3 << endl;
		return 0;
	}
	for(int i = 0 ; i < 1000000; i++){
		if(a[i]%2 == 0){
			a[i+1] = a[i]/2;
		}else{
			a[i+1] = a[i]*3+1;
		}
		if(a[i+1] == 4){
		cout << i+4 << endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: expected ')' before 'a'
    7 |         if((a[0]-2)a[0](a[0]-4) == 0){
      |           ~        ^
      |                    )
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
	vector<int> a(1000100);
	cin >> a[0];
	if((a[0]-2)a[0](a[0]-4) == 0){
		cout << 3 << endl;
		return 0;
	}
	for(int i = 0 ; i < 10000099; i++){
		if(a[i]%2 == 0){
			a[i+1] = a[i]/2;
		}else{
			a[i+1] = a[i]*3+1;
		}
		if(a[i+1] == 4){
		cout << i+4 << endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: expected ')' before 'a'
    7 |         if((a[0]-2)a[0](a[0]-4) == 0){
      |           ~        ^
      |                    )
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
	vector<int> a(1000100);
	cin >> a[0];
	for(int i = 0 ; i < 10000099; i++){
		if(a[i]%2 == 0){
			a[i+1] = a[i]/2;
		}else{
			a[i+1] = a[i]*3+1;
		}
	}
	if(a[i+1] == 4){
		cout << i+4 << endl;
		return 0;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: 'i' was not declared in this scope
   14 |         if(a[i+1] == 4){
      |              ^
Language: C++

#include <iostream>
using namespace std;

int main (){
    int s;
    int a, b = 1;
    a = s;
    cin >> s;
    int i = 0;
    while(1){
        if (a % 2 = 1){
            a = a * 3 + 1;
        } else {
            a = a/2;
        }
        if (a == 1){
            cout << b + 1 << endl;
            break;
        }
        b++;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: lvalue required as left operand of assignment
   11 |         if (a % 2 = 1){
      |             ~~^~~
Language: C++

#include <iostream>
using namespace std;

int main (){
    int s;
    int a, b = 1;
    a = s;
    cin >> s;
    int i = 0;
    while(1){
        if (a % 2 = 1){
            a = a * 3 + 1;
        } else {
            a = a/2;
        }
        if (a = 1){
            cout << b + 1 << endl;
            break;
        }
        b++;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: lvalue required as left operand of assignment
   11 |         if (a % 2 = 1){
      |             ~~^~~
Language: C++

#include <iostream>
using namespace std;

int main (){
    int s;
    int a[1000000];
    a[1]=s;
    cin >> s;
    int i = 0;
    while(1){
        if (a[i] % 2 == 0){
            a[i+1] = a[i]/2;
        } else {
            a[i +1] = a[i] * 3 + 1;
        }
        for (int j = 0; j < i-1 j++){
            if (a[j] == a[i]){
                cout << i << endl;
                break;
            }
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:32: error: expected ';' before 'j'
   16 |         for (int j = 0; j < i-1 j++){
      |                                ^~
      |                                ;
Language: C++

#include <iostream>
using namespace std;

int main (){
    int s;
    int a[1000000];
    a[1]=s;
    cin >> s;
    int i = 0;
    while(1){
        if (a[i] % 2 == 0){
            a[i++] = a[i]/2;
        } else {
            a[i++] = a[i] * 3 + 1;
        }
        for (int j = 0; j < i-1 j++){
            if (a[j] == a[i]){
                cout << i << endl;
                break;
            }
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:32: error: expected ';' before 'j'
   16 |         for (int j = 0; j < i-1 j++){
      |                                ^~
      |                                ;
Language: C++

#include <bits/stdc++.h>
using namespace std;

int collatz(int x){
  if(x%2==0)return x/2;
  else return 3*x+1;
}

int main(){
	int s;cin >>s;
 	vector<int>a;
  int cnt=2;
  int x=s;
  a.push_back(x);
  while(true){
  	x=collatz(x);
    if(any_of(a.begin(),a.end(),[x&](int y){return y==x;}){
      cout <<cnt;return 0;}
       a.pushback(x);
       cnt++;}
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:35: error: expected ',' before '&' token
   17 |     if(any_of(a.begin(),a.end(),[x&](int y){return y==x;}){
      |                                   ^
      |                                   ,
a.cc:17:36: error: expected identifier before ']' token
   17 |     if(any_of(a.begin(),a.end(),[x&](int y){return y==x;}){
      |                                    ^
a.cc:17:59: error: expected ';' before '{' token
   17 |     if(any_of(a.begin(),a.end(),[x&](int y){return y==x;}){
      |                                                           ^
      |                                                           ;
a.cc:17:14: warning: ignoring return value of 'bool std::any_of(_IIter, _IIter, _Predicate) [with _IIter = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Predicate = main()::<lambda(int)>]', declared with attribute 'nodiscard' [-Wunused-result]
   17 |     if(any_of(a.begin(),a.end(),[x&](int y){return y==x;}){
      |        ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:447:5: note: declared here
  447 |     any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
      |     ^~~~~~
a.cc:19:10: error: 'class std::vector<int>' has no member named 'pushback'; did you mean 'push_back'?
   19 |        a.pushback(x);
      |          ^~~~~~~~
      |          push_back
a.cc:19:21: error: expected ')' before ';' token
   19 |        a.pushback(x);
      |                     ^
      |                     )
a.cc:17:7: note: to match this '('
   17 |     if(any_of(a.begin(),a.end(),[x&](int y){return y==x;}){
      |       ^
a.cc: At global scope:
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

s = int(input())

S = [s]

for i in range(1,100000000):
  if(s%2 == 0):
    s = s / 2
  else:
    s = 3 * s + 1
  if s in S:
    print(i+1)  
    break
  else: S.append(s)

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s = int(input())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
    int s, m = 1;
    int c[301];
    cin >> s;
    c[s]++;
    while(){
        if(s%2 == 0){
            s /= 2;
        }else{
            s = 3*s+1;
        }
        if(c[s] == 1){
            cout << m;
            return 0;
        }else{
            c[s]++;
        }
        m++;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: expected primary-expression before ')' token
    9 |     while(){
      |           ^
Language: C

#include <stdio.h>
int main(void){
int s,m[1000010],count,flag;
  int count,count2,count3;
  scanf("%d",&s);
  m[0]=s;
  for(count=1;;count++){
  if(s%2==0){s=s/2;}
    else{s=(s*3)+1;}
  m[count]=s;
    if(s==1){count3=count;break;}
  }
   for(count=0;count!=count3;count++){
     for(count2=0;count2!=count3;count2++){
     if(m[count]==m[count2]){flag=1;break;}
     }
     if(flag==1){printf("%d",count);break;}
   }
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:7: error: redeclaration of 'count' with no linkage
    4 |   int count,count2,count3;
      |       ^~~~~
main.c:3:18: note: previous declaration of 'count' with type 'int'
    3 | int s,m[1000010],count,flag;
      |                  ^~~~~
Language: C++

s = int(input())
lst = [s]
while True:
    if lst[-1]%2 == 0:
        a = lst[-1]//2
    else:
        a = 3*lst[-1] + 1
    if a in lst:
        lst.append(a)
        print(len(lst))
        break
    lst.append(a)

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s = int(input())
      | ^
Language: C

#include <stdio.h>

int main (void){
  int a[1000000],k,m,min=0;flag=0;
  scanf("%d",&a[0]);
  
  for(k=1;;k++){
    if(a[k-1]%2 ==0) a[k]=a[k-1]/2;
    if(a[k-1]%2 !=0) a[k]=a[k-1]*3+1;
    for(m=1;m<k;m++){
      if(a[m]==a[k]){
        min=m;
        flag=1;
      }
      if(flag==1) break;
    }
    if(flag==1) break;
  }
  
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:4:28: error: 'flag' undeclared (first use in this function)
    4 |   int a[1000000],k,m,min=0;flag=0;
      |                            ^~~~
main.c:4:28: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <staio.h>

int main (void){
  int a[1000000],k,m,min=0;flag=0;
  scanf("%d",&a[0]);
  
  for(k=1;;k++){
    if(a[k-1]%2 ==0) a[k]=a[k-1]/2;
    if(a[k-1]%2 !=0) a[k]=a[k-1]*3+1;
    for(m=1;m<k;m++){
      if(a[m]==a[k]){
        min=m;
        flag=1;
      }
      if(flag==1) break;
    }
    if(flag==1) break;
  }
  
  return 0;
}

Compiler output:
main.c:1:10: fatal error: staio.h: No such file or directory
    1 | #include <staio.h>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;using int32=int_fast32_t;using uint32=uint_fast32_t;using int64=int_fast64_t;using uint64=uint_fast64_t;using pi=pair<int32,int32>;using pll=pair<int64,int64>;using vi=vector<int32>;using vvi=vector<vector<int32>>;using vll=vector<int64>;using ll=int64;using ull=uint64;constexpr int32 INF=1<<30;constexpr ll INFLL=1LL<<62;
#define all(x) x.begin(),x.end()
#define LB(V,x) lower_bound(all(V),x)-V.begin()
#define uint uint32
inline int f(int x){
    return x%2==0 ? n/2 : x*3+1;
}
void Main(){
    int s;
    cin >> s;
    map<int, int> R;
    for(int n=1;n<=1000000;n++){
        if(R[s]!=0) break;
        R[s] = n;
        s = f(s);
    }
    cout << R[s];
}
int main(){cin.tie(0);ios::sync_with_stdio(false);Main();return 0;}

Compiler output:
a.cc: In function 'int f(int)':
a.cc:7:21: error: 'n' was not declared in this scope
    7 |     return x%2==0 ? n/2 : x*3+1;
      |                     ^
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;

int main(){
	int a[1000000+1],count=1;
  	scanf("%d",&a[count]);
  	while(1){
      ++count;
      if(a[count-1]%2==0)a[count]=a[count-1]/2;
  	  else if(a[count-1%2!=0)  a[count]=3*a[count-1]+1;
     for(int i=1;i<count;++i){
      	if(a[i]==a[count])break;
      }
    }
  	printf("%d\n",&count);
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:33: error: expected ']' before ')' token
   11 |           else if(a[count-1%2!=0)  a[count]=3*a[count-1]+1;
      |                                 ^
      |                                 ]
Language: C++

#include<iostream>
using namespace std;

int func(int n){
  	int a;
	if(n%2==0){
      a=n/2;
  	else return 3*n+1;
}

int main(){
	int a[1000000+1],count=1;
  	cin>>a[count];
  	while(1){
      ++count;
      if(a[count]%2==0)
      	a[count]=a[count-1]/2;
  	  else  a[count]=3*a[count-1]+1;
     for(int i=1;i=count;++i){
      	if(a[i]==a[count])break;
      }
    }
  	cout<<count<<endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int func(int)':
a.cc:8:9: error: expected '}' before 'else'
    8 |         else return 3*n+1;
      |         ^~~~
a.cc:6:19: note: to match this '{'
    6 |         if(n%2==0){
      |                   ^
a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type]
    9 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

int func(int n){
  	int a;
	if(n%2==0){
      a=n/2;
  	else return 3*n+1;
}

int main(){
	int a[1000000+1],count=1;
  	cin>>a[count];
  	while(1){
      ++count;
      if(a[count]%2==0)
      	a[count]=a[count-1]/2;
  	  else  a[count]=3*a[count-1]+1;
     for(int i=1;i=count){
      	if(a[i]==a[count])break;
      }
    }
  	cout<<count<<endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int func(int)':
a.cc:8:9: error: expected '}' before 'else'
    8 |         else return 3*n+1;
      |         ^~~~
a.cc:6:19: note: to match this '{'
    6 |         if(n%2==0){
      |                   ^
a.cc: In function 'int main()':
a.cc:19:25: error: expected ';' before ')' token
   19 |      for(int i=1;i=count){
      |                         ^
      |                         ;
a.cc: In function 'int func(int)':
a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type]
    9 | }
      | ^
Language: C++


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
 
#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}
 
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
 
using namespace std;
 
typedef pair<int,int> pii;
 
int main(){
  int n;
  cin >> n;

  map<int ,int> mp;
  int i = 1;
  
  mp[val] = 1;
  int val = n;

  while(true){
    if(val % 2 == 0){
      val = val / 2;
    }else{
      val = 3 * val + 1;
    }

    if(mp[val] == 1){
      cout << i+1 << endl;
      break;
    }
    mp[val] = 1;
    i++;
  }
  return 0;
}
 



Compiler output:
a.cc: In function 'int main()':
a.cc:48:6: error: 'val' was not declared in this scope
   48 |   mp[val] = 1;
      |      ^~~
Language: C++

#include <iostream>
using namespace std;

int f(n){
  if(n&1){
    return 3*n + 1
  }
  else{
    return n >> 1
  }
}

int main(){
  int s;
  cin >> s;
  for(int i=2; i<1000000; ++i){
    s = f(s)
    if(s == 1){
      cout << i << endl;
    }
  }
}

Compiler output:
a.cc:4:7: error: 'n' was not declared in this scope
    4 | int f(n){
      |       ^
a.cc: In function 'int main()':
a.cc:17:10: error: 'f' cannot be used as a function
   17 |     s = f(s)
      |         ~^~~
Language: C++

int main() {
  int s;
  cin>>s;
  int count=1;
  
  if(s==1||s==2||s==4){
    cout<<4;
   }
  else {
  while(s!=1){
    if(s%2==0)
    s=s/2;
  else
    s=3*s+1;
    
    count++;
    }
   cout<<count+1;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin>>s;
      |   ^~~
a.cc:7:5: error: 'cout' was not declared in this scope; did you mean 'count'?
    7 |     cout<<4;
      |     ^~~~
      |     count
a.cc:18:4: error: 'cout' was not declared in this scope; did you mean 'count'?
   18 |    cout<<count+1;
      |    ^~~~
      |    count
Language: C++

#include <iostream>
using namespace std;

int main(){
  int s;
  cin >> s;
  int x = s;
  set <int> st ;
  while(st.count(x) == 0){
    st.insert(x)
    if(x % 2 == 0){
      x /= 2;
    }
    else{
      x = x * 3 + 1;
    }
  }
  cout << (st.size() + 1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'set' was not declared in this scope
    8 |   set <int> st ;
      |   ^~~
a.cc:2:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    1 | #include <iostream>
  +++ |+#include <set>
    2 | using namespace std;
a.cc:8:8: error: expected primary-expression before 'int'
    8 |   set <int> st ;
      |        ^~~
a.cc:9:9: error: 'st' was not declared in this scope; did you mean 's'?
    9 |   while(st.count(x) == 0){
      |         ^~
      |         s
a.cc:14:5: error: 'else' without a previous 'if'
   14 |     else{
      |     ^~~~
a.cc:18:12: error: 'st' was not declared in this scope; did you mean 's'?
   18 |   cout << (st.size() + 1) << endl;
      |            ^~
      |            s
Language: C++

#include <bits/stdc++.h>
using namespace std;
int f(int n){
  if(n%2==0){
    return n/2;
  }else{
    return 3*n+1;
  }
}

int main(){
  int s;
  cin>>s;
  
  vector<int> vect(1000001,0);
  vect[0]=s;
  //vect[1]=f(vect[0]);
  for(int i=0;i<1000001-1;i++){
    vect[i+1]=f(vect[i]);
    for(int j=0;j<i;j++){
      if(vect[i]==vect[j]){
        cout<<i+1<<endl;
        return 0;
      }

    }

  }

Compiler output:
a.cc: In function 'int main()':
a.cc:28:4: error: expected '}' at end of input
   28 |   }
      |    ^
a.cc:11:11: note: to match this '{'
   11 | int main(){
      |           ^
Language: C++

/*#include <iostream>
using namespace std;
long long a[1000001]={0};	
int main()
{
	long long n;
	cin>>n;
	a[1]=n;
	for (int i=2;i<=1000001;i++)
	{
		if (a[i-1]%2==0)  a[i]=a[i-1]/2;
		else a[i]=a[i-1]*3+1;
		for (int j=1;j<=i-1;j++)
		{
			if (a[j]==a[i])
			{
				cout<<i<<endl;
				return 0;
			}
		}
	}
	return 0;
}*/
#include <bits/stdc++.h>
using namespace std;
int f(int n){
  if(n%2==0){
    return n/2;
  }else{
    return 3*n+1;
  }
}

int main(){
  int s;
  cin>>s;
  
  vector<int> vect(1000001);
  vect[0]=f(s);
  //vect[1]=f(vect[0]);
  for(int i=0;i<1000001;i++){
    vect[i+1]=f(vect[i]);
    for(int j=0;j<i;j++){
      if(vect[i]==vect[j]){
        cout<<i+2<<endl;
        return 0;
      }

    }

  }

Compiler output:
a.cc: In function 'int main()':
a.cc:51:4: error: expected '}' at end of input
   51 |   }
      |    ^
a.cc:34:11: note: to match this '{'
   34 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int s ;
  cin >> s;
  set<int> st;
  int x = s;
  while(st.count(x) == 0 ){
    st.insert(x);
    if(x % 2 == 0){
      x /= 2;
    }
    else{
      x = x*3 + 1;
    }
  }
  cout << (st.size() + 1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'set' was not declared in this scope
    7 |   set<int> st;
      |   ^~~
a.cc:2:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    1 | #include <iostream>
  +++ |+#include <set>
    2 | using namespace std;
a.cc:7:7: error: expected primary-expression before 'int'
    7 |   set<int> st;
      |       ^~~
a.cc:9:9: error: 'st' was not declared in this scope; did you mean 's'?
    9 |   while(st.count(x) == 0 ){
      |         ^~
      |         s
a.cc:18:12: error: 'st' was not declared in this scope; did you mean 's'?
   18 |   cout << (st.size() + 1) << endl;
      |            ^~
      |            s
Language: C++

#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
   int s;
   cin>>s;
   int cnt=0;
   if(s==1|s==2) {
     cout<<4;
   else{
     while(s!=4){
      if(s%2==0) s=s/2;
      else s=3*s+1;
      cnt++;
     }
      cout<<cnt+4;
   }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:4: error: expected '}' before 'else'
   18 |    else{
      |    ^~~~
a.cc:16:18: note: to match this '{'
   16 |    if(s==1|s==2) {
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int colla(int x){
  if(x%2==0) x/=2;
  else x=3*x+1;}

int main() {
  int n;
  cin>>n;
  if(n==1||n==2||n==4) cout<<4<<endl;
else{
  int count=1;
  while(n!=1){
    n=colla(n);
    count++;
}
  cout<<count+1<<endl;

Compiler output:
a.cc: In function 'int colla(int)':
a.cc:8:16: warning: no return statement in function returning non-void [-Wreturn-type]
    8 |   else x=3*x+1;}
      |                ^
a.cc: In function 'int main()':
a.cc:20:23: error: expected '}' at end of input
   20 |   cout<<count+1<<endl;
      |                       ^
a.cc:14:5: note: to match this '{'
   14 | else{
      |     ^
a.cc:20:23: error: expected '}' at end of input
   20 |   cout<<count+1<<endl;
      |                       ^
a.cc:10:12: note: to match this '{'
   10 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <numeric>
#include <unordered_set>

using namespace std;

int solve(int s) {
    auto i = 1;
    unordered_set<int> results;
    results.insert(s);
    auto next = f(s);
    while (!results.count(next)) {
        results.insert(next);
        next = f(next);
        i++;
    }
    return i + 1;
}

// Read parameters from standard input and call main solution function
int main() {
    int s;
    cin >> s;
    cout << solve(s) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:11:17: error: 'f' was not declared in this scope
   11 |     auto next = f(s);
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rItr(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define Itr(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define setp(n) fixed << setprecision(n)
#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>
#define All(a) (a.begin()),(a.end())
#define rAll(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll s; cin>>s;
	set<ll> a;
	ll la=s, ans=1;
	a.insert(s);
	while(true){
		ll f;
		ans++;
		if (la%2==1)
			f=3*i+1;
		else
			f=/2;
		if (a.count(f)) break;
		a.insert(f);
		la=f;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:29: error: 'i' was not declared in this scope
   33 |                         f=3*i+1;
      |                             ^
a.cc:35:27: error: expected primary-expression before '/' token
   35 |                         f=/2;
      |                           ^
Language: C++

#include <iostream>
using namespace std;

int f(int n) {
	int fn;
	if (n % 2 == 0) {
		fn = n /= 2;
	} else {
		fn = 3 * n + 1;
	}
	return fn;
}

int a[1000001];

int main() {
	int s;
	cin >> s;

	a[0] = s;
	bool flag = false;
	for (int i = 0; i < 1000001; i++) {
		a[i + 1] = f(a[i]);
		for (int j = 0; j < 1000000; j++) {
			if (a[i] == a[i + j]) {
				flag = true;
				break;
			}
			j++;
		}
		if (flag) break;
	}

	cout << i << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'i' was not declared in this scope
   34 |         cout << i << endl;
      |                 ^
Language: C++

#include <iostream>
using namespace std;

int f(int n) {
	int fn;
	if (n % 2 == 0) {
		fn = n /= 2;
	} else {
		fn = 3 * n + 1;
	}
	return fn;
}

int main() {
	int s;
	cin >> s;
	int a[1000001]
	
	int i = 0;
	a[i] = s;
	bool flag = false;
	for (int i = 0; i < 1000001; i++) {
		a[i + 1] = f(a[i]);
		for (int j = 0; j < 1000000; j++) {
			if (a[i] == a[i + j]) {
				flag = true;
				break;
			}
			j++;
		}
		if (flag) break;
	}

	cout << i << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: expected initializer before 'int'
   19 |         int i = 0;
      |         ^~~
a.cc:20:9: error: 'a' was not declared in this scope
   20 |         a[i] = s;
      |         ^
a.cc:20:11: error: 'i' was not declared in this scope
   20 |         a[i] = s;
      |           ^
Language: C

#include <iostream>
using namespace std;
long long a[1000001]={0};	
int main()
{
	long long n;
	cin>>n;
	a[1]=n;
	for (int i=2;i<=1000001;i++)
	{
		if (a[i-1]%2==0)  a[i]=a[i-1]/2;
		else a[i]=a[i-1]*3+1;
		for (int j=1;j<=i-1;j++)
		{
			if (a[j]==a[i])
			{
				cout<<i<<endl;
				return 0;
			}
		}
	}
	return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.