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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Inversion {
	
	static int count = 0;
	static int count3 = 0;
	
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		String[] strArray = reader.readLine().split(" ");
		int[] arr = new int[n];
		int[] arr2 = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(strArray[i]);
			arr2[i] = arr[i];
		}
		countInversion(arr);
		System.out.println(count);
//		int count2 = countInversionSimple(arr2);
//		System.out.println(count2);
	}

	private static int countInversionSimple(int[] arr) {
		int count = 0;
		int n = arr.length;
		for (int i = 0; i < n - 1; i++) {
			for (int j = i + 1; j < n; j++) {
				if (arr[i] > arr[j]) {
					count++;
				}
			}
		}
		return count;
	}

	private static void countInversion(int[] arr) {
		countInversion(arr, 0, arr.length);
	}

	private static void countInversion(int[] arr, int left, int right) {
		if (left + 1 < right) {
			int mid = left + (right - left) / 2;
			countInversion(arr, left, mid);
			countInversion(arr, mid, right);
			merge(arr, left, mid, right);
		}
	}
 
	private static void merge(int[] arr, int left, int mid, int right) {
		
		int n1 = mid - left;
		int n2 = right - mid;
		
		int[] L = new int[n1 + 1];
		int[] R = new int[n2 + 1];
		for (int i = 0; i < n1; i++) {
			L[i] = arr[left + i];
		}
		for (int i = 0; i < n2; i++) {
			R[i] = arr[mid + i];
		}
		L[n1] = Integer.MAX_VALUE;
		R[n2] = Integer.MAX_VALUE;
//		System.out.println(Arrays.toString(L));
//		System.out.println(Arrays.toString(R));
		int i = 0;
		int j = 0;
		int tmp = n1;		
		for (int k = left; k < right; k++) {
			if (L[i] <= R[j]) {
				if (R[j] != Integer.MAX_VALUE) {
					tmp--;
				}				
				arr[k] = L[i];
				i++;
			} else {
				if (L[i] != Integer.MAX_VALUE) {
					count += tmp;
				}
				arr[k] = R[j];
				j++;
			}
		}
	}
}



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

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

public class Inversion {
	
	static int count = 0;
	
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		String[] strArray = reader.readLine().split(" ");
		int[] arr = new int[n];
		int[] arr2 = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(strArray[i]);
			arr2[i] = arr[i];
		}
		countInversion(arr);
		System.out.println(count);
	}

	private static void countInversion(int[] arr) {
		countInversion(arr, 0, arr.length);
	}

	private static void countInversion(int[] arr, int left, int right) {
		if (left + 1 < right) {
			int mid = left + (right - left) / 2;
			countInversion(arr, left, mid);
			countInversion(arr, mid, right);
			merge(arr, left, mid, right);
		}
	}
 
	private static void merge(int[] arr, int left, int mid, int right) {
		
		int n1 = mid - left;
		int n2 = right - mid;
		
		int[] L = new int[n1 + 1];
		int[] R = new int[n2 + 1];
		for (int i = 0; i < n1; i++) {
			L[i] = arr[left + i];
		}
		for (int i = 0; i < n2; i++) {
			R[i] = arr[mid + i];
		}
		L[n1] = Integer.MAX_VALUE;
		R[n2] = Integer.MAX_VALUE;
		int i = 0;
		int j = 0;
		int tmp = n1;		
		for (int k = left; k < right; k++) {
			if (L[i] <= R[j]) {
				if (R[j] != Integer.MAX_VALUE) {
					tmp--;
				}				
				arr[k] = L[i];
				i++;
			} else {
				if (L[i] != Integer.MAX_VALUE) {
					count += tmp;
				}
				arr[k] = R[j];
				j++;
			}
		}
	}
}



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

    import java.util.Scanner;
    public class ALDS1_5_D {
        static final int  MAX = 200000;
        static final int SENTINEL = 2000000000;
        static int []L = new int[MAX / 2 + 2];
        static int []R = new int[MAX / 2 + 2];
        public static void main(String[] args) {
            Scanner scan = new Scanner(System.in);
            int N = scan.nextInt();
            int []a = new int[N];
            for(int i = 0; i < N; i++) {
                a[i] = scan.nextInt();
            }
            scan.close();
            long ans = mergeSort(a, N, 0, N);
            System.out.println(ans);
        }
        static long merge(int []A, int n, int left, int mid, int right) {
            int i, j, k;
            long cnt = 0;
            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] = SENTINEL;
            R[n2] = SENTINEL;
            i = 0;
            j = 0;
            for(k = left; k < right; k++) {
                if(L[i] <= R[j]) {
                    A[k] = L[i++];
                }else {
                    A[k] = R[j++];
                    cnt += n1 - i;  // mid + j - k - 1
                }
            }
            return cnt;
        }
        static long mergeSort(int []A, int n, int left, int right) {
            int mid;
            long v1, v2, v3;
            if(left + 1 < right) {
                mid = (left + right) / 2;
                v1 = mergeSort(A, n, left, mid);
                v2 = mergeSort(A, n, mid, right);
                v3 = merge(A, n, left, mid, right);
                return v1 + v2 + v3;
            }else {
                return 0;
            }
        }
    }


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

import java.util.Scanner;
public class ALDS1_5_D {
    static final int  MAX = 200000;
    static final int SENTINEL = 2000000000;
    static int []L = new int[MAX / 2 + 2];
    static int []R = new int[MAX / 2 + 2];
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int N = scan.nextInt();
	int []a = new int[N];
	for(int i = 0; i < N; i++) {
	    a[i] = scan.nextInt();
	}
	scan.close();
	long ans = mergeSort(a, N, 0, N);
	System.out.println(ans);
    }
    static long merge(int []A, int n, int left, int mid, int right) {
	int i, j, k;
	long cnt = 0;
	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] = SENTINEL;
	R[n2] = SENTINEL;
	i = 0;
	j = 0;
	for(k = left; k < right; k++) {
	    if(L[i] <= R[j]) {
		A[k] = L[i++];
	    }else {
		A[k] = R[j++];
		cnt += n1 - i;  // mid + j - k - 1
	    }
	}
	return cnt;
    }
    static long mergeSort(int []A, int n, int left, int right) {
	int mid;
	long v1, v2, v3;
	if(left + 1 < right) {
	    mid = (left + right) / 2;
	    v1 = mergeSort(A, n, left, mid);
	    v2 = mergeSort(A, n, mid, right);
	    v3 = merge(A, n, left, mid, right);
	    return v1 + v2 + v3;
	}else {
	    return 0;
	}
    }
}


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

import java.util.Scanner;

public class BIT {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();
		BinaryIndexedTree tree = new BinaryIndexedTree(N);

		int ans = 0;
		for (int i = 0; i < N; i++) {
			ans += i - tree.sum(a[i]);
			tree.add(a[i], 1);
		}
		System.out.println(ans);

	}

	static class BinaryIndexedTree {
		int N;
		int[] bit;

		public BinaryIndexedTree(int N) {
			this.N = N;
			bit = new int[N + 1];

		}

		public int sum(int i) {
			int sum = 0;
			while (i > 0) {
				sum += bit[i];
				i -= i & -i;
			}
			return sum;
		}

		public void add(int i, int x) {
			while (i <= N) {
				bit[i] += x;
				i += i & -i;
			}
		}
	}

}

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

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class BIT {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		ArrayList<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			list.add(a[i]);
		}
		Collections.sort(list);
		sc.close();
		BinaryIndexedTree tree = new BinaryIndexedTree(N);

		long ans = 0;
		for (int i = 0; i < N; i++) {
			a[i] = Collections.binarySearch(list, a[i]) + 1;
			ans += i - tree.sum(a[i]);
			tree.add(a[i], 1);
		}
		System.out.println(ans);

	}

	static class BinaryIndexedTree {
		int N;
		int[] bit;

		public BinaryIndexedTree(int N) {
			this.N = N;
			bit = new int[N + 1];

		}

		public int sum(int i) {
			int sum = 0;
			while (i > 0) {
				sum += bit[i];
				i -= i & -i;
			}
			return sum;
		}

		public void add(int i, int x) {
			while (i <= N) {
				bit[i] += x;
				i += i & -i;
			}
		}
	}

}

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

import java.util.Scanner;
public class Main1 {
    static long counter = 0;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] ls = new int[n];
        for(int x = 0; x < n; x++){
            ls[x] = scan.nextInt();
        }
        merge_sort(ls, 0, n);
        System.out.println(counter);
    }
    public static void merge_sort (int[] lst, int left, int right) {
        if(left + 1 < right){
            int mid = (left + right)/2;
            merge_sort(lst, left, mid);
            merge_sort(lst, mid, right);
            merge(lst, left, mid, right);
        }
    }
    public static void merge(int[] A, int left, int mid, int right) {
        int n1 = mid - left;
        int n2 = right - mid;
        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] = R[n2] = Integer.MAX_VALUE;
        int l = 0;
        int r = 0;
        for(int i = left; i < right; i++){
            if (L[l] <= R[r]){
                A[i] = L[l++];
                counter = counter + r;
            }
            else{
                A[i] = R[r++];
            }
        }
    }
}


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

#include<iostream>
using namespace std;

#define MAX 1000000001
int ans = 0;

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

    int li = 0;
    int ri = 0;

    for(int i = left; i < right; i++){
        if(L[li] <= R[ri]){
            A[i] = L[li];
            li++;
        }else{
            A[i] = R[ri];
            ri++;
            ans += n1-li;
        }
    }
}

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

int main(){
    int n;
    cin >> n;
    int A[n];
    for(int i = 0; i < n; i++)  cin >> A[i];
    mergeSort(A, 0, n);
    cout << ans << endl;
    return 0;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include<iostream>
^
Main.java:1: error: class, interface, enum, or record expected
#include<iostream>
        ^
Main.java:4: error: illegal character: '#'
#define MAX 1000000001
^
Main.java:4: error: class, interface, enum, or record expected
#define MAX 1000000001
        ^
Main.java:10: error: not a statement
    int L[n1+1];
            ^
Main.java:11: error: not a statement
    int R[n2+1];
            ^
Main.java:7: error: unnamed classes are a preview feature and are disabled by default.
void merge(int A[], int left, int mid, int right){
^
  (use --enable-preview to enable unnamed classes)
Main.java:10: error: ']' expected
    int L[n1+1];
          ^
Main.java:10: error: ';' expected
    int L[n1+1];
              ^
Main.java:11: error: ']' expected
    int R[n2+1];
          ^
Main.java:11: error: ';' expected
    int R[n2+1];
              ^
Main.java:43: error: not a statement
    cin >> n;
        ^
Main.java:44: error: not a statement
    int A[n];
          ^
Main.java:45: error: not a statement
    for(int i = 0; i < n; i++)  cin >> A[i];
                                    ^
Main.java:47: error: not a statement
    cout << ans << endl;
                ^
Main.java:44: error: ';' expected
    int A[n];
           ^
16 errors
Language: Java

import java.util.Scanner;
//import java.util.Arrays ;

// import java.InputMismatchException;
// alds_5b, Aizu Online Judge accept only class name: Main


class Main {

    static void print_list(int [] A, int low, int high) {
        int i ;
        for (i=low; i<high; i++) {
            System.out.printf("%d ", A[i]) ;
        }
        System.out.println() ;
    }

    static long Merge(int [] A, int low, int mid, int high) {
        long swap_count = 0 ;
        int l_size = mid-low ;
        int h_size = high-mid ;
        int []L = new int[l_size] ;
        int []H = new int[h_size] ;

        for (int i=0; i<l_size; i++) {
            L[i] = A[low+i] ;
        }
        for (int i=0; i<h_size; i++) {
            H[i] = A[mid+i] ;
        }

        int a_pos=low, l_pos=0, h_pos=0 ;

        while (l_size != 0 && h_size != 0) {
            //if (L[l_pos] <= H[h_pos]) {
            if (L[l_pos] < H[h_pos]) {  // should be <= ?
                A[a_pos] = L[l_pos] ;
                l_size -= 1 ;
                l_pos += 1 ;
            }
            else {
                A[a_pos] = H[h_pos] ;
                h_size -= 1 ;
                h_pos += 1 ;
                swap_count += l_size ;
            }
            a_pos += 1 ;
        }
        
        while (l_size != 0) {
            A[a_pos] = L[l_pos] ;
            l_size -= 1 ;
            l_pos += 1 ;
            a_pos += 1 ;
        }
        
        while (h_size != 0) {
            A[a_pos] = H[h_pos] ;
            h_size -= 1 ;
            h_pos += 1 ;
            a_pos += 1 ;
        }
        
        return swap_count ;

    }

    static long Merge_sort(int [] A, int low, int high) {
        if (low + 1 < high) {
            int mid = (low + high) / 2 ;
            long v1 = Merge_sort(A, low, mid) ;
            long v2 = Merge_sort(A, mid, high) ;
            long v3 = Merge(A, low, mid, high) ;
            return v1+v2+v3 ;
        }
        else return 0 ;
    }

    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in) ;
        String s = scanner.nextLine() ;

        int elem_count ;
        elem_count = Integer.parseInt(s) ;
        int A[] = new int[elem_count] ;

        for (int i=0; i<elem_count; i++) {
            A[i] = scanner.nextInt() ;
        }

        scanner.close() ;
        long swap_count = Merge_sort(A, 0, elem_count) ;

        /*
        for (int i=0; i<elem_count; i++) {
            String end_mark = " " ;
            if (i==elem_count-1) end_mark = "\n" ;
            System.out.print(A[i] + end_mark) ;
        }



Compiler output:
Main.java:94: error: unclosed comment
        /*
        ^
Main.java:101: error: reached end of file while parsing
2 errors
Language: Java

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

public class Main {
  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] arrayS = new int[n];
      int i=0;
      for (String val : br.readLine().split(" ")) {
        arrayS[i++] = Integer.parseInt(val);
      }

      MergeSort merge = new MergeSort(arrayS);
      int cnt = merge.mergeSort(0, n);

      System.out.println(cnt);
    }
  }
}

class MergeSort {

  static private final int SENTINEL = Integer.MAX_VALUE;

  private int[] target;
  private int[] bufL;
  private int[] bufR;

  public MergeSort(int[] target) {
    this.target = target;
    bufL = new int[target.length/2+2];
    bufR = new int[target.length/2+2];

  }

  public int mergeSort(int left, int right) {
    int cnt =0;

    if(left+1 < right){
      int mid = (left + right) / 2;
      cnt += mergeSort(left, mid);
      cnt += mergeSort(mid, right);
      cnt += merge(left, mid, right);
    }

    return cnt;
  }

  private int merge(int left, int mid, int right) {
    int cnt = 0;
    int n1 = mid - left;
    int n2 = right - mid;
    
    for(int i=0; i<n1; i++)
      bufL[i] = target[left+i];
    bufL[n1] = MergeSort.SENTINEL;

    for(int i=0; i<n2; i++)
      bufR[i] = target[mid+i];
    bufR[n2] = MergeSort.SENTINEL;

    for(int i=0,j=0,k=left; k<right; k++) {
      if(bufL[i] <= bufR[j]) {
        target[k] = bufL[i++];
          cnt += n-i;
      }
      else {
        target[k] = bufR[j++];
      }
    }

    return cnt;
  }

  public int[] getArray() {
    return target;
  }

  public void dispIntArray() {
    StringBuilder s = new StringBuilder();

    for (int i : target) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
}


Compiler output:
Main.java:69: error: cannot find symbol
          cnt += n-i;
                 ^
  symbol:   variable n
  location: class MergeSort
1 error
Language: C

#include <iostream>
#include <climits>
using namespace std;
typedef long long ll;

const int INFTY=INT_MAX;
const int maxn=500000;

int L[maxn/2+2],R[maxn/2+2];

ll merge(int *Array,int left,int mid,int right) {
  int n1=mid-left;
  int n2=right-mid;
  ll count=0;
  for (int i=0; i<n1; i++) {
    L[i]=Array[left+i];
  }
  for (int i=0; i<n2; i++) {
    R[i]=Array[mid+i];
  }
  L[n1]=R[n2]=INFTY;
  int i=0,j=0;
  for (int k=left; k<right; k++) {
    if (L[i]<=R[j]) {
      Array[k]=L[i++];
    }
    else {
      Array[k]=R[j++];
      count+=n1-i;
    }
  }
  return count;
}
ll mergeSort(int *Array,int left,int right) {
  ll v1,v2,v3;
  if (left+1<right) {
    int mid=(left+right)/2;
    v1=mergeSort(Array,left,mid);
    v2=mergeSort(Array,mid,right);
    v3=merge(Array,left,mid,right);
    return v1+v2+v3;
  }
  else {
    return 0;
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int n;
  cin>>n;
  int S[n];
  for (int i=0; i<n; i++) {
    cin>>S[i];
  }
  ll ans=mergeSort(S,0,n);
  cout<<ans<<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  true 1;
#define false (-1)
int n,cnt;
  long a[200000];
void bubbleSort(){
    long i,j,key;
    int han;
    for(i=0;i<n;i++){
        han=true;
        for(j=n-1;j>i;j--){
	  if(a[j]<a[j-1]){
            key=a[j-1];
	    a[j-1]=a[j];
	    a[j]=key;
	    cnt++;
            han=false;
	  }
	}
        if(han==1) break;
    }
    return;
}


int main(){

  long i,count;
  
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%ld",&a[i]);
  // bubbleSort();
   
 long i,j,key;
    int han;
    for(i=0;i<n;i++){
        han=true;
        for(j=n-1;j>i;j--){
	  if(a[j]<a[j-1]){
            key=a[j-1];
	    a[j-1]=a[j];
	    a[j]=key;
	    cnt++;
            han=false;
	  }
	}
        if(han==1) break;
    }
 
}







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

Compiler output:
main.c: In function 'main':
main.c:34:7: error: redeclaration of 'i' with no linkage
   34 |  long i,j,key;
      |       ^
main.c:28:8: note: previous declaration of 'i' with type 'long int'
   28 |   long i,count;
      |        ^
main.c: At top level:
main.c:58:9: error: expected declaration specifiers or '...' before string constant
   58 |  printf("%ld\n",cnt);
      |         ^~~~~~~
main.c:58:17: error: expected declaration specifiers or '...' before 'cnt'
   58 |  printf("%ld\n",cnt);
      |                 ^~~
main.c:60:1: error: expected identifier or '(' before 'return'
   60 | return 0;
      | ^~~~~~
main.c:61:1: error: expected identifier or '(' before '}' token
   61 | }
      | ^
Language: C

#include <iostream>
#include <vector>
#include <ios>
#include <limits.h>
using namespace std;
#define FOR(i, s, e) for(int i = s; i < e; ++i)
typedef vector<long> vec;
long long c = 0;
 
void Merge(vec& vA, int l, int m, int r)
{
    int n1 = m - l;
    int n2 = r - m;
    vec vL(n1 + 1, 0);
    vec vR(n2 + 1, 0);
    FOR(i, 0, n1) vL[i] = vA[l + i];
    FOR(i, 0, n2) vR[i] = vA[m + i];
    vL[n1] = LONG_MAX;
    vR[n2] = LONG_MAX;
    int s = 0, t = 0;
    FOR(i, l, r){
        if ( vL[s] > vR[t]){
            vA[i] = vR[t];
            ++t;
            c += n1 - s;
        }else{
            vA[i] = vL[s];
            ++s;
        }
    }
}
 
void CountCross(vec& vA, int l, int r)
{
    if (l + 1 >= r) return;
    int m = (l + r) / 2;
    CountCross(vA, l, m);
    CountCross(vA, m, r);
    Merge(vA, l, m, r);
}
 
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vec vA(n, 0);
    FOR(i, 0, n) cin >> vA[i];
    CountCross(vA, 0, n);
    cout << c << "\n";
    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>
 
double count=0;
void margesort(int *,int,int);
void marge(int *,int,int,int);
 
int S[200000],L[100001],R[100001];
 
int main(){
  FILE* p;
  int n,i;
  //p=fopen("ALDS1_5_D_in19.txt","r");
  //fscanf(p,"%d",&n);
  scanf("%d",&n);
  for(i=0;i<n;i++) //fscanf(p,"%d",&S[i]);
     scanf("%d",&S[i]);
   
   margesort(S,0,n);
   printf("%.0f\n",count);
 
   //fclose(p);  
 
   return 0;
}
 
void margesort(int *S,int left,int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    margesort(S,left,mid);
    margesort(S,mid,right);
    marge(S,left,mid,right);
  }
}
 
void marge(int *S,int left,int mid,int right){
  int n1,n2;
  int i,j=0,k;
 
  n1 = mid - left;
  n2 = right - mid;
 
  for(i=0;i<n1;i++) L[i] = S[left+i];
  L[n1]=-1;
  for(i=0;i<n2;i++) R[i] = S[mid+i];
  R[n2]=-1;
 
  i=0;
  for(k=left;k<right;k++){
  if(L[i] > R[j]){ 
    S[k] = L[i];
    i++;
    count += n2 - j;
  }
  else{
    S[k] = R[j];
    j++;
  }
  }

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

#include <stdio.h>
#include <stdlib.h>
#define N 200000

unsigned int a[N];
int cnt = 0;
void inversion(int* a, int l, int r){
int m = (r+l)/2;
int i = 0, j = 0;
 if(l == r)
  return;

   inversion(a, l, m);
   inversion(a, m + 1, r);

    for(i = l; i <= m; i++){
     for(j = m+1; j <= r; j++){
      if(a[i] > a[j]){
        cnt++;
      }
    }
   }

}



int main(int argc, char** argv){
int n, i = 0;
   scanf("%d", &n);

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


   inversion(a, 0, n-1);

   printf("%d", cnt);

  return 0;
}
~                                                            

Compiler output:
main.c:42:1: error: expected identifier or '(' before '~' token
   42 | ~
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#define N 200000

unsigned int a[N];

int L[N/2 + 2], R[N/2 + 2];

long long merge_sort(int *a, int l, int r){
int m  = (l+r)/2, count, i, j;
int n1, n2;
long long v1, v2 cnt = 0;
  if(l == r)
   return 0;

  v1 = merge_sort(a, l, m);
  v2 = merge_sort(a, m + 1, r);
  n1 = m-l+1;
  n2 = r - m;
  L[n1]  = R[n2] = 200000000;
  for(count = l; count <= m; count++){
     L[count - l] = a[count];
  }
  for(count = m + 1; count <= r; count++){
    R[count - m - 1] = a[count];
  }
  for(i = 0, j = 0, count = l; count <= r; count++){
    if(L[i] <= R[j]){
     a[count] = L[i++];
    }
    else{
     a[count] = R[j++];
     cnt += n1 - i;
    }

  }

   return cnt + v1 + v2;
}

int main(int argc, char** argv){
int n, i = 0;
   scanf("%d", &n);

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


 printf("%d\n", merge_sort(a, 0, n-1));

  return 0;
}

Compiler output:
main.c: In function 'merge_sort':
main.c:12:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'cnt'
   12 | long long v1, v2 cnt = 0;
      |                  ^~~
main.c:17:3: error: 'v2' undeclared (first use in this function); did you mean 'v1'?
   17 |   v2 = merge_sort(a, m + 1, r);
      |   ^~
      |   v1
main.c:17:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:33:6: error: 'cnt' undeclared (first use in this function); did you mean 'int'?
   33 |      cnt += n1 - i;
      |      ^~~
      |      int
Language: C

#b#include <stdio.h>
#define MAX 200000
#define SENTINEL 2000000000
long long merge(int,int,int);
long long mergeSort(int,int);
int A[MAX];
int L[MAX/2 + 2],R[MAX/2 + 2];

int main(){
  int n,i;
  long long result;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }
  result = mergeSort(0,n);
  printf("%d\n",result);
  return 0;
}

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

long long mergeSort(int left, int right){
  int mid;
  long long a1,a2,a3;
  if(left+1 < right){
    mid = (left + right)/2;
    a1 = mergeSort(left,mid);
    a2 = mergeSort(mid,right);
    a3 = merge(left,mid,right);
    return a1+a2+a3;
  }
  else return 0;
}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #b
    1 | #b#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 | #b#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:17:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   17 |   printf("%d\n",result);
      |   ^~~~~~
main.c:17:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:17:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:17:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

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

#define N 100000005

int babbleSort(int A[]){
int i,j,count = 0;
for(i=0; i<A.length-1; i++){
	for(j=A.length-1; j=i; j--){
		if(A[j] < A[j-1]){
			swap(A[j],A[j-1]);
			count++;
		}
	}
}
	return count;
}


int main(){
	int n;
	int A[N];
	scanf("%d",&n);
	for(i=0; i<n; i++) scanf("%d",&n);
	
	babbleSort(A);
	
	for(i=0; i<n; i++) printf("%d",A[i]);
	
	return 0;
	
}

Compiler output:
main.c: In function 'babbleSort':
main.c:8:13: error: request for member 'length' in something not a structure or union
    8 | for(i=0; i<A.length-1; i++){
      |             ^
main.c:9:16: error: request for member 'length' in something not a structure or union
    9 |         for(j=A.length-1; j=i; j--){
      |                ^
main.c:11:25: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   11 |                         swap(A[j],A[j-1]);
      |                         ^~~~
main.c: In function 'main':
main.c:24:13: error: 'i' undeclared (first use in this function)
   24 |         for(i=0; i<n; i++) scanf("%d",&n);
      |             ^
main.c:24:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

#define INFTY 1000000009
#define N 100000005
int count = 0;

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

free(L);
free(R);
}


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,answer;
	int A[N];
	scanf("%d",&n);
	for(i=0; i<n; i++) scanf("%d",&n);
	
	answer = mergeSort(A,0,n);
	
	printf("%d",answer);
	
	return 0;
	
}

Compiler output:
main.c: In function 'merge':
main.c:12:12: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   12 | L = (int *)malloc((n1+1) * sizeof(int));
      |            ^~~~~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    2 | #include <string.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:12:12: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   12 | L = (int *)malloc((n1+1) * sizeof(int));
      |            ^~~~~~
main.c:12:12: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:32:1: error: implicit declaration of function 'free' [-Wimplicit-function-declaration]
   32 | free(L);
      | ^~~~
main.c:32:1: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c:32:1: warning: incompatible implicit declaration of built-in function 'free' [-Wbuiltin-declaration-mismatch]
main.c:32:1: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c: In function 'main':
main.c:53:16: error: void value not ignored as it ought to be
   53 |         answer = mergeSort(A,0,n);
      |                ^
Language: C

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

#define INFTY 1000000009
#define N 2000005
int A[N];

long merge(int left,int mid, int right){
  int i,j,k,n1,n2,*L,*R;
  long mcount=0;
  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] = 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 + 1;
    }
    else{
      A[k] = R[j];
      j = j + 1;
      mcount += n1 - i;
    }
  }
  free(L);
  free(R);
  return mcount;
}


long mergeSort(int left,int right){
  int mid
  long a,b,c;
  if(left+1 < right){
    mid = (left + right) / 2;
    a = mergeSort(left,mid);
    b = mergeSort(mid,right);
    c = merge(left,mid,right);
    return a+b+c;
  }
  else return 0;
}

int main(){
  int i,n;
  long answer;

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

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

  return 0;

}

Compiler output:
main.c: In function 'merge':
main.c:23:5: error: 'count' undeclared (first use in this function); did you mean 'mcount'?
   23 |     count++;
      |     ^~~~~
      |     mcount
main.c:23:5: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'mergeSort':
main.c:41:10: error: expected ';' before 'long'
   41 |   int mid
      |          ^
      |          ;
   42 |   long a,b,c;
      |   ~~~~    
main.c:44:5: error: 'mid' undeclared (first use in this function)
   44 |     mid = (left + right) / 2;
      |     ^~~
Language: C

#include<stdio.h>
#define I 200000000

long long int S[100000000];
int L[1000000],R[1000000];
//int cnv=0; 
 
void merge(int *A,int left,int mid,int right){
  int i,j,k;
  int 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]=I;
  R[n2]=I;
 
  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;
      cnv+=n1-i;
    }
  }
}


void mergeSort(int *A,int left, int right){
  int mid;
  int v1,v2,v3;
 
  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;
  int n;
   
  scanf("%lld",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
 
  mergeSort(S,0,n);
 
  printf("%d\n",cnv);
  return 0;
}
 
 

Compiler output:
main.c: In function 'merge':
main.c:36:7: error: 'cnv' undeclared (first use in this function)
   36 |       cnv+=n1-i;
      |       ^~~
main.c:36:7: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:65:13: error: passing argument 1 of 'mergeSort' from incompatible pointer type [-Wincompatible-pointer-types]
   65 |   mergeSort(S,0,n);
      |             ^
      |             |
      |             long long int *
main.c:42:21: note: expected 'int *' but argument is of type 'long long int *'
   42 | void mergeSort(int *A,int left, int right){
      |                ~~~~~^
main.c:67:17: error: 'cnv' undeclared (first use in this function)
   67 |   printf("%d\n",cnv);
      |                 ^~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#define int long long
 
#define iin(x) scanf("%d", &x)
#define lin(x) scanf("%lld", &x)
#define fin(x) scanf("%lf", &x)
 
#define iout(x) printf("%d", x)
#define lout(x) printf("%lld", x)
#define fout(x) printf("%.10f", x)
#define _ putchar(' ')
#define endl puts("")
 
#define reps(i, x, n) for(i = (x); i < (n); i++)
#define rep(i, n) reps(i, 0, n)
 
int L[500001], R[500001];
 
int merge(int A[], int left, int mid, int right) {
  int res = 0;
  int n1 = mid - left;
  int n2 = right - mid;
  int i, j, k;
  rep(i, n1) L[i] = A[left+i];
  rep(i, n2) R[i] = A[mid+i];
  L[n1] = 2000000000;
  R[n2] = 2000000000;
  i = 0, j = 0;
  reps(k, left, right) {
    if(L[i] <= R[j]) {
      A[k] = L[i];
      i++;
    } else {
      A[k] = R[j];
      j++;
      res += n1 - i;
    }
  }
  return res;
}
 
int mergeSort(int A[], int left, int right) {
  int a = 0, b = 0, c = 0;
  if(left + 1 < right) {
    int mid = (left + right) / 2;
    a = mergeSort(A, left, mid);
    b = mergeSort(A, mid, right);
    c = merge(A, left, mid, right);
  }
  return a+b+c;
}
 
int A[500001];
 
signed main() {
  int n; lin(n);
  int i;
  rep(i, n) lin(A[i]);
  lout(mergeSort(A, 0, n)),endl;
 
  return 0;

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

#include<stdio.h>
#define N 200000
doubele count=0;
void margesort(int,int);
void marge(int,int,int);
 
int S[N],Left[N/2+1],Right[N/2+1];

int main(){
  int n,i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++) 
    scanf("%d",&S[i]);
  
  margesort(0,n);
  printf("%0.f\n",count); 
  
  return 0;
}

void margesort(int left,int right){
  int mid;
  if(left+1 < right){ 
    mid = (left + right)/2;
    margesort(left,mid);
    margesort(mid,right);
    marge(left,mid,right);
  }
}

void marge(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++) Left[i] = S[left+i];
  Left[n1]=-1;
  for(i=0;i<n2;i++) Right[i] = S[mid+i];
  Right[n2]=-1;
  
  i=0;
  for(k=left;k<right;k++){
    if(Left[i] > Right[j]){  
      S[k] = Left[i];
      i++;
    count += n2 - j;
    }
    else{
      S[k] = Right[j];
      j++;
    }
  }
}

Compiler output:
main.c:3:1: error: unknown type name 'doubele'; did you mean 'double'?
    3 | doubele count=0;
      | ^~~~~~~
      | double
Language: C

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


long long int merge_count(int, int);
long long int bubble_sort(int);


int main(void) {
  
    int i, n;

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

  
long long int A[200000];

long long int merge_count(int l, int r){
  
    long long int count = 0;
    int i, j, k;
    int n = r - l;

    
    if(n > 1){

      long long int b[n+5];
      int m
	m = l + n/2;
      
	count = count + merge_count(l, m);
        count = count + merge_count(m, r);

	memcpy((void*)b, (void*)&A[l], sizeof(b));
	
        for(i = l, j = 0, k = n / 2; i < r; ++i){
	  
            if(j == n / 2) {
                A[i] = b[k++];
            } else if(k == n) {
                A[i] = b[j++];
            } else if(b[j] <= b[k]) {
                A[i] = b[j++];
            } else {
                A[i] = b[k++];
                count == count + n/2 - j;
            }
        }
    }
    return count;
}
  
long long int bubble_sort(int n){
  
    return merge_count(0, n);

}

Compiler output:
main.c: In function 'main':
main.c:17:24: error: 'A' undeclared (first use in this function)
   17 |         scanf("%lld", &A[i]);
      |                        ^
main.c:17:24: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'merge_count':
main.c:39:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'm'
   39 |         m = l + n/2;
      |         ^
main.c:39:9: error: 'm' undeclared (first use in this function)
Language: C

#include<stdio.h>

#define M 200000
#define MH 100000 
#define S 2000000000

int L[MH],R[MH];

long mer(int *a,int n,int left,int right,int man){

  int i,j=0,k=0;
  long cou=0;

  int na=man-left;
  int nb=right-man;

  for(i=0;i<na;i++) L[i]=a[left+1];
  for(i=0;i<nb;i++)R[i]=a[man+1];

  L[na]=R[nb]=S;

  i=0;

  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      i++;
      a[k]=l[i];
    }else{
      j++;
      a[k]=[j];
      cou+=na-i;
    }
  }
  return cou;
}

long sort(int *a,int n,int right,int left){
  int man;
  long b1,b2,b3;

  if(left+1<right){
    man=(left+right)/2;
    b1=sort(a,n,man,left);
    b2=sort(a,n,right,man);
    b3=mer(a,n,left,right,man);
    return b1+b2+B3;
  }else return 0;
}

int main(){
  int a[M],n,i;
  long ans;

  scanf("%d",&n);

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

  ans=sort(a,n,n,0);
  scanf("%d\n",ans);

  return 0;
}

Compiler output:
main.c: In function 'mer':
main.c:27:12: error: 'l' undeclared (first use in this function)
   27 |       a[k]=l[i];
      |            ^
main.c:27:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:30:12: error: expected expression before '[' token
   30 |       a[k]=[j];
      |            ^
main.c: In function 'sort':
main.c:46:18: error: 'B3' undeclared (first use in this function); did you mean 'b3'?
   46 |     return b1+b2+B3;
      |                  ^~
      |                  b3
Language: C

include<stdio.h>
  
long long Merge(int A[],int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int i,j,k;
  int L[n1+1],R[n2+1];
  long long res=0;
  for(i=0;i<n1;i++)L[i]=A[left+i];
  for(i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=1000000001;
  R[n2]=1000000001;
    
  i=j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }else{
      A[k]=R[j];
      j++;
      res+= (long long)n1- (long long)i;
    }
  }
  return res;
}
  
long long Merge_Sort(int A[],int left,int right){
  int mid;
  long long res=0;
  if(left+1<right){
    mid=(left+right)/2;
  
    res+=Merge_Sort(A,left,mid);
    res+=Merge_Sort(A,mid,right);
    res+=Merge(A,left,mid,right);
      
  }
  return res;
}
  
int main(){
  int i,n,S[200000];
  long long x;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&S[i]);
  
  x=Merge_Sort(S,0,n);
  printf("%ld\n",x);
  return 0;
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'Merge_Sort':
main.c:36:10: error: implicit declaration of function 'Merge' [-Wimplicit-function-declaration]
   36 |     res+=Merge(A,left,mid,right);
      |          ^~~~~
main.c: In function 'main':
main.c:45:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   45 |   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:45:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   45 |   scanf("%d",&n);
      |   ^~~~~
main.c:45:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:49:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   49 |   printf("%ld\n",x);
      |   ^~~~~~
main.c:49:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:49:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:49:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>
#include <stdlib.h>
  
#define MIN_N 1
#define MAX_N 200000
#define MIN_A 0
#define MAX_A 1000000000
  
int array[MAX_N];
long invcnt = 0;
  
void merge(int *array, int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    int i, j, k, *left_array, *right_array;
  
    left_array = malloc(sizeof(int) * n1 + 100);
    right_array = malloc(sizeof(int) * n2 + 100);
  
    for(i = 0; i < n1; i++) 
        left_array[i] = array[left + i];
    for(i = 0; i < n2; i++)
        right_array[i] = array[mid + i];
    left_array[n1] = MAX_A + 1;
    right_array[n2] = MAX_A + 1;
    i = 0;
    j = 0;
    for(k = left; k < right; k++) {
        if(left_array[i] <= right_array[j]) 
            array[k] = left_array[i++];
        else {
            invcnt += n1 - i;
            array[k] = right_array[j++];
        }
          
    }
    free(left_array);
    free(right_array);
}
  
void merge_sort(int *array, int left, int right)
{
    if(left + 1 < right) {
        int mid;
  
        mid = (left + right) / 2;
        merge_sort(array, left, mid);
        merge_sort(array, mid, right);
        merge(array, left, mid, right);
    }
  
}
  
int main(void)
{
    int i, n;
  
    scanf("%d", &n);
    for(i = 0; i < n; i++)
    {
        int a;
        scanf("%d", &a);
        array[i] = a;
    }
    merge_sort(array, 0, n);
    printf("%ld\n", invcnt);
  
    return 0;

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

ank (38:02:43)
0 Comments
SettingFavorite
A
B
C
D
E
F
G
H
I
J
Submit
Status My Status
Time limit
1000 ms
Memory limit
65536 kB
OS
Linux
I - The Number of Inversions 


All Copyright Reserved ?2010-2017 Xu Han 
Server Time: 2017-12-19 14:02:47 CST

#12016314 | MyVj's solution for [Problem I]
Status
Compile Error
Length
478
Lang
C
Submitted
2017-12-19 14:02:14
Shared

code.c:1:22: fatal error: iostream: No such file or directory 
compilation terminated. 
Select Code
#include <iostream>  
#include <cstdio>  
#include <algorithm>
#define N 200001  
using namespace std; 
long long cnt=0;
long long b(long long a[],long long n){
	for(long long i=0;i<n;i++){
		for(long long j=n-1;j>i;j--){
			if( a[j] < a[j-1]){
				long long ax=a[j];
				a[j]=a[j-1];
				a[j-1]＝ax;
				cnt++;
			}
		}
	} 
	return cnt;
} 
int main() { 
	long long n;
	scanf("%ld",&n);
	long long a[N];
	for(long long i=0;i<n;i++){
		scanf("%ld",&a[i]);
	}
	cout<<b(a,n)<<"\n";
} 

Compiler output:
main.c:1:6: error: expected declaration specifiers or '...' before numeric constant
    1 | ank (38:02:43)
      |      ^~
main.c:28:11: error: "|" is not a valid filename
   28 | #12016314 | MyVj's solution for [Problem I]
      |           ^
main.c:28:17: warning: missing terminating ' character
   28 | #12016314 | MyVj's solution for [Problem I]
      |                 ^
main.c:42:10: fatal error: iostream: No such file or directory
   42 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>

using namespace std;

int a[200005];

int main()
{
    int i,j,h,l;
    int cnt=0;
    while(scanf("%d",&h)!=EOF)
    {
        for(l=0;l<h;l++)
        {
            scanf("%d",&a[l]);
        }
        for(i=0;i<h;i++)
        {
            for(j=h-1;j>=i+1;j--)
            {
                if(a[j]<a[j-1])
                {
                    swap(a[j],a[j-1]);
                    cnt++;
                }
            }
        }
        printf("%d\n",cnt);
        cnt=0;
    }
    return 0;
}

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<stdio.h>
#include<stdlib.h>
int msort(int, int, int*);
main()
{
        int i, n, *a;
        scanf("%d", &n);
        a = (int*)malloc(sizeof(int) * n);
        for (i = 0; i < n; i++) {
                scanf("%d", &a[i]);
        }
        printf("%lld\n", msort(0, n - 1, a));
        free(a);
}
long long int msort(int left, int right, int *a)
{
        int i, j, center, num, base, work[right - left + 1];
        long long int reverse = 0;
        if (left >= right) return 0;
        center = (left + right) / 2;
        reverse += msort(left, center, a);
        reverse += msort(center + 1, right, a);
        for (num = 0, i = left; i <= center; num++, i++) {
                work[num] = a[i];
        }
        j = 0, base = left;
        while (i <= right && j < num) {
                if (a[i] < work[j]) {
                        a[base++] = a[i++];
                        reverse += i - base;
                } else {
                        a[base++] = work[j++];
                }
        }
        while (j < num) {
                a[base++] = work[j++];
        }
        return reverse;
}


Compiler output:
main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
    4 | main()
      | ^~~~
main.c:15:15: error: conflicting types for 'msort'; have 'long long int(int,  int,  int *)'
   15 | long long int msort(int left, int right, int *a)
      |               ^~~~~
main.c:3:5: note: previous declaration of 'msort' with type 'int(int,  int,  int *)'
    3 | int msort(int, int, int*);
      |     ^~~~~