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

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

struct Node {
  Node* l = nullptr;
  Node* r = nullptr;
};

int n
long k;
string s[100000];
Node nodes[400000];
Node* head = nodes;

Node* new_node() {
  static Node* node = nodes;
  return ++node;
}

void add(const string& str) {
  Node* curr = head;
  for (int i = 0; i < str.size(); ++i) {
    char c = str[i];
    if (c == '0') {
      if (curr->l == nullptr) {
        curr->l = new_node();
      }
      curr = curr->l;
    } else {
      if (curr->r == nullptr) {
        curr->r = new_node();
      }
      curr = curr->r;
    }
  }
}

void create() {
  for (int i = 0; i < n; ++i) {
    add(s[i]);
  }
}

int a[100001];
void rec(Node* node, int level) {
  if (node == nullptr) {
    ++a[level];
    return;
  }
  if (node->l == nullptr && node->r == nullptr) return;
  rec(node->l, level + 1);
  rec(node->r, level + 1);
}

int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }
  create();
  rec(head, 0);
  
  int odd = 0;
  int even = 0;
  for (int i = 0; i <= 100000; ++i) {
    (i % 2 == 0 ? even : odd) += a[i];
  }
  
  if (odd % 2 == 0 && even % 2 == 0) {
    cout << "Bob" << endl;
  } else {
    cout << "Alice" << endl;
  }
  
  return 0;
}

Compiler output:
a.cc:10:1: error: expected initializer before 'long'
   10 | long k;
      | ^~~~
a.cc: In function 'void create()':
a.cc:39:23: error: 'n' was not declared in this scope
   39 |   for (int i = 0; i < n; ++i) {
      |                       ^
a.cc: In function 'int main()':
a.cc:56:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   56 |   cin >> n >> k;
      |          ^
      |          yn
a.cc:56:15: error: 'k' was not declared in this scope
   56 |   cin >> n >> k;
      |               ^
Language: C++

        cin >> s;
        trie.add(s, 0);
    }

    int sum = 0;
    stack<int> st;
    st.push(0);
    while(not st.empty()){
        int id = st.top();
        st.pop();

        if(trie.nodes[id].l == -1 && trie.nodes[id].r == -1){
            continue;
        }

        if(trie.nodes[id].l != -1){
            st.push(trie.nodes[id].l);
        }else{
            int h = l - trie.nodes[id].d;
            sum ^= grundy(h);
        }
        if(trie.nodes[id].r != -1){
            st.push(trie.nodes[id].r);
        }else{
            int h = l - trie.nodes[id].d;
            sum ^= grundy(h);
        }
    }

    cout << (sum == 0 ? "Bob" : "Alice") << endl;


    return 0;
}


Compiler output:
a.cc:1:9: error: 'cin' does not name a type
    1 |         cin >> s;
      |         ^~~
a.cc:2:9: error: 'trie' does not name a type
    2 |         trie.add(s, 0);
      |         ^~~~
a.cc:3:5: error: expected declaration before '}' token
    3 |     }
      |     ^
a.cc:6:5: error: 'stack' does not name a type
    6 |     stack<int> st;
      |     ^~~~~
a.cc:7:5: error: 'st' does not name a type
    7 |     st.push(0);
      |     ^~
a.cc:8:5: error: expected unqualified-id before 'while'
    8 |     while(not st.empty()){
      |     ^~~~~
a.cc:30:5: error: 'cout' does not name a type
   30 |     cout << (sum == 0 ? "Bob" : "Alice") << endl;
      |     ^~~~
a.cc:33:5: error: expected unqualified-id before 'return'
   33 |     return 0;
      |     ^~~~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

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

int sz = 1, cnt[100010];
pair<int, int> p[100010];
void rec(int r, int pos, const string &s){
	//cerr<<"r: "<<r<<" pos:"<<pos<<" s:"<<s<<endl;
	if(pos >= s.size()) {
		cnt[r]++;
		return;
	}
	if(s[pos] == '0'){
		if(!p[r].first) p[r].first = ++sz;
		rec(p[r].first, pos + 1, s);
	}
	else{
		if(!p[r].second) p[r].second = ++sz;
		rec(p[r].second, pos + 1, s);
	}
}
int grundy(int r, long long l){
	//cerr<<"r: "<<r<<endl;
	if(!r) return l % 2 ? 2 : 1;
	if(cnt[r]) return 0;

	int res = 0;
	res ^= grundy(p[r].first, l - 1);
	res ^= grundy(p[r].second, l - 1);
	return res;
}

int main(){
	int n;
	long long l;
	cin >> n >> l;
	vector<string> in(n);
	rep(i, n){
		cin >> in[i];
		rec(1, 0, in[i]);
	}
	//cerr<<"?"<<endl;
	int ans = grundy(1, l);
	cout << (ans ? "Alice" : "Bob") <<
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:9: error: expected primary-expression before 'return'
   48 |         return 0;
      |         ^~~~~~
Language: C++

#include <iostream>
#include <cstring>
using namespace std;
const int N = 10000000+10;
int ch[N][2], tot;
int n, L;
char s[N];
void insert(int len, char * s) {
    int now = 0; 
    for (int i = 1; i <= len; i ++) {
        int f = (s[i] == '1') ? 1 : 0;
        if (!ch[now][f]) {
            ch[now][f] = ++ tot;
        }
        now = ch[now][f], 
    }
}
int dfs(int x, int dep) {
    if (x == 0 && dep != 0) {
        if (L >= dep)
            return (L-dep+1)&(-L+dep-1);
        return 0;
    }
    return dfs(ch[x][0], dep + 1) ^ dfs(ch[x][1], dep + 1);
}
int main() {
    scanf("%d %d", &n, &L);
    for (int i = 1; i <= n; i ++) {
        scanf("%s", s+1);
        int len = strlen(s+1);
        insert(len, s);
    }
    printf("%s\n", dfs(0, 0) ? "Alice" : "Bob");
}





Compiler output:
a.cc: In function 'void insert(int, char*)':
a.cc:16:5: error: expected primary-expression before '}' token
   16 |     }
      |     ^
Language: C++

#include "bits/stdc++.h"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
const int maxn = 101010;
int trie[maxn][2], nd = 1;
void add(char x[]){
    int cur = 0;
    for(int e = 0; x[e]; e++){
        int & v = trie[cur][x[e]-'0'];
        if(v == -1) v = nd++;
        cur = v;
    }
}
long long l;
long long solve(int cur, long long v){
    if(cur == -1){
        if(l >= v) return ((l + 1 - h)&(-(l + 1 - h)));
        return 0;
    }
    return solve(trie[cur][0], v+1)^solve(trie[cur][1], v+1);
}
char d[maxn];
int main(){
    memset(trie, -1, sizeof(trie));
    int n;
    cin >> n >> l;
    for(int e = 0; e < n; e++){
        scanf("%s", d);
        add(d);
    }
    if(solve(0, 0) == 0) cout << "Bob" << endl;
    else cout << "Alice" << endl;
    return 0;
}


Compiler output:
a.cc: In function 'long long int solve(int, long long int)':
a.cc:18:37: error: 'h' was not declared in this scope
   18 |         if(l >= v) return ((l + 1 - h)&(-(l + 1 - h)));
      |                                     ^
Language: C++

// forked from https://beta.atcoder.jp/contests/arc087/submissions/2069621
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
#include <cmath>
#include <memory>
using namespace std;

using NULL = nullptr;
 
struct node_t {
        node_t* left; 
        node_t* right;
        node_t(node_t* l, node_t* r) : left(l), right(r) {}
};
 
using node = node_t*;
 
node new_node() {
        return new node_t(NULL, NULL);
}
 
int main() {
        int n;
        long long l;
        scanf("%d %lld", &n, &l);
        vector<string> s(n);
        for (int i = 0; i < n; i ++) {
                cin >> s[i];
        }
        node root = new_node();
        function<void (node, string, int)> dfs = [&](node u, string str, int depth) {
                if (depth >= (int) str.size()) {
                        return;
                }
                if (str[depth] == '0') {
                        if (u->left == NULL) {
                                u->left = new_node();
                        }
                        dfs(u->left, str, depth + 1);
                } else {
                        assert(str[depth] == '1');
                        if (u->right == NULL) {
                                u->right = new_node();
                        }
                        dfs(u->right, str, depth + 1);
                }
        };
        for (int i = 0; i < n; i ++) {
                dfs(root, s[i], 0);
        }
        function<long long (long long)> get_grundy = [&](long long x) {
                int ctz = __builtin_ctzll(x);
                return 1LL << ctz;
        };
        long long ans = 0;
        function<void (node, int)> dfs2 = [&](node u, int depth) {
                if ((u->left == NULL && u->right != NULL) || (u->left != NULL && u->right == NULL)) {
                        ans ^= get_grundy(l - depth);
                }
                if (u->left != NULL) {
                        dfs2(u->left, depth + 1);
                }
                if (u->right != NULL) {
                        dfs2(u->right, depth + 1);
                }
        };
        dfs2(root, 0);
        puts(ans ? "Alice" : "Bob");
        return 0;
}


Compiler output:
In file included from /usr/include/time.h:29,
                 from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:9:
a.cc:15:7: error: expected nested-name-specifier before '__null'
   15 | using NULL = nullptr;
      |       ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<unordered_set>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
 
ll g(ll k){
	int a=1;
	while(k%2==0)k/=2,a++;
	return a;
}
 
unordered_set<string> s;
unordered_set<string>::iterator it;
 
int main(){
	int n;
	ll L,ans=0;
	cin>>n>>L;
	string x;
	lol(i,n){
		cin>>x;
		lol(j,x.size()+1){
			s.insert(x.substr(0,j));
		}
	}
	if(s.size()>100000){
		cout<<"%$%#%"<<endl;
		return;
	}
	for(it=s.begin();it!=s.end();it++){
		x=*it;
		if((s.end()==s.find(x+'0'))^(s.end()==s.find(x+'1'))){
			ans^=g(L-x.size());
		}
	}
	cout<<(ans==0?"Bob":"Alice")<<endl;
	return 0;
}

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

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

struct Trie {
    static constexpr int M = 1, O = '0';
    struct Node {
        int children[2];
        int count;
    };
    Trie() : nodes(1) {}
    void insert(const string& s) {
        int k = 0;
        int n = s.size();
        for (int i = 0; i < n; i++) {
            int c = s[i] - O;
            for (int j = M - 1; j >= 0; j--) {
                int v = c >> j & 1;
                int& p = nodes[k].children[v];
                if (p == 0) {
                    p = nodes.size();
                    nodes.push_back(Node());
                }
                k = p;
            }
        }
        nodes[k].count++;
    }
    void dfs(int k, int j, string& s) {
        int64_t d = s.size();

        if (j == 0) s.push_back(0); else s.back() <<= 1;
        if (++j == M) s.back() += O, j = 0;

        int c = 0;
        for (int v = 0; v < 2; v++) {
            int k1 = nodes[k].children[v];
            if (k1 == 0) continue;

            c++;
            if (v) s.back()++;
            int b = s.back(), n = s.size();
            dfs(k1, j, s);
            s.resize(n); s.back() = b;
        }

        if (c == 1) {
            //cout << s.size() << ' ' << s << endl;
            d = l - d;
            g ^= d & -d;
        }
    }
    vector<Node> nodes;
    int64_t g, l;
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    int64_t l;
    cin >> l;

    Trie tr;
    string s;
    for (int i = 0; i < n; i++) {
        cin >> s;
        tr.insert(s);
    }
    tr.g = 0;
    tr.l = l;
    tr.dfs(0, 0, string());

    cout << (tr.g != 0 ? "Alice" : "Bob") << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:80:18: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   80 |     tr.dfs(0, 0, string());
      |                  ^~~~~~~~
a.cc:34:36: note:   initializing argument 3 of 'void Trie::dfs(int, int, std::string&)'
   34 |     void dfs(int k, int j, string& s) {
      |                            ~~~~~~~~^
Language: C++

#include <bits/stdc++.h>
#define rep(i,  x,  y) for(int i = x; i <= y; i ++)
#define ll long long
#define X first
#define Y second
#define ls rt << 1
#define rs rt << 1 | 1
#define INF 0x3f3f3f3f
#define mod 1000000007
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
int n;
ll l;
string s;
 
int nxt[ran][2], tail = 1;
ll ans;
 
ll sg(int dep) 
{
	ll rem = l - dep + 1;
	return rem & -rem;
}
 
void dfs(int cur, int dep) 
{
	for(int i = 0; i < 2; i ++)
		if (nxt[cur][i] == -1) ans ^= sg(dep);
		else dfs(nxt[cur][i], dep+1);
}
 
int main() 
{
	memset(nxt, -1, sizeof nxt);
	cin >> n >> l;
	for(int i = 0; i < n; i ++) 
	{
		cin >> s;
		int it = 0;
		for(int j = 0; j < s.size(); j ++) 
		{
			int dir = s[j] - '0';
			if (nxt[it][dir] == -1) nxt[it][dir] = tail++;
			it = nxt[it][dir];
		}
	}
	ans = 0LL;
	dfs(0, 1);
	puts(ans == 0 ? "Bob" : "Alice");
	
	return 0;
}


Compiler output:
a.cc:22:9: error: 'ran' was not declared in this scope; did you mean 'tan'?
   22 | int nxt[ran][2], tail = 1;
      |         ^~~
      |         tan
a.cc: In function 'void dfs(int, int)':
a.cc:34:21: error: 'nxt' was not declared in this scope
   34 |                 if (nxt[cur][i] == -1) ans ^= sg(dep);
      |                     ^~~
a.cc: In function 'int main()':
a.cc:40:16: error: 'nxt' was not declared in this scope
   40 |         memset(nxt, -1, sizeof nxt);
      |                ^~~
Language: C++

#include <bits/stdc++.h>
#define lowbit(x) (x&-x)
using namespace std;
typedef long long ll;
ll n,l,ch[100010][2],tot=1,Ans; char sd[100010];
inline void dfs(int rt,ll pr)
{
	if(!(ch[rt][0]^ch[rt][1])) return ;
	if(ch[rt][0]&&ch[rt][1]) 
		dfs(ch[rt][0],pr+1),dfs(ch[rt][1],pr+1);
	else Ans^=lowbit(l-pr)， dfs(ch[rt][0]|ch[rt][1],pr+1);
}
int main()
{
	cin >> n >> l; for(int i=1;i<=n;i++)
	{
		scanf("%s",sd); int len=strlen(sd);
		for(int j=0,nw=1;j<len;j++)
			!ch[nw][sd[j]-'0']? ch[nw][sd[j]-'0']=++tot:1,
			nw=ch[nw][sd[j]-'0'];
	}
	dfs(1,0ll); if(Ans) puts("Alice"); else puts("Bob");
}

Compiler output:
a.cc: In function 'void dfs(int, ll)':
a.cc:11:31: error: expected ';' before '\U0000ff0c'
   11 |         else Ans^=lowbit(l-pr)， dfs(ch[rt][0]|ch[rt][1],pr+1);
      |                               ^~
Language: C++

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

const int N = 5e3 + 10;
const int mod = 1e9 + 7;

int qpow(int a, int b) {
	int ret = 1;
	while (b) {
		if (b & 1) ret = 1ll * ret * a % mod;
		a = 1ll * a * a % mod, b >>= 1;
	}
	return ret;
}

int n, fac[N], ifac[N], f[N], nf[N], siz[N], g[N], mn = 1e9;
vector<int> E[N];

void dfs(int u, int fa) {
	siz[u] = 1;
	for (auto v : E[u])
		if (v ^ fa) {
			dfs(v, u), siz[u] += siz[v];
			g[u] = max(g[u], siz[v]);
		}
	g[u] = max(g[u], n - siz[u]);
	mn = min(mn, g[u]);
}

int main() {
	cin >> n;
	for (int i = 1, u, v; i < n; i++) cin >> u >> v, E[u].push_back(v), E[v].push_back(u);
	fac[0] = 1; for (int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
	ifac[n] = qpow(fac[n], mod - 2);
	for (int i = n; i; i--) ifac[i - 1] = 1ll * ifac[i] * i % mod;
	dfs(1, 0);
	int x = 0, y = 0;
	for (int i = 1; i <= n; i++)
		if (g[i] == mn) (x ? y : x) = i;
	if (y) cout << 1ll * fac[n / 2] * fac[n / 2] % mod;
	else {
		f[0] = 1; int sum = 0, ans = 0;
		for (auto u : E[x]) {
			dfs(u, x); memset(nf, 0, sizeof(nf));
			for (int i = 0; i <= sum; i++)
				for (int j = 0; j <= siz[u]; j++)
					nf[i + j] = (nf[i + j] + 1ll * f[i] * fac[siz[u]] % mod * fac[siz[u]] % mod * ifac[j] % mod * ifac[siz[u] - j] % mod * ifac[siz[u] - j]) % mod;
			swap(f, nf); sum += siz[u];
		}
		for (int i = 0; i < n; i++) ans = (ans + 1ll * f[i] * ((i & 1) ? mod - 1 : 1) % mod * fac[n - i]) % mod;
		cout << ans;
	}
	return 0;
}


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

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
int kai_size = 5001;
vel kai(kai_size, 1);
vel kai2;
vel ink(kai_size, 1);
vel ink2;
const int MAX_V = 5300;  // ツリーのサイズのありうる最大値

int n;  // ツリーのサイズ
vvel tree;  // ツリーを隣接リスト形式のグラフ構造で表したもの

vel sizeSubtree(MAX_V,1);  // sizeSubtree[v] := v を根とする部分ツリーのサイズ

vel dis(int mid1, vvel &way) {
	int n = way.size();
	vel dist(n, -1); dist[mid1] = 0;
	queue<int> q;
	q.push(mid1);
	while (!q.empty()) {
		int st = q.front(); q.pop();
		rep(i, way[st].size()) {
			int to = way[st][i];
			if (dist[to] == -1) {
				dist[to] = dist[st] + 1;
				q.push(to);
			}
		}
	}
	return dist;
}
int FindCentroids() {

	vel dist = dis(0,tree);
	vvel list_d(n);
	rep(i, n) {
		list_d[dist[i]].push_back(i);
	}
	for (int i = n - 1; i > 0; i--){
		for (auto v : list_d[i]) {
			for (auto nex : tree[v]) {
				if (dist[nex] > dist[v]) {
					sizeSubtree[v] += sizeSubtree[nex];
				}
			}
		}
	}
	rep(i, n) {
		bool is_center = true;
		for (auto ch : tree[i]) {
			if (dist[ch] > dist[i]) {
				if (sizeSubtree[ch] > n / 2) { is_center = false; }
			}
		}
		if (n - sizeSubtree[i] > n / 2) { is_center = false; }
		if (is_center) { return i; }
	}
	return 0;
}
int size_tree(int back, int now, vvel way) {
	int ans = 1;
	rep(j, way[now].size()) {
		int nex = way[now][j];
		if (nex != back) {
			ans += size_tree(now, nex, way);
		}
	}
	return ans;
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	kai2 = kai; ink2 = ink;
	rep(i, kai_size - 1) {
		kai[i + 1] = (kai[i] * (i + 1)) % p;
		kai2[i + 1] = kai[i + 1] * kai[i + 1];
		kai2[i + 1] %= p;
	}
	rep(i, kai_size) {
		ink[i] = inv(kai[i]);
		ink2[i] = ink[i] * ink[i];
		ink2[i] %= p;
	}
}
int RE() {
	vel v(3, 2);
	return v.at(4);
}
int comper(int n, int r) {
	int ans = kai2[n] * ink2[n - r];
	ans %= p;
	ans *= ink[r];
	return ans % p;
}
void pl(int &a, int b) {
	a += b; a %= p;
}
signed main() {
	make_kai();
	cin >> n;
	vel x(n), y(n);
	vvel way(n);
	rep(i, n - 1) {
		cin >> x[i] >> y[i]; x[i]--; y[i]--;
		way[x[i]].push_back(y[i]);
		way[y[i]].push_back(x[i]);
	}
	tree = way;
	int g = 1;
	vel sub(way[g].size());
	rep(i, way[g].size()) {
		sub[i]=size_tree(g, way[g][i], way);
	}
	sor(sub);
	int sz = way[g].size();
	vvel dp(2,vel(5010,0));
	dp[0][0] = 1;
	int sum = 0;
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:145:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
  145 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
const int mod = 1e9+7;
int ad(int x,int y) { x+=y; return x>=mod?x-mod:x; }
int sb(int x,int y) { x-=y; return x<0?x+mod:x; }
int mu(int x,int y) { return 1ll*x*y%mod; }
void up(int &x,int y) { x+=y; if(x>=mod)x-=mod; }
using namespace std;
vector<int>ve[5005];
int f[5005][5005];
int RT;
int n;
int V[5005],TT,sz[5005];
void dfs(int x,int ba) {
	sz[x] = 1; 
	int sso = 0;
	for(auto y:ve[x]) {
		if(y==ba) continue;
		dfs(y,x);
		sso = max(sso,sz[y]);
		sz[x] += sz[y];
	}
	sso = max(sso,n-sz[x]);
	if(sso<=n/2) RT = (RT?-1:x);
}
int fac[5005],inv[5005];
int A(int x,int y) {
	return mu(fac[x],inv[x-y]);
}
int C(int x,int y) {
	return mu(fac[x],mu(inv[x-y],inv[y]));
}

int main() {
	scanf("%d",&n);
	for(int i=1;i<n;i++) {
		int x,y; scanf("%d%d",&x,&y);
		ve[x].push_back(y);
		ve[y].push_back(x);
	}
	fac[0] = 1;
	for(int i=1;i<=n;i++) fac[i] = mu(fac[i-1],i);
	inv[0] = inv[1] = 1;
	for(int i=2;i<=n;i++) inv[i] = mu(inv[mod%i],mod-mod/i);
	for(int i=2;i<=n;i++) inv[i] = mu(inv[i-1],inv[i]);
	dfs(1,0);
	if(RT==-1) {
		printf("%d",mu(fac[n/2],fac[n/2]));
		return 0;
	}
	if(RT!=1) V[++TT] = n-sz[RT];
	for(auto y:ve[RT]) {
		if(sz[y]<sz[RT]) V[++TT] = sz[y];
	}
	f[0][0] = 1;
	int tot = 0;
	for(int i=1;i<=TT;i++) {
		tot += V[i];
		for(int j=0;j<=tot;j++) {
			for(int k=0;k<=min(sz[i],j);k++) {
				up(f[i][j],mu(f[i-1][j-k],mu( C(V[i],k),A(V[i],k) )));
			}
		}
	}
	int ans = 0;
	for(int i=0;i<n;i++) {
		if(i&1) ans = sb(ans,mu(f[TT][i],fac[n-i]));
		else ans = ad(ans,mu(f[TT][i],fac[n-i]));
	}
	printf("%d",ans);
}

Compiler output:
a.cc:11:1: error: 'vector' does not name a type
   11 | vector<int>ve[5005];
      | ^~~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:19:20: error: 've' was not declared in this scope
   19 |         for(auto y:ve[x]) {
      |                    ^~
a.cc: In function 'int main()':
a.cc:40:17: error: 've' was not declared in this scope
   40 |                 ve[x].push_back(y);
      |                 ^~
a.cc:54:20: error: 've' was not declared in this scope
   54 |         for(auto y:ve[RT]) {
      |                    ^~
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

#define pb push_back
#define fr first
#define sc second

const ll M = 1000000007;

ll fac[5002];
void init_fac(int MAX_N = 5000){
	fac[0] = 1;
	for(int i = 1 ; i <= MAX_N ; i ++){
		fac[i] = fac[i-1]*i;
		fac[i] %= M;
	}
}
ll C[5002][5002];
void init_C(int MAX_N = 5000, int MAX_K = 5000){
	C[0][0] = 1;
	for(int i = 0 ; i <= MAX_N ; i ++){
		for(int j = 0 ; j <= i ; j ++){
			C[i][j] %= M;
			C[i+1][j] += C[i][j];
			C[i+1][j+1] += C[i][j];
		}
	}
}

int N;
vector<int> G[5002];
ll ret[5002];

ll dp[2][5002] = {};
ll memo[5002];

int dfs(int v,int p){
	ret[v] = 1;
	
	vector<ll> vec;
	ll cnt = 1;
	for(int i = 0 ; i < G[v].size() ; i ++){
		if(G[v][i] == p)continue;
		vec.pb(dfs(G[v][i],v));
		cnt += vec[vec.size()-1];
	}
	if(p != 0)vec.pb(N-cnt);
	
	sort(vec.begin(),vec.end());
	reverse(vec.begin(),vec.end());
	if(vec[0] > N-vec[0]){
		ret[v] = 1;
	}
	else if(vec[0] == N-vec[0]){
		ret[v] *= fac[N-vec[0]];
		ret[v] %= M;
	}
	else {
		int t = 0 , t_ = 1;
		int sum = 0;
		dp[t][0] = 1;
		for(int i = 0 ; i < vec.size() ; i ++){
			int d = vec[i];
			for(int j = 0 ; j < 5002 ; j ++){
				dp[t_][j] = 0;
			}
			for(int m = 0 ; m <= min(sum,5000-sum) ; m ++){
				for(int k = 0 ; k <= d ; k ++){
					memo[k] = 1;
					memo[k] *= C[m][k];
					memo[k] *= C[d][k]; memo[k] %= M;
					memo[k] *= fac[k]; memo[k] %= M;
				}
				for(int n = max(0,m-d) ; n <= min(sum+d,min(m+d,5000-sum-d)) ; n ++){
					ll X = 0;
					int MAX_K = min(m+d-n,min(d,m));
					for(int k = max(0,m-n) ; k <= MAX_K ; ++k){
						if((k<<1) <= MAX_K){
							memo[k] *= memo[l];
							memo[k] %= M;
							memo[l] = memo[k];
						}
						X += memo[k];
						/*ll Y = memo[k];
						int l = m+d-n-k;
						Y *= memo[l];
						Y %= M;
						X += Y;*/
					}
					X %= M;
					dp[t_][n] += dp[t][m]*X;
					dp[t_][n] %= M;
				}
			}
			/*for(int n = 0 ; n <= min(sum+d,5000-sum-d) ; n ++){
				for(int m = max(0,n-d) ; m <= min(sum,min(n+d,5000-sum)) ; m ++){
					ll X = 0;
					for(int k = max(0,m-n) ; k <= min(m+d-n,m) ; k ++){
						ll Y = 1;
						Y *= C[m][k]; Y %= M;
						Y *= C[d][k]; Y %= M;
						Y *= fac[k]; Y %= M;
						int l = m+d-n-k;
						Y *= C[m][l]; Y %= M;
						Y *= C[d][l]; Y %= M;
						Y *= fac[l]; Y %= M;
						X += Y;
					}
					X %= M;
					dp[t_][n] += dp[t][m]*X;
					dp[t_][n] %= M;
				}
			}*/
			sum += d;
			swap(t,t_);
		}
		ret[v] = (dp[t][0]+dp[t][1])%M;
	}
	
	return cnt;
}

int main(){
	init_fac();
	init_C();
	
	scanf("%d",&N);
	for(int i = 0 ; i < N-1 ; i ++){
		int x,y;
		scanf("%d%d",&x,&y);
		G[x].pb(y);
		G[y].pb(x);
	}
	
	int root = 1;
	dfs(1,0);
	
	ll RET = 1;
	for(int i = 1 ; i <= N ; i ++){
		RET *= ret[i];
		RET %= M;
	}
	cout << RET << endl;
}



Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:88:73: error: 'l' was not declared in this scope
   88 |                                                         memo[k] *= memo[l];
      |                                                                         ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;

const int MOD = 1e9 + 7;

const int N = 5000001;
long long fact[N];
long long invfact[N];
long long inv[N];
void init() {
        fact[0] = fact[1] = 1;
        for (int i = 2; i < N; i ++) fact[i] = fact[i - 1] * i % MOD;
        inv[1] = 1;
        for (int i = 2; i < N; i ++) inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
        invfact[0] = invfact[1] = 1;
        for (int i = 2; i < N; i ++) invfact[i] = invfact[i - 1] * inv[i] % MOD;
}

int main() {
        init();
        int n;
        scanf("%d", &n);
        vector<vector<int>> g(n);
        bool easy = false;
        for (int i = 0; i < n - 1; i ++) {
                int a, b;
                scanf("%d%d", &a, &b);
                a --, b --;
                g[a].push_back(b);
                g[b].push_back(a);
        }
        vector<int> sz(n);
        function<void (int, int)> dfs = [&](int u, int prev) {
                sz[u] = 1;
                for (auto v : g[u]) if (v != prev) {
                        dfs(v, u);
                        sz[u] += sz[v];
                }
                if (sz[u] == n - sz[u]) {
                        easy = true;
                }
        };
        dfs(0, -1);
        if (easy) {
                long long ans = fact[n / 2] * fact[n / 2] % MOD;
                printf("%lld\n", ans);
        }
        return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: 'function' was not declared in this scope
   39 |         function<void (int, int)> dfs = [&](int u, int prev) {
      |         ^~~~~~~~
a.cc:8:1: note: 'std::function' is defined in header '<functional>'; this is probably fixable by adding '#include <functional>'
    7 | #include <set>
  +++ |+#include <functional>
    8 | using namespace std;
a.cc:39:32: error: expression list treated as compound expression in functional cast [-fpermissive]
   39 |         function<void (int, int)> dfs = [&](int u, int prev) {
      |                                ^
a.cc:39:18: error: expected primary-expression before 'void'
   39 |         function<void (int, int)> dfs = [&](int u, int prev) {
      |                  ^~~~
a.cc:49:9: error: 'dfs' was not declared in this scope
   49 |         dfs(0, -1);
      |         ^~~
Language: C++

#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
/*#### modular_arithmetic */
class modular_arithmetic{
public:
	int mod, range;

	modular_arithmetic(){
		mod = 1000000007;
	}
	//No specific settings.
	void set_mod(int _mod){mod = _mod;}
	int add(int x,int y){return (x+y)%mod;}
	int sub(int x,int y){return (x-y+mod)%mod;}
	int mul(int x,int y){return (int)((long long int)x*y%mod);}
	int pw(int x,int y){
		int r = 1;
		while(1){
			if(y&1)r=mul(r,x);
			if(y>>=1)x=mul(x,x);else
				break;
		}
		return r;
	}
};
/*####*/

modular_arithmetic ma;

int n;bool ff;
vector<int> e[5005];
int sz[5005];

int m,a[5005];
void dfs(int x,int fat){
	sz[x] = 1;
	int mx = 0;
	for(vector<int>::iterator it = e[x].begin(); it != e[x].end(); it++){
		int y = *it;
		if(y == fat)continue;
		dfs(y, x);
		sz[x] += sz[y];
		if(sz[y] + sz[y] == n){
			ff = true;
		}
		mx = max(mx, sz[y]);
	}
	mx = max(mx, n - sz[x]);
	if(mx + mx < n){
		a[m++] = n-sz[x];
		for(vector<int>::iterator it = e[x].begin(); it != e[x].end(); it++){
			int y = *it;
			if(y == fat)continue;
			a[m++] = sz[y];
		}
	}
}

int fac[5005],ifac[5005];
void init(){
	fac[0] = 1;
	for(int i=1; i<=n; i++)
		fac[i] = ma.mul(fac[i-1],i);
	ifac[n] = ma.pw(fac[n],ma.mod-2);
	for(int i=n; i>=1; i--)
		ifac[i-1] = ma.mul(ifac[i], i);
}

int d[5005],d2[5005];
int solve(){
	memset(d,0,sizeof(d));
	d[0] = 1;
	int N = 0;
	sort(a,a+m);
	for(int i=0; i<m; i++){
		memset(d2,0,sizeof(d2));
		for(int j=0; j<=N; j++)if(d[j])
			for(int k=0; k<=a[i]; k++){
				int W = ma.mul(fac[a[i]], ifac[a[i]-k]);
				W = ma.mul(W, W);
				W = ma.mul(W, ifac[k]);
				d2[j+k] = ma.add(d2[j+k], ma.mul(d[j], W));
			}
		memcpy(d,d2,sizeof(d2));
		N += a[i];
	}

	int res = 0;
	for(int i=0; i<=N; i++){
		int cur = ma.mul(d[i], fac[N-i]);
		if(i%2)res = ma.sub(res, cur);else
			res = ma.add(res, cur);
	}
	return res;
}


int solve_1(){
	init();
	int ret = solve();
	a[m++] = 1;
	return ma.add(ret, solve());
}

int main(){
	scanf("%d",&n);
	for(int i=1; i<n; i++){
		int x,y;
		scanf("%d%d",&x,&y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	ff = false;
	dfs(1,1);
	if(ff){
		int res = 1;
		for(int i=1; i+i<=n; i++)
			res = ma.mul(res, i);
		res = ma.mul(res, res);
		printf("%d\n",res);
	}else{
		printf("%d\n",solve_1());
	}
	return 0;
}


Compiler output:
a.cc: In function 'int solve()':
a.cc:76:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   76 |         sort(a,a+m);
      |         ^~~~
      |         short
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
using namespace std;

#define MAX 5002

int n;

vector<int> v[MAX];
int sz[MAX];

inline void dfs(int b, int pr = -1) {
	for (int go : v[b]) {
		if (go == pr)continue;
		dfs(go, b);
		sz[b] += sz[go];
	}
	sz[b]++;
}

vector<pair<int, int> > nd[MAX];

long long int C[MAX][MAX];

#define MOD 1000000007

inline long long int dfs3(int b, int pr = -1, int er = 0) {
	if (er == 0) {
		return 1;
	}
	int sum = 0;
	nd[b].push_back(make_pair(1, -1));
	sum++;
	for (int go : v[b]) {
		if (go == pr)continue;
		nd[b].push_back(make_pair(sz[go], go));
		sum += sz[go];
	}
	sort(nd[b].begin(), nd[b].end());
	int sum2 = nd[b].back().first;
	sum -= sum2;
	if (sum2 > sum) {
		if (sum * 2 < er) {
			return dfs3(nd[b].back().second, b, er - sum * 2);
		}
	}
	//(-max)*2<er
	int ALL = sum + sum2;
	long long int U = 0;
	int pass = 0;
	int minu = 0;
	for (int j = nd[b].size()-1; j>=0; j--) {
		int val = nd[b][j].first;
		int have = ALL - nd[b][j].first;
		if (j + 1 < nd[b].size()) {
			minu += pass*(nd[b][j+1].first - nd[b][j].first + 1);
		}
		for (int k = val; k >= 0; k--) {
			long long int way = C[val][val - k];
			int need = (er - 1) / 2;
			way *= C[have-minu][need-minu];
			way %= MOD;
			U += way;
			if (U >= MOD)U %= MOD;
		}
		pass++;
	}
	return U;
}
inline long long int dfs2(int b,int pr=-1) {
	vector<pair<int,int> > node;
	node.push_back({ 1,-1 });
	for (int go : v[b]) {
		if (go == pr)continue;
		node.push_back({sz[go],go });
	}
	sort(node.begin(), node.end());
	if (node.size() == 1) {
		//leaf
		return 1;
	}
	if (b == 0) {
		int sum = 0;
		for (int i = 0; i + 1 < node.size(); i++) {
			sum += node[i].first;
		}
		if (sum < node.back().first) {
			int need_er = node.back().first - sum;
			node.clear();
			return dfs3(node.back().second,b, node.back().first-sum);
		}
		else {
			puts("1");
			exit(0);
		}
		return;
	}
}
int main() {
	C[0][0] = 1;
	for (int i = 0; i+1 < MAX; i++) {
		for (int j = 0; j <= i; j++) {
			C[i + 1][j] += C[i][j];
			C[i + 1][j + 1] += C[i][j];
			C[i + 1][j] %= MOD;
			C[i + 1][j + 1] %= MOD;
		}
	}
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--;
		b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	dfs(0);
	printf("%lld\n",dfs2(0)%MOD);
	return 0;
}

Compiler output:
a.cc: In function 'long long int dfs2(int, int)':
a.cc:121:17: error: return-statement with no value, in function returning 'long long int' [-fpermissive]
  121 |                 return;
      |                 ^~~~~~
a.cc:123:1: warning: control reaches end of non-void function [-Wreturn-type]
  123 | }
      | ^
Language: C++

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const ll MOD = 1000000007;

int N;
vi g[5010];
int sz[5010];
int mc[5010];
ll fac[5010];
int par[5010];
int comb[5010][5010];

void dfs(int v, int p)
{
	sz[v] = 1;
	par[v] = p;

	for (int to : g[v]) if (to != p) {
		dfs(to, v);
		sz[v] += sz[to];
		mc[v] = max(mc[v], sz[to]);
	}

	if (p != -1) {
		mc[v] = max(mc[v], N - sz[v]);
	}
}

ll dp[5010][2][5010];

inline void add(ll &x, ll y) { x += y; if (x >= MOD) x %= MOD; }

int main() {
	fac[0] = 1;
	for (int i = 1; i < 5010; ++i) {
		fac[i] = fac[i-1] * i % MOD;
	}

	for (int i = 0; i < 5010; ++i) {
		comb[i][0] = comb[i][i] = 1;
		for (int j = 1; j < i; ++j) {
			comb[i][j] = (comb[i-1][j-1]+comb[i-1][j]) % MOD;
		} 
	}

	cin >> N;

	rep(i, N-1) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		g[a].pb(b);
		g[b].pb(a);
	}

	dfs(0, -1);

	int r = -1;

	rep(i, N) {
		if (r == -1 || mc[r] > mc[i]) {
			r = i;
		}
		if (sz[i] * 2 == N) {
			cout << fac[N/2] * fac[N/2] % MOD << endl;
			return 0;
		}
	}

	vi num;

	for (int to : g[r]) {
		if (to != par[r]) {
			num.pb(sz[to]);
		} else {
			num.pb(N-sz[r]);
		}
	}

	dp[0][0][0] = 1;
	dp[0][1][0] = 1;

	rep(i, num.size()) {
		int t = num[i];
		rep(f, 2) {
			rep(j, 5010) if (dp[i][f][j]) {
				for (int k = 0; k <= t; ++k) {
					if (j >= k) {
						ll mul = comb[j][k] % MOD * comb[t][k] % MOD * fac[k] % MOD * fac[k] % MOD; 
						add(dp[i+1][f][j+t-k*2], dp[i][j] * mul % MOD);
						if (f) {
							mul = mul * k % MOD;
							add(dp[i+1][0][j+1+t-k*2], dp[i][f][j] * mul % MOD);
						}
					}
				}
			}
		}
	}

	cout << dp[num.size()][0][0] << endl;

	for (int x:num) {
		cout<<x<<endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:104:83: error: invalid operands of types 'll [5010]' {aka 'long long int [5010]'} and 'll' {aka 'long long int'} to binary 'operator*'
  104 |                                                 add(dp[i+1][f][j+t-k*2], dp[i][j] * mul % MOD);
      |                                                                          ~~~~~~~~ ^ ~~~
      |                                                                                 |   |
      |                                                                                 |   ll {aka long long int}
      |                                                                                 ll [5010] {aka long long int [5010]}
Language: C++

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

int main() {
  int S1, S1, S1;
  cin >> S1 >> S2 >> S3;
  cout << S1+S2+S1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: redeclaration of 'int S1'
    5 |   int S1, S1, S1;
      |           ^~
a.cc:5:7: note: 'int S1' previously declared here
    5 |   int S1, S1, S1;
      |       ^~
a.cc:5:15: error: redeclaration of 'int S1'
    5 |   int S1, S1, S1;
      |               ^~
a.cc:5:7: note: 'int S1' previously declared here
    5 |   int S1, S1, S1;
      |       ^~
a.cc:6:16: error: 'S2' was not declared in this scope; did you mean 'S1'?
    6 |   cin >> S1 >> S2 >> S3;
      |                ^~
      |                S1
a.cc:6:22: error: 'S3' was not declared in this scope; did you mean 'S1'?
    6 |   cin >> S1 >> S2 >> S3;
      |                      ^~
      |                      S1
Language: Java

Scanner sc = new Scanner(System.in);

		String s = sc.next();
		System.out.println(s.replaceAll("0", "").length());

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
Scanner sc = new Scanner(System.in);
^
  (use --enable-preview to enable unnamed classes)
Main.java:4: error: class, interface, enum, or record expected
		System.out.println(s.replaceAll("0", "").length());
		^
2 errors
Language: C

#include <stdio.h>
int main () {
  char a;
  int b;
  scanf("%d",&a);
  b=0;
  if(a[0]==1){
    b=b+1;
  }
  if(a[1]==1){
    b=b+1;
  }
  if(a[2]==1){
    b=b+1;
  }
  printf("%d",b);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:7: error: subscripted value is neither array nor pointer nor vector
    7 |   if(a[0]==1){
      |       ^
main.c:10:7: error: subscripted value is neither array nor pointer nor vector
   10 |   if(a[1]==1){
      |       ^
main.c:13:7: error: subscripted value is neither array nor pointer nor vector
   13 |   if(a[2]==1){
      |       ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {

  string a;

  int cou;

  cin >> a ;

  if(a[0]=="1"){

   cou++;
  }
if(a[1]=="1"){
  

    cou++;
  
    }

  if(a[2]=="1"){

    cou++;


    }

  
cout<<cou<<endl;
  

  
 

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |   if(a[0]=="1"){
a.cc:17:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 | if(a[1]=="1"){
a.cc:24:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |   if(a[2]=="1"){
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {

  char a;

  int cou;

  cin >> a ;

  if(a[0]=="1"){

   cou=cou+1;

    }

  if(a[1]=="1"){

    cou=cou+1;

    }

  if(a[2]=="1"){

    cou=cou+1;

    }

  cout<<cou<<endl;

  cout <<avg2<< endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: invalid types 'char[int]' for array subscript
   13 |   if(a[0]=="1"){
      |       ^
a.cc:19:7: error: invalid types 'char[int]' for array subscript
   19 |   if(a[1]=="1"){
      |       ^
a.cc:25:7: error: invalid types 'char[int]' for array subscript
   25 |   if(a[2]=="1"){
      |       ^
a.cc:33:10: error: 'avg2' was not declared in this scope
   33 |   cout <<avg2<< endl;
      |          ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {

  char a;
  int cou;

  cin >> a ;

  if(a[0]==1){
   cou=cou+1;
    }
  if(a[1]==1){
    cou=cou+1;
    }
  if(a[2]==1){
    cou=cou+1;
    }
  cout<<cou<<endl;
  cout <<avg2<< endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: invalid types 'char[int]' for array subscript
   12 |   if(a[0]==1){
      |       ^
a.cc:15:7: error: invalid types 'char[int]' for array subscript
   15 |   if(a[1]==1){
      |       ^
a.cc:18:7: error: invalid types 'char[int]' for array subscript
   18 |   if(a[2]==1){
      |       ^
a.cc:22:10: error: 'avg2' was not declared in this scope
   22 |   cout <<avg2<< endl;
      |          ^~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
	int[] a;
    int ans; 
	cin >> a;
    if (a[0] == '1') {
      ans++;
    }
    if (a[1] == '1') {
      ans++;
    }
    if (a[2] == '1') {
      ans++;
    }
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:12: error: structured binding declaration cannot have type 'int'
    5 |         int[] a;
      |            ^~
a.cc:5:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:5:12: error: empty structured binding declaration
a.cc:5:15: error: expected initializer before 'a'
    5 |         int[] a;
      |               ^
a.cc:7:16: error: 'a' was not declared in this scope
    7 |         cin >> a;
      |                ^
Language: C++

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

int main() {
  int a,b,c;

  cin >> abc ;

  cout << a+b+c << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'abc' was not declared in this scope; did you mean 'abs'?
    7 |   cin >> abc ;
      |          ^~~
      |          abs
Language: C++

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

int main(){
  string s;
  cin >> s;
  
  int sum;
  if(s[0]== "1") sum++;
  if(s[1]== "1") sum++;
  if(s[2]== "1") sum++;
  
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |   if(s[0]== "1") sum++;
a.cc:10:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   10 |   if(s[1]== "1") sum++;
a.cc:11:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |   if(s[2]== "1") sum++;
Language: C++

#include<iostream>
#include <string>
 
int main()
{
	std::string str;
  	int counter = 0;
	std::cin >> str;
	if(s[0] == '1') counter++;
  	if(s[1] == '1') counter++;
  	if(s[2] == '1') counter++;
  
  	std::cout << counter << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: 's' was not declared in this scope
    9 |         if(s[0] == '1') counter++;
      |            ^
a.cc:10:12: error: 's' was not declared in this scope
   10 |         if(s[1] == '1') counter++;
      |            ^
a.cc:11:12: error: 's' was not declared in this scope
   11 |         if(s[2] == '1') counter++;
      |            ^
Language: C++

#include<iostream>
]using namespace std;
int main()
{
  int s;
  cin>>s;
  if(s==111){
    cout<<"3";
  }
  else if(s==000){
    cout<<"0";
  }
  else if(s==100||s==001||s==010){
    cout<<"1";
  }
  else if(s==110||s==101||s==011){
    cout<<"2";
  }
}

Compiler output:
a.cc:2:1: error: expected unqualified-id before ']' token
    2 | ]using namespace std;
      | ^
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin>>s;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |     cout<<"3";
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:11:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |     cout<<"0";
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:14:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   14 |     cout<<"1";
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:17:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |     cout<<"2";
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int a;
  cin>>a;
  int b[3];
  int k=0;
  for(int i=0;i<3;i++){
    b[i]=a%10;
    a=a/10;
    if(b[i]=="1")
      k++;
  }
  cout<<k<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |     if(b[i]=="1")
      |        ~~~~^~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int a;
  cin>>a;
  int b[3];
  int k=0;
  for(int i=0;i<3;i++){
    a[i]=b%10;
    b=b/10;
    if(b[i]=='1')
      k++;
  }
  cout<<k<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:6: error: invalid types 'int[int]' for array subscript
    9 |     a[i]=b%10;
      |      ^
a.cc:9:11: error: invalid operands of types 'int [3]' and 'int' to binary 'operator%'
    9 |     a[i]=b%10;
      |          ~^~~
      |          | |
      |          | int
      |          int [3]
a.cc:10:8: error: invalid operands of types 'int [3]' and 'int' to binary 'operator/'
   10 |     b=b/10;
      |       ~^~~
      |       | |
      |       | int
      |       int [3]
Language: C

#include <stdio.h>
int main(void)
{
  int i,a;
  int x = 0;
  for (i == 1;i <= 3;i++)
  {
    scanf("%d", &a);
    if (a == 1);
    {
      x++;
    }
    else
    {
    }
  }
  printf("%d", x);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:13:5: error: 'else' without a previous 'if'
   13 |     else
      |     ^~~~
Language: C

#include <stdio.h>
int main(void)
{
  int i,a;
  int x = 0;
  for (i == 1;i <= 3;i++)
  {
    scanf("%d", &a);
    if (a == 1);
    {
      x++;
    }
    else
    {
    }
  }
  printf("%d", b);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:5: error: 'else' without a previous 'if'
   13 |     else
      |     ^~~~
main.c:17:16: error: 'b' undeclared (first use in this function)
   17 |   printf("%d", b);
      |                ^
main.c:17:16: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int[] s = new int[3];
      s[0] = sc.nextInt();
      s[1] = sc.nextInt();
      s[2] = sc.nextInt();
      int ans=0;
      for(int i=0; i<3; i++)if(s[i]==1)ans++;
      return ans;
    }
}

Compiler output:
Main.java:12: error: incompatible types: unexpected return value
      return ans;
             ^
1 error
Language: C

#include<stdio.h>
#include<string.h>
int main()
{int i;
  char S[5]={};
 for(i=0;i<3;i++)
 {scanf("%c",s[i]);
 }
 

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:14: error: 's' undeclared (first use in this function)
    7 |  {scanf("%c",s[i]);
      |              ^
main.c:7:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main(){
 int ans = 0;
 string s;
 cin >> s;
  
 for(int i = 0; i < 3; i++){
  if(s[i] == '1'){
   ans++;
  }
}
}

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) sort(v.begin(), v.end())
typedef long long ll;
using Graph = vector<vector<int>>;
const int mod = 1000000007;

int main()
{
  string s;
  cin >> s;
  int ans = 0;
  rep(i, 3)
  {
    if (s.at(i) = "1")
    {
      ans++;
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   16 |     if (s.at(i) = "1")
      |                   ^~~
      |                   |
      |                   const char*