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

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

const int MAX = 100000;

int64_t invNum(int *a, int l, int r) {
	int64_t ret = 0;
	int n = r - l, m = l + (n >> 1);
	if (n <= 1) return ret;
	ret += invNum(a, l, m);
	ret += invNum(a, m, r);
	int *tmp = new int[n];
	for (int i = 0, j = m;i < n;++ i) {
		if (a[l] <= a[j]) {
			tmp[i] = a[l];
			++ l;
			if (l >= m) {
				memcpy(tmp + i + 1, a + j, sizeof(int) * (n - i - 1));
				break;
			}
		} else {
			tmp[i] = a[j];
			ret += m - l;
			++ j;
			if (j >= r) {
				memcpy(tmp + i + 1, a + l, sizeof(int) * (n - i - 1));
				break;
			}
		}
	}
	memcpy(a + r - n, tmp, sizeof(int) * n);
	return ret;
}

bool check(int x, int *a, int N) {
	int *b = new int[N + 1];
	b[0] = 0;
	for (int i = 0;i < N;++ i) b[i + 1] = b[i] + (a[i] < x ? -1 : 1);
	int64_t ret = (N * (N + 1) >> 1) - invNum(b, 0, N + 1);
	return ret >= N * (N + 1) >> 2;
}

int binarySearch(int *a, int N) {
	int min = 0, max = N;
	int b[MAX];
	memcpy(b, a, sizeof(int) * N);
	sort(b, b+N);
	for (int mid = max >> 1;max - min > 1;mid = min + (max - min >> 1)) {
		if (check(b[mid], a, N)) min = mid;
		else max = mid;
	}
	return b[min];
}
int main() {
	int N, a[MAX];
	cin >> N;
	for (int i = 0;i < N;++ i) cin >> a[i];
	cout << binarySearch(a, N);
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

おいまったく解けねーぞ！
解説AC
*/

Compiler output:
a.cc: In function 'int64_t invNum(int*, int, int)':
a.cc:20:33: error: 'memcpy' was not declared in this scope
   20 |                                 memcpy(tmp + i + 1, a + j, sizeof(int) * (n - i - 1));
      |                                 ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<cstdint>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc:28:33: error: 'memcpy' was not declared in this scope
   28 |                                 memcpy(tmp + i + 1, a + l, sizeof(int) * (n - i - 1));
      |                                 ^~~~~~
a.cc:28:33: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:33:9: error: 'memcpy' was not declared in this scope
   33 |         memcpy(a + r - n, tmp, sizeof(int) * n);
      |         ^~~~~~
a.cc:33:9: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc: In function 'int binarySearch(int*, int)':
a.cc:48:9: error: 'memcpy' was not declared in this scope
   48 |         memcpy(b, a, sizeof(int) * N);
      |         ^~~~~~
a.cc:48:9: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include "bits/stdc++.h"
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define qceil(n,d) ((n) > 0 ? ((n) - 1) / (d) + 1 : (n) / (d))
#define parity(a,b) (a & 1 ^ b & 1 ^ 1)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;

const pii dir[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int mod = 1e9 + 7;
const int inf32 = (1 << 30) - 1;
const ll inf64 = (1LL << 62) - 1;

template<class Abel> struct BItree {
	int range;
	vector<Abel> data_;
	
	BItree(int size_,Abel init = 0) : range(size_ + 1)
	{
		init(range);
	}
	
	void init(int n) {
		data_.assign(n,0);
	}
	
	Abel sum(int r) {
		Abel s = 0;
		while (r) {
			s += data_[r];
			r -= r & -r;
		}
		return s;
	}
	
	Abel sum(int l, int r) { return sum(r) - sum(l - 1); }
	
	void add(int idx, Abel diff) {
		while (idx < range) {
			data_[idx] += diff;
			idx += idx & -idx;
		}
	}
	
	bool update(int idx, Abel val){
		int prev = sum(idx, idx);
		add(idx, val - prev);
		return val > prev;
	}
	
	int lower_bound(Abel obj) {
		int lower = 0;
		int upper = range;
		while (upper - lower > 1) {
			int mid = (lower + upper) / 2;
			if(sum(mid) < obj) lower = mid;
			else upper = mid;
		}
		return upper;
	} 
	
	int upper_bound(Abel obj) {
		int lower = 0;
		int upper = range;
		while (upper - lower > 1) {
			int mid = (lower + upper) / 2;
			if(sum(mid) > obj) upper = mid;
			else lower = mid;
		}
		return upper;
	} 
};



ll N,M,Q,K,L;
string S;
int a[100010],tmp[100010],s[100010];

bool ch(int x){
	rep(i,N) tmp[i] = 2 * (x <= a[i]) - 1;
	BItree<int> bt(N * 2 + 2);
	ll cnt = 0;
	s[0] = 0;
	bt.add(N + 1,1);
	rep(i,N) s[i + 1] = s[i] + tmp[i],cnt += bt.sum(N + 1 + s[i + 1]),bt.add(N + 1 + s[i + 1],1);
	return cnt >= (N * (N + 1) / 2 + 1) / 2;
}

int solve(){
	int l = 0;
	int r = inf32;
	while(r - l > 1){
		int m = (l + r) / 2;
		if(ch(m)) l = m;
		else r = m;
	}
	return l;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> N;
	rep(i,N) cin >> a[i];
	cout << solve() << endl;
}






Compiler output:
a.cc: In instantiation of 'BItree<Abel>::BItree(int, Abel) [with Abel = int]':
a.cc:104:26:   required from here
  104 |         BItree<int> bt(N * 2 + 2);
      |                                 ^
a.cc:42:21: error: 'init' cannot be used as a function
   42 |                 init(range);
      |                 ~~~~^~~~~~~
Language: C++

#include "bits/stdc++.h"
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define qceil(n,d) ((n) > 0 ? ((n) - 1) / (d) + 1 : (n) / (d))
#define parity(a,b) (a & 1 ^ b & 1 ^ 1)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;

const pii dir[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int mod = 1e9 + 7;
const int inf32 = (1 << 30) - 1;
const ll inf64 = (1LL << 62) - 1;

template<class Abel> struct BItree {
	int range;
	vector<Abel> data_;
	
	BItree(int size_,Abel init = 0) : range(size_ + 1)
	{
		init(int ranze);
	}
	
	void init(int n) {
		data_.assign(n,0);
	}
	
	Abel sum(int r) {
		Abel s = 0;
		while (r) {
			s += data_[r];
			r -= r & -r;
		}
		return s;
	}
	
	Abel sum(int l, int r) { return sum(r) - sum(l - 1); }
	
	void add(int idx, Abel diff) {
		while (idx < range) {
			data_[idx] += diff;
			idx += idx & -idx;
		}
	}
	
	bool update(int idx, Abel val){
		int prev = sum(idx, idx);
		add(idx, val - prev);
		return val > prev;
	}
	
	int lower_bound(Abel obj) {
		int lower = 0;
		int upper = range;
		while (upper - lower > 1) {
			int mid = (lower + upper) / 2;
			if(sum(mid) < obj) lower = mid;
			else upper = mid;
		}
		return upper;
	} 
	
	int upper_bound(Abel obj) {
		int lower = 0;
		int upper = range;
		while (upper - lower > 1) {
			int mid = (lower + upper) / 2;
			if(sum(mid) > obj) upper = mid;
			else lower = mid;
		}
		return upper;
	} 
};



ll N,M,Q,K,L;
string S;
int a[100010],tmp[100010],s[100010];

bool ch(int x){
	rep(i,N) tmp[i] = 2 * (x <= a[i]) - 1;
	BItree<int> bt(N * 2 + 2);
	ll cnt = 0;
	s[0] = 0;
	bt.add(N + 1,1);
	rep(i,N) s[i + 1] = s[i] + tmp[i],cnt += bt.sum(N + 1 + s[i + 1]),bt.add(N + 1 + s[i + 1],1);
	return cnt >= (N * (N + 1) / 2 + 1) / 2;
}

int solve(){
	int l = 0;
	int r = inf32;
	while(r - l > 1){
		int m = (l + r) / 2;
		if(ch(m)) l = m;
		else r = m;
	}
	return l;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> N;
	rep(i,N) cin >> a[i];
	cout << solve() << endl;
}






Compiler output:
a.cc: In constructor 'BItree<Abel>::BItree(int, Abel)':
a.cc:42:22: error: expected primary-expression before 'int'
   42 |                 init(int ranze);
      |                      ^~~
a.cc: In instantiation of 'BItree<Abel>::BItree(int, Abel) [with Abel = int]':
a.cc:104:26:   required from here
  104 |         BItree<int> bt(N * 2 + 2);
      |                                 ^
a.cc:42:31: error: 'init' cannot be used as a function
   42 |                 init(int ranze);
      |                               ^
Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>
using namespace std;
#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)
#define int long long

const int maxn = 120000;
int ff[maxn*2];
int a[maxn];
/*
int add(int x){
	x++;
	for(;x < maxn*2;x+=x&(-x))ff[x]+=1;
}

int get(int x){
	x++;
	int ans = 0;
	for(;x > 0; x-=x&(-x))ans+=ff[x];
	return ans;
}*/

void add(int x) {
	for (; x < MAXN * 2; x |= (x + 1))
		ff[x] += 1;
}
 
int get(int x) {
	int ans = 0;
	for (; x >= 0; x = (x & (x + 1)) - 1)
		ans += ff[x];
	return ans;
}
signed main(){
	int n;cin>>n;
	FOR(i,0,n-1)cin>>a[i];

	
	int l=0,r=1e9;
	int all = n*(n+1)/2;
	while(r-l > 1)
	{
		int mid = (l+r)/2;
		memset(ff,0,sizeof(ff));
		int cur = n;
		add(n);
		int now = 0;
		FOR(i,0,n-1)
		{
			if(a[i]>=mid)cur++;
			else cur--;
			now += get(cur);
			add(cur);
		}
		
		if(now*2 >= all) l = mid;
		else r = mid;
	}
	
	cout << l << endl;
}


Compiler output:
a.cc: In function 'void add(long long int)':
a.cc:30:20: error: 'MAXN' was not declared in this scope
   30 |         for (; x < MAXN * 2; x |= (x + 1))
      |                    ^~~~
Language: C

long m,r=1e9,l=-1,c,s,i,N,a[1<<17];
main(){
	for(;~scanf("%d",a+i++););
	for(;r-l>1;c>*a*(*a+1)/4?r=m:(l=m)){
		int b[2<<17]={};
		m=l+r>>1;
		b[s=*a]=1;
		for(N=c=i=0;i<n;b[s]++)c+=N+=a[++i]>m?-b[++s]:b[s--];
	}
	printf("%d",r);
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:3:15: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 |         for(;~scanf("%d",a+i++););
      |               ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | long m,r=1e9,l=-1,c,s,i,N,a[1<<17];
main.c:3:15: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    3 |         for(;~scanf("%d",a+i++););
      |               ^~~~~
main.c:3:15: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:8:31: error: 'n' undeclared (first use in this function)
    8 |                 for(N=c=i=0;i<n;b[s]++)c+=N+=a[++i]>m?-b[++s]:b[s--];
      |                               ^
main.c:8:31: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   10 |         printf("%d",r);
      |         ^~~~~~
main.c:10:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:10:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:10:9: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

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

int bit[100010],n;
long long a[100010],b[100010],cnt,m=0;
pair<long long, long long> p[100010];
int sum(int i){
	int s = 0;
	while(i>0){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

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

int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
		m = max(a[i],m);
	}
	
	long long lb=m+1,ub=-1,mid;
	while(lb-ub>1){
		long long x = 0;
		mid = (lb+ub)/2;
		cnt = 0;
		for(int i=0;i<n;i++){
			bit[i] = 0;
			if(a[i]>=mid){
				b[i] = 1;
				cnt++;
			}else{
				b[i] = -1;
			}
			x += b[i];
			p[i] = make_pair(x,i);
		}
		bit[n] = 0;
		sort(p,p+n);
		int now = 1;
		b[p[0].second] =  now;
		for(int i=1;i<n;i++){
			if(p[i].first!=p[i-1].first){
				now++;
			}
			b[p[i].second] = now;
		}
		
		for(int i=0;i<n;i++){
			cnt += sum(b[i]);
			add(b[i],1);
		}
		//cout << lb << " " << ub << " " << mid << " " << cnt << endl;
		if(cnt<n*(n+1)/4){
			lb = mid;
		}else{
			ub = mid;
		}
	}
	long long y = abs(a[0]-ub),ans=0;
	for(i=0;i<n;i++){
		if(y>abs(a[i]-ub)){
			ans = i;
			y = abs(a[i]-ub);
		}
	}
	cout << a[ans] << endl;
}
		
			

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

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS * max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x * x + y * y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;


#define MAXN 100005

int n, a[MAXN], b[2 * MAXN], s;
ll total;

int query(int p) {
	int t = 0;
	for (int i = (p + MAXN); i; i -= (i & -i)) {
		t += b[i];
	}
	return t;
}
void update(int p) {
	for (int i = (p + MAXN); i < 2 * MAXN; i += (i & -i)) {
		b[i]++;
	}
}

ll getTotal(int x, const vector <int>& c)
{
	total = 0;
	s = 0;
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));

	for (int i = 0; i<n; ++i) {
		a[i] = (c[i] >= x ? 1 : -1);
	}
	update(0);

	for (int i = 0; i<n; ++i) {
		s += a[i];
		total += query(s);
		update(s);
	}

	return total;
}

int main() 
{
	cin >> n;

	vector <int> c(n);

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


	vector <int> d(c);
	sort(d.begin(), d.end());

/*
	for (int i = 0; i < n; ++i)
	{
		ll aboveXTotal = getTotal(d[i], c);
		// BEGIN CUT HERE
		cerr << " i=" << i << " d[i]=" << d[i] << " aboveXTotal=" << aboveXTotal << endl;
		// END CUT HERE


	}
	*/

	ll rank = (ll)n * (n + 1LL) / 2 / 2;

	ll lo = 0;
	ll hi = n - 1;
	// BEGIN CUT HERE
//	cerr << " rank=" << rank << endl;
	// END CUT HERE

	while (lo<hi)
	{
		ll mid = lo + (hi - lo + 1) / 2LL; // +1 is necessary, otherwise infinite loop when only two elements.

		ll aboveXTotal = getTotal(d[mid], c);


		// BEGIN CUT HERE
//		cerr << " lo=" << lo << " hi=" << hi << " mid=" << mid << " d[mid]=" << d[mid] << " aboveXTotal=" << aboveXTotal << endl;
		// END CUT HERE




		if (aboveXTotal < rank)
		{
			hi = mid - 1;
		}
		else
		{
			lo = mid;
		}
	}


	cout << d[lo] << endl;



	return 0;
}



Compiler output:
a.cc: In function 'll getTotal(int, const std::vector<int>&)':
a.cc:63:9: error: 'memset' was not declared in this scope
   63 |         memset(a, 0, sizeof(a));
      |         ^~~~~~
a.cc:19:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   18 | #include <cstdio>
  +++ |+#include <cstring>
   19 |
Language: C++

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll tar = (ll)n * (n + 1) / 2 / 2 + 1;

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
   
    map<int, int> cnt;

    if (n <= 300) {
        for (int i = 0; i < n; i++) {
            vector<int> v;
            for (int j = i; j < n; j++) {
                v.push_back(a[j]);
                sort(v.begin(), v.end());
                cnt[v[(int)v.size() / 2]]++;
            }
        }

        ll cnt_sum = 0;
        for (auto& p : cnt) {
            ll prv = cnt_sum;
            cnt_sum += p.second;
            cout << cnt_sum << endl;
            if (tar > p.first && tar <= cnt_sum) {
                cout << p.first << endl;
                break;
            }
        }
    } else {
        std::random_device seed_gen;
        std::mt19937 engine(seed_gen());
        std::uniform_int_distribution<> randn(0, n-1); 
        vector<int> v;
        for (int i = 0; i < n; i++) {
            v.push_back(a[randn(mt)]);
        }
        sort(v.begin(), v.end());
        cout << v[n / 2] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:33: error: 'mt' was not declared in this scope; did you mean 'tm'?
   47 |             v.push_back(a[randn(mt)]);
      |                                 ^~
      |                                 tm
Language: C++

#include <stdio.h>
#include <algorithm>
int main(void){
   int n;
   scanf("%d",&n);
   long long a[n];
   for(int i=0;i<n;i++){
       scanf("%lld",&a[i]);
   }
   long long b[2*n-1];
   for(int i=0;i<n;i++){
       b[n-1+i]=a[i];
   }
   for(int i=0;i<n-1;i++){
       b[i]=max(a[i],a[i+1]);
   }
   std::sort(b,b+2*n-1);
   printf("%lld\n",b[n-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: 'max' was not declared in this scope; did you mean 'std::max'?
   15 |        b[i]=max(a[i],a[i+1]);
      |             ^~~
      |             std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include <stdio.h>
#include <algorithm>
int main(void){
   int n;
   scanf("%d",&n);
   long long a[n];
   for(int i=0;i<n;i++){
       scanf("%lld",&a[i]);
   }
   long long b[2*n-1];
   for(int i=0;i<n;i++){
       b[n-1+i]=a[i];
   }
   for(int i=0;i<n-1;i++){
       b[i]=fmax(a[i],a[i+1]);
   }
   std::sort(b,b+2*n-1);
   printf("%lld\n",b[n-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: 'fmax' was not declared in this scope
   15 |        b[i]=fmax(a[i],a[i+1]);
      |             ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int n;
int a[MAXN];

int main()
{
    std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    cout<<a[(n-1)>>1];
    return 0;
}


Compiler output:
a.cc:6:7: error: 'MAXN' was not declared in this scope
    6 | int a[MAXN];
      |       ^~~~
a.cc: In function 'int main()':
a.cc:12:30: error: 'a' was not declared in this scope
   12 |     for(int i=0;i<n;i++)cin>>a[i];
      |                              ^
a.cc:13:11: error: 'a' was not declared in this scope
   13 |     cout<<a[(n-1)>>1];
      |           ^
Language: C++

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

int main()
{
    int n; cin>>n;
    vector<int> a(n); for(auto& e: a) cin>>e;
    cout<<a[(n-(n%2?0:1)/2]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:27: error: expected ')' before ']' token
    8 |     cout<<a[(n-(n%2?0:1)/2]<<endl;
      |             ~             ^
      |                           )
a.cc:8:34: error: expected ']' before ';' token
    8 |     cout<<a[(n-(n%2?0:1)/2]<<endl;
      |                                  ^
      |                                  ]
Language: C++

/*
 * @Author: BilyHurington
 * @Date: 2020-08-16 10:07:53
 * @LastEditors: BilyHurington
 * @LastEditTime: 2020-08-16 11:03:01
 */
#include<bits/stdc++.h>
using namespace std;
int n,f[5010][5010],g[5010],siz[5010],cnt[5010];
vector<int> v[5010];
const int mod=1e9+7;
void Add(int &x,int y){x+=y;if(x>=mod) x-=mod;}
void dfs(int x,int fa){
    f[x][1]=1;siz[x]=1;
    for(int i=0;i<v[x].size();i++){
        if(v[x][i]==fa) continue;
        dfs(v[x][i],x);
    }
    for(int i=0;i<v[x].size();i++){
        if(v[x][i]==fa) continue;
        siz[x]+=siz[v[x][i]];
        for(int j=0;j<=siz[x];j++) g[j]=0;
        for(int j=1;j<=siz[x];j++){
            for(int k=0;k<=siz[v[x][i]]&&k<=j;k++){
                // printf("%d %d\n",j,k);
                Add(g[j],1ll*f[x][j-k]*f[v[x][i]][k]%mod);
            }
        }
        for(int j=0;j<=siz[x];j++) f[j]=g[j];
    }
    for(int i=1;i<=siz[x];i++) Add(f[x][0],1ll*cnt[i]*f[x][i]%mod);
    f[x][0]=(mod-f[x][0])%mod;
    // printf("%d: ",x);for(int i=0;i<=siz[x];i++) printf("%d ",f[x][i]);printf("\n");
}
int main(){
    scanf("%d",&n);
    cnt[0]=1;for(int i=2;i<=n;i+=2) cnt[i]=1ll*cnt[i-2]*(i-1)%mod;
    for(int i=1,x,y;i<n;i++){
        scanf("%d %d",&x,&y);
        v[x].push_back(y);
        v[y].push_back(x);
    }
    dfs(1,0);
    printf("%lld",(mod-f[1][0])%mod);
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:29:40: error: incompatible types in assignment of 'int' to 'int [5010]'
   29 |         for(int j=0;j<=siz[x];j++) f[j]=g[j];
      |                                    ~~~~^~~~~
Language: C++

#include<cstdio>
const long long Mod = 1e9+7;
long long dp[5001][5001],vis[5001],size[5001],next[10001],last[5001],edge[10001],_dp[5001],df[10001];
int n,u,v;
/*long long df(int x)
{
	int s = 1;
	for (int i = 1;i*2-1 <= x;++i)
		s = (s*(i*2-1)+Mod)%Mod;
	return s;
}*/
void dfs(int root)
{
	vis[root] = true;
	size[root] = 1;
	dp[root][1] = 1;
	int p = last[root];
	while (p)
	{
		if (!vis[edge[p]])
		{
			dfs(edge[p]);
			for (int i = 1;i <= size[root]+size[edge[p]];++i)
				_dp[i] = 0;
			for (int i = 1;i <= size[root]+size[edge[p]];++i)
				for (int j = 1;j <= size[root];++j)
					_dp[i] = (_dp[i]+dp[root][j]*dp[edge[p]][i-j]+Mod)%Mod;
			for (int i = 1;i <= size[root]+size[edge[p]];++i)
				dp[root][i] = _dp[i];
			size[root] += size[edge[p]];
		}
		p = next[p];
	}
	for (int i = 1;i <= size[root]/2;++i)
		dp[root][0] = (dp[root][0]-df[i*2-1]*dp[root][i*2]%Mod+Mod)%Mod;
}
void Add_Edge(int u,int v)
{
	edge[++edge[0]] = v;
	next[edge[0]] = last[u];
	last[u] = edge[0];
}
int main()
{
	scanf("%d",&n);
	for (int i = 1;i < n;++i)
	{
		scanf("%d%d",&u,&v);
		Add_Edge(u,v);
		Add_Edge(v,u);
	}
	df[1] = 1;
	for (int i = 1;i <= n;++i)
		df[2*i+1] = (dp[2*i-1]*(2*i+1)+Mod)%Mod;
	dfs(1);
	printf("%lld\n",(Mod-dp[1][0])%Mod);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:39: error: invalid operands of types 'long long int [5001]' and 'int' to binary 'operator*'
   54 |                 df[2*i+1] = (dp[2*i-1]*(2*i+1)+Mod)%Mod;
      |                              ~~~~~~~~~^~~~~~~~
      |                                      |     |
      |                                      |     int
      |                                      long long int [5001]
Language: C++

#include <bits/stdc++.h>
const int N=5005,mu=1e9+7;
int to[N<<1],edge,last[N],Next[N<<1],n,x,y,t[N],siz[N],dp[N][N],inv[N],p[N];
void add(int x,int y){
	to[++edge]=y;
	Next[edge]=last[x];
	last[x]=edge;
}
int C(int x,int y){
	return 1ll*p[x]*inv[y]%mu*inv[x-y]%mu;
}
void dfs(int x,int fa){
	dp[x][1]=1,siz[x]=1;
	for (int i=last[x];i;i=Next[i]){
		int u=to[i];
		if (u==fa) continue;
		dfs(u,x);
		for (int j=0;j<=siz[x]+siz[u];j++) t[j]=0;
		for (int j=0;j<=siz[x];j++)
			for (int k=0;k<=siz[u];k++)
				t[j+k]=(t[j+k]+1ll*dp[x][j]*dp[u][k])%mu;
		siz[x]+=siz[u];
		for (int j=0;j<=siz[x];j++) dp[x][j]=t[j];
	}
	for (int i=2;i<=siz[x];i+=2) dp[x][0]=(mu-dp[x][i])*g[i]%mu;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		add(x,y),add(y,x);
	}
	g[0]=1;
	for (int i=2;i<=n;i+=2) g[i]=1ll*g[i-1]%mu*(i-1)%mu;
	dfs(1,0);
	printf("%d\n",mu-dp[1][0]);
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:25:61: error: 'g' was not declared in this scope
   25 |         for (int i=2;i<=siz[x];i+=2) dp[x][0]=(mu-dp[x][i])*g[i]%mu;
      |                                                             ^
a.cc: In function 'int main()':
a.cc:33:9: error: 'g' was not declared in this scope
   33 |         g[0]=1;
      |         ^
Language: C++

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

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

#define fr first
#define sc second

const ll MOD=1000000007;

ll modpow(ll x,ll k){
	if(k==0)return 1;
	ll ret=modpow(x,k/2);
	ret*=ret; ret%=MOD;
	if(k%2==1){
		ret*=x;
		ret%=MOD;
	}
	return ret;
}

ll inv[5002];
void init(){
	for(int i=0;i<5002;i++){
		inv[i]=modpow(i,MOD-2);
	}
}

int n;
vector<int> G[5002];
int cnt[5002];
ll dp[5002][5002];
ll memo[5002];

void dfs(int v,int p){
	cnt[v]=1;
	for(int i=0;i<5002;i++){
		dp[v][i]=0;
	}
	dp[v][1]=1;
	for(int u: G[v]){
		if(u==p)continue;
		dfs(u,v);
		for(int i=0;i<=cnt[v]+cnt[u];i++){
			memo[i]=0;
		}
		for(int i=0;i<=min(cnt[v],n-cnt[v]);i++){
			if(dp[v][i]==0)continue;
			for(int j=1;j<=min(cnt[u],n-cnt[u]);j++){
				if(dp[u][j]==0)continue;
				ll x=dp[v][i]*dp[u][j];
				x%=MOD;
				for(int k=0;k<=min(i,j);k++){
					memo[i+j-2*k]+=x;
					if(memo[i+j-2*k]>=MOD)memo[i+j-2*k]-=MOD;
					x*=(i-k)*(j-k);
					x%=MOD;
					x*=inv[k+1];
					x%=MOD;
				}
			}
		}
		for(int i=0;i<=cnt[v]+cnt[u];i++){
			dp[v][i]=memo[i];
		}
		cnt[v]+=cnt[u];
	}
}

int main(){
	init();
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		G[a].push_back(b);
		G[b].push_back(a);
	}
	srand((unsigned)time(NULL));
	int root=rand()%n;
	dfs(r,0);
	cout<<dp[r][0]<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:82:13: error: 'r' was not declared in this scope
   82 |         dfs(r,0);
      |             ^
Language: C++

解説見た
包除原理を使わないDP(imosを用いる)を考えていて,
これは解説内の計算量解析さえ思いついていればO(N^2)だったかも

Compiler output:
a.cc:1:1: error: '\U000089e3\U00008aac\U0000898b\U0000305f' does not name a type
    1 | 解説見た
      | ^~~~~~~~
Language: C++

//I love Nanami Chiaki
#include<bits/stdc++.h>
using namespace std;
const int maxn=5007;
const int mod=1e9+7;
struct Edge{int nxt,to;}G[maxn<<1];
int bG=0,hG[maxn],sz[maxn],dp[maxn][maxn][2],ans=0,n,fac[maxn];  //dp_i_j_k:子树i中,有j个点还没有匹配,一定没经过的边数量%2=k的方案数 
inline add(int x,int y){G[bG].nxt=hG[x];G[bG].to=y;hG[x]=bG++;G[bG].nxt=hG[y];G[bG].to=x;hG[y]=bG++;}
inline Add(int &x,int y){x+=y;if (x>=mod) x-=mod;}
void solveit(int v,int p){
	sz[v]=1;dp[v][1][0]=1;
	for (int i=hG[v];i!=-1;i=G[i].nxt){
		int u=G[i].to;if (u==p) continue;solveit(u,v);
		for (int szv=sz[v];szv>0;szv--){
			int cnt[2]={dp[v][szv][0],dp[v][szv][1]};
			dp[v][szv][0]=0;dp[v][szv][1]=0;
			for (int e1=0;e1<=1;e1++){
				if (!cnt[e1]) continue;
				for (int szu=1;szu<=sz[u];szu++){
					for (int e2=0;e2<=1;e2++){
						if (!dp[u][szu][e2]) continue;
						int nsz=szv+szu,ne=(e1+e2)%2;
						Add(dp[v][nsz][ne],1ll*cnt[e1]*dp[u][szu][e2]%mod);
						if (!(szu%2)) Add(dp[v][szv][ne^1],1ll*cnt[e1]*dp[u][szu][e2]%mod*fac[szu]%mod);
					}
				}
			}
		}
		sz[v]+=sz[u];
	}
}
int main(){
	scanf("%d",&n);memset(hG,-1,sizeof(hG));
	for (int i=0;i<n-1;i++){int x,y;scanf("%d%d",&x,&y);x--;y--;add(x,y);}
	fac[0]=1;for (int i=2;i<=n;i+=2) fac[i]=1ll*fac[i-2]*(i-1)%mod;
	solveit(0,-1);
	for (int i=0;i<=sz[0];i+=2){Add(ans,1ll*dp[0][i][0]*fac[i]%mod);Add(ans,mod-1ll*dp[0][i][1]*fac[i]%mod);}
	printf("%d\n",ans);return 0;
}

Compiler output:
a.cc:8:8: error: ISO C++ forbids declaration of 'add' with no type [-fpermissive]
    8 | inline add(int x,int y){G[bG].nxt=hG[x];G[bG].to=y;hG[x]=bG++;G[bG].nxt=hG[y];G[bG].to=x;hG[y]=bG++;}
      |        ^~~
a.cc: In function 'int add(int, int)':
a.cc:8:101: warning: no return statement in function returning non-void [-Wreturn-type]
    8 | inline add(int x,int y){G[bG].nxt=hG[x];G[bG].to=y;hG[x]=bG++;G[bG].nxt=hG[y];G[bG].to=x;hG[y]=bG++;}
      |                                                                                                     ^
a.cc: At global scope:
a.cc:9:8: error: ISO C++ forbids declaration of 'Add' with no type [-fpermissive]
    9 | inline Add(int &x,int y){x+=y;if (x>=mod) x-=mod;}
      |        ^~~
a.cc: In function 'int Add(int&, int)':
a.cc:9:50: warning: no return statement in function returning non-void [-Wreturn-type]
    9 | inline Add(int &x,int y){x+=y;if (x>=mod) x-=mod;}
      |                                                  ^
Language: C++

Submit fail
What fuck

int main() {
	int n = input();
	for(int i = 1; i < n; i ++) {
		int u = input(), v = input();
		G[u].push_back(v);
		G[v].push_back(u);
	}
	g[0] = 1;
	for(int i = 2; i <= n; i ++)
		g[i] = g[i - 2] * (i - 1) % mod;
	dp(1, 0);
	printf("%lld\n", (mod - f[1][0]) % mod);
}


Compiler output:
a.cc:1:1: error: 'Submit' does not name a type
    1 | Submit fail
      | ^~~~~~
Language: C

Submit fail
int main() {
	int n = input();
	for(int i = 1; i < n; i ++) {
		int u = input(), v = input();
		G[u].push_back(v);
		G[v].push_back(u);
	}
	g[0] = 1;
	for(int i = 2; i <= n; i ++)
		g[i] = g[i - 2] * (i - 1) % mod;
	dp(1, 0);
	printf("%lld\n", (mod - f[1][0]) % mod);
}


Compiler output:
main.c:1:1: error: unknown type name 'Submit'
    1 | Submit fail
      | ^~~~~~
main.c:1:12: error: expected ';' before 'int'
    1 | Submit fail
      |            ^
      |            ;
    2 | int main() {
      | ~~~         
main.c: In function 'main':
main.c:3:17: error: implicit declaration of function 'input' [-Wimplicit-function-declaration]
    3 |         int n = input();
      |                 ^~~~~
main.c:6:17: error: 'G' undeclared (first use in this function)
    6 |                 G[u].push_back(v);
      |                 ^
main.c:6:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:9: error: 'g' undeclared (first use in this function)
    9 |         g[0] = 1;
      |         ^
main.c:11:45: error: 'mod' undeclared (first use in this function)
   11 |                 g[i] = g[i - 2] * (i - 1) % mod;
      |                                             ^~~
main.c:12:9: error: implicit declaration of function 'dp' [-Wimplicit-function-declaration]
   12 |         dp(1, 0);
      |         ^~
main.c:13:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   13 |         printf("%lld\n", (mod - f[1][0]) % mod);
      |         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | Submit fail
main.c:13:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   13 |         printf("%lld\n", (mod - f[1][0]) % mod);
      |         ^~~~~~
main.c:13:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:33: error: 'f' undeclared (first use in this function)
   13 |         printf("%lld\n", (mod - f[1][0]) % mod);
      |                                 ^
Language: C++

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

using namespace std;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar();}
	return f * x;
}

int n, m, x[5005], y[5005], ans, tot;

int main()
{
	n = gi();
	for (int i = 1; i < n; i++) x[i] = gi(), y[i] = gi();
	if (n == 4 && x[2] == 1) printf(3);
	else if (n == 4 && x[2] == 2) printf("2");
	else if (n == 4) printf("10");
	else if (n == 10) printf("672");
	else printf("%d\n", n / 2);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:41: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
   24 |         if (n == 4 && x[2] == 1) printf(3);
      |                                         ^
      |                                         |
      |                                         int
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int N = 5001;
int dp[N][N];
vector<vector<int>> adj;
int n;
int G[N];
int T[2][N];
int sz[N];

int solve(int u, int p = -1){
  sz[u] = 1;
  dp[u][1] = 1;
  bool ch = 0;
  for(auto el : adj[u]){
    if(el != p){
      solve(el, u);
      int tmp[sz[u] + sz[el] + 1];
      for(int i = 0;i < sz[u] + sz[el] + 1;i++)
        tmp[i] = 0;
      for(int i = 1;i <= sz[u];i++){
        for(int j = 1;j <= sz[el];j++){
          tmp[i + j] += (tmp[i + j] + 1ll * dp[el][j] * dp[u][i] % MOD) % MOD;
          if(j % 2 == 0)
            tmp[i] = ((tmp - 1ll * dp[el][j] * dp[u][i] % MOD * G[j] % MOD) % MOD + MOD) % MOD;
        }
      }
      sz[u] += sz[el];
      for(int i = 0;i <= sz[u];i++)
        dp[u][i] = tmp[i];
    }
  }
}
int main()
{
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  cin >> n;
  adj.resize(n);
  for(int i = 0;i < n - 1;i++){
    int u, v;
    scanf("%d %d", &u, &v);
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
//  solve(0);
//  return 0;
  G[0] = 1;
  for(int i = 2;i < N;i += 2)
    G[i] = 1ll * (i - 1) * G[i - 2] % MOD;
//  for(int i =1 ;i < 10;i++){
//    cout << G[i] << endl;
//  }
  solve(0);
//cout << sz[0]<< endl;
  ll res = 0;
  for(int i = 1;i <= n;i++){
//    cout << dp[0][i] << endl;
    res += dp[0][i] * G[i] % MOD;
    res %= MOD;
  }
  cout << res;
  return 0;
}


Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:27:77: error: invalid operands of types 'int*' and 'const int' to binary 'operator%'
   27 |             tmp[i] = ((tmp - 1ll * dp[el][j] * dp[u][i] % MOD * G[j] % MOD) % MOD + MOD) % MOD;
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
      |                            |                                                  |
      |                            int*                                               const int
a.cc:35:1: warning: no return statement in function returning non-void [-Wreturn-type]
   35 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x)(x)*(x)
#define fz1(i,n) for (i=1;i<=n;i++)
#define fd1(i,n) for (i=n;i>=1;i--)
#define fz0g(i,n) for (i=0;i<=n;i++)
#define fd0g(i,n) for (i=n;i>=0;i--)
#define fz0k(i,n) for (i=0;i<n;i++)
#define fd0k(i,n) for (i=(long long)(n-1);i>=0;i--)
#define fz(i,x,y) for (i=x;i<=y;i++)
#define fd(i,y,x) for (i=y;i>=x;i--)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){char ss[len];scanf("%s",ss);(st)=ss;}
using namespace std;
//struct bit{T_ arr[1000005];int lowbit(int x){return x&(-x);}void add(int x,T_ y){for (int i=x;i<=n;i+=lowbit(i)) arr[i]+=y;}T_ query(int x){T_ s=0;for (int i=x;i>0;i-=lowbit(i)) s+=arr[i];return s;}};
//struct seg{struct treedot{int l,r;T_ sum,add;void update(T_ x){sum+=(r-l+1)*x; add+=x;}}c[800005];void pushdown(int id){if (c[id].add){c[id*2].update(c[id].add);c[id*2+1].update(c[id].add);c[id].add=0;}}void pushup(int id){c[id].sum=c[id*2].sum+c[id*2+1].sum;}void build(int id,int l,int r){if (l>r) return;c[id].l=l;c[id].r=r;c[id].sum=0;c[id].add=0;if (l==r) c[id].sum=0;else{int mid=l+(r-l)/2;build(id*2,l,mid);build(id*2+1,mid+1,r);pushup(id);}}void update(int id,int le,int ri,T_ x){if (le>c[id].r||ri<c[id].l) return;if (le<=c[id].l&&c[id].r<=ri) c[id].update(x);else{pushdown(id);update(id*2,le,ri,x);update(id*2+1,le,ri,x);pushup(id);}}T_ query(int id,int le,int ri){if (ri<c[id].l||c[id].r<le) return 0;if (le<=c[id].l&&c[id].r<=ri) return c[id].sum;T_ ans=0;pushdown(id);ans+=query(id*2,le,ri);ans+=query(id*2+1,le,ri);pushup(id);return ans;}};
int n,m,i,j,mod=1e9+7,a[100005],b[100005];
struct bit
{
	int lowbit(int x){return x&(-x);}
	int a[100005];
	void add(int x,int y)
	{
		int i;
		for (i=x;i<=n;i+=(lowbit(i))) (a[i]+=y)%mod;
	}
	int query(int x)
	{
		int s=0,i;
		for (i=x;i;i-=lowbit(i)) (s+=a[i])%=mod;
		return s;
	}
}b;
int main()
{
	cin>>n;
	for (i=1;i<=n;i

Compiler output:
a.cc:39:2: error: conflicting declaration 'bit b'
   39 | }b;
      |  ^
a.cc:23:33: note: previous declaration as 'int b [100005]'
   23 | int n,m,i,j,mod=1e9+7,a[100005],b[100005];
      |                                 ^
a.cc: In function 'int main()':
a.cc:43:24: error: expected ')' at end of input
   43 |         for (i=1;i<=n;i
      |             ~          ^
      |                        )
a.cc:43:24: error: expected statement at end of input
a.cc:43:24: error: expected '}' at end of input
a.cc:41:1: note: to match this '{'
   41 | {
      | ^
Language: C++

    #include <iostream>
    #include <string>
    #include <set>  
    #include <stack>
    #include <algorithm>
    #include <vector>
    #include <cmath>
    #include <queue>
    #include <deque>
    #include <cstring>
    #include <cstdio>
    #include <map>
    #include <numeric>
    #include <cassert>
    #include <iomanip>
    #include <sstream>
    #include <ctime>
    #include <bitset> 
    #include <unordered_map>
using namespace std;
#define for1(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,maxn) for1(i,0,maxn)
#define ford(i,b,a) for(int i=(int)(b)-1;i>=a;--i)
typedef long long ll;
typedef unsigned long long int128;
typedef pair<int,int> pii;
typedef pair<int,pii > piii;
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
#define mod1 1000000007
#define mod2 998244353
#define eps 1e-10
#define pi acos(-1)
#define st first
#define nd second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define dprintf(...) printf(__VA_ARGS__)
#define lson(x) ((x)<<1)
#define rson(x) ((x)<<1^1)
const int dx[4]={0,0,1,1},dy[4]={1,0,1,0};
const int maxn=5007;
int n;
int sz[maxn];
vector<int> g[maxn];
ll pw[maxn];
ll dp[maxn][maxn][2];
ll pre[maxn][2];
void cal(int x,int p)
{
	sz[x]=1;dp[x][1][0]=1;
	rep(i,g[x].size())
	{
		int to=g[x][i];
		if(to==p)continue;
		cal(to,x);
		for(int j=1;j<=sz[x];j++)
		{
			pre[j][0]=dp[x][j][0];pre[j][1]=dp[x][j][1];
			dp[x][j][0]=dp[x][j][1]=0; 
		}
		for(int j=1;j<=sz[x];j++)
		{
			for(int k=1;k<=sz[to];k++)
			{
				rep(dir,4)
				{
					int xd=dx[dir],tod=dy[dir];
				//	cout<<xd<<" "<<tod<<endl;
				//	system("pause");
					dp[x][j+k][(xd+tod)%2]+=pre[j][xd]*dp[to][k][tod];
					dp[x][j+k][(xd+tod)%2]%=mod1;
					dp[x][j][(xd+tod+1)%2]+=pre[j][xd]*dp[to][k][tod]*pw[k];
					dp[x][j][(xd+tod+1)%2]%=mod1;
				}
			}
		}
		sz[x]+=sz[to];
	}
}
int main()
{
	scanf("%d",&n);
	rep(i,n-1)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		g[x].pb(y);
		g[y].pb(x);
	}
	pw[0]=1;
	for(int i=2;i<=n;i+=2)pw[i]=(pw[i-2]*1ll*(i-1))%mod1;
	cal(1,0);
	ll ans;
	ans=0;
	for(int rm=2;rm<=n;rm+=2)
	{
	//	cout<<dp[1][rm][0]<<" "<<dp[1][rm][1]<<endl;
		ans=(ans+pw[rm]*(dp[1][rm][0]-dp[1][rm][1]+mod1)%mod1)%mod1;
	}
	printf("%lld\n",ans%mod);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:102:29: error: 'mod' was not declared in this scope; did you mean 'modf'?
  102 |         printf("%lld\n",ans%mod);
      |                             ^~~
      |                             modf
Language: C++

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

#define int long long

#define _   int v, int tl, int tr, int l, int r
#define tm  (tl + tr >> 1)
#define sol v+v, tl, tm, l, r
#define sag v+v+1, tm+1, tr, l, r
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N   = 1e5 + 5;

pp P[N];
int A[N], W[N], w, F[N], dp[N], n;

int qry(int x){
    int t = 1;
    for(; x ; x -= x&-x)
        t = (t + F[x]) % mod;
    return t;
}
void up(int x, int t){
    for(; x <= n; x += x&-x)
        F[x] = (F[x] + t) % mod;
}


signed main(){
    int m;
    cin >> n >> m;
    for(int i=1; i<=n; i++) scanf("%lld", &A[i]);
    int p = 0;
    for(int j=1, i=1; i<=m; i++){
        int x;
        scanf("%lld", &x);
    	for(; j <= n && A[j] < x; j++){
            if(i == 1) continue;
            P[++w] = mp(A[j] - p, x - A[j]);
            W[w] = P[w].nd;
        }
    	p = x;
    }    
    
    sort(P+1 , P+w+1);
    sort(W+1 , W+w+1);
    int ans = 1;
    for(int i=w; i>=1; i--){
        if(P[i] == P[i+1]) continue;
        int ind = lower_bound(W+1 , W+w+1 , P[i].nd) - W;

        int dp = (ss + qry(n-ind)) % mod;
        up(n-ind+1, dp);	
        
        if(P[i].st != P[i-1].st) ans = (ans + dp) % mod;
    }
    
    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:19: error: 'ss' was not declared in this scope; did you mean 'st'?
   56 |         int dp = (ss + qry(n-ind)) % mod;
      |                   ^~
      |                   st
Language: C++

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<algorithm>
#include<ctime>
#define lowbit(x) (x&-x)
using namespace std;
const int mod=1e9+7;
inline int read()
{
	int kkk=0,x=1;
	char c=getchar();
	while((c<'0' || c>'9') && c!='-')
		c=getchar();
	if(c=='-')
		c=getchar(),x=-1;
	while(c>='0' && c<='9')
		kkk=(kkk<<3)+(kkk<<1)+(c-'0'),c=getchar();
	return kkk*x;
}
int n,m,x[100001],y[100001],liml,limr,tree[100001],dp[100001],ans;
struct sb
{
	int l,r;
	const operator ==(const sb &x)const
	{
		return x.l==l && x.r==r;
	}
}a[100001];
inline int cmp(sb x,sb y)
{
	return x.l<y.l || (x.l==y.l && x.r<y.r);
}
inline int cx(int zone)
{
	int bck=0;
	while(zone)
	{
		bck=(bck+tree[zone])%mod;
		zone-=lowbit(zone);
	}
	return bck;
}
inline void xg(int zone,int v)
{
	while(zone<=n)
	{
		tree[zone]=(tree[zone]+v)%mod;
		zone+=lowbit(zone);
	}
}
int main()
{
	n=read(),m=read();
	for(register int i=1;i<=n;++i)
		x[i]=read();
	for(register int i=1;i<=m;++i)
		y[i]=read();
	for(liml=1;liml<=n && x[liml]<y[1];++liml);
	for(limr=n;limr>=1 && x[limr]>y[m];--limr);
	/*if(liml>limr)
	{
		puts("1");
		return 0;
	}*/
	int bj=1;
	n=0;
	for(register int i=liml;i<=limr;++i)
	{
		while(x[i]>y[bj+1])
			++bj;
		a[++n].l=x[i]-y[bj];
		a[n].r=y[bj+1]-x[i];
	}
	sort(a+1,a+n+1,cmp);
	n=unique(a+1,a+n+1)-a-1;
	for(register int i=1;i<=n;)
	{
		int mem=i;
		while(a[i].l==a[mem].l && i<=n)
		{
			dp[i]=(cx(a[i].r-1)+1)%mod;
			ans=(ans+dp[i])%mod;
			++i;
		}
		for(register int j=mem;j<i;++j)
			xg(a[j].r,dp[j]);
	}
	printf("%d\n",(ans+1)%mod);
	return 0;
}

Compiler output:
a.cc:28:15: error: ISO C++ forbids declaration of 'operator==' with no type [-fpermissive]
   28 |         const operator ==(const sb &x)const
      |               ^~~~~~~~
a.cc: In function 'int main()':
a.cc:58:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   58 |         for(register int i=1;i<=n;++i)
      |                          ^
a.cc:60:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   60 |         for(register int i=1;i<=m;++i)
      |                          ^
a.cc:71:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   71 |         for(register int i=liml;i<=limr;++i)
      |                          ^
a.cc:80:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   80 |         for(register int i=1;i<=n;)
      |                          ^
a.cc:89:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   89 |                 for(register int j=mem;j<i;++j)
      |                                  ^
Language: C++

#include <bits/stdc++.h>
#define N 200005
#define p 1000000007
using namespace std;

int n,m,ct,tmp_ct,x[N],y[N],a[N];
pair <int,int>P[N];
long long sum[N];
vector<int>Ve[N];

inline int lowbit(int x){return x&-x;}

inline void add(int x,int y){for(int i=x;i<=tmp_ct+1;i+=lowbit(i))(sum[i]+=y)%=p;}

inline long long ask(int x){long long tmp=0;for(int i=x;i;i-=lowbit(i))(tmp+=sum[i])%=p;return tmp;}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",&x[i]);
	for(int i=1;i<=m;i++)
		scanf("%d",&y[i]);
	for(int i=1;i<=n;i++)
	{
		if(x[i]<y[1]||x[i]>y[m])continue;
		int pos=upper_bound(y+1,y+1+m,x[i])-y;
		P[++ct]=make_pair(y[pos]-x[i],x[i]-y[pos-1]);
	}
	sort(P+1,P+1+ct);
	for(int i=1;i<=ct;i++)
		a[2*i-1]=P[i].first,a[2*i]=P[i].second;
	sort(a+1,a+1+2*ct);
	tmp_ct=unique(a+1,a+1+2*ct)-a-1;
	for(int i=1;i<=ct;i++)
	{
		P[i].first=lower_bound(a+1,a+1+tmp_ct,P[i].first)-a;
		P[i].second=lower_bound(a+1,a+1+tmp_ct,P[i].second)-a;
		Ve[P[i].first].push_back(P[i].second);
	}
	add(1,1);
	for(int i=1;i<=tmp_ct;i++)
	{
		int las=0;
		for(vector<int>::reverse_iteratorit=Ve[i].rbegin();it!=Ve[i].rend();it++)
			if(*it!=las)add(*it+1,ask(*it)),las=*it;
	}
	printf("%lld",ask(tmp_ct+1));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:34: error: 'reverse_iteratorit' is not a member of 'std::vector<int>'
   45 |                 for(vector<int>::reverse_iteratorit=Ve[i].rbegin();it!=Ve[i].rend();it++)
      |                                  ^~~~~~~~~~~~~~~~~~
a.cc:45:68: error: 'it' was not declared in this scope; did you mean 'i'?
   45 |                 for(vector<int>::reverse_iteratorit=Ve[i].rbegin();it!=Ve[i].rend();it++)
      |                                                                    ^~
      |                                                                    i
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e5+5;
const int mod=1e9+7;
int n,m,x[N],y[N],tot,o[N],len,bit[N];
struct node{
	int x,y;
	bool operator < (const node &b)const{
		return x==b.x?y>b.y:x<b.x;
	}
}a[N];
void modify(int x,int v){
	while(x<=len)bit[x]=(bit[x]+v)%mod,x+=x&-x;
}
int query(int x){
	int res=0;
	while(x)res=(res+bit[x])%mod,x^=x&-x;
	return res;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)scanf("%d",&x[i]);
	for(int i=1;i<=m;++i)scanf("%d",&y[i]);
	for(int i=1;i<=n;++i){
		if(x[i]<y[1]||x[i]>y[m])continue;
		int p=upper_bound(y+1,y+m+1,x[i])-y;
x		a[++tot]=(node){x[i]-y[p-1],o[++len]=y[p]-x[i]};
	}
	sort(a+1,a+tot+1);sort(o+1,o+len+1);len=unique(o+1,o+len+1)-o-1;
	for(int i=1;i<=tot;++i)
		if(a[i].x!=a[i-1].x||a[i].y!=a[i-1].y){
			int p=lower_bound(o+1,o+len+1,a[i].y)-o;
			modify(p,query(p-1)+1);
		}
	printf("%d\n",(query(len)+1)%mod);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:8: error: expected ';' before 'a'
   28 | x               a[++tot]=(node){x[i]-y[p-1],o[++len]=y[p]-x[i]};
      |  ^~~~~~~        ~
      |        ;