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

include<bits/stdc++.h>
using namespace std;
inline int read()
{
    int r,s=0,c;
    for(;!isdigit(c=getchar());s=c);
    for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);
    return s^45?r:-r;
}
const int N=110000;
int n;
int a[N];
map<int,int> mp;
int ans;
int main()
{
    n=read();
    for(int i=1;i<=n;i++)
        a[i]=read(),mp[a[i]]++;
    for(int i=1;i<=n;i++)
        if(a[i]==mp[a[i]])
            ans++,mp[a[i]]=-45132;
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int read()':
a.cc:6:21: error: 'getchar' was not declared in this scope
    6 |     for(;!isdigit(c=getchar());s=c);
      |                     ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include<bits/stdc++.h>
a.cc:6:11: error: 'isdigit' was not declared in this scope
    6 |     for(;!isdigit(c=getchar());s=c);
      |           ^~~~~~~
a.cc:7:26: error: 'getchar' was not declared in this scope
    7 |     for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);
      |                          ^~~~~~~
a.cc:7:26: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:7:16: error: 'isdigit' was not declared in this scope
    7 |     for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);
      |                ^~~~~~~
a.cc: At global scope:
a.cc:13:1: error: 'map' does not name a type
   13 | map<int,int> mp;
      | ^~~
a.cc: In function 'int main()':
a.cc:19:21: error: 'mp' was not declared in this scope
   19 |         a[i]=read(),mp[a[i]]++;
      |                     ^~
a.cc:21:18: error: 'mp' was not declared in this scope
   21 |         if(a[i]==mp[a[i]])
      |                  ^~
a.cc:23:5: error: 'printf' was not declared in this scope
   23 |     printf("%d\n",ans);
      |     ^~~~~~
a.cc:23:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

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

int n,a[100001];
int main(){
  cin >> n;
  int del = 0;
  for(int i=0;i<=100000;i++) a[i] = 0;
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    if(x <= 100000) a[x]++;
    else del++;
  }

  for(int i=0;i<=100000;i++){
    if(i <= a[i]) del += a[i]-i;
    else del += a[i];
  }
  cout << del << endl;
  return 0;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> n;
      |   ^~~
a.cc:20:3: error: 'cout' was not declared in this scope
   20 |   cout << del << endl;
      |   ^~~~
a.cc:20:18: error: 'endl' was not declared in this scope
   20 |   cout << del << endl;
      |                  ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int b[10];
    int n;
    char k;
    int ans=0;
    scanf("%d",&n);
    while(scanf("%c",&k){
        b[k-'0']++;
        if(b[k-'0']>n)ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:25: error: expected ')' before '{' token
    9 |     while(scanf("%c",&k){
      |          ~              ^
      |                         )
Language: C++

#include<bits/stdc++.h>
using namespace std;
int s[1000000001]
int main()
{
    int n,i,a,kkksc03=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a;
        s[a++];
    }
    for(i=1;i<=n;i++)
    {
        if(s[i]<i)kkksc03+=s[i];else kkksc03+=s[i]-i;
    }
    cout<<kkksc03<<endl;
}

Compiler output:
a.cc:4:1: error: expected initializer before 'int'
    4 | int main()
      | ^~~
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
map<int,int> m;
vector<int> v;
int main()
{
    int n,ans;
    cin>>n;
    for(register int i=1;i<=n;++i)
    {
        int x;
        cin>>x;
        if(m[x]==0) v.push_back(x);
        m[x]++;
    }
    for(register int i=0;i<v.size();++i)
        if(m[v[i]]>=v[i])
            ans+=m[v[i]]-v[i];
        else
            ans+=m[v[i]];
    cout<<ans;
    return 0;
}

Compiler output:
a.cc:4:1: error: 'map' does not name a type
    4 | map<int,int> m;
      | ^~~
a.cc:5:1: error: 'vector' does not name a type
    5 | vector<int> v;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:10:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   10 |     for(register int i=1;i<=n;++i)
      |                      ^
a.cc:14:12: error: 'm' was not declared in this scope
   14 |         if(m[x]==0) v.push_back(x);
      |            ^
a.cc:14:21: error: 'v' was not declared in this scope
   14 |         if(m[x]==0) v.push_back(x);
      |                     ^
a.cc:15:9: error: 'm' was not declared in this scope
   15 |         m[x]++;
      |         ^
a.cc:17:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |     for(register int i=0;i<v.size();++i)
      |                      ^
a.cc:17:28: error: 'v' was not declared in this scope
   17 |     for(register int i=0;i<v.size();++i)
      |                            ^
a.cc:18:12: error: 'm' was not declared in this scope
   18 |         if(m[v[i]]>=v[i])
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  long ans = 0;
  vector <long> num(N);
  vector <long> mod(N);
  for(int i = 0;i<N;i++){
    cin >> num.at(i);
  }
  for(int i = 0;i<N;i++){
    int temp = 0;
    if(num.at(i) > N){
      ans++;
      continue;
    }
    else{
      mod.at(num.at(i))++;
    }
  }
  for(int i = 0;i<N;i++){
    if(mod(i) > i){
      ans = mod.at(i) - i;
    }
    if(mod(i) < i){
      ans += mod.at(i);
    }
  }
  cout << ans << endl;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:23:11: error: no match for call to '(std::vector<long int>) (int&)'
   23 |     if(mod(i) > i){
      |        ~~~^~~
a.cc:26:11: error: no match for call to '(std::vector<long int>) (int&)'
   26 |     if(mod(i) < i){
      |        ~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  long ans = 0;
  vector <long> num(N);
  vector <long> mod(N);
  for(int i = 0;i<N;i++){
    cin >> num.at(i);
  }
  for(int i = 0;i<N;i++){
    int temp = 0;
    if(num.at(i) > N){
      ans++;
      continue;
    }
    else{
      mod.at(num.at(i))++;
    }
  }
  for(int i = 0;i<N;i++){
    if(mod(i) > i){
      ans = mod(i) - i;
    }
    if(mod(i) < i){
      ans += mod(i);
    }
  }
  cout << ans << endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:23:11: error: no match for call to '(std::vector<long int>) (int&)'
   23 |     if(mod(i) > i){
      |        ~~~^~~
a.cc:24:16: error: no match for call to '(std::vector<long int>) (int&)'
   24 |       ans = mod(i) - i;
      |             ~~~^~~
a.cc:26:11: error: no match for call to '(std::vector<long int>) (int&)'
   26 |     if(mod(i) < i){
      |        ~~~^~~
a.cc:27:17: error: no match for call to '(std::vector<long int>) (int&)'
   27 |       ans += mod(i);
      |              ~~~^~~
Language: C++

include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n;
  cin >> n;
  V a(n);
  REP(i, n) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int i = 0, sum = 0;
  while (i < n) {
    int cnt = 1;
    while (i < n-1 && a[i] == a[i+1]) {
      i++;
      cnt++;
    }
    if (a[i] > cnt) {
      sum += cnt;
    }
    else {
      sum += cnt-a[i];
    }
    i++;
  }
  dump(sum);
  return 0;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc:7:9: error: 'pair' does not name a type
    7 | typedef pair<ll, ll> pl;
      |         ^~~~
a.cc:8:9: error: 'pair' does not name a type
    8 | typedef pair<int, int> pi;
      |         ^~~~
a.cc:9:9: error: 'vector' does not name a type
    9 | typedef vector<int> V;
      |         ^~~~~~
a.cc: In function 'int main()':
a.cc:13:3: error: 'cin' was not declared in this scope
   13 |   cin >> n;
      |   ^~~
a.cc:14:3: error: 'V' was not declared in this scope
   14 |   V a(n);
      |   ^
a.cc:16:12: error: 'a' was not declared in this scope
   16 |     cin >> a[i];
      |            ^
a.cc:18:8: error: 'a' was not declared in this scope
   18 |   sort(a.begin(), a.end());
      |        ^
a.cc:18:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |   sort(a.begin(), a.end());
      |   ^~~~
      |   short
a.cc:5:17: error: 'cout' was not declared in this scope
    5 | #define dump(x) cout << (x) << endl
      |                 ^~~~
a.cc:34:3: note: in expansion of macro 'dump'
   34 |   dump(sum);
      |   ^~~~
a.cc:5:32: error: 'endl' was not declared in this scope
    5 | #define dump(x) cout << (x) << endl
      |                                ^~~~
a.cc:34:3: note: in expansion of macro 'dump'
   34 |   dump(sum);
      |   ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[1000000001],b[1000000001];
int main(){
	int i,n,t=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		b[a[i]]++;
	}
	for(i=1;i<=n;i++)
	{
		if(b[a[i]]>a[i])t+=b[a[i]]-a[i];
		else if(b[a[i]]<a[i])t+=b[a[i]];
		b[a[i]]=0;
	}
	printf("%d\n",t);
	return 0;
}

Compiler output:
/tmp/ccfNUjtt.o: in function `main':
a.cc:(.text+0x86): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccfNUjtt.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccfNUjtt.o
a.cc:(.text+0xe0): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccfNUjtt.o
a.cc:(.text+0x126): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccfNUjtt.o
a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccfNUjtt.o
a.cc:(.text+0x1b5): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccfNUjtt.o
a.cc:(.text+0x1e3): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccfNUjtt.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
int main() {
	ll N; cin >> N;
	for (ll i = 0; i < N; i++)
		cin >> a[i];
	map<ll, ll>mp;
	for (ll i = 0; i < N; i++)
		mp[a[i]]++;
	ll ans = 0;
	for (auto p; mp) {
		int x = p.first;
		int n = p.second;
		if (n < x) ans += n;
		else ans += n - x;
	}
	cout << ans << endl;
	}




Compiler output:
a.cc: In function 'int main()':
a.cc:28:24: error: 'a' was not declared in this scope
   28 |                 cin >> a[i];
      |                        ^
a.cc:31:20: error: 'a' was not declared in this scope
   31 |                 mp[a[i]]++;
      |                    ^
a.cc:33:14: error: declaration of 'auto p' has no initializer
   33 |         for (auto p; mp) {
      |              ^~~~
a.cc:33:22: error: could not convert 'mp' from 'std::map<long long int, long long int>' to 'bool'
   33 |         for (auto p; mp) {
      |                      ^~
      |                      |
      |                      std::map<long long int, long long int>
a.cc:33:24: error: expected ';' before ')' token
   33 |         for (auto p; mp) {
      |                        ^
      |                        ;
Language: C++

//我要吃面包
#include<iostream>
#include<vector>
#include<map>
using namespace std;

map<int,int> m;
vector<int> v;

int main()
{
    int i;
    int n,ans;
    cin>>n;
    for(i=1;i<=n;i=i+1)
    {
        int x;
        cin>>x;
        if(m[x]==0)
        {
            v.push_back(x);
        }
        m[x]=m[x]+1;
    }
    for(i=0;i<v.size();i=i+1)
    {
        if(m[x]==0)
        {
            ans=ans+m[v[i]]-v[i];
        }
        else
        {
            ans=ans+m[v[i]];
        }
    }
    cout<<ans<<endl; 
    //system("PAUSE");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: 'x' was not declared in this scope
   27 |         if(m[x]==0)
      |              ^
Language: C++

//我要吃面包
#include<iostream>
#include<vector>
#include<map>
using namespace std;

map<int,int> m;
vector<int> v;

int main()
{
    int i;
    int n,ans;
    cin>>n;
    for(i=1;i<=n;i=i+1)
    {
        int x;
        cin>>x;
        if(m[x]==0)
        {
            v.push_back(x);
        }
        m[x]=m[x]+1;
    }
    for(i=0;i<v.size();i=i+1)
    {
        ans=ans+m[v[i]]-v[i];
        else
        {
            ans=ans+m[v[i]];
        }
    }
    cout<<ans<<endl; 
    //system("PAUSE");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'else' without a previous 'if'
   28 |         else
      |         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
signed main(){
    set<int> s;
    int n;
    VI a;
    scanf("%d",&n);
    REP(i,n){
        int tmp;
        scanf("%d",&tmp);
        a.pb(tmp);
        s.insert(tmp);
    }
    SORT(a);

    int ans = 0;
    for(set<int>::iterator it=s.begin();it!=s.end();it++){
        int item = *it;
        int num = UB(all(a),item) - LB(all(a),item);
        if(num>=item) ans += num - item;
        else ans += num;
    }

    printf("%d\n",ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'VI' was not declared in this scope
    6 |     VI a;
      |     ^~
a.cc:8:9: error: 'i' was not declared in this scope
    8 |     REP(i,n){
      |         ^
a.cc:8:5: error: 'REP' was not declared in this scope
    8 |     REP(i,n){
      |     ^~~
a.cc:14:10: error: 'a' was not declared in this scope
   14 |     SORT(a);
      |          ^
a.cc:14:5: error: 'SORT' was not declared in this scope
   14 |     SORT(a);
      |     ^~~~
a.cc:19:22: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   19 |         int num = UB(all(a),item) - LB(all(a),item);
      |                      ^~~
      |                      std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
a.cc:19:19: error: 'UB' was not declared in this scope
   19 |         int num = UB(all(a),item) - LB(all(a),item);
      |                   ^~
a.cc:19:37: error: 'LB' was not declared in this scope
   19 |         int num = UB(all(a),item) - LB(all(a),item);
      |                                     ^~
Language: C++

#include <map>
#include <iostream>
int main(){
	int N;
	cin >> N;
	map<int,int> hist;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		if (hist.find(tmp) == hist.end()) hist[tmp] = 1;
		else hist[tmp]++;
	}
	int remove_num = 0;
	for (auto itr = hist.begin(); itr != hist.end(); itr++) {
		int tmp = itr->second - itr->first;
		if (tmp < 0) remove_num += itr->second;
		else remove_num += tmp;
	}
	cout << remove_num << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |         cin >> N;
      |         ^~~
      |         std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:9: error: 'map' was not declared in this scope
    6 |         map<int,int> hist;
      |         ^~~
a.cc:6:9: note: suggested alternatives:
In file included from /usr/include/c++/14/map:63,
                 from a.cc:1:
/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:6:13: error: expected primary-expression before 'int'
    6 |         map<int,int> hist;
      |             ^~~
a.cc:10:21: error: 'hist' was not declared in this scope
   10 |                 if (hist.find(tmp) == hist.end()) hist[tmp] = 1;
      |                     ^~~~
a.cc:14:25: error: 'hist' was not declared in this scope
   14 |         for (auto itr = hist.begin(); itr != hist.end(); itr++) {
      |                         ^~~~
a.cc:19:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   19 |         cout << remove_num << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:19:31: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   19 |         cout << remove_num << endl;
      |                               ^~~~
      |                               std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

int main()
{
	ull n;
	cin >> n;
	const int Max = pos(10,5)
	vector<int> cnt(Max+1);
	ull ans = 0;
	for(int i=0;i<n;i++){
		ull tmp;
		cin >> tmp;
		if(tmp>Max)
			ans++;
		else
			cnt[tmp]++;
	}
	for(int i=1;i<=n;i++){
		ans += (cnt[i]>=i)?(cnt[i]-i):cnt[i];
	}
	
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:25: error: 'pos' was not declared in this scope; did you mean 'pow'?
    9 |         const int Max = pos(10,5)
      |                         ^~~
      |                         pow
a.cc:18:25: error: 'cnt' was not declared in this scope; did you mean 'int'?
   18 |                         cnt[tmp]++;
      |                         ^~~
      |                         int
a.cc:21:25: error: 'cnt' was not declared in this scope; did you mean 'int'?
   21 |                 ans += (cnt[i]>=i)?(cnt[i]-i):cnt[i];
      |                         ^~~
      |                         int
Language: Java

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		HashMap<Integer,Integer> hs=new HashMap<>();
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		for(int i=0;i<n;i++) {
			int a=sc.nextInt();
			if(!hs.containsKey(a)){
				hs.put(a, 1);
			}else {
				hs.put(a, hs.get(a)+1);
			}
		}
		int ans=0;
		for(Integer key:hs.keySet()) {
			int num=hs.get(key);
			if(key==num||num==0){
			}else if(num>key) {
				ans+=num-key;
			}else {
				ans+=num;
			}
		}
		System.out.println(ans);
	}
}


Compiler output:
Main.java:5: error: cannot find symbol
		HashMap<Integer,Integer> hs=new HashMap<>();
		^
  symbol:   class HashMap
  location: class Main
Main.java:5: error: cannot find symbol
		HashMap<Integer,Integer> hs=new HashMap<>();
		                                ^
  symbol:   class HashMap
  location: class Main
2 errors
Language: C

#include<stdio.h>
#include<stdlib.h>
#include <string.h>

int main(){
  int a[100000]; b[100000]; c[100000];
  int i, j, k, N, num;
  scanf("%d", &N); k=0;
  
  for(i=0;i<N;i++){
    scanf(" %d", &a[i]);
    for(j=0;j<k;j++){
      if(a[i]==b[j]){
        c[j]++; break;
      }
    }
    k++; b[k-1]=a[i]; c[k-1]=1;
  }
  
  num=0;
  for(i=0;i<k;i++){
    if(b[i]>c[i])
      num+=c[i];
    else if(b[i]<c[i])
      num+=(c[i]-b[i]);
    else
      continue;    
  }
  printf("%d\n", num);

}


Compiler output:
main.c: In function 'main':
main.c:6:18: error: 'b' undeclared (first use in this function)
    6 |   int a[100000]; b[100000]; c[100000];
      |                  ^
main.c:6:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:29: error: 'c' undeclared (first use in this function)
    6 |   int a[100000]; b[100000]; c[100000];
      |                             ^
Language: C

import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		HashMap<Integer,Integer> mp=new HashMap<Integer,Integer>();
		int n=sc.nextInt();
		int a[]=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
			if(mp.get(a[i])==null)mp.put(a[i],1);
			else mp.put(a[i],mp.get(a[i]).intValue()+1);
		}
		int ans=0;
		for(int i:mp.keySet()){
			int t=mp.get(i);
			if(t>i)ans+=t-i;
			else if(t<i)ans+=t;
		}
		System.out.println(ans);
	}
}

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.*;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.*;
      |            ^
main.c:3:1: error: unknown type name 'public'
    3 | public class Main{
      | ^~~~~~
main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    3 | public class Main{
      |              ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define loop(i,L,R) for(int i=(L);i<=(R);i++)
#define rept(i,L,R) for(int i=(L);i<(R);i++)
#define isc(n) scanf("%d",&n)
#define llsc(n) scanf("%lld",&n)
#define dsc(n) scanf("%lf",&n)
#define enl cout<<endl
#define pb(x) push_back(x)
#define xx first
#define yy second
typedef long long ll;
typedef pair<int,int>PI;
typedef pair<pair<int,int>,int>PII;

map<int,int>a;
int main()
{
    int n,t;
    cin>>n;
    rept(i,0,n){cin>>t;a[t]++;}
    ll ans=0;
    for(auto i:a)
    {
        if(i.xx>i.yy))ans+=i.yy;
        else ans+=min((i.yy-i.xx),i.yy);
    }
    cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:22: error: expected primary-expression before ')' token
   25 |         if(i.xx>i.yy))ans+=i.yy;
      |                      ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int c[n];
  int num[n];
  for(int i=0;i<n;i++){
    cin>>c[i];
    num[i+1]=0;
    }

  for(int i=0;i<n;i++){
    if(c[i]<=n;){num[c[i]]++;}
    }
  int ans=0;
  for(int i=1;i<=n;i++){
    if(num[i]>=i){
      ans+=i;
      }
    } 
  cout <<n-ans <<endl;
  return 0;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:14:16: error: expected primary-expression before ')' token
   14 |     if(c[i]<=n;){num[c[i]]++;}
      |                ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#define N 100000
int main(){
  int *hairetu, *tmp;
  int n, i, j, fig, mp;
  int sum = 0;
  scanf("%d", &n);
  if((hairetu = (int *)calloc(n, sizeof(int))) == NULL){
    fprintf(stderr, "メモリエラー\n");
    return 1;
  }
  
  for(i = 0; i < n; i++){
    scanf("%d", &hairetu[i]);
  }

  for(i = 0; i < n - 1; i++){
    for(j = n - 1; j > i; j--){
      if(hairetu[j-1] > hairetu[j]){
        mp = hairetu[j];
        hairetu[j] = hairetu[j-1];
        hairetu[j-1] = mp;
      }
    }
  }
  
  f//or(i = 0; i < n; i++){
    //printf("%d\n", hairetu[i]);
  //}
  for(i = 0;i < n; i++){
    for(j = 0; hairetu[i+j] == hairetu[i]; j++){
    }
    
  //  printf("%d", j);
    if(j > hairetu[i]){
      sum += j - hairetu[i];
    }else if(j < hairetu[i]){
      sum += j;
    }else{

    }
    i += j;
  }
  printf("%d", sum);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:28:3: error: 'f' undeclared (first use in this function)
   28 |   f//or(i = 0; i < n; i++){
      |   ^
main.c:28:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:28:4: error: expected ';' before 'for'
   28 |   f//or(i = 0; i < n; i++){
      |    ^
      |    ;
......
   31 |   for(i = 0;i < n; i++){
      |   ~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
map<int,int> m;
vector<int> v;
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		if(m[x]==0) 
		{
			v.push_back(x);
		}
		m[x]++;
	}
	int s=0;
	for(int i=0;i<v.size();i++)
	{
		if(v[i]>m[v[i]])
		{
			ans+=m[v[i]];
		} 
		else 
		{
			if(v[i]<m[v[i]]) 
			{
				ans+=m[v[i]]-v[i];
			}
		}
	}
	cout<<s;
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |                         ans+=m[v[i]];
      |                         ^~~
      |                         abs
a.cc:30:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |                                 ans+=m[v[i]]-v[i];
      |                                 ^~~
      |                                 abs
Language: C++

#Include<iostream>
#include<vector>
#include<map>
#include<set>
using namespace std;
map<int,int>m;
vector<int>v;
int main()
{
ios::sync_with_stdio(false);
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
int x;
cin>>x;
if(m[x]==0)
v.push_back(x);
m[x]++;
}
int ans=0;
for(int i=0;i<v.size();i++)
if(v[i]>m[v[i]])
ans+=m[v[i]];
else if(v[i]<m[v[i]])
ans+=m[v[i]]-v[i];
cout<<ans;
return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #Include; did you mean #include?
    1 | #Include<iostream>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:10:1: error: 'ios' has not been declared
   10 | ios::sync_with_stdio(false);
      | ^~~
a.cc:12:1: error: 'cin' was not declared in this scope
   12 | cin>>n;
      | ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include<set>
  +++ |+#include <iostream>
    5 | using namespace std;
a.cc:27:1: error: 'cout' was not declared in this scope
   27 | cout<<ans;
      | ^~~~
a.cc:27:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
 
int main() {
	int N, x; cin >> N;
	for (int i = 0; i < N; i++){
		cin >> x;
		mp[x]++;
    }
	map<int, int> mp;
 
	int ans = 0;
	for (auto p: mp) {
		int x = p.first;
		int n = p.second;
		if (n < x) ans += n;
		else ans += n - x;
	}
 
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'mp' was not declared in this scope
   10 |                 mp[x]++;
      |                 ^~
Language: Java

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.HashMap;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author khokharnikunj8
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        arc087_a solver = new arc087_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class arc087_a {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt(), temp;
            HashMap<Integer, Integer> hs = new HashMap<>();
            while (n-- > 0) {
                temp = in.scanInt();
                if (!hs.containsKey(temp)) hs.put(temp, 1);
                else hs.put(temp, (hs.get(temp) + 1));
            }
            long ans = 0;
            for (int i : hs.keySet()) {
                temp = hs.get(i);
                if (temp >= i) temp -= i;
                ans += (temp);
            }
            out.println(ans);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }


Compiler output:
Main.java:94: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include <cmath>
#include <algorithm>

int c[100001];

int main() {
  long long int n;
  long long int count = 0;
  std::cin >> n;
  for (int i = 0; i < 100001; ++i)
    c[i] = 0;
  for (long long int i = 0; i < n; ++i) {
    int x = 0;
    std::cin >> x;
    if (x >= 100001) {
      count++;
      continue;
    }   
    c[x]++;
  }
  for (int i = 1; i < 100001; ++i) {
    count += std::min(c[i], std::abs(c[i] - i));
  }
  std::cout << count << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'cin' is not a member of 'std'
    9 |   std::cin >> n;
      |        ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <algorithm>
  +++ |+#include <iostream>
    3 | 
a.cc:14:10: error: 'cin' is not a member of 'std'
   14 |     std::cin >> x;
      |          ^~~
a.cc:14:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:8: error: 'cout' is not a member of 'std'
   24 |   std::cout << count << std::endl;
      |        ^~~~
a.cc:24:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:30: error: 'endl' is not a member of 'std'
   24 |   std::cout << count << std::endl;
      |                              ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <algorithm>
  +++ |+#include <ostream>
    3 |
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int N; cin >> N;
	vector<int>a(N+1);
	for( int n = 1; n <= N; n++ )
	{
		cin >> a[n];
	}
	sort(a.begin(), a.end());

	int k = 0, ans = 0;
	for( int i = 1; i <= N; i++ )
	{
		if( a[i] == a[i - 1] )
		{
			k++;
			if( k > a[i] )ans++;
		}
		else
		{
			if( k < a[i - 1] )
				ans += k;
			k = 1;
		}
	}
	if( k < a[N] )
		ans += k;

	cout << ans << endl;
}

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

import java.util.*;
public class Goodsequence {
    public static void main(String[] args){
        int N;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int[] a = new int[N];
        int[] flag = new int[N];
        for(int i=0;i<N;i++){
            a[i] = sc.nextInt();
            flag[i] = 0;
        }
        Arrays.sort(a);
        int sum = 0;
        int count = 0;
        for(int i=0;i<N;i=i+count){
            count=0;
            for(int j=i;j<N;j++){
                if(a[j]==a[i]) count++;
                else break;
            }
            if(count<a[i]) sum = sum + count;
            else sum = sum - a[i] + count;


        }


        System.out.println(sum);

    }

}


Compiler output:
Main.java:2: error: class Goodsequence is public, should be declared in a file named Goodsequence.java
public class Goodsequence {
       ^
1 error
Language: Java

import java.util.*;
public class Goodsequence {
    public static void main(String[] args){
        int N;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int[] a = new int[N];
        int[] flag = new int[N];
        for(int i=0;i<N;i++){
            a[i] = sc.nextInt();
            flag[i] = 0;
        }
        int sum = 0;
        for(int i=0;i<N;i++){
            int count = 0;
            if(flag[i]!=1) {
                for (int j = i; j < N; j++) {
                    if (a[j] == a[i]) {
                        count++;
                        flag[j] = 1;
                    }
                }
                if(count<a[i]){
                    sum = sum + count;
                }else {
                    sum = sum + (count - a[i]);
                }

            }
        }
        System.out.println(sum);

    }

}


Compiler output:
Main.java:2: error: class Goodsequence is public, should be declared in a file named Goodsequence.java
public class Goodsequence {
       ^
1 error
Language: C++

using namespace std;
int main()
{
  int n,ans;
  int a[K];
  int b[K]={0};
  ans=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++)
    {
      scanf("%d",&a[i]);
      if(a[i]>n)
	{
	  ans++;
	}
      else
	{
	  b[a[i]]++;
	}
    }
  for(int i=0;i<n+1;i++)
    {
      if(b[i]<i)
	{
	  ans+=b[i];
	}
      else if(b[i]>i)
	{
	  ans+=b[i]-i;
	}
    }
  printf("%d\n",ans);
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'K' was not declared in this scope
    5 |   int a[K];
      |         ^
a.cc:8:3: error: 'scanf' was not declared in this scope
    8 |   scanf("%d",&n);
      |   ^~~~~
a.cc:11:19: error: 'a' was not declared in this scope
   11 |       scanf("%d",&a[i]);
      |                   ^
a.cc:18:11: error: 'b' was not declared in this scope
   18 |           b[a[i]]++;
      |           ^
a.cc:23:10: error: 'b' was not declared in this scope
   23 |       if(b[i]<i)
      |          ^
a.cc:32:3: error: 'printf' was not declared in this scope
   32 |   printf("%d\n",ans);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | using namespace std;
Language: C++

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

map<int,int> a;
vector<int> v;

int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		if(a[x]==0) v.push_back(x);
		a[x]++;
	}
	
	int s=0;
	for(int i=0;i<v.size();i++)
		if(v[i]>m[v[i]]) s+=m[v[i]];
		else if(v[i]<m[v[i]]) s+=m[v[i]]-v[i];
	
	cout << s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: 'm' was not declared in this scope
   22 |                 if(v[i]>m[v[i]]) s+=m[v[i]];
      |                         ^
Language: C

#include <stdio.h>
#define LEN 10000

int main(void) {
  int N, a[LEN] = {}, n[LEN] = {}, v, cnt;
  int i, j;

  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d", &v);
    for (j = 0; a[j] != 0 || a[j] != v; j++);
    a[j] = v;
    n[j]++;
  }

  for (cnt = i = 0; a[i] != 0; i++) {
    int tmp = n[i] - a[i];
    if (tmp > 0) cnt += tmp;
    else (tmp < 0) cnt += n[i];
  }
  printf("%d\n", cnt);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:19:19: error: expected ';' before 'cnt'
   19 |     else (tmp < 0) cnt += n[i];
      |                   ^~~~
      |                   ;
Language: C++

#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<map>
using namespace std;


int a[10005];

int main(){
	map<int,int> m;
	map<int,int> ::iterator iter;
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		m[a[i]]++;
	}
	int sum=0;
	for(iter=m.begin();iter!=m.end();iter++){
		if(iter->first != iter->second){
			if(iter->first < iter->second){
			sum+=iter->second-iter->first;
			}
		else{
			sum+=iter->second;
		}
	}
	}
	printf("%d\n",sum);
	return 0;
}#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<map>
using namespace std;


int a[10005];

int main(){
	map<int,int> m;
	map<int,int> ::iterator iter;
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		m[a[i]]++;
	}
	int sum=0;
	for(iter=m.begin();iter!=m.end();iter++){
		if(iter->first != iter->second){
			if(iter->first < iter->second){
			sum+=iter->second-iter->first;
			}
		else{
			sum+=iter->second;
		}
	}
	}
	printf("%d\n",sum);
	return 0;
}

Compiler output:
a.cc:35:2: error: stray '#' in program
   35 | }#include<cstdio>
      |  ^
a.cc:35:3: error: 'include' does not name a type
   35 | }#include<cstdio>
      |   ^~~~~~~
a.cc:45:5: error: redefinition of 'int a [10005]'
   45 | int a[10005];
      |     ^
a.cc:11:5: note: 'int a [10005]' previously declared here
   11 | int a[10005];
      |     ^
a.cc:47:5: error: redefinition of 'int main()'
   47 | int main(){
      |     ^~~~
a.cc:13:5: note: 'int main()' previously defined here
   13 | int main(){
      |     ^~~~
Language: C++

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

int N;
int A[100010];
int ans = 0;

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++)scanf("%d",A + i);
    sort(A,A + N);

    int cnt = 1;
    for(int i = 0; i < N; i++)
    {
        if(i == N - 1 || A[i] != A[i + 1])
        {
            if(cnt < A[i])ans += cnt;
            else ans += cnt - A[i];
            cnt = 0;
        }
        cnt++;
    }
    printf("%d\n",ans);
    return 0;
}


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

#include<iostream>
using namespace std;
int main(){
  int N;
  int a[N];
  cin>>N;
  for(int i=0;i<N;i++)cin>>a[i];
  int c[1000000001];
  int temp;
  for(int i=0;i<N;i++){
    temp = a[i];
    c[temp]+=1;
  }
  int t[1000000001]
  for(int i=0;i<1000000001;i++){
    if(c[i]==0 || c[i]==i)t[i]=0;
    else if(c[i]<i)t[i]=c[i];
    else t[i]=c[i]-i;
  }
  int res=0;
  for(int i=0;i<1000000001;i++)res+=t[i];
  cout<<res;  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: expected initializer before 'for'
   15 |   for(int i=0;i<1000000001;i++){
      |   ^~~
a.cc:15:15: error: 'i' was not declared in this scope
   15 |   for(int i=0;i<1000000001;i++){
      |               ^
a.cc:21:37: error: 't' was not declared in this scope
   21 |   for(int i=0;i<1000000001;i++)res+=t[i];
      |                                     ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N;
  int a[N]
  cin>>N;
  for(int i=0;i<N;i++)cin>>a[i];
  int c[1000000001];
  int temp;
  for(int i=0;i<N;i++){
    temp = a[i];
    c[temp]+=1;
  }
  int t[1000000001]
  for(int i=0;i<1000000001;i++){
    if(c[i]==0 || c[i]==i)t[i]=0;
    else if(c[i]<i)t[i]=c[i];
    else t[i]=c[i]-i;
  }
  int res=0;
  for(int i=0;i<1000000001;i++)res+=t[i];
  cout<<res;  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'cin'
    6 |   cin>>N;
      |   ^~~
a.cc:7:28: error: 'a' was not declared in this scope
    7 |   for(int i=0;i<N;i++)cin>>a[i];
      |                            ^
a.cc:11:12: error: 'a' was not declared in this scope
   11 |     temp = a[i];
      |            ^
a.cc:15:3: error: expected initializer before 'for'
   15 |   for(int i=0;i<1000000001;i++){
      |   ^~~
a.cc:15:15: error: 'i' was not declared in this scope
   15 |   for(int i=0;i<1000000001;i++){
      |               ^
a.cc:21:37: error: 't' was not declared in this scope
   21 |   for(int i=0;i<1000000001;i++)res+=t[i];
      |                                     ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N;
  int a[N]
  cin>>N;
  for(int i=0;i<N;i++)cin>>a[i];
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'cin'
    6 |   cin>>N;
      |   ^~~
a.cc:7:28: error: 'a' was not declared in this scope
    7 |   for(int i=0;i<N;i++)cin>>a[i];
      |                            ^
Language: C

#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
 
int a[100000];
 
int main() {
	int N; cin >> N;
	for (int i = 0; i < N; i++)
		cin >> a[i];
 
	map<int, int> mp;
	for (int i = 0; i < N; i++)
		mp[a[i]]++;
 
	int ans = 0;
	for (auto p: mp) {
		int x = p.first;
		int n = p.second;
		if (n < x) ans += n;
		else ans += n - x;
	}
 
	cout << ans << endl;
}

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

#include<stdio.h>

int main()
{
  int N,i,cnt=0;A
  scanf("%d",&N);
  long a[N];
  int baketu[1000000000]={};
  for(i=0;i<N;i++){
    scanf("%ld",&a[i]);
  }
  for(i=0;i<N;i++){
    baketu[a[i]]++;
  }
  for(i=0;i<1000000000;i++){
    while(baketu[i]>i){
      baketu[i]--;
      cnt++;        
  }}
  printf("%d",cnt);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:17: error: unknown type name 'A'
    5 |   int N,i,cnt=0;A
      |                 ^
main.c:6:9: error: expected declaration specifiers or '...' before string constant
    6 |   scanf("%d",&N);
      |         ^~~~
main.c:6:14: error: expected declaration specifiers or '...' before '&' token
    6 |   scanf("%d",&N);
      |              ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
int N;
const int MAX_N = 100000;
int a[MAX_N];

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

	sort(a, a + N);

	int tmp = a[0], cnt = 1, sum = 0;
	for (int i = 0; i < N; i++) {
		if (tmp == a[i]) {
			cnt++;
		}
		else {
			if (cnt < tmp) sum += cnt;
			else sum += cnt - tmp;
			tmp = a[i];
			cnt = 1;
		}
	}
	if (cnt < tmcnt - tmp;
	cout << sum << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:19: error: 'tmcnt' was not declared in this scope; did you mean 'cnt'?
   30 |         if (cnt < tmcnt - tmp;
      |                   ^~~~~
      |                   cnt
a.cc:31:28: error: expected ')' before ';' token
   31 |         cout << sum << endl;
      |                            ^
      |                            )
a.cc:30:12: note: to match this '('
   30 |         if (cnt < tmcnt - tmp;
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[1000000005];
int main()
{
	long long c;
	cin>>c;
	long long s;
	long long ans=0;
	for(long long i=0;i<c;i++)
	{
		cin>>s;
		a[s-1]++;
	}
	for(i=0;i<10;i++)
	{
		if(a[i]<i+1)
		ans+=a[i];
		else
		ans+=a[i]-i-1;
	}
	cout<<ans;
	return 0;
}

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

#include<cstring>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
#define M 100000
#define Ma 1000000000
using namespace std;
typedef long long LL;
LL check(LL a[M],LL n){
	LL b[Ma];
	LL y=0,k=0;
    for(LL i=0;i<n;i++)
    if(a[i]>y)y=a[i];
    memset(b,0,sizeof(b));
    for(LL i=0;i<n;i++){
		LL x=a[i];
    	b[x]++;
    	}
     for(LL i=0;i<=y;i++){
     	 if(b[i]>=i)
     	 k+=b[i]-i
     	 else k+=i;
	 }
	 return k;
}



	}
int main(){
	LL a[M];
	LL n;
	scanf("%lld",n);
    for(LL i=0;i<n;i++)
    scanf("%lld",&a[i]);
    printf("%lld",check(a,n));
}

Compiler output:
a.cc: In function 'LL check(LL*, LL)':
a.cc:25:19: error: expected ';' before 'else'
   25 |          k+=b[i]-i
      |                   ^
      |                   ;
   26 |          else k+=i;
      |          ~~~~      
a.cc: At global scope:
a.cc:33:9: error: expected declaration before '}' token
   33 |         }
      |         ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
	int n,a[100005],s=1,sum=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	sort(a,a+n);
	set<pair<int,int> > q;
	for(int i=0;i<n-1;i++)
	{
		if(a[i]==a[i+1])s++;
		else
		{
			if(i==n-2)
			{
				q.insert(make_pair(a[i],s));
				q.insert(make_pair(a[i+1],1));
				break;
			}
			else
			{
				q.insert(make_pair(a[i],s));
				s=1;
			}
		}
		if(a[i]==a[i+1]&&i==n-2)q.insert(make_pair(a[i],s));
	}
	set<pair<int,int> >::iterator it;
	//for(it=q.begin();it!=q.end();it++)
		//printf("%d %d\n",it->first,it->second);
	int i=0,j=0,more[100005],les[100005];
	memset(more,0,sizeof(more));
	memset(les,0,sizeof(les));
	for(it=q.begin();it!=q.end();it++)
	{
		if(it->first==it->second)continue;
		else 
		{
			if(it->first > it->second)sum+=it->second;
			else sum+=it->second - it->first;
		}
	}
	printf("%d\n",sum);
	return 0;
}

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

#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
	long nDelCnt = 0;
	long nCnt;
	cin >> nCnt;
	long arr[100001];
	memset(arr, 0, sizeof(arr));

	// 入力値を配列に格納。
	// 但し、数列の最大数が100000なのでそれより大きな値を入力されても
	// 数列が正しくならないので削除対象に加算する。
	for (long i = 0; i < nCnt; i++)
	{
		long lnTmpVal;
		cin >> lnTmpVal;
		if (100000 < lnTmpVal)
		{
			nDelCnt++;
			continue;
		}
		arr[lnTmpVal]++;
	}

	// 入力された個数と、数値の値が一致するかチェック
	for (long i = 1; i <= nCnt; i++)
	{
		if (0 > arr[i]-i)			// 必要数に足りないので、入力されたもの全消し
			nDelCnt = nDelCnt + arr[i];
		else if (0 < arr[i] - i)	// 余分な個数のみ消す
			nDelCnt = nDelCnt + arr[i] - i;
	}
	cout << nDelCnt;
	return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
queue<int>que;
cin>>n;
int a;
for(int i=0;i<n;i++){
cin>>a;
que.push(a);
}
sort(que.begin(),que.end());
int count=0;
while(!que.empty()){
int temp=que.begin(),count2=0;
while(!que.empty()){
if(que.begin()!=temp) break;
count2++;
que.pop();
}
if(count2!=temp){
count+=count2;
}
cout<<count<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: 'class std::queue<int>' has no member named 'begin'
   12 | sort(que.begin(),que.end());
      |          ^~~~~
a.cc:12:22: error: 'class std::queue<int>' has no member named 'end'
   12 | sort(que.begin(),que.end());
      |                      ^~~
a.cc:15:14: error: 'class std::queue<int>' has no member named 'begin'
   15 | int temp=que.begin(),count2=0;
      |              ^~~~~
a.cc:17:8: error: 'class std::queue<int>' has no member named 'begin'
   17 | if(que.begin()!=temp) break;
      |        ^~~~~
a.cc:18:1: error: 'count2' was not declared in this scope; did you mean 'count'?
   18 | count2++;
      | ^~~~~~
      | count
a.cc:21:4: error: 'count2' was not declared in this scope; did you mean 'count'?
   21 | if(count2!=temp){
      |    ^~~~~~
      |    count
a.cc:26:2: error: expected '}' at end of input
   26 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^