#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
// #define int long long
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
void create_circuit(int m, std::vector<int> a) {
int n = a.size();
vector<int> c(m + 1, 0), x, y;
vector<vector<int>> g(m + 1);
a.pb(0);
g[0].pb(a[0]);
for(int i = 0; i < n; i++) {
g[a[i]].pb(a[i + 1]);
}
auto add = [&](int X, int Y) -> int {
x.pb(X);
y.pb(Y);
return -(int)x.size();
}
for(int i = 0; i <= m; i++) {
int sz = g[i].size();
if(sz == 0) continue;
int tmp = 1;
while(tmp * 2 < sz) tmp *= 2;
while(g[i].size() < tmp) g[i].pb(0);
vector<int> tmp;
while(g[i].size() > 1) {
for(int j = 0; j < g[i].size(); j += 2) {
tmp.pb(add(g[i][j], g[i][j + 1]));
}
swap(tmp, g[i]);
}
c[i] = g[i][0];
}
answer(c, x, y);
}
Compilation message
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:37:2: error: expected ',' or ';' before 'for'
37 | for(int i = 0; i <= m; i++) {
| ^~~
doll.cpp:37:17: error: 'i' was not declared in this scope
37 | for(int i = 0; i <= m; i++) {
| ^