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

#include<stdio.h>
#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];

int x[N][N];
void initialize(void);
void printBoard(void);
void recursive(int);

int main(){
  int i,j;
  
  initialize();

  for( i = 0 ; i < N ; i++ ){
    for(j = 0 ; j < N ; j++ ){
      x[i][j] = false;

    }
  }

  int k;
  int r,c;
  
  scanf("%d",&k);

  for( i = 0 ; i < k ; i++ ){
    scanf("%d%d",&r,&c);
    x[r][c] = true;
  }

  recursive(0);

  return 0;
}

void initialize(){
  int i,j;
  for( i = 0 ; i < N ; i++ ) {
    row[i] = FREE;
    col[i] = FREE;
  }

  for( i = 0 ; i < 2*N-1 ; i++ ){
    dpos[i] = FREE;
    dreg[i] = FREE;
  }

}


void printBoard(){
  int i,j;
  
  for( i = 0 ; i < N ; i++ ){
    for( j = 0 ; j < N ; j++ ){
      if(x[i][j]){
	if(row[i] != j) return;
      }
    }
  }

  for( i = 0 ; i < N ; i++ ){
    for( j = 0 ; j < N ; j++ ){
      if(row[i] == j ) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void recursive(int i){
  if( i == N ){
    printBoard();
    return;
  }

  int j;

  for( j = 0 ; j < N ; j++ ){
    if( NOT_FREE == col[j] || NOT_FREE == dpos[i+j] || NOT_FREE == dneg[i-j+N-1]) continue;

    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;

    recursive(i+1);

    row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
}

Compiler output:
main.c: In function 'main':
main.c:20:17: error: 'false' undeclared (first use in this function)
   20 |       x[i][j] = false;
      |                 ^~~~~
main.c:2:1: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include<stdio.h>
  +++ |+#include <stdbool.h>
    2 | #define N 8
main.c:20:17: note: each undeclared identifier is reported only once for each function it appears in
   20 |       x[i][j] = false;
      |                 ^~~~~
main.c:32:15: error: 'true' undeclared (first use in this function)
   32 |     x[r][c] = true;
      |               ^~~~
main.c:32:15: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c: In function 'initialize':
main.c:49:5: error: 'dreg' undeclared (first use in this function); did you mean 'dneg'?
   49 |     dreg[i] = FREE;
      |     ^~~~
      |     dneg
Language: C

#include<stdio.h>
#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];

int x[N][N];
void initialize(void);
void printBoard(void);
void recursive(int);

int main(){
  int i,j;
  
  initialize();

  for( i = 0 ; i < N ; i++ ){
    for(j = 0 ; j < N ; j++ ){
      x[i][j] = 0;

    }
  }

  int k;
  int r,c;
  
  scanf("%d",&k);

  for( i = 0 ; i < k ; i++ ){
    scanf("%d%d",&r,&c);
    x[r][c] = 1;
  }

  recursive(0);

  return 0;
}

void initialize(){
  int i,j;
  for( i = 0 ; i < N ; i++ ) {
    row[i] = FREE;
    col[i] = FREE;
  }

  for( i = 0 ; i < 2*N-1 ; i++ ){
    dpos[i] = FREE;
    dreg[i] = FREE;
  }

}


void printBoard(){
  int i,j;
  
  for( i = 0 ; i < N ; i++ ){
    for( j = 0 ; j < N ; j++ ){
      if(x[i][j]){
	if(row[i] != j) return;
      }
    }
  }

  for( i = 0 ; i < N ; i++ ){
    for( j = 0 ; j < N ; j++ ){
      if(row[i] == j ) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void recursive(int i){
  if( i == N ){
    printBoard();
    return;
  }

  int j;

  for( j = 0 ; j < N ; j++ ){
    if( NOT_FREE == col[j] || NOT_FREE == dpos[i+j] || NOT_FREE == dneg[i-j+N-1]) continue;

    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;

    recursive(i+1);

    row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
}

Compiler output:
main.c: In function 'initialize':
main.c:49:5: error: 'dreg' undeclared (first use in this function); did you mean 'dneg'?
   49 |     dreg[i] = FREE;
      |     ^~~~
      |     dneg
main.c:49:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

/**
  Queen Chess
*/

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

/* define */
#define MAX 8
#define BLACK 1 //queen exist
#define WHITE 0 //queen non-exist

/* prototype */
void search(int i);

/* global */
//X????????????Y????¨???????JUDGE????????????ULLR(Upper Left, Lower Right)???URLL(Upper Right, Lower Left)
int X[MAX], Y[MAX], JUDGE[MAX][MAX], ULLR[2*MAX-1], URLL[2*MAX-1];
int top=1;


int main() {
  int i,j, k, r,c;
  /*?????????????????????*/
  //?????????????¨?????¨??????????
  for(i=0;i<MAX;i++){
    X[i] = WHITE;
    Y[i] = WHITE;
  }
  //?¬??????????????¨??????????
  for(i=0;i<2*MAX-1;i++){
    ULLR[i] = WHITE;
    URLL[i] = WHITE;
  }
  
  //??????????????????
  for(i=0;i<MAX;i++){
    for(j=0;j<MAX;j++){
      JUDGE[i][j] = -1;
    }
  }
  //input
  scanf("%d", &k); //????????????????????¨??????????????°
  for(i=0;i<MAX;i++){
    scanf("%d %d",&r,&c); //r??????,c????¨?
    JUDGE[r][c] = 1; //?????¨
  }
  
  //???????????????????????????????§£?????¢?´¢
  search(0);
  
  
  /*??????*/
  for(i=0;i<MAX;i++){
    for(j=0;j<MAX;j++){
      if(JUDGE == WHITE) { //?????????????????????????????°
        if(X[i]!=j){
          goto NEXT;
        }
      }
    }
  }
  //Goto
  NEXT:
  for(i=0;i<MAX;i++) {
    for(j=0;j<MAX;j++) {
      if(X[i]==j) {
        printf("Q");
      }else{
        printf(".");
      }
    }
    printf("\n");
  }
}

/** ?????????????????????????????????????????????????????¢?´¢
  * n?????????????????????????????????????????´??????n??????????????§????????¨????????????
  * ????????????????????£???????????£??????????????¢?´¢
  */
int search(int n){
  int i;
  if(n==MAX) { //???????????§?????£????????°???
    return 0;
  }
  for(i=0;i<MAX;i++){
    if(X[i]==BLACK){
      if(URLL[i]==BLACK){
        if(ULLR[i]==BLACK){
          continue;
        }
      }
    }
    //???????????????????????????????????\??¨?????¢????????????BLACK?????????
    X[n] = i;
    Y[i] = BLACK;
    URLL[n+i] = BLACK;
    ULLR[n-i+MAX-1] = BLACK;
    
    //?¬????????????¢?´¢
    search(n+1);
    
    //???????????????????????????????????????
    X[n] = WHITE;
    Y[i] = WHITE;
    URLL[n+i] = WHITE;
    ULLR[n-i+MAX-1] = WHITE;
  }
}

Compiler output:
main.c:82:5: error: conflicting types for 'search'; have 'int(int)'
   82 | int search(int n){
      |     ^~~~~~
main.c:15:6: note: previous declaration of 'search' with type 'void(int)'
   15 | void search(int i);
      |      ^~~~~~
Language: C

#include <stdio.h>

#define N 8
#define FREE -1
#define NOT_FREE 1
#define TRUE 3
#define FALSE 2
void initialize(void);
void printboard(void);
void recursive(int);

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
int Q[N][N];


void initialize(){
  int i;
  for ( i = 0; i < N; i++ ){
    row[i] = FREE; col[i] = FREE;
  }
    for ( i = 0; i < 2*N - 1; i++ ) {
      dpos[i] = FREE; dneg[i] = FREE;
    }
}
  




void printBoard(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(Q[i][j] == TRUE){
    if(row[i] != j)return;
      }
    }
  }
  for (i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i] == j){
	printf("Q");
      }else{printf(".");
    }
    printf("\n");
  }
   printf("\n");
}

void recursive (int i ){
  int j;
  if ( i == N){

    printBoard();
    return ;
  }
  for (j =0 ;j <N;j++){
    if (col[j] == NOT_FREE || dpos[i+j] == NOT_FREE || dneg[i-j+N-1] ==NOT_FREE)continue;

    row[i] =j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
    recursive(i+1);
    row[i] = col[j]=dpos[i+j]=dneg[i-j+N-1] = FREE;
  }
}

  
int main(){
  int i,j,k,r,c;
  
   initialize();
   
  for (i = 0; i< N;i++)
    for (j = 0; j< N;j++)
      Q[i][j] = FALSE;

      scanf("%d",&k);
      for(i=0;i<k;i++){
	scanf("%d %d",&r,&c);
	Q[r][c] = TRUE;
   
  }
   
   
    recursive( 0 );
    return 0;
}

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



#include <iostream>
 
using namespace std;
 
int row[8], col[8], dpos[15], dneg[15], ans[8][8] = { 0 };
 
void print() {
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            if (ans[i][j] == 1) {
                if (row[i] != j) {
                    return;
                }
            }
        }
    }
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            if (row[i] == j) {
                cout << 'Q';
            }
            else {
                cout << '.';
            }
        }
        cout << endl;
    }
}
 
void recursive(int i) {
    if (i == 8) {
        print();
        return;
    }
    for (int j = 0; j < 8; j++) {
        if (col[j] == 1 || dpos[i + j] == 1 || dneg[i - j + 7] == 1) {
            continue;
        }
        row[i] = j;
        col[j] = dpos[i + j] = dneg[i - j + 7] = 1;
        recursive(i + 1);
        row[i] = col[j] = dpos[i + j] = dneg[i - j + 7] = -1;
    }
}
 
int main() {
    int k, r, c;
 
    for (int i = 0; i < 8; i++) {
        row[i] = col[i] = -1;
    }
    for (int i = 0; i < 15; i++) {
        dpos[i] = dneg[i] = -1;
    }
 
    cin >> k;
    for (int i = 0; i < k; i++) {
        cin >> r >> c;
        ans[r][c] = 1;
    }
 
    recursive(0);
     
    return 0;
}

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


#include <iostream>
 
using namespace std;
 
int row[8], col[8], dpos[15], dneg[15], ans[8][8] = { 0 };
 
void print() {
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            if (ans[i][j] == 1) {
                if (row[i] != j) {
                    return;
                }
            }
        }
    }
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            if (row[i] == j) {
                cout << 'Q';
            }
            else {
                cout << '.';
            }
        }
        cout << endl;
    }
}
 
void recursive(int i) {
    if (i == 8) {
        print();
        return;
    }
    for (int j = 0; j < 8; j++) {
        if (col[j] == 1 || dpos[i + j] == 1 || dneg[i - j + 7] == 1) {
            continue;
        }
        row[i] = j;
        col[j] = dpos[i + j] = dneg[i - j + 7] = 1;
        recursive(i + 1);
        row[i] = col[j] = dpos[i + j] = dneg[i - j + 7] = -1;
    }
}
 
int main() {
    int k, r, c;
 
    for (int i = 0; i < 8; i++) {
        row[i] = col[i] = -1;
    }
    for (int i = 0; i < 15; i++) {
        dpos[i] = dneg[i] = -1;
    }
 
    cin >> k;
    for (int i = 0; i < k; i++) {
        cin >> r >> c;
        ans[r][c] = 1;
    }
 
    recursive(0);
     
    return 0;
}

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

#include<stdio.h>
#define N 8
char Q[N][N];
void putpoint1(x,y){
  int i,j;
  for(i=1;i<N-x;i++){
    for(j=1;j<N-y;j++){
      Q[x+i][j+y]='.';
  }
  for(j=1;y-j>=0;j++){
      Q[x+i][y-j]='.';
}
}
for(i=1;x-i>=0;i++){
    for(j=1;j<N-y;j++){
      Q[x-i][j+y]='.';
  }
  for(j=1;y-j>=0;j--){
      Q[x-i][y-j]='.';
}
}
}

void putpoint2(x,y){
  int i;
  for(i=1;x-i>=0;i++){
    Q[x-1][y]='.';
  }
  for(i=1;x+1<N;i++){
    Q[x+1][y]='.';
  }
   for(i=1;x-i>=0;i++){
    Q[x][y-1]='.';
  }
  for(i=1;x+1<N;i++){
    Q[x+1][y+1]='.';
  }
}

int main(){
  int k,i,j,x,y;
  scanf("%d",&k);
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
    Q[i][j]=' ';
  }
  }
  for(i=0;i<k;i++){
    scanf("%d %d",x,y);
    Q[x][y]='Q';
    putpoint1(x,y);
    putpoint2(x,y);
  }
  for(j=0;i<N;j++){
    for(i=0;i<N;i++){
      if(Q[i][j]!='Q' ||Q[i][j]!='.'){
         putpoint1(x,y);
         putpoint2(x,y);
      }
  }
  }
for(i=0;i<N;i++){
  for(j=0;i<N;j++){
    print("%c",Q[i][j]);
  }
  printf("\n");
}
}

Compiler output:
main.c: In function 'putpoint1':
main.c:4:6: error: type of 'x' defaults to 'int' [-Wimplicit-int]
    4 | void putpoint1(x,y){
      |      ^~~~~~~~~
main.c:4:6: error: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c: In function 'putpoint2':
main.c:24:6: error: type of 'x' defaults to 'int' [-Wimplicit-int]
   24 | void putpoint2(x,y){
      |      ^~~~~~~~~
main.c:24:6: error: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c: In function 'main':
main.c:64:5: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   64 |     print("%c",Q[i][j]);
      |     ^~~~~
      |     printf
Language: C

#include <stdio.h>
 
#define B 8
int check(int,int,int,int,int,int,int,int)
 
int check(int i, int j, int k, int l, int m, int n, int o, int p)
{
    return (i != j) && (i != k) && (i != l) && (i != m) && (i != n) && (i != o) && (i != p)
        && (j != k) && (j != l) && (j != m) && (j != n) && (j != o) && (j != p)
        && (k != l) && (k != m) && (k != n) && (k != o) && (k != p)
        && (l != m) && (l != n) && (l != o) && (l != p)
        && (m != n) && (m != o) && (m != p)
        && (n != o) && (n != p)
        && (o != p)
        && (abs(i - j) != 1) && (abs(j - k) != 1) && (abs(k - l) != 1) && (abs(l - m) != 1) 
        && (abs(m - n) != 1) && (abs(n - o) != 1) && (abs(o - p) != 1)
        && (abs(i - k) != 2) && (abs(j - l) != 2) && (abs(k - m) != 2) && (abs(l - n) != 2) 
        && (abs(m - o) != 2) && (abs(n - p) != 2)
        && (abs(i - l) != 3) && (abs(j - m) != 3) && (abs(k - n) != 3) && (abs(l - o) != 3) 
        && (abs(m - p) != 3) 
        && (abs(i - m) != 4) && (abs(j - n) != 4) && (abs(k - o) != 4) && (abs(l - p) != 4) 
        && (abs(i - n) != 5) && (abs(j - o) != 5) && (abs(k - p) != 5)
        && (abs(i - o) != 6) && (abs(j - p) != 6) 
        && (abs(i - p) != 7);
}
         
         
int main(void)
{
    int i, j, k, l, m, n, o, p;
     
    for (i = 0; i < 8; i++) {
        for (j = 0; j < 8; j++) {
            for (k = 0; k < 8; k++) {
                for (l = 0; l < 8; l++) {
                    for (m = 0; m < 8; m++) {
                        for (n = 0; n < 8; n++) {
                            for (o = 0; o < 8; o++) {
                                for (p = 0; p < 8; p++) {
                                    if (check(i, j, k, l, m, n, o, p)) {
                                        printf("%d %d %d %d %d %d %d %d/n", i, j, k, l, m, n, o, p);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
return 0;
}

Compiler output:
main.c: In function 'check':
main.c:7:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    7 | {
      | ^
main.c:29:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   29 | {
      | ^
main.c:53: error: expected '{' at end of input
Language: C

#include <stdio.h>
#define FREE_NOT 1
#define FREE 0
void putQueen(int);
int n=8;
int dpos[8];
int col[8];
int dneg[8];
int row[8];
int r[8],c[8];
int main() {
  int i;
  int k,a,b;

  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d",&r);
    scanf("%d",&c);
    row[r]=c;
  }
  
  putQueen(0);
  for(b=0;b<n;b++){
    for(a=0;a<n;a++){
      if(a==row[b]) printf("Q");
       
      else printf(" .");
    }
    printf("\n");
  }
  return 0;
}

void putQueen(int i)
{
  int j,b,a;
   
  
    
  if(i==n) return;
  

  for(j=0;j<n;j++){
    if(col[j]==FREE_NOT || dpos[i+j]==FREE_NOT || dneg[i-j+n-1]==FREE_NOT) continue;
    row[i]=j;
    col[j]=dpos[i+j]=dneg[i-j+n-1]=FREE_NOT;
    putQueen(i+1);
    col[j]=dpos[i+j]=dneg[i-j+n-1]=FREE;
  }
}

Compiler output:
main.c: In function 'main':
main.c:19:8: error: array subscript is not an integer
   19 |     row[r]=c;
      |        ^
Language: C

	else
	  printf("Q");
      }
      printf("\n");
    }
    return;
  }
  if(row[i] == NOT_FREE)
    putQueen(i+1);
  else{
    for(j = 0; j < N; j++){
      if(col[j] == NOT_FREE || dpos[i+j] == NOT_FREE || dneg[i-j+N-1] == NOT_FREE)
	continue;
	col[j] = dpos[i+j] = dneg[i-j+N-1] = Board[i][j] = NOT_FREE;
	putQueen(i+1);
	col[j] = dpos[i+j] = dneg[i-j+N-1] = Board[i][j] = FREE;
    }
  }
}

Compiler output:
main.c:1:9: error: expected identifier or '(' before 'else'
    1 |         else
      |         ^~~~
main.c:3:7: error: expected identifier or '(' before '}' token
    3 |       }
      |       ^
main.c:4:14: error: expected declaration specifiers or '...' before string constant
    4 |       printf("\n");
      |              ^~~~
main.c:5:5: error: expected identifier or '(' before '}' token
    5 |     }
      |     ^
main.c:6:5: error: expected identifier or '(' before 'return'
    6 |     return;
      |     ^~~~~~
main.c:7:3: error: expected identifier or '(' before '}' token
    7 |   }
      |   ^
main.c:8:3: error: expected identifier or '(' before 'if'
    8 |   if(row[i] == NOT_FREE)
      |   ^~
main.c:10:3: error: expected identifier or '(' before 'else'
   10 |   else{
      |   ^~~~
main.c:19:1: error: expected identifier or '(' before '}' token
   19 | }
      | ^
Language: C

#include<stdio.h>
#define N 8

int Location[N][N];
int row[N];
int col[N];
int attackR[2*N-1];
int attackL[2*N-1];

void init(){
  int i,j;
  for(i=0;i<N;i++)row[i]=col[i]==-1;
  for(i=0;i<2*N-1;i++) attackR[i]=attackL[i]=-1;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      Location[N][N]=-1;
    }
  }
}

void printLocation(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(Location[i][j]==1&&row[i]!=j)return;
    }
  }

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j)printf("Q");
      else printf(".");
    }
    printf("\n");
  }

}
void putQueen(int i){
  int j;
  if(i==N){
    printLocation();
    return ;
  }
  for(j=0;j<N;j++) {
    if(col[j]==1||attackL[j+1]==1||attackR[i-j+N-1]==1)continue;
    row[i]=j;
    col[j]=attackL[j+i]=attackR[i-j+N-1]=1;
    putQueen(i+1);
    col[j]=attackL[j+i]=attackR[i-j+N-1]=-1;
  }
}

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'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#define N 8

int Location[N][N];
int row[N];
int col[N];
int attackR[2*N-1];
int attackL[2*N-1];

void init(){
  int i,j;
  for(i=0;i<N;i++)row[i]=col[i]==-1;
  for(i=0;i<2*N-1;i++) attackR[i]=attackL[i]=-1;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      Location[N][N]=-1;
    }
  }
}

void printLocation(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(Location[i][j]==1&&row[i]!=j)return;
    }
  }

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j)printf("Q");
      else printf(".");
    }
    printf("\n");
  }

}
void putQueen(int i){
  int j;
  if(i==N){
    printLocation();
    return ;
  }
  for(j=0;j<N;j++) {
    if(col[j]==1||attackL[j+i]==1||attackR[i-j+N-1]==1)continue;
    row[i]=j;
    col[j]=attackL[j+i]=attackR[i-j+N-1]=1;
    putQueen(i+1);
    col[j]=attackL[j+i]=attackR[i-j+N-1]=-1;
  }
}

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'
collect2: error: ld returned 1 exit status
Language: C


#include<stdio.h>
#define N 8

int Location[N][N];
int row[N];
int col[N];
int attackR[2*N-1];
int attackL[2*N-1];

void init(){
  int i,j;
  for(i=0;i<N;i++)row[i]=col[i]==-1;
  for(i=0;i<2*N-1;i++) attackR[i]=attackL[i]=-1;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      Location[N][N]=-1;
    }
  }
}

void printLocation(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(Location[i][j]==1&&row[i]!=j)return;
    }
  }

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j)printf("Q");
      else printf(".");
    }
    printf("\n");
  }

}
void putQueen(int i){
  int j;
  if(i==N){
    printLocation();
    return ;
  }
  for(j=0;j<N;j++) {
    if(col[j]==1||attackL[j+i]==1||attackR[i-j+N-1]==1)continue;
    row[i]=j;
    col[j]=attackL[j+i]=attackR[i-j+N-1]=1;
    putQueen(i+1);
    col[j]=attackL[j+i]=attackR[i-j+N-1]=-1;
  }
}

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'
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#define FREE 0
#define N_FREE 1
#define Q 2
#define N 8
 
int board[N][N];
int row[N],col[N],dneg[2*N-1],dpos[2*N-1];

void printboard(int);
void putQueen(int);

int main(){
  int k,r,c;
  int i;
  
  
  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d",&r);
    scanf("%d",&c);
    board[r][c] = N_FREE;
  }
  
  putQueen(0);
      
  return 0;
}
 
void printboard(){
  int i, j;
  
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(board[i][j] == N_FREE && row[i] != j)
    return;
    }
  }
  
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(row[i] == j)
    printf("Q");
      else
    printf(".");
    }
    printf("\n");
  }
};
 
void putQueen(int i){
  int j;
   
  if(i==N){  
    printboard();
    return;
  }
 
  for(j=0;j<N;j++){
    if(col[j]==N_FREE || dpos[i+j]==N_FREE || dneg[i-j+N-1]==N_FREE){ 
      continue;
    }
 
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = N_FREE; 

    putQueen(i+1);
     
    col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
};
 

Compiler output:
main.c: In function 'printboard':
main.c:30:1: error: number of arguments doesn't match prototype
   30 | void printboard(){
      | ^~~~
main.c:10:6: error: prototype declaration
   10 | void printboard(int);
      |      ^~~~~~~~~~
main.c: In function 'putQueen':
main.c:55:5: error: too few arguments to function 'printboard'
   55 |     printboard();
      |     ^~~~~~~~~~
main.c:30:6: note: declared here
   30 | void printboard(){
      |      ^~~~~~~~~~
Language: C

#include<stdio.h>
#define N 8
#define FREE -1
#define NOT_FREE 1

 int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
bool X[N][N];

void initialize(){
  for(int i=0;i<N;i++){
    row[i]=FREE,col[i]=FREE;
  }

void printBoard(){
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(X[i][j]){
	if(row[i]!=j)return;
      }
    }
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      printf((row[i]==j)?"Q":".");
    }
    printf("\n");
  }
}

 void recursive(int i){
   if(i==N){
     printBoard();
     return;
   }
   for(int j=0;j<N;j++){
     if(NOT_FREE==col[j] ||NOT_FREE==dpos[i+j] || NOT_FREE==dneg[i-j+N-1] )continue;

     row[i]=j;
     col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;

     recursive(i+1);

     row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
   }
 }

 int main(){
   initialize();

   for(int i=0;i<N;i++){
     for(int j=0;j<N;j++)X[i][j]=false;
   }
   int k;
   scanf("%d",&k);
   for(int i=0;i<k;i++){
     int r,c;
     scanf("%d%d",&r,&c);
     X[r][c]=true;
   }

   recursive(0);
   return 0;
 }
 

Compiler output:
main.c:7:1: error: unknown type name 'bool'
    7 | bool X[N][N];
      | ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include<stdio.h>
  +++ |+#include <stdbool.h>
    2 | #define N 8
main.c: In function 'main':
main.c:51:34: error: 'false' undeclared (first use in this function)
   51 |      for(int j=0;j<N;j++)X[i][j]=false;
      |                                  ^~~~~
main.c:51:34: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:51:34: note: each undeclared identifier is reported only once for each function it appears in
main.c:58:14: error: 'true' undeclared (first use in this function)
   58 |      X[r][c]=true;
      |              ^~~~
main.c:58:14: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c: In function 'initialize':
main.c:63:2: error: expected declaration or statement at end of input
   63 |  }
      |  ^
Language: C

#include <stdio.h>
#define N 8
#define free 0
#define unfree 1

int Q[N][N],row[N],col[N],dpos[2*N-1],dneg[2*N-1];

int putQueen(int i){
 int k,j;
 if(i==N){
  for(k=0;k<N;k++){
   for(l=0;l<N;l++){
    if(Q[k][l] == free){
     printf(".");
    }
    else printf("Q");
    return;
   }
  }
 if(row[i]==unfree)
  putQueen(i+1);
 else for(j=0;j<N;j++){
  if(col[j]==unfree || dpos[i+j]==unfree || dneg[i-j+N-1]==unfree) continue;
  col[j]=dpos[i+j]=dneg[i-j+N-1]=Q[i][j]=unfree;
  putQueen(i+1);
  col[j]=dpos[i+j]=dneg[i-j+N-1]=Q[i][j]=0;
 }
}

int main(){
 int i,k,r,c;
 scanf("%d",&k);
 for(i=0;i<k;i++){
  scanf("%d %d",&r,&c);
  Q[r][c]=row[r]=col[c]=dpos[r+c]=dneg[r-c+N-1]=1;
 }
 putQueen(0);
 return 0;
}

Compiler output:
main.c: In function 'putQueen':
main.c:12:8: error: 'l' undeclared (first use in this function)
   12 |    for(l=0;l<N;l++){
      |        ^
main.c:12:8: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:5: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
   17 |     return;
      |     ^~~~~~
main.c:8:5: note: declared here
    8 | int putQueen(int i){
      |     ^~~~~~~~
main.c:39:1: error: expected declaration or statement at end of input
   39 | }
      | ^
Language: C

#include<stdio.h>
#define N 8
#define FREE -1
#define NOT_FREE 1
#define TRUE 1
#define FALSE 0

int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];

int X[N][N];

void initialize(){
  int i;
  for(i = 0; i < N; i++){
    row[i] = FREE;
    col[i] = FREE;
  }
  for(i = 0; i < 2 * N - 1; i++){
    dpos[i] = FREE;
    dneg[i] = FREE;
  }
}

void printBoard(){
  int i, j;
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(X[i][j] == TRUE) if(row[i] != j) return;
    }
  }
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(row[i] == j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void recursive(int i){
  int j;
  if(i == N){
    printBoard();
    return;
  }
  for(j = 0; j < N; j++){
    if(NOT_FREE == col[j] || NOT_FREE == dpos[i + j] || NOT_FREE == dneg[i - j + N - 1]) continue;
    row[i] = j;
    col[j] = NOT_FREE;
    dpos[i + j] = NOT_FREE;
    dneg[i - j + N - 1] = NOT_FREE;
    recursive(i + 1);
    row[i] = FREE;
    col[j] = FREE;
    dpos[i + j] = FREE;
    dneg[i - j + N - 1] = FREE;
  }
}

int main(){
  int i, j, k, r, c;
  initialize();
  for(i = 0; i < N; i++) for(j = 0; j < N; j++) X[i][j] = FALSE;
  scanf("%d",&k);
  for(i = 0; i < k; i++){
    scanf("%d%d",&r,&c);
    X[r][c] = TRUE;
  }
  recuresive(0);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:69:3: error: implicit declaration of function 'recuresive'; did you mean 'recursive'? [-Wimplicit-function-declaration]
   69 |   recuresive(0);
      |   ^~~~~~~~~~
      |   recursive
Language: C

#include <stdio.h>
??
int bunpai(int A[8][8], int *a, int *h, int *s, int *d, int n)
{
????int r, c;
????int x;
??
????if (n == 0) return 1;
??
????for (r = 0; r < 8; r++) {
????????if (h[r] == 0) {
????????????for (c = 0; c < 8; c++) {
????????if (v[c] == 0) {
????????????if (s[r+c] == 0 && d[r-c+7] == 0) {
????????????????A[r][c] = 1;
????????????????h[r] = 1;
????????????????a[c] = 1;
????????????????s[r+c] = 1;
????????????????d[r-c+7] = 1;
????????????????x = bunpai(A, a, h, s, d, n - 1);
????????????????if (x == 1) return 1;
????????????????else {
????????????????????A[r][c] = 0;
????????????????????h[r] = 0;
????????????????????a[c] = 0;
????????????????????s[r+c] = 0;
????????????????????d[r-c+7] = 0;
????????????????}
????????????}
????????}
????????????}
????????}
????}
????return 0;
}

??
int main(int argc, char *argv[])
{
????int A[8][8];
????int k, r, c;
  int i, j;
????int tate[8];
????int yoko[8];
????int sum[15];
????int B[15];
??
????scanf("%d", &k);
??
????for (i = 0; i < 8; i++) {
????????for (j = 0; j < 8; j++) 
    A[i][j] = 0;
????????tate[i] = 0;
????????yoko[i] = 0;
????}
??
????for (i = 0; i < 15; i++) {
????????sum[i] = 0;
????????diff[i] = 0;
????}
??????
????for (i = 0; i < k; i++) {
????????scanf("%d", &r);
????????scanf("%d", &c);
??
????????A[r][c] = 1;
????????yoko[r] = 1;
????????tate[c] = 1;
????????sum[r+c] = 1;
????????B[r-c+7] = 1;
????}
??
????bunpai(A, tate, yoko, sum, B, 8 - k);
??
????for (i = 0; i < 8; i++) {
????????for (j = 0; j < 8; j++) {
????????????if (A[i][j] == 0) printf(".");
????????????else printf("Q");
????????}
????????printf("\n");
????}
??
????return 0;
}
??

Compiler output:
main.c:2:1: error: expected identifier or '(' before '?' token
    2 | ??
      | ^
main.c:37:1: error: expected identifier or '(' before '?' token
   37 | ??
      | ^
main.c:85:1: error: expected identifier or '(' before '?' token
   85 | ??
      | ^
Language: C

#include <iostream>
using namespace std;
int n;
char p[8][8];
bool di(int a,int b){
	for(int i=a,j=b;i<8&&j<8;){
		if(p[i][j]=='Q')
			return 0;
		i++;
		j++;
	}
	for(int i=a,j=b;i>=0&&j<8;){
		if(p[i][j]=='Q')
			return 0;
		i--;
		j++;
	}
	for(int i=a,j=b;i<8&&j>=0;){
		if(p[i][j]=='Q')
			return 0;
		i++;
		j--;
	}
	for(int i=a,j=b;i>=0&&j>=0;){
		if(p[i][j]=='Q')
			return 0;
		i--;
		j--;
	}
	return 1;
}
bool co(int b){
	for(int i=0;i<8;i++)
		if(p[i][b]=='Q')
			return 0;
	return 1;
}
void qu(int);
int main(int argc, char** argv) {
	ios::sync_with_stdio(0);
//    cin.tie(0);
	while(cin>>n){
		for(int i=0;i<8;i++)
			for(int j=0;j<8;j++)
				p[i][j]='.';
		for(int i=0;i<n;i++){
			int x,y;
			cin>>x>>y;
			p[x][y]='Q';
		}
		qu(0);
	}
	return 0;
}
void qu(int ok){
	if(ok<8){
		for(int i=0;i<8;i++)
			if(p[ok][i]=='Q'){
				qu(ok+1);
				break;
			}
		for(int i=0;i<8;i++){
			if(di(ok,i)&&co(i)){
				p[ok][i]='Q';
				qu(ok+1);
				p[ok][i]='.';
			}
		}
	}
	else{
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++)
				cout<<p[i][j];
			cout<<'\n';
		}
	}
}


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

#include <iostream>

using namespace std;

#define N 8

//  x 0 1 2 3 ...
// y
// 0
// 1
// 2
// 3
// ...

int pos[N];
int row_reserved[N];
bool col_owned[N];
bool down_owned[2 * N - 1];
bool up_owned[2 * N - 1];

void init_board() {
  memset(pos, -1, sizeof(pos));
  memset(row_reserved, -1, sizeof(row_reserved));
  memset(col_owned, false, sizeof(col_owned));
  memset(down_owned, false, sizeof(down_owned));
  memset(up_owned, false, sizeof(up_owned));
}

void print_board() {
  for(int i = 0;i < N;i++) {
    for(int j = 0;j < N;j++) {
      if(pos[i] == j) {
        cout << 'Q';
      } else {
        cout << '.';
      }
    }
    cout << endl;
  }
}

void set_queen(int x, int y) {
  pos[y] = x;
  col_owned[x] = true;
  down_owned[y - x + (N - 1)] = true;
  up_owned[x + y] = true;
}

void remove_queen(int x, int y) {
  pos[y] = -1;
  col_owned[x] = false;
  down_owned[y - x + (N - 1)] = false;
  up_owned[x + y] = false;
}

bool solve(int y) {
  int i;

  for(int j = 0;j < N;j++) {
    i = row_reserved[y] == -1 ? j : row_reserved[y];
    if(!col_owned[i] && !down_owned[y - i + (N - 1)] && !up_owned[i + y]) {
      set_queen(i, y);

      if(y + 1 >= N) {
        return true;
      }
      if(solve(y + 1)) {
        return true;
      } else {
        remove_queen(i, y);
      }
    }
  }

  return false;
}

int main() {
  int k, r, c;

  init_board();

  cin >> k;
  for(int i = 0;i < k;i++) {
    cin >> r >> c;
    row_reserved[r] = c;
  }

  solve(0);
  print_board();

  return 0;
}



Compiler output:
a.cc: In function 'void init_board()':
a.cc:22:3: error: 'memset' was not declared in this scope
   22 |   memset(pos, -1, sizeof(pos));
      |   ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

from itertools import permutations
def check(queen):
    for r1, c1 in queen:
        if any((r1 != r2 or c1 != c2) and (r1 == r2 or c1 == c2 or r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2) for r2, c2 in queen):
            return False
    return True
N = int(input())
queen, row, col = [], list(range(8)), list(range(8))
for _ in range(N):
    r, c = map(int, input().split())
    queen.append((r, c))
    row.remove(r)
    col.remove(c)
for l in permutations(col):
    queen_tmp = queen[:] + [(r, c) for r, c in zip(row, l)]
    if check(queen_tmp):
        board = [''.join('Q' if (r, c) in queen_tmp else '.' for c in range(8)) for r in range(8)]
        print(*board, sep='\n')
        break

Compiler output:
a.cc:17:18: error: empty character constant
   17 |         board = [''.join('Q' if (r, c) in queen_tmp else '.' for c in range(8)) for r in range(8)]
      |                  ^~
a.cc:1:1: error: 'from' does not name a type
    1 | from itertools import permutations
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
free 0
false 0;

int a[8]={},b[8]={},c[15]={},d[15]={};
int x[8][8]={};

 
void dfs(int i){
  int j;
  if(i==N){
  for(int i=0;i<8;i++)
    for(int j=0;j<8;j++)
     if(x[i][j]==1)
      if(a[i]!=j)return;

  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++)
      printf("%s",(row[i] == j)?"Q":".");    
    cout<<endl;
  } 
    return;
  }

  for(int j=0;j<N;j++){
    if(b[j]!=1 && c[i+j]!=1 && d[i-j+N-1]!=1){
     a[i]=j;
     b[j]=c[i+j]=d[i-j+N-1]=1;
     dfs(++i);
     a[i]=b[j]=c[i+j]=d[i-j+N-1]=0;
   }
  }
}
    
int main(){
  int n,r,c1;   
  cin>>n;
  for(i=0;i<k;i++){
    cin>>r>>c1;
    x[r][c1]=1;
  }
  dfs(0);
 return 0;
}

Compiler output:
a.cc:4:1: error: 'free' does not name a type
    4 | free 0
      | ^~~~
a.cc:2:1: note: 'free' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    1 | #include<bits/stdc++.h>
  +++ |+#include <cstdlib>
    2 | using namespace std;
a.cc: In function 'void dfs(int)':
a.cc:13:9: error: 'N' was not declared in this scope
   13 |   if(i==N){
      |         ^
a.cc:21:20: error: 'row' was not declared in this scope; did you mean 'pow'?
   21 |       printf("%s",(row[i] == j)?"Q":".");
      |                    ^~~
      |                    pow
a.cc:27:17: error: 'N' was not declared in this scope
   27 |   for(int j=0;j<N;j++){
      |                 ^
a.cc: In function 'int main()':
a.cc:40:7: error: 'i' was not declared in this scope
   40 |   for(i=0;i<k;i++){
      |       ^
a.cc:40:13: error: 'k' was not declared in this scope
   40 |   for(i=0;i<k;i++){
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
void dfs(int );

int a[8]={},b[8]={},c[15]={},d[15]={};
int x[8][8]={};

void dfs(int i){
  if(i==N){
  for(int i=0;i<8;i++)
    for(int j=0;j<8;j++)
     if(x[i][j]==1)
      if(a[i]!=j)return;

  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++)
      printf("%s",(row[i] == j)?"Q":".");    
    cout<<endl;
  } 
  }
  else{
  for(int j=0;j<N;j++)
    if(b[j]!=1 && c[i+j]!=1 && d[i-j+N-1]!=1){
     a[i]=j;
     b[j]=c[i+j]=d[i-j+N-1]=1;
     dfs(++i);
     a[i]=b[j]=c[i+j]=d[i-j+N-1]=0;
   }
  }
}

    
int main(){
  int n,r,c1;   
  cin>>n;
  for(i=0;i<k;i++){
    cin>>r>>c1;
    x[r][c1]=1;
  }
  dfs(0);
 return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:9:9: error: 'N' was not declared in this scope
    9 |   if(i==N){
      |         ^
a.cc:17:20: error: 'row' was not declared in this scope; did you mean 'pow'?
   17 |       printf("%s",(row[i] == j)?"Q":".");
      |                    ^~~
      |                    pow
a.cc: In function 'int main()':
a.cc:36:7: error: 'i' was not declared in this scope
   36 |   for(i=0;i<k;i++){
      |       ^
a.cc:36:13: error: 'k' was not declared in this scope
   36 |   for(i=0;i<k;i++){
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
void dfs(int );

int a[8]={},b[8]={},c[15]={},d[15]={};
char ch[8][8];

void dfs(int i){
  if(i==N){
  for(int i=0;i<8;i++)
    for(int j=0;j<8;j++)
     if(x[i][j]=='Q')
      if(a[i]!=j)return;

  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++)
     cout<<x[i][j];      
    cout<<endl;
  } 
  return;
 }

  for(int j=0;j<N;j++)
    if(b[j]!=1 && c[i+j]!=1 && d[i-j+N-1]!=1){
     a[i]=j;
     b[j]=c[i+j]=d[i-j+N-1]=1;
     dfs(++i);
     a[i]=b[j]=c[i+j]=d[i-j+N-1]=0;
   }

}    
int main(){
  int n,r,c1;   
  cin>>n;
  for(int i=0;i<n;i++)
   for(int j=0;j<n;j++)
    x[i][j]='.';
  for(i=0;i<k;i++){
    cin>>r>>c1;
    x[r][c1]='Q';
  }
  dfs(0);
 return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:9:9: error: 'N' was not declared in this scope
    9 |   if(i==N){
      |         ^
a.cc:12:9: error: 'x' was not declared in this scope
   12 |      if(x[i][j]=='Q')
      |         ^
a.cc:17:12: error: 'x' was not declared in this scope
   17 |      cout<<x[i][j];
      |            ^
a.cc:23:17: error: 'N' was not declared in this scope
   23 |   for(int j=0;j<N;j++)
      |                 ^
a.cc: In function 'int main()':
a.cc:37:5: error: 'x' was not declared in this scope
   37 |     x[i][j]='.';
      |     ^
a.cc:38:7: error: 'i' was not declared in this scope
   38 |   for(i=0;i<k;i++){
      |       ^
a.cc:38:13: error: 'k' was not declared in this scope
   38 |   for(i=0;i<k;i++){
      |             ^
a.cc:40:5: error: 'x' was not declared in this scope
   40 |     x[r][c1]='Q';
      |     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
void dfs(int);

int a[8]={},b[8]={},c[15]={},d[15]={};
char ch[8][8];

void dfs(int x){
  if(x==8){
   for(int i=0;i<8;i++)
    for(int j=0;j<8;j++)
     if(x[i][j]=='Q')
      if(a[i]!=j)return;
   for(int i=0;i<8;i++){
    for(int j=0;j<8;j++)
     cout<<x[i][j];      
    cout<<endl;
  } 
  return;
 }

  for(int j=0;j<8;j++)
    if(b[j]!=1 && c[x+j]!=1 && d[x-j+7]!=1){
     a[x]=j;
     b[j]=c[x+j]=d[x-j+7]=1;
     dfs(++x);
     a[x]=b[j]=c[x+j]=d[x-j+7]=0;
   }

}    
int main(){
  int n,r,c1;   
  cin>>n;
  for(int i=0;i<8;i++)
   for(int j=0;j<8;j++)
    x[i][j]='.';
  for(int i=0;i<n;i++){
    cin>>r>>c1;
    x[r][c1]='Q';
  }
  dfs(0);
 return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:12:10: error: invalid types 'int[int]' for array subscript
   12 |      if(x[i][j]=='Q')
      |          ^
a.cc:16:13: error: invalid types 'int[int]' for array subscript
   16 |      cout<<x[i][j];
      |             ^
a.cc: In function 'int main()':
a.cc:36:5: error: 'x' was not declared in this scope
   36 |     x[i][j]='.';
      |     ^
a.cc:39:5: error: 'x' was not declared in this scope
   39 |     x[r][c1]='Q';
      |     ^
Language: C++

#include <iostream>
using namespace std;

char print[8][8];
bool board[8][8];

void put(int r, int c){

	print[c][r] = 'Q';
	board[c][r] = false;

	int temp_x[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
	int temp_y[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
	
	int x = r, y = c;
	for (int i = 0; i < 8; i++){
		
		x = r, y = c;
		while (x + temp_x[i] >= 0 && y + temp_y[i] >= 0 && x + temp_x[i] < 8 && y + temp_y[i] < 8){
			
			x += temp_x[i]; y += temp_y[i];
			board[y][x] = false;
		}
	}

	return;
}

void del(int r, int c){

	print[c][r] = '.';
	board[c][r] = true;

	int temp_x[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
	int temp_y[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };

	int x = r, y = c;
	for (int i = 0; i < 8; i++){

		x = r, y = c;
		while (x + temp_x[i] >= 0 && y + temp_y[i] >= 0 && x + temp_x[i] < 8 && y + temp_y[i] < 8){

			x += temp_x[i]; y += temp_y[i];
			board[y][x] = true;;
		}
	}

	return;
}

int Backtrack(int i){

	if (i == 8)return 1;

	bool flg = true;
	for (int j = 0; j < 8; j++){

		if (print[i][j] == 'Q')
			flg = false;
	}

	if (flg){

		bool flg1 = true;
		for (int j = 0; j < 8; j++){
			flg1 = false;
			if (board[i][j]){
				put(j, i);
				flg1 = true;
				if (Backtrack(i + 1) == 1 ) break;
				else{
					del(j, i);
					flg1 = false;
				}
			}
		}

		if (!flg1) return 0;
	}

	else Backtrack(i + 1);

	return 1;
}

int main(void){

	memset(board, true, sizeof(board));
	memset(print, '.', sizeof(print));

	int k;

	cin >> k;


	for (int i = 0; i < k; i++){

		int  r, c;
		cin >> r >> c;
		put(r, c);
	}

	Backtrack(0);

	for (int i = 0; i < 8; i++){
		for (int j = 0; j < 8; j++){

			cout << print[i][j];
		}

		cout << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:88:9: error: 'memset' was not declared in this scope
   88 |         memset(board, true, sizeof(board));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <iostream>
#include <stack>
#define N 8
using namespace std;

stack<char> s[N][N];
char map[N][N];
int kazu;

void post(int a,int b){
	for(int i=0;i<N;i++){
		s[i][b].push(1);
		if(i!=b) s[a][i].push(1);
	}
	for(int i=1;i+a<N&&i+b<N;i++){
		s[a+i][b+i].push(1);
	}
	for(int i=1;a-i>=0&&b-i>=0;i++){
		s[a-i][b-i].push(1);
	}
	for(int i=1;a+i<N&&b-i>=0;i++){
		s[a+i][b-i].push(1);
	}
	for(int i=1;a-i>=0&&b+i<N;i++){
		s[a-i][b+i].push(1);
	}
}

void receive(int a,int b){
	for(int i=0;i<N;i++){
		s[i][b].pop();
		if(i!=b)s[a][i].pop();
	}
	for(int i=1;i+a<N&&i+b<N;i++){
		s[a+i][b+i].pop();
	}
	for(int i=1;a-i>=0&&b-i>=0;i++){
		s[a-i][b-i].pop();
	}
	for(int i=1;a+i<N&&b-i>=0;i++){
		s[a+i][b-i].pop();
	}
	for(int i=1;a-i>=0&&b+i<N;i++){
		s[a-i][b+i].pop();
	}

}

void rop(int a,int b){
	map[a][b]='Q';
	post(a,b);
	kazu++;
	if(kazu==8){
		view();
		exit(0);
	}
	for(int i=a+1;i<N;i++){
		for(int j=0;j<N;j++){
			if(s[i][j].empty()) rop(i,j);
		}
	}
		receive(a,b);
		map[a][b]='.';
		kazu--;
}

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

	kazu=0;
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			map[i][j]='.';
		}
	}

	cin>>n;
	while(n--){
		cin>>a>>b;
		map[a][b]='Q';
		post(a,b);
		kazu++;
	}

	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(s[i][j].empty()){
				rop(i,j);
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'void rop(int, int)':
a.cc:54:17: error: 'view' was not declared in this scope
   54 |                 view();
      |                 ^~~~
Language: C++

#include"windows.h"
#include<cstring>
#include<iostream>
#include<cassert>
using namespace std;

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2*N-1], dneg[2*N-1];
bool X[N][N];

void initialize(){
	for(int i=0; i<N; i++){ row[i]=FREE, col[i]=FREE; }
	for(int i=0; i<2*N-1; i++){ dpos[i]=FREE; dneg[i]=FREE; }
}


void printBoard(){
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			if( X[i][j] ){
				if( row[i] != j ) return ;
			}
		}
	}

	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			cout << ( (row[i]==j) ? "Q" : "." );
		}
		cout << "\n";
	}
}

void recursive(int i){
	if(i==N){ // ??????????????????????????????
		printBoard(); 
		return ;
	}

	for(int j=0; j<N; j++){
		// (i,j)?????????????????????????\?????????????????????´????????????
		if( NOT_FREE == col[j] ||
			NOT_FREE == dpos[i+j] ||
			NOT_FREE == dneg [i-j+N-1]) continue;
		// (i,j)??????????????????????????????
		row[i] = j;
		col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
	}
	// ??????????????????????????±???
}


int main(){
	initialize();

	for(int i=0; i<N; i++)
		for(int j=0; j<N; j++) X[i][j] = false;

	int k;
	cin >> k;

	for(int i=0; i<k; i++){
		int r,c;
		cin >> r >> c;
		X[r][c] = true;
	}

	recursive(0);
	return 0;
}

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

#include"windows.h"
#include<cstring>
#include<iostream>
#include<cassert>
using namespace std;

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2*N-1], dneg[2*N-1];
bool X[N][N];

void initialize(){
	for(int i=0; i<N; i++){ row[i]=FREE, col[i]=FREE; }
	for(int i=0; i<2*N-1; i++){ dpos[i]=FREE; dneg[i]=FREE; }
}


void printBoard(){
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			if( X[i][j] ){
				if( row[i] != j ) return ;
			}
		}
	}

	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			cout << ( (row[i]==j) ? "Q" : "." );
		}
		cout << "\n";
	}
}

void recursive(int i){
	if(i==N){ // ??????????????????????????????
		printBoard(); 
		return ;
	}

	for(int j=0; j<N; j++){ // ??????????????????????????±???
		// (i,j)?????????????????????????\?????????????????????´????????????
		if( NOT_FREE == col[j] ||
			NOT_FREE == dpos[i+j] ||
			NOT_FREE == dneg [i-j+N-1]) continue;
		// (i,j)??????????????????????????????
		row[i] = j;
		col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;

		// ?¬?????????§??????
		recursive(i+1);
		// (i,j)???????????????????????????????????????????????????
		row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
	}
}


int main(){
	initialize();

	for(int i=0; i<N; i++)
		for(int j=0; j<N; j++) X[i][j] = false;

	int k;
	cin >> k;

	for(int i=0; i<k; i++){
		int r,c;
		cin >> r >> c;
		X[r][c] = true;
	}

	recursive(0);
	return 0;
}

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

#include"windows.h"
#include<cstring>
#include<iostream>
#include<cassert>
using namespace std;

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2*N-1], dneg[2*N-1];
bool X[N][N];

void initialize(){
	for(int i=0; i<N; i++){ row[i]=FREE, col[i]=FREE; }
	for(int i=0; i<2*N-1; i++){ dpos[i]=FREE; dneg[i]=FREE; }
}


void printBoard(){
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			if( X[i][j] ){
				if( row[i] != j ) return ;
			}
		}
	}

	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			cout << ( (row[i]==j) ? "Q" : "." );
		}
		cout << "\n";
	}
}

void recursive(int i){
	if(i==N){ // ??????????????????????????????
		printBoard(); 
		return ;
	}

	for(int j=0; j<N; j++){ // ??????????????????????????±???
		// (i,j)?????????????????????????\?????????????????????´????????????
		if( NOT_FREE == col[j] ||
			NOT_FREE == dpos[i+j] ||
			NOT_FREE == dneg [i-j+N-1]) continue;
		// (i,j)??????????????????????????????
		row[i] = j;
		col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;

		// ?¬?????????§??????
		recursive(i+1);
		// (i,j)???????????????????????????????????????????????????
		row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
	}
}


int main(){
	initialize();

	for(int i=0; i<N; i++)
		for(int j=0; j<N; j++) X[i][j] = false;

	int k;
	cin >> k;

	for(int i=0; i<k; i++){
		int r,c;
		cin >> r >> c;
		X[r][c] = true;
	}

	recursive(0);
	cout << "\n";
	return 0;
}

Compiler output:
a.cc:1:9: fatal error: windows.h: No such file or directory
    1 | #include"windows.h"
      |         ^~~~~~~~~~~
compilation terminated.