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

int main(void)
{
  int n;
  scanf("%d", &n);
  int a[n-1],i;
  int sum[n] = {0};
  for(i = 0; i < n-1 ; i++)
  {
    scanf("%d", &a[i]);
    sum[a[i]-1] += 1;
  }
  for(i = 0; i < n ; i++)
    printf("%d\n", sum[i]);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |   scanf("%d", &n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(void)
main.c:4:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |   scanf("%d", &n);
      |   ^~~~~
main.c:4:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:6:16: error: variable-sized object may not be initialized except with an empty initializer
    6 |   int sum[n] = {0};
      |                ^
main.c:13:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   13 |     printf("%d\n", sum[i]);
      |     ^~~~~~
main.c:13:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:13:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:6:25: error: variable-sized object may not be initialized except with an empty initializer
    6 |   int a[n-1],i,sum[n] = {0};
      |                         ^
Language: C

#include<stdio.h>
int main()
{
  int n,i,a[200000]={0};
  scanf("%d",&n);
  for(i=2;i<=n;i++){
    scamf("%d",&a[i]);
    ++a[a[i]];
  }
  for(i=1;i<=n;i++)
    printf("%d\n",a[i]);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:5: error: implicit declaration of function 'scamf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    7 |     scamf("%d",&a[i]);
      |     ^~~~~
      |     scanf
Language: C

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


Compiler output:
main.c: In function 'main':
main.c:5:17: error: invalid initializer
    5 |   int c[200000]=0;
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
	int n;
	cin >> n;
	vector<int> ans(n);
	rep(i,n-1){
		int a;
		cin >> a;
		ans[a-1]++;
	}
	for(int x : ans){
		cout < x << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:26: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   17 |                 cout < x << endl;
      |                        ~~^~~~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define PI 3.14159265358979323846264338327950L
int main(){
    int n,i;
    scanf("%d",&n);
    int a[n],cnt[n]={0};
    rep(i,n){
        scanf("%d",&a[n]);
        cnt[a[n]]++;
    }
    for(i=1;i<n;i++){
        printf("%d",cnt[i]);
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:21: error: variable-sized object may not be initialized except with an empty initializer
    9 |     int a[n],cnt[n]={0};
      |                     ^
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
long long int mod = (long long int)1000000007;
using namespace std;

void solve()
{
    ll i,j,k,n;
    std::cout.precision(10);
    int yes=0;
  	cin>>n;
  freq[n+1]={0};
  n--;
  while(n--)
  {
    cin>>i;
    freq[i]++;
  }
  for(i=1;i<=n;i++)
    cout<<freq[i]<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    int i,j,k;
    int t;
    std::cout.precision(10);
    t=1;
    while(t--)
    {
        solve();
        cout<<"\n";
    }
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:13:3: error: 'freq' was not declared in this scope; did you mean 'free'?
   13 |   freq[n+1]={0};
      |   ^~~~
      |   free
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;
using M = map<int, int>

int main()
{
  int n;
  cin >> n;
  M mp;
  rep(i, n - 1){
    int x;
    cin >> x;
    mp[x]++;
  }
  rep(i, n){
    cout << mp[i + 1] << endl;
  }

  return 0;
}


Compiler output:
a.cc:7:11: error: two or more data types in declaration of 'type name'
    7 | using M = map<int, int>
      |           ^~~~~~~~~~~~~
Language: C++

N = gets.to_i
A = gets.split.map(&:to_i)
#buka_count = ['0']
buka_count = Array.new(N+1,0)

A.each { |buka|
  buka_count[buka] += 1
}
buka_count.drop(1).each { |buka,idx| p buka>0 ? buka : 0 }



Compiler output:
a.cc:3:2: error: invalid preprocessing directive #buka_count
    3 | #buka_count = ['0']
      |  ^~~~~~~~~~
a.cc:1:1: error: 'N' does not name a type
    1 | N = gets.to_i
      | ^
a.cc:9:1: error: 'buka_count' does not name a type
    9 | buka_count.drop(1).each { |buka,idx| p buka>0 ? buka : 0 }
      | ^~~~~~~~~~
Language: Java

import java.util.Map.Entry;
import java.util.*;
import java.math.*;
import org.w3c.dom.css.Counter;
  
public class main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        //モンスターの体力
        //int H = Integer.valueOf(s.next());
        //社員番号
        int N = Integer.valueOf(s.next());
        //部下持ち数
        int[] Ai = new int[N+1];
        Arrays.fill(Ai, 0);
		for(int i = 0; i < N-1; i++) {
            int hoge = Integer.valueOf(s.next());
			Ai[hoge] += 1;
        }
        for(int i = 1; i < Ai.length; i++) {
            System.out.println(Ai[i]);
        }
    }
}

Compiler output:
Main.java:6: error: class main is public, should be declared in a file named main.java
public class main{
       ^
1 error
Language: Java


import java.util.Map.Entry;
import java.util.*;
import java.math.*;
import org.w3c.dom.css.Counter;
  
public class main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        //モンスターの体力
        //int H = Integer.valueOf(s.next());
        //社員番号
        int N = Integer.valueOf(s.next());
        //部下持ち数
        int[] Ai = new int[N+1];
        Arrays.fill(Ai, 0);
		for(int i = 0; i < N-1; i++) {
            int hoge = Integer.valueOf(s.next());
			Ai[hoge] += 1;
        }
        for(int i = 1; i < Ai.length; i++) {
            System.out.println(Ai[i]);
        }
    }

Compiler output:
Main.java:24: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
using ll = long long;
using p = pair<int,int>
using Graph = vector<vector<int>>;

const double PI = acos(-1);

int main() {
	int N;
    cin >> N;
    int v[N] = {};
    int a;
    rep(i,N) {
    	cin >> a;
        v[a-1]++;
    }
    rep(i,N) {
    	cout << v[i] << "\n";
    }
    return 0;
}

Compiler output:
a.cc:5:24: error: expected ';' before 'using'
    5 | using p = pair<int,int>
      |                        ^
      |                        ;
    6 | using Graph = vector<vector<int>>;
      | ~~~~~
Language: C++

　#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) {       //階乗
    if (i == 0) return 1;
    return (factorial(i - 1)) * i;
}
 
int main() {
    int n;
    cin >> n;
    vector<int> a(n - 1);
    int ans[210000];
    rep(i, n - 1) {
        cin >> a[i];
        ans[a[i]]++;
    }
    rep1(i, n) cout << ans[i] << "/n";
}

Compiler output:
a.cc:1:1: error: extended character 　 is not valid in an identifier
    1 | 　#include <bits/stdc++.h>
      | ^
a.cc:1:3: error: stray '#' in program
    1 | 　#include <bits/stdc++.h>
      |   ^
a.cc:1:1: error: '\U00003000' does not name a type
    1 | 　#include <bits/stdc++.h>
      | ^~
a.cc: In function 'int main()':
a.cc:13:5: error: 'cin' was not declared in this scope
   13 |     cin >> n;
      |     ^~~
a.cc:14:5: error: 'vector' was not declared in this scope
   14 |     vector<int> a(n - 1);
      |     ^~~~~~
a.cc:14:12: error: expected primary-expression before 'int'
   14 |     vector<int> a(n - 1);
      |            ^~~
a.cc:17:16: error: 'a' was not declared in this scope
   17 |         cin >> a[i];
      |                ^
a.cc:20:16: error: 'cout' was not declared in this scope
   20 |     rep1(i, n) cout << ans[i] << "/n";
      |                ^~~~
Language: C++

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

int main() {
	int n; 
    cin>>n;
	vector<int> ans(n+1,0);
	for(int i=0; i<n-1; i++){
		int x; 
        cin>>x;
		++a[x];
	}
	for(int i=1; i<=n; ++i){
		cout<<ans[i]<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: 'a' was not declared in this scope
   11 |                 ++a[x];
      |                   ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n - 1);
  for (int i = 0; i < n - 1; i++) {
    cin >> a.at(i);
  }
  int kaunto = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == a.at(j)) {
        kaunto++
      }
      if (j = n - 1) {
        cout << kaunto << endl;
        kaunto = 0
          break;
      }
    }
  }
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: expected ';' before '}' token
   15 |         kaunto++
      |                 ^
      |                 ;
   16 |       }
      |       ~          
a.cc:19:19: error: expected ';' before 'break'
   19 |         kaunto = 0
      |                   ^
      |                   ;
   20 |           break;
      |           ~~~~~
Language: C++

#include<iostream>
using namespace std;
int c[200001];
int main(){
 
  int n,a;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a;
    c[a]++;
  }
  for(i=1;i<=n;i++){
    cout << c[a] << endl;
  }  
  return 0;

  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;i<n;i++){
      |       ^
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i=1;i<=n;i++){
      |       ^
Language: C++

#include<iostream>
using namespace std;
int main(){
 
  int n,a;
  int c[200001];
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a;
    c[a]++;
  }
  for(i=1;i<=n;i++){
    cout << c[a] << endl;
  }  
  return 0;

  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;i<n;i++){
      |       ^
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i=1;i<=n;i++){
      |       ^
Language: C

#include <bits/stdc++.h>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
int main(){
    int n ;
    cin >> n ;
    vector<int> vec (n);
    int t;
    rep(i, n-1){
        cin >> t ;
        vec[t - 1]++ ;
    }
    for(int k : vec){
        cout << k << endl;
    }
}


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

#include<stdio.h>
 
int main()
{
  int N;
  int i;
  int b;
  int a[200000] = {0};
 
  scanf("%d", &n);
  
  for(int i=0; i < n; i++){
    scanf("%d", &b);
    a[b] += 1;
  }
 
  for(i = 0; i < n; i++) {
    printf("%d", a[i]);
  }
 
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:10:16: error: 'n' undeclared (first use in this function)
   10 |   scanf("%d", &n);
      |                ^
main.c:10:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)

int main() {
    int N;
    int a;
    cin >> N;
    vector<int> A(N);
    rep(i, N-1) {
        cin >> a;
        A.push_back(a);
    }
    vector<int> ans(N);
    for(int ai: A) {
        ans[ai-1] += 1;
    }

    rep(i, ans.size()) {
        cout << ans[i] << endl;
    }
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: expected '}' at end of input
   23 |     return 0;
      |              ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: Java

import java.util.Scanner;
import java.util.ArrayList;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    ArrayList <Integer> li = new ArrayList <Integer>();
    ArrayList <Integer> lili = new ArrayList <Integer>();
    for(int i=0; i<number-1; i++){
      int a = sc.nextInt();
      li.add(a);
    }
    for(int i=0;i<number-1;i++){
      lili.add(0);
    }
    for(int i=0; i<number-1; i++){
      int a = li.get(i);
      lili.set(a-1,lili(a-1)+1);
    }
    for(int i=0; i<number-1; i++){
      System.out.println(lili.get(1))
    }
    System.out.println(0)
  }
}

Compiler output:
Main.java:21: error: ';' expected
      System.out.println(lili.get(1))
                                     ^
Main.java:23: error: ';' expected
    System.out.println(0)
                         ^
2 errors
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int) (n); i++)
#define ll long long
#define scout cout << fixed << setprecision(20)
ll INF = 9e17;
ll mod = 1e9 + 7;

int main() {
	int n,; cin >> n;
	vector<int> a(n);
	vector<int> ans(n);
	for(int i=2;i<=n;i++) cin >> a[i];
	for(int i=2;i<=n;i++) ans[a[i]] ++;
	for(int i=2;i<=n;i++) cout << ans[i];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: expected unqualified-id before ';' token
   11 |         int n,; cin >> n;
      |               ^
Language: C++

#include <stdio.h>

int main(void)
{
  long int n;
  int i;
  int a[100000];
  
  do {
    scanf("%ld",&n);
  } while(n<2 || n>200000);
  
  int sum[n];
  
  for(i=1; i<=n; i++){
    sum[i] = 0;
  
  for(i=2; i<=n; i++){
    do {
      scanf("%d ",&a[i]);
    } while(a[i]<1 || a[i]>=i);
      sum[a[i]]++;
  }
  for(i=1; i<=n; i++)
    printf("%d\n",sum[i]);
  
  return 0;
}

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

#include <stdio.h>

int main(void)
{
  long int n;
  int i;
  int a[100000];
  
  do {
    scanf("%ld",&n);
  } while(n<2 || n>200000);
  
  int sum[n];
  
  for(i=1; i<=n; i++){
    sum[i] = 0;
  
  for(i=2; i<=n; i++){
    do {
      scanf("%ld ",&a[i]);
    } while(a[i]<1 || a[i]>=i);
      sum[a[i]]++;
  }
  for(i=1; i<=n; i++)
    printf("%ld\n",sum[i]);
  
  return 0;
}

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

#include<stdio.h>

int main(void)
{
  int N,i,s;
  
  scanf("%d", &N);
  int a[N]={0};
  
  for(i=1;i<N;i++){
    scanf("%d", &s);
    a[s-1]++;
  }
  
  for(i=0;i<N;i++){
    printf("%d\n",a[i]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:12: error: variable-sized object may not be initialized except with an empty initializer
    8 |   int a[N]={0};
      |            ^
Language: C

#include<stdio.h>

int main(void)
{
  int N,i,j;
  
  scanf("%d", &N);
  int a[N]={0},b[N]={0};
  
  for(i=1;i<N;i++){
    scanf("%d", &a[i]);
    b[a[i]-1]++;
  }
  
  for(j=0;j<N;j++){
    printf("%d\n",b[j]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:12: error: variable-sized object may not be initialized except with an empty initializer
    8 |   int a[N]={0},b[N]={0};
      |            ^
main.c:8:21: error: variable-sized object may not be initialized except with an empty initializer
    8 |   int a[N]={0},b[N]={0};
      |                     ^
Language: C

#include<stdio.h>

int main(void)
{
  int N,i,j;
  
  scanf("%d", &N);
  int a[N]={0},b[N]={0};
  
  for(i=1;i<N;i++){
    scanf("%d", &a[i]);
    b[a[i]-1]++;
  }
  
  for(j=0;j<N;j++){​#include<stdio.h>

int main(void)
{
  int N,i,j;
  
  scanf("%d", &N);
  int a[N]={0},b[N]={0};
  
  for(i=1;i<N;i++){
    scanf("%d", &a[i]);
    b[a[i]-1]++;
  }
  
  for(j=0;j<N;j++){
    printf("%d\n",b[j]);
  }
  
  return 0;
  }
    printf("%d\n",b[j]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:12: error: variable-sized object may not be initialized except with an empty initializer
    8 |   int a[N]={0},b[N]={0};
      |            ^
main.c:8:21: error: variable-sized object may not be initialized except with an empty initializer
    8 |   int a[N]={0},b[N]={0};
      |                     ^
main.c:15:20: error: stray '#' in program
   15 |   for(j=0;j<N;j++){​#include<stdio.h>
      |                    ^
main.c:15:20: error: unknown type name '\U0000200b'
   15 |   for(j=0;j<N;j++){​#include<stdio.h>
      |                     
main.c:15:28: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   15 |   for(j=0;j<N;j++){​#include<stdio.h>
      |                            ^
Language: C

#include<stdio.h>
int main(void)
{
  int N,i;
  scanf("%d",&N);
  int A[N-1];
  int boss[N]={0};
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
    boss[A[i]-1]++;
  }
  for(i=0;i<N;i++)
    printf("%d\n",boss[i]);
}

Compiler output:
main.c: In function 'main':
main.c:7:15: error: variable-sized object may not be initialized except with an empty initializer
    7 |   int boss[N]={0};
      |               ^
Language: C

#include<stdio.h>

int main(void)
{
  int N,i,j;
  int c;
  
  scanf("%d", &N);
  int a[N]={0},b[N]={0};
  
  for(i=1;i<N;i++){
    scanf("%d", &a[i]);
    c=a[i]-1;
    b[c]++;
  }
  
  for(j=0;j<N;j++){
    printf("%d\n",b[j]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:12: error: variable-sized object may not be initialized except with an empty initializer
    9 |   int a[N]={0},b[N]={0};
      |            ^
main.c:9:21: error: variable-sized object may not be initialized except with an empty initializer
    9 |   int a[N]={0},b[N]={0};
      |                     ^
Language: C

#include<stdio.h>

int main(void)
{
  int N,i,j;
  int c;
  
  scanf("%d", &N);
  int a[N]={0},b[N]={0};
  
  for(i=1;i<N;i++){
    scanf("%d", &a[i]);
    c=a[i]-1;
    b[c]+=1;
  }
  
  for(j=0;j<N;j++){
    printf("%d\n",b[j]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:12: error: variable-sized object may not be initialized except with an empty initializer
    9 |   int a[N]={0},b[N]={0};
      |            ^
main.c:9:21: error: variable-sized object may not be initialized except with an empty initializer
    9 |   int a[N]={0},b[N]={0};
      |                     ^
Language: C

#include<stdio.h>

int main(void)
{
  int N,i,j;
  int c;
  
  scanf("%d", &N);
  int a[N]={0},b[N]={0};
  
  for(i=0;i<N;i++){
    scanf("%d", &a[N]);
    c=a[N]-1;
    b[c]+=1;
  }
  
  for(j=0;j<N;j++){
    printf("%d\n",b[N]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:12: error: variable-sized object may not be initialized except with an empty initializer
    9 |   int a[N]={0},b[N]={0};
      |            ^
main.c:9:21: error: variable-sized object may not be initialized except with an empty initializer
    9 |   int a[N]={0},b[N]={0};
      |                     ^
Language: C

#include<stdio.h>

int main(void)
{
  int N,i,j;
  int c;
  
  scanf("%d", &N);
  int a[N]=0,b[N]=0;
  
  for(i=0;i<N;i++){
    scanf("%d", &a[N]);
    c=a[N]-1;
    b[c]+=1;
  }
  
  for(j=0;j<N;j++){
    printf("%d\n",b[N]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:12: error: variable-sized object may not be initialized except with an empty initializer
    9 |   int a[N]=0,b[N]=0;
      |            ^
main.c:9:19: error: variable-sized object may not be initialized except with an empty initializer
    9 |   int a[N]=0,b[N]=0;
      |                   ^
Language: C

#include<stdio.h>

int main(void)
{
  int N,i,j;
  int c;
  
  scanf("%d", &N);
  int a[N],b[N]=0;
  
  for(i=0;i<N;i++){
    scanf("%d", &a[N]);
    c=a[N]-1;
    b[c]+=1;
  }
  
  for(j=0;j<N;j++){
    printf("%d\n",&b[N]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:17: error: variable-sized object may not be initialized except with an empty initializer
    9 |   int a[N],b[N]=0;
      |                 ^
Language: C

#include<stdio.h>

int main(void)
{
  int N,i,j;
  int c;
  
  scanf("%d", &N);
  int a[N],b[N]=0;
  
  for(i=0;i<N;i++){
    scanf("%d", &a[N]);
    c=a[N]-1;
    b[c]+=1;
  }
  
  for(j=0;j<N;j++){
    printf("%d\n",b[N]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:17: error: variable-sized object may not be initialized except with an empty initializer
    9 |   int a[N],b[N]=0;
      |                 ^
Language: C

#include<stdio.h>

int main(void)
{
  int N,i,j;
  
  scanf("%d", &N);
  int a[N]=0,b[N]=0;
  
  for(i=0;i<N;i++){
    scanf("%d", &a[N]);
    b[a[N]-1]+=1;
  }
  
  for(j=0;j<N;j++){
    printf("%d\n",&b[N]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:12: error: variable-sized object may not be initialized except with an empty initializer
    8 |   int a[N]=0,b[N]=0;
      |            ^
main.c:8:19: error: variable-sized object may not be initialized except with an empty initializer
    8 |   int a[N]=0,b[N]=0;
      |                   ^
Language: C++

#include <stdio.h>

int main(void)
{
  long n;
  int a[100000],sum[100000];
  
  do {
    scanf("%ld",&n);
  } while(n<2 || n>200000);
  
  for(i=2; i<=n; i++){
    do {
      scanf("%d ",&a[i]);
    } while(a[i]<1 || a[i]>=i);
      sum[a[i]]++;
  }
  for(i=1; i<=n; i++)
    printf("%d\n",sum[i]);
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i=2; i<=n; i++){
      |       ^
a.cc:18:7: error: 'i' was not declared in this scope
   18 |   for(i=1; i<=n; i++)
      |       ^
Language: C

#include<stdio.h>

int main(void)
{
  int N,i,j;
  
  scanf("%d", &N);
  int a[N],b[N]=0;
  
  for(i=0;i<N;i++){
    scanf("%d", &a[N]);
    b[a[N]-1]+=1;
  }
  
  for(j=0;j<N;j++){
    printf("%d\n",b[N]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:17: error: variable-sized object may not be initialized except with an empty initializer
    8 |   int a[N],b[N]=0;
      |                 ^
Language: C++

#include <stdio.h>

int main(void)
{
  long n;
  int a[100000],sum[100000];
  
  do {
    scanf("%d",&n);
  } while(n<2 || n>200000);
  
  for(i=2; i<=n; i++){
    do {
      scanf("%d ",&a[i]);
    } while(a[i]<1 || a[i]>=i);
      sum[a[i]]++;
  }
  for(i=1; i<=n; i++)
    printf("%d\n",sum[i]);
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i=2; i<=n; i++){
      |       ^
a.cc:18:7: error: 'i' was not declared in this scope
   18 |   for(i=1; i<=n; i++)
      |       ^
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:6:12: error: variable-sized object may not be initialized except with an empty initializer
    6 |   int a[n]={0},b[n]={0},i;
      |            ^
main.c:6:21: error: variable-sized object may not be initialized except with an empty initializer
    6 |   int a[n]={0},b[n]={0},i;
      |                     ^
Language: C

#include <stdio.h>
 
int main(){
int n,i;
scanf("%d",&n);
int a[n],b[n] = {0};
for(i=0;i<n;i++){
scanf("%d",&a[i]);
b[a[i]]++;
}
for(i=0;i<n;i++){
printf("%d\n",b[i]);
}
return 0;
}    

Compiler output:
main.c: In function 'main':
main.c:6:17: error: variable-sized object may not be initialized except with an empty initializer
    6 | int a[n],b[n] = {0};
      |                 ^
Language: C

#include <stdio.h>
 
typedef struct boss{
  int boss;
  int sub;
};
int main(void){
  
  int n, i;
  boss member[200000] = {0};
  
  scanf("%d", &n);
  
  for(i = 1; i < n; i++){
    scanf("%d", &member[i].boss);
    member[member[i].boss].sub++;
  }
  
  for(i = 0; i < n; i++){
    printf("%d\n",member[i].sub); 
  }
  
  return 0;
 
}

Compiler output:
main.c:6:1: warning: useless storage class specifier in empty declaration
    6 | };
      | ^
main.c: In function 'main':
main.c:10:3: error: unknown type name 'boss'; use 'struct' keyword to refer to the type
   10 |   boss member[200000] = {0};
      |   ^~~~
      |   struct 
main.c:15:27: error: request for member 'boss' in something not a structure or union
   15 |     scanf("%d", &member[i].boss);
      |                           ^
main.c:16:21: error: request for member 'boss' in something not a structure or union
   16 |     member[member[i].boss].sub++;
      |                     ^
main.c:20:28: error: request for member 'sub' in something not a structure or union
   20 |     printf("%d\n",member[i].sub);
      |                            ^
Language: C

#include <stdio.h>

typedef struct boss{
  int boss;
  int sub;

}
int main(void){
  
  int n, i;
  boss member[200000] = {0};
  
  scanf("%d", &n);
  
  for(i = 1; i < n; i++){
    scanf("%d", &member[i].boss);
    member[member[i].boss].sub++;
  }
  
  for(i = 0; i < n; i++){
    printf("%d\n",member[i].sub); 
  }
  
  return 0;

}

Compiler output:
main.c:8:1: error: expected ';', identifier or '(' before 'int'
    8 | int main(void){
      | ^~~
main.c: In function 'main':
main.c:11:3: error: unknown type name 'boss'; use 'struct' keyword to refer to the type
   11 |   boss member[200000] = {0};
      |   ^~~~
      |   struct 
main.c:16:27: error: request for member 'boss' in something not a structure or union
   16 |     scanf("%d", &member[i].boss);
      |                           ^
main.c:17:21: error: request for member 'boss' in something not a structure or union
   17 |     member[member[i].boss].sub++;
      |                     ^
main.c:21:28: error: request for member 'sub' in something not a structure or union
   21 |     printf("%d\n",member[i].sub);
      |                            ^
Language: C

#include<stdio.h>
 
int main(void){
  int N,b,i;
  int a[200005] = {0};
  
  scanf("%d",&N);
  for(i=2;i<=N;i++){
    scanf("%d",&b);
    a[b]++;
  }
 for(i=1;i<=N;i++){
 printf("%d\n",a[d]);
 }
 return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:18: error: 'd' undeclared (first use in this function)
   13 |  printf("%d\n",a[d]);
      |                  ^
main.c:13:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int i;
  long n;
  cin>>n;
  int sum[n];
  int a[n-1];
  for(i=0;i<n;i++){
    sum[i]=0;
  }
  for(i=1;i<n;i++){
    cin>>a[i];
    sum[a[i]-1]++;
  }
  for(i=0;i<n;i++){
    cout<<sum[i];
  }


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

#include <stdio.h>
int main(void){
 
  int n,i;
  int a[100000];
  int b[100000];
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  	b[i]=0;
  }
  
  i=0;
  
  for(l=1;l<n;l++)
  	for(;i<n;i++)
    	if(a[i]=l)
          b[l]++;
  
  for(i=1;i<n;i++)
    printf("%d\n",b[i]);
    
    
  
  
 
}

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

#include <stdio.h>
int main(void){

  int n,i;
  int a[100000];
  int b[100000];
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  	b[i]=0
  }
  
  i=0;
  
  for(l=1;l<n;l++)
  	for(;i<n;i++)
    	if(a[i]=l)
          b[l]++;
  
  for(i=1;i<n;i++)
    printf("%d\n",b[i]);
    
    
  
  

}

Compiler output:
main.c: In function 'main':
main.c:12:15: error: expected ';' before '}' token
   12 |         b[i]=0
      |               ^
      |               ;
   13 |   }
      |   ~            
main.c:17:7: error: 'l' undeclared (first use in this function)
   17 |   for(l=1;l<n;l++)
      |       ^
main.c:17:7: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.Scanner;
import java.util.ArrayList;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    ArrayList <Integer> li = new ArrayList <Integer>();
    ArrayList <Integer> lili = new ArrayList <Integer>();
    for(int i=0; i<number-1; i++){
      int a = sc.nextInt();
      li.add(a);
    }
    for(int i=0;i<number-1;i++){
      lili.add(0);
    }
    for(int i=0; i<number-1; i++){
      a = li.get(i);
      lili.set(a-1,lili.get(a)+1);
    }
    for(int i=0;i<number-1;i++){
      System.out.println(lili.get(i));
    }
    System.out.println(0);
  }
}


Compiler output:
Main.java:17: error: cannot find symbol
      a = li.get(i);
      ^
  symbol:   variable a
  location: class Main
Main.java:18: error: cannot find symbol
      lili.set(a-1,lili.get(a)+1);
               ^
  symbol:   variable a
  location: class Main
Main.java:18: error: cannot find symbol
      lili.set(a-1,lili.get(a)+1);
                            ^
  symbol:   variable a
  location: class Main
3 errors
Language: Java

import java.util.Scanner;
import java.util.ArrayList;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    ArrayList <Integer> li = new ArrayList <Integer>();
    ArrayList <Integer> lili = new ArrayList <Integer>();
    for(int i=0; i<number-1; i++){
      int a = sc.nextInt();
      li.add(a);
    }
    for(int i=0;i<number-1;i++){
      lili.add(0);
    }
    for(int i=0; i<number-1; i++){
      a = li.get(i)
      lili.set(a-1,lili.get(a)+1);
    }
    for(int i=0;i<number-1;i++){
      System.out.println(lili.get(i));
    }
    System.out.println(0);
  }
}


Compiler output:
Main.java:17: error: ';' expected
      a = li.get(i)
                   ^
1 error
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0;i<a.size();i++){
    if()
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: expected primary-expression before ')' token
   13 |     if()
      |        ^
a.cc:14:3: error: expected primary-expression before '}' token
   14 |   }
      |   ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main() {
	int N;
	cin >> N;
	
	vector<int> A;
	A.push_back(0);
	for (int i = 1; i < N; i++) {
		int a;
		cin >> a;
		A.push_back(a);
	}

	for (int i = 0; i < N; i++) {
		int c = count(A.begin(), A.end(), i + 1);
		cout << c << endl;
	}

}




Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: 'count' was not declared in this scope
   19 |                 int c = count(A.begin(), A.end(), i + 1);
      |                         ^~~~~
Language: C++

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

long long int n,i,x,a[200010]

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n;
	for (i=1;i<n+1;i++) a[i]=0;
	for (i=1;i<n;i++) cin>>x,a[x]++;
	for (i=1;i<n+1;i++) cout<<a[i]<<"\n";
}


Compiler output:
a.cc:6:1: error: expected initializer before 'signed'
    6 | signed main()
      | ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int main()
{
  int N;
  cin >> N;
  
  vi sub(N+1);
  for(int i = 0; i < N; ++i)
  {
    int x;
    cin >> x;
    ++sub[x];
  }
  for(int i = 1; i <= N; ++i)
  {
    cout << sub[i] << endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'vi' was not declared in this scope
    9 |   vi sub(N+1);
      |   ^~
a.cc:14:7: error: 'sub' was not declared in this scope
   14 |     ++sub[x];
      |       ^~~
a.cc:18:13: error: 'sub' was not declared in this scope
   18 |     cout << sub[i] << endl;
      |             ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i <(n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> boss_num(n-1);
  vector<int> buka_num(n+1); //初期化

  rep(i, n-1) cin >> boss_num.at(i);
  rep(i,n-1){
    buka_num.at(boss_num.at(i))++;
  }

 for (int i = 1; i < n + 1 ; ++i){
   cout << buka_num.at(i) << endl;
 }
  //TLE
  // rep(i, n){
  //   cout << count(all(boss_num), i+1) << endl;
  // }

}

Compiler output:
a.cc:9:3: error: expected initializer before 'ios'
    9 |   ios::sync_with_stdio(false);
      |   ^~~
a.cc:10:3: error: 'cin' does not name a type
   10 |   cin.tie(nullptr);
      |   ^~~
a.cc:12:3: error: 'cin' does not name a type
   12 |   cin >> n;
      |   ^~~
a.cc:2:18: error: expected unqualified-id before 'for'
    2 | #define rep(i,n) for (int i = 0; i <(n); ++i)
      |                  ^~~
a.cc:16:3: note: in expansion of macro 'rep'
   16 |   rep(i, n-1) cin >> boss_num.at(i);
      |   ^~~
a.cc:16:7: error: 'i' does not name a type
   16 |   rep(i, n-1) cin >> boss_num.at(i);
      |       ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i = 0; i <(n); ++i)
      |                                  ^
a.cc:2:42: error: expected unqualified-id before '++' token
    2 | #define rep(i,n) for (int i = 0; i <(n); ++i)
      |                                          ^~
a.cc:16:3: note: in expansion of macro 'rep'
   16 |   rep(i, n-1) cin >> boss_num.at(i);
      |   ^~~
a.cc:2:18: error: expected unqualified-id before 'for'
    2 | #define rep(i,n) for (int i = 0; i <(n); ++i)
      |                  ^~~
a.cc:17:3: note: in expansion of macro 'rep'
   17 |   rep(i,n-1){
      |   ^~~
a.cc:17:7: error: 'i' does not name a type
   17 |   rep(i,n-1){
      |       ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i = 0; i <(n); ++i)
      |                                  ^
a.cc:2:42: error: expected unqualified-id before '++' token
    2 | #define rep(i,n) for (int i = 0; i <(n); ++i)
      |                                          ^~
a.cc:17:3: note: in expansion of macro 'rep'
   17 |   rep(i,n-1){
      |   ^~~
a.cc:21:2: error: expected unqualified-id before 'for'
   21 |  for (int i = 1; i < n + 1 ; ++i){
      |  ^~~
a.cc:21:18: error: 'i' does not name a type
   21 |  for (int i = 1; i < n + 1 ; ++i){
      |                  ^
a.cc:21:30: error: expected unqualified-id before '++' token
   21 |  for (int i = 1; i < n + 1 ; ++i){
      |                              ^~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

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

int main(){
  int n;
  cin>>n;
  vector<int>a(n-1);
  for(int i=0;i>n-1;i++){
    int a;
    cin>>a;
    a[i]++;
  }
  for(int i=0;i>n-1;i++){
    cout<<a[i]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:6: error: invalid types 'int[int]' for array subscript
   11 |     a[i]++;
      |      ^
Language: C++

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

int main(){
  int n;
  cin>>n;
  vector<int>a(n-1);
  for(int i=0;i>n-1;i++){
    int a;
    cin>>a;
    a[i]++;
  }
  for(int i=0;i>n-1;i++){
    cout<<a[i]<<endl;
  }
}

Compiler output:
a.cc:1:9: fatal error: bits/stdc++h: No such file or directory
    1 | #include<bits/stdc++h>
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int num[200005];
int main() {
    // freopen("boss.in", "r", stdin);
    // freopen("boss.out", "w", stdout);
    int n;
    cin >> n;
    for (int i = 2; i <= n; i++) {
        int x;
        cin >> x;
        num[x]++;
    }
    for (int i = 1; i <= n; i++) {
        cout << num[x] << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:21: error: 'x' was not declared in this scope
   16 |         cout << num[x] << endl;
      |                     ^
Language: C++

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

int main(){
int N;
cin >> N;
vector<int> A(N);
vector<int> B(N);
A.at(0)=0;
for(int i=1;i<N;i++){
  cin >> A.at(i);
}
for(int i=1;i<N;i++){
  B.at(A.at(i)-1)++;
}
for(int i=0;i<N;i++){
  cout << B.at(i) <<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;
typedef pair<int, int> P;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  int cnt[N+1];
  FOR(i,0,N-1) {
    int a;
    cin >> a;
    cnt[a]++;
  }
  FOR(i,1,N+1) {
    cout << a[i] << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: 'a' was not declared in this scope
   20 |     cout << a[i] << endl;
      |             ^
Language: Java


import java.util.*;

public class Main2 {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer N = Integer.parseInt(scanner.next());
        Map<Integer, Integer> map = new HashMap<Integer, Integer>();

        for (int i = 0; i < N-1; i++) {
            Integer A = Integer.parseInt(scanner.next()) -1;
            Integer count = map.get(A);
            map.put(A, (count == null) ? 1 : count + 1);
        }

        Integer[] total = new Integer[N];
        Arrays.fill(total, 0);

        for (Integer nKey: map.keySet()) {
            total[nKey] = map.get(nKey);
        }

        for (int i = 0; i < N; i++) System.out.println(total[i]);
    }
}


Compiler output:
Main.java:4: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
Language: C

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

int n;
vector<int> a;
vector<int> b;

int main(){

  cin >> n;
  a = vector<int>(n-1);
  b = vector<int>(n,0);
  rep(i,n-1) cin >> a[i];

  rep(i,n-1){
    b[a[i]-1]++;
  }

  rep(i,n){
    cout << b[i];
    if(i != n-1) cout << " ";
  }
  cout << endl;

  return 0;
}


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

#include <bits/stdc++.h>
#include <vector>
#include <stack>

using namespace std;

int a[200010];
int ans[200010];

int main(){

  long int n,x;
  cin>>n;

   for(int i=2;i<=n;i++) cin>>a[i];

   for(int 2;i<=n;i++) ans[a[i]]++;

   for(int i=1;i<=n;i++)
   cout<<ans[i]<<endl;

 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: expected unqualified-id before numeric constant
   17 |    for(int 2;i<=n;i++) ans[a[i]]++;
      |            ^
a.cc:17:11: error: expected ';' before numeric constant
   17 |    for(int 2;i<=n;i++) ans[a[i]]++;
      |           ^~
      |           ;
a.cc:17:14: error: 'i' was not declared in this scope
   17 |    for(int 2;i<=n;i++) ans[a[i]]++;
      |              ^
a.cc:17:18: error: expected ')' before ';' token
   17 |    for(int 2;i<=n;i++) ans[a[i]]++;
      |       ~          ^
      |                  )
a.cc:17:19: error: 'i' was not declared in this scope
   17 |    for(int 2;i<=n;i++) ans[a[i]]++;
      |                   ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<int> s(n, 0);
  for (int i = 1;i < n;i++) {
    int a;
    cin >> a;
    s[a - 1] += 1;
  }
  for (int x : s) {
    cout << x << endl;
}

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

#include <iostream>
using namespace std;

int main(){
  int a;
  cin>>a;
  int s,result[a];
  data[0]=0;
  for(int i=0;i<a;i++){
    result[i]=0;
  }
  for(int i=1;i<a;i++){
    cin>>s;
    result[s]+=1;
  }
  for(int i=1;i<a;i++){
    cout<<result[s]<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
    8 |   data[0]=0;
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = Long Long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> ans(n);

  for (int i = 0; i < n-1; i++) {
    int a;
    cin >> a;
    ans[a-1]++;
  };
  for (int x : ans) {
    cout << x << endl;
  }
  return 0;
};

Compiler output:
a.cc:3:12: error: 'Long' does not name a type; did you mean 'long'?
    3 | using ll = Long Long;
      |            ^~~~
      |            long
Language: C

#include <stdio.h>
#include <ctype.h>
#include <string.h>


int main() {
	int N;
	scanf_s("%d", &N);
	int a[200010] = { 0 };
	int b[200010] = { 0 };
	int i;
	int j;
	for (i = 2; i < N + 1; i++) {
		scanf_s("%d", &a[i]);
		j = 1;
		for (j; j < i; j++) {
			if (j == a[i]) {
				b[j] = b[j] + 1;
			}
		}
	}
	for (i = 1; i < N + 1; i++) {
		printf("%d\n", b[i]);

	}
	return 0;
}



Compiler output:
main.c: In function 'main':
main.c:8:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    8 |         scanf_s("%d", &N);
      |         ^~~~~~~
      |         scanf
Language: C

#include<iostream>
#include<string>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
    int n;
    cin >> n;
    map<int,int>s;
    rep(i,n-1){
        int shainnum;
        cin >> shainnum;
        s[shainnum] +=1;
    }
    for(int i=1;i<n+1;i++){
        cout << s[i] << " ";
    }
    return 0;
}

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

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

int main(){
  int N;
  int count = 0;
  cin >> N;
  
  vector<int> sub(N-1);
  vector<int> out(N);
  //vector<vector<int>> path(M, vector<int>(2));
  
  for(int i=0; i<N; i++){
    while(i < N-1) cin >> sub.at(i);
    out.at(i) = 0;
  }
  
  for(int i=1; i<N-1; i++){
    out.at(sub.at(i-1)-1)++;
    if(sub.at(i) == sub.at(i-1)){
      out.at(sub.at(i-1)-1)++;
    }
    if(i = N-2)
      out.at(sub.at(i))++;
  }
    
  for(i=0; i<N; i++)
    cout << out.at(i) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:7: error: 'i' was not declared in this scope
   27 |   for(i=0; i<N; i++)
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define SORT(obj) sort(obj.begin(),obj.end())
#define pb(obj) push_back(obj)
#define REP(i,N) for(int i=0;i<N;i++)
typedef long long ll;
ll const MOD=1e9+7;
using ll = long long;

int main(){
  ll n;
  cin>>n;
  vector<int> data(n-1,0);
  REP(i,n-1){
    int a;
    cin>>a;
    data[a-1]++;
  }
  REP(i,n-1){
    cout<<data.(i)<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:16: error: expected unqualified-id before '(' token
   21 |     cout<<data.(i)<<endl;
      |                ^
Language: C++

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

typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
  
ll N;
VL A;
VL ans;

int main(){ 
    cin>>N;
    A = VL A(N,0);
    ans = VL ans(N,0);
    rep(i,0,N-1){
        cin>>A[i];
        ans[A[i]-1]++;
    }
    rep(i,0,N){
        cout<<ans[i];
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: expected primary-expression before 'A'
   21 |     A = VL A(N,0);
      |            ^
a.cc:22:14: error: expected primary-expression before 'ans'
   22 |     ans = VL ans(N,0);
      |              ^~~
Language: C++

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

int main() {
  long long N,X,Y,Z,A,B,C,ans,a,b;
  cin >>N;
  int x[N+1];
  for(int i=0;i<N+1;i++){
    x[i]=0;
  }
  for(int i=1;i<N;i++){
    cin>>A;
    x[A]++;
  }
  for(int i=1;i<N+1;i++){
  cout<<z[i]<<endl;
  }
}


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

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> (n+1,0);
  for(int i=0;i<n-1;i++)
  {
    int x;
    cin>>x;
    v[x]++;
  }
  for(int i=1;i<=n;i++)
    cout<<v[i]<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'v' was not declared in this scope
   12 |     v[x]++;
      |     ^
a.cc:15:11: error: 'v' was not declared in this scope
   15 |     cout<<v[i]<<endl;
      |           ^
Language: C++

#include <iostream>
#include <map>

int main(){
  std::in >> N;
  int n[N];
  int emps[N];

  for(int i=0; i<N; i++){
    n[emps[i]]++;
  }

  for(int i=0; i++){
    std::cout << n[i] << std::endl;
  }


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:8: error: 'in' is not a member of 'std'; did you mean 'min'?
    5 |   std::in >> N;
      |        ^~
      |        min
a.cc:5:14: error: 'N' was not declared in this scope
    5 |   std::in >> N;
      |              ^
a.cc:10:5: error: 'n' was not declared in this scope
   10 |     n[emps[i]]++;
      |     ^
a.cc:10:7: error: 'emps' was not declared in this scope
   10 |     n[emps[i]]++;
      |       ^~~~
a.cc:13:19: error: expected ';' before ')' token
   13 |   for(int i=0; i++){
      |                   ^
      |                   ;
a.cc:14:18: error: 'n' was not declared in this scope
   14 |     std::cout << n[i] << std::endl;
      |                  ^
Language: C++


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int n){
    if(n==1||n==1){
        return false;
    }
    for(int i=2;i<n;++i){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
int fact(int n){
    int ans = 1;
    for(int i = 1; i<= n; ++i){
        ans *= i;
    }
    return ans;
}


int main()
{
    int a[200010];
    int ans[200010];
    int main(){
    int n;
    scanf("%d",&n);
    for(int i=2;i<=n;i++)scanf("%d",&a[i]);
    for(int i=2;i<=n;i++)ans[a[i]]++;
    for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   29 |     int main(){
      |             ^~
a.cc:29:13: note: remove parentheses to default-initialize a variable
   29 |     int main(){
      |             ^~
      |             --
a.cc:29:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:29:15: error: a function-definition is not allowed here before '{' token
   29 |     int main(){
      |               ^
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:26:1: note: to match this '{'
   26 | {
      | ^