foo.cc:31:1: error: 'concept' does not name a type; did you mean 'const'?
31 | concept Container = std::ranges::range<T> && requires { typename T::value_type; } && !same_as<T,string>;
| ^~~~~~~
| const
foo.cc:31:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
foo.cc:31:86: error: expected unqualified-id before '!' token
31 | concept Container = std::ranges::range<T> && requires { typename T::value_type; } && !same_as<T,string>;
| ^
foo.cc:32:11: error: 'Container' has not been declared
32 | template <Container C>
| ^~~~~~~~~
foo.cc:33:34: error: 'C' has not been declared
33 | istream& operator>>(istream& is, C& c) {
| ^
foo.cc: In function 'std::istream& operator>>(std::istream&, int&)':
foo.cc:34:23: error: there are no arguments to 'begin' that depend on a template parameter, so a declaration of 'begin' must be available [-fpermissive]
34 | for (auto& elem : c) is >> elem;
| ^
foo.cc:34:23: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
foo.cc:34:23: error: there are no arguments to 'end' that depend on a template parameter, so a declaration of 'end' must be available [-fpermissive]
foo.cc: At global scope:
foo.cc:37:11: error: 'Container' has not been declared
37 | template <Container C>
| ^~~~~~~~~
foo.cc:38:34: error: 'C' has not been declared
38 | ostream& operator<<(ostream& os, C& c) {
| ^
foo.cc: In function 'std::ostream& operator<<(std::ostream&, int&)':
foo.cc:39:22: error: request for member 'begin' in 'c', which is of non-class type 'int'
39 | for (auto it = c.begin(); it != c.end(); it++) os << *it << (next(it) == c.end()?"":" ");
| ^~~~~
foo.cc:39:39: error: request for member 'end' in 'c', which is of non-class type 'int'
39 | for (auto it = c.begin(); it != c.end(); it++) os << *it << (next(it) == c.end()?"":" ");
| ^~~
foo.cc:39:80: error: request for member 'end' in 'c', which is of non-class type 'int'
39 | for (auto it = c.begin(); it != c.end(); it++) os << *it << (next(it) == c.end()?"":" ");
| ^~~
foo.cc: In function 'void work()':
foo.cc:57:20: error: expected identifier before 'this'
57 | auto res = [&](this auto &&res, int l, int r, int p) -> int {
| ^~~~
foo.cc:57:20: error: expected ',' or '...' before 'this'
foo.cc: In lambda function:
foo.cc:58:13: error: 'l' was not declared in this scope
58 | if (l == r) return v[l];
| ^
foo.cc:58:18: error: 'r' was not declared in this scope
58 | if (l == r) return v[l];
| ^
foo.cc:59:20: error: 'l' was not declared in this scope
59 | int mid = (l+r)/2;
| ^
foo.cc:59:22: error: 'r' was not declared in this scope
59 | int mid = (l+r)/2;
| ^
foo.cc:60:13: error: 'p' was not declared in this scope
60 | if (p) return max(res(l,mid,!p), res(mid+1,r,!p));
| ^
foo.cc:60:27: error: use of 'res' before deduction of 'auto'
60 | if (p) return max(res(l,mid,!p), res(mid+1,r,!p));
| ^~~
foo.cc:60:42: error: use of 'res' before deduction of 'auto'
60 | if (p) return max(res(l,mid,!p), res(mid+1,r,!p));
| ^~~
foo.cc:61:25: error: use of 'res' before deduction of 'auto'
61 | else return min(res(l,mid,!p), res(mid+1,r,!p));
| ^~~
foo.cc:61:40: error: use of 'res' before deduction of 'auto'
61 | else return min(res(l,mid,!p), res(mid+1,r,!p));
| ^~~
foo.cc: In function 'void work()':
foo.cc:68:20: error: no match for call to '(work()::<lambda(int)>) (int, ll, ll&)'
68 | cout << res(0,n-1,p) << '\n';
| ~~~^~~~~~~~~
foo.cc:57:16: note: candidate: 'work()::<lambda(int)>'
57 | auto res = [&](this auto &&res, int l, int r, int p) -> int {
| ^
foo.cc:57:16: note: candidate expects 1 argument, 3 provided