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

#include<stdio.h>
#define MAX 500000
#define SENTINEL 200000000

int L[MAX/2+2],R[MAX/2+2];
int cnt;

void merge(A[], left, mid){
    int i,j,k,right = left;
  int n1 = mid - left;
  int n2 = right - mid;
  for(i = 0;i <= n1-1;i++)
    L[i] = A[left + i];
  for(i = 0;i <= n2-1;i++)
    R[i] = A[mid + i];
  L[n1] = SENTINEL;
  R[n2] = SENTINEL;
  i = 0;
  j = 0;
  for(k = left ;k <= right-1;k++){
      cnt++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    }
    else {
      A[k] = R[j];
      j = j + 1;
    }
  }
}

void mergeSort(int A[], int left, int right){
  if(left+1 < right){
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid);
  }
}

int main(){
    int A[MAX],n,i;
    cnt = 0;

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

    mergeSort(A,n,0);

    for(i=0;i<n;i++){
        if(i) printf(" ");
        else printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",cnt);

    return 0;
}


Compiler output:
main.c:8:12: error: unknown type name 'A'
    8 | void merge(A[], left, mid){
      |            ^
main.c:8:17: error: unknown type name 'left'
    8 | void merge(A[], left, mid){
      |                 ^~~~
main.c:8:23: error: unknown type name 'mid'
    8 | void merge(A[], left, mid){
      |                       ^~~
main.c: In function 'mergeSort':
main.c:38:5: error: implicit declaration of function 'merge' [-Wimplicit-function-declaration]
   38 |     merge(A, left, mid);
      |     ^~~~~
Language: C

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




void mergeSort(int numbers[], int temp[], int array_size);
void m_sort(int numbers[], int temp[], int left, int right);
void merge(int numbers[], int temp[], int left, int mid, int right);

int numbers[10000];
int temp[10000];
int cnt=0;

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

	
	mergeSort(numbers, temp, n);

	for (i = 0; i < n; i++){
	if(i){
	printf(" ");
	}
	printf("%d", numbers[i]);
	}
	printf("\n\n%d", cnt);
	
	return 0;
}


void mergeSort(int numbers[], int temp[], int array_size)
{
  m_sort(numbers, temp, 0, array_size - 1);
}



void m_sort(int numbers[], int temp[], int left, int right)
{
  int mid;

  if (right > left)
  {
    mid = (right + left) / 2;
    m_sort(numbers, temp, left, mid);
    m_sort(numbers, temp, mid+1, right);

    merge(numbers, temp, left, mid+1, right);
  }
}


void merge(int numbers[], int temp[], int left, int mid, int right)
{
  int i, end_left, num_elements, tmp_pos;

  end_left = mid - 1;
  tmp_pos = left;
  num_elements = right - left + 1;

  while ((left <= end_left) && (mid <= right))
  {
    if (numbers[left] <= numbers[mid])
    {
      temp[tmp_pos] = numbers[left];
      tmp_pos = tmp_pos + 1;
      left = left +1;
    	cnt++;
    }
    else
    {
      temp[tmp_pos] = numbers[mid];
      tmp_pos = tmp_pos + 1;
      mid = mid + 1;
    	cnt++;
    }
  }

  while (left <= end_left)
  {
    temp[tmp_pos] = numbers[left];
    left = left + 1;
    tmp_pos = tmp_pos + 1;
  	cnt++;
  }
  while (mid <= right)
  {
    temp[tmp_pos] = numbers[mid];
    mid = mid + 1;
    tmp_pos = tmp_pos + 1;
  	cnt++;
  }

  for (i=0; i <= num_elements; i++)
  {
    numbers[right] = temp[right];
    right = right - 1;
  }



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

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

int count=0;
void Merge(int*,int,int,int);
void MergeSort(int*,int,int);
int main(){
  int n,i;
  scanf("%d",&n);
  int A[n];
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  MergeSort(A,0,n);
  
    
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n%d\n",count);
  return 0;
}

void Merge(int *a,int l,int m,int r){
  int n1,n2,i,j,k;
  int *L,*R;
  n1=m - l;
  n2=r - m;
  L=(int *)malloc((n1+1) * sizeof(int));
  R=(int *)malloc((n2+1) * sizeof(int));
  for(i=0;i<n1;i++){
    L[i]=a[l+i];
  }
 
  for(i=0;i<n2;i++){
    R[i]=a[m+i];
   
  }
 
  L[n1]=INFINITY;
  R[n2]=INFINITY;
  i=0;
  j=0;
  for(k=l;k<r;k++){
    if(L[i]<R[j]){
      a[k] = L[i];
      i=i+1;
    }


Compiler output:
main.c: In function 'Merge':
main.c:42:9: warning: overflow in conversion from 'float' to 'int' changes value from '+Inff' to '2147483647' [-Woverflow]
   42 |   L[n1]=INFINITY;
      |         ^~~~~~~~
main.c:43:9: warning: overflow in conversion from 'float' to 'int' changes value from '+Inff' to '2147483647' [-Woverflow]
   43 |   R[n2]=INFINITY;
      |         ^~~~~~~~
main.c:50:5: error: expected declaration or statement at end of input
   50 |     }
      |     ^
main.c:50:5: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>
#include <math.h>
#define N 500000

int cnt=0;

void merge(int *A,int left,int mid,int right){
  int n1 = mid-left;
  int n2 = right-mid;
  int i,j,k;
  int L[N],R[N];
  
  for(i=0;i<=n1-1;i++){
    L[i] = A[left+i];
  }
  for(i=0;i<=n2-1;i++){
    R[i] = A[mid+i];
  }
  L[n1] = INFTY;
  R[n2] = INFIY;
  i=0;
  j=0;
  for(k=left;k<=right-1;k++){
    cnt++;
    if(L[i]<=R[j]){
      A[k] = L[i];
      i++;
    }
    else {
      A[k] = R[j];
      j++;
    }
  }
}
void mergeSort(int *A,int left,int right){
  int mid;
  if(left+1<right){
    mid = (left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}
int main(){
  int n,S[N],i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  mergeSort(S,0,n);
  for(i=0;i<n;i++){
    if(i==n-1) printf("%d\n",S[i]);
    else printf("%d ",S[i]);
  }

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



Compiler output:
main.c: In function 'merge':
main.c:19:11: error: 'INFTY' undeclared (first use in this function); did you mean 'INFINITY'?
   19 |   L[n1] = INFTY;
      |           ^~~~~
      |           INFINITY
main.c:19:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:11: error: 'INFIY' undeclared (first use in this function); did you mean 'INFINITY'?
   20 |   R[n2] = INFIY;
      |           ^~~~~
      |           INFINITY
Language: C

#include<studio.h>
#include<stdlib.h>
#define N 1000000000
#define RANGE 500000

void merge(int *,int ,int);
void mergesort(int *,int,int);
int *L,*R,cnt=0;

int main(void){
  int n,S[RANGE],i;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  mergesort(S,0,n);

  for(i=0;i<n;i++){
    printf("%d",S[i]);
    if(i < n-1) printf(" ");

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

void merge(int *S,int left,int mid int right){
  int n1,n2,i,k,j;
  n1=mid-left;
  n2=right-mid;
  L=(int *)malloc((n1+1)*sizeof(int));
  R=(int *)malloc((n2+1)*sizeof(int));

  for(i=0;i<n1;i++) L[i]=S[left + i];
  for(i=0;i<n2;i++) R[i]=S[mid + i];
  L[n1]=N;
  R[n2]=N;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j] ){
      S[k]=L[i];
      i++;
    }else{
      S[k]=R[j];
      j++;
    }
  }
}


void mergesort(int *S,int left,int right){
  int mid;
  if(left+1<right){
    mid = (left + right)/2;
    mergesort(S,left,mid);
    mergesort(S,mid,right);
    merge(S,left,mid,right);

  }


}



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

void mergSort(int num[], int temp[], int array)
{
    m_sort(num,temp,0,array - 1);
}
void m_sort(int num[], int temp, int left, int right)
{
    int center;
    if(right>left)
    {
        center=(right+left)/2;
        m_sort(num,temp,left,center);
        m_sort(num,temp,center+1,right);
        merge(num,temp,left,center+1,right);
    }
}
void merge(int num[], int temp[], int left, int center, int right){
    int i,left_end,num_elements,tmp_pos;
    left_end=center-1;
    tmp_pos=left;
    num_elements=right-left+1;

    while((left<=left_end)&&(center<=right))
    {
        if(num[left]<=num[center])
        {
        temp=[tmp_pos]=num[left];
        tmp_pos=tmp_pos+1;
        left=left+1;
        }
    
    else
    {
        temp[tmp_pos]=num[center];
        tmp_pos=tmp_pos+1;
        center=center+1;
    }
}
while(left<=left_end)
{
    temp[tmp_pos]=num[left];
    left=left+1;
    tmp_pos=tmp_pos+1;
}
while(center<=right)
{
    temp[tmp_pos]=num[center];
    center=center+1;
    tmp_pos=tmp_pos+1;
}
for(i=0;i<=num_elements;i++){
    num[right]=temp[right];
    right=right-1;
}
}


Compiler output:
main.c: In function 'mergSort':
main.c:3:5: error: implicit declaration of function 'm_sort' [-Wimplicit-function-declaration]
    3 |     m_sort(num,temp,0,array - 1);
      |     ^~~~~~
main.c: At top level:
main.c:5:6: warning: conflicting types for 'm_sort'; have 'void(int *, int,  int,  int)'
    5 | void m_sort(int num[], int temp, int left, int right)
      |      ^~~~~~
main.c:3:5: note: previous implicit declaration of 'm_sort' with type 'void(int *, int,  int,  int)'
    3 |     m_sort(num,temp,0,array - 1);
      |     ^~~~~~
main.c: In function 'm_sort':
main.c:13:9: error: implicit declaration of function 'merge' [-Wimplicit-function-declaration]
   13 |         merge(num,temp,left,center+1,right);
      |         ^~~~~
main.c: At top level:
main.c:16:6: warning: conflicting types for 'merge'; have 'void(int *, int *, int,  int,  int)'
   16 | void merge(int num[], int temp[], int left, int center, int right){
      |      ^~~~~
main.c:13:9: note: previous implicit declaration of 'merge' with type 'void(int *, int *, int,  int,  int)'
   13 |         merge(num,temp,left,center+1,right);
      |         ^~~~~
main.c: In function 'merge':
main.c:26:14: error: expected expression before '[' token
   26 |         temp=[tmp_pos]=num[left];
      |              ^
Language: C

void mergSort(int num[], int temp[], int array)
{
    m_sort(num,temp,0,array - 1);
}
void m_sort(int num[], int temp, int left, int right)
{
    int center;
    if(right>left)
    {
        center=(right+left)/2;
        m_sort(num,temp,left,center);
        m_sort(num,temp,center+1,right);
        merge(num,temp,left,center+1,right);
    }
}
void merge(int num[], int temp[], int left, int center, int right){
    int i,left_end,num_elements,tmp_pos;
    left_end=center-1;
    tmp_pos=left;
    num_elements=right-left+1;

    while((left<=left_end)&&(center<=right))
    {
        if(num[left]<=num[center])
        {
        temp[tmp_pos]=num[left];
        tmp_pos=tmp_pos+1;
        left=left+1;
        }
    
    else
    {
        temp[tmp_pos]=num[center];
        tmp_pos=tmp_pos+1;
        center=center+1;
    }
}
while(left<=left_end)
{
    temp[tmp_pos]=num[left];
    left=left+1;
    tmp_pos=tmp_pos+1;
}
while(center<=right)
{
    temp[tmp_pos]=num[center];
    center=center+1;
    tmp_pos=tmp_pos+1;
}
for(i=0;i<=num_elements;i++){
    num[right]=temp[right];
    right=right-1;
}
}


Compiler output:
main.c: In function 'mergSort':
main.c:3:5: error: implicit declaration of function 'm_sort' [-Wimplicit-function-declaration]
    3 |     m_sort(num,temp,0,array - 1);
      |     ^~~~~~
main.c: At top level:
main.c:5:6: warning: conflicting types for 'm_sort'; have 'void(int *, int,  int,  int)'
    5 | void m_sort(int num[], int temp, int left, int right)
      |      ^~~~~~
main.c:3:5: note: previous implicit declaration of 'm_sort' with type 'void(int *, int,  int,  int)'
    3 |     m_sort(num,temp,0,array - 1);
      |     ^~~~~~
main.c: In function 'm_sort':
main.c:13:9: error: implicit declaration of function 'merge' [-Wimplicit-function-declaration]
   13 |         merge(num,temp,left,center+1,right);
      |         ^~~~~
main.c: At top level:
main.c:16:6: warning: conflicting types for 'merge'; have 'void(int *, int *, int,  int,  int)'
   16 | void merge(int num[], int temp[], int left, int center, int right){
      |      ^~~~~
main.c:13:9: note: previous implicit declaration of 'merge' with type 'void(int *, int *, int,  int,  int)'
   13 |         merge(num,temp,left,center+1,right);
      |         ^~~~~
Language: C

#include <stdio.h>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;

void(int A[], int n, int left, int mid, int right){
    int n1=mid-left;
    int n2=right-mid;
    for(i=0;i<n1;i++)L[i]=A[left+i];
    for(i=0;i<n2;i++)R[i]=A[mid+i];
    L[n1]=R[n2]=SENTINEL;
    int i=0,j=0;
    for(int k=left; k<right;k++){
        cnt++;
        if(L[i]<=R[j]){
            A[k]=L[i++];
        }
        else {
            A[k]=R[j++];
        }
    }
}

void mergeSort(int A[],int n, int left, int right){
    if(left+1<right){
        int mid=(left+right)/2;
        mergeSort(A,n,left,mid);
        mergeSort(A,n,mid,right);
        merge(A,n,left,mid,right);
    }
}
int main(){
    int A[MAX],n,i;
    cnt=0;
    cin>>n;
    for(i=0;i<n;i++)cin>>A[i];
    mergeSort(A,n,0,n);
    for(i=0;i<n;i++){
        if(i)cout<<" ";
        cout<<A[i];
    }
    cout<<endl;
    cout<<cnt<<endl;
    return 0;
    }


Compiler output:
main.c:2:1: error: unknown type name 'using'
    2 | using namespace std;
      | ^~~~~
main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    2 | using namespace std;
      |                 ^~~
main.c:8:6: error: expected identifier or '(' before 'int'
    8 | void(int A[], int n, int left, int mid, int right){
      |      ^~~
main.c: In function 'mergeSort':
main.c:31:9: error: implicit declaration of function 'merge' [-Wimplicit-function-declaration]
   31 |         merge(A,n,left,mid,right);
      |         ^~~~~
main.c: In function 'main':
main.c:37:5: error: 'cin' undeclared (first use in this function)
   37 |     cin>>n;
      |     ^~~
main.c:37:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:41:14: error: 'cout' undeclared (first use in this function)
   41 |         if(i)cout<<" ";
      |              ^~~~
main.c:44:11: error: 'endl' undeclared (first use in this function)
   44 |     cout<<endl;
      |           ^~~~
Language: C

#include <iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX / 4], R[MAX / 4];
int cnt;

void merge(int a[], int n, int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0, i < n1; i++)
        L[i] = a[left + i];
    for (int i = 0; i < n2; i++)
        R[i] = a[mid + i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++)
    {
        cnt++;
        if (L[i] <= R[j])
        {
            A[k] = L[i++];
        }
        else
        {
            A[k] = R[j++];
        }
    }
}

void mergesort(int a[], int n, int left, int right)
{
    if (left + 1 < right)
    {
        int mid = (left + right) / 2;
        mergesort(a, n, left, mid);
        mergesort(a, n, mid, right);
        merge(a, n, left, mid, right);
    }
}

int main()
{
    int a[MAX], n, i;
    cnt = 0;

    cin >> n;
    for (i = 0; i < n; i++)
        cin >> a[i];

    mergesort(a, n, 0, n);

    for (o = 0; i < n; i++)
    {
        if (i)
            cout << " ";
        cout << a[i];
    }
    cout << endl;

    cout << cnt << endl;
    return 0;
}


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

#include <iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX / 4], R[MAX / 4];
int cnt;

void merge(int a[], int n, int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++)
        L[i] = a[left + i];
    for (int i = 0; i < n2; i++)
        R[i] = a[mid + i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++)
    {
        cnt++;
        if (L[i] <= R[j])
        {
            a[k] = L[i++];
        }
        else
        {
            a[k] = R[j++];
        }
    }
}

void mergesort(int a[], int n, int left, int right)
{
    if (left + 1 < right)
    {
        int mid = (left + right) / 2;
        mergesort(a, n, left, mid);
        mergesort(a, n, mid, right);
        merge(a, n, left, mid, right);
    }
}

int main()
{
    int a[MAX], n, i;
    cnt = 0;

    cin >> n;
    for (i = 0; i < n; i++)
        cin >> a[i];

    mergesort(a, n, 0, n);

    for (i = 0; i < n; i++)
    {
        if (i)
            cout << " ";
        cout << a[i];
    }
    cout << endl;

    cout << cnt << endl;
    return 0;
}


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

include<stdio.h>
#define MAX 500000
#define INFTY 1000000000
int L[MAX], R[MAX];
int count;
void merge(int*, int, int, int);
void mergeSort(int*, int, int);
int main(){
  int i;
  int A[MAX], n;
  count = 0;
  scanf("%d", &n);
  for (i=0; i<n; i++){
    scanf("%d", &A[i]);
    if (A[i] >= INFTY ){
      return 1;
    }
  }

  mergeSort(A, 0, n);

  for (i=0; i<n; i++){
    if ( i ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", count);
  return 0;
}

void merge(int A[], int left, int mid, int right){
  int i,j,k,n1,n2;
  n1 = mid - left;
  n2 = right - mid;
  for(i=0; i<n1; i++){
    L[i] = A[left + i];
  }
  for (i=0; i<n2; i++){
    R[i] = A[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;

  for (k=left; k<=right-1; k++){
    count++;
    if ( L[i] <= R[j] ){
      A[k] = L[i];
      i = i + 1;
    }
    else {
      A[k] = R[j];
      j=j+1;
    }
  }
}

void mergeSort(int A[], int left, int right ){
  int m;
  if (left+1 < right){
    m = (left + right)/2;
    mergeSort(A, left, m);
    mergeSort(A, m, right);
    merge(A, left, m, right);
  }
}




Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'main':
main.c:12:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |   scanf("%d", &n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:12:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |   scanf("%d", &n);
      |   ^~~~~
main.c:12:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:23:14: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   23 |     if ( i ) printf(" ");
      |              ^~~~~~
main.c:23:14: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:14: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:23:14: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   24 |     printf("%d", A[i]);
      |     ^~~~~~
main.c:24:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:26:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   26 |   printf("\n");
      |   ^~~~~~
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'merge':
main.c:36:5: error: 'L' undeclared (first use in this function)
   36 |     L[i] = A[left + i];
      |     ^
main.c:36:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:39:5: error: 'R' undeclared (first use in this function)
   39 |     R[i] = A[mid + i];
      |     ^
Language: C

include<stdio.h>
#define MAX 500000
#define INFTY 1000000000
int L[MAX], R[MAX];
int count;
void merge(int*, int, int, int);
void mergeSort(int*, int, int);
int main(){
  int i;
  int A[MAX], n;
  count = 0;
  scanf("%d", &n);
  for (i=0; i<n; i++){
    scanf("%d", &A[i]);
    if (A[i] >= INFTY ){
      return 1;
    }
  }

  mergeSort(A, 0, n);

  for (i=0; i<n; i++){
    if ( i ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", count);
  return 0;
}

void merge(int A[], int left, int m, int right){
  int i,j,k,n1,n2;
  n1 = m - left;
  n2 = right - m;
  for(i=0; i<n1; i++){
    L[i] = A[left + i];
  }
  for (i=0; i<n2; i++){
    R[i] = A[m + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;

  for (k=left; k<=right-1; k++){
    count++;
    if ( L[i] <= R[j] ){
      A[k] = L[i];
      i = i + 1;
    }
    else {
      A[k] = R[j];
      j=j+1;
    }
  }
}

void mergeSort(int A[], int left, int right ){
  int m;
  if (left+1 < right){
    m = (left + right)/2;
    mergeSort(A, left, m);
    mergeSort(A, m, right);
    merge(A, left, m, right);
  }
}




Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'main':
main.c:12:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |   scanf("%d", &n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:12:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |   scanf("%d", &n);
      |   ^~~~~
main.c:12:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:23:14: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   23 |     if ( i ) printf(" ");
      |              ^~~~~~
main.c:23:14: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:14: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:23:14: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   24 |     printf("%d", A[i]);
      |     ^~~~~~
main.c:24:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:26:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   26 |   printf("\n");
      |   ^~~~~~
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'merge':
main.c:36:5: error: 'L' undeclared (first use in this function)
   36 |     L[i] = A[left + i];
      |     ^
main.c:36:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:39:5: error: 'R' undeclared (first use in this function)
   39 |     R[i] = A[m + i];
      |     ^
Language: C

#include <stdio.h>
#define MAX 500000
#define SENTINEL 200000000
// sentinel 10^2 分少ない

int L[MAX/2+2],R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left,int mid,int right){
  int i,j,k;
  int n1 = mid - left;
  int n2 = right - mid;
  for(i=0;i<n1; i++) L[i] = A[left + i];
  for(i=0;i<n2; i++) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;

  i=0,j=0;
  for(k = left;k < right; k++){
    cnt++;
    if(L[i] <= R[j]){
      A[k] = L[i++];
    }
    else{
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[],int n,int left,int right){
   if( left+1 < right){
       int mid = ( left + right) /2;
       mergeSort(A,n,left,mid);
       mergeSort(A,n,mid,right);
       merge(A,n,left,mid,right);
       }
      }
        
int main(){
     int A[MAX], n,i;
     cnt =0;
     
     scanf("%d",&n);
     for(i=0;i<n;i++)scanf("%d",&A[i]);
 
     mergeSort(A,n,0,n);
     for(i=0;i<n;i++){

   　if(i)printf(" ");
     printf("%d",A[i]);
    
     }

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



Compiler output:
main.c: In function 'main':
main.c:48:4: error: stray '\343' in program
   48 |    <U+3000>if(i)printf(" ");
      |    ^~~~~~~~
Language: C

include<stdio.h>
#define M 500000

void merge(int*,int,int,int);
void MergeSort(int*,int,int);

int count=0;
int main(){
  int n,i,A[M];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  MergeSort(A,0,n);
  for(i=0;i<n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[i]);

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

void merge(int *A,int left,int mid,int right){
  int i,j,k,n1,n2,L[M],R[M];
  n1=mid-left;
  n2=right-mid;
    for(i=0;i<n1;i++){
      L[i]=A[left+i];
    }
    for(i=0;i<n2;i++){
      R[i]=A[mid+i];
    }
    L[n1]=999999999;
    R[n2]=999999999;
    i=0;
    j=0;
    for(k=left;k<right;k++){
      if(L[i]<=R[j]){
        A[k]=L[i];
        i++;
      }
      else{
        A[k]=R[j];
        j++;
      }
      count++;
    }
}

void MergeSort(int *A,int left,int right){
  int mid;
  if((left+1)<right){
    mid=(left+right)/2;
    MergeSort(A,left,mid);
    MergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}





Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'main':
main.c:10:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   10 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:10:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   10 |   scanf("%d",&n);
      |   ^~~~~
main.c:10:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:16:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   16 |     printf("%d ",A[i]);
      |     ^~~~~~
main.c:16:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:16:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:16:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   18 |   printf("%d\n",A[i]);
      |   ^~~~~~
main.c:18:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

include<stdio.h>
#define M 500000

void merge(int*,int,int,int);
void MergeSort(int*,int,int);

int count=0;
int main(){
  int n,i,A[M];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  MergeSort(A,0,n);
  for(i=0;i<n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[i]);

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

void merge(int *A,int left,int mid,int right){
  int i,j,k,n1,n2,L[M],R[M];
  n1=mid-left;
  n2=right-mid;
    for(i=0;i<n1;i++){
      L[i]=A[left+i];
    }
    for(i=0;i<n2;i++){
      R[i]=A[mid+i];
    }
    L[n1]=999999999;
    R[n2]=999999999;
    i=0;
    j=0;
    for(k=left;k<right;k++){
      if(L[i]<=R[j]){
        A[k]=L[i];
        i++;
      }
      else{
        A[k]=R[j];
        j++;
      }
      count++;
    }
}


void MergeSort(int *A,int left,int right){
  int mid;
  if((left+1)<right){
    mid=(left+right)/2;
    MergeSort(A,left,mid);
    MergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}





Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'main':
main.c:10:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   10 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:10:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   10 |   scanf("%d",&n);
      |   ^~~~~
main.c:10:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:16:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   16 |     printf("%d ",A[i]);
      |     ^~~~~~
main.c:16:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:16:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:16:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   18 |   printf("%d\n",A[i]);
      |   ^~~~~~
main.c:18:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

    #include <stdio.h>
    #define MAX 500000
    #define INFTY 1000000
    int A[MAX],L[MAX],R[MAX];
    int c=0;
    void Merge(int *,int,int,int);
    
    void MergeSort(int *,int,int,int);
    
    int main(){
    
      int i,n;
      scanf("%d",&n);
      for(i=0;i<n;i++){
        scanf("%d",&A[i]);
      }
    
      MergeSort(A,0,n);
    
      for(i=0;i<n;i++){
        printf("%d",A[i]);
        if(i<n-1){
          printf("%d\n",c);
    
      return 0;
    
    }
    
    void Merge(int A[], int left, int mid, int right){
    
      int n1,n2,i,j,k;
    
    n1 = mid - left;
    
    n2 = right - mid;
    
    for(i=0;i<=n1;i++){
      L[i]=A[left+i];
     }
    
    
    /*for i = 0 to n1-1
      L[i] = A[left + i]*/
    
    for(i=0;i<=n2;i++){
      R[i]=A[mid+i];
     }
      L[n1]=INFTY;
      R[n2]=INFTY;
       i=0;
      j=0;
    
    
    /*for i = 0 to n2-1
        R[i] = A[mid + i]
      L[n1] = INFTY //番兵
      R[n2] = INFTY //番兵
      i = 0
      j = 0*/
    
    for(k=left;k<right;k++){
      c++;
      if(L[i]<=R[j]){
        A[k]=L[i];
        i=i+1;
      }
      else{
                A[k]=R[j];
            j=j+1;
         }
        }
        }
      /*or k = left to right-1
        if L[i] <= R[j]
          A[k] = L[i]
          i = i + 1
        else
          A[k] = R[j]
          j = j + 1
      */
    
    void MergeSort(int A[],int left,int right){
      int mid;
      if(left+1<right){
        mid = (left + right)/2;
           MergeSort(A,left,mid);
        MergeSort(A,mid,right);
        Merge(A,left, mid, right);
          }
    }


Compiler output:
main.c: In function 'main':
main.c:18:7: error: too few arguments to function 'MergeSort'
   18 |       MergeSort(A,0,n);
      |       ^~~~~~~~~
main.c:8:10: note: declared here
    8 |     void MergeSort(int *,int,int,int);
      |          ^~~~~~~~~
main.c:90:5: error: expected declaration or statement at end of input
   90 |     }
      |     ^
main.c:90:5: error: expected declaration or statement at end of input
Language: C

    #include <stdio.h>
    #define MAX 500001
    #define INFTY 1000000
    int A[MAX],L[MAX],R[MAX];
    int c=0;

    int main(){
    
      int i,n;
      scanf("%d",&n);
      for(i=0;i<n;i++){
        scanf("%d",&A[i]);
      }
    
      MergeSort(A,0,n);
    
      for(i=0;i<n;i++){
        printf("%d",A[i]);
        if(i<n-1){
            printf("\n")
          printf("%d\n",c);
        }
      return 0;
    
    }
    
    void Merge(int A[], int left, int mid, int right){
    
      int n1,n2,i,j,k;
    
    n1 = mid - left;
    
    n2 = right - mid;
    
    for(i=0;i<=n1;i++){
      L[i]=A[left+i];
     }
    
    
    /*for i = 0 to n1-1
      L[i] = A[left + i]*/
    
    for(i=0;i<=n2;i++){
      R[i]=A[mid+i];
     }
      L[n1]=INFTY;
      R[n2]=INFTY;
       i=0;
      j=0;
    
    
    /*for i = 0 to n2-1
        R[i] = A[mid + i]
      L[n1] = INFTY //番兵
      R[n2] = INFTY //番兵
      i = 0
      j = 0*/
    
    for(k=left;k<right;k++){
      c++;
      if(L[i]<=R[j]){
        A[k]=L[i];
        i=i+1;
      }
      else{
                A[k]=R[j];
            j=j+1;
         }
        }
        }
      /*or k = left to right-1
        if L[i] <= R[j]
          A[k] = L[i]
          i = i + 1
        else
          A[k] = R[j]
          j = j + 1
      */
    
    void MergeSort(int A[],int left,int right){
      int mid;
      if(left+1<right){
        mid = (left + right)/2;
           MergeSort(A,left,mid);
        MergeSort(A,mid,right);
        Merge(A,left, mid, right);
          }
    }


Compiler output:
main.c: In function 'main':
main.c:15:7: error: implicit declaration of function 'MergeSort' [-Wimplicit-function-declaration]
   15 |       MergeSort(A,0,n);
      |       ^~~~~~~~~
main.c:20:25: error: expected ';' before 'printf'
   20 |             printf("\n")
      |                         ^
      |                         ;
   21 |           printf("%d\n",c);
      |           ~~~~~~         
main.c:80:10: warning: conflicting types for 'MergeSort'; have 'void(int *, int,  int)'
   80 |     void MergeSort(int A[],int left,int right){
      |          ^~~~~~~~~
main.c:80:10: error: static declaration of 'MergeSort' follows non-static declaration
main.c:15:7: note: previous implicit declaration of 'MergeSort' with type 'void(int *, int,  int)'
   15 |       MergeSort(A,0,n);
      |       ^~~~~~~~~
main.c:88:5: error: expected declaration or statement at end of input
   88 |     }
      |     ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#define MAX 500000
#define INF 1000000000

void merge(int*A,int left,int mid,int right)
{
  int i,k,n1=0,n2=0;
  int *L,*R;

  n1=mid-left;
  n2=right-mid;

  L=(int *)malloc(sizeof(int)*(n1+1));
  R=(int *)malloc(sizeof(int)*(n2+1));

  for(i=0;i<=n1-1;i++)
    {
      L[i]=A[left+i];
    }
  for(j=0;j<=n2-1;j++)
    {
      R[j]=A[mid+j];
    }

  L[n1]=INF;
  R[n2]=INF;
  i=0;
  j=0;

  for(k=left;k<=right-1;k++)
    {
      if(L[i]<=R[j])
	{
	  A[k]=L[i];
	  i++;
	  count++;
	}
      else
	{
	  A[k]=R[j];
	  j++;
	  count++;
	}}
  free(L);
  free(R);
}

void  tmarge(int A[],int left,int right)
{
  init mid;
  if(left+1<right)
    {
      mid =(left+right)/2;
      tmaege(A,left,mid



Compiler output:
main.c: In function 'merge':
main.c:21:7: error: 'j' undeclared (first use in this function)
   21 |   for(j=0;j<=n2-1;j++)
      |       ^
main.c:21:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:37:11: error: 'count' undeclared (first use in this function)
   37 |           count++;
      |           ^~~~~
main.c: In function 'tmarge':
main.c:51:3: error: unknown type name 'init'; did you mean 'int'?
   51 |   init mid;
      |   ^~~~
      |   int
main.c:55:7: error: implicit declaration of function 'tmaege'; did you mean 'tmarge'? [-Wimplicit-function-declaration]
   55 |       tmaege(A,left,mid
      |       ^~~~~~
      |       tmarge
main.c:55:24: error: expected ')' at end of input
   55 |       tmaege(A,left,mid
      |             ~          ^
      |                        )
   56 | 
main.c:55:7: error: expected declaration or statement at end of input
   55 |       tmaege(A,left,mid
      |       ^~~~~~
main.c:55:7: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>
#include<limits.h>
int A[500005],N,c=0,i,tmp[2][250005];
void marge(int l,int m,int r)
{
	int i,j,c1=m-l,c2=r-m;
	for(i=0;i<c1;i++)tmp[0][i]=A[l+i];
	for(i=0;i<c2;i++)tmp[1][i]=A[m+i];
	tmp[0][c1]=tmp[1][c2]=INT_MAX;
	for(i=j=0;i<c1||j<c2;c++)
	{
		if(tmp[0][i]<tmp[1][j])
		{
			A[l+i+j]=tmp[0][i];
			i++;
		}
		else
		{
			A[l+i+j]=tmp[1][j];
			j++;
		}
	}
}

void margeSort(int l,int r)
{
	int m;
	if(l+1<r)
	{
		m=(l+r)/2;
		margeSort(l,m);
		margeSort(m,r);
		marge(l,m,r);
	}
}
void margeSort(int l,int r)
{
	int m;
	if(l+1<r)
	{
		m=(l+r)/2;
		margeSort(l,m);
		margeSort(m,r);
		marge(l,m,r);
	}
}



Compiler output:
main.c:36:6: error: redefinition of 'margeSort'
   36 | void margeSort(int l,int r)
      |      ^~~~~~~~~
main.c:25:6: note: previous definition of 'margeSort' with type 'void(int,  int)'
   25 | void margeSort(int l,int r)
      |      ^~~~~~~~~
Language: C

   #include <stdio.h>
    #define MAX 500001
    #define INFTY 100000000
    int A[MAX],L[MAX],R[MAX];
    int count=0;

    void merge(int A[], int left, int mid, int right){
    
      int n1,n2,i,j,k;
    
    n1 = mid - left;
    
    n2 = right - mid;
    
    for(i=0;i<n1;i++){
      L[i]=A[left+i];
     }
    for(i=0;i<n2;i++){
      R[i]=A[mid+i];
     }

      L[n1]=INFTY;
      R[n2]=INFTY;
       i=0;
      j=0;

    for(k=left;k<right;k++){
      count++;
      if(L[i]<=R[j]){
        A[k]=L[i];
        i=i++;
      }
      else{
                A[k]=R[j];
            j++;
         }
        }
        }
    
    void mergesort(int A[],int left,int right){
      int mid;
      if(left+1<right){
        mid = (left + right)/2;
           mergesort(A,left,mid);
        mergesort(A,mid,right);
        merge(A,left, mid, right);
          }
    }

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

    }



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

#include<stdio.h>
#include<stdlib.h>
#define MAX 500000
#define INF 1000000000


int count;
int L[MAX/2+2],R[MAX/2+2];
void  tmarge(int A[],int left,int right)
{
  int mid;
  if(left+1<right)
    {
      mid =(left+right)/2;
      tmaege(A,left,mid);
      tmarge(A,mid,right);
      merge(A,left,mid,right);
    }
}
void merge(int*A,int left,int mid,int right)
{
  int i,k,n1=0,n2=0;
  int *L,*R;

  n1=mid-left;
  n2=right-mid;

  L=(int *)malloc(sizeof(int)*(n1+1));
  R=(int *)malloc(sizeof(int)*(n2+1));

  for(i=0;i<=n1-1;i++)
    {
      L[i]=A[left+i];
    }
  for(j=0;j<=n2-1;j++)
    {
      R[j]=A[mid+j];
    }

  L[n1]=INF;
  R[n2]=INF;
  i=0;
  j=0;

  for(k=left;k<=right-1;k++)
    {
      if(L[i]<=R[j])
	{
	  A[k]=L[i];
	  i++;
	  count++;
	}
      else
	{
	  A[k]=R[j];
	  j++;
	  count++;
	}}
  free(L);
  free(R);
}

int main()
{
  int n,i;
  int A[MAX];

  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
  tmarge(A,0,n);
  for(i=0;i<n;i++)
    {
      if(i>0) printf(" ");
      printf("%d",A[i]);
    }
  printf("\n");
  printf("%d\n",count);
  return 0;
}



Compiler output:
main.c: In function 'tmarge':
main.c:15:7: error: implicit declaration of function 'tmaege'; did you mean 'tmarge'? [-Wimplicit-function-declaration]
   15 |       tmaege(A,left,mid);
      |       ^~~~~~
      |       tmarge
main.c:17:7: error: implicit declaration of function 'merge'; did you mean 'tmarge'? [-Wimplicit-function-declaration]
   17 |       merge(A,left,mid,right);
      |       ^~~~~
      |       tmarge
main.c: At top level:
main.c:20:6: warning: conflicting types for 'merge'; have 'void(int *, int,  int,  int)'
   20 | void merge(int*A,int left,int mid,int right)
      |      ^~~~~
main.c:17:7: note: previous implicit declaration of 'merge' with type 'void(int *, int,  int,  int)'
   17 |       merge(A,left,mid,right);
      |       ^~~~~
main.c: In function 'merge':
main.c:35:7: error: 'j' undeclared (first use in this function)
   35 |   for(j=0;j<=n2-1;j++)
      |       ^
main.c:35:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define MAX 500001
#define INFTY 1000000000
int A[MAX],L[MAX],R[MAX]
int c=0;

void Merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++){
L[i]=A[left+i];
}

for(i=0;i<n2;i++){
R[i]=A[mid+i];
  }

  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;

  for(k=left;k<right;k++){
    c++;
    if(l[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
    }
    else {
      A[k]=R[j];
      j=j+1;
    }
  }
}

void MergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(A,left,mid);
    MergeSort(A,mid,right);
    Merge(A,left,mid,right);
  }
}

int main(){
  int n,i;

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


  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1){
printf(" ");
}
  }
printf("\n");
  printf("%d\n",count);
  
  return 0;



Compiler output:
main.c:5:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    5 | int c=0;
      | ^~~
main.c: In function 'Merge':
main.c:16:1: error: 'R' undeclared (first use in this function)
   16 | R[i]=A[mid+i];
      | ^
main.c:16:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:5: error: 'c' undeclared (first use in this function)
   25 |     c++;
      |     ^
main.c:26:8: error: 'l' undeclared (first use in this function)
   26 |     if(l[i]<=R[j]){
      |        ^
main.c: In function 'main':
main.c:64:17: error: 'count' undeclared (first use in this function)
   64 |   printf("%d\n",count);
      |                 ^~~~~
main.c:66:3: error: expected declaration or statement at end of input
   66 |   return 0;
      |   ^~~~~~
Language: C

#include <stdio.h>
#define MAX 500001
#define INFTY 1000000000
int A[MAX],L[MAX],R[MAX]
int c=0;

void Merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++){
L[i]=A[left+i];
}

for(i=0;i<n2;i++){
R[i]=A[mid+i];
  }

  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;

  for(k=left;k<right;k++){
    c++;
    if(l[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
    }
    else {
      A[k]=R[j];
      j=j+1;
    }
  }
}

void MergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(A,left,mid);
    MergeSort(A,mid,right);
    Merge(A,left,mid,right);
  }
}

int main(){
  int n,i;

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


  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1){
printf(" ");
}
  }
printf("\n");
  printf("%d\n",count);
  
  return 0;



Compiler output:
main.c:5:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    5 | int c=0;
      | ^~~
main.c: In function 'Merge':
main.c:16:1: error: 'R' undeclared (first use in this function)
   16 | R[i]=A[mid+i];
      | ^
main.c:16:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:5: error: 'c' undeclared (first use in this function)
   25 |     c++;
      |     ^
main.c:26:8: error: 'l' undeclared (first use in this function)
   26 |     if(l[i]<=R[j]){
      |        ^
main.c: In function 'main':
main.c:54:19: error: expected expression before ')' token
   54 |   MergeSort(A,0,n,);
      |                   ^
main.c:54:3: error: too many arguments to function 'MergeSort'
   54 |   MergeSort(A,0,n,);
      |   ^~~~~~~~~
main.c:37:6: note: declared here
   37 | void MergeSort(int A[],int left,int right){
      |      ^~~~~~~~~
main.c:64:17: error: 'count' undeclared (first use in this function)
   64 |   printf("%d\n",count);
      |                 ^~~~~
main.c:66:3: error: expected declaration or statement at end of input
   66 |   return 0;
      |   ^~~~~~
Language: C

#include <stdio.h>
#define MAX 500001
#define INFTY 1000000000
int A[MAX],L[MAX],R[MAX]
int c=0;

void Merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++){
L[i]=A[left+i];
}

for(i=0;i<n2;i++){
R[i]=A[mid+i];
  }

  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;

  for(k=left;k<right;k++){
    c++;
    if(L[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
    }
    else {
      A[k]=R[j];
      j=j+1;
    }
  }
}

void MergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(A,left,mid);
    MergeSort(A,mid,right);
    Merge(A,left,mid,right);
  }
}

int main(){
  int n,i;

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


  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1){
printf(" ");
}
  }
printf("\n");
  printf("%d\n",c);
  
  return 0;



Compiler output:
main.c:5:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    5 | int c=0;
      | ^~~
main.c: In function 'Merge':
main.c:16:1: error: 'R' undeclared (first use in this function)
   16 | R[i]=A[mid+i];
      | ^
main.c:16:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:5: error: 'c' undeclared (first use in this function)
   25 |     c++;
      |     ^
main.c: In function 'main':
main.c:64:17: error: 'c' undeclared (first use in this function)
   64 |   printf("%d\n",c);
      |                 ^
main.c:66:3: error: expected declaration or statement at end of input
   66 |   return 0;
      |   ^~~~~~
Language: C

#include <stdio.h>
#define MAX 500001
#define INFTY 1000000000
int A[MAX],L[MAX],R[MAX],c=0;

void Merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++){
L[i]=A[left+i];
}

for(i=0;i<n2;i++){
R[i]=A[mid+i];
  }

  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;

  for(k=left;k<right;k++){
    c++;
    if(L[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
    }
    else {
      A[k]=R[j];
      j=j+1;
    }
  }
}

void MergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(A,left,mid);
    MergeSort(A,mid,right);
    Merge(A,left,mid,right);
  }
}

int main(){
  int i,n;

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


  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1){
printf(" ");
}
  }
printf("\n");
  printf("%d\n",c);
  
  return 0;



Compiler output:
main.c: In function 'main':
main.c:65:3: error: expected declaration or statement at end of input
   65 |   return 0;
      |   ^~~~~~
Language: C

#include <stdio.h>
#define INFTY 100000000;

int ct = 0;
void merge(int A[], int left, int mid, int right){
  int i,j,k,L[250000],R[250000];
  int n1 = mid - left;
  int n2 = right - mid;
  //L[0...n1], R[0...n2] を生成
  for (i = 0; i < n1; i++) L[i] = A[left + i];
  for (i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for (k = left; k < right ; k++){
    ct++;
    if (L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    }
    else{
      A[k] = R[j];
      j = j + 1;
    }
  }
}
void mergeSort(int A[], int left,int right){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}
int main(){
  int A[500000],i,a;
  scanf("%d",&a);
  for(i=0; i<a; i++) scanf("%d",&A[i]);
  margeSort(A, 0, a);
  for(i=0; i<a-1; i++) printf("%d ",A[i]);
  printf("%d\n%d\n",A[i],ct);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:41:3: error: implicit declaration of function 'margeSort'; did you mean 'mergeSort'? [-Wimplicit-function-declaration]
   41 |   margeSort(A, 0, a);
      |   ^~~~~~~~~
      |   mergeSort
Language: C

#include <stdio.h>
#include <stdlib.h>
#define INFTY 100000000;

int ct;
int L[250000],R[250000];
void merge(int A[], int left, int mid, int right){
  int i,j,k;
  int n1 = mid - left;
  int n2 = right - mid;
  //L[0...n1], R[0...n2] を生成
  for (i = 0; i < n1; i++) L[i] = A[left + i];
  for (i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for (k = left; k < right ; k++){
    ct++;
    if (L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    }
    else{
      A[k] = R[j];
      j = j + 1;
    }
  }
}
void mergeSort(int A[], int left,int right){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
  else exit(1);
}
int main(){
  int A[500000],i,a;
  ct = 0;
  scanf("%d",&a);
  for(i=0; i<a; i++) scanf("%d",&A[i]);
  margeSort(A, 0, a);
  for(i=0; i<a-1; i++) printf("%d ",A[i]);
  printf("%d\n%d\n",A[i],ct);
}


Compiler output:
main.c: In function 'main':
main.c:45:3: error: implicit declaration of function 'margeSort'; did you mean 'mergeSort'? [-Wimplicit-function-declaration]
   45 |   margeSort(A, 0, a);
      |   ^~~~~~~~~
      |   mergeSort