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

#include <iostream>
#include <vector>
#include <utility>

int main() {
	
	int N;
	std::cin >> N;

	std::vector<int> D;
	std::vector<int> distance;
	
	int maxD = 0;

	for (int i = 0; i < N; i++) {
		int d;
		std::cin >> d;
		D[i] = d;
		distance[d]++;
		if (d > maxD) 
			maxD = d;
	}

	if (D[0] != 0)
		std::cout << 0 << std::endl; 

	if (distance[0] != 1)
		std::cout << 0 << std::endl;

	if (distance[1] == D.length-1) 
		std::cout << 1 << std::endl;

	long long ans = 0;
	bool flag = false;

	for (int i = 2; i <= maxD; i++) {

		if (flag && distance[i] == 0) {
			std::cout << 0 << std::endl;
		}

		if (distance[i] != 0) {
			if (distance[i] == 1) {
				ans *= distance[i-1];
			} else {
				if (i == 2) {
					ans = distance[1];
				}
				ans = (long)Math.pow(ans, distance[i]);
			}
		} else {
			flag = true;
		}				
	}
	ans %= 998244353
	for (int i = 0; i < Tmax; i++) {
		std::cout << ans << std::endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:30: error: 'class std::vector<int>' has no member named 'length'
   30 |         if (distance[1] == D.length-1)
      |                              ^~~~~~
a.cc:49:45: error: 'Math' was not declared in this scope
   49 |                                 ans = (long)Math.pow(ans, distance[i]);
      |                                             ^~~~
a.cc:55:25: error: expected ';' before 'for'
   55 |         ans %= 998244353
      |                         ^
      |                         ;
   56 |         for (int i = 0; i < Tmax; i++) {
      |         ~~~              
a.cc:56:25: error: 'i' was not declared in this scope
   56 |         for (int i = 0; i < Tmax; i++) {
      |                         ^
a.cc:56:29: error: 'Tmax' was not declared in this scope
   56 |         for (int i = 0; i < Tmax; i++) {
      |                             ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>

int a(void);
int b(void);
int main(void) {
	b();
	return 0;
}

int a(void) {
	int N;
	std::cin >> N;
	if (N % 2 == 0) {
		std::cout << static_cast<int>((N / 2) - 1);
	}
	else {
		std::cout << static_cast<int> (((N - 1) / 2));
	}
	return 0;
}

int b(void) {
	int N;
	std::vector<int> D;
	std::cin >> N;
	int temp;
	for (int i = 0; i < N; i++) {
		std::cin >> temp;
		D.push_back(temp);
	}
	std::sort(D.begin(), D.end());
	__int64 result, count, prev_count;
	result = 1;
	int temp_val = 0;
	int i = 0;
	int n = 0;
	while (temp_val <= D.back()) {
		count = 0;
		for (int j = n; D[j] == temp_val; j++) {
			count++;
			if (j == N-1) break;
		}
		if (count == 0) {
			std::cout << 0;
			return 0;
		} else {
			if (temp_val == 0) {
				result = 1;
			}
			else {
				for (int i = 0; i < count; i++) {
					
					result *= prev_count;
					
					result = result % 998244353;
				}
				
			}
		}
		prev_count = count;
		n += count;
		temp_val++;
	}
	result = result % 998244353;
	std::cout << result;
	return 0;
	
}


Compiler output:
a.cc: In function 'int b()':
a.cc:36:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   36 |         __int64 result, count, prev_count;
      |         ^~~~~~~
      |         __int64_t
a.cc:37:9: error: 'result' was not declared in this scope
   37 |         result = 1;
      |         ^~~~~~
a.cc:42:17: error: 'count' was not declared in this scope; did you mean 'std::count'?
   42 |                 count = 0;
      |                 ^~~~~
      |                 std::count
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:4:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
a.cc:57:51: error: 'prev_count' was not declared in this scope
   57 |                                         result *= prev_count;
      |                                                   ^~~~~~~~~~
a.cc:64:17: error: 'prev_count' was not declared in this scope
   64 |                 prev_count = count;
      |                 ^~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>

int a(void);
int b(void);
int main(void) {
	b();
	return 0;
}

int a(void) {
	int N;
	std::cin >> N;
	if (N % 2 == 0) {
		std::cout << static_cast<int>((N / 2) - 1);
	}
	else {
		std::cout << static_cast<int> (((N - 1) / 2));
	}
	return 0;
}

int b(void) {
	int N;
	std::vector<int> D;
	std::cin >> N;
	int temp;
	for (int i = 0; i < N; i++) {
		std::cin >> temp;
		D.push_back(temp);
	}
	std::sort(D.begin(), D.end());
	__int64 result, count, prev_count;
	result = 1;
	int temp_val = 0;
	int i = 0;
	int n = 0;
	while (temp_val <= D.back()) {
		count = 0;
		for (int j = n; D[j] == temp_val; j++) {
			count++;
			if (j == N-1) break;
		}
		if (count == 0) {
			std::cout << 0;
			return 0;
		} else {
			if (temp_val == 0) {
				result = 1;
			}
			else {
				for (int i = 0; i < count; i++) {
					
					result *= prev_count;
					
					result = result % 998244353;
				}
				
			}
		}
		prev_count = count;
		n += count;
		temp_val++;
	}
	result = result % 998244353;
	std::cout << result;
	return 0;
	
}

int c(void) {

}

Compiler output:
a.cc: In function 'int b()':
a.cc:36:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   36 |         __int64 result, count, prev_count;
      |         ^~~~~~~
      |         __int64_t
a.cc:37:9: error: 'result' was not declared in this scope
   37 |         result = 1;
      |         ^~~~~~
a.cc:42:17: error: 'count' was not declared in this scope; did you mean 'std::count'?
   42 |                 count = 0;
      |                 ^~~~~
      |                 std::count
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:4:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
a.cc:57:51: error: 'prev_count' was not declared in this scope
   57 |                                         result *= prev_count;
      |                                                   ^~~~~~~~~~
a.cc:64:17: error: 'prev_count' was not declared in this scope
   64 |                 prev_count = count;
      |                 ^~~~~~~~~~
a.cc: In function 'int c()':
a.cc:76:1: warning: no return statement in function returning non-void [-Wreturn-type]
   76 | }
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n; cin >> n;
  int a[n+1];
  int max_node = -1;
  memset(a, 0, sizeof a);
  for(int i = 0; i < n; i++) {
    int c; cin >> c;
    a[c]++;
    max_node = max(max_node, c);
  }
  
  int M = 998244353;
  long long ans = 1;
  for(int i = 1; i <= max_node; i++) {
    long long tmp = 1;
    for(int j = 0; j < a[i]; j++) {
      tmp = (tmp * a[i-1]) % M;
    }
    if(a[i-1] == 0) tmp = 0;
   // cout << i << " " << tmp << endl;
    ans  = (ans * tmp) % M;
  }
  if(a[0] != ) cout << 0 << endl;
  else cout << ans << endl;
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: expected primary-expression before ')' token
   27 |   if(a[0] != ) cout << 0 << endl;
      |              ^
Language: C++

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

int main()
{
  int N; cin >> N;
  long cnt[100005] = {};
  int mx_D = 0;
  for (int i = 0; i < N; i++)
  {
    int D; cin >> D;
    mx_D = max(mx_D, D);
    cnt[D]++;
  }
  
  if (cnt[0] == 0)
  {
    cout << 0 << endl;
    return 0;
  }
  
  long ans = 1;
  long mod = 998244353;
  for (int j = 1; j <= mx_D; j++)
  {
    ans *= pow(cnt[j - 1], cnt[j]) % mod;
  }
  
  cout << ans % mod << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:36: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long int' to binary 'operator%'
   28 |     ans *= pow(cnt[j - 1], cnt[j]) % mod;
      |            ~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
      |               |                      |
      |               |                      long int
      |               __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;

int main(){
    int g_a;
    int n;
    vector<int> v_i;
    scanf("%d", &n);
    for(int i = 1; i <=n; i++){
        scanf("%d", &g_a);
        v_i.push_back(g_a);
    }
    if(n == 0){printf("%d", 0); return 0;}
    if(v_i[0] != 0){printf("%d", 0); return 0;}
    if(n == 1 ){printf("%d", 1); return 0;}
    sort(v_i.begin(), v_i.end());
    if(v_i[1] == 0){printf("%d", 0); return 0;}
    if(v_i[1] != 1){printf("%d", 0); return 0;}
    int to = 1;
    int p_count = 1;
    int c = 1;
    int c_count = 0;
    for(int i = 1; i < v_i.size(); i++){
        if (v_i[i] == c){
            to = (to*p_count)%998244353;
            c_count += 1;
            continue;
        }
        #if(v_i[i] - c > 1){
        #printf("%d", 0); return 0;
        #}
        c = v_i[i];
        p_count = c_count;
        c_count = 1;
        to = (to*p_count)%998244353;
    }
    printf("%d", to);
    return 0;

}



Compiler output:
a.cc:33:16: error: token "[" is not valid in preprocessor expressions
   33 |         #if(v_i[i] - c > 1){
      |                ^
a.cc:33: error: unterminated #if
   33 |         #if(v_i[i] - c > 1){
a.cc: In function 'int main()':
a.cc:32:10: error: expected '}' at end of input
   32 |         }
      |          ^
a.cc:27:40: note: to match this '{'
   27 |     for(int i = 1; i < v_i.size(); i++){
      |                                        ^
a.cc:32:10: error: expected '}' at end of input
   32 |         }
      |          ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C


#include <stdio.h>
#include <math.h>
#define MAGIC 998244353
int main(){
	long n = 0;
	long d[100000] = {};
	long floor[100000] = {};
	long cnt = 0;
	long i=0; long j = 0;
	long fm = 0;
	
	scanf("%ld",&n);
	
	for(i=0;i < n;i++){
		scanf("%ld",&d[i]);
	}
	
	for(i=0;i < n;i++){
		floor[d[i]]++;
		if(fm < floor[d[i]]){
			fm = floor[d[i]]
		}
	}

	if(floor[0] == 1){
			cnt = 1;
		for(i=0;i < n;i++){
			if(floor[i+1] == 0){
				if(i == fm){
					break;
				}else{
					cnt = 0;
					break;
				}
            }else{
            	for(j = 0;j < floor[i+1];j++){
					cnt = (cnt*(floor[i])) % 998244353;
            	}
			}
		}
	}else{
		cnt = 0;
	}
	cnt = cnt % 998244353;
	printf("%ld",cnt);	
	return 0;
}




Compiler output:
main.c: In function 'main':
main.c:22:41: error: expected ';' before '}' token
   22 |                         fm = floor[d[i]]
      |                                         ^
      |                                         ;
   23 |                 }
      |                 ~
Language: C

#include <math.h>
#define MAGIC 998244353
int main(){
	long n = 0;
	long d[100000] = {};
	long floor[100000] = {};
	long cnt = 0;
	long i=0; long j = 0;
	int fm = 0;
	
	scanf("%ld",&n);
	
	for(i=0;i < n;i++){
		scanf("%ld",&d[i]);
	}
	
	for(i=0;i < n;i++){
		floor[d[i]]++;
		if(fm < floor[d[i]]){
			fm = floor[d[i]]
		}
	}

	if(floor[0] == 1){
			cnt = 1;
		for(i=0;i < n;i++){
			if(floor[i+1] == 0){
				if(i == fm){
					break;
				}else{
					cnt = 0;
					break;
				}
            }else{
            	for(j = 0;j < floor[i+1];j++){
					cnt = (cnt*(floor[i])) % 998244353;
            	}
			}
		}
	}else{
		cnt = 0;
	}
	cnt = cnt % 998244353;
	printf("%ld",cnt);	
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:11:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   11 |         scanf("%ld",&n);
      |         ^~~~~
main.c:2:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    1 | #include <math.h>
  +++ |+#include <stdio.h>
    2 | #define MAGIC 998244353
main.c:11:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   11 |         scanf("%ld",&n);
      |         ^~~~~
main.c:11:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:20:41: error: expected ';' before '}' token
   20 |                         fm = floor[d[i]]
      |                                         ^
      |                                         ;
   21 |                 }
      |                 ~                        
main.c:44:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   44 |         printf("%ld",cnt);
      |         ^~~~~~
main.c:44:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:44:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:44:9: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
	int[] d = new int[n];
    d[0] = sc.nextInt();
    if(d[0]!=0){
      System.out.println(0);
    }
    else{
      for(int i=1; i<n; i++){
        d[i] = sc.nextInt();
    	}
      Arrays.sort(d);
      System.out.println(Check(d));
  	}
  }
  
  public static int Check(int[] d){
    long ans = 1;
    int cnt = 1;
    for(int i=0; i<d.length-1; i++){
      if(d[i]==d[i+1] && d[i+1]!=0){
        cnt++;
      }
      else if(d[i]==d[i+1]-1 && d[i+1] != 0){
        ans = ans*Factorial(cnt)*Factorial(ans);
        cnt = 1;
      }
      else{
        ans = 0;
        break;
      }
    }
    return ans%998244353;
  }
  
  public static int Factorial(int x){
    if(x == 1){
      return 1;
    }
    else if(x<1){
      return 0;
    }
    else{
      return x * Factorial(x-1);
    } 
  }
}

Compiler output:
Main.java:29: error: incompatible types: possible lossy conversion from long to int
        ans = ans*Factorial(cnt)*Factorial(ans);
                                           ^
Main.java:37: error: incompatible types: possible lossy conversion from long to int
    return ans%998244353;
              ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n ; ++i)
#define REP(i,a,b) for(ll i=a; i<b; ++i)
typedef long long ll;
//プロトタイプ宣言
ll gcd(ll , ll);


ll main(){
  ll n,ans = 0,count = 0,now = 0,next = 0;
  cin >> n;
  vector<ll> d(n),temp;
  rep(i,n) cin >> d[i];
  if(d[0] == 1){
    cout << 0 << endl;
    return 0;
  }
  sort(d.begin(),d.end());
  for(ll i=1;i<n;i++){
    next = lower_bound(d.begin(),d.end(),i) - d.begin();
    count = next - now;
    now = next;
    temp.push_back(count);
  }
  for(ll i=0;i<temp.size();i++){
    ll multi = 1;
    if(i == 0) ans = temp[0];
    else {
      for(ll j=1;j<=temp[i];j++){
        multi *= temp[i - 1];
      }
      ans *= multi;
    }
  }
  cout << ans%998244353 << endl;
}








































//以下、ライブラリ
//ユークリッドの互除法

ll gcd(ll a, ll b) {
  return b ? gcd(b, a%b) : a;
}



Compiler output:
a.cc:10:1: error: '::main' must return 'int'
   10 | ll main(){
      | ^~
Language: C++

#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 998244353
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double

int main(void){
  ll n;
  cin>>n;
  vl d(n);
  rep(i,n)cin>>d[i];
  if(d[0]!=0){
    cout<<0;
    return 0;
  }
  rep(i,n){
    if(i!=0 && d[i]==0){
      cout<<0;
      return 0;
    }
  }
  sort(d.begin(),d.end());
  vl d2(n,0);
  rep(i,n){
    d2[d[i]]++;
  }
  ll ans=1;
  int begin=0;
  rep(i,n-1){
    if(begin==0 && d2[n-i-1]==0)continue;
    begin=1;
    ans*=digitpower(d2[n-i-1],d2[n-i]);
    if(d2[n-i-1]==0)ans=0;
    ans%=d9_7;
  }
  cout<<ans%d9_7<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:10: error: 'digitpower' was not declared in this scope
   42 |     ans*=digitpower(d2[n-i-1],d2[n-i]);
      |          ^~~~~~~~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  B.at(0) = 1;
  int count = 1;
  
  for(int j=0;j<N;j++){
    cin >> A.at(j);
  }
  sort(A.begin(), A.end());
  
  if(N==1){
      cout << 1 << endl;
  }else if((A.at(0) != 0)||(A.at(1) != 1)){
      cout << 0 << endl;
  }else{
    
  	for(int i=1;i<N-1;i++){
    	if(A.at(i+1) == count){
    		B.at(count-1) += 1;
   		}else if(A.at(i+1) == (count+1)){
      		B.at(count) += 1;	
          	count += 1;
    	}
    }
    
    long int ans = 1;
    long int pow = 1;
    for(int k = 0;k<count;k++){
    	pow = pow(B.at(k),B.at(k+1));
      	pow = pow % 998244353;
        ans *= pow;
    }
    cout << (ans%998244353) << endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:18: error: 'pow' cannot be used as a function
   35 |         pow = pow(B.at(k),B.at(k+1));
      |               ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

int main()
{
    int n;
    std::cin >> n;
    std::vector<int> d(n);

    int max = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> d[i];
        max = std::max(max,d[i]);
    }

    std::vector<long long> t(max+1,0);
    for (int i = 0; i < n; i++) {
        t[d[i]]++;
    }

    long long ans = 0;
    if (t[0] == 1) {
        ans = 1;
        long long x = 998244353;
        for (int i = 1; i < max+1; i++) {
            long long tmp = std::pow(t[i-1], t[i]);
            ans = (ans　% x * tmp % x);
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Compiler output:
a.cc:26:20: error: extended character 　 is not valid in an identifier
   26 |             ans = (ans　% x * tmp % x);
      |                    ^
a.cc: In function 'int main()':
a.cc:26:20: error: 'ans\U00003000' was not declared in this scope
   26 |             ans = (ans　% x * tmp % x);
      |                    ^~~~~
Language: C++

#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 998244353
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
ll digitpower(ll a,ll b){//aのb乗を計算
  if(b==1){
    return a;
  }else if(b==0){
    return 1;
  }
  if(b%2==1){
    ll tmp = digitpower(a,(b-1)/2);
    tmp%=d9_7;
    tmp*=tmp;
    tmp%=d9_7;
    tmp*=a;
    return (tmp)%d9_7;
  }else{
    ll tmp = digitpower(a,(b)/2);
    tmp%=d9_7;
    tmp*=tmp;
    tmp%=d9_7;
    return (tmp)%d9_7;
  }
}
int main(void){
  ll n;
  cin>>n;
  vl d(n);
  rep(i,n)cin>>d[i];
  if(d[0]!=0){
    cout<<0;
    return 0;
  }
  sort(d.begin(),d.end());
  vl d2(n,0);
  rep(i,n){
    d2[d[i]]++;
  }
  ll ans=1;
  int begin=0;
  rep(i,n-1){
    if(begin==0 && d2[n-i-1]==0)continue;
    begin=1;
    ans*=digitpower(d2[n-i-1],d2[n-i]);
    if(d2[n-i-1]==0)ans=0;
    ans%=d9_7;
  }
  cout<<ans%=d9_7<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:18: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   60 |   cout<<ans%=d9_7<<endl;
      |                  ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  B.at(0) = 1;
  int count = 1;
  
  for(int j=0;j<N;j++){
    cin >> A.at(j);
  }
  sort(A.begin(), A.end());
  
  if(N==1){
      cout << 1 << endl;
  }else if((A.at(0) != 0)||(A.at(1) != 1)){
      cout << 0 << endl;
  }else{
    
  	for(int i=1;i<N-1;i++){
    	if(A.at(i+1) == count){
    		B.at(count-1) += 1;
   		}else if(A.at(i+1) == (count+1)){
      		B.at(count) += 1;	
          	count += 1;
    	}
    }
    
    long int ans = 1;
    for(int k = 0;k<count;k++){
    	ans *= (pow(B.at(k),B.at(k+1))%998244353);
    }
    cout << (ans%998244353) << endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:39: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
   34 |         ans *= (pow(B.at(k),B.at(k+1))%998244353);
      |                 ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
      |                    |                   |
      |                    |                   int
      |                    __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

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

const ll mod = 998244353;
template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
ll cnt[100010];
int main(){
  int n;
  cin >> n;
  int mx = 0;
  rep(i,n) {
    int d;
    cin >> d;
    if (i == 0 && d != 0) {
      cout << 0 << endl;
      return 0;
    }
    cnt[d]++;
    mx = max(mx,d);
  }
  ll res = 1;
  if (cnt[0] != 1 || ) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < mx; i++) {
    (res *= mod_pow(cnt[i],cnt[i+1],mod)) %= mod;
  }
  cout << res << endl;
  return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:35:22: error: expected primary-expression before ')' token
   35 |   if (cnt[0] != 1 || ) {
      |                      ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;
ll last,a,b,c,i,j,k,m,n,str[100005],sum=1;
int main()
{
    scanf("%lld",&n);
    for(i=0;i<n;i++){
        scanf("%lld",&str[i]);
    }
    sort(str,str+n);
    j=0;
    for(i=0;i<n;i++){
        if(str[i]==j)
            j++;
        else if(str[i]>j)
            break;
    }
    if(i!=n)
        {printf("0\n");return 0;}

    j=0;
    while(str[j]==0)
    {
        j++;
    }
    if(j>1)
        printf("0\n");
    else
    {
        j=1;
        last=j;
        b=0;
        for(i=1;i<n;i++){
            if(str[i]==j)
            {
                sum=sumt%998244353*last%998244353;
                b++;
            }
            else
            {
                j=str[i];
                last=b;
                sum=sumt%998244353*last%998244353;
                b=1;
            }
        }
            printf("%lld\n",sum);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:21: error: 'sumt' was not declared in this scope; did you mean 'sum'?
   41 |                 sum=sumt%998244353*last%998244353;
      |                     ^~~~
      |                     sum
a.cc:48:21: error: 'sumt' was not declared in this scope; did you mean 'sum'?
   48 |                 sum=sumt%998244353*last%998244353;
      |                     ^~~~
      |                     sum
Language: C

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 998244353

typedef long long int lli;

lli zyou(lli a, lli x)
{
  lli ans = 1;
  rep(i, 0, x) ans = (ans * a) % MOD;
  return ans;
}

int main(void)
{
  lli n, d[MAX];
  scanf("%lld", &n);

  lli kyori[MAX] = {0}; // kyori[i]:頂点1からの距離がiの個数
  lli len = 0;
  rep(i, 0, n)
  {
    scanf("%lld", &d[i]);
    len = max(len, d[i]);
    kyori[d[i]]++;
  }

  lli ans = 1;
  rep(i, 0, len)
  {
    if (kyori[i] == 0)
    {
      ans = 0;
      break;
    }
    ans = (ans * (zyou(kyori[i], kyori[i + 1]) % MOD)) % MOD;
  }
  if (kyori[idx] != 1)
    ans = 0;
  printf("%lld\n", ans % MOD);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:51:13: error: 'idx' undeclared (first use in this function)
   51 |   if (kyori[idx] != 1)
      |             ^~~
main.c:51:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

const ll BIG=998244353;
ll pow_ans(ll x, ll n){
  ll res = 1;
  while(n>0){
    if(n&1){res*=x; res%=BIG;}
    x*=x; x%=BIG;
    n>>=1;
  }
  return res;
}

int main(){
  //cout << fixed << setprecision(10);
  int n; cin>>n;
  vector<int> D(n);
  rep(i,n){
    cin>>D[i];
  }
  sort(D.begin(),D.end());
  vector<int> kazu(1);
  ll ans=-1;
  rep(i,n){
    if(i==0&&D[i]!=0){
      ans=0; break;
    }
    if(i==1&&D[i]==0){
      ans=0; break;
    }
    if(D[i]==kazu.size()-1){
      kazu[D[i]]++;
    }else if(D[i]==kazu.size()){
      kazu.push_back(1);
    }else{
      ans=0; break;
    }
  }
  //N=1のときkazu[0]=1でおわり
  if(ans==0){
    cout<<0<<endl;
  }else{
    ans=1;
    for(int i=1;i<kazu.size();i++){
      ans*= pow_ans(kazu[i-1],kazu[i]);
      ans%=BIG;
    }
    cout<< ans <<endl;
  }
}
4
0 1 1 2

Compiler output:
a.cc:54:1: error: expected unqualified-id before numeric constant
   54 | 4
      | ^
Language: C++

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

#define i64 long long 

i64 POW(i64 x,i64 n, i64 MOD = 1000000007){
    i64 res = 1;
    while(n){
        if(n%2) res = (res * x) % MOD;
        x = (x*x) % MOD;
        n >>= 1;
    }
    return res;
}

i64 

int main(){
    int N;
    cin >> N;
    vector<int> D(N);
    for(int i = 0; i < N; i++) cin >> D[i];
    bool ok = true;

    if(D[0] != 0) ok = false;

    vector<long long> d(N, 0);
    for(int i = 0; i < N; i++) d[ D[i] ]++;
    if(d[0] != 1) ok = false;

    int depth = 0;
    for(int i = 1; d[i] != 0 && i < N; i++) depth = i+1;
    for(int i = 1; i < N; i++){
        if(d[i] != 0 && depth < i) ok = false;
    }

    if(!ok){
        cout << 0 << endl;
        return 0;
    }

    const long long MOD = 998244353;
    long long ans = 1;
    for(int i = 2; i < depth; i++){
        ans = (ans*POW(d[i-1], d[i], MOD)) % MOD;
    }

    cout << ans << endl;
}

Compiler output:
a.cc:18:1: error: '::main' must return 'int'
   18 | int main(){
      | ^~~
Language: C++

#include <bits/stdc++.h>

#define INF (1 << 30)
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define out(x) cout << x << endl;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

template <typename T>
T v1sum(vector<T> vec){
    T ret = 0;
    for(int i = 0; i < vec.size(); i++) ret += vec[i];
    return ret;
}
template <typename T>
vector<T> v1sort(vector<T> vec, bool min_to_max=true){
    sort(vec.begin(), vec.end(), [min_to_max](const T a, const T b){return (min_to_max == true) ? (a < b) : (b < a);});
    return vec;
}
template <typename T>
void v1show(vector<T> vec){
    for(int i = 0; i < vec.size(); i++){
        cout << vec[i] << " ";
    }
    cout << endl;
}

int main(){
    vector<int> a;
    int n;
    cin >> n;
    rep(i, n){
        int tmp = 0;
        cin >> tmp;
        a.push_back(tmp);
    }
    a = v1sort<int>(a, true);
    ll ans = 1;
    int depth = 0;
    int depth_num = 0;
    vector<int> depth_nums;
    rep(i, n){
        if(a[i] == depth){
            depth_num++;
        }else if(a[i] == depth+1){
            depth_nums.push_back(depth_num);
            depth_num = 1;
            depth++;
        }else{
            ans = 0;
        }
        if(i == n-1){
            depth_nums.push_back(depth_num);
        }
    }

    rep(i, depth_nums.size()-1){
        ans *= pow(depth_nums[i], depth_nums[i+1]) % 998244353;// a[i]a[i+1];
    }

    out(ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:52: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
   61 |         ans *= pow(depth_nums[i], depth_nums[i+1]) % 998244353;// a[i]a[i+1];
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~
      |                   |                                  |
      |                   |                                  int
      |                   __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  B.at(0) = 1;
  int count = 1;
  
  for(int j=0;j<N;j++){
    cin >> A.at(j);
  }
  sort(A.begin(), A.end());
  
  if(N==1){
      cout << 1 << endl;
  }else if((A.at(0) != 0)||(A.at(1) != 1)){
      cout << 0 << endl;
  }else{
    
  	for(int i=1;i<N-1;i++){
    	if(A.at(i+1) == count){
    		B.at(count-1) += 1;
   		}else if(A.at(i+1) == (count+1)){
      		B.at(count) += 1;	
          	count += 1;
    	}
    }
    
    long int ans = 1;
    for(int k = 0;k<count;k++){
    	ans *= pow(B.at(k),B.at(k+1))%998244353;
    }
    cout << (ans%998244353) << endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:38: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
   34 |         ans *= pow(B.at(k),B.at(k+1))%998244353;
      |                ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
      |                   |                   |
      |                   |                   int
      |                   __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int MAXSIZE=1e5+1;
int swt[MAXSIZE];
int main(){
	int n,m;
	cin >> n;
	memset(swt,0,sizeof(swt));
	for(int k=0;k<n;k++){
		cin >> m;
		swt[m]++;		
	}
	int sum=0,i;
	int xs=1;
	for(i=0;i<MAXSIZE;i++){
		if(swt[i]==0)
			break;
		
		sum+=swt[i];
	} 
	//cout<<sum<<" "<<i<<endl;
	if(sum==n){
		for(int j=i-1;j>0;j--){
			//cout<< swt[j-1]<<"  "<<swt[j]<<endl;
			xs=xs*pow(swt[j-1],swt[j])%998244353;
		}
		cout<<xs<<endl;
	}
	else{
		cout<<0<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:51: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
   25 |                         xs=xs*pow(swt[j-1],swt[j])%998244353;
      |                            ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
      |                              |                     |
      |                              |                     int
      |                              __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

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

int main() {
    ll N; cin >> N;
    vector<ll> D(N), vec(N);
    for(int i = 0; i < N; ++i){
        cin >> D[i];
        ++vec[D[i]];
    }
  
    if(D[0] != 0){
        cout << 0 << endl;
        return;
    }


    ll ans = 1;
    if(vec[0] != 1){
        cout << 0 << endl;
        return 0;
    }
    for(ll i = 1; i < N; ++i){
        for(int j = 0; j < vec[i]; ++j){
            ans *= vec[i-1];
            ans %= MOD;
        }
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}



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

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

int main() {
    ll N; cin >> N;
    vector<ll> D(N), vec(N);
    for(int i = 0; i < N; ++i){
        cin >> D[i];
        ++vec[D[i]];
    }

    if(D[0] != 0){
        cout << 0 << endl;
        return;
    }

  
    ll ans = 1;
    if(vec[0] != 1){
        cout << 0 << endl;
        return 0;
    }
    for(ll i = 1; i < N; ++i){
        for(int j = 0; j < vec[i]; ++j){
            ans *= vec[i-1];
            ans %= MOD;
        }
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}



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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 998244353
 
ll a[100010];
int main() {
	ll n;
	cin>>n;
	ll ma=0;
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		a[now]++;
		ma=max(ma,now);
	}
	ll ans=a[0];
	if(ans!=1){
		ans=0;
		cout << ans <<endl;
		return;
	}
	for(ll i=1;i<ma+1;i++){
		ll cnt=0;
		ll now=1;
		while(a[i]>cnt){
			cnt++;
			now*=a[i-1];
			now%=inf;
		}
		//ll now=pow(a[i-1],a[i]);
		ans*=now;
		ans%=inf;
	}
	cout <<ans%inf;
	// your code goes here
	return 0;
}

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

#include <bits/stdc++.h>
#define LL long long
#define maxn   100005
#define modn   998244353
using namespace std;
LL a[maxn];
LL quickpow(LL a,LL b)
{
    LL ans=1;
    a%=modn;
    while(b)
    {
        if(b%2==1)
          ans=(ans*a)%modn;
       a=(a*a)%modn;
       b/=2;
    }
    return ans;
}
int main()
{
    LL n;
    cin>>n;
    memset(a,0,sizeof(a));
    LL flag=0;
    LL maxroad=0;
    for(int i=0;i<n;i++)
    {
        int k;
        scanf("%d",&k);
        if(k<n)
            {
               a[k]++;
               maxroad=max(maxroad,k);
            }
        else
            flag=1;
    }
    LL ans=1;
    if(a[0]!=1)
        flag=1;
    if(flag)
        ;
    else
    {
        for(int i=1; i<=maxroad; i++)
        {
            /*if(a[i]==0){
                flag=1;
                break;
            }
            else
            {*/
                ans*=quickpow(a[i-1],a[i]);
                ans%=modn;
            //}
        }
    }
    if(flag)
        cout<<"0"<<endl;
    else
        cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:27: error: no matching function for call to 'max(long long int&, int&)'
   34 |                maxroad=max(maxroad,k);
      |                        ~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:34:27: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |                maxroad=max(maxroad,k);
      |                        ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:34:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |                maxroad=max(maxroad,k);
      |                        ~~~^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

const ll MOD = 998244353;
int main(){
    ll n;cin >> n;
    ll d[n];
  	rep(i,0,n)cin >> d[i];
    //最初は0確定
    if(d[0] != 0){
        cout<<0<<endl;
        return 0;
    }
    //他に0を含んでいてもだめ
    rep(i,1,n){
        if(d[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    
    sort(d,d+n);
    ll res = 1;
    vector<ll> v; ll cnt=1,tmp=1;
  	v.pb(1);
    rep(i,1,n){
        if(d[i] == cnt+1){
            v.pb(i-tmp);
            tmp =i;cnt++;
        }if(i==n-1){
            v.pb(n-tmp);
        }
    }
  	//rep(i,0,v.size())cout<<v[i]<<ednl;
    rep(i,1,v.size()){
      	//cout << v[i] << " " << v[i-1] << endl;
        res*=pow(v[i-1],v[i]) % MOD;
        // ll sum=0;
        // rep(j,0,v[i]+1) sum+=COM(v[i], j);
        // res *= 
    }
    cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:31: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'const long long int' to binary 'operator%'
   62 |         res*=pow(v[i-1],v[i]) % MOD;
      |              ~~~~~~~~~~~~~~~~ ^ ~~~
      |                 |               |
      |                 |               const long long int
      |                 __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
    long long int N,ans=1,count=1,add=0,now=2,pw=0;
    bool flag = true,ff=false;

    cin >> N;

    vector<int> D(N);

    for(int i=0;i<N;i++){
        cin >> D[i];
    }

    if(D[0]!=0){
        flag = false;
    }

    sort(D.begin(),D.end());

    if(D[1]!=1){
        flag = false;
    }else{
        for(int i=1;i<N;i++){
            if(D[i]!=1){
                count = i;
                break;
            }
            add++;
        }

    for(int i=count;i<N;i++){
        if(D[i]==now+1){
                ans %= 998244353;
                ans *= (pow(add,pw)%998244353);
                ans %= 998244353;
                add = pw;
                pw = 1;
                now++;
        }else if(D[i]==now){
            pw++;
        }else{
            flag = false;
        }
    }

    if(D[N-1]==now){
    ans %= 998244353;
    ans *= (pow(add,pw)%998244353;
    ans %= 998244353;
    }

    if(flag){
    cout << ans << endl;
    }else{
    cout << 0 << endl;
    }
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:36: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
   37 |                 ans *= (pow(add,pw)%998244353);
      |                         ~~~~~~~~~~~^~~~~~~~~~
      |                            |        |
      |                            |        int
      |                            __gnu_cxx::__promote<double>::__type {aka double}
a.cc:51:24: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
   51 |     ans *= (pow(add,pw)%998244353;
      |             ~~~~~~~~~~~^~~~~~~~~~
      |                |        |
      |                |        int
      |                __gnu_cxx::__promote<double>::__type {aka double}
a.cc:51:34: error: expected ')' before ';' token
   51 |     ans *= (pow(add,pw)%998244353;
      |            ~                     ^
      |                                  )
Language: C++

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

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
 

using ll = long long int;
using ld = long double;
using pii = pair<int,int>;

#define REP(i,m,n) for(ll i = m; i < (ll)(n);++i)
#define rep(i,n) REP(i,0,n)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
 
using vi=vc<int>;

const ll mod=1e9+7;
const ll INF = 1e18;

  
int main(){
  int n;cin >> n;
  vi d(n);
  rep(i,n) cin >> d[i];
  sort(all(d));
  if(d[0]!=0) cout << 0 << endl;
  else{
    bool t=false;
    vector<int> s;
    s.push_back(1);
    for(int i=2;i<n;i++){
      if(d[i]-d[i-1]==1){
        s.push_back(i);
      }
    }
    rep(i,n-1){
      if(d[i+1]-d[i]>1)t=true;
      break;}
    
    if(t) cout << 0 <<endl;
    else{
      s.push_back(n);
      ll ans=1;
      rep(i,s.size()-2){
        ans*=pow(s[i+1]-s[i],s[i+2]-s[i+1]);
        ans%=998244353
      }
      cout << ans << endl;}
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:23: error: expected ';' before '}' token
   53 |         ans%=998244353
      |                       ^
      |                       ;
   54 |       }
      |       ~
Language: C++

#include <algorithm>
#include <iostream>
#include <map>

using namespace std;

const int64_t kMod = 998'244'353;

int main() {
  int64_t N;
  cin >> N;

  map<int64_t, int64_t> D;
  for (int64_t i = 0; i < N; i++) {
    int64_t d;
    cin >> d;

    if (D.count(d) == 1) {
      D[d]++;
    } else {
      D.emplace(d, static_cast<int64_t>(1));
    }
  }

  bool exist = false;
  int64_t sum = 1;
  int64_t before = 0;
  for (const auto& d : D) {
    if (d.first == 0) continue;
    if (d.first == 1) {
      before = d.second;
      continue;
    }
    int64_t s = 1;
//    cout << "!!! " << d.first << " " << d.second << " " << before << endl;
    for (int64_t i = 0; i < d.second; i++) {
      s = (s * before) % kMod;
    }
//    cout << "@@@ " << s << endl;
    sum = (sum * s) % kMod;
    exist = true;
    before = d.second;
  }
  if (exist) {
    cout << sum % kMod << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;


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

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

#define MOD 998244353

long long powM(long long a, long long b){
	//if(a==0)return 0;
	if(b==0)return 1;
	else if(b==1)return a%MOD;

	if(b%2==0){
		a=(a*a)%MOD;
		return powM(a, b/2)%MOD;
	}else{
		return (a*powM(a,b-1) )%MOD;
	}
}

long long int cnt[100001];

signed main(){
	long long n;	cin>>n;
	vector<long long> d(n);

	long long maxD=0;
	for(long long i=0;i<n;i++){
		cin>>d[i];
		if(d[i]>maxD)maxD=d[i];
	}

	for(long long i=0;i<n;i++){
		cnt[ d[i] ]++;
	}


	if(cnt[0]!=1){
		cout<<0<<endl;
		return 0;
	}

	long long  ans=1;
	for(long long i=1;i<=maxD;i++){
		B
		if(cnt[i]==0){
			cout<<0<<endl;
			return 0;
		}

		ans=( ans*powM(cnt[i-1],cnt[i]) )%MOD;
	}
	//cout<<endl;
	//for(long long i=0;i<=maxD;i++)cout<<cnt[i]<<" ";
	//cout<<endl;
	ans%=MOD;

	cout<<ans<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: 'B' was not declared in this scope
   43 |                 B
      |                 ^
Language: C++

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

const ll mod = 998244353;
template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
ll cnt[100010];
int main(){
  int n;
  cin >> n;
  int mx = 0;
  rep(i,n) {
    int d;
    cin >> d;
    cnt[d]++;
    mx = max(mx,d);
  }
  ll res = 1;
  if (d[0] != 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < mx; i++) {
    (res *= mod_pow(cnt[i],cnt[i+1],mod)) %= mod;
  }
  cout << res << endl;
  return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:31:7: error: 'd' was not declared in this scope
   31 |   if (d[0] != 1) {
      |       ^
Language: C++

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

typedef long long ll;
#define INF = 1001001001
#define LINF = 1e18
#define PI = acos(-1)

const int MO = 998244353;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> d(n);
  vector<int> c(n+1);
	set<int> s;
  for(int i = 0; i < n+1;i++) c[i] = 0;

  for(int i = 0; i < n; i++){
      cin >> d[i];
			s.insert(d[i]);
      c[d[i]]++;
  }
	sort(d.begin(),d.end());
	int d_max = *max_element(d.begin(),d.end());
	int s_max = s.size();
	if(d_max!=s_max-1){
		cout << 0 << endl;
		return 0;
	}
	ll ans = 1;
  for(int i = 0; i < s_max-2; i++){
		int k = c[i];
		int q = c[i+1];
		ans *= k;
		ans %= MO;
	}

	int k = c[s_max-2];
	ans *= pow(k,q);
	ans %= MO;

	cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:22: error: 'q' was not declared in this scope
   43 |         ans *= pow(k,q);
      |                      ^
Language: C++

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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (1000006)
#define INF (1LL << 60)
const int MOD = 998244353LL;

/* x^nを高速に求める */
int mod_pow(int x, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%MOD;  // 最下位ビットが立ってる時にx^(2^i)を掛ける
		x = x*x%MOD;              // xを順次二乗していく
		n >>= 1;    // 右ビットシフト
	}
	return res;
}

signed main(){
    int N;
    cin >> N;
    vector<int> D(N);
    int f=0;
    for(int i=0; i<N; i++) {
        cin >> D[i];
        if(D[i]==0) f++;
    if(D[0]!=0 && f!=1) {
        cout << 0 << endl;
        return 0;
    }

    map<int,int> mp;
    for(int i=0; i<N; i++) mp[D[i]]++;

    int ans=1;
    for(auto it: mp){
        //DEBUG2(it.first, it.second);
        if(it.first <= 1) continue;
        int pr = it.first-1;
        for(int i=0; i<it.second; i++){
            ans *= mp[pr];
            ans %= MOD;
        }
    }

    cout << ans%MOD << endl;
}

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