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

#include <stdio.h>

int main(void){
  int N, v, i, j, k, m;
  scanf("%d", &N);
  int A[N];

  //配列に入力値を代入する
  for(k = 0; k < N; k++){
    scanf("%d", &A[k]);
  }

  //for文ではiを右にずらし、while文ではソート済みの配列をずらしている
  for(i = 1; i < N; i++){
    
    for(m = 0; m < N; m++){
      if(m > 0) printf(" ");
      printf("%d",A[m]);
    }
    printf("\n");
    
    v = A[i];
    j = i - 1;
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;


  }

  for(m = 0; m < N; m++){
    #include <stdio.h>

int main(void){
  int N, v, i, j, k, m;
  scanf("%d", &N);
  int A[N];

  //配列に入力値を代入する
  for(k = 0; k < N; k++){
    scanf("%d", &A[k]);
  }

  //for文ではiを右にずらし、while文ではソート済みの配列をずらしている
  for(i = 1; i < N; i++){
    
    for(m = 0; m < N; m++){
      if(m > 0) printf(" ");
      printf("%d",A[m]);
    }
  printf("\n");
  return 0;
}



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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <vector>
#define CL(a) memset(a,0,sizeof(a))
#define cl(a,b) memset(a,(b),sizeof(a))
#define For(i,a,b) for(i=a;i<b;i++)
#define LL long long 
using namespace std;
int a[200];
int n;
void print(int * a){
	printf("%d",a[0]);
	for(int i=1;i<n;i++)
		printf(" %d",a[i]);
	printf("\n");
} 
int main()
{
	int i,j,k;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",a+i);

	for(i=1;i<n;i++){
		k = a[i]; 
		j = i-1;
		while(j>=0&&a[j]>k){
			a[j+1] = a[j]; 
			j--; 
		}
		a[j+1] = k;
		print(a);
	}
	return 0;
}


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

#define _CRT_SECURE_NO_WARNINGS


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<set>

using std::cout;
using std::endl;
using std::cin;
using std::sort;
using std::queue;
using std::stack;
using std::set;


void print(int a[], int n)
{
	for (int i = 0; i < n; i++)
		cout << a[i] << " ";
	cout << endl;
}

int main(int argc, char** argv)
{
	if (argc == 2 && strcmp(argv[1], "-debug") == 0)
	{
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}


	int n;
	int a[100];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	print(a, n);
	for (int i = 1; i < n; i++)
	{
		for (int j = i; j > 0; j--)
		{
			if (a[j] < a[j - 1])
				std::swap(a[j], a[j - 1]);
		}
		print(a, n);
	}







	return 0;
}



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

#include<stdio.h>

int main(void){
  int i,j;
  int key;
  int A[];
  int N;

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

    for(i=0;i<N;i++){
      if(i>0)printf(" ");
      printf("%d",A[i]);
    }

    printf("\n");

  for(j=1;j<N;j++){
    key=A[j];
    i=j-1;

    while(1){
      if(i>=0 && A[i]>key){
	A[i+1]=A[i];
	i=i-1;
      }
      else break;
    }

    A[i+1]=key;

    for(key=0;key<N;key++){
      if(key>0)printf(" ");
      printf("%d",A[key]);
    }

    printf("\n");

  }
  return 0;

}

Compiler output:
main.c: In function 'main':
main.c:6:7: error: array size missing in 'A'
    6 |   int A[];
      |       ^
Language: C

/*Insertion sort*/
#include<stdio.h>


int main(){
	int n,i,j;
	while(scanf("%d",&n){
		int a[n];
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);
		}
		for(i=0;i<n;i++){
			printf("%d ",a[i]);
		}
		printf("\n");
		for(i=0;i<n-1;i++){
		    j=i+1;
			while(j>0 && a[j]<a[j-1]){
				a[j-1]^=a[j];
				a[j]^=a[j-1];
				a[j-1]^=a[j];
				j--;
			}
            for(int k=0;k<n;k++){
                printf("%d ",a[k]);
            }
            printf("\n");
        }
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:29: error: expected ')' before '{' token
    7 |         while(scanf("%d",&n){
      |              ~              ^
      |                             )
main.c:31:1: error: expected expression before '}' token
   31 | }
      | ^
Language: C

#include<stdio.h>

int main(){
  int a,b,i;

  scanf("%d %d",&a,&b);
  
  if(a > b){
    for(i=b; i>= 0; i--){
      if((a%i == 0) && (b%i == 0)){
	printf("greatest common divisor is %d\n",i);
	break;
      }
    }
  }
  
  else{
    for(i=a; i>= 0; i--){
      if((a%i == 0) && (b%i == 0)){
	printf("greatest common divisor is %d\n",i);
	break;
      }
    }
  }

  return 0;

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

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,a;
  vector<int>v(1,0);
  cin >> n;
  while(n--){
    cin >> a;
    v.push_back(a);
  }
  for(int j=2;j<v.size();j++){
    int key = v[j],i = j - 1;
    while(i > 0 && v[i] > key){
      v[i+1] = v[i];
      i--;
    }
    v[i+1] = key;
    for(int j=1;j<v.size();j++){
      cout << (j==1?"":" ") << v[j];
    }
    cout << endl;
  }
}

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

import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	int n=Integer.parseInt(input.readLine());
	
	String b=input.readLine();
	System.out.println(b);
	String  a[]=b.split(" ");
	int c[]=new int[n];
	
	for(int i=1;i<n;i++)
	    {
	for(int k=0;k<n;k++)
		    {
			System.out.print(c[k]+" ");
		    }
		int j=i;
		while(j>=1 && c[j-1]>c[j])
		    {

			int temp=c[j];
			c[j]=c[j-1];
			c[j-1]=temp;
			
			j--;

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

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.io.*;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.io.*;
      |            ^
main.c:2:1: error: unknown type name 'class'
    2 | class Main
      | ^~~~~
main.c:3:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    3 | {
      | ^
Language: C

#include<stdio.h>

static const int N = 1000;

void change(int *num,int *n){
	int i,j,temp;
	
	print(num,n);
	for(i=1;i<*n;i++){
		for(j=0;j<i;j++){
			if(*(num+i)<=*(num+j)){
				temp=*(num+i);
				move(num,&j,&i);
				*(num+j)=temp;
				break;
			}
		}
		print(num,n);
	}
}

void move(int *num,int *j,int *stop){
	int i,temp;

	for(i=*stop-1;i>=*j;i--){
		temp=*(num+i);
		*(num+i+1)=temp;
	}
}

void print(int *num,int *n){
	int i;

	for(i=0;i<*n;i++){
		printf("%d ",*(num+i));
	}
	printf("\n");
}
void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);
  change(num,&n);

  return 0;
}

Compiler output:
main.c: In function 'change':
main.c:8:9: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
    8 |         print(num,n);
      |         ^~~~~
      |         printf
main.c:13:33: error: implicit declaration of function 'move'; did you mean 'remove'? [-Wimplicit-function-declaration]
   13 |                                 move(num,&j,&i);
      |                                 ^~~~
      |                                 remove
main.c: At top level:
main.c:22:6: warning: conflicting types for 'move'; have 'void(int *, int *, int *)'
   22 | void move(int *num,int *j,int *stop){
      |      ^~~~
main.c:13:33: note: previous implicit declaration of 'move' with type 'void(int *, int *, int *)'
   13 |                                 move(num,&j,&i);
      |                                 ^~~~
main.c:31:6: warning: conflicting types for 'print'; have 'void(int *, int *)'
   31 | void print(int *num,int *n){
      |      ^~~~~
main.c:8:9: note: previous implicit declaration of 'print' with type 'void(int *, int *)'
    8 |         print(num,n);
      |         ^~~~~
main.c: In function 'main':
main.c:56:10: error: 'num' undeclared (first use in this function)
   56 |   change(num,&n);
      |          ^~~
main.c:56:10: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(void)
{
  int n,key,i,j;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i<n-1)
      printf("%c"," ");
  }
  printf("\n");
  for(j=1;j<n;j++){
    key=a[j];
    i=j-1
    while(i>0 && a[i]>key){
      a[i+1]=a[i];
      i--;
    }
    a[i+1]=key;
  }
  for(j=0;j<n;j++){
    printf("%d",a[j]);
    if (j+1!=n)
      printf(" ");
  }
  printf("\n");
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:17:10: error: expected ';' before 'while'
   17 |     i=j-1
      |          ^
      |          ;
   18 |     while(i>0 && a[i]>key){
      |     ~~~~~
Language: C

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



int main(void)
{
  int *A;
  int N,i,j,k,l,key;

  scanf("%d",&N);
  if(N<1 || N>100) return -1;
  A=malloc(sizeof(int)*N);
  for(i=0;i<N;i++)
    scanf("%d",&A[i]);

  for(j=1;j<N;j++){
    key=A[j];
    i=j-1;
    while(i>=0 && A[i]>key){
      A[i+1]=A[i];
      i=i-1;
    }
    A[i+1]=key;
    for(l=0;l<N;l++)
      printf("%d ",A[l]);
    printf("\n");
  }

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

#include<stdio.h>
#define N
main(){
  int min,n,i,j,key;
  int arr[100];

  printf("input Number\n");  
  scanf("%d",&N);
  for(i=0;i<N;i++){
  scanf("%d",arr);
  }

  for(i=1;i<n;i++){
    min = arr[0];
    if(min > arr[i]){
      key = min; 
      min = arr[i];
      arr[i+1] = key;    
}
}
 printf("%d",arr);
  
return 0;
}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:8:16: error: expected expression before ')' token
    8 |   scanf("%d",&N);
      |                ^
main.c:9:14: error: expected expression before ';' token
    9 |   for(i=0;i<N;i++){
      |              ^
Language: C

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

int main () {
	int *a, i, j, n, key;
	
	// 動的配列の生成
	scanf("%d", &n);
	a = (int *)malloc(sizeof(int) * n);
	
	for (i = 0; i < n; i++) scanf("%d", &a[i]);
	
	// 挿入ソート
	for (i = 1; i < n - 1; i++) {
		key = a[i];
		j = i - 1;
		
		while (j >= 0 && a[j] > key) {
			a[j + 1] = a[j];
			j--;
		}
		
		// 要素の出力
		for (k = 0; k < n; k++) printf("%d ", a[k]);
		printf("\n");
		
		a[j + 1] = key;
		
	}

	// 要素の出力
	for (i = 0; i < n; i++) printf("%d ", a[i]);
	printf("\n");
	
	free(a);
	
	return 0;
}

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

include <stdio.h>

int main(){
  int i,j,a[100],key,len;
  scanf("%d",&len);
  for(i=0;i<len;i++){
    scanf("%d",&a[i]);
  }
  for(i=1;i<len;i++){
    key=a[i];
    j=i-1;
    while(j>=0 && a[j]>key){
      a[j+1]=a[j];
      j--;
      a[j+1]=key;
    }
    for(i=0;i<len;i++){
      printf("%d",a[i]);
    }
  }
  
  return 0;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
Language: C

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

int main () {
  int *a, i, j, k, n, key;
	
	// 動的配列の生成
	scanf("%d", &n);
	a = (int *)malloc(sizeof(int) * n);
	
	for (i = 0; i < n; i++) scanf("%d", &a[i]);
	
	// 挿入ソート
	for (i = 1; i < n - 1; i++) {
		key = a[i];
		j = i - 1;
		
		while (j >= 0 && a[j] > key) {
			a[j + 1] = a[j];
			j--;
		}
		
		// 要素の出力
		for (k = 0; k < n; k++) {
		  if (i > 1; i <= n; i++) printf("\n");
		  printf("%d", a[k]);
		}
		printf("\n");
		
		a[j + 1] = key;
		
	}

	// 要素の出力
	for (i = 0; i < n; i++) printf("%d ", a[i]);
	printf("\n");
	
	free(a);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:25:28: error: expected ')' before ';' token
   25 |                   if (i > 1; i <= n; i++) printf("\n");
      |                      ~     ^
      |                            )
Language: C

for i = 1 to A.length-1
    key = A[i]
    /* insert A[i] into the sorted sequence A[0,...,j-1] */
    j = i - 1
    while j >= 0 and A[j] > key
        A[j+1] = A[j]
        j--
    A[j+1] = key

Compiler output:
main.c:1:1: error: expected identifier or '(' before 'for'
    1 | for i = 1 to A.length-1
      | ^~~
Language: C

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

int main(void){
  int N,key;
  int *data;
  int i,j;

  scanf("%d",&N);

  data=(int *)malloc(N*sizeof(int));

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

  printf("%d",data[0]);
  for(i=1;i<N;i++){
    printf(" %d",data[i]);
  }
  printf("\n");

  for(i=1;i<N;i++){
    key=data[i];
    j=i-1;
    while(j>=0 && data[j]>key){
      data[j+1]=data[j];
      j--;
    }
    data[j+1]=key;
    
    printf("%d",data[0]);
    for(i=1;i<N;i++){
      printf(" %d",data[i]);
    }
    printf("\n")
  }

  free(data);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:34:17: error: expected ';' before '}' token
   34 |     printf("\n")
      |                 ^
      |                 ;
   35 |   }
      |   ~
Language: C

#include <stdio.h>
#define N 100
int main (){
  int n,i,j,k,key,a[N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=1;i<n;i++){ 
    for(k=0;k<n;k++){
      printf("%d",a[k]);
     if(k<n-1){
     printf(" ");
     }
    }
    if(i<n-1){
     printf("\n");
    } 
    key=a[i];
    j=i-1;
    while(j>=0 && a[j]>key){
      a[j+1]=a[j];
      j--; 
    }
    a[j+1]=key;
  }
  for(k=0;k<n;k++){
   printf("%d",a[k]);
   if(k<n-1){
   printf(" ");
  }
  return 0;
}

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

#include <stdio.h>
#define N 100
int main (){
  int n,i,j,k,key,a[N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=1;i<n;i++){ 
    for(k=0;k<n;k++){
      printf("%d",a[k]);
     if(k<n-1){
     printf(" ");
     }
    }
    printf("\n");
    key=a[i];
    j=i-1;
    while(j>=0 && a[j]>key){
      a[j+1]=a[j];
      j--; 
    }
    a[j+1]=key;
  }
  for(k=0;k<n;k++){
   printf("%d",a[k]);
   if(k<n-1){
   printf(" ");
    }
   }
  return 0;

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

#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

void sort(int A[], int n){
  int i,key;

  for( i = 1; i <= n; i++ ){
    key = A[i];
    j = i -1;

    while( (j >= 0) && (A[j] > key) ){
      A[j+1] = A[j];
      j--;
    }

    A[j+1] = key;

    trace(A, n);
  }
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

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

  return 0;
}

Compiler output:
main.c: In function 'sort':
main.c:19:5: error: 'j' undeclared (first use in this function)
   19 |     j = i -1;
      |     ^
main.c:19:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main(){
  int N,A[100],i,j,k,key;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }  
  
  for(i=0;i<=N-1;i++){
    key=A[i];
    j=i-1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
      A[j+1]=key;
    }
    for(k=0;k<N;k++){
      printf("%d"A[k]);
      if(k<N-1)printf(" ");
    }
    printf("\n");
  }   
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:18: error: expected ')' before 'A'
   19 |       printf("%d"A[k]);
      |             ~    ^
      |                  )
Language: C

include <stdio.h>

int main()
{
  int key,i,j,n,k;
  int A[100];

 scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
  
  for(i=0;i<n;i++){
    key=A[i];
    j=i-1;
    while(j>=0 && A[j]>key)
      {
	A[j+1]=A[j];
	j--;
      }
    A[j+1]=key;
    
    for(k=0;k<n;k++){
      printf("%d",A[k]);
      if(k<n-1){
	printf(" ");
      }
	else if(k=n-1) break;
    }
    printf("\n");
  }
  return 0;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
Language: C

#include<stdio.h

?tatic const int N = 100;

int i, j, key, n;

main(){
  int A[N + 1];
  scanf(即%d即, &n);
  for(i = 0; i < n; i++){
    scanf(即%d即, &A[i]);
  }

  for(i = 1; i <= n - 1; i++){
    key = A[i];
    j = i - 1;
    while (j >= 0 && A[j] > key){
      A[j + 1] = A[j];
      j--;
    }
    A[j + 1] = key;

    for(j = 0; j < n; j++){
      printf(即%d即, A[j]);
    }
    printf(即\n即);
  }
  return 0;
}

Compiler output:
main.c:1:17: error: missing terminating > character
    1 | #include<stdio.h
      |                 ^
main.c:3:1: error: expected identifier or '(' before '?' token
    3 | ?tatic const int N = 100;
      | ^
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | main(){
      | ^~~~
main.c: In function 'main':
main.c:8:9: error: 'N' undeclared (first use in this function)
    8 |   int A[N + 1];
      |         ^
main.c:8:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:9: error: '\U00005373' undeclared (first use in this function)
    9 |   scanf(即%d即, &n);
      |         ^~
main.c:9:12: error: 'd\U00005373' undeclared (first use in this function)
    9 |   scanf(即%d即, &n);
      |            ^~~
main.c:26:14: error: stray '\' in program
   26 |     printf(即\n即);
      |              ^
main.c:26:14: error: expected ')' before 'n\U00005373'
   26 |     printf(即\n即);
      |           ~  ^~~~
      |              )
Language: C

#include<stdio.h>
#define N 100

int main(){

	int A[N];
	int key;
	int i,j,k,l;

	scanf_s("%d",&k);
		
	for(j =	0;j < k;j++){
			scanf_s("%d",&A[j]);
	}	
	
	for(i = 0;i < k;i++){
		key = A[i];
		j =	i - 1;
			
		while(j >= 0 &&	A[j] > key){
			A[j + 1] = A[j];
			j--;	
			A[j + 1] = key;
		}	
			
	for(l =	0;l < k;l++){
		printf("%d",A[l]);	
	 }			
printf("\n");
	}	
	
	return 0;
}	

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

#include<stdio.h>
#define N 100

int main(){

	int A[N];
	int key;
	int i,j,k,l;

	scanf("%d",&k);
		
	for(j =	0;j < k;j++){
			scanf("%d",&A[j]);
	}	
	
	for(i = 0;i < k;i++){
		key = A[i];
		j =	i - 1;
			
		while(j >= 0 &&	A[j] > key){
			A[j + 1] = A[j];
			j--;	
			A[j + 1] = key;
		}	
			
	for(l =	0;l < k;l++){
		printf("%d",A[l]);	
	 }			
　　　　　printf("\n");
	}	
	
	return 0;
}	

Compiler output:
main.c: In function 'main':
main.c:29:1: error: stray '\343' in program
   29 | <U+3000><U+3000><U+3000><U+3000><U+3000>printf("\n");
      | ^~~~~~~~
main.c:29:3: error: stray '\343' in program
   29 | <U+3000><U+3000><U+3000><U+3000><U+3000>printf("\n");
      |         ^~~~~~~~
main.c:29:5: error: stray '\343' in program
   29 | <U+3000><U+3000><U+3000><U+3000><U+3000>printf("\n");
      |                 ^~~~~~~~
main.c:29:7: error: stray '\343' in program
   29 | <U+3000><U+3000><U+3000><U+3000><U+3000>printf("\n");
      |                         ^~~~~~~~
main.c:29:9: error: stray '\343' in program
   29 | <U+3000><U+3000><U+3000><U+3000><U+3000>printf("\n");
      |                                 ^~~~~~~~
Language: C

#include<stdio.h>
#define N 100

main(){

	int A[N];
	int key;
	int i,j,k,l;

	scanf("%d",&k);
		
	for(j =	0;j < k;j++){
			scanf("%d",&A[j]);
	}	
	
	for(i = 0;i < k;i++){
		key = A[i];
		j =	i - 1;
			
		while(j >= 0 &&	A[j] > key){
			A[j + 1] = A[j];
			j--;	
			A[j + 1] = key;
		}	
			
	for(l =	0;l < k;l++){
		printf("%d",A[l]);	
	 }			
　　　　　printf("\n");
	}	
	
	return 0;
}	

Compiler output:
main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
    4 | main(){
      | ^~~~
main.c: In function 'main':
main.c:29:1: error: stray '\343' in program
   29 | <U+3000><U+3000><U+3000><U+3000><U+3000>printf("\n");
      | ^~~~~~~~
main.c:29:3: error: stray '\343' in program
   29 | <U+3000><U+3000><U+3000><U+3000><U+3000>printf("\n");
      |         ^~~~~~~~
main.c:29:5: error: stray '\343' in program
   29 | <U+3000><U+3000><U+3000><U+3000><U+3000>printf("\n");
      |                 ^~~~~~~~
main.c:29:7: error: stray '\343' in program
   29 | <U+3000><U+3000><U+3000><U+3000><U+3000>printf("\n");
      |                         ^~~~~~~~
main.c:29:9: error: stray '\343' in program
   29 | <U+3000><U+3000><U+3000><U+3000><U+3000>printf("\n");
      |                                 ^~~~~~~~
Language: C

#include<stdio.h>
#define N 100
main(){
	int A[N];
	int key,tmp,i,j;
	scanf("%d",&key);
	
	for(i=0;i<key;i++){
	scanf("%d",A[i]);
	}
	for(i = 1;i<key;i++){
	tmp=A[i]; 
	for(j=1;j>0 && A[j-1] > tmp;j--){
		A[j] = A[j-1];
	}
	A[j] = tmp;
	for(i = 0; i < key; i++){
	if(i == key-1){
	printf("%d",A[key]);
	}
	else{
	printf("%d ",A[i]);
	}
	}
	return 0;
	}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:26:9: error: expected declaration or statement at end of input
   26 |         }
      |         ^
Language: C

#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j, k;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);
  
  for(j=2; j<=n;j++)
    {
      k=A[j];
      i=j-1;
  while(i>0 && A[i]>key)
    {
      A[i+1] = A[i];
      i--;
      A[i+1] = k;
    }
  trace(A, n);
    }
}

Compiler output:
main.c: In function 'main':
main.c:27:21: error: 'key' undeclared (first use in this function)
   27 |   while(i>0 && A[i]>key)
      |                     ^~~
main.c:27:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j, k;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);
  
  for(j=2; j<=n;j++)
    {
      k=A[j];
      i=j-1;
  while(i>0 && A[i]>key)
    {
      A[i+1] = A[i];
      i--;
      A[i+1] = k;
    }
  trace(A, n);
    }
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:27:21: error: 'key' undeclared (first use in this function)
   27 |   while(i>0 && A[i]>key)
      |                     ^~~
main.c:27:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
void swap(int *, int *);
 
int main(void){
    double x, y;
    double t;
    scanf("%d%d", &x, &y);
    if(y>x){
        swap(&x, &y);
    }
   if(x>=y){
    while(y>0){
        t = x%y;
        x = y;
        y = t;
   }
        printf("%d\n", x);
    }
    return 0;
}
void swap(int *x, int *y){
    int temp;
    temp = *x;
    *x = *y;
    *y = temp;
}

Compiler output:
main.c: In function 'main':
main.c:9:14: error: passing argument 1 of 'swap' from incompatible pointer type [-Wincompatible-pointer-types]
    9 |         swap(&x, &y);
      |              ^~
      |              |
      |              double *
main.c:2:11: note: expected 'int *' but argument is of type 'double *'
    2 | void swap(int *, int *);
      |           ^~~~~
main.c:9:18: error: passing argument 2 of 'swap' from incompatible pointer type [-Wincompatible-pointer-types]
    9 |         swap(&x, &y);
      |                  ^~
      |                  |
      |                  double *
main.c:2:18: note: expected 'int *' but argument is of type 'double *'
    2 | void swap(int *, int *);
      |                  ^~~~~
main.c:13:14: error: invalid operands to binary % (have 'double' and 'double')
   13 |         t = x%y;
      |              ^
Language: C

#include <stdio.h>
void swap(int *, int *);
 
int main(void){
    double x, y;
    int t;
    scanf("%d%d", &x, &y);
    if(y>x){
        swap(&x, &y);
    }
   if(x>=y){
    while(y>0){
        t = x%y;
        x = y;
        y = t;
   }
        printf("%d\n", x);
    }
    return 0;
}
void swap(int *x, int *y){
    int temp;
    temp = *x;
    *x = *y;
    *y = temp;
}

Compiler output:
main.c: In function 'main':
main.c:9:14: error: passing argument 1 of 'swap' from incompatible pointer type [-Wincompatible-pointer-types]
    9 |         swap(&x, &y);
      |              ^~
      |              |
      |              double *
main.c:2:11: note: expected 'int *' but argument is of type 'double *'
    2 | void swap(int *, int *);
      |           ^~~~~
main.c:9:18: error: passing argument 2 of 'swap' from incompatible pointer type [-Wincompatible-pointer-types]
    9 |         swap(&x, &y);
      |                  ^~
      |                  |
      |                  double *
main.c:2:18: note: expected 'int *' but argument is of type 'double *'
    2 | void swap(int *, int *);
      |                  ^~~~~
main.c:13:14: error: invalid operands to binary % (have 'double' and 'double')
   13 |         t = x%y;
      |              ^
Language: C++

// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


#include<stack>
#include<algorithm>

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

void display(vector<int> v) {
	for (auto i : v) {
		cout << i << " ";
	}
	cout << endl;
}


void insertion_sort(vector<int> v) {

	for (int i = 0; i < v.size() -1 ; ++i) {
		int j = i + 1;
		int cur = v[j];
		while ( j >= 1 && cur < v[j - 1]) {
			v[j] = v[j - 1];
			--j;
		}
		v[j] = cur;
		display(v);

	}

}

int main() {

	int n;
	cin >> n;
	

	vector<int> v;

	int x;
	while (n > 0) {
		cin >> x;
		v.push_back(x);
		--n;
	}

	insertion_sort(v);

	return 0;
}


Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <stdio.h>
#define NUMBER 100

void insertionSort(int array[],int num){
	int i, j, v;
	for(i = 1; i <= num - 1 ; i++){
		v = array[i];
		j = i - 1;
		while(j >= 0 && array[j] > v){
			array[j + 1] = array[j];
			j--;
		}
	array[j + 1] = v;
	//配列の出力
	print_array(array, num);
	}
}

void print_array(int array[],int num){
	int i;
	
	for(i = 0; i < num - 1; i++)
		printf("%d ", array[i]);
	
	//スペースを出力したくないので最後の要素だけfor文外で出力
	printf("%d\n", array[i]);
}

int main(void){
	int array[NUMBER];
	int num, i;
	
	scanf("%d", &num);
	
	for(i = 0; i < num; i++){
		//配列を入力
		scanf("%d", &array[i]);
	}
	//挿入ソート
	insertionSort(array, num);

	
	return 0;
}


Compiler output:
a.cc: In function 'void insertionSort(int*, int)':
a.cc:15:9: error: 'print_array' was not declared in this scope
   15 |         print_array(array, num);
      |         ^~~~~~~~~~~
Language: C++

package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	fmt.Println(printSlice(a))

	for i := 1; i < n; i++ {
		key := a[i]
		j := i - 1
		for j >= 0 && a[j] > key {
			a[j+1] = a[j]
			j--
		}
		a[j+1] = key
		fmt.Println(printSlice(a))
	}
}

func printSlice(slice []int) (s string) {
	for _, v := range slice {
		s += strconv.Itoa(v) + " "
	}
	return strings.TrimRight(s, " ")
}



Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:31:1: error: 'func' does not name a type
   31 | func printSlice(slice []int) (s string) {
      | ^~~~
Language: C++

// ALDS1_1_A Insertion sort

#include <vector>
#include <iostream>

using namespace std;

namespace alds1_1_a {

	void outputArray(ostream& os, const vector<int>& A)
	{
		auto it = A.cbegin();
		int n = A.size();
		for (int i = 0; i < n - 1; ++i) {
			os << A[i] << " ";
		}
		os << A[n - 1] << endl;
	}

	void insertionSort(vector<int>& A, ostream& os)
	{
		int n = A.size();

		for (int i = 0; i < n; ++i) {
			int key = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > key) {
				if (A[j] > key)
					A[j + 1] = A[j];
				--j;
			}
			A[j + 1] = key;

			outputArray(os, A);
		}
	}

	void solve(istream &sin, ostream &sout)
	{
		int n;
		sin >> n;

		vector<int> A;
		for (int i = 0; i < n; ++i) {
			int val;
			sin >> val;
			A.push_back(val);
		}

		insertionSort(A, sout);
	}
}

void main()
{
	alds1_1_a::solve(cin, cout);
}


Compiler output:
a.cc:54:1: error: '::main' must return 'int'
   54 | void main()
      | ^~~~
Language: C++

// ALDS1_1_A Insertion sort

#include <vector>
#include <iostream>

using namespace std;

namespace alds1_1_a {

	void outputArray(ostream& os, const vector<int>& A)
	{
		int n = A.size();
		for (int i = 0; i < n - 1; ++i) {
			os << A[i] << " ";
		}
		os << A[n - 1] << endl;
	}

	void insertionSort(vector<int>& A, ostream& os)
	{
		int n = A.size();

		for (int i = 0; i < n; ++i) {
			int key = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > key) {
				if (A[j] > key)
					A[j + 1] = A[j];
				--j;
			}
			A[j + 1] = key;

			outputArray(os, A);
		}
	}

	void solve(istream &sin, ostream &sout)
	{
		int n;
		sin >> n;

		vector<int> A;
		for (int i = 0; i < n; ++i) {
			int val;
			sin >> val;
			A.push_back(val);
		}

		insertionSort(A, sout);
	}
}

void main()
{
	alds1_1_a::solve(cin, cout);
}


Compiler output:
a.cc:53:1: error: '::main' must return 'int'
   53 | void main()
      | ^~~~
Language: C++

#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);
  
  for ( i = 1; i <= n; i++ ) {
    key = A[i];
    j = i - 1;
    while (j > 0 && A[j] > key) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'key' was not declared in this scope
   24 |     key = A[i];
      |     ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int cnt;
int n[110];

void p() {
    for(int i = 0; i < cnt; i++) cout << n[i] << " ";
    cout << endl;
}
int main() {
    cin >> cnt;
    for(int i =0; i < cnt; i++) cin >> n[i];
    for(int i = 1; i < cnt; i++) {
        int l = i - 1;
        int value = n[i];
        while(l >= 0 && a[l] > value)) {
            n[l+1] = n[l];
            l--;
        }
        n[l-1] = value;
        p();
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: 'a' was not declared in this scope
   18 |         while(l >= 0 && a[l] > value)) {
      |                         ^
a.cc:18:38: error: expected primary-expression before ')' token
   18 |         while(l >= 0 && a[l] > value)) {
      |                                      ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int cnt;
int n[110];

void p() {
    for(int i = 0; i < cnt; i++) cout << n[i] << " ";
    cout << endl;
}
int main() {
    cin >> cnt;
    for(int i =0; i < cnt; i++) cin >> n[i];
    for(int i = 1; i < cnt; i++) {
        int l = i - 1;
        int value = n[i];
        while(l >= 0 && a[l] > value) {
            n[l+1] = n[l];
            l--;
        }
        n[l+1] = value;
        p();
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: 'a' was not declared in this scope
   18 |         while(l >= 0 && a[l] > value) {
      |                         ^
Language: C++

#include<cstdio.h>
#include<iostream>
//按顺序输出数组元素
void trace(int A[],int N)
{
for(int i=0;i<N;i++)
{
if (i>0)  cout<<" ";
cout<<A[i];
}
cout<<endl;
}
//插入排序
void insertionSort(int A[],int N)
{
int j,i,v;
for( i=1;i<N;i++)
{
v=A[i];
j=i-1;
if (j>=0&&A[j]>v)
{
A[j+1]=A[j];
j--;
}
A[j+1]=v;
trace(A,N);
}
}
int main()
{
int N,i,j;
int A[100];
cin>>N;
for(i=0;i<N;i++)
cin>>A[i];
trace(A,N);
insertionSort(A,N);
return 0;
}



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

#include<cstdio>
#include<iostream>
//按顺序输出数组元素
void trace(int A[],int N)
{
for(int i=0;i<N;i++)
{
if (i>0)  cout<<" ";
cout<<A[i];
}
cout<<endl;
}
//插入排序
void insertionSort(int A[],int N)
{
int j,i,v;
for( i=1;i<N;i++)
{
v=A[i];
j=i-1;
if (j>=0&&A[j]>v)
{
A[j+1]=A[j];
j--;
}
A[j+1]=v;
trace(A,N);
}
}
int main()
{
int N,i,j;
int A[100];
cin>>N;
for(i=0;i<N;i++)
cin>>A[i];
trace(A,N);
insertionSort(A,N);
return 0;
}


Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:8:11: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 | if (i>0)  cout<<" ";
      |           ^~~~
      |           std::cout
In file included from a.cc:2:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:9:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    9 | cout<<A[i];
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:11:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 | cout<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:11:7: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   11 | cout<<endl;
      |       ^~~~
      |       std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc: In function 'int main()':
a.cc:34:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   34 | cin>>N;
      | ^~~
      | std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
Language: C++

#include <iostream>
using namespace std;

int main(){
    int n; cin >> n;
    int a[n];

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

    for(int i = 0; i < n; i++){
        int v = a[i];
        int j = i-1;
        while(j>=0 && a[j]>v){
            a[j+1]=a[j];
            j--;
            a[j+1]=v;
        }
        
        for(int i = 0; i < n; i++){
            if(i<n-1){
                cout << a[i] << " ";
            }else{
                cout << a[i] << endl;
            }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:2: error: expected '}' at end of input
   28 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

using namespace std;

int main() {
	int N;
	cin >> N;
	int p[N+1];
	p[0] = -100000;
	for (int i = 1;i < N+1;i++) {
		cin >> p[i];
	
	}
	

	
	for (int i = 1;i < N+1;i++) {
		int key = p[i];
		for (int j= 0;j <i ;j++) {

			if (p[j] <=key && key <= p[j + 1]) {
				for (int l = i-1; l >= j+1;l--)
					p[l + 1] = p[l];
				p[j + 1] = key;
				break;
			}
		}
	
		for (int k = 1;k < N + 1;k++) {
			cout << p[k] ;
			if(k !=N)
			cout << ' ';
		}
		
		
		cout << '\n';
	}
	
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin >> N;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:28:25: error: 'cout' was not declared in this scope
   28 |                         cout << p[k] ;
      |                         ^~~~
a.cc:28:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:17: error: 'cout' was not declared in this scope
   34 |                 cout << '\n';
      |                 ^~~~
a.cc:34:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

int main() {
	int N, evacuation,num;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	for (i = 0; i < n; i++) cout << a[i] << ((i == n - 1) ? '\n' : ' '); //出力している

	for (int j = 1; j < N; j++) {
		evacuation = A[j];
		num = j - 1;

		while (num>=0 && A[num] > evacuation)
		{
			swap(A[num], A[num + 1]);
			num--;
		}

		for (int i = 0; i < N; i++) {
			cout << A[i] << " \n"[i == N - 1];
		}
	}

	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: 'i' was not declared in this scope
   13 |         for (i = 0; i < n; i++) cout << a[i] << ((i == n - 1) ? '\n' : ' '); //出力している
      |              ^
a.cc:13:25: error: 'n' was not declared in this scope
   13 |         for (i = 0; i < n; i++) cout << a[i] << ((i == n - 1) ? '\n' : ' '); //出力している
      |                         ^
a.cc:13:41: error: 'a' was not declared in this scope
   13 |         for (i = 0; i < n; i++) cout << a[i] << ((i == n - 1) ? '\n' : ' '); //出力している
      |                                         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
int N;
int arr[100];

void InsertionSort(int *arr, int n)
{
    {
        int key = arr[i];
        int j = i - 1;
        while (j >= 0 && arr[j] > key)
        {

            arr[j + 1] = arr[j];
            j--;
        }

        arr[j + 1] = key;
        for (int k = 0; k < n-1; k++)
            cout << arr[k] << " ";
            cout << arr[n - 1] << endl;
    }
}
int main()
{
    freopen("in.txt", "r", stdin);
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> arr[i];
    }

    for (int j = 0; j < N - 1; j++)
        cout << arr[j] << " ";
    cout << arr[N - 1] << endl;
    InsertionSort(arr, N);
    return 0;
}


Compiler output:
a.cc: In function 'void InsertionSort(int*, int)':
a.cc:10:23: error: 'i' was not declared in this scope
   10 |         int key = arr[i];
      |                       ^
Language: C++

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := []int{}
	for i := 0; i < n; i++ {
		var aa int
		fmt.Scan(&aa)
		a = append(a, aa)
	}
	sortWithPrint(n, a)
}

func sortWithPrint(n int, a []int) {
	for i := 0; i < n; i++ {
		v := a[i]
		j := i-1
		for ; j >= 0 && a[j] > v; j-- {
			a[j+1] = a[j]
		}
		a[j+1] = v

		// print
		fmt.Print(a[0])
		for k := 1; k < n; k++ {
			fmt.Printf(" %d", a[k])
		}
		fmt.Println()
	}
}



Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:20:1: error: 'func' does not name a type
   20 | func sortWithPrint(n int, a []int) {
      | ^~~~
Language: C++

void trace(int A[], int N) {
    for(int i = 0; i < N; i++) {
        if(i > 0) { printf(" ";)}
        printf("%d", A[i]);
    }
    printf("\n");
}

void insertionSort(int A[], int N) {
    int v, j;
    for(int i = 1; i < N; i++) {
        v = A[i];
        j = i - 1;
        while(j >= 0 && v < A[j]) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main() {
    int N;
    int A[100];
    scanf("%d", N);
    for(int i = 0; i < N; i++) { scanf("%d", A); }
    trace(A, N);
    insertionSort(A, N);
    return 0;
}


Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:3:31: error: expected ')' before ';' token
    3 |         if(i > 0) { printf(" ";)}
      |                           ~   ^
      |                               )
a.cc:3:32: error: expected primary-expression before ')' token
    3 |         if(i > 0) { printf(" ";)}
      |                                ^
a.cc:4:9: error: 'printf' was not declared in this scope
    4 |         printf("%d", A[i]);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | void trace(int A[], int N) {
a.cc:6:5: error: 'printf' was not declared in this scope
    6 |     printf("\n");
      |     ^~~~~~
a.cc:6:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: In function 'int main()':
a.cc:26:5: error: 'scanf' was not declared in this scope
   26 |     scanf("%d", N);
      |     ^~~~~
Language: C++

void trace(int A[], int N) {
    for(int i = 0; i < N; i++) {
        if(i > 0) { printf(" "); }
        printf("%d", A[i]);
    }
    printf("\n");
}

void insertionSort(int A[], int N) {
    int v, j;
    for(int i = 1; i < N; i++) {
        v = A[i];
        j = i - 1;
        while(j >= 0 && v < A[j]) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main() {
    int N;
    int A[100];
    scanf("%d", N);
    for(int i = 0; i < N; i++) { scanf("%d", A); }
    trace(A, N);
    insertionSort(A, N);
    return 0;
}



Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:3:21: error: 'printf' was not declared in this scope
    3 |         if(i > 0) { printf(" "); }
      |                     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | void trace(int A[], int N) {
a.cc:4:9: error: 'printf' was not declared in this scope
    4 |         printf("%d", A[i]);
      |         ^~~~~~
a.cc:4:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:6:5: error: 'printf' was not declared in this scope
    6 |     printf("\n");
      |     ^~~~~~
a.cc:6:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: In function 'int main()':
a.cc:26:5: error: 'scanf' was not declared in this scope
   26 |     scanf("%d", N);
      |     ^~~~~
Language: C++

void trace(int A[], int N) {
    for(int i = 0; i < N; i++) {
        if(i > 0) { printf(" "); }
        printf("%d", A[i]);
    }
    printf("\n");
}

void insertionSort(int A[], int N) {
    int v, j;
    for(int i = 1; i < N; i++) {
        v = A[i];
        j = i - 1;
        while(j >= 0 && v < A[j]) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

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



Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:3:21: error: 'printf' was not declared in this scope
    3 |         if(i > 0) { printf(" "); }
      |                     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | void trace(int A[], int N) {
a.cc:4:9: error: 'printf' was not declared in this scope
    4 |         printf("%d", A[i]);
      |         ^~~~~~
a.cc:4:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:6:5: error: 'printf' was not declared in this scope
    6 |     printf("\n");
      |     ^~~~~~
a.cc:6:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: In function 'int main()':
a.cc:26:5: error: 'scanf' was not declared in this scope
   26 |     scanf("%d", &N);
      |     ^~~~~
Language: C++

#include <iostream>

using namespace std;

int main(){

  int size;

  cin >> size;

  int *array = new int[size];

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

  int j, v;

  for(int i = 1; i < size; i++){
    j = i - 1;
    v = array[i];
    while(j >= 0 && array[j] > v){
      array[j + 1] = array[j];
      j--;
    }
    array[j + 1] = v;

    for(int i = 0; i < size - 1; i++){
      cout << array[i] << " ";
    }
    cout << array[i] << endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:32:4: error: expected '}' at end of input
   32 |   }
      |    ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int main(void){

  int N;
  cin >> N;

  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  int v = 0;
  for (int i = 1; i < N; i++)
  {
    v = A.at(i);
    j = i - 1;
    while((j >= 0)&&(A.at(j) > v)){
      A.at(j+1) = A.at(j);
      j--;
      A.at(j+1) = v;
    }
  }
  
  
  


  return 0;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'j' was not declared in this scope
   16 |     j = i - 1;
      |     ^
Language: C++

/*
1 insertionSort(A, N) // N個の要素を含む0-オリジンの配列A
2   for i が 1 から N-1 まで
3     v = A[i]
4     j = i - 1
5     while j >= 0 かつ A[j] > v
6       A[j+1] = A[j]
7       j--
8     A[j+1] = v
*/
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    int A[N];
    
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    
    for(int i=0; i<N; i++){
        int v=A[i];
        int j = i - 1;
        for(int k=0; k<N; k++){
            cout << A[k];
            if(k==N-1){
                cout <<endl;
            }else{
                cout << " ";
            }
        }
        
        
        while(j>=0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
    }
    
    retunr 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:5: error: 'retunr' was not declared in this scope
   42 |     retunr 0;
      |     ^~~~~~
Language: C++

#include<iostream>
using namespace std;
void trace(int A[],int N)
{
    int i;
    for( i=0;i<n;i++)
    {
        if(i>0)cout<<" ";
        cout<<A[i];
        
    }
    cout<<endl;
    
    
}

void insertionsort(int A[], int N){
    int j,i,v;
    for(i=1;i<N;i++)
    {
        v=A[i];
        j=i-1;
        while(j>=0 &&A[j]>v)
        A[j+1]=A[j];
        j--;
    }
    A[j+1]=v;
    trace(A,N);
        
    }
        }
        
        int main(){
            int N,i,j;
            int A[100];
            
            cin>>N;
            for(i=0;i<N;i++)cin>>A[i];
            trace(A,N);
            insertionsort(A,N);
            return 0;
            
            
            
            
        }


Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:6:16: error: 'n' was not declared in this scope
    6 |     for( i=0;i<n;i++)
      |                ^
a.cc: At global scope:
a.cc:31:9: error: expected declaration before '}' token
   31 |         }
      |         ^