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

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

void merge(int A[], int l, int m, int r){
    int n1 = m-l+1;
    int n2 = r-m;
    int *B = (int *)calloc(n1+1, sizeof(int));
    int *C = (int *)calloc(n2+1, sizeof(int));
    for(int i=0; i<n1; i++){
        B[i] = A[l+i];
    }
    for(int i=0; i<n2; i++){
        C[i] = A[m+1+i];
    }
    B[n1] = INT_MAX;
    C[n2] = INT_MAX;
    int i = 0;
    int j = 0;
    for(int k=0; k<r-l+1; k++){
        if(B[i] < C[j]){
            A[k+l] = B[i];
            i++;
        }else{
            A[k+l] = C[j];
            j++;
        }
    }
}

void merge_sort(int A[], int l, int r){
    int m = (l+r)/2;
    if(l < r){
        merge_sort(A, l, m);
        merge_sort(A, m+1, r);
        merge(A, l, m, r);
    }
}

int main(){
    int n;
    cin >> n;
    int *A = new int[n];
    for(int i=0; i<n; i++){
        cin >> A[i];
    }
    merge_sort(A, 0, n-1);
    for(int i=0; i<n; i++){
        if(i != 0) cout << " ";
        cout << A[i];
    }
    cout << endl;
}


Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:33:13: error: 'INT_MAX' was not declared in this scope
   33 |     B[n1] = INT_MAX;
      |             ^~~~~~~
a.cc:19:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   18 | #include<functional>
  +++ |+#include <climits>
   19 |
Language: C++

#include <stdio.h>
#define INF 1<<30

int count;

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

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

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




Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:16:11: error: 'j' was not declared in this scope
   16 |     int i=j=0;
      |           ^
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:31:9: error: 'mid' was not declared in this scope
   31 |         mid = (left + right)/2;
      |         ^~~
Language: C++

#include <stdlib.h>
#include <stdio.h>
void merge(int *,int,int,int);
void mergesort(int *,int,int);
int main(){
  int a[500000],n,i;
  scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",a[i]);
  mergesort(a,0,n-1);
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i!=n-1)printf(" ");
    else printf("\n");
  }
  return 0;
}
void mergesort(int *a,int left,int right){
  int mid;
  if(left+1>=right)return;
  else {
    mid=(left+right)/2;
    mergesort(a,left,mid);
    mergesort(a,mid+1,right);
    merge(a,left,mid,right);
  }
}
void merge(int *a,int left,int mid,int right){
  int i,k,j,n1=mid-left,n2=right-mid;
  int *L,*R;
  L=malloc(sizeof(int)*(n1+1));
  R=malloc(sizeof(int)*(n2+1));
  for(i=0;i<n1;i++){
    L[i]=a[i];
  }
  for(i=0;i<n2;i++){
    R[i]=a[mid+i];
  }
  L[n1]=2147483647;
  R[n2]=2147483647;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<R[j])a[k]=L[i++];
    else a[k]=R[j++];
  }
}


Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:30:11: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   30 |   L=malloc(sizeof(int)*(n1+1));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:31:11: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   31 |   R=malloc(sizeof(int)*(n2+1));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;
int n,tmp,sum=0;
vector <int> a;
void merge(vector <int> &a,int left,int mid,int right)
{
    int n1=mid-left;
    int n2=right-mid;
    int l[n1],r[n2];
    for(int i=0;i<n1;i++) {l[i]=a[left+i];}
    for(int i=0;i<n2;i++) {r[i]=a[mid+i];}
    int i=0,j=0;
    for(int k=left;k<right;k++)
    {
        if(l[i]<=r[j]) {a[k]=l[i];i++;}
        else {a[k]=r[j];j++;}
        sum++;
    }
};
void merge_sort(vector <int> &a,int left,int right){
if(left+1<right)
{   int mid=(left+right)/2;
    merge_sort(a,left,mid);
    merge_sort(a,mid,right);
    merge(a,left,mid,right);
};
int main()
{    cin>>n;for(int i=0;i<n;i++) {cin>>tmp;a.push_back(tmp);}
    merge_sort(a,0,n);
    for(int i=0;i<n-1;i++)
        cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
    cout<<sum<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'void merge_sort(std::vector<int>&, int, int)':
a.cc:30:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   30 | int main()
      |         ^~
a.cc:30:9: note: remove parentheses to default-initialize a variable
   30 | int main()
      |         ^~
      |         --
a.cc:30:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:31:1: error: a function-definition is not allowed here before '{' token
   31 | {    cin>>n;for(int i=0;i<n;i++) {cin>>tmp;a.push_back(tmp);}
      | ^
a.cc:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:23:52: note: to match this '{'
   23 | void merge_sort(vector <int> &a,int left,int right){
      |                                                    ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int n,tmp,sum=0;
void merge(int a[],int left,int mid,int right)
{
    int n1=mid-left;
    int n2=right-mid;
    int l[n1],r[n2];
    for(int i=0;i<n1;i++) {l[i]=a[left+i];}
    for(int i=0;i<n2;i++) {r[i]=a[mid+i];}
    int i=0,j=0;
    for(int k=left;k<right;k++)
    {
        if(l[i]<=r[j]) {a[k]=l[i];i++;}
        else {a[k]=r[j];j++;}
        sum++;
    }
};
void merge_sort(int a[],int left,int right){
if(left+1<right)
{   int mid=(left+right)/2;
    merge_sort(a,left,mid);
    merge_sort(a,mid,right);
    merge(a,left,mid,right); }
};
int main()
{    cin>>n;int a[n];for(int i=0;i<n;i++) {cin>>a[i];}
    sort(a,0,n);
    for (int i = 0; i < n; i++) {cout << a[i];
		if (i < n - 1) {cout << ' ';}else { cout << endl; }
	}
    cout<<34<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: no matching function for call to 'sort(int [n], int, int&)'
   29 |     sort(a,0,n);
      |     ~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   template argument deduction/substitution failed:
a.cc:29:9: note:   deduced conflicting types for parameter '_RAIter' ('int*' and 'int')
   29 |     sort(a,0,n);
      |     ~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 3 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   template argument deduction/substitution failed:
a.cc:29:9: note:   variable-sized array type 'int (&)[n]' is not a valid template argument
   29 |     sort(a,0,n);
      |     ~~~~^~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
void merge(int a[],int left,int mid,int right)
{
    int n1=mid-left;
    int n2=right-mid;
    int l[n1],r[n2];
    for(int i=0;i<n1;i++) {l[i]=a[left+i];}
    for(int i=0;i<n2;i++) {r[i]=a[mid+i];}
    int i=0,j=0;
    for(int k=left;k<right;k++)
    {
        if(l[i]<=r[j]) {a[k]=l[i];i++;}
        else {a[k]=r[j];j++;}
        sum++;
    }
};
void merge_sort(int a[],int left,int right){
if(left+1<right)
{   int mid=(left+right)/2;
    merge_sort(a,left,mid);
    merge_sort(a,mid,right);
    merge(a,left,mid,right); }
};
int main()
{   int n,tmp,sum=0; 
    cin>>n;int a[n];for(int i=0;i<n;i++) {cin>>a[i];}
    merge_sort(a,0,n);
    for(int i=0;i<n;i++)
        if(i==n-1)cout<<a[i]<<endl; else cout<<a[i]<<' ';
    cout<<sum<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:16:9: error: 'sum' was not declared in this scope
   16 |         sum++;
      |         ^~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
void merge(int a[],int left,int mid,int right)
{
    int n1=mid-left;
    int n2=right-mid;
    int l[n1],r[n2];
    for(int i=0;i<n1;i++) {l[i]=a[left+i];}
    for(int i=0;i<n2;i++) {r[i]=a[mid+i];}
    int i=0,j=0;
    for(int k=left;k<right;k++)
    {
        if(l[i]<=r[j]) {a[k]=l[i];i++;}
        else {a[k]=r[j];j++;}
    }
};
int merge_sort(int a[],int left,int right){
    if(left+1<right)
    {   int mid=(left+right)/2;
        return merge_sort(a,left,mid,sum)+merge_sort(a,mid,right,sum)+right-left;
        merge(a,left,mid,right);
    }
    else return 0;
};
int main()
{    int n,tmp;cin>>n;int a[n];for(int i=0;i<n;i++) {cin>>a[i];}
    int sum=merge_sort(a,0,n);
    for (int i = 0; i < n; i++) {
        cout << a[i]; 
        if (i < n - 1) {cout << ' ';}
        else { cout << endl; }
    }
    cout<<sum<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'int merge_sort(int*, int, int)':
a.cc:21:38: error: 'sum' was not declared in this scope
   21 |         return merge_sort(a,left,mid,sum)+merge_sort(a,mid,right,sum)+right-left;
      |                                      ^~~
Language: C++

#include <stdlib.h>
#include <stdio.h>
void merge(int *,int,int,int);
void mergesort(int *,int,int);
int cnt=0,n;
int main(){
  int a[500000],i;
  scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&a[i]);
  mergesort(a,0,n);
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i!=n-1)printf(" ");
    else printf("\n");
  }
  printf("%d\n",cnt);
  return 0;
}
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);
  }
}
void merge(int *a,int left,int mid,int right){
  int l,i,k,j,n1=mid-left,n2=right-mid;
  int *L,*R;
  L=malloc(sizeof(int)*(n1+2));
  R=malloc(sizeof(int)*(n2+2));
  for(i=0;i<n1;i++){
    L[i]=a[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=a[mid+i];
  }
  L[n1]=2147483647;
  R[n2]=2147483647;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j])a[k]=L[i++];
    else a[k]=R[j++];
  }
  free(L);
  free(R);
}



Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:31:11: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   31 |   L=malloc(sizeof(int)*(n1+2));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:32:11: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   32 |   R=malloc(sizeof(int)*(n2+2));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

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

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

int count=0;

int main()
{
  int n,i;
  int left,right,mid;
  int A[500000];

  scanf("%d",&n);

  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
  }
  left = 0;
  mid = i/2;
  right = i;

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

  return 0;
}

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

  int L[n1];
  int R[n2];

  for(i=0; i<n1; i++)
    L[i] = A[left+i];

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

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

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



Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:50:11: error: 'INFTY' was not declared in this scope; did you mean 'INFINITY'?
   50 |   L[n1] = INFTY;
      |           ^~~~~
      |           INFINITY
Language: C++

#include<iostream>
#include<limits>

void mergeSort(int* A, int left, int right);
using namespace std;
int ct=0;
int main() {
	int* S;
	int n;
	cin >> n;
	S = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> S[i];
	}
	/*for (int i = 0; i < n; i++) {
		cout << S[i];
		cout << " ";
	}
	cout << endl;
	*/
	mergeSort(S,0,n);

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

}

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

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

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:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:47:22: error: 'INFINITY' was not declared in this scope
   47 |         L[n1] = (int)INFINITY;
      |                      ^~~~~~~~
Language: C++

#include<iostream>
#include<limits.h>
#define SENTINEL INT_MAX //SENTINELをとても大きい値で初期化する
using namespace std;
typedef long long ll;
ll counter=0;
void Merge(long long S[],int left,int mid,int right){//擬似コードに従った、Merge
  int n1 = mid-left;
  int n2 = right-mid;
  ll L[n1+1];
  ll R[n2+1];
 
  for(int i=0;i<n1;i++){
    L[i] = S[left+i];
  }
  for(int i=0;i<n2;i++){
    R[i]=S[mid+i];
  }
  L[n1]=R[n2]=SENTINEL;//番兵設置
  int i=0;
  int j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j]){
      S[k]=L[i];
      i=i+1;
      counter++;
    }
    else{
      S[k]=R[j];
      j=j+1;
      counter++;
    }
  }
}
 
void Merge_Sort(long long S[],int left,int right){//擬似コードに従った,Merge_Sort
  
  if(left+1<right){
    int mid = (left+right)/2;
    Merge_Sort(S,left,mid);
    Merge_Sort(S,mid,right);
    Merge(S,left,mid,right);
  }
}
 
 
 
int main(){
  int n;
  ll S[600000];
 
  cin >> n;
    for(int i=0;i<n;i++){
      cin >> S[i];
    }
 
    Merge_Sort(S,0,n);
 
    for(int i=0;i<n;i++){
      cout << S[i];
      if(i != n-1)cout << " ";
    }
    cout << endl;
    cout << counter << endl;
 
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:66:12: error: expected '}' at end of input
   66 |   return 0;
      |            ^
a.cc:48:11: note: to match this '{'
   48 | int main(){
      |           ^
Language: C++

#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
ll A[500010];
int cnt = 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]=INF;
	R[n2]=INF;
	int i = 0;
	int j = 0;
	for(int k = left;k <=right-1;k++){
		if(L[i]<=R[j]){
			A[k] =L[i];
			i++;
			cnt++;
		}else{
			A[k] = R[j];
			j++;
			cnt++;
		}
	}
}
void merge_sort(int *A,int left,int right){
	if(left+1<right){
		int mid = (left+right)/2;
		merge_sort(A,left,mid);
		merge_sort(A,mid,right);
		merge(A,left,mid,right);
	}
}
int main(){
	int n;
	cin>>n;
	for(int i = 0;i < n;i++){
		cin>>A[i];
	}
	int left = 0;
	int right = n;
	merge_sort(A,left,right);
	for(int i = 0;i < n;i++){
		cout <<A[i];
		if(i!=n-1){
			cout <<" ";
		}else{
			cout <<endl;
		}
	}
	cout <<cnt<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:84:20: error: cannot convert 'll*' {aka 'long long int*'} to 'int*'
   84 |         merge_sort(A,left,right);
      |                    ^
      |                    |
      |                    ll* {aka long long int*}
a.cc:68:22: note:   initializing argument 1 of 'void merge_sort(int*, int, int)'
   68 | void merge_sort(int *A,int left,int right){
      |                 ~~~~~^
Language: C++

#include<cstdio>
#include<iostream>

#define NMAX 5000
#define SENTINEL INT_MAX

int cnt=0;

using namespace std;

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

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

int main(void){

	int n;
	int A[NMAX];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	merge_sort(A,0,n);
	for(int i=0;i<n-1;i++){
		cout<<A[i]<<" ";
	}
	cout<<A[n-1]<<endl;
	cout<<cnt<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:5:18: error: 'INT_MAX' was not declared in this scope
    5 | #define SENTINEL INT_MAX
      |                  ^~~~~~~
a.cc:21:15: note: in expansion of macro 'SENTINEL'
   21 |         L[n1]=SENTINEL;
      |               ^~~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<iostream>
  +++ |+#include <climits>
    3 |
Language: C++

#include<stdio.h>
int merge(int arr[], int l, int m, int h);
int merge_sort(int arr[],int low,int high);
int p=0;

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

    for(i = 0; i < n; i++)
        printf("%d ", arr[i]);
        printf("/n%d\n",p);
        getch();
    return 0;
}

int merge(int arr[], int l, int m, int h)
{
    int arr1[100], arr2[100];
    int n1, n2, i, j, k;
    n1 = m - l + 1;   
    n2 = h - m;       

    for(i = 0; i < n1; i++)       
        arr1[i] = arr[l + i];

    for(j = 0; j < n2; j++)     
        arr2[j] = arr[m + j + 1];

    arr1[i] = 9999;    
    arr2[j] = 9999;

    i = 0;
    j = 0;

    for(k = l; k <= h; k++)      
    {
        if(arr1[i] <= arr2[j])
            arr[k] = arr1[i++];
        else
            arr[k] = arr2[j++];
            p++;
}
    return 0;
}
int merge_sort(int arr[],int low,int high)
{
    int mid;
    if(low < high) 
    {
        mid = (low + high) / 2;          
        merge_sort(arr, low, mid);
        merge_sort(arr, mid + 1, high);
        merge(arr, low, mid, high);     
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: expected unqualified-id before ';' token
    8 |     int i,n,;
      |             ^
a.cc:18:9: error: 'getch' was not declared in this scope; did you mean 'getc'?
   18 |         getch();
      |         ^~~~~
      |         getc
Language: C++

#include<stdio.h>

int merge(int arr[], int l, int m, int h);
int merge_sort(int arr[],int low,int high);
int p=0;

int main()
{    
    int i,n,;
    scanf("%d",&n);
    int arr[n];
    for(i=0;i<n;i++){
    scanf("%d",&arr[i]);}
    merge_sort(arr, 0, n-1);

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

int merge(int arr[], int l, int m, int h)
{
    int arr1[100], arr2[100];
    int n1, n2, i, j, k,f=9999;
    n1 = m - l + 1;   
    n2 = h - m;       

    for(i = 0; i < n1; i++) {      
        arr1[i] = arr[l + i];}

    for(j=0;j<n2;j++){     
        arr2[j] = arr[m+j+1];}

    arr1[i] = f;    
    arr2[j] = f;

    i = 0;
    j = 0;

    for(k = l; k <= h; k++)      
    {
        if(arr1[i] <= arr2[j]){
            arr[k] = arr1[i++];}
        else{
            arr[k] = arr2[j++];}
            p++;
    }
    return 0;
}
int merge_sort(int arr[],int low,int high)
{
    int mid;
    if(low < high) 
    {
        mid = (low + high) / 2;          
        merge_sort(arr, low, mid);
        merge_sort(arr, mid + 1, high);
        merge(arr, low, mid, high);     
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: expected unqualified-id before ';' token
    9 |     int i,n,;
      |             ^
Language: Java

import java.io.*;

public class Algo19{

	// Point class
	static class Point{
		public double x;
		public double y;

		public Point(double x, double y){
			this.x = x;
			this.y = y;
		}

		public Point(Point p){
			x = p.x;
			y = p.y;
		}

		public void printPoint(){
			System.out.printf("%.8f %.8f\n", x, y);
		}
	}

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n;
		Point zero = new Point(0, 0);
		Point hyaku = new Point(100, 0);
		int i, j, k;

		n = Integer.parseInt(br.readLine());
		
		zero.printPoint();
		divisionPoint(n, zero, hyaku);
		hyaku.printPoint();
	}

	static void divisionPoint(int n, Point p1, Point p2){
		double x = p2.x - p1.x;
		double y = p2.y - p1.y;

		Point s = new Point((x/3)+p1.x, (y/3)+p1.y);
		Point t = new Point(2*(x/3)+p1.x, 2*(y/3)+p1.y);
		Point u = new Point(getKoch(s, t));

		if(n > 0){
			divisionPoint(n-1, p1, s);
			s.printPoint();

			divisionPoint(n-1, s, u);
			u.printPoint();

			divisionPoint(n-1, u, t);
			t.printPoint();

			divisionPoint(n-1, t, p2);
		}
	}

	static Point getKoch(Point s, Point t){
		double x = t.x - s.x;
		double y = t.y - s.y;

		double moveX = (Math.cos(Math.toRadians(60)) * x - Math.sin(Math.toRadians(60)) * y) + s.x;
		double moveY = (Math.sin(Math.toRadians(60)) * x + Math.cos(Math.toRadians(60)) * y) + s.y;

		Point u = new Point(moveX, moveY);
		return u;
	}
}

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

import java.io.IOException;
import java.util.Scanner;

class Main {
	static final int INF = 1000000001;

	static int changecount;
   public static void main(String args[]) throws IOException{

      Scanner sc = new Scanner(System.in);

	   int n = Integer.parseInt( sc.next()  );

	   Cood p1 = new Cood(0 , 0);
 	   Cood p2 = new Cood(100 , 0);

 	   p1.printCood();
	   kock(n , p1, p2);
       p2.printCood();

	   sc.close();
   }


   public static void kock(int n, Cood p1, Cood p2){

      if( n == 0){
    	  return;
      }

      Cood s = new Cood( (2*p1.x + 1*p2.x)/3    ,   (2*p1.y + 1*p2.y)/3  );
      Cood t = new Cood( (1*p1.x + 2*p2.x)/3    ,   (1*p1.y + 2*p2.y)/3  );
      Cood u = new Cood( (t.x - s.x)*Math.cos(Math.toRadians(60)) - (t.y - s.y)*Math.sin( Math.toRadians(60) )+s.x  ,  (t.x - s.x)*Math.sin( Math.toRadians(60) ) + (t.y - s.y)*Math.cos( Math.toRadians(60) )+s.y  );

      kock(n-1, p1, s);
      s.printCood();
      kock(n-1, p1, u);
      u.printCood();
      kock(n-1, p1, t);
      t.printCood();
      kock(n-1, t, p2);
   }

}



class Cood{

	double x;
	double y;

    Cood(double X, double Y){
    	x = X;
    	y = Y;
    }

	void printCood(){
		System.out.print(String.format("%05f ", x) );
		System.out.println(String.format("%05f", y) );
	}

Compiler output:
Main.java:61: error: reached end of file while parsing
	}
	 ^
1 error
Language: Java

import java.util.Scanner;

public class ALDS1_5_C {

	public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        double[] p1 = {0, 0};
        double[] p2 = {100, 0};
        print(p1);
        koch(n, p1, p2);
        print(p2);

	}

	static void koch(int n, double[] p1, double[] p2) {
		if(n == 0)
			return;

		double[] s = { (2*p1[0]+1*p2[0])/3,  (2*p1[1]+1*p2[1])/3 };
		double[] t = { (1*p1[0]+2*p2[0])/3,  (1*p1[1]+2*p2[1])/3 };
		double[] u = { (t[0]-s[0]) * Math.cos(Math.toRadians(60)) - (t[1]-s[1]) * Math.sin(Math.toRadians(60)) + s[0]
						,(t[0]-s[0]) * Math.sin(Math.toRadians(60)) + (t[1]-s[1]) * Math.cos(Math.toRadians(60)) + s[1] };

		koch(n-1, p1, s);
		print(s);
		koch(n-1, s, u);
		print(u);
		koch(n-1, u, t);
		print(t);
		koch(n-1, t, p2);
	}

	private static void print(double[] s) {
		System.out.println(s[0] + " " + s[1]);
	}
}



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

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

struct Point{
 double x,y;
};

void koch(int n, Point a, Point b){
 if(n == 0) return;
 Point s,t,u;
 double th = M_PI * 60.0 / 180.0;
 
 s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
 s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
 t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
 t.y = (1.0 * a.x + 2.0 * b.y) / 3.0;
 u.x = (t.x - s.x)*cos(th) - (t.y-s.y)*sin(th)+s.x;
 u.x = (t.x - s.x)*sin(th) - (t.y-s.y)*cos(th)+s.y;
 
 koch(n-1, a, s);
 printf("%.8f %.8f\n", s.x, s.y);
 koch(n-1, s, u);
 printf("%.8f %.8f\n", u.x, u.y);
 koch(n-1, u, t);
 printf("%.8f %.8f\n", t.x, t.y);
 koch(n-1, t, b);
}

int main(){
 Point a,b;
 int n;
 scanf("%d",&n);

 a.x=0;
 a.y=0;
 b.x=100;
 b.y=0;

 printf("%.8f %.8f\n",a.x,a.y);
 koch(n,a,b);
 printf("%.8f %.8f\n",b.x,b.y);

 return 0;
}


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: '#'
#include<math.h>
^
Main.java:6: error: class, interface, enum, or record expected
};
^
Main.java:8: error: unnamed classes are a preview feature and are disabled by default.
void koch(int n, Point a, Point b){
^
  (use --enable-preview to enable unnamed classes)
Main.java:32: error: illegal start of expression
 scanf("%d",&n);
            ^
6 errors
Language: C

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

typedef struct Point{
  double x, y;
} Point;

void koch(int n, Point p1, Point p2){
  if (n == 0) {return;}

  Point s, t, u;
  double an = M_PI * 60.0 / 180.0;

// p1, p2 から s, t, u を計算

  s.x = (2.0*p1.x + 1.0*p2.x) / 3.0;
  s.y = (2.0*p1.y + 1.0*p2.y) / 3.0;
  t.x = (1.0*p1.x + 2.0*p2.x) / 3.0;
  t.y = (1.0*p1.y + 2.0*p2.y) / 3.0;
  u.x = (t.x - s.x)*cos(an) - (t.y - s.y)*sin(an) + s.x;
  u.y = (t.x - s.x)*sin(an) + (t.y - s.y)*cos(an) + s.y;

  koch(n - 1, p1, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n - 1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n - 1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n - 1, t, p2);
}


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

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

struct Point {double x, y; };

void coch(Point p1, Point p2, int n) {
  double th = M_PI * 60.0 / 180.0;

  if (n == 0)
    return;

  Point s, t, u;

  s.x = (2 * p1.x + p2.x) / 3;
  s.y = (2 * p1.y + p2.y) / 3;

  t.x = (p1.x + 2 * p2.x) / 3;
  t.y = (p1.y + 2 * p2.y) / 3;

  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

  printf("%.8f %.8f\n", s.x, s.y);
  coch(p1, s, n - 1);

  printf("%.8f %.8f\n", u.x, u.y);
  coch(s, u, n - 1);

  printf("%.8f %.8f\n", t.x, t.y);
  coch(t, p2, n - 1);

}

int main() {
  int n;
  Point a, b;

  a.x = 0;
  a.y = 0;

  b.x = 100;
  b.y = 0;

  cin >> n;

  printf("%.8f %.8f\n", a.x, a.y);
  coch(a, b, n);
  printf("%.8f %.8f\n", b.x, b.y);

  return 0;

}



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

#include<stdio.h>
#include<math.h>
#define pie 3.1415926535897

 void koch(int n,int p1x,int p1y,int p2x,int p2y){
       int sx,sy,tx,ty,ux,uy;
       if(n==0)return;
       th=pie*60/180;
       sx=(p1x*2+p2x*1)/3;
       sy=(p1y*2+p2y*1)/3;
       tx=(p1x*1+p2x*2)/3;
       ty=(p1y*1+p2y*2)/3;
       ux=(tx-sx)*cos(th)-(ty-sy)*sin(th);
       uy=(tx-sx)*sin(th)+(ty-sy)*cos(th);
       koch(n-1,p1x,p1y,sx,sy);
       printf("%d %d\n",sx,sy);
       koch(n-1,sx,sy,ux,uy);
       printf("%d %d\n",ux,uy);
       koch(n-1,ux,uy,tx,ty);
       printf("%d %d\n",tx,ty);
       koch(n-1,tx,ty,p2x,p2y);
       }
                   

 int main(){
       int n;
       int p1x;
       int p1y;
       int p2x;
       int p2y;
       p1x=0.0;
       p1y=0.0;
       p2x=100.0;
       p2y=0.0;
       
       scanf("%d",&n);
       printf("%d %d\n",p1x,p1y);
       koch(n);
       printf("%d %d\n",p2x,p2y);
       return 0;
       }
       


Compiler output:
main.c: In function 'koch':
main.c:8:8: error: 'th' undeclared (first use in this function); did you mean 'ty'?
    8 |        th=pie*60/180;
      |        ^~
      |        ty
main.c:8:8: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:38:8: error: too few arguments to function 'koch'
   38 |        koch(n);
      |        ^~~~
main.c:5:7: note: declared here
    5 |  void koch(int n,int p1x,int p1y,int p2x,int p2y){
      |       ^~~~
Language: C

#include<stdio.h>
#include<math.h>
#define pie 3.1415926535897

 void koch(int n,int p1x,int p1y,int p2x,int p2y){
       int sx,sy,tx,ty,ux,uy,th;
       if(n==0)return;
       th=pie*60/180;
       sx=(p1x*2+p2x*1)/3;
       sy=(p1y*2+p2y*1)/3;
       tx=(p1x*1+p2x*2)/3;
       ty=(p1y*1+p2y*2)/3;
       ux=(tx-sx)*cos(th)-(ty-sy)*sin(th);
       uy=(tx-sx)*sin(th)+(ty-sy)*cos(th);
       koch(n-1,p1x,p1y,sx,sy);
       printf("%d %d\n",sx,sy);
       koch(n-1,sx,sy,ux,uy);
       printf("%d %d\n",ux,uy);
       koch(n-1,ux,uy,tx,ty);
       printf("%d %d\n",tx,ty);
       koch(n-1,tx,ty,p2x,p2y);
       }
                   

 int main(){
       int n;
       int p1x;
       int p1y;
       int p2x;
       int p2y;
       p1x=0.0;
       p1y=0.0;
       p2x=100.0;
       p2y=0.0;
       
       scanf("%d",&n);
       printf("%d %d\n",p1x,p1y);
       koch(n);
       printf("%d %d\n",p2x,p2y);
       return 0;
       }
       


Compiler output:
main.c: In function 'main':
main.c:38:8: error: too few arguments to function 'koch'
   38 |        koch(n);
      |        ^~~~
main.c:5:7: note: declared here
    5 |  void koch(int n,int p1x,int p1y,int p2x,int p2y){
      |       ^~~~
Language: C

#include<stdio.h>
#include<math.h>
#define pie 3.1415926535897

 void koch(int n,double p1x,double p1y,double p2x,double p2y){
       double sx,sy,tx,ty,ux,uy,th;
       if(n==0)return;
       th=pie*60/180;
       sx=(p1x*2+p2x*1)/3.0;
       sy=(p1y*2+p2y*1)/3.0;
       tx=(p1x*1+p2x*2)/3.0;
       ty=(p1y*1+p2y*2)/3.0;
       ux=(tx-sx)*cos(th)-(ty-sy)*sin(th);
       uy=(tx-sx)*sin(th)+(ty-sy)*cos(th);
       koch(n-1,p1x,p1y,sx,sy);
       printf("%f %f\n",sx,sy);
       koch(n-1,sx,sy,ux,uy);
       printf("%f %f\n",ux,uy);
       koch(n-1,ux,uy,tx,ty);
       printf("%f %f\n",tx,ty);
       koch(n-1,tx,ty,p2x,p2y);
       }
                   

 int main(){
       int n;
       double p1x;
       double p1y;
       double p2x;
       double p2y;
       p1x=0.0;
       p1y=0.0;
       p2x=100.0;
       p2y=0.0;
       
       scanf("%d",&n);
       printf("%f %f\n",p1x,p1y);
       koch(n);
       printf("%f %f\n",p2x,p2y);
       return 0;
       }
       


Compiler output:
main.c: In function 'main':
main.c:38:8: error: too few arguments to function 'koch'
   38 |        koch(n);
      |        ^~~~
main.c:5:7: note: declared here
    5 |  void koch(int n,double p1x,double p1y,double p2x,double p2y){
      |       ^~~~
Language: C

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

typedef struct{
  double x;
  double y;
} Point;

void kohho(Point,Point,int);

int main(){
  int n;
  Point p1={0.0,0.0},p2={100.0,0.0};

  scanf("%d",&n);

  printf("%f\n",p1);
  kohho(p1,p2,n);
  printf("%f\n",p2);

  return 0;
}

void kohho(Point p1,Point p2,int n){
  Point s,t,u;
  int a,b,c,d;

  if(n==0) return;

  s.x=(p2.x+(2*p1.x))/3;
  s.y=(p2.x+(2*p1.y))/3;  

  t.x=((2*p2.x)+p1.x)*2/3;
  t.y=((2*p2.x)+p1.y)*2/3;

  u.x=(t.x−s.x)×cos(60)−(t.y−s.y)×sin(60)+s.x;
  u.y=(t.x−s.x)×sin(60)+(t.y−s.y)×cos(60)+s.y;

  kohho(p1,s,n-1);
  printf("%f\n",s);
  kohho(s,u,n-1);
  printf("%f\n",u);
  kohho(u,t,n-1); 
  printf("%f\n",t);
  kohho(t,p2,n-1); 

}



  
  
  
  



Compiler output:
main.c: In function 'kohho':
main.c:37:11: error: stray '\342' in program
   37 |   u.x=(t.x<U+2212>s.x)<U+00D7>cos(60)<U+2212>(t.y<U+2212>s.y)<U+00D7>sin(60)+s.x;
      |           ^~~~~~~~
main.c:37:11: error: expected ')' before 's'
   37 |   u.x=(t.x−s.x)×cos(60)−(t.y−s.y)×sin(60)+s.x;
      |       ~   ^~
      |           )
main.c:37:16: error: stray '\303' in program
   37 |   u.x=(t.x<U+2212>s.x)<U+00D7>cos(60)<U+2212>(t.y<U+2212>s.y)<U+00D7>sin(60)+s.x;
      |                       ^~~~~~~~
main.c:37:16: error: expected ';' before 'cos'
   37 |   u.x=(t.x−s.x)×cos(60)−(t.y−s.y)×sin(60)+s.x;
      |                ^~~~
      |                ;
main.c:37:24: error: stray '\342' in program
   37 |   u.x=(t.x<U+2212>s.x)<U+00D7>cos(60)<U+2212>(t.y<U+2212>s.y)<U+00D7>sin(60)+s.x;
      |                                      ^~~~~~~~
main.c:37:29: error: stray '\342' in program
   37 |   u.x=(t.x<U+2212>s.x)<U+00D7>cos(60)<U+2212>(t.y<U+2212>s.y)<U+00D7>sin(60)+s.x;
      |                                                  ^~~~~~~~
main.c:37:34: error: stray '\303' in program
   37 |   u.x=(t.x<U+2212>s.x)<U+00D7>cos(60)<U+2212>(t.y<U+2212>s.y)<U+00D7>sin(60)+s.x;
      |                                                              ^~~~~~~~
main.c:38:11: error: stray '\342' in program
   38 |   u.y=(t.x<U+2212>s.x)<U+00D7>sin(60)+(t.y<U+2212>s.y)<U+00D7>cos(60)+s.y;
      |           ^~~~~~~~
main.c:38:11: error: expected ')' before 's'
   38 |   u.y=(t.x−s.x)×sin(60)+(t.y−s.y)×cos(60)+s.y;
      |       ~   ^~
      |           )
main.c:38:16: error: stray '\303' in program
   38 |   u.y=(t.x<U+2212>s.x)<U+00D7>sin(60)+(t.y<U+2212>s.y)<U+00D7>cos(60)+s.y;
      |                       ^~~~~~~~
main.c:38:16: error: expected ';' before 'sin'
   38 |   u.y=(t.x−s.x)×sin(60)+(t.y−s.y)×cos(60)+s.y;
      |                ^~~~
      |                ;
main.c:38:29: error: stray '\342' in program
   38 |   u.y=(t.x<U+2212>s.x)<U+00D7>sin(60)+(t.y<U+2212>s.y)<U+00D7>cos(60)+s.y;
      |                                           ^~~~~~~~
main.c:38:34: error: stray '\303' in program
   38 |   u.y=(t.x<U+2212>s.x)<U+00D7>sin(60)+(t.y<U+2212>s.y)<U+00D7>cos(60)+s.y;
      |                                                       ^~~~~~~~
Language: C

#include<stdio.h>
#include<math.h>
 
int koch(double x1,double y1,double x2,double y2,int n){

  if(n==0){
    printf("%f %f\n",x2,y2);
    return 0;
  }

  double Ax,Ay,Bx,By,Cx,Cy;
  Ax=(x2-x1)/3+x1;
  Ay=(y2-y1)/3+y1;
  Bx=(x2-x1)*2/3+x1;
  By=(y2-y1)*2/3+y1;
  Ux=(cos(M_PI/3)*(Bx-Ax)-sin(M_PI/3)*(By-Ay))+Ax;
  Uy=(sin(M_PI/3)*(Bx-Ax)+cos(M_PI/3)*(By-Ay))+Ay;
  koch(x1, y1, Ax, Ay, n-1);
  koch(Ax, Ay, Cx, Cy, n-1);
  koch(Cx, Cy, Bx, By, n-1);
  koch(Bx, By, x2, y2, n-1);
   
}


int main(){
  int n;
  double x1=0,y1=0,x2=100,y2=0;
  scanf("%d",&n);
  printf("0.00000000 0.00000000\n");
  koch(x1,y1,x2,y2,n);
  return 0;
}

Compiler output:
main.c: In function 'koch':
main.c:16:3: error: 'Ux' undeclared (first use in this function); did you mean 'Cx'?
   16 |   Ux=(cos(M_PI/3)*(Bx-Ax)-sin(M_PI/3)*(By-Ay))+Ax;
      |   ^~
      |   Cx
main.c:16:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:3: error: 'Uy' undeclared (first use in this function); did you mean 'Cy'?
   17 |   Uy=(sin(M_PI/3)*(Bx-Ax)+cos(M_PI/3)*(By-Ay))+Ay;
      |   ^~
      |   Cy
Language: C

#include <stdio.h>
#include <math.h>
 
typedef struct{
  double x;
  double y;
}P;
 
void kock(int, P, P);
 
int main(){
 
  int n;
  P p1 = {0.0, 0.0}, p2 = {100.0, 0.0};
 
  scanf("%d", &n);
 
  printf("%f %f\n", p1.x, p1.y);
 
  kock(n, p1, p2);
 
  printf("%f %f\n", p2.x, p2.y);
 
  return 0;
}
 
void kock(int n, P p1, P p2){
 
  P s, t, u;
 
  if(n == 0) return 0;
 
  s.x = (p1.x * 2 + p2.x) / 3;
  s.y = (p1.y * 2 + p2.y) / 3;
  t.x = (p1.x + p2.x * 2) / 3;
  t.y = (p1.y + p2.y * 2) / 3;
  u.x = (t.x - s.x) * cos(M_PI / 3) - (t.y - s.y) * sin(M_PI / 3) + s.x;
  u.y = (t.x - s.x) * sin(M_PI / 3) + (t.y - s.y) * cos(M_PI / 3) + s.y;
 
  kock(n-1, p1, s);
  printf("%f %f\n", s.x, s.y);
  kock(n-1, s, u);
  printf("%f %f\n", u.x, u.y);
  kock(n-1, u, t);
  printf("%f %f\n", t.x, t.y);
  kock(n-1, t, p2);
 
}


 

A

Compiler output:
main.c: In function 'kock':
main.c:31:21: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   31 |   if(n == 0) return 0;
      |                     ^
main.c:27:6: note: declared here
   27 | void kock(int n, P p1, P p2){
      |      ^~~~
main.c: At top level:
main.c:53:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
   53 | A
      | ^
Language: C

#include<stdio.h>
#include<math.h>
void koch(double, double, double, double, int);
main()
{
  scanf("%d",&n);

  printf("%f %f\n",0.0, 0.0);

  koch(0.0, 0.0, 100.0, 0.0);

  printf("%f %f\n",100.0, 0.0);

  return 0;
}

void koch(double p1x, double p1y, double p2x, double p2y, int c)
{
  double sx, sy, tx, ty, ux, uy;

  if(x != 0)
    {
      sx = (2 * p1x + p2x) / 3;
      sy = (2 * p1y + p2y) / 3;
      tx = (p1x + 2 * p2x) / 3;
      ty = (p1y + 2 * p2y) / 3;
      ux = sx + (tx - sx) * cos(M_PI/3) - (ty - sy) * sin(M_PI/3);
      uy = sy + (tx - sx) * sin(M_PI/3) + (ty - sy) * cos(M_PI/3);

      koch(p1x, p1y, sx, sy, c - 1);
      printf("%f %f\n", sx, sy);
      koch(sx, sy, ux, uy, c - 1);
      printf("%f %f\n", ux, uy); 
      koch(ux, uy, tx, ty, c - 1);
      printf("%f %f\n", tx,ty);
      koch(tx, ty, p2x, p2y, c - 1);
    }
}

Compiler output:
main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
    4 | main()
      | ^~~~
main.c: In function 'main':
main.c:6:15: error: 'n' undeclared (first use in this function); did you mean 'yn'?
    6 |   scanf("%d",&n);
      |               ^
      |               yn
main.c:6:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:3: error: too few arguments to function 'koch'
   10 |   koch(0.0, 0.0, 100.0, 0.0);
      |   ^~~~
main.c:3:6: note: declared here
    3 | void koch(double, double, double, double, int);
      |      ^~~~
main.c: In function 'koch':
main.c:21:6: error: 'x' undeclared (first use in this function); did you mean 'ux'?
   21 |   if(x != 0)
      |      ^
      |      ux
Language: C

#include<stdio.h>
#include<math.h>
void koch(double, double, double, double, int);
main()
{
  int n;

  scanf("%d",&n);

  printf("%f %f\n", 0.0, 0.0);

  koch(0.0, 0.0, 100.0, 0.0);

  printf("%f %f\n",100.0, 0.0);

  return 0;
}

void koch(double p1x, double p1y, double p2x, double p2y, int c)
{
  double sx, sy, tx, ty, ux, uy;

  if(x != 0)
    {
      sx = (2 * p1x + p2x) / 3;
      sy = (2 * p1y + p2y) / 3;
      tx = (p1x + 2 * p2x) / 3;
      ty = (p1y + 2 * p2y) / 3;
      ux = sx + (tx - sx) * cos(M_PI/3) - (ty - sy) * sin(M_PI/3);
      uy = sy + (tx - sx) * sin(M_PI/3) + (ty - sy) * cos(M_PI/3);

      koch(p1x, p1y, sx, sy, c - 1);
      printf("%f %f\n", sx, sy);
      koch(sx, sy, ux, uy, c - 1);
      printf("%f %f\n", ux, uy); 
      koch(ux, uy, tx, ty, c - 1);
      printf("%f %f\n", tx,ty);
      koch(tx, ty, p2x, p2y, c - 1);
    }
}

Compiler output:
main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
    4 | main()
      | ^~~~
main.c: In function 'main':
main.c:12:3: error: too few arguments to function 'koch'
   12 |   koch(0.0, 0.0, 100.0, 0.0);
      |   ^~~~
main.c:3:6: note: declared here
    3 | void koch(double, double, double, double, int);
      |      ^~~~
main.c: In function 'koch':
main.c:23:6: error: 'x' undeclared (first use in this function); did you mean 'ux'?
   23 |   if(x != 0)
      |      ^
      |      ux
main.c:23:6: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<math.h>
void koch(double, double, double, double, int);
main()
{
  int n;

  scanf("%d",&n);

  printf("%f %f\n", 0.0, 0.0);

  koch(0.0, 0.0, 100.0, 0.0, n);

  printf("%f %f\n",100.0, 0.0);

  return 0;
}

void koch(double p1x, double p1y, double p2x, double p2y, int c)
{
  double sx, sy, tx, ty, ux, uy;

  if(x != 0)
    {
      sx = (2 * p1x + p2x) / 3;
      sy = (2 * p1y + p2y) / 3;
      tx = (p1x + 2 * p2x) / 3;
      ty = (p1y + 2 * p2y) / 3;
      ux = sx + (tx - sx) * cos(M_PI/3) - (ty - sy) * sin(M_PI/3);
      uy = sy + (tx - sx) * sin(M_PI/3) + (ty - sy) * cos(M_PI/3);

      koch(p1x, p1y, sx, sy, c - 1);
      printf("%f %f\n", sx, sy);
      koch(sx, sy, ux, uy, c - 1);
      printf("%f %f\n", ux, uy); 
      koch(ux, uy, tx, ty, c - 1);
      printf("%f %f\n", tx,ty);
      koch(tx, ty, p2x, p2y, c - 1);
    }
}

Compiler output:
main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
    4 | main()
      | ^~~~
main.c: In function 'koch':
main.c:23:6: error: 'x' undeclared (first use in this function); did you mean 'ux'?
   23 |   if(x != 0)
      |      ^
      |      ux
main.c:23:6: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

#define RtD(radian) ((radian)*(180.0f/M_PI))

void moveXY( double *x, double *y, double mx, double my, double si, double co )
{
    double xy[3][1] = { {*x},
                        {*y},
                        {1}, };
    double r[3][3] = { { co, -si, 0 },
                    { si, co, 0 },
                    { 0, 0, 1 } };
    double m[3][3] = { { 1, 0, mx },
                    { 0, 1, my },
                    { 0, 0, 1 } };    
    int i,j,k;
    double a[3][3] = { {0} };
    for( i=0; i<3; i++ ) {
        for( j=0; j<3; j++ ) {
            for( k=0; k<3; k++ ) {
                a[i][j] += m[i][k]*r[k][j];
            }
        }
    }

    double b[3][1] = { {0} };          
    for( i=0; i<3; i++ ) {
        for( j=0; j<3; j++ ) {
            b[i][0] += a[i][j]*xy[j][0];
        }
    }


    *x = b[0][0];
    *y = b[1][0];
    return;
}



void kochCurve( int n, double px, double py, double px2, double py2 )
{       
    double sx, sy;
    double ux, uy;
    double tx, ty;
    double d = sqrt( pow( px2-px, 2 ) + pow( py2-py, 2 ) );
    
    sx = d/3;
    ux = d/2;
    tx = sx*2;
    sy = ty = 0;
    uy = sin( DtR(60) )*sx;
    
    double si=0;
    double co=0;
    
    if( px < px2 ) {
        if( py == py2 ) {
            si = sin( DtR(0) );
            co = cos( DtR(0) );            
        } else if( py < py2 ) {
            si = sin( DtR(60) );
            co = cos( DtR(60) );            
        } else if( py2 < py ) {
            si = sin( DtR(-60) );
            co = cos( DtR(-60) );
        }
    } else if( px2 < px ) {
        if( py == py2 ) {
            si = sin( DtR(-180) );
            co = cos( DtR(-180) );                 
        } else if( py2 < py ) {
            si = sin( DtR(-120) );
            co = cos( DtR(-120) );
        } else if( py < py2 ) {
            si = sin( DtR(-240) );
            co = cos( DtR(-240) );            
        }
    }


    moveXY( &sx, &sy, px, py, si, co );
    moveXY( &ux, &uy, px, py, si, co );
    moveXY( &tx, &ty, px, py, si, co );
    
    if( 1 < n ) {
        kochCurve( n-1, px, py, sx, sy );
    }

    printf( "%f %f\n", sx, sy );
    if( 1 < n ) {
        kochCurve( n-1, sx, sy, ux, uy );
    }
    
    printf( "%f %f\n", ux, uy );
    if( 1 < n ) {
        kochCurve( n-1, ux, uy, tx, ty );
    }
 
    printf( "%f %f\n", tx, ty );
    if( 1 < n ) {
        kochCurve( n-1, tx, ty, px2, py2 );
    }

	return;
}

int main()
{
	int n;
    
	scanf( "%d", &n );

    printf( "%f %f\n", 0.0, 0.0 );
    if( 1 <= n ) {
	   kochCurve( n, 0, 0, 100.0, 0.0 );
    }
    printf( "%f %f\n", 100.0, 0.0 );

	return 0;
}

Compiler output:
main.c: In function 'kochCurve':
main.c:53:15: error: implicit declaration of function 'DtR' [-Wimplicit-function-declaration]
   53 |     uy = sin( DtR(60) )*sx;
      |               ^~~