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

#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < ll , ll >
#define F first
#define S second
#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
/// khodaya komak kon
/// ya navid navid
const int N=2e5+1000,mod=1e9+7;
vector <int> g[N];
pii b[N];
vector <pair <pii,int> > a[N],q;
ll power(ll n,ll k){
    if (k==0) return 1;
    if (k%2==1){
        ll x=power(n,k/2);
        return x*x%mod*n%mod;
    }
    ll x=power(n,k/2);
    return x*x%mod;
}
ll fac[N];
ll cnt[N];
ll vis[N];
vector <int> ras;
ll dfs(ll v){
    vis[v]=1;
    ras.pb(v);
    cnt[b[v].S]++;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (vis[u]) continue;
        dfs(u);
    }
}
int32_t main(){
    fac[0]=1;
    for (int i=1;i<N;i++){
        fac[i]=fac[i-1]*i%mod;
    }
    ll n,x,y;
    cin >> n >> x >> y;
    for (int i=1;i<=n;i++){
        cin >> b[i].S >> b[i].F;
        q.pb({b[i],i});
        a[b[i].S].pb({b[i],i});
    }
    sort(q.begin(),q.end());
    ll o=-1;
    ll y=-1;
   // if (y<x) cout << 1/0;
    for (int i=1;i<q.size();i++){
        if (q[i].F.F+q[0].F.F<=y && q[0].F.S!=q[i].F.S){
            g[q[i].S].pb(q[0].S);
            g[q[0].S].pb(q[i].S);
        }
        if (q[0].F.S!=q[i].F.S && o==-1){
            o=i;
            continue;
        }
        if (o!=-1 && q[i].F.F+q[o].F.F<=y && q[o].F.S!=q[i].F.S){
            g[q[i].S].pb(q[o].S);
            g[q[o].S].pb(q[i].S);
        }

    }
    for (int i=1;i<q.size();i++){
        if (q[i].F.F+q[0].F.F<=y && q[0].F.S!=q[i].F.S){
            g[q[i].S].pb(q[0].S);
            g[q[0].S].pb(q[i].S);
        }
        if (q[0].F.S!=q[i].F.S && o==-1){
            o=i;
            continue;
        }
        if (o!=-1 && q[i].F.F+q[o].F.F<=y && q[o].F.S!=q[i].F.S){
            g[q[i].S].pb(q[o].S);
            g[q[o].S].pb(q[i].S);
        }

    }
    for (int i=0;i<N;i++){
        sort(a[i].begin(),a[i].end());
        for (int j=1;j<a[i].size();j++){
            if (a[i][j].F.F+a[i][0].F.F<=x){
                g[a[i][j].S].pb(a[i][0].S);
                g[a[i][0].S].pb(a[i][j].S);
            }
        }
    }
    ll ans=1;
    for (int i=1;i<=n;i++){
        if (vis[i]) continue;
        dfs(i);
        ll z=ras.size();
        ans*=fac[z];
        ans%=mod;
        for (int j=0;j<ras.size();j++){
            ll v=ras[j];
            ll z=cnt[b[v].S];
            cnt[b[v].S]--;
            ans*=power(z,mod-2);
            ans%=mod;
        }
        ras.clear();
    }
    cout << ans << endl;

}




Compiler output:
a.cc: In function 'll dfs(ll)':
a.cc:43:1: warning: no return statement in function returning non-void [-Wreturn-type]
   43 | }
      | ^
a.cc: In function 'int32_t main()':
a.cc:58:8: error: redeclaration of 'll y'
   58 |     ll y=-1;
      |        ^
a.cc:49:12: note: 'll y' previously declared here
   49 |     ll n,x,y;
      |            ^
Language: C++

#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < ll , ll >
#define F first
#define S second
#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
/// khodaya komak kon
/// ya navid navid
const int N=2e5+1000,mod=1e9+7;
vector <int> g[N];
pii b[N];
vector <pair <pii,int> > a[N],q;
ll power(ll n,ll k){
    if (k==0) return 1;
    if (k%2==1){
        ll x=power(n,k/2);
        return x*x%mod*n%mod;
    }
    ll x=power(n,k/2);
    return x*x%mod;
}
ll fac[N];
ll cnt[N];
ll vis[N];
vector <int> ras;
ll dfs(ll v){
    vis[v]=1;
    ras.pb(v);
    cnt[b[v].S]++;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (vis[u]) continue;
        dfs(u);
    }
}
int32_t main(){
    fac[0]=1;
    for (int i=1;i<N;i++){
        fac[i]=fac[i-1]*i%mod;
    }
    ll n,x,y;
    cin >> n >> x >> y;
    for (int i=1;i<=n;i++){
        cin >> b[i].S >> b[i].F;
        q.pb({b[i],i});
        a[b[i].S].pb({b[i],i});
    }
    sort(q.begin(),q.end());
    for (int i=1;i<q.size();i++){
        if (q[i].F.F+q[0].F.F<=y && q[0].F.S!=q[i].F.S){
            g[q[i].S].pb(q[0].S);
            g[q[0].S].pb(q[i].S);
        }
        if (q[0].F.S!=q[i].F.S && o==-1){
            o=i;
        }
        if (o!=0 && q[i].F.F+q[o].F.F<=y && q[o].F.S!=q[i].F.S){
            g[q[i].S].pb(q[o].S);
            g[q[o].S].pb(q[i].S);
        }

    }
    for (int i=0;i<N;i++){
        sort(a[i].begin(),a[i].end());
        for (int j=1;j<a[i].size();j++){
            if (a[i][j].F.F+a[i][0].F.F<=x){
                g[a[i][j].S].pb(a[i][0].S);
                g[a[i][0].S].pb(a[i][j].S);
            }
        }
    }
    ll ans=1;
    for (int i=1;i<=n;i++){
        if (vis[i]) continue;
        dfs(i);
        ll z=ras.size();
        ans*=fac[z];
        ans%=mod;
        for (int j=0;j<ras.size();j++){
            ll v=ras[j];
            ll z=cnt[b[v].S];
            cnt[b[v].S]--;
            ans*=power(z,mod-2);
            ans%=mod;
        }
        ras.clear();
    }
    cout << ans << endl;

}




Compiler output:
a.cc: In function 'll dfs(ll)':
a.cc:43:1: warning: no return statement in function returning non-void [-Wreturn-type]
   43 | }
      | ^
a.cc: In function 'int32_t main()':
a.cc:62:35: error: 'o' was not declared in this scope
   62 |         if (q[0].F.S!=q[i].F.S && o==-1){
      |                                   ^
a.cc:65:13: error: 'o' was not declared in this scope
   65 |         if (o!=0 && q[i].F.F+q[o].F.F<=y && q[o].F.S!=q[i].F.S){
      |             ^
Language: C++

#include<bits/stdc++.h>
#define mod 1000000007
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
int fact[200010],ifact[200010],c[200010],w[200010],mnw[200010],cnt[200010],p[200010];
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi(),X=gi(),Y=gi(),ans=1;
	fact[0]=1;for(int i=1;i<=n;++i)fact[i]=1ll*fact[i-1]*i%mod;
	ifact[n]=pow(fact[n],mod-2);for(int i=n;i;--i)ifact[i-1]=1ll*ifact[i]*i%mod;
	for(int i=0;i<=n;++i)mnw[i]=1e9;
	for(int i=1;i<=n;++i)c[i]=gi(),w[i]=gi(),mnw[c[i]]=std::min(mnw[c[i]],w[i]);
	for(int i=1;i<=n;++i)
		if(mnw[c[i]]+w[i]<=X)w[i]=mnw[c[i]],++cnt[c[i]];
		else if(w[i]==mnw[c[i]])++cnt[c[i]]
	int mn=0,cmn=0;
	for(int i=1;i<=n;++i){
		if(mnw[mn]>mnw[i])cmn=mn,mn=i;
		else if(mnw[cmn]>mnw[i])cmn=i;
	}
	int sz=cnt[mn];
	for(int i=1;i<=n;++i)if(c[i]!=mn&&mnw[mn]+w[i]<=Y)++sz,++p[c[i]];
	if(sz==cnt[mn])return puts("1"),0;
	for(int i=1;i<=n;++i)if(c[i]==mn&&w[i]!=mnw[mn]&&mnw[cmn]+w[i]<=Y)++sz,++p[c[i]];
	p[mn]+=cnt[mn];
	ans=fact[sz];
	for(int i=1;i<=n;++i)ans=1ll*ans*ifact[p[i]]%mod;
	printf("%d\n",ans);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:52: error: expected ';' before 'int'
   32 |                 else if(w[i]==mnw[c[i]])++cnt[c[i]]
      |                                                    ^
      |                                                    ;
   33 |         int mn=0,cmn=0;
      |         ~~~                                         
a.cc:35:24: error: 'mn' was not declared in this scope; did you mean 'n'?
   35 |                 if(mnw[mn]>mnw[i])cmn=mn,mn=i;
      |                        ^~
      |                        n
a.cc:35:35: error: 'cmn' was not declared in this scope
   35 |                 if(mnw[mn]>mnw[i])cmn=mn,mn=i;
      |                                   ^~~
a.cc:36:29: error: 'cmn' was not declared in this scope
   36 |                 else if(mnw[cmn]>mnw[i])cmn=i;
      |                             ^~~
a.cc:38:20: error: 'mn' was not declared in this scope; did you mean 'n'?
   38 |         int sz=cnt[mn];
      |                    ^~
      |                    n
a.cc:41:62: error: 'cmn' was not declared in this scope
   41 |         for(int i=1;i<=n;++i)if(c[i]==mn&&w[i]!=mnw[mn]&&mnw[cmn]+w[i]<=Y)++sz,++p[c[i]];
      |                                                              ^~~
Language: C

#include <iostream>
#include <cstring>
using namespace std;
typedef long long LL;
const int maxn = 1000005;
const int inf = 0x3f3f3f3f;
const int mod = 1000000007;
int n, A, B;
int fac[maxn], inv[maxn];
int c[maxn], w[maxn], minci[maxn];
int Gs[maxn];
inline int pow(int a, int b)
{
    int ans = 1;
    for(; b; b >>= 1, a = (LL) a * a % mod)
        if(b & 1)
            ans = (LL) ans * a % mod;
    return ans;
}
inline int C(int n, int m)
{
    if(!n)
        return 1;
    if(m < n)
        return 0;
    return (LL) fac[m] * (LL) inv[m - n] % mod * (LL) inv[n] % mod;
}
int main()
{
    scanf("%d%d%d", &n, &A, &B);
    memset(minci, 0x3f, sizeof(minci));
    for(int i = 1; i <= n; ++i)
    {
        scanf("%d%d", &c[i], &w[i]);
        minci[c[i]] = min(minci[c[i]], w[i]);
    }
    int minn = 0, minnn = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(minci[i] < minci[minn])
        {
            minnn = minn;
            minn = i;
        }
        else if(minci[i] < minci[minnn])
            minnn = i;
    }
    int gss = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] + minci[c[i]] <= A)
            w[i] = minci[c[i]];
        if(c[i] == minn && minci[minnn] + w[i] <= B)
        {
            Gs[c[i]]++;
            gss++;
        }
        if(c[i] != minn && minci[minn] + w[i] <= B)
        {
            Gs[c[i]]++;
            gss++;
        }
    }
    int ans = 1;
    fac[0] = 1;
    for(int i = 1; i <= n; ++i)
        fac[i] = (LL) i * fac[i - 1] % mod;
    inv[n] = pow(fac[n], mod - 2);
    for(int i = n - 1; ~i; --i)
        inv[i] = (LL) inv[i + 1] * (i + 1) % mod;
    for(int i = 1; i <= n; ++i)
    {
        if(Gs[i])
        {
            ans = (LL) ans * (LL) C(Gs[i], gss) % mod;
            gss -= Gs[i];
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;


typedef long long LL;


typedef pair <int, int> pr;


const int N = 2e5 + 10;

const int INF = 2e9;


const LL mod = 1e9 + 7;


inline LL power(LL a, LL n, LL mod)
{
	LL Ans = 1;
	while (n)
	{
		if (n & 1) Ans = Ans * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return Ans;
}


namespace ufs
{
	int parent[N];

	void init(int n) { for (int i = 1; i <= n; i++) parent[i] = i; }

	inline int findrt(int x) { return parent[x] == x ? x : parent[x] = findrt(parent[x]); }

	void merge(int x, int y)
	{
		x = findrt(x), y = findrt(y);
		parent[x] = y;
	}
}


int col[N], w[N];
int n, X, Y;

pr minv[N];
vector <int> vec[N];
int cnt[N];


LL fac[N], ifac[N];

inline LL calc(int n, int m) { return n < m ? 0 : fac[n] * ifac[m] % mod * ifac[n-m] % mod; }


int main()
{
	cin >> n >> X >> Y;
	
	fac[0] = 1;
	for (int i = 1; i <= n; i++) fac[i] = fac[i-1] * i % mod;
	ifac[n] = power(fac[n], mod-2, mod);
	for (int i = n-1; i >= 0; i--) ifac[i] = ifac[i+1] * (i+1) % mod;
	
	int maxc = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d %d", &col[i], &w[i]);
		maxc = max(maxc, col[i]);
	}
	for (int i = 1; i <= maxc; i++) minv[i] = make_pair(INF, INF);
	
	for (int i = 1; i <= n; i++)
	{
		minv[col[i]] = make_pair(w[i], i);
		vec[col[i]].push_back(i);
	}
	
	ufs::init(n);
	
	for (int i = 1; i <= maxc; i++)
	{
		for (auto id : vec[i])
			if (w[id] + minv[i].first <= X)
				ufs::merge(id, minv[i].second);
	}
	
	pr mn = make_pair(INF, INF), mn2 = make_pair(INF, INF);
	for (int i = 1; i <= n; i++)
	{
		pr tmp = make_pair(w[i], i);
		mn = min(mn, tmp);
	}
	for (int i = 1; i <= n; i++)
	{
		pr tmp = make_pair(w[i], i);
		if (col[i] != col[mn.second])
			mn2 = min(mn2, tmp);
	}
	
	for (int i = 1; i <= n; i++)
		if (col[mn.second] != col[i] && mn.first + w[i] <= Y)
			ufs::merge(mn.second, i);
		else if (mn2.first != INF && col[mn2.second] != col[i] && mn2.first + w[i] <= Y)
			ufs::merge(mn2.second, i);
	
	for (int i = 1; i <= n; i++)
		if (ufs::findrt(i) == ufs::findrt(mn.second))
			cnt[col[i]]++;
	
	int all = 0;
	for (int i = 1; i <= maxc; i++)
		all += cnt[i];
	
	LL Ans = 1;
	for (int i = 1; i <= maxc; i++)
		if (cnt[i])
			Ans = Ans * calc(all, cnt[i]) % mod,
			all -= cnt[i];
	
	printf("%lld\n", Ans);
	
	return 0;
}

Compiler output:
a.cc:57:1: error: 'vector' does not name a type
   57 | vector <int> vec[N];
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:86:17: error: 'vec' was not declared in this scope
   86 |                 vec[col[i]].push_back(i);
      |                 ^~~
a.cc:93:32: error: 'vec' was not declared in this scope
   93 |                 for (auto id : vec[i])
      |                                ^~~
Language: C++

#include <bits/stdc++.h>
#define mod 1000000007ll
#define M 200010
using namespace std;
struct edge
{
	int to;
	int nxt;
}e[3000010];
int n,minnum,minnum2;
int color[M],dlfl[M],pos[M],vis[M];
long long val[M],minn[M];
long long fac[M],rfac[M];
long long X,Y;
int head[M],cnt;
void addedge(int x,int y)
{
	e[++cnt].nxt = head[x];
	e[cnt].to = y;
	head[x] = cnt;
}
void add(int x,int y)
{
	addedge(x,y);
	addedge(y,x);
}
long long qpow(long long a,long long b)
{
	long long ans = 1,res = a;
	while(b)
	{
		if(b&1)ans = (ans * res) % mod;
		res *= res;
		res %= mod;
		b >>= 1;
	}
	return ans;
}
long long C(long long n,long long k)
{
	return  fac[n] * rfac[k] % mod * rfac[n - k] % mod;
}
void init()
{
	fac[0] = 1;
	for(int i = 1;i <= n;i++)fac[i] = (i * fac[i - 1]) % mod;
	rfac[n] = qpow(fac[n],mod - 2);
	for(int i = n; i > 0; i--)rfac[i - 1] = (i * rfac[i]) % mod;
}
void dfs(int x)
{
	vis[x] = 1;
	for(int i = head[x]; i; i = e[i].nxt)
	{
		if(!vis[e[i].to])dfs(e[i].to);
	}
}
void find()
{
	for(int i = 1; i <= n; i++)
	{
		if(val[i] < min1)
		{
			min1 = val[i];
			minnum = i;
		}
	}
	for(int i = 1; i <= n; i++)
	{
		if(val[i] <= min2 && color[i] != color[minnum])
		{
			min2 = val[i];
			minnum2 = i;
		}
	}
}
int main()
{
	scanf("%d%lld%lld",&n,&X,&Y);
	init();
	for(int i = 1;i <= n;i++)minn[i] = 2147483647ll;
	for(int i = 1;i <= n;i++)scanf("%d%lld",&color[i],&val[i]);
	for(int i = 1;i <= n;i++)
	{
		if(val[i] < minn[color[i]])
		{
			minn[color[i]] = val[i];
			pos[color[i]] = i;
		}
	}
	for(int i = 1; i <= n; i++)
	{
		if(i != pos[color[i]] && val[i] + minn[color[i]] <= X)
		{
			add(i,pos[color[i]]);
		}
	}
	long long min1 = 2147483647ll,min2 = 2147483647ll;
	find();
	for(int i = 1; i <= n; i++)
	{
		if(i != minnum)
		{
			if(color[i] != color[minnum] && val[i] + val[minnum] <= Y)
			{
				add(i,minnum);
			}
			if(minnum2 && color[i] != color[minnum2] && val[i] + val[minnum2] <= Y)
			{
				add(i,minnum2);
			}
		}
		
	}
	dfs(minnum);
	long long fldl = 0;
	for(int i = 1; i <= n; i++)
	{
		if(vis[i])
		{
			dlfl[color[i]]++;
		}
	}
	for(int i = 1;i <= n;i++)fldl += dlfl[i];
	long long ans = 1;
	for(int i = 1; i <= n; i++)
	{
		if(dlfl[i])
		{
			ans *= C(fldl,dlfl[i]);
			ans %= mod;
			fldl -= dlfl[i];
		}
	}
	printf("%lld",ans);
	return 0;
}

Compiler output:
a.cc: In function 'void find()':
a.cc:62:29: error: 'min1' was not declared in this scope; did you mean 'minn'?
   62 |                 if(val[i] < min1)
      |                             ^~~~
      |                             minn
a.cc:70:30: error: 'min2' was not declared in this scope; did you mean 'minn'?
   70 |                 if(val[i] <= min2 && color[i] != color[minnum])
      |                              ^~~~
      |                              minn
Language: C++

#include <bits/stdc++.h>

inline int read() {
	int ret, cc;
	while (!isdigit(cc = getchar()));
	ret = cc - 48;
	while ( isdigit(cc = getchar()))
		ret = cc - 48 + ret * 10;
	return ret;
}

const int MOD = 1000000007;
inline int add(int a, int b) { return (a += b) >= MOD ? a - MOD : a; }
inline int sub(int a, int b) { return (a -= b) <    0 ? a + MOD : a; }
inline int mul(int a, int b) { return 1ll * a * b % MOD; }
inline int qpow(int a, int p) {
	int ret = 1;
	for (; p; p >>= 1, a = mul(a, a))
		if (p & 1) ret = mul(ret, a);
	return ret;
}


const int MAXN = 200010;

int fac[MAXN];
int inv[MAXN];

int col[MAXN];
int val[MAXN];
std::vector<int> node[MAXN];
int ans[MAXN];
int root[MAXN];
int n, X, Y;

int main() {
#ifdef ARK
	freopen("test.in", "r", stdin);
#endif
	n = read(), X = read(), Y = read();
	val[0] = 0x3f3f3f3f;
	for (int i = 1; i <= n; ++i) {
		size[i] = 1, pa[i] = i;
		col[i] = read(), val[i] = read();
		if (val[i] < val[root[col[i]]]) 
			root[col[i]] = i;
		if (val[i] < val[root[0]])
			root[0] = i;
		node[col[i]].push_back(i);
	}
	for (int i = 1; i <= n; ++i) {
		if (root[i] != root[0]) {
			int cnt = 1;
			for (auto x : node[i]) if (x != root[i]) {
				if (val[x] + val[root[i]] <= X) cnt++;
				else if (val[x] + val[root[0]] <= Y) ans[i]++;
			}
			if (val[root[i]] + val[root[0]] <= Y) ans[i] += cnt;
		} else {
			ans[i] = 1;
			for (auto x : node[i]) if (x != root[i]) {
				if (val[x] + val[root[i]] <= X) ans[i]++;
			}
		}
	}
	fac[0] = 1;
	for (int i = 1; i <= n; ++i) fac[i] = mul(fac[i - 1], i);
	inv[n] = qpow(fac[n], MOD - 2);
	for (int i = n; i >= 1; --i) inv[i - 1] = mul(inv[i], i);
	int res1 = 1, res2 = 0;
	for (int i = 1; i <= n; ++i) 
		res1 = mul(res1, inv[ans[i]]), res2 += ans[i];
	printf("%d\n", mul(fac[res2], res1));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: 'size' was not declared in this scope; did you mean 'std::size'?
   43 |                 size[i] = 1, pa[i] = i;
      |                 ^~~~
      |                 std::size
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: 'std::size' declared here
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
a.cc:43:30: error: 'pa' was not declared in this scope
   43 |                 size[i] = 1, pa[i] = i;
      |                              ^~
Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#define LL long long
#define maxn 2000005
#define mod 1000000007
#define INF (LL)1e16
using namespace std;
typedef pair<LL,int> PLI;
LL n,ans,c[maxn],Siz,cnt[maxn],fact[maxn],inv[maxn],mnp[maxn],Mnp2,Mnp;
LL w[maxn],x,y,Mn=INF,Mn2=INF,mn[maxn];
bool vis[maxn];
vector<PLI> cw[maxn];
struct node { LL v; node *nxt; } edge[maxn*75],*head[maxn],*ncnt;
void addedge(LL u,LL v)
{
	ncnt++;
	ncnt->v=v,ncnt->nxt=head[u];
	head[u]=ncnt;
}
void dfs(LL u)
{
	vis[u]=true;
	cnt[c[u]]++,Siz++;
	for(node *p=head[u];p;p=p->nxt)
	{
		LL v=p->v;
		if(!vis[v]) dfs(v);
	}
}
int main()
{
	scanf("%lld%lld%lld",&n,&x,&y);
	fact[0]=1;
	for(LL i=1;i<=n;i++) fact[i]=1ll*fact[i-1]*i%mod;
	inv[1]=1;
	for(LL i=2;i<=n;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	inv[0]=1;
	for(LL i=1;i<=n;i++) inv[i]=1ll*inv[i]*inv[i-1]%mod;
	ncnt=&edge[0];
	for(LL i=1;i<=n;i++) mn[i]=INF;
	for(LL i=1;i<=n;i++) 
	{
		scanf("%lld%lld",&c[i],&w[i]);
		if(mn[c[i]]>w[i]) mn[c[i]]=w[i],mnp[c[i]]=i;
		if(Mn>w[i]) Mn=w[i],Mnp=i;//Mn=min(Mn,w[i]);
	}
	for(LL i=1;i<=n;i++)
		if(c[i]!=c[Mnp]&&Mn2>w[i]) Mn2=w[i],Mnp2=i;
	for(LL i=1;i<=n;i++)
		if(i!=mnp[c[i]]&&mn[c[i]]+w[i]<=x) { addedge(i,mnp[c[i]]); addedge(mnp[c[i]],i); }
	for(LL i=1;i<=n;i++)
	{
		if(i==Mnp) continue;
		else if(c[i]!=c[Mnp]&&Mn+w[i]<=y) { addedge(i,Mnp); addedge(Mnp,i); }
		else if(Mn2!=INF&&c[i]!=c[Mn2]&&Mn2+w[i]<=y) { addedge(i,Mnp2); addedge(Mnp2,i); }
	}
	dfs(Mnp);
	ans=fact[Siz];
	for(LL i=1;i<=n;i++) ans=1ll*ans*inv[cnt[i]]%mod;
	printf("%lld\n",ans);
}

Compiler output:
/tmp/cc8uo8oB.o: in function `addedge(long long, long long)':
a.cc:(.text+0xf): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/cc8uo8oB.o
a.cc:(.text+0x1a): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/cc8uo8oB.o
a.cc:(.text+0x21): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/cc8uo8oB.o
a.cc:(.text+0x2f): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/cc8uo8oB.o
a.cc:(.text+0x42): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/cc8uo8oB.o
a.cc:(.text+0x51): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/cc8uo8oB.o
a.cc:(.text+0x64): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/cc8uo8oB.o
/tmp/cc8uo8oB.o: in function `dfs(long long)':
a.cc:(.text+0xee): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/cc8uo8oB.o
/tmp/cc8uo8oB.o: in function `main':
a.cc:(.text+0x370): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/cc8uo8oB.o
collect2: error: ld returned 1 exit status
Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#define LL long long
#define maxn 2000005
#define mod 1000000007
#define INF (LL)1e16
using namespace std;
typedef pair<LL,int> PLI;
LL n,ans,c[maxn],Siz,cnt[maxn],fact[maxn],inv[maxn],mnp[maxn],Mnp2,Mnp;
LL w[maxn],x,y,Mn=INF,Mn2=INF,mn[maxn];
bool vis[maxn];
vector<PLI> cw[maxn];
struct node { LL v; node *nxt; } edge[maxn*75],*head[maxn],*ncnt;
void addedge(LL u,LL v)
{
	ncnt++;
	ncnt->v=v,ncnt->nxt=head[u];
	head[u]=ncnt;
}
void dfs(LL u)
{
	vis[u]=true;
	cnt[c[u]]++,Siz++;
	for(node *p=head[u];p;p=p->nxt)
	{
		LL v=p->v;
		if(!vis[v]) dfs(v);
	}
}
int main()
{
	scanf("%d%lld%lld",&n,&x,&y);
	fact[0]=1;
	for(LL i=1;i<=n;i++) fact[i]=1ll*fact[i-1]*i%mod;
	inv[1]=1;
	for(LL i=2;i<=n;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	inv[0]=1;
	for(LL i=1;i<=n;i++) inv[i]=1ll*inv[i]*inv[i-1]%mod;
	ncnt=&edge[0];
	for(LL i=1;i<=n;i++) mn[i]=INF;
	for(LL i=1;i<=n;i++) 
	{
		scanf("%d%lld",&c[i],&w[i]);
		if(mn[c[i]]>w[i]) mn[c[i]]=w[i],mnp[c[i]]=i;
		if(Mn>w[i]) Mn=w[i],Mnp=i;//Mn=min(Mn,w[i]);
	}
	for(LL i=1;i<=n;i++)
		if(c[i]!=c[Mnp]&&Mn2>w[i]) Mn2=w[i],Mnp2=i;
	for(LL i=1;i<=n;i++)
		if(i!=mnp[c[i]]&&mn[c[i]]+w[i]<=x) { addedge(i,mnp[c[i]]); addedge(mnp[c[i]],i); }
	for(LL i=1;i<=n;i++)
	{
		if(i==Mnp) continue;
		else if(c[i]!=c[Mnp]&&Mn+w[i]<=y) { addedge(i,Mnp); addedge(Mnp,i); }
		else if(Mn2!=INF&&c[i]!=c[Mn2]&&Mn2+w[i]<=y) { addedge(i,Mnp2); addedge(Mnp2,i); }
	}
	dfs(Mnp);
	ans=fact[Siz];
	for(LL i=1;i<=n;i++) ans=1ll*ans*inv[cnt[i]]%mod;
	printf("%d\n",ans);
}


Compiler output:
/tmp/ccq0wKvd.o: in function `addedge(long long, long long)':
a.cc:(.text+0xf): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/ccq0wKvd.o
a.cc:(.text+0x1a): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/ccq0wKvd.o
a.cc:(.text+0x21): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/ccq0wKvd.o
a.cc:(.text+0x2f): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/ccq0wKvd.o
a.cc:(.text+0x42): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccq0wKvd.o
a.cc:(.text+0x51): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/ccq0wKvd.o
a.cc:(.text+0x64): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccq0wKvd.o
/tmp/ccq0wKvd.o: in function `dfs(long long)':
a.cc:(.text+0xee): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccq0wKvd.o
/tmp/ccq0wKvd.o: in function `main':
a.cc:(.text+0x370): relocation truncated to fit: R_X86_64_PC32 against symbol `ncnt' defined in .bss section in /tmp/ccq0wKvd.o
collect2: error: ld returned 1 exit status
Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#define LL long long
#define maxn 200005
#define mod 1000000007
#define INF (LL)1e16
using namespace std;
typedef pair<LL,int> PLI;
LL n,ans,c[maxn],Siz,cnt[maxn],fact[maxn],inv[maxn],mnp[maxn],Mnp2,Mnp;
LL w[maxn],x,y,Mn=INF,Mn2=INF,mn[maxn];
bool vis[maxn];
vector<PLI> cw[maxn];
struct node { LL v; node *nxt; } edge[maxn*75],*head[maxn],*ncnt;
void addedge(LL u,LL v)
{
	ncnt++;
	ncnt->v=v,ncnt->nxt=head[u];
	head[u]=ncnt;
}
void dfs(LL u)
{
	vis[u]=true;
	cnt[c[u]]++,Siz++;
	for(node *p=head[u];p;p=p->nxt)
	{
		LL v=p->v;
		if(!vis[v]) dfs(v);
	}
}
LL main()
{
	freopen("colorball.in","r",stdin);
	freopen("colorball.out","w",stdout);
	scanf("%d%lld%lld",&n,&x,&y);
	fact[0]=1;
	for(LL i=1;i<=n;i++) fact[i]=1ll*fact[i-1]*i%mod;
	inv[1]=1;
	for(LL i=2;i<=n;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	inv[0]=1;
	for(LL i=1;i<=n;i++) inv[i]=1ll*inv[i]*inv[i-1]%mod;
	ncnt=&edge[0];
	for(LL i=1;i<=n;i++) mn[i]=INF;
	for(LL i=1;i<=n;i++) 
	{
		scanf("%d%lld",&c[i],&w[i]);
		if(mn[c[i]]>w[i]) mn[c[i]]=w[i],mnp[c[i]]=i;
		if(Mn>w[i]) Mn=w[i],Mnp=i;//Mn=min(Mn,w[i]);
	}
	for(LL i=1;i<=n;i++)
		if(c[i]!=c[Mnp]&&Mn2>w[i]) Mn2=w[i],Mnp2=i;
	for(LL i=1;i<=n;i++)
		if(i!=mnp[c[i]]&&mn[c[i]]+w[i]<=x) { addedge(i,mnp[c[i]]); addedge(mnp[c[i]],i); }
	for(LL i=1;i<=n;i++)
	{
		if(i==Mnp) continue;
		else if(c[i]!=c[Mnp]&&Mn+w[i]<=y) { addedge(i,Mnp); addedge(Mnp,i); }
		else if(Mn2!=INF&&c[i]!=c[Mn2]&&Mn2+w[i]<=y) { addedge(i,Mnp2); addedge(Mnp2,i); }
	}
	dfs(Mnp);
	ans=fact[Siz];
	for(LL i=1;i<=n;i++) ans=1ll*ans*inv[cnt[i]]%mod;
	printf("%d\n",ans);
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
#define x first
#define y second
#define y1 secondy1
#define rank tipa_rank
#define pb push_back
#define mp make_pair
#define pow10 tipa_pow10
#define ll long long
#define INF 1000000000
#define EPS 1e-9
#define EPS2 1e-8
#define PI acos(-1.0)
using namespace std;
const int MOD = INF + 7;
int n , x, y;
int cntByColour[200000];
int c[200000] , w[200000];
int goodPos[200000];
ll fact[200005];
bool good[200000];
vector<int> colWeight[200000];
vector<pair<int , int> >  weight;
ll mod = 1000 * 1000 * 1000 + 7;
ll gcdExtended(ll a, ll b, ll *x, ll *y);

// Function to find modulo inverse of a
ll modInverse(ll a, ll m)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    if (g != 1)
        cout << "Inverse doesn't exist";
    else
    {
        // m is added to handle negative x
        ll res = (x%m + m) % m;
        return res;
    }
}

// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}
int main()
{
	fact[0] = 1;
	for(int i = 1; i <= 200000; i++)
		fact[i] = (fact[i - 1] * i) % MOD;
	scanf("%d %d %d" , &n , &x , &y);
	for(int i = 0; i < n; i++)
	{
		scanf("%d %d" , &c[i] , &w[i]);
		c[i]--;
		colWeight[c[i]].pb(w[i]);
		weight.pb(mp(w[i] , c[i]));
	}
	sort(weight.begin() , weight.end());
	for(int i = 0; i < n; i++)
		sort(colWeight[i].begin() , colWeight[i].end());
	ll ans = 1;
	auto it = lower_bound(weight.begin() , weight.end() , mp(y - weight[0].first + 1, 0));
	//cout << it->first << " " << it->second << endl;

	for(auto it2 = weight.begin(); it2 != it; it2++)
	{
		good[it2->second] = true;
		cntByColour[it2->second]++;
	}

	int cnt = 0;
	for(int i = 0; i < n; i++)
	{
		if(!good[i])
			continue;
		if(!colWeight[i].size())
			continue;
		auto It = upper_bound(colWeight[i].begin() , colWeight[i].end() , x - colWeight[i][0]);
		for(auto it2 = colWeight[i].begin(); it2 != It; it2++)
		{
			if(!binary_search(weight.begin() , it , mp(*it2 , i)))
			{
				cntByColour[i]++;
				cnt++;
			}
			else
			{
				int x = lower_bound(weight.begin() , it , mp(*it2 , i)) - weight.begin();
				goodPos[x] = 1;
			}

		}
	}
	for(int i = 0; i < weight.size(); i++)
	{
		if(!goodPos[i])
		{
			cnt--;
			cntByColor[weight[i].second]--;
		}
	}
	ans *= fact[it - weight.begin() + cnt];
	for(int i = 0; i < n; i++)
	{
		ans *= modInverse(fact[cntByColour[i]] , MOD);
		ans %= MOD;
	}
	ans %= MOD;
	cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:116:25: error: 'cntByColor' was not declared in this scope; did you mean 'cntByColour'?
  116 |                         cntByColor[weight[i].second]--;
      |                         ^~~~~~~~~~
      |                         cntByColour
a.cc: In function 'long long int modInverse(long long int, long long int)':
a.cc:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^
Language: C++

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define v edge[i].to
#define mp(a, b) make_pair(a, b)

using namespace std;

const int N = 200010;
const int mod = 1e9 + 7;
typedef long long LL;
typedef pair<int, int> pii;
vector<pii> b;
vector<int> t[N];
int n, x, y, lc[N], col[N], ls[N], tc[N], w[N];

#define bi b[i].second

int f[N], st[N];
int f_f(int x) { return x == f[x] ? x : f[x] = f_f(f[x]);} 

void merge(int x1, int x2)
{
	int f1 = f_f(x1), f2 = f_f(x2);
	if (f1 != f2) f[f1] = f2;
}

LL p[N];
LL qpow(LL a, LL b)
{
	LL ret = 1, base = a;
	while (b) {
		if (b & 1) ret = ret * base % mod;
		base = base * base % mod, b >>= 1;
	}
	return ret;
}
LL C(int a, int b) {return p[a] * qpow(p[b], mod - 2) % mod * qpow(p[a - b], mod - 2) % mod;}

int main()
{
	scanf("%d%d%d", &n, &x, &y);
	Rep(i, n){
		scanf("%d%d", &col[i], &w[i]);
		b.push_back(mp(w[i], i));
		f[i] = i;
	}
	sort(b.begin(), b.end());
	
	memset(ls, -1, sizeof(ls));
	ls[col[b[0]].second] = 0;
	Rep(i, n - 1){
		int tmp = ls[col[bi]];
		if (tmp != -1 && b[i].first + b[tmp].first <= x) merge(bi, b[tmp].second);
		if (col[bi] != col[b[0].second] && b[i].first + b[0].first <= y) merge(bi, b[0].second);
		if (!ls[col[bi]]) ls[col[bi]] = i;
	}
	
	Rep(i, n) t[f_f(i)].push_back(col[i]);
	p[0] = 1;
	Rep(i, n) p[i] = p[i - 1] * i % mod;
	
	LL ans = 1;
	
	Rep(i, n) if (t[i].size()) {
		sort(t[i].begin(), t[i].end());	
		int top = 0, cnt = 0;
		for (int j = 0; j < t[i].size(); j ++){
			if (t[i][j] != t[i][j - 1] && j != 0) st[++ top] = cnt, cnt = 0;
			cnt ++;
		}
		int tmp = cnt;
		LL tans = 1;
		while (top){
			tans = tans * C(tmp + st[top], st[top]) % mod;
			tmp += st[top], top --;
		}
		ans = ans * tans % mod;
	}
	printf("%lld\n", ans);
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:15: error: no match for 'operator[]' (operand types are 'int [200010]' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'})
   56 |         ls[col[b[0]].second] = 0;
      |               ^
Language: C++

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

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define pb push_back

using namespace std;

const int Mod = 1e9 + 7;
const int N = 200010;

typedef long long LL;

LL Pow(LL x, LL e){
	LL ret = 1;
	while(e){
		if(e & 1) ret = ret * x % Mod;
		x = x * x % Mod;
		e >>= 1;
	}
	return ret;
}

int fa[N];

int find(int x){
	return x == fa[x] ? x : fa[x] = find(fa[x]);
}

int n, X, Y;
int val[N], col[N];
vector<int> S[N];

int fac[N], rfac[N];

void init(){
	fac[0] = 1;
	For(i, 1, N - 5) fac[i] = 1ll * fac[i - 1] * i % Mod;
	rfac[N - 5] = Pow(fac[N - 5], Mod - 2);
	Forr(i, N - 6, 0) rfac[i] = 1ll * (i + 1) * rfac[i + 1] % Mod;
}

int rk[N];

bool cmp1(int x, int y){
	return col[x] ^ col[y] ? col[x] < col[y] : val[x] < val[y];
}

int main(){
	init();
	scanf("%d%d%d", &n, &X, &Y);
	For(i, 1, n) scanf("%d%d", &col[i], &val[i]), fa[i] = rk[i] = i;
	sort(rk + 1, rk + n + 1, cmp1);

	int pre = rk[1];
	int mn1 = 1, mn2 = 0;
	val[0] = 2e9;

	For(i, 2, n){
		if(col[rk[i]] ^ col[pre]) pre = rk[i];
		if(val[rk[i]] + val[pre] <= X) fa[find(rk[i])] = find(pre);
		if(val[rk[i]] < val[mn1]) mn2 = mn1, mn1 = rk[i];
		if(col[mn1] != col[rk[i]] && val[rk[i]] < val[mn2]) mn2 = rk[i];
	}

	if(!mn2){
		puts("1"); return 0;
	}

	For(i, 1, n) 
		if(col[i] == col[mn1] && val[i] + val[mn2] <= Y) fa[find(i)] = find(mn2);
		else if(col[i] != col[mn1] && val[i] + val[mn1] <= Y) fa[find(i)] = find(mn1);
	For(i, 1, n) S[find(i)].pb(col[i]);

	LL ans = 1;
	For(i, 1, n) if(fa[i] == i){
		sort(S[i].begin(), S[i].end());
		int sz = int(S[i].size()) - 1, c = 0;
		ans = ans * fac[sz + 1] % Mod;
		For(j, 0, sz){
			++c;
			if(j == sz || S[i][j] != S[i][j + 1]){
				ans = ans * rfac[c] % Mod;
				c = 0;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Compiler output:
a.cc:36:1: error: 'vector' does not name a type
   36 | vector<int> S[N];
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:77:22: error: 'S' was not declared in this scope
   77 |         For(i, 1, n) S[find(i)].pb(col[i]);
      |                      ^
a.cc:81:22: error: 'S' was not declared in this scope
   81 |                 sort(S[i].begin(), S[i].end());
      |                      ^
a.cc:85:27: error: 'c' was not declared in this scope
   85 |                         ++c;
      |                           ^
Language: C++

c#include<bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define rep2(i,k,n) for(int i=k;i>=n;i--)
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int N=2e5+7;
void upd(int& x,int y){x+=y;if(x>=mod)x-=mod;} 
int qpow(int a,int b){int aa=a,res=1;for(;b;b>>=1){if(b&1)res=1ll*res*aa%mod;aa=1ll*aa*aa%mod;}return res;}
int bin[N],pin[N];
void init(){bin[0]=pin[0]=1;
	rep(i,1,N-1)bin[i]=1ll*bin[i-1]*i%mod;
	pin[N-1]=qpow(bin[N-1],mod-2);
	rep2(i,N-2,1)pin[i]=1ll*pin[i+1]*(i+1)%mod;
}
int n,X,Y,c[N],w[N],p[N],mi,sz[N],col[N],dif[N];
int find(int x){
	return p[x]==x ? x : p[x]=find(p[x]);
}
void merge(int x,int y){
	int px=find(x),py=find(y);
	if(px==py)return;
	p[py]=px,sz[px]+=sz[py];
}
bool cmp(int x,int y){return w[x]<w[y];}
vector<int> tu[N]; 
int main(){
	init();
	scanf("%d%d%d",&n,&X,&Y);
	rep(i,1,n){
		scanf("%d%d",&c[i],&w[i]);
		p[i]=i,sz[i]=1;
		col[c[i]]++;
		tu[c[i]].push_back(i);
		if(!mi || w[i]<w[mi])mi=i;
	}
	rep(i,1,n)if(tu[i].size()){
		sort(tu[i].begin(),tu[i].end(),cmp);
		rep(j,0,tu[i].size()-1){
			int v=tu[i][j];
			if(w[v] + w[tu[i][0]] <= X)merge(v,tu[i][0]);
			if(w[v] + w[mi] <=Y && c[v]!=c[mi])merge(v,mi);
		}
	}
	int tot=n;
	rep(i,1,n)if(c[i]!=c[find(i)])dif[find(i)]=1;
	rep(i,1,n)if(!dif[find(i)])tot--,col[c[i]]--;
	
	int ans=bin[tot];
	rep(i,1,n)ans=1ll*ans*pin[col[i]]%mod;
	printf("%d\n",ans);
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | c#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'c' does not name a type
    1 | c#include<bits/stdc++.h>
      | ^
a.cc:26:1: error: 'vector' does not name a type
   26 | vector<int> tu[N];
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:29:9: error: 'scanf' was not declared in this scope
   29 |         scanf("%d%d%d",&n,&X,&Y);
      |         ^~~~~
a.cc:34:17: error: 'tu' was not declared in this scope
   34 |                 tu[c[i]].push_back(i);
      |                 ^~
a.cc:37:22: error: 'tu' was not declared in this scope
   37 |         rep(i,1,n)if(tu[i].size()){
      |                      ^~
a.cc:38:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   38 |                 sort(tu[i].begin(),tu[i].end(),cmp);
      |                 ^~~~
      |                 short
a.cc:51:9: error: 'printf' was not declared in this scope
   51 |         printf("%d\n",ans);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | c#include<bits/stdc++.h>
Language: C++

N, X, Y = map( int, input().split() )

C = []
W = []
for i in range( N ):
  c, w = map( int, input().split() )
  C.append( c - 1 )
  W.append( w )

c2w = [ [] for i in range( N ) ]
for i in range( N ):
  c2w[ C[ i ] ].append( W[ i ] )
for i in range( N ):
  c2w[ C[ i ] ].sort()

W.sort()
minw, minw2 = W[ 0 ], W[ 1 ] if 1 < N else W[ 0 ]

merged = [ False for i in range( N ) ]
hi = [ 1 for i in range( N ) ]
for i in range( N ):
  if len( c2w[ i ] ) == 0: continue
  lb, ub = 2, len( c2w[ i ] )
  while lb <= ub:
    mid = lb + ub >> 1
    if c2w[ i ][ 0 ] + c2w[ i ][ mid - 1 ] <= X:
      hi[ i ] = max( hi[ i ], mid )
      lb = mid + 1
    else:
      ub = mid - 1
  lb, ub = 1, len( c2w[ i ] )
  www = minw2 if minw != minw2 and c2w[ i ][ 0 ] == minw else minw
  while lb <= ub:
    mid = lb + ub >> 1
    if www + c2w[ i ][ mid - 1 ] <= Y:
      hi[ i ] = max( hi[ i ], mid )
      merged[ i ] = True
      lb = mid + 1
    else:
      ub = mid - 1

MOD = int( 1e9 + 7 )

fact = [ 1 ]
inv_fact = [ 1 ]
for i in range( 1, N + 1, 1 ):
  fact.append( fact[ i - 1 ] * i % MOD )
  inv_fact.append( pow( fact[ i ], MOD - 2, MOD ) )

ans = fact[ sum( merged[ i ] * hi[ i ] for i in range( N ) ) ]
for i in range( N ):
  if not merged[ i ]: continue
  ans = ans * inv_fact[ hi[ i ] ] % MOD

print( ans )


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N, X, Y = map( int, input().split() )
      | ^
Language: C++

#include <cstdio>
#include <vector>
#include <unordered_map>

typedef long long ll;

constexpr int MAX_N = 200200;
constexpr int MOD = 1000000007;

using namespace std;

int n, x, y;
int col[MAX_N], weight[MAX_N];

vector<pair<int, int>> each[MAX_N];
vector<pair<int, int>> all;

vector<int> adj[MAX_N];
bool vis[MAX_N];

int dfs(int u, unordered_map<int, int> &col_cnt) {
    if (vis[u]) return 0;
    vis[u] = true;
    int ans = 1;
    col_cnt[col[u]]++;
    for (int v : adj[u]) {
        ans += dfs(v, col_cnt);
    }
    return ans;
}

int fact(int x) {
    ll ans = 1;
    for (int i = 1; i <= x; i++) {
        ans = (ans * i) % MOD;
    }
    return ans;
}

int pow(int b, int e) {
    if (e == 0) return 1;
    ll res = pow(b, e >> 1);
    res = (res * res) % MOD;
    if (e & 1) res = (res * b) % MOD;
    return (int) res;
}

int inv(int x) {
    return pow(x, MOD - 2);
}

int permute(int cnt, unordered_map<int, int> &col_cnt) {
    ll ans = fact(cnt);
    for (pair<int, int> c : col_cnt) {
        if (c.second > 0) {
            ans = (ans * inv(fact(c.second))) % MOD;
        }
    }
    return (int) ans;
}

int main() {
    scanf(" %d %d %d", &n, &x, &y);
    for (int i = 0; i < n; i++) {
        scanf(" %d %d", &col[i], &weight[i]);
        each[col[i]].push_back(make_pair(weight[i], i));
        all.push_back(make_pair(weight[i], i));
    }

    sort(all.begin(), all.end());
    for (int i = 1; i <= n; i++) {
        sort(each[i].begin(), each[i].end());
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j < each[i].size(); j++) {
            if (each[i][j].first + each[i][0].first <= x) {
                adj[each[i][j - 1].second].push_back(each[i][j].second);
                adj[each[i][j].second].push_back(each[i][j - 1].second);
            }
        }
    }

    for (int i = 1; i < all.size(); i++) {
        if (all[i].first + all[0].first <= y) {
            adj[all[i].second].push_back(all[i - 1].second);
            adj[all[i - 1].second].push_back(all[i].second);
        }
    }

    ll tot = 1;
    for (int i = 0; i < n; i++) {
        if (!vis[i]) {
            unordered_map<int, int> col_cnt;
            int cnt = dfs(i, col_cnt);
            tot = (tot * permute(cnt, col_cnt)) % MOD;
        }
    }

    printf("%lld\n", tot);

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   70 |     sort(all.begin(), all.end());
      |     ^~~~
      |     short
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
ll n,x,y;
vector<ll>v[222222];
struct item{
  ll c,w;
}a[222222];
struct tree{
  ll c,w,id;
  tree(){
    w=(ll)1e18;
  }
  friend bool operator <(tree a, tree b) {
    return a.w < b.w;
  }
};
tree t[2222222];
int st[222222];
int en[222222];

void build(int v=1,int tl=1,int tr=n){
  if(tl==tr){
    t[v].c=a[tl].c;
    t[v].w=a[tl].w;
    t[v].id=tl;
  } else {
    int mid=(tl+tr)/2;
    build(v+v,tl,mid);
    build(v+v+1,mid+1,tr);
    t[v]=min(t[v+v],t[v+v+1]);
  }
}
tree get(int l,int r,int v=1,int tl=1,int tr=n){
  if(tl>r||tr<l)return tree();
  if (l <=tl&&tr<=r)return t[v];
  int mid=(tl+tr)/2;
  return min(get(l,r,v+v,tl,mid),get(l,r,v+v+1,mid+1,tr));
}
void kill(int pos,int v=1,int tl=1,int tr=n){
  if(tl==tr)t[v].w=(ll)1e18;
  else {
    int mid=(tl+tr)/2;
    if(pos<=mid)kill(pos,v+v,tl,mid);
    else kill(pos,v+v+1,mid+1,tr);
    t[v]=min(t[v+v],t[v+v+1]);
  }
}
void read(ll &x)
{
  scanf("%lld",&x);
}
bool cmp(item a, item b)
{
  if(a.c!=b.c)
    return a.c<b.c;
  return a.w<b.w;
}
bool used[222222];
int fact[222222];
map<int, int>cnt;
int tot;
void dfs(int v){
  //cout<<v<<' ';
  used[v]=1;
  cnt[a[v].c]++;
  tot++;
  kill(v);
  int l=st[a[v].c];
  int r=en[a[v].c];
  //cout<<l<<' '<<r<<endl;
  while(1){
    auto it=get(l,r);
    //cout<<v<<"->"<<it.id<<' '<<it.w<<endl;
    if(a[v].w+it.w>x)
      break;
    dfs(it.id);
  }
  while(1){
    auto it=get(1,l-1);
    if(a[v].w+it.w>y)
      break;
    dfs(it.id);
  }
  while(1){
    auto it=get(r+1,n);
    if(a[v].w+it.w>y)
      break;
    dfs(it.id);
  }
}
const int MOD=(int)1e9+7;
int bin(int a, int b){
  int res=1;
  while(b){
    if(b&1)res=res*1ll*a%MOD;
    b>>=1;
    a=a*1ll*a%MOD;
  }
  return res;
}
int main()
{
  #ifdef LOCAL
  freopen("in.txt","r",stdin);
  #endif
  cin>>n>>x>>y;
  fact[0]=1;
  for(int i=1;i<=n;i++)
    fact[i]=fact[i-1]*1ll*i%MOD;
  for(ll i=1;i<=n;i++)
    read(a[i].c),read(a[i].w);
  sort(a+1,a+n+1,&cmp);
  for(int i=1;i<=n;i++)
    st[i]=0,en[i]=-1;
  for(int i=1;i<=n;i++){
    if(!st[a[i].c])
      st[a[i].c]=i;
    en[a[i].c]=i;
  }
  build();
  ll ans=1;
  for(int i=1;i<=n;i++){
    if(!used[i]){
      cnt.clear();
      tot=0;
      dfs(i);
      ans=ans*fact[tot]%MOD;
      for(auto it:cnt)
        ans=ans*bin(fact[it.second],MOD-2)%MOD;
      //cout<<endl;
    }
  }
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:120:3: error: 'sort' was not declared in this scope; did you mean 'short'?
  120 |   sort(a+1,a+n+1,&cmp);
      |   ^~~~
      |   short
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define fo(i, n) for(int i = 1; i <= n; ++i)
#define rep(i, a, b) for(int (i) = (a); (i) < (b); ++(i))

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 200200;
const int mod = 1e9 + 7;
const ll INF = 1e18;

ll f[N]={1};
ll rf[N]={1};
ll w[N];
vector<ll> vect[N];
ll p[N];
vector<ll>g[N];
ll cnt[N];
int pos[N];
ll c[N];
ll same,notsame,n;


inline bool cmp(int x, int y)
{
	return w[x]<w[y];
}

int get(int x)
{
	if(p[x]==x)
		return x;
	return p[x]=get(p[x]);
}

inline uni(int x, int y)
{
	x=get(x);
	y=get(y);
	if(rand()&1)
		p[x]=y;
	else
		p[y]=x;
}

ll bin(ll x, ll k)
{
	ll res=1;
	while(k)
	{
		if(k&1)
			res=res*x%mod;
		x=x*x%mod;
		k>>=1;
	}
	return res;
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n>>same>>notsame;
	fo(i,n)
	{
		p[i]=i;
		cin>>c[i]>>w[i];
		g[c[i]].pb(i);
	}
	fo(i,n)
		f[i]=f[i-1]*i%mod;
	rf[n]=bin(f[n],mod-2);
	for(int i=n-1;i>=1;--i)
		rf[i]=rf[i+1]*(i+1)%mod;
	multiset<pii> allw;
	fo(i,n)
	{
		sort(g[i].begin(),g[i].end(),cmp);  
		allw.insert(mp(w[i],i));
	}
	fo(i,n)
	{
		if(g[i].size()>0)
		{
			int cur=pos[i];
			int st=g[i][0];
			while(pos[i]<g[i].size())
			{
				int x=g[i][pos[i]];
				int y=st;
				if(w[x]+w[y]<=same)
					++pos[i];
				else
					break;
			}
		}
	}
	fo(i,n)
	{
		if(g[i].size()>0)
		{
			for(int e:g[i])
				allw.erase(mp(w[e],e));
			int y=g[i][0];
			int x=allw.begin()->S;
			if(w[x]+w[y]<=notsame)
				uni(c[x],c[y]);
			if(!allw.empty())
			{
	        	int x=allw.begin()->S;
	        	while(pos[i]<g[i].size())
	        	{
	        		int y=g[i][pos[i]];
	        		if(w[x]+w[y]<=notsame)
	        			uni(c[x],c[y]), ++pos[i];
	        		else
	        			break;
	        	}
	        }
			for(int e:g[i])
				allw.insert(mp(w[e],e));
		}
	}
	ll ans=1;
	fo(i,n)
	{
		int x=get(i);
		vect[x].pb(i);
	}
	for(int i=1;i<=n;++i)
	{
		ll sum=0;
		for(int j=0;j<vect[i].size();++j)
		{
			int y=vect[i][j];
			sum+=pos[y];
		}
		ans=(ans*f[sum])%mod;
		for(int j=0;j<vect[i].size();++j)
		{
			int y=vect[i][j];
			ans=(ans*rf[pos[y]])%mod;
		}
	}
	cout<<ans;
	return 0;	
}

Compiler output:
a.cc:45:8: error: ISO C++ forbids declaration of 'uni' with no type [-fpermissive]
   45 | inline uni(int x, int y)
      |        ^~~
a.cc: In function 'int uni(int, int)':
a.cc:53:1: warning: no return statement in function returning non-void [-Wreturn-type]
   53 | }
      | ^
Language: C++

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


const int NUM_=400001;
static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
ll mo=1000000007;

int N,X,Y;
pair<int,int> mi[202020];
int C[202020],W[202020];
pair<int,int> L[202020],R[202020];

template<int um> class UF {
	public:
	vector<int> par,rank,cnt;
	UF() {par=rank=vector<int>(um,0); cnt=vector<int>(um,1); for(int i=0;i<um;i++) par[i]=i;}
	void reinit() {int i; FOR(i,um) rank[i]=0,cnt[i]=1,par[i]=i;}
	int operator[](int x) {return (par[x]==x)?(x):(par[x] = operator[](par[x]));}
	int count(int x) { return cnt[operator[](x)];}
	int operator()(int x,int y) {
		if((x=operator[](x))==(y=operator[](y))) return x;
		cnt[y]=cnt[x]=cnt[x]+cnt[y];
		if(rank[x]>rank[y]) return par[x]=y;
		rank[x]+=rank[x]==rank[y]; return par[y]=x;
	}
};
UF<202020> uf;
vector<pair<int,int>> CC[202020];
map<int,int> M[202020];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	inv[1]=fact[0]=factr[0]=1;
	for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
	for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	
	for(i=0;i<=202000;i++) mi[i]={1<<30,0};
	
	cin>>N>>X>>Y;
	FOR(i,N) {
		cin>>C[i]>>W[i];
		CC[C[i]].push_back({W[i],i});
		mi[C[i]]=min(mi[C[i]],{W[i],i});
	}
	
	L[0]=R[202000]={1<<30,-1};
	FOR(i,202000) L[i+1]=min(L[i],mi[i+1]);
	for(i=202000;i>=1;i--) R[i-1]=min(R[i],mi[i-1]);
	
	for(i=1;i<=200000;i++) if(CC[i].size()) {
		aort(ALL(CC[i]));
		auto a=CC[i][0];
		pair<int,int> p=min(L[i-1],R[i+1]);
		FORR(r,CC[i]) if(a.first+r.first<=X) uf(a.second,r.second);
		FORR(r,CC[i]) if(p.first+r.first<=Y) uf(p.second,r.second);
	}
	FOR(i,N) M[uf[i]][C[i]]++;
	
	ll ret=1;
	FOR(i,N) if(M[i].size()) {
		x=0;
		FORR(r,M[i]) x+=r.second;
		(ret *= fact[x])%=mo;
		FORR(r,M[i]) (ret *= factr[r.second])%=mo;
	}
	cout<<ret<<endl;
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:64:17: error: 'aort' was not declared in this scope; did you mean 'abort'?
   64 |                 aort(ALL(CC[i]));
      |                 ^~~~
      |                 abort