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

#include<stdio.h>
#define INFTY 9999999
#define N 500000

void merge(int[],int,int,int);
void mergeSort(int[],int,int);

int count = 0;

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

  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[n - 1]);
  printf("%d\n",count);
  
  return 0;
}
 void merge(int A[],int left,int mid,int right)
 {
   int n1 = mid - left;
   int n2 = right - mid;
   int L[N],R[N]; 
   
   int i;
	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;
	int j = 0;
	
	for(int k = left; k < right; k++)
	  if (L[i] <= R[j])
	    {
	      A[k] = L[i];
	      i++;
	      count++;
	    }
	
	  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.java:1: error: illegal character: '#'
#include<stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<stdio.h>
        ^
Main.java:2: error: illegal character: '#'
#define INFTY 9999999
^
Main.java:3: error: illegal character: '#'
#define N 500000
^
Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
void mergeSort(int[],int,int);
^
  (use --enable-preview to enable unnamed classes)
Main.java:6: error: <identifier> expected
void mergeSort(int[],int,int);
                    ^
Main.java:6: error: <identifier> expected
void mergeSort(int[],int,int);
                        ^
Main.java:6: error: <identifier> expected
void mergeSort(int[],int,int);
                            ^
Main.java:12: error: not a statement
  int i,n,A[N];
            ^
Main.java:12: error: ';' expected
  int i,n,A[N];
             ^
Main.java:14: error: illegal start of expression
  scanf("%d",&n);
             ^
Main.java:17: error: illegal start of expression
    scanf("%d",&A[i]);
               ^
Main.java:33: error: not a statement
   int L[N],R[N]; 
         ^
Main.java:33: error: not a statement
   int L[N],R[N]; 
             ^
Main.java:33: error: ';' expected
   int L[N],R[N]; 
          ^
15 errors
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{

    public static int MAX = 500000;
    public static int SENTINEL = 2000000000;
    public static int[] L = new int[MAX / 2 + 2];
    public static int[] R = new int[MAX / 2 + 2];
    public static int cnt;

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] A = new int[MAX];
        cnt = 0;
        String[] in = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            A[i] = Integer.parseInt(in[i]);
        }

        mergeSort(A, n, 0, n);

        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++){
            if(i != 0) sb.append(" ");
            sb.append(A[i]);
        }
        sb.append("\n").append(cnt);
        System.out.println(sb);
    }

    public static 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);
        }
    }
    public static 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);
        }
    }

    public static void merge(int[] A, int n, int left, int mid, int right){
        int n1 = mid - left;
        int n2 = right - mid;
        //System.out.println("yes");                                                  
        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++];
            }
        }
    }

}

Compiler output:
Main.java:42: error: method mergeSort(int[],int,int,int) is already defined in class Main
    public static void mergeSort(int[] A, int n, int left, int right){
                       ^
1 error
Language: Java




import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author baito
 */
public class JavaApplication6 {

    /**
     * @param args the command line arguments
     * @throws java.io.FileNotFoundException
     */
    static int count = 0;
    public static void main(String[] args) throws Exception {
        // TODO code application logic here

        ContestScanner sc = new ContestScanner();
        int n = sc.nextInt();
        int A[] = new int[n];
        for (int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        mergeSort(A, 0, n);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            sb.append(A[i]).append(' ');
        }
        System.out.println(sb);
        System.out.println(count);
       
    }
    //??????not include
    public static void mergeSort (int[] A , int l , int r ) {
        if(l + 1 < r){
            int mid = (l + r)/2;
            mergeSort(A, l, mid);
            mergeSort(A, mid,r);
            merge(A,l,mid,r);
            
        }
        
    }
    public static void merge (int[] A , int l , int m , int r) {
        int n1  = m - l + 1;
        int n2 =  r - m + 1;
        int L[] = new int[n1];
        int R[] = new int[n2];
        System.arraycopy(A, l, L, 0, n1-1);
        L[n1-1] = Integer.MAX_VALUE;
        System.arraycopy(A, m, R, 0, n2-1);
        R[n2-1] = Integer.MAX_VALUE;
        for (int i = l, j= 0 , k= 0; i < r; i++) {
            count++;
            if(L[j] >= R[k]){
                A[i] = R[k++];
            } else {
                A[i] = L[j++];
            }
            
            
        }
        
        
    }
    
    
    
}

//????????????????????????
class ContestScanner {
    
    private final BufferedReader reader;
    private String[] line;
    private int idx;
    
    public ContestScanner() throws FileNotFoundException {
        reader = new BufferedReader(new InputStreamReader(System.in));
    }
    
    public ContestScanner(String filename) throws FileNotFoundException {
        reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
    }
    //???????????? 

    public String readLine() throws Exception {
        return reader.readLine();
    }
    
    public String nextToken() throws IOException {
        if (line == null || line.length <= idx) {
            line = reader.readLine().trim().split(" ");
            idx = 0;
        }
        return line[idx++];
    }
    
    public long nextLong() throws IOException, NumberFormatException {
        return Long.parseLong(nextToken());
    }
    
    public int nextInt() throws NumberFormatException, IOException {
        return (int) nextLong();
    }
    
    public double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextToken());
    }
}

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

public class Main {

	static int count = 0;
	
	public static void main(String[] args) throws NumberFormatException, IOException{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n];
		
		String[] str = br.readLine().split(" ");
		for(int i = 0; i < n; i++) S[i] = Integer.parseInt(str[i]);
		
		mergeSort(S, 0, n);
		
		for(int i = 0; i < n; i++){
			System.out.print(S[i]);
			if(i + 1 == n) System.out.print("\n");
			else System.out.print(" ");
		}
		System.out.println(count);
	}
	
	public static void merge(int[] A, int left, int mid, int right){
		int n1 = mid - left, n2 = right - mid;
		int[] L = new int[n1 + 1], R = new int[n2 + 1];
		
		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] = Integer.MAX_VALUE;
		
		for(int i = 0, j = 0, k = left; k < right; k++){
			count++;
			if(L[i] <= R[j]) A[k] = L[i++];
			else A[k] = R[j++];
		}
	}
	
	public static 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, right);
		}
	}
}


Compiler output:
Main.java:5: error: cannot find symbol
	public static void main(String[] args) throws NumberFormatException, IOException{
	                                                                     ^
  symbol:   class IOException
  location: class Main
Main.java:7: error: cannot find symbol
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		^
  symbol:   class BufferedReader
  location: class Main
Main.java:7: error: cannot find symbol
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		                        ^
  symbol:   class BufferedReader
  location: class Main
Main.java:7: error: cannot find symbol
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		                                           ^
  symbol:   class InputStreamReader
  location: class Main
4 errors
Language: Java

import java.util.*;

public class Main {
	int count = 0;
	public static void main(String[] args) {
		new mergeSort().runSort();
	}
	
	public void runSort() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] l = new int[n];
		for (int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
		}
		sorting(l, 0, n);
		System.out.print(l[0]);
		for (int i = 1; i < n; i++) {
			System.out.print(" " +l[i]);
		}
		System.out.println();
		System.out.println(count);
	}

	public void sorting(int[] l, int nl, int nr) {
		if (nl + 1 < nr) {
			int nm = (nl + nr) / 2;
			sorting(l, nl, nm);
			sorting(l, nm, nr);
			merging(l, nl, nm, nr);
		}
	}

	public void merging(int[] list, int nl, int nm, int nr) {
		int n1 = nm - nl;
		int n2 = nr - nm;
		int[] l = new int[n1 + 1];
		int[] r = new int[n2 + 1];
		for (int i = 0; i < n1; i++) {
			l[i] = list[nl + i];
		}
		for (int i = 0; i < n2; i++) {
			r[i] = list[nm + i];
		}
		l[n1] = Integer.MAX_VALUE;
		r[n2] = Integer.MAX_VALUE;

		int LEFT = 0;
		int RIGHT = 0;
		for (int i = nl; i < nr; i++) {
			if (l[LEFT] <= r[RIGHT]) {
				list[i] = l[LEFT++];
			} else {
				list[i] = r[RIGHT++];
			}
			count++;
		}
	}

}


Compiler output:
Main.java:6: error: cannot find symbol
		new mergeSort().runSort();
		    ^
  symbol:   class mergeSort
  location: class Main
1 error
Language: Java

import java.util.*;

public class mergeSort {
	int count = 0;
	public static void main(String[] args) {
		new Main().runSort();
	}
	
	public void runSort() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] l = new int[n];
		for (int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
		}
		sorting(l, 0, n);
		System.out.print(l[0]);
		for (int i = 1; i < n; i++) {
			System.out.print(" " +l[i]);
		}
		System.out.println();
		System.out.println(count);
	}

	public void sorting(int[] l, int nl, int nr) {
		if (nl + 1 < nr) {
			int nm = (nl + nr) / 2;
			sorting(l, nl, nm);
			sorting(l, nm, nr);
			merging(l, nl, nm, nr);
		}
	}

	public void merging(int[] list, int nl, int nm, int nr) {
		int n1 = nm - nl;
		int n2 = nr - nm;
		int[] l = new int[n1 + 1];
		int[] r = new int[n2 + 1];
		for (int i = 0; i < n1; i++) {
			l[i] = list[nl + i];
		}
		for (int i = 0; i < n2; i++) {
			r[i] = list[nm + i];
		}
		l[n1] = Integer.MAX_VALUE;
		r[n2] = Integer.MAX_VALUE;

		int LEFT = 0;
		int RIGHT = 0;
		for (int i = nl; i < nr; i++) {
			if (l[LEFT] <= r[RIGHT]) {
				list[i] = l[LEFT++];
			} else {
				list[i] = r[RIGHT++];
			}
			count++;
		}
	}

}


Compiler output:
Main.java:3: error: class mergeSort is public, should be declared in a file named mergeSort.java
public class mergeSort {
       ^
Main.java:6: error: cannot access Main
		new Main().runSort();
		    ^
  bad source file: ./Main.java
    file does not contain class Main
    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
2 errors
Language: Java

import java.util.*;
public class Merge_sort{
    public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	int count;
	int n=sc.nextInt();
	int[] S=new int[n];
	for(int i=0;i<n;i++){
	    S[i]=sc.nextInt();
	}
	count=mergeSort(S,0,n);
	for(int i=0;i<n-1;i++){
	    System.out.print(S[i]+" ");
	}
	System.out.println(S[n-1]);
	System.out.println(count);
    }
    public static int merge(int[] A,int left,int mid,int right){
	int n1 = mid - left;
	int n2 = right - mid;
	int count=0;
	int[] L=new int[n1+1];
	int[] R=new int[n2+1];
	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]=Integer.MAX_VALUE;
	R[n2]=Integer.MAX_VALUE;
	int i=0;
	int j=0;
	for(int k=left;k<right;k++){
	    if(L[i]<=R[j]){
		A[k] = L[i];
		i+=1;
		count++;
	    }else{
		A[k]=R[j];
		j+=1;
		count++;
	    }
	}
	return count;
    }
    public static int mergeSort(int[] A,int left,int right){
	int c;
	if(left+1<right){
	    int mid=(left+right)/2;;
	    c=mergeSort(A,left,mid);
	    c+=mergeSort(A,mid,right);
	    c+=merge(A,left,mid,right);
	    return c;
	}else{
	    return 0;
	}
    }
}


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

package Blog;

import static java.lang.System.*;
import java.util.*;

public class Blog {
	static Scanner sc = new Scanner(System.in);
	static List<Integer> list = new ArrayList<>();
	static int num = 0;

	
	public static void main(String[] args) {
		int n = sc.nextInt();
		for (int i=0; i<n; i++) list.add(sc.nextInt());

		mergeSort(list);

		for (int i=0; i<list.size(); i++) out.print((i==0?"":" ")+list.get(i)); out.println();
		out.println(num);
	}

	
	static void mergeSort(List<Integer> list) {
		int size = list.size();

		//listの大きさが1なら再帰終了
		if (size == 1) return;

		//1でないなら分割
		ArrayList<Integer> L = new ArrayList<>(), R = new ArrayList<>();
		int M = size/2;

			//分割処理、左側を作成
			for (int i=0; i<M; i++) L.add(list.get(i));
			//分割処理、右側を作成
			for (int i=M; i<size; i++) R.add(list.get(i));

			
		//再帰
		mergeSort(L); mergeSort(R);

		//マージ処理
		list.clear();
		int indexL = 0, indexR = 0;
		while (indexL<L.size() || indexR<R.size()) {
			if (indexL == L.size()) {
				list.add(R.get(indexR)); indexR++; num++;
			}
			else if (indexR == R.size()) {
				list.add(L.get(indexL)); indexL++; num++;
			}
			else {
				int tempL = L.get(indexL);
				int tempR = R.get(indexR);
				if (tempL <= tempR) {
					list.add(tempL); indexL++;
				}
				else {
					list.add(tempR); indexR++;
				}
				num++;
			}
		}
	}
}


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

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

public class MergeSort {
	/*
	 * マージソート　2014.3.19
	 * [入力]
	 * １行目にn、２行目にSを表すn個の整数が与えられる。 
	 * [出力]
	 * １行目に整列済みの数列Sを出力せよ。数列の隣り合う要素は１つの空白で区切ること。
	 * ２行目に比較回数を出力せよ。 
	 */
	static int counter=1;//the number of comparing
	public static void main(String args[]){
		ArrayList<Integer> input = new ArrayList<Integer>();
		ArrayList<Integer> output = new ArrayList<Integer>();
		int inputNumber=0;//n
		String inputString = null;//S
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			inputNumber = Integer.parseInt(br.readLine());
			inputString = br.readLine();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		input = StringToArrayList(inputString,inputNumber);
		output = Sorting(input,inputNumber);
		String outputString = "";
		for(int i : output){
			outputString += i+ " ";
		}
		System.out.println(outputString);
		System.out.println(counter);
	}
	
	// convert type String to ArrayList
	private static ArrayList<Integer> StringToArrayList(String input, int number){
		ArrayList<Integer> output = new ArrayList<Integer>();
		StringTokenizer st = new StringTokenizer(input," ");// separated by Space
		for(int i=0;i<number;i++){
			output.add(Integer.parseInt(st.nextToken()));
		}
		return output;
	}
	//do sorting
	private static ArrayList<Integer> Sorting(ArrayList<Integer> input, int number){
		int separate1, separate2;
		ArrayList<Integer> tempList1 = new ArrayList<Integer>();
		ArrayList<Integer> tempList2 = new ArrayList<Integer>();
		ArrayList<Integer> newList1 = new ArrayList<Integer>();
		ArrayList<Integer> newList2 = new ArrayList<Integer>();
		//ArrayList<Integer> output = new ArrayList<Integer>();
		if(number == 1){
			counter++;
			return input;
		}else if(number==2){
			if(input.get(0) > input.get(1)){
				int temp;
				temp = input.get(0);
				input.set(0,input.get(1));
				input.set(1,temp);
			}
			counter++;
			return input;
		}else{//number > 2
			separate1 = number/2;
			separate2 = number-separate1;
			for(int i=0;i<separate1;i++){
				tempList1.add(input.get(i));
			}
			for(int i=separate1;i<number;i++){
				tempList2.add(input.get(i));
			}
			newList1 = Sorting(tempList1,separate1);
			newList2 = Sorting(tempList2,separate2);
			int index=0;//index number of newList2
			for(int i=0;i<separate1;i++){// Extension for can't be used easily
				if(newList2.size()<index+1){
					newList2.add(index,newList1.get(i));
					counter++;
				}else if(newList1.get(i)<=newList2.get(index)){
					newList2.add(index, newList1.get(i));
					counter++;
				}else{
					index++;
					i--;
					counter++;
				}
			}
			return newList2;
		}
	}
}

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

#include <stdio.h>
#define INFTY 1000000000 
int N,L[INFTY],R[INFTY],A[INFTY],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++){
    if (L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
      count++;
    }
    else{ 
      A[k] = R[j];
      j = j + 1;
      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);
      }
}
int main(){
      int i;
      scanf("%d",&N);
      for(i=0;i<N;i++){
	scanf("%d",&A[i]);
      }
      mergeSort(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:
/tmp/ccVKrmuZ.o: in function `merge':
main.c:(.text+0xa0): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccVKrmuZ.o
main.c:(.text+0xde): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccVKrmuZ.o
main.c:(.text+0x129): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccVKrmuZ.o
main.c:(.text+0x167): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/ccVKrmuZ.o
main.c:(.text+0x170): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/ccVKrmuZ.o
main.c:(.text+0x19a): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccVKrmuZ.o
main.c:(.text+0x1a9): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/ccVKrmuZ.o
main.c:(.text+0x1b2): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/ccVKrmuZ.o
/tmp/ccVKrmuZ.o: in function `main':
main.c:(.text+0x27a): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccVKrmuZ.o
main.c:(.text+0x2b7): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccVKrmuZ.o
main.c:(.text+0x2ec): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>

int kazu=0;

int merge(int A[],int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int i,j,k;
  int Le[250001];
  int Ri[250001];

  for(i=0;i<=n1-1;i++) Le[i]=A[left+i];
  for(i=0;i<=n2-1;i++) Ri[i]=A[mid+i];
  Le[n1]=1000000001;
  Ri[n2]=1000000001;
  i=0;
  j=0;

  for(k=left;k<=right-1;k++){
    kazu++;
    if(Le[i]<=Ri[j]){
      A[k]=Le[i];
      i++;
    }
    else {
      A[k]=Ri[j];
      j++;
    }
  }
}


int 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(void)
{
	int i,n;
	int S[500000];
	
	scanf("%d",&n);
	for(i=0;i<=n-1;i++) scanf("%d",&S[i]);
	
	mergeSort(S,0,n);
	for(i=0;i<=n-1;i++)
	{
		if(i) printf(" ");
		printf("%d",S[i]);
	}
	
	printf("\n%d\n",count);
	return 0;
}



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

#include<stdio.h>
#define Max 500000
#define term 1000000000

int Left[(Max/2)+2], Right[(Max/2)+2];
int c=0;

int main(){
  int e[Max], n, i;
  scanf("%d", &n);
  for ( i=0; i<n; i++) {
    scanf("%d", &e[i]);
    if (e[i]>=term ){
      return 1;
    }
  }
  mergeSort(e,n,0,n);

  for ( i=0; i<n; i++) {
    if ( i!=0 ) 
    printf(" ");

    printf("%d", e[i]);
    }
  printf("\n");

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

  return 0;
}

void merge(int e[], int n, int left, int mid, int right){
  int i,j,k;

  int x = (mid-left);
  int y = (right-mid);

  for ( i=0; i<x; i++ )
   Left[i] = e[left+i];
  for ( i=0; i<y; i++ )
   Right[i] = e[mid+i];

  Left[x]= Right[t] = term;
  i = j = 0;
  for ( k=left; k<right; k++){
    c++;
    if ( Left[i]<=Right[j] ){
      e[k] = Left[i+1];
    } else {
      e[k] = Right[j+1];
    }
  }
}

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




Compiler output:
main.c: In function 'main':
main.c:17:3: error: implicit declaration of function 'mergeSort' [-Wimplicit-function-declaration]
   17 |   mergeSort(e,n,0,n);
      |   ^~~~~~~~~
main.c: In function 'merge':
main.c:43:18: error: 't' undeclared (first use in this function)
   43 |   Left[x]= Right[t] = term;
      |                  ^
main.c:43:18: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:55:6: warning: conflicting types for 'mergeSort'; have 'void(int *, int,  int,  int)'
   55 | void mergeSort(int e[], int n, int left, int right ){
      |      ^~~~~~~~~
main.c:17:3: note: previous implicit declaration of 'mergeSort' with type 'void(int *, int,  int,  int)'
   17 |   mergeSort(e,n,0,n);
      |   ^~~~~~~~~
Language: C

#include<stdio.h>
#define Max 500000
#define term 1000000000
int merge(int,int,int,int);
int mergeSort(int,int,int,int);

int Left[(Max/2)+2], Right[(Max/2)+2];
int c=0;

int main(){
  int e[Max], n, i;
  scanf("%d", &n);
  for ( i=0; i<n; i++) {
    scanf("%d", &e[i]);
    if (e[i]>=term ){
      return 1;
    }
  }
  mergeSort(e,n,0,n);

  for ( i=0; i<n; i++) {
    if ( i!=0 ) 
    printf(" ");

    printf("%d", e[i]);
    }
  printf("\n");

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

  return 0;
}

void merge(int e[], int n, int left, int mid, int right){
  int i,j,k;

  int x = (mid-left);
  int y = (right-mid);

  for ( i=0; i<x; i++ )
   Left[i] = e[left+i];
  for ( i=0; i<y; i++ )
   Right[i] = e[mid+i];

  Left[x]= Right[t] = term;
  i = j = 0;
  for ( k=left; k<right; k++){
    c++;
    if ( Left[i]<=Right[j] ){
      e[k] = Left[i+1];
    } else {
      e[k] = Right[j+1];
    }
  }
}

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




Compiler output:
main.c: In function 'main':
main.c:19:13: error: passing argument 1 of 'mergeSort' makes integer from pointer without a cast [-Wint-conversion]
   19 |   mergeSort(e,n,0,n);
      |             ^
      |             |
      |             int *
main.c:5:15: note: expected 'int' but argument is of type 'int *'
    5 | int mergeSort(int,int,int,int);
      |               ^~~
main.c: At top level:
main.c:34:6: error: conflicting types for 'merge'; have 'void(int *, int,  int,  int,  int)'
   34 | void merge(int e[], int n, int left, int mid, int right){
      |      ^~~~~
main.c:4:5: note: previous declaration of 'merge' with type 'int(int,  int,  int,  int)'
    4 | int merge(int,int,int,int);
      |     ^~~~~
main.c: In function 'merge':
main.c:45:18: error: 't' undeclared (first use in this function)
   45 |   Left[x]= Right[t] = term;
      |                  ^
main.c:45:18: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:57:6: error: conflicting types for 'mergeSort'; have 'void(int *, int,  int,  int)'
   57 | void mergeSort(int e[], int n, int left, int right ){
      |      ^~~~~~~~~
main.c:5:5: note: previous declaration of 'mergeSort' with type 'int(int,  int,  int,  int)'
    5 | int mergeSort(int,int,int,int);
      |     ^~~~~~~~~
Language: C

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

#define MAX 500000
#define INFTY 1000000001

void merge(int *A,int left,int mid,int right){
  int i,j,k,n1,n2,L[MAX],R[MAX];
  
  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++){
    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,l,A[MAX];

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



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

#include<stdio.h>
void margesort(int *,int,int);
void marge(int *,int,int,int);
int count=0,A[1000000000],L[500000001],R[500000001];
int main(){
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

margesort(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 margesort(int *A,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    margesort(A,left,mid);
    margesort(A,mid,right);
    marge(A,left,mid,right);
  }
}

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



Compiler output:
/tmp/ccuPjPIO.o: in function `marge':
main.c:(.text+0x1e4): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccuPjPIO.o
main.c:(.text+0x207): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccuPjPIO.o
main.c:(.text+0x247): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccuPjPIO.o
main.c:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccuPjPIO.o
main.c:(.text+0x297): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccuPjPIO.o
main.c:(.text+0x2ae): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccuPjPIO.o
main.c:(.text+0x2dd): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccuPjPIO.o
main.c:(.text+0x310): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccuPjPIO.o
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
void margesort(int *,int,int);
void marge(int *,int,int,int);
int count=0,A[1000000000],L[500000001],R[500000001];
int main(){
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

margesort(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 margesort(int *A,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    margesort(A,left,mid);
    margesort(A,mid,right);
    marge(A,left,mid,right);
  }
}

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



Compiler output:
/tmp/ccitbDci.o: in function `marge':
main.c:(.text+0x1e4): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccitbDci.o
main.c:(.text+0x207): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccitbDci.o
main.c:(.text+0x247): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccitbDci.o
main.c:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccitbDci.o
main.c:(.text+0x297): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccitbDci.o
main.c:(.text+0x2ae): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccitbDci.o
main.c:(.text+0x2dd): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccitbDci.o
main.c:(.text+0x310): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccitbDci.o
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
void margesort(int *,int,int);
void marge(int *,int,int,int);
int count=0,A[1000000000],L[500000001],R[500000001];
int main(){
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

margesort(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 margesort(int *A,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    margesort(A,left,mid);
    margesort(A,mid,right);
    marge(A,left,mid,right);
  }
}

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



Compiler output:
/tmp/ccAipdtx.o: in function `marge':
main.c:(.text+0x1e4): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccAipdtx.o
main.c:(.text+0x207): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccAipdtx.o
main.c:(.text+0x247): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccAipdtx.o
main.c:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccAipdtx.o
main.c:(.text+0x297): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccAipdtx.o
main.c:(.text+0x2ae): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccAipdtx.o
main.c:(.text+0x2dd): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccAipdtx.o
main.c:(.text+0x310): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccAipdtx.o
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
void margesort(int *,int,int);
void marge(int *,int,int,int);
int count=0,A[1000000000],L[500000001],R[500000001];
int main(){
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

margesort(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 margesort(int *A,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    margesort(A,left,mid);
    margesort(A,mid,right);
    marge(A,left,mid,right);
  }
}

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



Compiler output:
/tmp/ccqe4Bf7.o: in function `marge':
main.c:(.text+0x1e4): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccqe4Bf7.o
main.c:(.text+0x207): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccqe4Bf7.o
main.c:(.text+0x247): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqe4Bf7.o
main.c:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqe4Bf7.o
main.c:(.text+0x297): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccqe4Bf7.o
main.c:(.text+0x2ae): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqe4Bf7.o
main.c:(.text+0x2dd): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccqe4Bf7.o
main.c:(.text+0x310): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqe4Bf7.o
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
void margesort(int *,int,int);
void marge(int *,int,int,int);
int count=0,A[100000000],L[500000001],R[500000001];
int main(){
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

margesort(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 margesort(int *A,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    margesort(A,left,mid);
    margesort(A,mid,right);
    marge(A,left,mid,right);
  }
}

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



Compiler output:
/tmp/cczlc9fq.o: in function `marge':
main.c:(.text+0x247): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cczlc9fq.o
main.c:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cczlc9fq.o
main.c:(.text+0x2ae): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cczlc9fq.o
main.c:(.text+0x310): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cczlc9fq.o
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
void margesort(int *,int,int);
void marge(int *,int,int,int);
int count=0,A[1000000000],L[500000001],R[500000001];
int main(){
  int n,i;
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

margesort(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 margesort(int *A,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    margesort(A,left,mid);
    margesort(A,mid,right);
    marge(A,left,mid,right);
  }
}

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



Compiler output:
/tmp/ccOsUxk9.o: in function `marge':
main.c:(.text+0x1e4): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccOsUxk9.o
main.c:(.text+0x207): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccOsUxk9.o
main.c:(.text+0x247): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccOsUxk9.o
main.c:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccOsUxk9.o
main.c:(.text+0x297): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccOsUxk9.o
main.c:(.text+0x2ae): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccOsUxk9.o
main.c:(.text+0x2dd): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccOsUxk9.o
main.c:(.text+0x310): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccOsUxk9.o
collect2: error: ld returned 1 exit status
Language: C

#include<iostream> 
using namespace std;

void merge(int arr[], int left, int mid, int right) 
{ 
	int n1 = mid - left + 1; 
	int n2 = right - mid; 

	int L[n1], R[n2]; 

	for (int i = 0; i < n1; i++) 
		L[i] = arr[left + i]; 
	for (int j = 0; j < n2; j++) 
		R[j] = arr[mid + 1+ j]; 

	int i = 0, j=0, k=left;  
	while (i < n1 && j < n2) 
	{ 
		if (L[i] <= R[j]) 
		{ 
			arr[k] = L[i]; 
			i++; 
		} 
		else
		{ 
			arr[k] = R[j]; 
			j++; 
		} 
		k++; 
	} 
	while (i < n1) 
	{ 
		arr[k] = L[i]; 
		i++; 
		k++; 
	} 
	while (j < n2) 
	{ 
		arr[k] = R[j]; 
		j++; 
		k++; 
	} 
} 

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

		merge(arr, left, mid, right); 
	} 
} 

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

	mergeSort(arr, 0, n - 1);

	for (int i=0; i<n; i++)
		cout<<arr[i]<<" ";
	cout<<endl;
	cout<<ceil(log2(n)*(n));
	return 0; 
} 


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

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

int L[MAX/2+2],R[MAX/2+2];
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[i]){
			A[k]=L[i++];
		}else{
			A[k]=R[i++];
		}
	}
}

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(void){
	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:9: fatal error: instream: No such file or directory
    1 | #include<instream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <algorithm>
using namespace std;
int cnt=0;

void merge(int a[],int left, int mid, int right){
    int i = left, j = mid+1;
    int *b = new int[right-left+1];
    int k = 0;
 while(i <= mid && j <= right){
    if(a[i] <= a[j]){
       b[k] = a[i];
       k++;
       i++;
  }
    else{
       b[k] = a[j];
       j++;
       k++;
    }
    cnt++;
 }
 while(i <= mid){
    b[k] = a[i];
    i++;
    k++;
    cnt++;
 }
 while(j <= right){
    b[k] = a[j];
    j++;
    k++;
    cnt++;
 }
 for(i = left, k = 0; i <= right; ++i, ++k){
    a[i] = b[k];
 }
 
}
void mergeSort(int a[], int left, int right){
    if(left < right){
      int mid=(left + right)/2;
      mergeSort(a,left,mid);
      mergeSort(a,mid+1,right);
      merge(a,left, mid, right);
 }
}

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


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

#include <bits/stdc++.h> 

using namespace std;

int c = 0;

void merge(int arr[], int l, int m, int r) 
{ 
    int i, j, k; 
    int left_r = m - l + 1; 
    int right_l =  r - m; 
  
    
    int L[left_r], R[right_l]; 
      
    for (i = 0; i < left_r; i++) 
        L[i] = arr[l + i]; 
    for (j = 0; j < right_l; j++) 
        R[j] = arr[m + 1+ j]; 
  
    i = 0; 
    j = 0;  
    k = l;  
    while (i < left_r && j < right_l) 
    { 
        if (L[i] <= R[j]) 
        { 
            arr[k] = L[i]; 
            i++; 
            c++;
        } 
        else
        { 
            arr[k] = R[j]; 
            j++; 
            c++;
        } 
        k++; 
    } 
  
    while (i < left_r) 
    { 
        arr[k] = L[i]; 
        i++; 
        k++; 
        c++;
    } 
  
  
    while (j < right_l) 
    { 
        arr[k] = R[j]; 
        j++; 
        k++; 
        c++;
    } 
} 


void mergeSort(int arr[], int l, int r) 
{
    if (l < r) 
    { 
        int m = l+(r-l)/2; 
  
        mergeSort(arr, l, m); 
        mergeSort(arr, m+1, r); 
  
        merge(arr, l, m, r); 
    }
    else return;
} 

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

  mergeSort(a, 0, n - 1);

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


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

#include <bits/stdc++.h> 

using namespace std;

int cn = 0;

void merge(int arr[], int l, int m, int r) 
{ 
    int i, j, k; 
    int left_r = m - l + 1; 
    int right_l =  r - m; 
  
    
    int L[left_r], R[right_l]; 
      
    for (i = 0; i < left_r; i++) 
        L[i] = arr[l + i]; 
    for (j = 0; j < right_l; j++) 
        R[j] = arr[m + 1+ j]; 
  
    i = 0; 
    j = 0;  
    k = l;  
    while (i < left_r && j < right_l) 
    { 
        if (L[i] <= R[j]) 
        { 
            arr[k] = L[i]; 
            i++; 
            cn++;
        } 
        else
        { 
            arr[k] = R[j]; 
            j++; 
            cn++;
        } 
        k++; 
    } 
  
    while (i < left_r) 
    { 
        arr[k] = L[i]; 
        i++; 
        k++; 
        cn++;
    } 
  
 while (j < right_l) 
    { 
        arr[k] = R[j]; 
        j++; 
        k++; 
        cn++;
    } 
} 


void mergeSort(int arr[], int l, int r) 
{
    if (l < r) 
    { 
        int m = l+(r-l)/2; 
  
        mergeSort(arr, l, m); 
        mergeSort(arr, m+1, r); 
  
        merge(arr, l, m, r); 
    }
    else return;
} 

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

  mergeSort(a, 0, n - 1);

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


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

#include <iostream> 

using namespace std; 

int cnt=0;
void merge(int *arr, int l, int m, int r) 
{ 
	int i, j, k; 
	int n1 = m - l + 1; 
	int n2 = r - m; 
	int L[n1], R[n2]; 
	for (i = 0; i < n1; i++) 
		L[i] = arr[l + i]; 
	for (j = 0; j < n2; j++) 
		R[j] = arr[m + 1+ j]; 

	i = 0;  
	j = 0;  
	k = l;  
  while (i < n1 && j < n2) 
    { 
        if (L[i] <= R[j]) 
        { 
            arr[k] = L[i]; 
            i++; 
        } 
        else
        { 
            arr[k] = R[j]; 
            j++; 
        } 
        k++; 
        cnt++;
    } 
  
    while (i < n1) 
    { 
        arr[k] = L[i]; 
        i++; 
        k++; 
        cnt++;
    } 
  
    while (j < n2) 
    { 
        arr[k] = R[j]; 
        j++; 
        k++; 
        cnt++;
    } 
}  


void mergeSort(int arr[], int l, int r) 
{ 
	if (l < r) 
	{ 
		int m = (l+r)/2; 

		mergeSort(arr, l, m + 1); 
		mergeSort(arr, m+1, r); 
		merge(arr, l, m, r); 
	} 
} 

int main() 
{ 
	int n;
	cin >> n;
	int a[500000];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	} 
	mergeSort(a, 0, n - 1);
	
	cout << a[0];
	
	for(int i = 1; i < n; i++){
		cout <<" " << a[i];
	}
	cout<<endl<<cnt<<endl;

	return 0; 	
} 


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