Language: C++

#define FOR(i,n) for(int i=0; i<n; ++i)
#define GET(type,name) type name; std::cin >> name;

  inline std::pair<int, int> min_max_in_the_same_line(const std::vector<std::vector<int>>& a){
    int n = a.size();
    std::vector<int> left(n);
    std::vector<int> up(n);
    std::vector<int> upleft(2*n-1); // (7,0) --> 0, (0,0) --> 7, (0,7) --> 14
    FOR(i,n){
      FOR(j,n){
        left[i] += a[i][j];
        up[j] += a[i][j];
        upleft[n - 1 - i + j] += a[i][j];
      }
    }
    int M = std::max(
      std::max(*std::max_element(left.begin(), left.end()), *std::max_element(upleft.begin(), upleft.end())),
      *std::max_element(up.begin(), up.end())
    );
    int m = std::min(
      std::min(*std::min_element(left.begin(), left.end()), *std::min_element(upleft.begin(), upleft.end())),
      *std::min_element(up.begin(), up.end())
    );
//    std::cout << m << ", " <<  M <<std::endl;
    return std::make_pair(m, M);
  };

  inline bool is_valid_board(const std::vector<std::vector<int>>& a){
    return min_max_in_the_same_line(a).second <= 1;
  }

  inline bool is_completed_board(const std::vector<std::vector<int>>& a){
    int s=0;
    auto n = a.size();
    FOR(i,n){
      FOR(j,n){
        if(a[i][j]==1) s+=1;
      }
    }
    return is_valid_board(a) and s==n;
  }


  std::vector<std::vector<int>> rec_8queen_solve(std::vector<std::vector<int>> a){
//    std::cout << 'x' << std::endl;
    int n = a.size();
//    FOR(p, n){
//      FOR(q, n){
//        std::cout << a[p][q];
//      }
//      std::cout<<std::endl;
//    }


    if(is_completed_board(a)){
//      std::cout << 'a' << std::endl;
      return a;
    }

    if(not is_valid_board(a)){
//      std::cout << 'b' << std::endl;
      return a;
    }

//    std::cout << 'c' << std::endl;

    FOR(i,n) {
      FOR(j, n) {
        std::vector<std::vector<int>> a_next = a;
        a_next[i][j] += 1;
        if(is_valid_board(a_next)){

//          std::cout << 'C' << n << std::endl;

          auto b = rec_8queen_solve(a_next);
//          std::cout << 'B' << std::endl;

          if(is_completed_board(b)){
//            std::cout << 'A' << std::endl;

            return b;
          }
        }
      }
    }

//    std::cout << 'd' << std::endl;


    return a;
  };

  int main(){
    int n = 8;
    GET(int, k)
    std::vector<std::vector<int>> a (n, std::vector<int>(n));
//    std::vector<int> left(8);
//    std::vector<int> up(8);
//    std::vector<int> upleft(15); // (7,0) --> 0, (0,0) --> 7, (0,7) --> 14

    FOR(i, k){
      GET(int, r);
      GET(int, c);
      a[r][c] = 1;
//      left[r] += 1;
//      up[c] += 1;
//      upleft[7-r+c] += 1;
    }

    auto solved_board = rec_8queen_solve(a);
//    std::cout<<"z"<<std::endl;
    FOR(i, n){
      FOR(j, n){
        std::cout << (solved_board[i][j]==1 ? 'Q' : '.');
      }
      std::cout<<std::endl;
    }
  };

Compiler output:
a.cc:4:15: error: 'pair' in namespace 'std' does not name a template type
    4 |   inline std::pair<int, int> min_max_in_the_same_line(const std::vector<std::vector<int>>& a){
      |               ^~~~
a.cc:1:1: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
  +++ |+#include <utility>
    1 | #define FOR(i,n) for(int i=0; i<n; ++i)
a.cc:28:41: error: 'vector' in namespace 'std' does not name a template type
   28 |   inline bool is_valid_board(const std::vector<std::vector<int>>& a){
      |                                         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #define FOR(i,n) for(int i=0; i<n; ++i)
a.cc:28:47: error: expected ',' or '...' before '<' token
   28 |   inline bool is_valid_board(const std::vector<std::vector<int>>& a){
      |                                               ^
a.cc: In function 'bool is_valid_board(int)':
a.cc:29:37: error: 'a' was not declared in this scope
   29 |     return min_max_in_the_same_line(a).second <= 1;
      |                                     ^
a.cc:29:12: error: 'min_max_in_the_same_line' was not declared in this scope
   29 |     return min_max_in_the_same_line(a).second <= 1;
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
a.cc: At global scope:
a.cc:32:45: error: 'vector' in namespace 'std' does not name a template type
   32 |   inline bool is_completed_board(const std::vector<std::vector<int>>& a){
      |                                             ^~~~~~
a.cc:32:40: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
   32 |   inline bool is_completed_board(const std::vector<std::vector<int>>& a){
      |                                        ^~~
a.cc:32:51: error: expected ',' or '...' before '<' token
   32 |   inline bool is_completed_board(const std::vector<std::vector<int>>& a){
      |                                                   ^
a.cc: In function 'bool is_completed_board(int)':
a.cc:34:14: error: 'a' was not declared in this scope
   34 |     auto n = a.size();
      |              ^
a.cc: At global scope:
a.cc:44:8: error: 'vector' in namespace 'std' does not name a template type
   44 |   std::vector<std::vector<int>> rec_8queen_solve(std::vector<std::vector<int>> a){
      |        ^~~~~~
a.cc:44:3: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
   44 |   std::vector<std::vector<int>> rec_8queen_solve(std::vector<std::vector<int>> a){
      |   ^~~
a.cc: In function 'int main()':
a.cc:2:40: error: 'cin' is not a member of 'std'
    2 | #define GET(type,name) type name; std::cin >> name;
      |                                        ^~~
a.cc:95:5: note: in expansion of macro 'GET'
   95 |     GET(int, k)
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define FOR(i,n) for(int i=0; i<n; ++i)
a.cc:96:10: error: 'vector' is not a member of 'std'
   96 |     std::vector<std::vector<int>> a (n, std::vector<int>(n));
      |          ^~~~~~
a.cc:96:10: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:96:22: error: 'vector' is not a member of 'std'
   96 |     std::vector<std::vector<int>> a (n, std::vector<int>(n));
      |                      ^~~~~~
a.cc:96:22: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:96:29: error: expected primary-expression before 'int'
   96 |     std::vector<std::vector<int>> a (n, std::vector<int>(n));
      |                             ^~~
a.cc:2:40: error: 'cin' is not a member of 'std'
    2 | #define GET(type,name) type name; std::cin >> name;
      |                                        ^~~
a.cc:102:7: note: in expansion of macro 'GET'
  102 |       GET(int, r);
      |       ^~~
a.cc:2:40: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #define GET(type,name) type name; std::cin >> name;
      |                                        ^~~
a.cc:102:7: note: in expansion of macro 'GET'
  102 |       GET(int, r);
      |       ^~~
a.cc:2:40: error: 'cin' is not a member of 'std'
    2 | #define GET(type,name) type name; std::cin >> name;
      |                                        ^~~
a.cc:103:7: note: in expansion of macro 'GET'
  103 |       GET(int, c);
      |       ^~~
a.cc:2:40: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #define GET(type,name) type name; std::cin >> name;
      |                                        ^~~
a.cc:103:7: note: in expansion of macro 'GET'
  103 |       GET(int, c);
      |       ^~~
a.cc:104:7: error: 'a' was not declared in this scope
  104 |       a[r][c] = 1;
      |       ^
a.cc:110:42: error: 'a' was not declared in this scope
  110 |     auto solved_board = rec_8queen_solve(a);
      |                                          ^
a.cc:110:25: error: 'rec_8queen_solve' was not declared in this scope
  110 |     auto solved_board = rec_8queen_solve(a);
      |                         ^~~~~~~~~~~~~~~~
a.cc:114:14: error: 'cout' is not a member of 'std'
  114 |         std::cout << (solved_board[i][j]==1 ? 'Q' : '.');
      |              ^~~~
a.cc:114:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:116:12: error: 'cout' is not a member of 'std'
  116 |       std::cout<<std::endl;
      |            ^~~~
a.cc:116:12: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:116:23: error: 'endl' is not a member of 'std'
  116 |       std::cout<<std::endl;
      |                       ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define FOR(i,n) for(int i=0; i<n; ++i)