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

#include<cstdio>
#include<algorithm>
#include<map>

using namespac std;

int n,i,x;

map<int,int>mp;

int main()
{
      scanf("%d",&n);
      for (i=1;i<=n;++i) scanf("%d",&x),mp[x]++;
      for (map<int,int>::iterator it=mp.begin();it!=mp.end();++it)
         ans+=it->se-1;
     printf("%d\n",n-ans-(ans%2));
}

Compiler output:
a.cc:5:7: error: expected nested-name-specifier before 'namespac'
    5 | using namespac std;
      |       ^~~~~~~~
a.cc:9:1: error: 'map' does not name a type
    9 | map<int,int>mp;
      | ^~~
a.cc: In function 'int main()':
a.cc:14:41: error: 'mp' was not declared in this scope
   14 |       for (i=1;i<=n;++i) scanf("%d",&x),mp[x]++;
      |                                         ^~
a.cc:15:12: error: 'map' was not declared in this scope
   15 |       for (map<int,int>::iterator it=mp.begin();it!=mp.end();++it)
      |            ^~~
a.cc:15:12: note: suggested alternatives:
In file included from /usr/include/c++/14/map:63,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_map.h:102:11: note:   'std::map'
  102 |     class map
      |           ^~~
/usr/include/c++/14/map:89:13: note:   'std::pmr::map'
   89 |       using map
      |             ^~~
a.cc:15:16: error: expected primary-expression before 'int'
   15 |       for (map<int,int>::iterator it=mp.begin();it!=mp.end();++it)
      |                ^~~
a.cc:15:49: error: 'it' was not declared in this scope; did you mean 'int'?
   15 |       for (map<int,int>::iterator it=mp.begin();it!=mp.end();++it)
      |                                                 ^~
      |                                                 int
a.cc:15:53: error: 'mp' was not declared in this scope
   15 |       for (map<int,int>::iterator it=mp.begin();it!=mp.end();++it)
      |                                                     ^~
a.cc:16:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |          ans+=it->se-1;
      |          ^~~
      |          abs
a.cc:17:22: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |      printf("%d\n",n-ans-(ans%2));
      |                      ^~~
      |                      abs
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <math.h>
#include <set>
#include <map>
using namespace std;
#define rep(i,n) for(int i = 0; i < n ; i++)
#define pb push_back
static const int INF = 1000000;
static const int MAX = 100001;

typedef pair<int, int> P;
typedef pair<P, int> PP;


int main(void){
  int N; cin >> N;
  int cnt[MAX];
  set<int> st;
  memset(cnt,0,sizeof(cnt));
  int odd = 0;
  long int  b;
  rep(i,N){
    cin >> b;
    st.insert(b);
    cnt[b] += 1;
    if(cnt[b] % 2 == 1 && cnt[b] >= 2) {
      odd -= 1;
    }else if(cnt[b] % 2 == 0)  {
      odd += 1;
    }
  }

  if(odd % 2 == 0){
    cout << N - (N - st.size()) << endl;
  }else{
    cout << N - (N - st.size()) - 1 << endl;
  }


  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:3: error: 'memset' was not declared in this scope
   24 |   memset(cnt,0,sizeof(cnt));
      |   ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <map>
  +++ |+#include <cstring>
   10 | using namespace std;
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//constants
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = 1<<28;


int main(int argc, char **argv) {
    int N;
    cin >> N;
    vector<int> A;
    A.resize(100001, 0);
    int start=INF, end=0;
    REP(i, N){
        int a;
        cin >> a;
        A[a]++;
        if (A[a] > 1 and a < start)
            start = a;
        if (A[a] > 1 and a > end)
            end = a;
    }

    if (start==INF)
        goto end;

    while(start!=end){
        //debug(start);
        //debug(end);
        A[start]--;
        A[end]--;
        if (A[start] == 1){
            int i;
            for(i = start+1; i < end+1; i++){
                if(A[i] > 1){
                    start = i;
                    break;
                }
            }
            if(i==end+1)
                break;
        }
        if (A[end] == 1){
            for(int i = end-1; i >= start; i--)
                if(A[i] > 1){
                    end = i;
                    break;
                }
        }
    }

    int ans = 0;
    while(A[start] > 2)
        A[start] -= 2;
    if (A[start] == 2){
        A[start] = 1;
        ans--;
    }

end:
    REP(i, 100001)
        if (A[i] == 1){
            //cout << i << endl;
            ans++;
        }

    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:83:1: error: jump to label 'end'
   83 | end:
      | ^~~
a.cc:48:14: note:   from here
   48 |         goto end;
      |              ^~~
a.cc:75:9: note:   crosses initialization of 'int ans'
   75 |     int ans = 0;
      |         ^~~
Language: C++

#include <iostream>
#include <vector>
#define pb push_back
using namespace std;

int na[111111];
int use[111111];
int main(void){
  int i,n,x;
  int m;
  int res;
  vector<int> a;
  cin>>n;
  for(i=0;i<n;i++){
    cin>>x;
    a.pb(x);
    na[x]++;
  }
  sort(a.begin(),a.end());
  res=m=0;
  for(i=0;i<n;i++){

    if(use[a[i]]!=1){

      use[a[i]]=1;
      na[a[i]]=na[a[i]]%2==1?1:2;
      if(na[a[i]]==1) res++;
      if(na[a[i]]==2){
        res++;
        m++;
      }
    }
  }

  if(m%2==1) res--;
  cout<<res<<endl;
  return 0;
}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
#include <fstream>
#include <sstream>
#include <string>
#include <time.h>
#include <math.h>
#include <set>

using namespace std;

int main() {
  int n;
  set<int> st;
  cin >> n;
  int a;
  for(int i=0;i<n;i++) {
    cin >> a;
    st.insert(a);
  }
  a = set.size();
  if(a%2==1) {
    cout << a << endl;
  }else{
    cout << a-1 << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:10: error: missing template arguments before '.' token
   23 |   a = set.size();
      |          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
map<int, int>m;
int main(){
  int n;
  int x;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x;
    m[x]++;
  }
  priority_queue<int>Q;
  for(auto it:m)
    Q.push((it.second));
  while(true){
    if(Q.top() == 1)
      break;
    n-=2;
    if(Q.size() == a){
      int a = Q.top();
      Q.pop();
      Q.push(a - 2);
      continue;
    }
    int a = Q.top();
    Q.pop();
    int b = Q.top();
    Q.pop();
    a--;
    b--;
    if(a)
      Q.push(a);
    if(b)
      Q.push(b);
  }
  cout << n << endl;


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:20: error: 'a' was not declared in this scope
   24 |     if(Q.size() == a){
      |                    ^
a.cc:25:11: error: redeclaration of 'int a'
   25 |       int a = Q.top();
      |           ^
a.cc:24:20: note: '<typeprefixerror>a' previously declared here
   24 |     if(Q.size() == a){
      |                    ^
Language: C++

int N, d;
bool seen[100005];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'scanf' was not declared in this scope
    5 |     scanf("%d", &N);
      |     ^~~~~
a.cc:11:5: error: 'printf' was not declared in this scope
   11 |     printf("%d\n", N - d - (d&1));
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int N, d;
Language: C++

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

const int N=300010;
int n,m,ql,qr,ans[N];

int read()
{
	int d=0; char ch=getchar();
	while (!isidigt(ch)) ch=getchar();
	while (isdigit(ch)) d=(d<<3)+(d<<1)+ch-48,ch=getchar();
	return d;
}

int main()
{
	m=read(); n=read();
	while (m--)
	{
		ql=read(); qr=read();
		for (reg int i=1;i<=qr;)
		{
			int d=qr/i,j=qr/d,k=(ql-1)/d;
			ans[max(k+1,i)]++; ans[j+1]--;
			i=j+1;
		}
	}
	for (reg int i=1;i<=n;i++)
	{
		ans[i]+=ans[i-1];
		printf("%d\n",ans[i]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int read()':
a.cc:11:17: error: 'isidigt' was not declared in this scope; did you mean 'isxdigit'?
   11 |         while (!isidigt(ch)) ch=getchar();
      |                 ^~~~~~~
      |                 isxdigit
a.cc: In function 'int main()':
a.cc:22:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |                 for (reg int i=1;i<=qr;)
      |                              ^
a.cc:29:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   29 |         for (reg int i=1;i<=n;i++)
      |                      ^
Language: C++

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

#define mp make_pair
#define pb push_back
#define x first
#define y second
#define FOR(i, a, b) for(int i=a, _n=b; i<=_n; ++i)
using namespace std;

const int N = 1e5+5, open = -1e7, close = 1e7;
int n, m, ans[N], bit[N];
vector<pair<int, int> > qu;

void update(int i, int x)
{
    for(; i>0; i-=i&-i) bit[i] += x;
}
int get(int i)
{
    int res =0 ; for(; i<=m; i+=i&-i)
    res += bit[i]; return res;
}
int main()
{
    ios::sync_with_stdio(); cin.tie(0);
    ///freopen("a.inp","r",stdin);

    cin >> n >> m;
    FOR(i, 1, n) {
        int l, r; cin >> l >> r;
        FOR(j, 2, sqrt(m)) if (l <= r/j*j) ans[j] += 1;
        qu.pb(mp(l, open));
        qu.pb(mp(r, close+l));
    }
    FOR(j, sqrt(m)+1, m) for(int x=j; x<=m; x+=j) qu.pb(mp(x, j));

    sort(qu.begin(), qu.end());
    FOR(i, 0, qu.size()-1)
    if (qu[i].y == open) {
        update(qu[i].x, 1);
    } else
    if (qu[i].y > close) {
        update(qu[i].y-close, -1);
    } else {
        ans[qu[i].y] += get(qu[i].x-qu[i].y+1);
    }

    ans[1] = n;
    FOR(i, 1, m) cout << ans[i] << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:19: error: 'sqrt' was not declared in this scope
   35 |         FOR(j, 2, sqrt(m)) if (l <= r/j*j) ans[j] += 1;
      |                   ^~~~
a.cc:11:38: note: in definition of macro 'FOR'
   11 | #define FOR(i, a, b) for(int i=a, _n=b; i<=_n; ++i)
      |                                      ^
a.cc:39:12: error: 'sqrt' was not declared in this scope
   39 |     FOR(j, sqrt(m)+1, m) for(int x=j; x<=m; x+=j) qu.pb(mp(x, j));
      |            ^~~~
a.cc:11:32: note: in definition of macro 'FOR'
   11 | #define FOR(i, a, b) for(int i=a, _n=b; i<=_n; ++i)
      |                                ^
a.cc:11:44: error: '_n' was not declared in this scope; did you mean 'n'?
   11 | #define FOR(i, a, b) for(int i=a, _n=b; i<=_n; ++i)
      |                                            ^~
a.cc:39:5: note: in expansion of macro 'FOR'
   39 |     FOR(j, sqrt(m)+1, m) for(int x=j; x<=m; x+=j) qu.pb(mp(x, j));
      |     ^~~
Language: C++

#include <bits/stdc++.h>
#define lowbit(x) (x & -x)
using namespace std;

// 数组开小了 /kk
const int _ = 3e5 + 10;
int N, M, d;
struct node {
	int l, r, len;
} a[_];

struct BIT {
	int c[_];
	void insert(int x, int y) {
		for ( ; x <= M + 1; x += lowbit(x)) c[x] += y;
	}
	int query(int x) {
		int y = 0;
		for ( ; x; x -= lowbit(x)) y += c[x];
		return y;
	}
} tr; 

int main() {
	scanf("%d%d", &N, &M);
	for (int i = 1; i <= N; ++i) {
		scanf("%d%d", &a[i].l, &a[i].r);
		a[i].len = (a[i].r - a[i].l + 1);
	}
	sort(a + 1, a + N + 1,
			 [](node a, node b) -> bool { return a.len < b.len; });
	for (int d = 1, p = 1; d <= M; ++d) {
		while (p <= N && a[p].len < d) {
			tr.insert(a[p].l, 1);
			tr.insert(a[p].r + 1, -1);
			++p;
		}
		int ans = N - p + 1;
		for (int i = d; i <= M; i += d)
			ans += tr.query(i);
		printf("%d\n", ans);
	}
	return 0;
}

Compiler output:
a.cc:22:6: error: extended character   is not valid in an identifier
   22 | } tr; 
      |      ^
a.cc:22:6: error: '\U00002028' does not name a type
   22 | } tr; 
      |      ^
Language: C++

#include <bits/stdc++.h>
#include "../lib/lazysegmenttree/lazy_segtree_add_sum.hpp"

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, m; cin >> n >> m;
  vector<vector<P>> v(m+1);
  for(int i=0;i<n;++i) {
    int l, r; cin >> l >> r;
    v[r-l+1].push_back({l, r});
  }

  LazySegmentTreeAddSum st(vll(m+1));

  ll su = n;
  for(int i=1;i<=m;++i) {
    
    for(int j=0;j<SZ(v[i]);++j) {
      su--;
      st.add(v[i][j].first, v[i][j].second + 1, 1);
    }

    int pos = 0;
    int ans = su;
    while(pos <= m) {
      ans += st.getsum(pos, pos+1);
      //cout << i << ":" << pos << ":" << ans << endl;
      pos += i;
    }
    cout << ans << endl;
  }
}


Compiler output:
a.cc:2:10: fatal error: ../lib/lazysegmenttree/lazy_segtree_add_sum.hpp: No such file or directory
    2 | #include "../lib/lazysegmenttree/lazy_segtree_add_sum.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef long long ijt;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;

const long long INF = 1LL << 55;

#define itn int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<typename T> // T: type of cost
struct BIT {
	ijt n;
	vector<T> d;
	BIT(ijt n = 0) :n(n), d(n + 1) {}
	void add(ijt i, T x = 1) {
		for (i++; i <= n; i += i & -i) {
			d[i] += x;
		}
	}
	T sum(ijt i) {
		T x = 0;
		for (i++; i; i -= i & -i) {
			x += d[i];
		}
		return x;
	}

	long long inversion(vector<ijt> a) {
		long long ans = 0;
		for (ijt j = 0; j < a.size(); j++) {
			ans += j - sum(a[j]);
			add(a[j], 1);
		}
		return ans;
	}
};
ijt main(void) {
	ijt n, m; cin >> n >> m;
	vector < pair<ijt, pair<ijt, ijt>>> p(n);
	for (ijt i = 0; i < n; i++)
	{
		ijt a, b; cin >> a >> b;
		p[i] = mp(b - a + 1, mp(a, b));
	}
	sort(all(p));
	ijt k = 0;
	BIT<ijt> bt(300030);
	for (ijt i = 1; i <= m; i++) {
		ijt ans = 0;
		while (p[k].ff <= i) {
			bt.add(p[k].ss.ss + 1, -1);
			bt.add(p[k].ss.ff, 1);
			k++;
		}
		ans += n - k;
		for (ijt j = 0; j <= m + 1; j += i) {
			ans += bt.sum(j);
		}

		cout << ans << endl;
	}

	cout << endl;
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
#define PI acos(-1.0)
#define MOD 2520
#define E 1e-12
using namespace std;
typedef long long ll;
const int MAXN=500000+5;//最大元素个数
int n,m;//元素个数
int c[MAXN];//c[i]==A[i]+A[i-1]+...+A[i-lowbit(i)+1]
//返回i的二进制最右边1的值
int lowbit(int i)
{
    return i&(-i);
}
//返回A[1]+...A[i]的和
int sum(int x)
{
    int sum = 0;
    while(x)
    {
        sum += c[x];
        x -= lowbit(x);
    }
    return sum;
}
//令A[i] += val
void add(int x, int val)
{
	
    while(x <= n)   //注意这里的n，是树状数组维护的长度
    {
        c[x] += val;
        x += lowbit(x);
    }
}
struct node
{
	int l,r;
}a[MAXN];
bool cmp1(node x,node y)
{
	return x.r-x.l<y.r-y.l;
}
bool cmp2(node x,node y)
{
	return x.r-x.l<=y.r-y.l;
}
int main()
{

    while(scanf("%d%d",&m,&n)!=-1)
    {
        memset(c,0,sizeof(c));
        for(int i=1;i<=m;i++)
		{
			scanf("%d%d",&a[i].l,&a[i].r);
		}
		sort(a+1,a+m+1,cmp);
		
		int j=0;
		for(int d=1;d<=n;d++)
		{
			int temp=0;
			for(int i=d;i<=n;i+=d)
			{
				temp+=sum(i);
			}
			printf("%d\n",temp+m-j)  ;
			
			while(j<m&&a[j+1].r-a[j+1].l+1<d)
			{
				add(a[j+1].l,1);
				add(a[j+1].r+1,-1);
				j++;
			}
			
		}
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:32: error: 'cmp' was not declared in this scope; did you mean 'cmp2'?
   60 |                 sort(a+1,a+m+1,cmp);
      |                                ^~~
      |                                cmp2
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

const int MAXN = 3e5 + 10;
int N, M;
struct Node {
	int l, r, d;
} A[MAXN];
int tr[MAXN];

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

inline void update(int x, int d) {
	for(; x <= N; x += lowbit(x))
		tr[x] += d;
}

inline int query(int x) {
	int res = 0;
	for(; x; x -= lowbit(x))
		res += tr[x];
	return res;
}

int main() {
	register int i, d;
	scanf("%d%d", &N, &M);
	for(i = 1; i <= N; ++i)
		scanf("%d%d", &A[i].l, &A[i].r), A[i].d = A[i].r - A[i].l + 1;
	sort(A + 1, A + N + 1, [&](Node x, Node y) {return x.d < y.d;});
	int k = 1;
	for(d = 1; d <= M; ++d) {
		while(k <= N && A[k].d < d) {
			update(A[k].l, 1); update(A[k].r + 1\, -1);
			++k;
		}
		int ans = N - k + 1;
		for(i = d; i <= M; i += d)
			ans += query(i);
		printf("%d\n", ans);
	}
	return 0;
}

Compiler output:
a.cc:40:61: error: stray '\' in program
   40 |                         update(A[k].l, 1); update(A[k].r + 1\, -1);
      |                                                             ^
a.cc: In function 'int main()':
a.cc:32:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   32 |         register int i, d;
      |                      ^
a.cc:32:25: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   32 |         register int i, d;
      |                         ^
Language: C++

#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N, M; cin >> N >> M;
    vec l(N), r(N);
    REP(i, N) cin >> l[i] >> r[i];

    vector<Pii> p(N);
    REP(i, N) p[i] = Pii(r[i] - l[i] + 1, i);
    SORT(p);

    int d0 = 1;
    vec ans(M + 1);
    BIT bit(M + 1), bit2(M + 1);
    REP(i, N){
        int D = p[i].first;
        int n = p[i].second;

        bit.add(1, 1);
        bit.add(D + 1, -1);

        FOR(d, d0 + 1, D + 1){
            FOR(k, 1, M / d + 1) ans[d] += bit2.sum(d * i);
        }
        d0 = D;
        bit2.add(l[n], 1);
        bit2.add(r[n] + 1, -1);
    }
    FOR(d, d0 + 1, M + 1){
        FOR(k, 1, M / d + 1) ans[d] += bit2.sum(d * i);
    }

    REP(d, M + 1) ans[d] += bit.sum(d);
    REP(d, M + 1) cout << ans[d] << endl;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: 'BIT' was not declared in this scope
   34 |     BIT bit(M + 1), bit2(M + 1);
      |     ^~~
a.cc:39:9: error: 'bit' was not declared in this scope
   39 |         bit.add(1, 1);
      |         ^~~
a.cc:43:44: error: 'bit2' was not declared in this scope
   43 |             FOR(k, 1, M / d + 1) ans[d] += bit2.sum(d * i);
      |                                            ^~~~
a.cc:46:9: error: 'bit2' was not declared in this scope
   46 |         bit2.add(l[n], 1);
      |         ^~~~
a.cc:50:40: error: 'bit2' was not declared in this scope
   50 |         FOR(k, 1, M / d + 1) ans[d] += bit2.sum(d * i);
      |                                        ^~~~
a.cc:50:53: error: 'i' was not declared in this scope
   50 |         FOR(k, 1, M / d + 1) ans[d] += bit2.sum(d * i);
      |                                                     ^
a.cc:53:29: error: 'bit' was not declared in this scope
   53 |     REP(d, M + 1) ans[d] += bit.sum(d);
      |                             ^~~
Language: C++

#include <bits/stdc++.h>
std::vector<int> A['   '];
int N, M, S['   '], B, L, R, I;
void U(int z, int u) {
  while (z <= N)
    S[z] += u, z += z & -z;
}
main() {
  for (gets(&I); ~scanf("%d%d", &L, &R);)
    M++, A[R - L + 1].push_back(L);
  for (L = 1; L <= N; L++) {
    B = M;
    for (I = L; I <= N; I += L) {
      R = I;
      while (R)
        B += S[R], R -= R & -R;
    }
    for (int u : A[L])
      U(u, 1), U(u + L, -1), M--;
    printf("%d\n", B);
  }
}

Compiler output:
a.cc:2:20: warning: multi-character character constant [-Wmultichar]
    2 | std::vector<int> A['   '];
      |                    ^~~~~
a.cc:3:13: warning: multi-character character constant [-Wmultichar]
    3 | int N, M, S['   '], B, L, R, I;
      |             ^~~~~
a.cc:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:9:8: error: 'gets' was not declared in this scope; did you mean 'getw'?
    9 |   for (gets(&I); ~scanf("%d%d", &L, &R);)
      |        ^~~~
      |        getw
Language: C++

#include <bits/stdc++.h>
std::vector<int> A['   '];
int N, M, S['   '];
void U(int z, int u) {
  while (z <= N)
    S[z] += u, z += z & -z;
}
main(B, L, R, I) {
  std::cin >> M >> N;
  for (I = 1; I <= M; I++)
    std::cin >> L >> R, A[R - L + 1].push_back(L);
  for (L = 1; L <= N; L++) {
    B = M;
    for (I = L; I <= N; I += L) {
      R = I;
      while (R)
        B += S[R], R -= R & -R;
    }
    for (int u : A[L])
      U(u, 1), U(u + L, -1), M--;
    std::cout << B << "\n";
  }
}

Compiler output:
a.cc:2:20: warning: multi-character character constant [-Wmultichar]
    2 | std::vector<int> A['   '];
      |                    ^~~~~
a.cc:3:13: warning: multi-character character constant [-Wmultichar]
    3 | int N, M, S['   '];
      |             ^~~~~
a.cc:8:5: error: expected constructor, destructor, or type conversion before '(' token
    8 | main(B, L, R, I) {
      |     ^
Language: C++

#include <bits/stdc++.h>
std::vector<int> A['   '];
int n, m, S['   '], a, l, r, i, d;
void U(int x, int u) {
  while (x <= n)
    S[x] += u, x += x & -x;
}
int main() {
  scanf("%d%d", &m, &n);
  for (i = 1; i <= m; i++)
    scanf("%d%d", &l, &r), A[r - l + 1].push_back(l);
  for (d = 1; d <= n; d++) {
    a = m;
    for (i = d; i <= n; i += d) {
      r = 0;
      while (x)
        r += S[x], x -= x & -x;
      Q(i), a += r;
    }
    for (int u : A[d])
      U(u, 1), U(u + d, -1), m--;
    printf("%d\n", a);
  }
  return 0;
}

Compiler output:
a.cc:2:20: warning: multi-character character constant [-Wmultichar]
    2 | std::vector<int> A['   '];
      |                    ^~~~~
a.cc:3:13: warning: multi-character character constant [-Wmultichar]
    3 | int n, m, S['   '], a, l, r, i, d;
      |             ^~~~~
a.cc: In function 'int main()':
a.cc:16:14: error: 'x' was not declared in this scope
   16 |       while (x)
      |              ^
a.cc:18:7: error: 'Q' was not declared in this scope
   18 |       Q(i), a += r;
      |       ^
Language: Java

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main{
        public static void main(String[] args) {
                int bentoType = 0;
                int stationCnt = 0;
                Scanner scanner = new Scanner(System.in);
                System.out.print("弁当の種類を指定してください：");
                bentoType = scanner.nextInt();
                System.out.print("駅の合計数を指定してください：");
                stationCnt = scanner.nextInt();

                Map<Integer, Integer> bentoMap = null;
                ArrayList<Map<Integer, Integer>> array = new
ArrayList<Map<Integer, Integer>>();
                int startSta = 0;
                int endSta = 0;
                System.out.println("AAA:"+bentoType);
                for(int i = 1; i <= bentoType; i++){
                        bentoMap = new HashMap<Integer, Integer>();
                        System.out.print("弁当"+i+"の開始駅を指定してくださ
い：");
                        startSta = scanner.nextInt();
                        System.out.print("弁当"+i+"の終了駅を指定してくださ
い：");
                        endSta = scanner.nextInt();
                        for(int start = startSta; start <= endSta; start++){
                                bentoMap.put(start, 1);
                        }
                        array.add(bentoMap);
                }
                int bentoCnt = 0;
                // 飛ばす駅数のループ
                for(int n = 1; n <= stationCnt; n++){
                        bentoCnt = 0;
                        // 種類のループ
                        for(Map<Integer, Integer> outMap : array){
//                              System.out.print("[");
                                //到着する駅でのループ
                                for(int m = 0; m <= stationCnt; m +=n){
                                        if(outMap.containsKey(m)){
                                                bentoCnt++;
//                                              System.out.print(m);
                                                break;
                                        }
                                }
//                              System.out.print("],");
                        }
//                      System.out.print(" = ");
                        System.out.println(bentoCnt);
                }
                scanner.close();
        }
}

Compiler output:
Main.java:23: error: unclosed string literal
                        System.out.print("??"+i+"????????????
                                                ^
Main.java:24: error: illegal character: '\uff1a'
??");
 ^
Main.java:24: error: not a statement
??");
^
Main.java:24: error: unclosed string literal
??");
  ^
Main.java:26: error: unclosed string literal
                        System.out.print("??"+i+"????????????
                                                ^
Main.java:27: error: illegal character: '\uff1a'
??");
 ^
Main.java:27: error: not a statement
??");
^
Main.java:27: error: unclosed string literal
??");
  ^
8 errors
Language: Java

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Java06 {
        public static void main(String[] args) {
                int bentoType = 0;
                int stationCnt = 0;
                Scanner scanner = new Scanner(System.in);
                System.out.print("弁当の種類を指定してください：");
                bentoType = scanner.nextInt();
                System.out.print("駅の合計数を指定してください：");
                stationCnt = scanner.nextInt();

                Map<Integer, Integer> bentoMap = null;
                ArrayList<Map<Integer, Integer>> array = new
ArrayList<Map<Integer, Integer>>();
                int startSta = 0;
                int endSta = 0;
                System.out.println("AAA:"+bentoType);
                for(int i = 1; i <= bentoType; i++){
                        bentoMap = new HashMap<Integer, Integer>();
                        System.out.print("弁当"+i+"の開始駅を指定してくださ
い：");
                        startSta = scanner.nextInt();
                        System.out.print("弁当"+i+"の終了駅を指定してくださ
い：");
                        endSta = scanner.nextInt();
                        for(int start = startSta; start <= endSta; start++){
                                bentoMap.put(start, 1);
                        }
                        array.add(bentoMap);
                }
                int bentoCnt = 0;
                // 飛ばす駅数のループ
                for(int n = 1; n <= stationCnt; n++){
                        bentoCnt = 0;
                        // 種類のループ
                        for(Map<Integer, Integer> outMap : array){
//                              System.out.print("[");
                                //到着する駅でのループ
                                for(int m = 0; m <= stationCnt; m +=n){
                                        if(outMap.containsKey(m)){
                                                bentoCnt++;
//                                              System.out.print(m);
                                                break;
                                        }
                                }
//                              System.out.print("],");
                        }
//                      System.out.print(" = ");
                        System.out.println(bentoCnt);
                }
                scanner.close();
        }
}

Compiler output:
Main.java:23: error: unclosed string literal
                        System.out.print("??"+i+"????????????
                                                ^
Main.java:24: error: illegal character: '\uff1a'
??");
 ^
Main.java:24: error: not a statement
??");
^
Main.java:24: error: unclosed string literal
??");
  ^
Main.java:26: error: unclosed string literal
                        System.out.print("??"+i+"????????????
                                                ^
Main.java:27: error: illegal character: '\uff1a'
??");
 ^
Main.java:27: error: not a statement
??");
^
Main.java:27: error: unclosed string literal
??");
  ^
8 errors
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<pair<int,int> > v[100010];
int bit[100010],n,m;

void add(int x,int k){
	while(x<=m+1){
		bit[x]+=k;
		x+=x&-x;
	}
}
int sum(int x){
	int s=0;
	while(x){
		s+=bit[x];
		x-=x&-x;
	}
	return s;
}
int main(){
	cin>>n>>m;
	memset(bit,0,m+1);
	for(int i=0;i<n;i++){
		int a,b;cin>>a>>b;
		v[b-a+1].push_back(make_pair(a,b));
	}
	for(int k=1;k<=m;k++){
		for(int i=0;i<v[k-1].size();i++){
			add(v[k-1][i].first,1);
			add(v[k-1][i].second+1,-1);
			n--;
		}
		int cnt=n;
		for(int i=k;i<=m;i+=k){
			cnt+=sum(i);
		}
		cout<<cnt<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'memset' was not declared in this scope
   24 |         memset(bit,0,m+1);
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<vector>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

vector<long long int> prime_factor(long long int n){
    vector<long long int> res;
    for(int i=2; i*i<=n; ++i){
        while(n%i==0){
            res.push_back(i);
            n/=i;
        }
    }
    if(n!=1) res.push_back(n);
    return res;
};

class segtree{
public:
    i64 n,size_;
    vector<vector<pair<int,int>>> segs;
    segtree()=default;
    segtree(i64 size){ init(size); }
    void init(i64 size){
        size_=size;
        n=1;
        while(n<size) n*=2;
        segs.resize(n*2-1);
    }
    void insert(int l_,int r_){ insert(0,n,0,l_,r_); }
    void insert(int a,int b,int index,int l_,int r_){
        if(b<=l_ or r_<=a) return;
        if(l_<=a and b<=r_){
            segs[index].push_back(make_pair(l_,r_));
            return;
        }
        insert(a,(a+b)/2,2*index+1,l_,r_);
        insert((a+b)/2,b,2*index+2,l_,r_);
    }
    int query(int lb,int x){ return query(0,n,0,lb,x); }
    int query(int a,int b,int index,int lb,int x){
        if(/*b<=lb*/ or x<a or b<=x) return 0;
        int res=0;
        if(lb<a and a<=x and x<b) res+=segs[index].end()-upper_bound(segs[index].begin(),segs[index].end(),make_pair(lb,inf));
        if((a+b)/2<b) res+=query(a,(a+b)/2,index*2+1,lb,x);
        if(a<(a+b)/2) res+=query((a+b)/2,b,index*2+2,lb,x);
        return res;
    }
};

void solve(){
    int N,M;
    cin >> N >> M;

    vector<pair<int,int>> LR;
    rep(i,0,N){
        int L,R;
        cin >> L >> R;
        ++R;
        LR.push_back(make_pair(L,R));
    }
    sort(LR.begin(),LR.end());
    segtree seg(M+1);
    rep(i,0,N) seg.insert(LR[i].first,LR[i].second);

    rep(i,1,M+1){
        int ans=0;
        rep(j,1,M/i+1){
            int tmp=seg.query(i*(j-1),i*j);
            ans+=seg.query(i*(j-1),i*j);
        }
        cout << ans << endl;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Compiler output:
a.cc: In member function 'int segtree::query(int, int, int, int, int)':
a.cc:65:22: error: expected primary-expression before 'or' token
   65 |         if(/*b<=lb*/ or x<a or b<=x) return 0;
      |                      ^~
Language: C++

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define orep(i, n) for (int i = 1; i <= (int)n; i++)
#define vec vector

class SegmentTree
{
private:
	int def = 0;
	int n;
	vec<int> data;

	int query_rec(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return def;
		if (a <= l && r <= b) return data[k];

		int vl = query_rec(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = query_rec(a, b, k * 2 + 2, (l + r) / 2, r);
		return func(vl, vr);
	}

	int func(int vl, int vr) {
		return vl + vr;
	}


public:
	SegmentTree(int n_) {
		n = 1;
		while(n < n_) n *= 2;
		data.resize(2 * n - 1);
		rep(i, data.size()) data[i] = def;
	}

	void update(int k, int a) {
		k += n - 1;
		data[k] += a;
		while(k > 0) {
			k = (k - 1) / 2;
			data[k] = func(data[k * 2 + 1], data[k * 2 + 2]);
		}
	}

	int query(int a, int b) {
		return func(a, b, 0, 0, n);
	}
};

int main(void)
{
	int n, m;
	cin >> n >> m;
	vec<pair<int, int>> a(n);
	rep(i, n) cin >> a[i].first >> a[i].second;
	sort(a.begin(), a.end(), [](pair<int, int> p, pair<int, int> q) {
			return p.second - p.first < q.second - q.first;
			});
	SegmentTree data(m + 1);
	int c = 0;
	orep(i, m) {
		while(c < n && a[c].second - a[c].first + 1 < i) {
			data.update(a[c].first - 1, 1);
			data.update(a[c].second, - 1);
			c++;
		}
		int ans = n - c;
		orep(j, m / i) ans += data.query(0, i * j);
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In member function 'int SegmentTree::query(int, int)':
a.cc:51:28: error: no matching function for call to 'SegmentTree::func(int&, int&, int, int, int&)'
   51 |                 return func(a, b, 0, 0, n);
      |                        ~~~~^~~~~~~~~~~~~~~
a.cc:28:13: note: candidate: 'int SegmentTree::func(int, int)'
   28 |         int func(int vl, int vr) {
      |             ^~~~
a.cc:28:13: note:   candidate expects 2 arguments, 5 provided
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define N (int)1e5
#define F first
#define S second
typedef pair<int, int> P;
int n, m, ans;
int l[N + 1], r[N + 1];
P lr[N + 1];
vector<int> vec[N + 10];
int bit[N + 1];
int sum(int i, int *b)
{
	int s = 0;
	while (i > 0)
	{
		s += b[i];
		i = i & (i - 1);
	}
	return s;
}
void add(int i, int x, int *b)
{
	while (i <= m)
	{
		b[i] += x;
		i += i & -i;
	}
}
int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> lr[i].S >> lr[i].F;
		l[i] = lr[i].S;
		r[i] = lr[i].F;
		lr[i].F = lr[i].F - lr[i].S + 1;
	}
	sort(lr, lr + n);
	int p1 = 0, p2 = 0;
	for (int i = 1; i <= m; i++)
	{
		ans = 0;
		p2 = lower_bound(lr, lr + n, make_pair(i, 0)) - lr;
		ans = n - p2;
		for (int j = p1; j < p2; j++)
		{
		    add(lr[j].S, 1, bit);
			add(lr[j].F + lr[j].S, -1, bit);
		}
		p1 = p2;
		for (int j = 0; j <= m; j += i)
		{
			ans += sum(j , bit);

Compiler output:
a.cc: In function 'int main()':
a.cc:57:45: error: expected '}' at end of input
   57 |                         ans += sum(j , bit);
      |                                             ^
a.cc:56:17: note: to match this '{'
   56 |                 {
      |                 ^
a.cc:57:45: error: expected '}' at end of input
   57 |                         ans += sum(j , bit);
      |                                             ^
a.cc:45:9: note: to match this '{'
   45 |         {
      |         ^
a.cc:57:45: error: expected '}' at end of input
   57 |                         ans += sum(j , bit);
      |                                             ^
a.cc:33:1: note: to match this '{'
   33 | {
      | ^
Language: C++

#include <iostream>
#include <vector>

class BinaryIndexedTree
{
private:
    std::vector<int> vals;
    int n;
public:
    BinaryIndexedTree(int n_)
        : vals(n_, 0), n(n_) { }

    void add(int a, int w)
    {
        for (int x = a; x <= n; x += x & -x) {
            vals[x - 1] += w;
        }
    }

    int sum(int a) const
    {
        int ret = 0;
        for (int x = a; x > 0; x -= x & -x) {
            ret += vals[x - 1];
        }
        return ret;
    }
};

class SnLine
{
private:
    struct ProdRange
    {
        ProdRange() { l = r = 0; }
        ProdRange(int l_, int r_) { l = l_; r = r_; }
        int l, r;
    };

    static ProdRange makeProdRange(int l, int r)
    {
        return ProdRange { l, r };
    }

    std::vector<ProdRange> prList;

    int numProds;
    int numStops;

public:
    SnLine(int numStops_, int numProds_)
    {
        numStops = numStops_;
        numProds = numProds_;
        prList.reserve(numProds);
    }

    void addProdRange(int l, int r)
    {
        prList.emplace_back(l, r);
    }

    void solve()
    {
        std::sort(prList.begin(), prList.end(),
            [](const auto& a, const auto& b)
            { return ((a.r - a.l) < (b.r - b.l)); });

        BinaryIndexedTree bit(numStops);
        
        int numRemainingProds = numProds;

        auto pr = prList.begin();
        for (int d = 1; d <= numStops; ++d)
        {
            int r = numRemainingProds;

            if (1 < d)
            {
                for (int a = d; a <= numStops; a += d)
                {
                    r += bit.sum(a);
                }
            }

            std::cout << r << std::endl;

            for(; pr != prList.end() && (d == pr->r - pr->l + 1); ++pr)
            {
                bit.add(pr->l, 1);
                bit.add(pr->r + 1, -1);
                --numRemainingProds;
            }
        }
    }
};

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

    SnLine sl(M, N);

    for (int i = 0; i < N; ++i)
    {
        int l, r;
        std::cin >> l >> r;
        sl.addProdRange(l, r);
    }

    sl.solve();
    return 0;
}


Compiler output:
a.cc: In member function 'void SnLine::solve()':
a.cc:65:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   65 |         std::sort(prList.begin(), prList.end(),
      |              ^~~~
      |              qsort
Language: C++

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

class FenwickTree {
private:
    long long n;
    vector<long long> dat;
public:
    FenwickTree(long long _n): n(_n), dat(_n+1, 0) {}
    FenwickTree(long long _n, long long init): n(_n), dat(_n+1, 0) {
        for (long long i = 0; i <= _n; i++) {
            add(i, init);
        }
    }
    
    void add(long long idx, long long value) {
        idx++;
        while(idx <= n) {
            dat[idx] += value;
            idx += idx & -idx;
        }
    }

    long long query(long long l, long long r) {
        long long ans = 0;
        r++;
        while(r > 0) {
            ans += dat[r];
            r -= r & -r;
        }
        while(l > 0) {
            ans -= dat[l];
            l -= l & -l;
        }
        return ans;
    }
};

bool comp(pair<long long,long long> a, pair<long long,long long> b)
{
    if (a.second - a.first <= b.second - b.first)
        return true;
    else
        return false;
}

long long main(void)
{
    long long n, m;
    cin >> n >> m;

    vector< pair<long long,long long> > A(n);
    for (long long i = 0; i < n; i++) {
        cin >> A[i].first >> A[i].second;
    }
    sort(A.begin(), A.end(), comp);

    FenwickTree ft(m+2);

    long long idx = 0;
    for (long long d = 1; d < m+1; d++) {
        long long count = 0;
        for(; idx < n && A[idx].second - A[idx].first < d; idx++) {
            ft.add(A[idx].first, 1);
            ft.add(A[idx].second+1, -1);
        }
        for (long long i = 0; i < m+1; i += d) {
            count += ft.query(0, i);
        }
        count += n - idx;
        cout << count << endl;
    }
}


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

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n,m;
    cin >> n >> m;
    VI l(n),r(n);
    REP(i,n){
        cin >> l[i] >> r[i];
    }

    VI ans (m+1,0);

    while (m>0){
        VI p(m+2,0);
        REP(i,n){
            p[l[i]]++;
            p[r[i]+1]--;
        }
        FOR(i,1,m+2){
            p[i] += p[i-1];
        }

        FOR(i,(m+1)/2,m+1){
            ans[i] = p[i];
        }
        m/=2;
        REP(i,n){
            if(l[i]>m){
                l[i]/=2;
                r[i]/=2;
            }
        }
    }

    REP(i,n){
        cut << ans[i] << endl;
    }

    return 0;
}


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

#include <vector>
#include <iostream>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int N, M, l[300009], r[300009], c[300009]; vector<int> d[100009], lc[100009], rc[100009];
int main() {
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		scanf("%d%d", &l[i], &r[i]), l[i]--, c[i] = r[i] - l[i];
		lc[l[i]].push_back(i);
		rc[r[i]].push_back(i);
	}
	for (int i = 1; i <= M; i++) {
		int B = sqrt(i);
		for (int j = 1; j <= B; j++) {
			int x = i / j;
			d[x].push_back(i);
		}
		int z = i / B;
		for (int j = 1; j < z; j++) {
			if (i / j != i / (j + 1)) {
				d[j].push_back(i);
			}
		}
	}
	for (int i = 1; i <= M; i++) {
		sort(d[i].begin(), d[i].end());
		d[i].erase(unique(d[i].begin(), d[i].end()), d[i].end());
	}
	int ret = N;
	for (int i = 1; i <= M; i++) {
		printf("%d\n", ret);
		for (int j : d[i]) {
			for (int k : rc[j]) {
				if (c[k] >= 1) ret--;
				c[k] -= r[k] / i - r[k] / (i + 1);
				if (c[k] >= 1) ret++;
			}
			for (int k : lc[j]) {
				if (c[k] >= 1) ret--;
				c[k] += l[k] / i - l[k] / (i + 1);
				if (c[k] >= 1) ret++;
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: 'sqrt' was not declared in this scope
   15 |                 int B = sqrt(i);
      |                         ^~~~
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
struct data{
    int s,e;
    bool operator<(const data&r)const{
        if(s==r.s)return e<r.e;
        return s<r.s;
    }
}a[300010];
struct Node{
    int cnt;
    Node *l,*r;
    Node(int cnt,Node *l,Node *r):cnt(cnt),l(l),r(r){}
    Node *update(int s,int e,int k);
}*root[300010];
Node *null=new Node(0,NULL,NULL);
Node *Node::update(int s,int e,int k){
    if(e<k||k<s)return this;
    if(s==e)return new Node(this->cnt+1,null,null);
    int m=(s+e)/2;
    return new Node(this->cnt+1,this->l->update(s,m,k),this->r->update(m+1,e,k));
}
int query(Node *a,int s,int e,int si,int ei){
    if(ei<s||e<si)return 0;
    if(si<=s&&e<=ei)return a->cnt;
    int m=(s+e)/2;
    return query(a->l,s,m,si,ei)+query(a->r,m+1,e,si,ei);
}
int main(){
    int i,j,k,l,n,m;
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;++i)scanf("%d%d",&a[i].s,&a[i].e);
    sort(a+1,a+n+1);
    root[0]=null->l=null->r=null;
    for(i=1;i<=n;++i)root[i]=root[i-1]->update(1,m,a[i].e);
    for(i=1;i<=m;++i){
        j=i,k=0;
        int ans=0;
        for(;j<=m;j+=i){
            data t={j,1e9};
            l=upper_bound(a+k+1,a+n+1,t)-a-1;
            ans+=query(root[l],1,m,j,m)-query(root[k],1,m,j,m);
            k=l;
        }
        printf("%d\n",ans);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:23: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
   41 |             data t={j,1e9};
      |                       ^~~