Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000;
#define mod MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005

int Layer(int i){ //pは1、bは2
    vector<int> v[i];
    if(i == 0){
        v[i].push_back(1);
    } else {
        for(int j = 0; j < i; j++){
            v[i].push_back(2);
            v[i].push_back(v[i-1]);
            v[i].push_back(1);
            v[i].push_back(v[i-1]);
            v[i].push_back(2);
        }
    }
    return v[i];
}

int main(){
    int n; cin >> n;
    int x; cin >> x;
    int cnt = 0;
    vector<int> s = Layer(n);
    for(int i = 0; i < x; i++){
        if(v[i] == 1){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int Layer(int)':
a.cc:17:27: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>&)'
   17 |             v[i].push_back(v[i-1]);
      |             ~~~~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:19:27: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>&)'
   19 |             v[i].push_back(v[i-1]);
      |             ~~~~~~~~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:23:15: error: cannot convert 'std::vector<int>' to 'int' in return
   23 |     return v[i];
      |            ~~~^
      |               |
      |               std::vector<int>
a.cc: In function 'int main()':
a.cc:30:26: error: conversion from 'int' to non-scalar type 'std::vector<int>' requested
   30 |     vector<int> s = Layer(n);
      |                     ~~~~~^~~
a.cc:32:12: error: 'v' was not declared in this scope
   32 |         if(v[i] == 1){
      |            ^