boxes.cpp:1:27: error: 'p' was not declared in this scope
long long int sumright = p[here], leftright = -1;
^
boxes.cpp:1:29: error: 'here' was not declared in this scope
long long int sumright = p[here], leftright = -1;
^~~~
boxes.cpp:2:5: error: 'cur' does not name a type; did you mean 'char'?
cur = k - 1;
^~~
char
boxes.cpp:4:5: error: expected unqualified-id before 'for'
for (int i = here + 1; i < n; ++i)
^~~
boxes.cpp:4:28: error: 'i' does not name a type
for (int i = here + 1; i < n; ++i)
^
boxes.cpp:4:35: error: expected unqualified-id before '++' token
for (int i = here + 1; i < n; ++i)
^~
boxes.cpp:18:5: error: 'sumright' does not name a type
sumright += p[n - 1] * 1LL;
^~~~~~~~