#include usingnamespacestd; #define pb push_back #define mp make_pair #define F first #define S second typedeflonglong LL; typedef pair<int, int> pii; LL gao(vector<int> a) {stack S;int n &#61; a.size();for (int i &#61; 0; i <100; &#43;&#43;i) S.push(0);for (int i &#61; 0; i if (!a[i]) {LL x &#61; S.top();S.pop();LL y &#61; S.top();S.pop();S.push(x &#43; y);}else S.push(a[i]);}return S.top(); } struct Suminator {int findMissing(vector <int> a, int S) {int n &#61; a.size();int p;for (int i &#61; 0; i if (a[i] &#61;&#61; -1) p &#61; i;a[p] &#61; 0;LL t &#61; gao(a);if (t &#61;&#61; S) return0;a[p] &#61; 1;LL u &#61; gao(a);a[p] &#61; 2;LL v &#61; gao(a);if (u &#61;&#61; v) return -1;if (u <&#61; S) return S - u &#43; 1;return -1;} };