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

#include<stdio.h>

int main(){
int i,n,t,j;
int a[1001];

scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n-1;i++){//バブルソートを行う
		for(j=0;j<n-i;j++){
			if(a[j+1]<a[j]){
				t=a[j];
				a[j]=a[j+1];
				a[j+1]=t;
			}
		}
	}
for(i=0;i<N;i++) printf("a[%d]=%d ",i,a[i]);

Compiler output:
main.c: In function 'main':
main.c:19:11: error: 'N' undeclared (first use in this function)
   19 | for(i=0;i<N;i++) printf("a[%d]=%d ",i,a[i]);
      |           ^
main.c:19:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:1: error: expected declaration or statement at end of input
   19 | for(i=0;i<N;i++) printf("a[%d]=%d ",i,a[i]);
      | ^~~
Language: C

#include<stdio.h>
 
int main(){
int i,n,t,j;
int a[1001];
 
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n-1;i++){//バブルソートを行う
        for(j=0;j<n-i;j++){
            if(a[j+1]<a[j]){
                t=a[j];
                a[j]=a[j+1];
                a[j+1]=t;
            }
        }
    }
for(i=0;i<N;i++) printf("a[%d]=%d ",i,a[i]);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:11: error: 'N' undeclared (first use in this function)
   19 | for(i=0;i<N;i++) printf("a[%d]=%d ",i,a[i]);
      |           ^
main.c:19:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<stdio.h>

int main(){

int n;
int p[1001]={}

scanf("%d",&n);
for(int i=0;i<n;i++)
	scanf("%d",&p[i]);

for(int i=0;i<n;i++)
	for(int j=n-1;j>=i;j--)
		if(p[j]<p[j-1]){int t=p[j-1];p[j-1]=p[j];p[j]=t;}


for(int i=0;i<n;i++){
	if(i!=0)printf(" ");
	printf("%d",p[i]);
}
printf("\n");

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:1: error: expected ',' or ';' before 'scanf'
    8 | scanf("%d",&n);
      | ^~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
  int n;
  int array[1100];
  cin >> n;
  for(int i = 0; i < n; i++) cin >> array[i];

  sort(array, array+n);
  for(int i = 0; i < n-1; i++) {
    cout << array[i] << ' ';
  }
  cout << array[n-1] << endl;
}

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

#include<iostream>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
  int n;
  cin>>n;
  int dt[n];
  rep(i,n){
  cin>>dt[i];
  }
  sort(dt,dt+n);
  rep(i,n)
    cout<<dt[i]<<" ";
  }
  cout<<dt[n-1]<<endl;
  return 0;
}

Compiler output:
a.cc:18:3: error: 'cout' does not name a type
   18 |   cout<<dt[n-1]<<endl;
      |   ^~~~
a.cc:19:3: error: expected unqualified-id before 'return'
   19 |   return 0;
      |   ^~~~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

/**
 * @brief ソートのテストプログラム
 * @date  作成日    : 2016/02/10
 * @date  最終更新日 : 2016/02/10
 */

//****************************************
// 必要なヘッダファイルのインクルード
//****************************************

#include <iostream>
#include <iterator>
#include <functional>



//****************************************
// 関数の定義
//****************************************

/**
 * @brief  挿入ソートを行う
 * @tparam class Iterator イテレータ
 * @tparam class Compare  比較用パラメタ
 * @param  Iterator a0    先頭イテレータ
 * @param  Iterator aN    末尾の次を指すイテレータ
 * @param  Compare  cmp   比較述語
 */
template <class Iterator, class Compare>
void inssort(Iterator a0, Iterator aN, Compare cmp)
{
    using val_t = typename std::iterator_traits<Iterator>::value_type;
    
    Iterator j = a0;
    // for文の各繰り返しが開始されるときには、部分配列A[0..j-1]には
    // 開始時点でA[0..j-1]に格納されていた要素がソートされた状態で格納されている
    for (++j; j != aN; ++j) {
        // for文の本体が行っていることはA[j]を入れるべき場所が見つかるまでA[j-1], A[j-2],..を
        // それぞれ1つ右に移し、空いた場所にA[j]の値を挿入することである.
        const val_t key = *j;  // 比較用のキーを取り出す
        // a[j]をソート済みの列a[0..j-1]に挿入する
        Iterator i = j; --i; // i = j - 1
        Iterator k = j;      // k = i + 1
        while (k != a0 && cmp(key, *i)) {
            *k = *i;
            --i; --k;
        }
        *k = key;
    }
    // for文が停止するのはj >= A.length = nを満たすときである.ループの各繰り返しはjの値を1だけ増加させるから、
    // 停止時にj = nが成立する.ループ不変式のjにnを代入すると、部分配列A[0..n-1]には、開始時点でA[0..n-1]に
    // 格納されていた要素全体が格納されているが、これらの要素は既にソートされている. 部分配列A[0..n-1]が
    // 全体配列であることに注意すると、配列全体がソート済みであると結論できる
}


/**
 * @brief  挿入ソートを行う
 * @note   比較器を引数に指定しなかった場合この手続きが呼ばれる
 * @tparam class Iterator イテレータ
 * @param  Iterator a0    先頭イテレータ
 * @param  Iterator aN    末尾の次を指すイテレータ
 */
template <class Iterator>
inline void inssort(Iterator a0, Iterator aN)
{
    using val_t = typename std::iterator_traits<Iterator>::value_type;
    inssort(a0, aN, std::less<val_t>());
}



int main(void)
{
    using namespaces std;
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    static int a[1000000];
    for (int i = 0; i < n; i++) cin >> a[i];
    inssort(a, a + n);
    for (int i = 0; i < n; i++) cin >> a[i];

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:11: error: expected nested-name-specifier before 'namespaces'
   75 |     using namespaces std;
      |           ^~~~~~~~~~
a.cc:76:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   76 |     cin.tie(0);
      |     ^~~
      |     std::cin
In file included from a.cc:11:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:77:5: error: 'ios' has not been declared
   77 |     ios::sync_with_stdio(0);
      |     ^~~
Language: C++

/**
 * @brief ソートのテストプログラム
 * @date  作成日    : 2016/02/10
 * @date  最終更新日 : 2016/02/10
 */



//****************************************
// 必要なヘッダファイルのインクルード
//****************************************

#include <iostream>
#include <utility>



//****************************************
// 関数の定義
//****************************************


/**
 * @brief  ヒープソートアルゴリズム
 * @note   最悪実行時間はΘ(lgn)
 * @note   zero-basedです.わかりやすさを殺さないために最適化はある程度コンパイラに任せています(たとえばhpszなんかは直接値入れればいい)
 * @tparam T       ソート対象の配列要素の型
 * @tparam Compare 比較用関数オブジェクトの型
 * @param  T a              配列A[0..n-1]
 * @param  std::ptrdiff_t n 配列Aのサイズ
 * @param  Compare cmp      比較述語
 */
template <class T, class Compare>
void _heapsort(T a, /*Iterator aN,*/std::ptrdiff_t n, Compare cmp)
{
    if (n < 2) { return; }   // 要素数が1以下の配列はソートしません
    using dif_t = std::ptrdiff_t;

    auto heapify = [](T a, dif_t p, dif_t hpsz, Compare cmp) {
        while (true) {                                  // ヒープ条件に違反した可能性があるので、ヒープ条件を回復する
            dif_t l = (p<<1)+1, r = (p<<1)+2, lst = p;  // 節点pの左右の子を取得
            if (l < hpsz && cmp(a[lst], a[l]))  { lst = l; }  // lstに最も大きい(小さい)keyを持つ節点の添字を代入する
            if (r < hpsz && cmp(a[lst], a[r]))  { lst = r; }
            if (lst == p) { break; }                    // このとき、lstが左右の子でないならば、ヒープ条件に違反はない
            std::swap(a[lst], a[p]); p = lst;           // lstが左右の子ならば、a[lst]とa[p]を交換し、pを適切な子に更新し、再びループする(木を下る)
        }
    };
    dif_t hpsz = n;  // for文の各繰り返しが開始される時点では、各節点i+1, i+2,...,n-1はあるヒープの根である(ループ不変式)
    for (dif_t i = n / 2; i >= 0; --i) {  // i < 0で手続きは終了. iを1減らすことで次の繰り返しに対するループ不変式が再び成立する
        heapify(a, i, hpsz, cmp);         // 節点iをヒープの根に修正する. またこの呼び出しは節点i+1,i+2,...,n-1がヒープの根であるという性質を保存する
    }  // 手続きはi < 0で終了する.ループ不変式から、各節点0,1,..,n-1はヒープの根である.特に節点0はヒープの根である
    
    for (dif_t i = n - 1; i > 0; --i) {   // ループの最初でA[n-1..i]は常にソートされていることに注意
        std::swap(a[0], a[i]);            // 最大(最小)要素を正しい最終位置に置く
        hpsz = i;                         // ヒープサイズを1つ減らしてヒープから節点iを削除する
        heapify(a, 0, hpsz, cmp);         // ヒープ条件に違反した可能性があるのでヒープ条件を回復する
    }
}



int main(void)
{
    using namespace std;
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    static int a[1000000];
    for (int i = 0; i < n; i++) cin >> a[i];
    _heapsort(a, a + n, std::less<int>());
    for (int i = 0; i < n; i++) cout<< a[i] << ((i == n - 1) ? '\n' : ' ');

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:14: error: no matching function for call to '_heapsort(int [1000000], int*, std::less<int>)'
   71 |     _heapsort(a, a + n, std::less<int>());
      |     ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:34:6: note: candidate: 'template<class T, class Compare> void _heapsort(T, std::ptrdiff_t, Compare)'
   34 | void _heapsort(T a, /*Iterator aN,*/std::ptrdiff_t n, Compare cmp)
      |      ^~~~~~~~~
a.cc:34:6: note:   template argument deduction/substitution failed:
a.cc:71:20: note:   cannot convert '(((int*)(& a)) + ((sizetype)(((long unsigned int)n) * 4)))' (type 'int*') to type 'std::ptrdiff_t' {aka 'long int'}
   71 |     _heapsort(a, a + n, std::less<int>());
      |                  ~~^~~
Language: C++

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

// template {{{
/* vim: set foldmethod=marker: */

// constant
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
const double PI = acos(-1);
#define EPS 1e-14

// typedef
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

// input
inline int inputi(){ int x; scanf("%d", &x); return x; }
inline double inputd(){ double x; scanf("%lf", &x); return x; }
inline string inputs(){ string x; cin >> x; return x; }

// short
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); 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 REPit(type, i, obj) for (type::iterator i = (obj).begin(); i != (obj).end(); i++)
#define RREPit(type, i, obj) for (type::iterator i = (obj).rbegin(); i != (obj).rend(); i++)

// container util
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define sz(obj) ((int)(obj).size())
#define sort(obj) sort(all(obj))
#define exist(obj, key) ((obj).find(key) != (obj).end())
#define clear(array) memset((array), 0, sizeof(array))

// print util
#define print(x) cout << (x) << endl
#define dump(x) cerr << #x << ": " << (x) << endl
#define debug(x) cerr << #x << ": " << (x) << " (" << __LINE__ << ")" << endl

// other
template <typename T> sqr(T x) { return x * x; }

//template }}}

int main()
{
    int n = inputi();
    vi v(n);
    REP(i, n) cin >> v[i];
    sort(v);
    REP(i, n) cout << v[i] << "\n "[i < n - 1];

    return 0;
}

Compiler output:
a.cc:53:23: error: ISO C++ forbids declaration of 'sqr' with no type [-fpermissive]
   53 | template <typename T> sqr(T x) { return x * x; }
      |                       ^~~
Language: C++

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] numbers = new int[n];
		
		for(int i=0;i<n;i++) numbers[i] = sc.nextInt();
		
		for(int i=0;i<n;i++){
			for (int j=i;j<n;j++){
				if(numbers[j]>numbers[j+1]){
					int temp;
					temp = numbers[j];
					numbers[j] = numbers[j+1];
					numbers[j+1] = temp;
				}
			}
		}
		System.out.printf("%d",numbers[0]);
		for(int i=1;i<n;i++) System.out.printf(" %d",numbers[i]);
		System.out.println();
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main{
      | ^~~~~~
Language: C++

void sort(int n,int* array){
  int i,j;
  for(i =0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if((array)[i]>(array)[j]){
        (array)[i]+=(array)[j];
        (array)[j]=(array)[i]-(array)[j];
        (array)[i]-=(array)[j];
      }
    }
  }
}

int main(){
  int n,i,*array;
  scanf("%d",&n);
  array=(int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++){
    scanf("%d",&array[i]);
  }
  sort(n,array);
  for(i=0;i<n-1;i++)printf("%d ",array[i]);
  printf("%d",array[i]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'scanf' was not declared in this scope
   16 |   scanf("%d",&n);
      |   ^~~~~
a.cc:17:15: error: 'malloc' was not declared in this scope
   17 |   array=(int*)malloc(sizeof(int)*n);
      |               ^~~~~~
a.cc:1:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
  +++ |+#include <cstdlib>
    1 | void sort(int n,int* array){
a.cc:22:21: error: 'printf' was not declared in this scope
   22 |   for(i=0;i<n-1;i++)printf("%d ",array[i]);
      |                     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | void sort(int n,int* array){
a.cc:23:3: error: 'printf' was not declared in this scope
   23 |   printf("%d",array[i]);
      |   ^~~~~~
a.cc:23:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <algorithm>
#Include <iostream>

using namespace std;

int main(){
 int a[1001];
 int n;
 cin >> n;
 for(int i = 0;i < n;i++){
  cin >> a[i];
 }
 sort(a, a + n);
 for(int i = 0;i < n;i++){
  if(i == n - 1)
  cout << a[i] << endl;
  else
  cout << a[i] << " ";
 }

 return 0;
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #Include; did you mean #include?
    2 | #Include <iostream>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:9:2: error: 'cin' was not declared in this scope
    9 |  cin >> n;
      |  ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <algorithm>
  +++ |+#include <iostream>
    2 | #Include <iostream>
a.cc:16:3: error: 'cout' was not declared in this scope
   16 |   cout << a[i] << endl;
      |   ^~~~
a.cc:16:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:19: error: 'endl' was not declared in this scope
   16 |   cout << a[i] << endl;
      |                   ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <algorithm>
  +++ |+#include <ostream>
    2 | #Include <iostream>
a.cc:18:3: error: 'cout' was not declared in this scope
   18 |   cout << a[i] << " ";
      |   ^~~~
a.cc:18:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<iostream>
#include<queue>
#include<cstdio>

using namespace std;

int main(void){
int n,x[101];
priority_queue<int>que;

scanf("%d",&n);

for(int i=0;i<n;i++){
scanf("%d",&x[i]);
que.push(x[i]);
}

for(int i=0;i<n;i++)
printf("%d ",que.pop());
printf("\n");

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:21: error: invalid use of void expression
   19 | printf("%d ",que.pop());
      |              ~~~~~~~^~
Language: C++

#include<iostream>
using namespace std;

int main(){
int n,a[1010];
cin >> n;
for(int i=0;i<n;i++)cin >> a[i];
sort(a,a+n);
for(Int i=0;j<n-1;i++)cout << a[i] << " ";
cout << a[n-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:1: error: 'sort' was not declared in this scope; did you mean 'short'?
    8 | sort(a,a+n);
      | ^~~~
      | short
a.cc:9:5: error: 'Int' was not declared in this scope; did you mean 'int'?
    9 | for(Int i=0;j<n-1;i++)cout << a[i] << " ";
      |     ^~~
      |     int
a.cc:9:13: error: 'j' was not declared in this scope
    9 | for(Int i=0;j<n-1;i++)cout << a[i] << " ";
      |             ^
a.cc:9:19: error: 'i' was not declared in this scope
    9 | for(Int i=0;j<n-1;i++)cout << a[i] << " ";
      |                   ^
Language: C++

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

int main(){
int n,a[1010];
cin >> n;
for(int i=0;i<n;i++)cin >> a[i];
sort(a,a+n);
for(Int i=0;j<n-1;i++)cout << a[i] << " ";
cout << a[n-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'Int' was not declared in this scope; did you mean 'int'?
   10 | for(Int i=0;j<n-1;i++)cout << a[i] << " ";
      |     ^~~
      |     int
a.cc:10:13: error: 'j' was not declared in this scope
   10 | for(Int i=0;j<n-1;i++)cout << a[i] << " ";
      |             ^
a.cc:10:19: error: 'i' was not declared in this scope
   10 | for(Int i=0;j<n-1;i++)cout << a[i] << " ";
      |                   ^
Language: C++

#include<iostream>
using namespace std;
#define MAX 1000

void sort(int number[],int n) ;

int main()
{
	int i,n;
	cin >> n ;
	int number[MAX];

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

	sort(number,n) ;

	for(i=0;i<n;i++){     
		if(i<(n-2)) cout << number[i] << ' '  ;
		if(i==(n-1) cout << number[i] << endl ;
	}

	return 0 ;
}

void sort(int number[],int n){
	int i, j, a;
	
	for(j=0;j<n-1;j++){
		for(i=0;i<n-1;i++){
			if(number[i]>number[i+1]){
				a = number[i] ;
				number[i] = number[i+1] ;
				number[i+1] = a ;
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:28: error: expected ';' before 'cout'
   21 |                 if(i==(n-1) cout << number[i] << endl ;
      |                            ^~~~~
      |                            ;
a.cc:22:9: error: expected primary-expression before '}' token
   22 |         }
      |         ^
a.cc:21:56: error: expected ')' before '}' token
   21 |                 if(i==(n-1) cout << number[i] << endl ;
      |                   ~                                    ^
      |                                                        )
   22 |         }
      |         ~                                               
a.cc:22:9: error: expected primary-expression before '}' token
   22 |         }
      |         ^
Language: C++

#include <stdio.h>

int main(){
	int i,j,n;
	int arr[1024]={0};
	int tmp;
	scanf("%d\n",&n);
	scanf("%d",&arr[0]);
	for (i=1;i<n;i++){
		scanf(" %d",&arr[i]);
		if(i!=0){
			for(j=0;j<i;j++){
				if(arr[i-j]<arr[i-j-1]){
					tmp=arr[i-j];
					arr[i-j]=arr[i-j-1];
					arr[i-j-1]=tmp;
				}
				else {
					break;}
			}
		}
	}
	for(i=0;i<n;i++){
	if(i==n-1){
		printf("%d",arr[i]);
	}
	else{
	printf("%d ",arr[i]);
	}
	}
	printf("\n");
	return 0;
}


0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 
					
				

Compiler output:
a.cc:36:1: error: expected unqualified-id before numeric constant
   36 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9
      | ^
Language: C++

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

int main(){
	int n,in;
	list<int> out;
	list<int>::iterator pos;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>in;
		out.push_back(in)
	}
	out.sort();
	pos=out.begin();
	cout<<*pos;
	++pos;
	for(;pos!=out.end();++pos)cout<<' '<<*pos;
	cout<<endl;
	cin>>n;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:34: error: expected ';' before '}' token
   12 |                 out.push_back(in)
      |                                  ^
      |                                  ;
   13 |         }
      |         ~
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> V(N);
  for(int i = 0; i < N; i++) cin >> V[i];
  sort(V.begin(),V.end());
  for(int i = 0; i < N; i++){
    if(i) cout << " " ;
    cout << V[i];
  }
  return 0;
}

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

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

int main()
{
int n;
vector<int> v(n);
for(int i=0;i<n;i++){
cin>>v[i];
}
for(int i=0;i<n;i++){
if(i!=0) cout<<" ";
cout<<v[i];
}
cout<<endl;
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #incude; did you mean #include?
    2 | #incude<algorithm>
      |  ^~~~~~
      |  include
Language: C++

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

int main()
{
int n;
vector<int> v(n);
for(int i=0;i<n;i++){
cin>>v[i];
}
sort(v.begin(),v.end())
for(int i=0;i<n;i++){
if(i!=0) cout<<" ";
cout<<v[i];
}
cout<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: expected ';' before 'for'
   13 | sort(v.begin(),v.end())
      |                        ^
      |                        ;
   14 | for(int i=0;i<n;i++){
      | ~~~                     
a.cc:14:13: error: 'i' was not declared in this scope
   14 | for(int i=0;i<n;i++){
      |             ^
Language: C++

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

int main() {
  
  
  int n,i,temp;
  vector<int> suuji
  cin >> n;
  
  
  for(i=0;i<n;i++){
    cin >> temp;
    suuji.push_back(temp);
  }
  
  sort(suuji.begin(),suuji.end())
  
  for(i=0;i<n;i++){
    if (i==0)cout << suuji[n-i-1] ;
    else cout << " " << suuji[n-i-1];
  }
  cout << endl;
    
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: expected initializer before 'cin'
   11 |   cin >> n;
      |   ^~~
a.cc:16:5: error: 'suuji' was not declared in this scope
   16 |     suuji.push_back(temp);
      |     ^~~~~
a.cc:19:8: error: 'suuji' was not declared in this scope
   19 |   sort(suuji.begin(),suuji.end())
      |        ^~~~~
a.cc:21:18: error: expected ';' before ')' token
   21 |   for(i=0;i<n;i++){
      |                  ^
      |                  ;
Language: C++

#include <iostream>

using namespace std;


void sort(int *array, int len)

{

	for (int i = 0; i < len; i++) {

		for (int j = i + 1; j < len; j++) {

			if (array[i] > array[j]) {

				int tmp = array[i];

				array[i] = array[j];

				array[j] = tmp;

			}

		}

	}

}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>

using namespace std;

int main(void){

  int n;
  int num[1000];

  cin >> n;

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

  sort( num , num + 5);

  for( int i = 0 ; i < n ; i++ ){
    if( i != n - 1 )cout << num[i] << " ";
    else if( i == n - 1 )cout << num[i] << endl;
  }

  return 0;
}

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

#include <iostream>

using namespace std;

int main(void){

  int n;
  int num[1000];

  cin >> n;

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

  sort( num , num + n );

  for( int i = 0 ; i < n ; i++ ){
    if( i != n - 1 )cout << num[i] << " ";
    else if( i == n - 1 )cout << num[i] << endl;
  }

  return 0;
}

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

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n_data, tmp;
    cin >> n_data;
    vector<int> data;
    for (int i = 0; i != n_data; ++i) {
	cin >> tmp;
	data.push_back(tmp);
    }
    sort(data.begin(), data.end());
    for (vector<int>::iterator it = data.begin(); ; ++it) {
	cout << *it;
	if (it == data.end() - 1)
	    break;
	cout << ' ';
    }
    cout << endl;
    return 0;
}

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

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n_data, tmp;
    cin >> n_data;
    vector<int> data;
    for (int i = 0; i != n_data; ++i) {
	cin >> tmp;
	data.push_back(tmp);
    }
    std::sort(data.begin(), data.end());
    for (vector<int>::iterator it = data.begin(); ; ++it) {
	cout << *it;
	if (it == data.end() - 1)
	    break;
	cout << ' ';
    }
    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   15 |     std::sort(data.begin(), data.end());
      |          ^~~~
      |          qsort
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int i, n, tmp;
	vector<int> row;

	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> tmp;
		row.push_back(tmp);
	}
	sort(row.begin(), row.end());

	for (i = 0; i < n; i++) {
		if (i == n - 1) {
			cout << row[i] << endl;
			break;
		}
		cout << row[i] << " ";
	}

	return 0;
}

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

#include <iostream>
using namespace std;

int main(){
	int n, *val;

	cin >> n;
	val = new int[n];	//int型の領域を動的に確保
	for(int i=0; i<n; i++)
		cin >> val[i];

	for(int i=0; i<n-1; i++)
		for(int j=0; j<n-i-1; j++)
			if(val[j]>val[j+1]){
				int tmp = val[j];
				val[j]=val[j+1];
				val[j+1]=tmp;
			}

	for(int i=0; i<n; i++){
		cout << val[i];
		if(i==n-1)
			cout << endl;
		else
			cout <<" ";
	}

	delete [] val;
	return ;
}

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

#include<stdio.h>
#include<hamakou.h>

main(){

  int a[1000], i, n, j, mpos, temp;

  //Input
  scanf("%d",&n);
  i = 0;
  while(i < n){
    scanf("%d",a + i);
    i++;
  }

  /* n個の数値 a[0], a[1], ・・・, a[n-1]を小さい順に並べ替える */
  i = 0;
  while(i < n - 1){
    /* i番目以降の最小値を見つける */
    mpos = i;
    j = i + 1;
    while(j < n){
      /* a[mpos] と a[j] を比較して a[j]が小さければmposを更新する */
      if( a[mpos] > a[j] ){
	mpos = j;
      }
      j++;
    }

    /* 最小値a[mpos]とa[i]を入れ替える */
    if( a[mpos] != a[i] ){
      temp = a[mpos];
      a[mpos] = a[i];
      a[i] = temp;
    }

    i++;
  }

  //Output
  i = 0;
  while(i < n){
    if(i) printf(" ");
    printf("%d", a[i]);
    i++;
  }
  printf("\n");
  return(0);
}

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

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

void swap(int *a, int *b)
{
	int temp;
	temp = *a;
	*a = *b;
	*b = temp;
}

void bubblesort(int a[],int n)
{
	int k = 0; /* a[k]まではソート済み */
	
	int i;
	
	do{
	
	int last = n - 1; /* 毎回最後までソートが終わったと仮定している。*/
	for(i = n - 1;i > k;i--)
	{
		if(a[i - 1] > a[i])
		{
			swap(&a[i - 1],&a[i]);
			last = i;
		}
	}
	k = last; /* lastは最後に交換した位置。ソートがそこまで終わっている。 */
	
	}while(k < n - 1); /* ここのkはlastでは未定義になってしまう。*/
	
}

int main(void)
{
	int n, i, *x;
	scanf("%d",&n);
	x = calloc(n, sizeof(int));
	for(i = 0;i < n;i++)
	{
	scanf("%d",&x[i]);
	}
	
	bubblesort(x, n);
	
	
	
	for(i = 0;i < n - 1;i++)
	{
		printf("%d ",x[i]);
	}
	
        printf("%d\n",x[n - 1]):
	free(x);
	
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:19: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   39 |         x = calloc(n, sizeof(int));
      |             ~~~~~~^~~~~~~~~~~~~~~~
      |                   |
      |                   void*
a.cc:54:32: error: expected ';' before ':' token
   54 |         printf("%d\n",x[n - 1]):
      |                                ^
      |                                ;
Language: C++

#include<stdio.h>
#include<stdlib.h>
 
void swap(int *a, int *b)
{
    int temp;
    temp = *a;
    *a = *b;
    *b = temp;
}
 
void bubblesort(int a[],int n)
{
    int k = 0; 
     
    int i;
     
    do{
     
    int last = n - 1;
    for(i = n - 1;i > k;i--)
    {
        if(a[i - 1] > a[i])
        {
            swap(&a[i - 1],&a[i]);
            last = i;
        }
    }
    k = last;
     
    }while(k < n - 1); 
}
 
int main(void)
{
    int n, i, *x;
    scanf("%d",&n);
    x = calloc(n, sizeof(int));
    for(i = 0;i < n;i++)
    {
    scanf("%d",&x[i]);
    }
     
    bubblesort(x, n);
     
     
     
    for(i = 0;i < n - 1;i++)
    {
        printf("%d ",x[i]);
    }
     
        printf("%d\n",x[n - 1]);
    free(x);
     
    return 0;
     
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:15: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   38 |     x = calloc(n, sizeof(int));
      |         ~~~~~~^~~~~~~~~~~~~~~~
      |               |
      |               void*
Language: Java

import java.util.Scanner;
import java.util.Arrays;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int s[] = new int[n];
    for (int i = 0; i < n; i++) {
      s[i] = sc.nextInt();
    }
    int q = sc.nextInt();
    int t[] = new int[q];
    for (int i = 0; i < q; i++) {
      t[i] = sc.nextInt();
    }
    int counter = 0;
    Arrays.sort(s);
    for (int i = 0; i < n; i++) {
      if (Arrays.binarySearch(s, t[i])) {
        counter++;
      }
    }
    System.out.println(counter);
  }
  
}

Compiler output:
Main.java:19: error: incompatible types: int cannot be converted to boolean
      if (Arrays.binarySearch(s, t[i])) {
                             ^
1 error
Language: Java

import java.io.*;
import java.util.*;

class Main {
  public static void main (String[] args) throws IOException {
    InputStreamReader isr = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(isr);
    String line = br.readLine();
    line = br.readLine();
    String[] s = line.split(" ");
    line = br.readLine();
    line = br.readLine();
    String[] t = line.split(" ");
    int c = 0;
    for (int ii = 0; ii < s.length; ii++) {
      for (int jj = 0; jj < t.length; jj++) {
        if (s[ii].equals(t[jj])) {
          cc++;
          break;
        }
      }
    }
    System.out.println(c);
  }
}

Compiler output:
Main.java:18: error: cannot find symbol
          cc++;
          ^
  symbol:   variable cc
  location: class Main
1 error
Language: Java

import java.util.Scanner;

public class Search1 {
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = scan.nextInt();
	int[] s = new int[n];
	for(int i = 0; i < n; ++i) {
	    s[i] = scan.nextInt();
	}

	int q = scan.nextInt();
	int ans = 0;
	for(int i = 0; i < q; ++i) {
	    int t = scan.nextInt();
	    for(int j = 0; j < n; ++j) {
		if(t == s[j]) {
		    ++ans;
		    break;
		}
	    }
	}

	System.out.println(ans);
    }
}

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

import java.util.Scanner;

public class Search1 {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[][] check = new int[2][501];

		int cnt = 0;
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
			check[0][sc.nextInt()]++;
		int m = sc.nextInt();
		for (int i = 0; i < m; i++)
			check[1][sc.nextInt()]++;
		for (int i = 0; i < check[0].length; i++)
			if (check[0][i] > 0 && check[1][i] > 0) cnt++;

		System.out.println(cnt);

	}

}

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

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int cnt = 0;
		int[] S = new int[100];
		int[] T = new int[100];
		int n = scan.nextInt();
		for(int i = 0; i < n;i++){
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		for(int i = 0; i < q;i++){
			T[i] = scan.nextInt();
		}
		for(int i = 0; i < n; i++){
			for(int j = 0; j < q; j++){
				if(T[j] == S[i]){
					cnt++;
					break;
				}
			}
		}
		System.out.println(cnt);
	}
}

Compiler output:
Main.java:4: error: cannot find symbol
		Scanner scan = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner scan = new Scanner(System.in);
		                   ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

public class Main {
	static void search(){
		Scanner sc = new Scanner(System.in);
		int idx = 10000000;
		int[] num = new int[idx];
		int number,ans = 0;
		for(int i = 0; i < idx; i++){
			num[i] = 0;
		}
		for(int i = 0; i < 2; i++){
			int n = sc.nextInt();
			for(int j = 0; j < n; j++){
				number = sc.nextInt();
				num[number]++;
			}
		}
		for(int i = 0; i < idx; i++){
			if(num[i] == 2) ans++;
		}
		System.out.println(ans);
	}
	public static void main(String[] args) {
		search();
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public class AOJ_10030 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int [n];
		for(int i = 0; i < n; i++){
			S[i] = sc.nextInt();
		}
		
		int q = sc.nextInt();
		int T[] = new int [q];
		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}
		
		int count = 0;
		
		for(int i = 0; i < n; i++){
			for(int j = 0; j < q; j++){
				if(S[i] == T[j]){
					count++;break;
				}
			}
		}
		System.out.println(count);
		
	}

}

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

#include<stdio.h>
int main(){
  int n,q,i,ii,C=0;
  scanf("%d",&n);
  int S[n];
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  int T[q];
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }
  for(i=0;i<n;i++){
    for(ii=0;ii<q;ii++){
      if(S[i]==T[ii]){
	C++;
      }
    }
  }
  printf("%d\n",total);
  return(0);
}
	

Compiler output:
main.c: In function 'main':
main.c:21:17: error: 'total' undeclared (first use in this function)
   21 |   printf("%d\n",total);
      |                 ^~~~~
main.c:21:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main(void){
int a,b,x[100],y[100],t,n,z=0;
scanf("%d",&a);
for(t=0;t<a;t++){
	scanf("%d",&x[t]);
}
scanf("%d",&b);
for(t=0;t<b;t++){
	scanf("%d",&y[t]);
}
for(n=0;n<b;n++){
     for(t=0;t<a;t++){
		if(x[t]==y[n]){
			z++;
			goto O;
		}
	}O
}

printf("%d\n",z);

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:10: error: 'O' undeclared (first use in this function)
   19 |         }O
      |          ^
main.c:19:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:11: error: expected ';' before '}' token
   19 |         }O
      |           ^
      |           ;
   20 | }
      | ~          
main.c:17:25: error: label 'O' used but not defined
   17 |                         goto O;
      |                         ^~~~
Language: C

#include <stdio.h>
int main(){
  int n,S[100],q,T[100],i,sc,tc,C = 0;
  scanf("%d",&n);
  if(n > 100){
    return 0;;
  }
  for(i = 0;i < n;i++){
    scanf("%d",&S[i]);
    if(S[i] <= 0 || S[i] >= 500){
      return 0;
    }
  }
  scanf("%d",&q);
  if(q > 100){
    return 0;;
  }
  for(i = 0;i < q;i++){
    scanf("%d",&T[i]);
    if(T[i] <= 0 || S[i] >= 500){
      return 0;
    }
  for(sc = 0;sc < n;sc++){
    for(tc = 0;tc < q;tc++){
      if(S[sc] == T[tc]) C++;
    }
  }
  printf("%d",C);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
Language: C

#include <stdio.h>
#include <algorithm>
int main() {
	int n,q,i,k,cnt=0,t[50000],s[100000];
//	int n,q,i,k,cnt=0,t[500],s[500];
	int low = 0,high, mid;
	scanf(" %d",&n);
	for(i = 0;i < n;i++){
		scanf(" %d",&s[i]);
	}
	std::sort(s,s+n);
	scanf(" %d",&q);
	for(i = 0;i < q;i++){
		scanf(" %d",&t[i]);
	}
	for(i = 0;i < q;i++){
		low = 0;
		high =n-1;
		while(1){
			mid = (low + high) / 2;
			if(s[mid] == t[i]) {
				cnt++;
				break;
			}else if(low > high){
				break;
			}else if(s[mid] < t[i]){
				low = mid+1;
			}else{
				high = mid-1;
			}
		}
	}
	printf("%d\n",cnt);
	return 0;
}

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

#include <stdio.h>
#include <algorithm>

int main() {
	int n,q,i,k,cnt=0,t[50000],s[100000];
//	int n,q,i,k,cnt=0,t[500],s[500];
	int low = 0,high, mid;
	scanf(" %d",&n);
	for(i = 0;i < n;i++){
		scanf(" %d",&s[i]);
	}
	std::sort(s,s+n);
	scanf(" %d",&q);
	for(i = 0;i < q;i++){
		scanf(" %d",&t[i]);
	}
	for(i = 0;i < q;i++){
		low = 0;
		high =n-1;
		while(1){
			mid = (low + high) / 2;
			if(s[mid] == t[i]) {
				cnt++;
				break;
			}else if(low > high){
				break;
			}else if(s[mid] < t[i]){
				low = mid+1;
			}else{
				high = mid-1;
			}
		}
	}
	printf("%d\n",cnt);
	return 0;
	
}

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

#include <stdio.h>

int main() {
  int i, k, n, q, N = 0;
  int S[100000], T[100000];
  scanf("%d", &n);
  for(i = 0; i < n; i++) scanf("%d", &S[i]);
  scanf("%d", &q);
  for(i = 0; i < q; i++){
    scanf("%d", &T[i]);
    for(k = 0, k < n; k++){
      if(T[i] == S[k]){
        N++;
        break;
      }
    }
  }
  printf("%d\n", N);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:26: error: expected ';' before ')' token
   11 |     for(k = 0, k < n; k++){
      |                          ^
      |                          ;
Language: C

#include <stdio.h>

int main(void)
{
	int n, s[100], q, t[100], c=0,i,j;

	scanf_s("%d", &n);
	for (i = 0; i < n; i++)
		scanf_s("%d", &s[i]);
	scanf_s("%d", &q);
	for (i = 0; i < q; i++)
		scanf_s("%d", &t[i]);
	for (i = 0; i < q; i++){
		for (j = 0; j < n; j++){
			if (t[i]==s[j]){
				c++;
				break;
			}
		}
	}
	printf("%d\n", c);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    7 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C

#include <stdio.h>

int main() {
  int i, j, n, q, work, N = 0;
  int S[100000], T[100000];
  scanf("%d", &n);
  for(i = 0; i < n; i++) scanf("%d", &S[i]);
  for(i=0; i<n; ++i){
    for(j=i+1; j<n; ++j){
      if(S[i] > S[j]){
        work =  S[i];
        S[i] = S[j];
        S[j] = work;
      }
    }
  }
  /*for(i=0; i<n; ++i) printf("%d\n", S[i]);*/
  scanf("%d", &q);
  for(i = 0; i < q; i++){
    scanf("%d", &T[i]);
    int low = 0, high = n - 1, mid;
    while(1) {
      mid = (low + high) / 2;
      if(S[mid] == T[i]){
        N++;
        break;
      }else if(S[mid] < T[i]) low = mid + 1;
      else high = mid - 1;
      if(high < low){
        break;
      }
    }
  printf("%d\n", N);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:35:1: error: expected declaration or statement at end of input
   35 | }
      | ^
Language: C

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

int cmp_int(const void *a, const void *b) {
	if (*(int *)a > *(int *)b)
		return 1;
	if (*(int *)a < *(int *)b)
		return -1;
	return 0;
}

typedef struct Items Items;
struct Items {
	int no_items;
	int *items;
};

void read_items(Items *items) {
	int i;
	scanf("%d", &items->no_items);
	items->items = (int *)malloc(items->no_items * sizeof(int));
	for (i = 0; i < items->no_items; i++)
		scanf("%d", &items->items[i]);
	qsort((void *)items->items, items->no_items, sizeof(int), cmp_int);
}

int count_intersection(Items *a, Items *b) {
	int i;
	int count = 0;
	for (i = 0; i < b->no_items; i++)
		if (bsearch(&b->items[i], a->items, a->no_items, sizeof(int), cmp_int) != NULL)
			count++;
	return count;
}

int main() {
	Items s, t;
	readItems(&s);
	readItems(&t);

	printf("%d\n", countIntersection(&s, &t));
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:38:9: error: implicit declaration of function 'readItems'; did you mean 'read_items'? [-Wimplicit-function-declaration]
   38 |         readItems(&s);
      |         ^~~~~~~~~
      |         read_items
main.c:41:24: error: implicit declaration of function 'countIntersection'; did you mean 'count_intersection'? [-Wimplicit-function-declaration]
   41 |         printf("%d\n", countIntersection(&s, &t));
      |                        ^~~~~~~~~~~~~~~~~
      |                        count_intersection
Language: C

#include <stdio.h>
#include <math.h>
 
int main(void)
{
	int n,q,i,j;
	int s[100],t[100];

	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		scanf("%d",&s[i]);
	}

	scanf("%d",&q);

	for(i=0;i<q;i++)
	{
		scanf("%d",&t[i]);
	}

	for(i=0;i<n;i++)
	{
		for(j=0;j<q;j++)
		{
			if(s[i]=={t[j])
			{
				printf("%d ",t[j]);
			}
		}
	}

	return (0);
}

Compiler output:
main.c: In function 'main':
main.c:27:34: error: expected expression before '{' token
   27 |                         if(s[i]=={t[j])
      |                                  ^
main.c:31:17: error: expected expression before '}' token
   31 |                 }
      |                 ^
Language: C

#include <stdio.h>
int main(){
 int i, n, q, x, S[100], T[100], ans;
 scanf("%d\n", &n);
 for(i = 0; i < n; i++){
  scanf("%d", &S[i]);
 }
 scanf("%d\n", &q);
 for(i = 0; i < q; i++){
  scanf("%d", &T[i]);
 }
 for(x = 0; x < q; x++){
  for(i = 0; i < n; i++){
   if(S[i] == T[x]){
    ans++;
    continue;
  }
 }
 printf("%d\n", ans);
 return 0;
}

Compiler output:
main.c: In function 'main':
main.c:21:1: error: expected declaration or statement at end of input
   21 | }
      | ^
Language: C

#include <stdio.h>
int main(){
	int i,k,n,q,C=0,S[101],T[101];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&S[i]);
	}
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&T[i]);
	}
	for(i=0;i<n;i++){
		for(k=0;k<q;k++){
			if(S[i]==T[k]){
				cnt++;
			}
		}
	}
	printf("%d\n",C);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:33: error: 'cnt' undeclared (first use in this function); did you mean 'int'?
   15 |                                 cnt++;
      |                                 ^~~
      |                                 int
main.c:15:33: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
int i,k,n,q,cnt=0,S[100]={},T[100]={},comp[500]={};
scanf("%d",&n)
for(i=0;i<n;i++){
scanf("%d",&S[i]);

}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&T[i]);
}
for(i=0;i<n;i++){
for(k=0;k<q;k++){
if(S[i]==T[k]&&comp[k]==0)){
cnt++;
comp[k]++;
break;
}
}
}
printf("%d\n",cnt);

}

Compiler output:
main.c: In function 'main':
main.c:4:15: error: expected ';' before 'for'
    4 | scanf("%d",&n)
      |               ^
      |               ;
    5 | for(i=0;i<n;i++){
      | ~~~            
main.c:15:27: error: expected statement before ')' token
   15 | if(S[i]==T[k]&&comp[k]==0)){
      |                           ^
Language: C

#include<stdio.h>
int main(){
int i,k,n,q,cnt=0,S[100]={},T[100]={},comp[500]={};
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);

}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&T[i]);
}
for(i=0;i<n;i++){
for(k=0;k<q;k++){
if(S[i]==T[k]&&comp[k]==0){
cnt++;
comp[k]++;
break;
}
}
}
printf("%d\n",cnt);
???return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:1: error: expected expression before '?' token
   23 | ???return 0;
      | ^
Language: C

#include<stdio.h>
#include<algorithm>
int main(){
	int i,n,q,cnt=0,S[100]={},T[100]={},dup[501]={};
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&S[i]);
	}
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&T[i]);
	}
	std::sort(S,S+n);
	for(i=0;i<q;i++){
		int low=0,high=n-1,mid;
		while(1){
			mid=(low+high)/2;
			if(T[i]==S[mid] && dup[i]==0){
				dup[i]++;
				cnt++;
				break;
			}else if(T[i] > S[mid])	low=mid+1;
			else	high=mid-1;
			if(high<low)	break;
		}
	}
	printf("%d\n",cnt);
	
}

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

#include<stdio.h>
	const int a=100000;
	int data[a+1];
	int main(){
		int n,k,S,q,T,y,cnt=0,zero=0;
		scanf("%d",&n);
		for(k=zero;k<n;k++){
			scanf("%d",&S);
			data[k]=S;
		}
		scanf("%d",&q);
		for(k=zero;k<q;k++){
		     scanf("%d",&T);
		     for(y=zero;y<n;y++){
		     	if(data[y]==T){
		     		cnt++;
		     	}
		     }
		 }
		 printf("%d\n",cnt);
		 return 0;
	  } 
		

Compiler output:
main.c:3:13: error: variably modified 'data' at file scope
    3 |         int data[a+1];
      |             ^~~~
Language: C

#include <stdio.h>

int main() {
	int MAX_V = 500;
	int i, v;
	int n, q, cnt = 0;
	static int cnt_s[MAX_V + 1] = {0}, cnt_t[MAX_V + 1] = {0};
	scanf("%d", &n);
	for(i = 0; i < n; i++) {
		scanf("%d", &v);
		cnt_s[v] = 1;
	}
	scanf("%d", &q);
	for(i = 0; i < q; i++) {
		scanf("%d", &v);
		cnt_t[v] = 1;
	}
	for(i = 0; i <= MAX_V; i++) {
		if(cnt_s[i] && cnt_t[i]) {
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:39: error: variable-sized object may not be initialized except with an empty initializer
    7 |         static int cnt_s[MAX_V + 1] = {0}, cnt_t[MAX_V + 1] = {0};
      |                                       ^
main.c:7:20: error: storage size of 'cnt_s' isn't constant
    7 |         static int cnt_s[MAX_V + 1] = {0}, cnt_t[MAX_V + 1] = {0};
      |                    ^~~~~
main.c:7:63: error: variable-sized object may not be initialized except with an empty initializer
    7 |         static int cnt_s[MAX_V + 1] = {0}, cnt_t[MAX_V + 1] = {0};
      |                                                               ^
main.c:7:44: error: storage size of 'cnt_t' isn't constant
    7 |         static int cnt_s[MAX_V + 1] = {0}, cnt_t[MAX_V + 1] = {0};
      |                                            ^~~~~
Language: C

#include <stdio.h>

int main() {
	const int MAX_V = 500;
	int i, v;
	int n, q, cnt = 0;
	static int cnt_s[MAX_V + 1] = {0}, cnt_t[MAX_V + 1] = {0};
	scanf("%d", &n);
	for(i = 0; i < n; i++) {
		scanf("%d", &v);
		cnt_s[v] = 1;
	}
	scanf("%d", &q);
	for(i = 0; i < q; i++) {
		scanf("%d", &v);
		cnt_t[v] = 1;
	}
	for(i = 0; i <= MAX_V; i++) {
		if(cnt_s[i] && cnt_t[i]) {
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:39: error: variable-sized object may not be initialized except with an empty initializer
    7 |         static int cnt_s[MAX_V + 1] = {0}, cnt_t[MAX_V + 1] = {0};
      |                                       ^
main.c:7:20: error: storage size of 'cnt_s' isn't constant
    7 |         static int cnt_s[MAX_V + 1] = {0}, cnt_t[MAX_V + 1] = {0};
      |                    ^~~~~
main.c:7:63: error: variable-sized object may not be initialized except with an empty initializer
    7 |         static int cnt_s[MAX_V + 1] = {0}, cnt_t[MAX_V + 1] = {0};
      |                                                               ^
main.c:7:44: error: storage size of 'cnt_t' isn't constant
    7 |         static int cnt_s[MAX_V + 1] = {0}, cnt_t[MAX_V + 1] = {0};
      |                                            ^~~~~