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

#include <stdio.h>
int main (void){
    int a,c,i,j,n;
    for(;;){
        scanf("%d",&n);
        if(n==0)break;
        int b[101]={},ans=0;
        for(i=0;i<n;i++){
            scanf("%d",&a);
            b[i]=a;
        }
        for(i=1;i<n;i++){
            for(j=1;j<n;j++){
                if(b[j-1]>=b[j]){
                    if(b[j-1]>b[j]){
                        ans++;
                    }
                    c=b[j-1];
                    b[j-1]=b[j];
                    b[j]=c;
                }
               }
            }
        }
        printf("%d\n",ans);
    }
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:25:23: error: 'ans' undeclared (first use in this function)
   25 |         printf("%d\n",ans);
      |                       ^~~
main.c:25:23: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:27:1: error: expected identifier or '(' before 'return'
   27 | return 0;
      | ^~~~~~
main.c:28:1: error: expected identifier or '(' before '}' token
   28 | }
      | ^
Language: C

#include<stdio.h>

int main(){
int i;
int n;
int u[500];
int sum;
int cnt;

while(scanf("%d", &n), n!=0){
for(i=0; i<n; i++)
scanf("%d", &u[i]);

cnt=0;

for(i=n-1; i>0; i--){
for(j=0; j<i; j++){
if(u[j]>u[j+1]){
sum=u[i];
u[j]=u[j+1];
u[j+1]=sum;
cnt++;
}
}
}
printf("%d\n", cnt);
}
return 0;
}

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

#include <stdio.h>
main(){
  int a,n[100],i,j,max=0,tmp,t;
  while(1){
    scanf("%d",&a);
    if(a==0) break;
    for(i=0;i<=a;i++){
      scanf("%d",&n[i]);
    }

    for(j=0;j<a;j++){
      for(i=j;i<a;i++){
	t=i+1;
	if(a[i]>a[t]){
	  tmp=a[t];
	  a[t]=a[i];
	  a[i]=tmp;
	}
      }
    }
    printf("%d\n",n);
  }
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:14:13: error: subscripted value is neither array nor pointer nor vector
   14 |         if(a[i]>a[t]){
      |             ^
main.c:14:18: error: subscripted value is neither array nor pointer nor vector
   14 |         if(a[i]>a[t]){
      |                  ^
main.c:15:16: error: subscripted value is neither array nor pointer nor vector
   15 |           tmp=a[t];
      |                ^
main.c:16:12: error: subscripted value is neither array nor pointer nor vector
   16 |           a[t]=a[i];
      |            ^
main.c:16:17: error: subscripted value is neither array nor pointer nor vector
   16 |           a[t]=a[i];
      |                 ^
main.c:17:12: error: subscripted value is neither array nor pointer nor vector
   17 |           a[i]=tmp;
      |            ^
Language: C

#include <stdio.h>
main(){
  int a,n[100],i,j,max=0,tmp,t;
  while(1){
    scanf("%d",&a);
    if(a==0) break;
    for(i=0;i<=a;i++){
      scanf("%d",&n[i]);
    }

    for(j=0;j<a;j++){
      for(i=j;i<a-1;i++){
	t=i+1;
	if(a[i]>a[t]){
	  tmp=a[t];
	  a[t]=a[i];
	  a[i]=tmp;
	}
      }
    }
    printf("%d\n",n);
  }
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:14:13: error: subscripted value is neither array nor pointer nor vector
   14 |         if(a[i]>a[t]){
      |             ^
main.c:14:18: error: subscripted value is neither array nor pointer nor vector
   14 |         if(a[i]>a[t]){
      |                  ^
main.c:15:16: error: subscripted value is neither array nor pointer nor vector
   15 |           tmp=a[t];
      |                ^
main.c:16:12: error: subscripted value is neither array nor pointer nor vector
   16 |           a[t]=a[i];
      |            ^
main.c:16:17: error: subscripted value is neither array nor pointer nor vector
   16 |           a[t]=a[i];
      |                 ^
main.c:17:12: error: subscripted value is neither array nor pointer nor vector
   17 |           a[i]=tmp;
      |            ^
Language: C


#include <stdio.h>
main(){
  int a,n[100],i,j,max=0,tmp,m;
  while(1){
    scanf("%d",&a);
    if(a==0) break;
    for(i=0;i<=a;i++){
      scanf("%d",&n[i]);
    }

    for(j=0;j<a-1;j++){
      for(i=j;i<a-1;i++){
	m=i+1;
	if(a[i]>a[m]){
	  tmp=a[m];
	  a[m]=a[i];
	  a[i]=tmp;
	}
      }
    }
    printf("%d\n",n);
  }
}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:15:13: error: subscripted value is neither array nor pointer nor vector
   15 |         if(a[i]>a[m]){
      |             ^
main.c:15:18: error: subscripted value is neither array nor pointer nor vector
   15 |         if(a[i]>a[m]){
      |                  ^
main.c:16:16: error: subscripted value is neither array nor pointer nor vector
   16 |           tmp=a[m];
      |                ^
main.c:17:12: error: subscripted value is neither array nor pointer nor vector
   17 |           a[m]=a[i];
      |            ^
main.c:17:17: error: subscripted value is neither array nor pointer nor vector
   17 |           a[m]=a[i];
      |                 ^
main.c:18:12: error: subscripted value is neither array nor pointer nor vector
   18 |           a[i]=tmp;
      |            ^
Language: C

#include<stdio.h>
void swap(int *x,int *y){
int m=*x;
*x=*y;
*y=m;
}
int main(){
int a[200],n,j;
while(scanf("%d",&n),n){
j=0;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n-1;i++)
if(a[i]>a[i+1]){
swap(&a[i],&a[i+1]);
j++;
}
printf("%d\n",j);

}
return 0;
}

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

#include<stdio.h>
void swap(int *x,int *y){
int m=*x;
*x=*y;
*y=m;
}
int main(){
int a[200],n,j,k;
while(scanf("%d",&n),n){
j=0;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(k=0;k<n-1;k++)
for(i=0;i<n-1;i++)
if(a[i]>a[i+1]){
swap(&a[i],&a[i+1]);
j++;
}
printf("%d\n",j);

}
return 0;
}

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

#include <stdio.h>

int main(void)
{
	int N;
	int i, j;
	int count;
	int box[100];
	int tmp;
	
	while (1){
		scanf("%d", &N);
		if (N == 0){
			break;
		}
		
		count = 0;
		
		for (i = 0; i < N; i++){
			scanf("%d", &box[i]);
		}
		for (i = 0; i < N - 1; i++){
			for (j = 0; j = N - i - 1; j++){
				if (box[j] > box[j + 1]{
					tmp = box[j];
					box[j] = box[j + 1];
					box[j + 1] = tmp;
					
					count++;
				}
			}
		}
	}
	printf("%d\n", count);
	
	return (0);
}

Compiler output:
main.c: In function 'main':
main.c:24:56: error: expected ')' before '{' token
   24 |                                 if (box[j] > box[j + 1]{
      |                                    ~                   ^
      |                                                        )
main.c:31:25: error: expected expression before '}' token
   31 |                         }
      |                         ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < int(n); i++)

int BIT[1000001];

int sum(int idx)
{
	int ret = 0;
	while (idx != 0)
	{
		ret += BIT[idx];
		idx -= idx & -idx;
	}
	return ret;
}

int n;
void add(int idx, int num)
{
	while (idx <= n)
	{
		BIT[idx] += num;
		idx += idx & -idx;
	}
}

signed main()
{
	while (cin >> n && n)
	{
		memset(BIT, 0, sizeof(BIT));
		int ans = 0;
		vector<int> arr(n);
		rep(i, n) cin >> arr[i];
		rep(i, n)
		{
			ans += sum(arr[n - i - 1]);
			add(arr[n - i - 1], 1);
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'memset' was not declared in this scope
   34 |                 memset(BIT, 0, sizeof(BIT));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 |
Language: C++

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

int main(void){

		int N, M;
		while(cin >> N, N){	
			int num[N], cnt = 0;
			fill_n(num, N, 0);
			for(int i = 0; i < N; i++){
				cin >> num[i];
			}
		        for(int i = N-1; i > 0; i--){
		            for(int j = 1; j <= i; j++){
		                if(num[j] < num[j-1]){
		                	int tmp;
		                	tmp = num[j];
		                	num[j] = num[j-1];
		                	num[j] = tmp;
		                    cnt++;
		                }
		            }
		        }
		    cout << cnt << endl;
		}
}

Compiler output:
a.cc:2:10: fatal error: Algorithm: No such file or directory
    2 | #include <Algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>

int main(){

int N;
int n[1000001]={};

while(1){
scanf("%d",&N);

int c=0;

for(int i=0;i<N;i++){
scanf("%d",&n[i];

for(int i=0;i<N;i++)
for(int j=N-1;j>i;j--)
{if(n[j]<n[j-1]){int T=n[j];n[j]=n[j-1];n[j-1]=T;c++}

printf("%d\n",c);
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: expected ')' before ';' token
   14 | scanf("%d",&n[i];
      |      ~          ^
      |                 )
a.cc:18:53: error: expected ';' before '}' token
   18 | {if(n[j]<n[j-1]){int T=n[j];n[j]=n[j-1];n[j-1]=T;c++}
      |                                                     ^
      |                                                     ;
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:8:9: note: to match this '{'
    8 | while(1){
      |         ^
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 1000000000;
using namespace std;

int main() {
  int n;
  while(cin>>n,n){
    int d[n],ans=0;
    rep(i, n) cin >> d[i];
    for (i = 1; i < n; i++)
      for (j = 0; j < n - i; j++)
        if (d[j] > d[j + 1]) {
          swap(d[j], d[j + 1]);
          ans++;
        }
    cout << k << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: 'i' was not declared in this scope
   12 |     for (i = 1; i < n; i++)
      |          ^
a.cc:13:12: error: 'j' was not declared in this scope
   13 |       for (j = 0; j < n - i; j++)
      |            ^
a.cc:18:13: error: 'k' was not declared in this scope
   18 |     cout << k << endl;
      |             ^
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
#include <utility>
using namespace std;

constexpr int kaijyou(const int &n) {
  return n == 0 ? 1 : n * factorial(n - 1);
}

int main() {
  int n, t;
  int ans;
  double count;
  while (cin >> n) {
    if (n == 0) return 0;
    int a[n];
    t     = 0;
    ans   = 0;
    count = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int j = 0; t == 0; j++) {
      if (j + 1 == n) {
        j = 0;
        count += 1;
      }
      if (a[j] > a[j + 1]) {
        swap(a[j], a[j + 1]);
        ans += 1;
      }
      if (count > kaijyou(n)) {
        cout << ans << endl;
        t = 1;
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'constexpr int kaijyou(const int&)':
a.cc:8:27: error: 'factorial' was not declared in this scope
    8 |   return n == 0 ? 1 : n * factorial(n - 1);
      |                           ^~~~~~~~~
Language: C++

#include<cstdio>
int main(){
	int a[102],i,j,k;
	for(;scanf("%d",a),*a;printf("%d\n",k)){
		for(i=1;i<=n; i++)scanf("%d",*(a+i++));
		k=0;
		for(j=n;j>1;j--)
			for(i=2;i<=j;i++)
				if(a[i-1]>a[i])
					a[i-1]^=a[i],a[i]^a[i-1],a[i-1]^=a[i],k++;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:28: error: 'n' was not declared in this scope
    5 |                 for(i=1;i<=n; i++)scanf("%d",*(a+i++));
      |                            ^
a.cc:7:23: error: 'n' was not declared in this scope
    7 |                 for(j=n;j>1;j--)
      |                       ^
Language: C++

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

int main(){
  int n,i,j,k,c,a[1000000];

  while(cin>>n&&n!=0){
    for(i=0;i<n;i++){
      cin>>a[i];
    }
    
    for(k=0,i=0;i<n-1;i++){
      for(j=i;j<n;j++){
	if(a[i]>a[j]){
	  c=a[i];
	  a[i]=a[j];
	  a[j]=c;
	  k++;
	} 
      }
    }
    cout<<k<<endl;
  }
return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |   while(cin>>n&&n!=0){
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<cstdio>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:23:5: error: 'cout' was not declared in this scope
   23 |     cout<<k<<endl;
      |     ^~~~
a.cc:23:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:14: error: 'endl' was not declared in this scope
   23 |     cout<<k<<endl;
      |              ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<cstdio>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include<iostream>
#define MAX_N 1000000
using namespace std;

int bit[MAX_N + 1],a[MAX_N + 1],n;

int sum(int);
void add(int,int);

int main(void){
  
  while(cin >> n,n){
    int ans=0;
    for(int i=0;i<n;i++)cin >> a[i];
    
    for(int j=0;j<n;j++){
      ans += j - sum(a[j]);
      add(a[j],1);
    }
    printf("%d\n",ans);
  }
}

int sum(int i){
  int s=0;
  while(i > 0){
    s += bit[i];
    i -= i & -i;
  }
  return s;
}

Compiler output:
/usr/bin/ld: /tmp/cczG1yvQ.o: in function `main':
a.cc:(.text+0xa3): undefined reference to `add(int, int)'
collect2: error: ld returned 1 exit status
Language: C++

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


#define N (111)
int seg[N+1];

void add(int x,int v){
	for(int i = x ; i < N ; i+=i&-i){
		seg[i] += v;
	}
}

int get(int x){
	int ans = 0;
	for(int i = x ; i > 0 ; i -= i & -i){
		ans += seg[i];
	}
	return ans;
}

int a[101];

int main(){
	int n;
	while(cin >> n && n){
		vector<int> u;
		for(int i = 0 ; i < 101 ; i++) seg[i] = 0;
		
		for(int i = 0 ; i < n ; i++) cin >> a[i] , u.push_back(a[i]);
		sort(u.begin(),u.end());
		u.erase(unique(u.begin(),u.end()),u.end());
		for(int i = 0 ; i < n ; i++)
			a[i] = (10/i) * lower_bound(u.begin(),u.end(),a[i]) - u.begin() + 1;
		int ans = 0;
		for(int i = 0 ; i < n ; i++){
			add(a[i],1);
			ans += (i+1) - get(a[i]);  //a[i]より大きな値
		}
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:39: error: no match for 'operator*' (operand types are 'int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >')
   36 |                         a[i] = (10/i) * lower_bound(u.begin(),u.end(),a[i]) - u.begin() + 1;
      |                                ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                   |                |
      |                                   int              __gnu_cxx::__normal_iterator<int*, std::vector<int> >
Language: C++

#include<iostream>
#include<cstdio>
#include<time.h>
using namespace std;
#define N 314159
int a[N],t[N];
long long ans=0;
void marge_count(int s,int g){
  if(s+1==g){
    if(a[s]>a[g]){
      swap(a[s],a[g]);ans++;
    }return;
  }
  int m= (s+g)/2;
  marge_count(s,m);
  marge_count(m,g);
  int p=s,q=m,r=s;
  while(p<m&&q<g){
    if(a[p]<a[q]){
      t[r++]=a[p++];
      ans+=q;
    }else{
      t[r++]=a[q++];
    }
  }
  if(p<m){
    while(p<m){
      t[r++]=a[p++];ans+=q;
    }
  }else{
    t[r++]=a[q++];
  }
  for(int i=s;i<g;i++){
    a[i]=t[i];
  }
}
int main(){
　while(cin>>n&&n!=0){
    ans=0;
    for(int i=0;i<n;i++)cin>>a[i];
    marge_count(0,n);
    cout<<(int)ans<<endl;
  }
  return 0;
}

Compiler output:
a.cc:38:1: error: extended character 　 is not valid in an identifier
   38 | 　while(cin>>n&&n!=0){
      | ^
a.cc: In function 'int main()':
a.cc:38:14: error: 'n' was not declared in this scope
   38 | 　while(cin>>n&&n!=0){
      |              ^
a.cc:38:1: error: '\U00003000while' was not declared in this scope
   38 | 　while(cin>>n&&n!=0){
      | ^~~~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<time.h>
using namespace std;
#define N 314159
int a[N],t[N];
int n;
long long ans=0;
void marge_count(int s,int g){
  if(s+1==g){
    if(a[s]>a[g]){
      swap(a[s],a[g]);ans++;
    }return;
  }
  int m= (s+g)/2;
  marge_count(s,m);
  marge_count(m,g);
  int p=s,q=m,r=s;
  while(p<m&&q<g){
    if(a[p]<a[q]){
      t[r++]=a[p++];
      ans+=q;
    }else{
      t[r++]=a[q++];
    }
  }
  if(p<m){
    while(p<m){
      t[r++]=a[p++];ans+=q;
    }
  }else{
    t[r++]=a[q++];
  }
  for(int i=s;i<g;i++){
    a[i]=t[i];
  }
}
int main(){
　while(cin>>n&&n!=0){
    ans=0;
    for(int i=0;i<n;i++)cin>>a[i];
    marge_count(0,n);
    cout<<(int)ans<<endl;
  }
  return 0;
}

Compiler output:
a.cc:39:1: error: extended character 　 is not valid in an identifier
   39 | 　while(cin>>n&&n!=0){
      | ^
a.cc: In function 'int main()':
a.cc:39:1: error: '\U00003000while' was not declared in this scope
   39 | 　while(cin>>n&&n!=0){
      | ^~~~~~~
Language: C++

<iostream>
using namespace std;

int main()
{
  int n;
  for(;cin>>n,n;)
    {
      int data[n];
      long long int step=0;
      for(int i=0;i<n;i++)
	cin>>data[i];
      
      for(int i=0;i<n;i++)
	for(int j=0;j<n-i-1;j++)
	  {
	    if(data[j]>data[j+1])
	      {
		swap(data[j],data[j+1]);
		step++;
	      }
	  }
      cout<<step<<endl;
    }
}

Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <iostream>
      | ^
a.cc: In function 'int main()':
a.cc:7:8: error: 'cin' was not declared in this scope
    7 |   for(;cin>>n,n;)
      |        ^~~
a.cc:19:17: error: 'swap' was not declared in this scope
   19 |                 swap(data[j],data[j+1]);
      |                 ^~~~
a.cc:23:7: error: 'cout' was not declared in this scope
   23 |       cout<<step<<endl;
      |       ^~~~
a.cc:23:19: error: 'endl' was not declared in this scope
   23 |       cout<<step<<endl;
      |                   ^~~~
Language: C++

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

const int N = 100;
int bit[N+10];

int sum(int i){
	int s = 0;
	while(i > 0){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(int i, int x){
	while(i <= N){
		bit[i] += x;
		i += i & -i;
	}
}

vector<int> compress(vector<int> v){
	map<int, int> mp;
	for(int i=0;i<v.size();i++)mp[i] = 0;

	int id = 1;
	for(map<int,int>::iterator it=mp.begin(); it != mp.end(); it++){
		it->second = id++;
	}

	for(int i=0;i<v.size();i++)v[i] = mp[v[i]];

	return v;
}


int main(){
	while(cin >> n && n){
		memset(bit, 0, sizeof(bit));

		vector<int> v(n);
		for(int i=0;i<n;i++)cin >> v[i];

		v = compress(v[i]);

		int ans = 0;
		for(int i=n-1;i>=0;i--){
			ans += sum(v[i] - 1);
			add(v[i], 1);
		}

		cout << ans << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:22: error: 'n' was not declared in this scope
   41 |         while(cin >> n && n){
      |                      ^
a.cc:42:17: error: 'memset' was not declared in this scope
   42 |                 memset(bit, 0, sizeof(bit));
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <map>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc:47:32: error: 'i' was not declared in this scope
   47 |                 v = compress(v[i]);
      |                                ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <cstring>
using namespace std;

const int N = 100;
int bit[N+10];

int sum(int i){
	int s = 0;
	while(i > 0){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(int i, int x){
	while(i <= N){
		bit[i] += x;
		i += i & -i;
	}
}

vector<int> compress(vector<int> v){
	map<int, int> mp;
	for(int i=0;i<v.size();i++)mp[i] = 0;

	int id = 1;
	for(map<int,int>::iterator it=mp.begin(); it != mp.end(); it++){
		it->second = id++;
	}

	for(int i=0;i<v.size();i++)v[i] = mp[v[i]];

	return v;
}


int main(){
        int n;
	while(cin >> n && n){
		memset(bit, 0, sizeof(bit));

		vector<int> v(n);
		for(int i=0;i<n;i++)cin >> v[i];

		v = compress(v[i]);

		int ans = 0;
		for(int i=n-1;i>=0;i--){
			ans += sum(v[i] - 1);
			add(v[i], 1);
		}

		cout << ans << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:32: error: 'i' was not declared in this scope
   49 |                 v = compress(v[i]);
      |                                ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include <cassert>

using namespace std;

int N, A[100];
int W[100];

int merge_and_count(int l,int r){
	if (l + 1 >= r)return 0;
	if (l + 2 == r){
		if (A[l] <= A[l + 1])return 0;
		swap(A[l], A[l + 1]);
		return 1;
	}
	int m = (l + r) / 2;
	int cl = merge_and_count(l, m);
	int cr = merge_and_count(m, r);
	int c = 0;
	int i = 1, j = m;
	int k = 1;
	while (i < m && j < r){
		if (A[i] <= A[j])W[k++] = A[i++];
		else{
			W[k++] = A[j++];
			c += floor(m-i)-1;
		}
	}
	while (i < m)W[k++] = A[i++];
	while (j < r)W[k++] = A[j++];
	assert(k == r);
	return cl + cr + c;
}

int main()
{
	cin >> N;
	for (int n = 0; n < N; n++){
		cin >> A[n];
	}
	cout << merge_and_count(0, N) << endl;
}

Compiler output:
a.cc: In function 'int merge_and_count(int, int)':
a.cc:28:30: error: 'floor' was not declared in this scope
   28 |                         c += floor(m-i)-1;
      |                              ^~~~~
Language: C

#include <stdio.h>
#include <string.h>
int main(void){
    int n;
    int temp[31];
    int i,j;
    while (scanf("%d", &n), n){
        memset(dp, 0, sizeof(dp));
        temp[1] = 1;
        temp[2] = 2;
        temp[3] = 4;
 
        for (i=4;i<=n;i++){
            for (j=1;j<=3;j++){
                temp[i]+=temp[i-j];
            }
        }
        if(temp[n]%3650==0){
            printf("%d\n", temp[n] / 3650);
        }
        else{
            printf("%d\n", (temp[n]/3650)+1);
        }
    }
 
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:16: error: 'dp' undeclared (first use in this function)
    8 |         memset(dp, 0, sizeof(dp));
      |                ^~
main.c:8:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <string.h>
int main(void)
{
    int n;
    int temp[31];
    int i,j;
    while (scanf("%d", &n), n){
        memset(dp, 0, sizeof(dp));
        temp[1] = 1;
        temp[2] = 2;
        temp[3] = 4;
 
        for (i=4;i<=n;i++){
            for (j=1;j<=3;j++){
                temp[i]+=temp[i-j];
            }
        }
        if(temp[n]%3650==0){
            printf("%d\n", temp[n] / 3650);
        }
        else{
            printf("%d\n", (temp[n]/3650)+1);
        }
    }
 
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:16: error: 'dp' undeclared (first use in this function)
    9 |         memset(dp, 0, sizeof(dp));
      |                ^~
main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <string.h>
int main(void)
{
    int n;
    int temp[31];
    int i,j;
    while (scanf("%d", &n), n){
        memset(dp, 0, sizeof(temp));
        temp[1] = 1;
        temp[2] = 2;
        temp[3] = 4;
 
        for (i=4;i<=n;i++){
            for (j=1;j<=3;j++){
                temp[i]+=temp[i-j];
            }
        }
        if(temp[n]%3650==0){
            printf("%d\n", temp[n] / 3650);
        }
        else{
            printf("%d\n", (temp[n]/3650)+1);
        }
    }
 
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:16: error: 'dp' undeclared (first use in this function)
    9 |         memset(dp, 0, sizeof(temp));
      |                ^~
main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <string.h>
int main()
{
    int n;
    int temp[31];
    int i,j;
    while (scanf("%d", &n), n){
        memset(dp, 0, sizeof(temp));
        temp[1] = 1;
        temp[2] = 2;
        temp[3] = 4;
 
        for (i=4;i<=n;i++){
            for (j=1;j<=3;j++){
                temp[i]+=temp[i-j];
            }
        }
        if(temp[n]%3650==0){
            printf("%d\n", temp[n] / 3650);
        }
        else{
            printf("%d\n", (temp[n]/3650)+1);
        }
    }
 
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:16: error: 'dp' undeclared (first use in this function)
    9 |         memset(dp, 0, sizeof(temp));
      |                ^~
main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <string.h>
int main()
{
    int n;
    int temp[31];
    int i,j;
    while (scanf("%d", &n), n){
        memset(dp, 0, sizeof(temp));
        temp[1] = 1;
        temp[2] = 2;
        temp[3] = 4;
 
        for (i=4;i<=n;i++){
            for (j=1;j<=3;j++){
                temp[i]+=temp[i-j];
            }
        }
        if(temp[n]%3650==0){
            printf("%d\n", temp[n] / 3650);
        }
        else{
            printf("%d\n", (temp[n]/3650)+1);
        }
    }
 
    return (0);
}

Compiler output:
main.c: In function 'main':
main.c:9:16: error: 'dp' undeclared (first use in this function)
    9 |         memset(dp, 0, sizeof(temp));
      |                ^~
main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int main(){
 long long dp[31]={0,1,2,4};
 int i,n;

 for(i=4;i<=30;i++){
  dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
 }

 while(scanf("%d",&n),n){
  printf("%d\n",

Compiler output:
main.c: In function 'main':
main.c:12:3: error: expected expression at end of input
   12 |   printf("%d\n",
      |   ^~~~~~
main.c:12:3: error: expected declaration or statement at end of input
main.c:12:3: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>
int main()
{
        int n;
        int a[31] = {1,1,2};
        for(int i=3 ; i <= 30 ; i++ ){
                a[i] = a[i-1] + a[i-2] + a[i-3];
        }
        scanf("%d",&n);
        printf("%d",a[n]/10/365+1);
}
~                                                                               
~    

Compiler output:
main.c:12:1: error: expected identifier or '(' before '~' token
   12 | ~
      | ^
Language: C

void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}

Compiler output:
main.c: In function 'main':
main.c:1:27: error: 'ans' undeclared (first use in this function)
    1 | void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}
      |                           ^~~
main.c:1:27: note: each undeclared identifier is reported only once for each function it appears in
main.c:1:103: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}
      |                                                                                                       ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}
main.c:1:103: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}
      |                                                                                                       ^~~~~
main.c:1:103: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:132: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}
      |                                                                                                                                    ^~~~~~
main.c:1:132: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:132: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:132: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);}

Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);}
      | ^~~~
main.c: In function 'main':
main.c:1:8: error: 'n' undeclared (first use in this function)
    1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);}
      |        ^
main.c:1:8: note: each undeclared identifier is reported only once for each function it appears in
main.c:1:10: error: 'a' undeclared (first use in this function)
    1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);}
      |          ^
main.c:1:16: error: expected expression before '{' token
    1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);}
      |                ^
main.c:1:71: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);}
      |                                                                       ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);}
main.c:1:71: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);}
      |                                                                       ^~~~~
main.c:1:71: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:89: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);}
      |                                                                                         ^~~~~~
main.c:1:89: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:89: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:89: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);}

Compiler output:
main.c: In function 'main':
main.c:1:48: error: lvalue required as increment operand
    1 | int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);}
      |                                                ^~
main.c:1:81: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);}
      |                                                                                 ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);}
main.c:1:81: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);}
      |                                                                                 ^~~~~
main.c:1:81: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:99: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);}
      |                                                                                                   ^~~~~~
main.c:1:99: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:99: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:99: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>

int main(void)
{
	__int64 ans[31];
	int a, i;
	
	ans[0] = ans[1] = 1;
	ans[2] = 2;
	for (i = 3; i < 31; i++){
		ans[i] = ans[i - 1] + ans[i - 2] + ans[i - 3];
	}
	
	while (1){
		scanf("%d", &a);
		
		if (!a){
			break;
		}
		
		printf("%d\n", ans[a] / 3650 + ((a % 3650 == 0) ? 0 : 1));
	}
	
	return (0);
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    5 |         __int64 ans[31];
      |         ^~~~~~~
      |         __int64_t
Language: C

#include <stdio.h>
#include <windows.h>

int memo[31];

int getways( int n );

int main( void )
{
	int n;
	int year;
	scanf("%d",&n);
	
	year = (getways(n)/10)/365+1;
	
	printf("%d\n",year);
	
	return 0;
}

int getways( int n )
{
	int ways;
	if( memo[n] != 0 )
	{
		return memo[n];
	}
	
	if( n <= 1 )
	{
		return 1;
	}
	if( n == 2 )
	{
		return 2;
	}
	
	return (memo[n] = getways(n-1) + getways(n-2) + getways(n-3) );
}

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

main(i,n[99]){for(n[1]=1,n[2]=2,n[3]=4,i=4;i-31;n[i]=n[i-1]+n[i-2]+n[i++-3]);for(;scanf("%d",&i)*i;printf("%d\n",n[i]/3650+(n[i]%3650?1:0)));}

Compiler output:
main.c:1:9: error: expected ')' before '[' token
    1 | main(i,n[99]){for(n[1]=1,n[2]=2,n[3]=4,i=4;i-31;n[i]=n[i-1]+n[i-2]+n[i++-3]);for(;scanf("%d",&i)*i;printf("%d\n",n[i]/3650+(n[i]%3650?1:0)));}
      |         ^
      |         )
Language: C++

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

#define int long long

int dp[50];
int n;

void init() {
  dp[1] = dp[2] = dp[3] = 1;
  for (int i = 1; i <= 30; i++) {
    dp[i+1] += dp[i];
    dp[i+2] += dp[i];
    dp[i+3] += dp[i];
  }
}

signed main() {
  init();
  while (1) {
    cin >> n;
    if (n == 0) break;
    int year = dp[n] / 3650;
    int day = (dp[n] + 3650 - 1) / 3650
    cout << max(1LL, year + (days >= 1)) << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: expected ',' or ';' before 'cout'
   25 |     cout << max(1LL, year + (days >= 1)) << endl;
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long INF=1LL << 60;



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<int> dan;
    vector<int> dp(35,0);
    int N;
    for(int i=0;i<35;i++){
        int tmp;
        cin>>tmp;
        if(tmp==0) break;
        dan.push_back(tmp);        
    }
    dp[0]=1;
    for(int i=1;i<31;i++){
        dp[i]+=dp[i-1];
        if(i>1)dp[i]+=dp[i-2];
        if(i>2)dp[i]+=dp[i-3];
    }
    for(int i:dan){
        int tmp=dp[i]/3650
        if(dp[i]%3650!=0) tmp++;
        cout << tmp <<endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: expected ',' or ';' before 'if'
   27 |         if(dp[i]%3650!=0) tmp++;
      |         ^~
Language: C++

a = [1, 1, 2]
for i in range(3, 31):
    a.append(sum(a[-3:]))

while True:
    n = int(input())
    if not n:
        break
    print(((a[n] + 9) / 10 + 364) / 365)

Compiler output:
a.cc:1:1: error: 'a' does not name a type
    1 | a = [1, 1, 2]
      | ^
Language: C++

#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	int dp[31][31];
	int n;
while(1){
	cin >> n;
        if(n==0)break;
	memset(dp, 0, sizeof(dp));
	dp[1][1] = 1;
	dp[1][2] = 1;
	dp[1][3] = 1;
	for (int i = 1; i <= 27; i++){
		for (int i2 = 1; i2 <= 27; i2++){
			dp[i + 1][i2 + 1] += dp[i][i2];
			dp[i + 1][i2 + 2] += dp[i][i2];
			dp[i + 1][i2 + 3] += dp[i][i2];
		}
	}
	int sum=0;

	for (int i = 0; i < 30; i++){
		sum += dp[i][n];
	}
	cout << sum / 10/365+1<<endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'memset' was not declared in this scope
   10 |         memset(dp, 0, sizeof(dp));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<stdio.h>
Language: C++

#include <iostream>
using namespace std;

int main()
{
  string s;
  cin >> s;
  cout << num(n) <<endl;
  return 0;
}

int num(int n){
  if(n<0)return 0;
  return num(n-1)+num(n-2)+num(n-3);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: 'n' was not declared in this scope
    8 |   cout << num(n) <<endl;
      |               ^
a.cc:8:11: error: 'num' was not declared in this scope; did you mean 'enum'?
    8 |   cout << num(n) <<endl;
      |           ^~~
      |           enum
Language: C++

#include <iostream>
using namespace std;

int main()
{
  string s;
  cin >> s;
  cout << num((int)s) <<endl;
  return 0;
}

int num(int n){
  if(n<0)return 0;
  return num(n-1)+num(n-2)+num(n-3);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: invalid cast from type 'std::string' {aka 'std::__cxx11::basic_string<char>'} to type 'int'
    8 |   cout << num((int)s) <<endl;
      |               ^~~~~~
a.cc:8:11: error: 'num' was not declared in this scope; did you mean 'enum'?
    8 |   cout << num((int)s) <<endl;
      |           ^~~
      |           enum
Language: C++

#include <iostream>
using namespace std;

int main()
{
  string s;
  cin >> s;
  cout << num(stoi(strPlus)) <<endl;
  return 0;
}

int num(int n){
  if(n<0)return 0;
  return num(n-1)+num(n-2)+num(n-3);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:20: error: 'strPlus' was not declared in this scope
    8 |   cout << num(stoi(strPlus)) <<endl;
      |                    ^~~~~~~
a.cc:8:11: error: 'num' was not declared in this scope; did you mean 'enum'?
    8 |   cout << num(stoi(strPlus)) <<endl;
      |           ^~~
      |           enum
Language: C++

#include <iostream>
using namespace std;

int main()
{
  string s;
  cin >> s;
  cout << num(stoi(s)) <<endl;
  return 0;
}

int num(int n){
  if(n<0)return 0;
  return num(n-1)+num(n-2)+num(n-3);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: 'num' was not declared in this scope; did you mean 'enum'?
    8 |   cout << num(stoi(s)) <<endl;
      |           ^~~
      |           enum
Language: C++

#include <iostream>
using namespace std;

int num(int n);

int main()
{
  string s;
  cin >> s;
  int n = stoi(s)
  cout << num(n) <<endl;
}

int num(int n){
  if(n<0)return 0;
  return num(n-1)+num(n-2)+num(n-3);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: expected ',' or ';' before 'cout'
   11 |   cout << num(n) <<endl;
      |   ^~~~
Language: C++

#include <iostream>
using namespace std;

int num(int n);

int main()
{
  string s;
  cin >> s;
  int n = std::stoi;
  cout << num(n) <<endl;
}

int num(int n){
  if(n<0)return 0;
  return num(n-1)+num(n-2)+num(n-3);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: cannot resolve overloaded function 'stoi' based on conversion to type 'int'
   10 |   int n = std::stoi;
      |                ^~~~
Language: C++

#include <iostream>
using namespace std;

int num(int n);

int main()
{
  int n;
  cout << num(cin>>n) <<endl;
}

int num(int n){
  if(n<0)return 0;
  return num(n-1)+num(n-2)+num(n-3);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:18: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
    9 |   cout << num(cin>>n) <<endl;
      |               ~~~^~~
      |                  |
      |                  std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:4:13: note:   initializing argument 1 of 'int num(int)'
    4 | int num(int n);
      |         ~~~~^
Language: C++

#include <iostream>
using namespace std;

int num(int n);

int main(){
  int n;
  cout << num(cin>>n) <<endl;
}

int num(int n){
  if(n<0)return 0;
  return num(n-1)+num(n-2)+num(n-3);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:18: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
    8 |   cout << num(cin>>n) <<endl;
      |               ~~~^~~
      |                  |
      |                  std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:4:13: note:   initializing argument 1 of 'int num(int)'
    4 | int num(int n);
      |         ~~~~^
Language: C++

#include <iostream>
using namespace std;

int num(int n);

int main(){
  int n;
  cin>>n;
  cout << num(n)//3650+1 <<endl;
}

int num(int n){
  if(n<1)return 0;
  return num(n-1)+num(n-2)+num(n-3);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: expected ';' before '}' token
    9 |   cout << num(n)//3650+1 <<endl;
      |                 ^
      |                 ;
   10 | }
      | ~
Language: C++

#include <iostream>
using namespace std;
int main(){
  int n;cin >> n;
  cout << num(num(n)/3650+1) <<endl;
}

int num(int n){
  if(n<0)return 0;
  if(n==0)return 1;
  return num(n-1)+num(n-2)+num(n-3);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:15: error: 'num' was not declared in this scope; did you mean 'enum'?
    5 |   cout << num(num(n)/3650+1) <<endl;
      |               ^~~
      |               enum
a.cc:5:11: error: 'num' was not declared in this scope; did you mean 'enum'?
    5 |   cout << num(num(n)/3650+1) <<endl;
      |           ^~~
      |           enum
Language: C++

#include <iostream>
using namespace std;
int f(int n){
    if(n<0)
        return 0;
    if(n==0)
        return 1;
    if ( memo[n]!= -1 )
        return memo[n];
    return f(n-1)+f(n-2)+f(n-3);
}
 
int main(){
    int n;
    memo.resize(31,-1);
    while(1){
        cin >> n;
        if(n==0)
            break;
        int num=f(n);
        cout <<num/10/365+1<< endl;
    }
    return 0;  
}  

Compiler output:
a.cc: In function 'int f(int)':
a.cc:8:10: error: 'memo' was not declared in this scope
    8 |     if ( memo[n]!= -1 )
      |          ^~~~
a.cc: In function 'int main()':
a.cc:15:5: error: 'memo' was not declared in this scope
   15 |     memo.resize(31,-1);
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;
VI memo;
int f(int n){
    if(n<0)
        return 0;
    if(n==0)
        return 1;
    if ( memo[n]!= -1 )
        return memo[n];
    return f(n-1)+f(n-2)+f(n-3);
}
 
int main(){
    int n;
    memo.resize(31,-1);
    while(1){
        cin >> n;
        if(n==0)
            break;
        int num=f(n);
        cout <<num/10/365+1<< endl;
    }
    return 0;  
}  

Compiler output:
a.cc:3:1: error: 'VI' does not name a type
    3 | VI memo;
      | ^~
a.cc: In function 'int f(int)':
a.cc:9:10: error: 'memo' was not declared in this scope
    9 |     if ( memo[n]!= -1 )
      |          ^~~~
a.cc: In function 'int main()':
a.cc:16:5: error: 'memo' was not declared in this scope
   16 |     memo.resize(31,-1);
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;
vector<int> memo;
int f(int n){
    if(n<0)
        return 0;
    if(n==0)
        return 1;
    if ( memo[n]!= -1 )
        return memo[n];
    return f(n-1)+f(n-2)+f(n-3);
}
 
int main(){
    int n;
    memo.resize(31,-1);
    while(1){
        cin >> n;
        if(n==0)
            break;
        int num=f(n);
        cout <<num/10/365+1<< endl;
    }
    return 0;  
}  

Compiler output:
a.cc:3:1: error: 'vector' does not name a type
    3 | vector<int> memo;
      | ^~~~~~
a.cc: In function 'int f(int)':
a.cc:9:10: error: 'memo' was not declared in this scope
    9 |     if ( memo[n]!= -1 )
      |          ^~~~
a.cc: In function 'int main()':
a.cc:16:5: error: 'memo' was not declared in this scope
   16 |     memo.resize(31,-1);
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
  
VI memo;
int f(int n){
    if(n<0)
        return 0;
    if(n==0)
        return 1;
    if ( memo[n]!= -1 )
        return memo[n];
    return f(n-1)+f(n-2)+f(n-3);
}
 
int main(){
    int n;
    memo.resize(31,-1);
    while(1){
        cin >> n;
        if(n==0)
            break;
        int num=f(n);
        cout <<num/10/365+1<< endl;
    }
    return 0;  
}  

Compiler output:
a.cc:6:9: error: 'vector' does not name a type
    6 | typedef vector<int> VI;
      |         ^~~~~~
a.cc:7:9: error: 'vector' does not name a type
    7 | typedef vector<VI > VVI;
      |         ^~~~~~
a.cc:8:9: error: 'vector' does not name a type
    8 | typedef vector<string> VS;
      |         ^~~~~~
a.cc:9:9: error: 'vector' does not name a type
    9 | typedef vector<LL> VLL;
      |         ^~~~~~
a.cc:18:1: error: 'VI' does not name a type
   18 | VI memo;
      | ^~
a.cc: In function 'int f(int)':
a.cc:24:10: error: 'memo' was not declared in this scope
   24 |     if ( memo[n]!= -1 )
      |          ^~~~
a.cc: In function 'int main()':
a.cc:31:5: error: 'memo' was not declared in this scope
   31 |     memo.resize(31,-1);
      |     ^~~~
Language: C++

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

int main()
{
	int p[31];
	p[0] = 1;
	p[1] = 1;
	p[2] = 2;
	for (int i = 3; i <= 30; ++i)
	{
		p[i] = p[i-1] + p[i-2] + p[i-3];
	}
	while(1){
		int y;
		cin >> n;
		if(n == 0){
			break;
		}
		y = p[n] / 10 / 365 + 1;
		
		cout << y << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:24: error: 'n' was not declared in this scope
   18 |                 cin >> n;
      |                        ^
Language: C++

#include <iostream>
using namespace std;

long long dp[31];
int main(){
	
	dp[0]=0;
	dp[1]=1;
	dp[2]=2;
    dp[3]=4;
int i=4;
	while(i<31){
		dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
        //cout << i << endl;
        i++;
	}
    for(;;){
	int n;
	cin >> n;
    if(n==0)return 0;
     if(dp[n]%3650==0)
	   cout << (dp[n]/3650);
     else
       cout << (dp[n]/3650)+1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^