Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n;
	cin >> n;
	int sel[n];
	int ans = 0;
	tuple<int,int,int> red[n];
	tuple<int,int,int> blue[n];
	for (int i = 0;i < n;i++) {
		cin >> get<0>(red[i]) >> get<1>(red[i]);
		get<2>(red[i]) = get<0>(red[i]) + get<1>(red[i]);
		sel[i] = 0;
	}
	for (int i = 0;i < n;i++) {
		cin >> get<0>(blue[i]) >> get<1>(blue[i]);
		get<2>(blue[i]) = get<0>(blue[i]) + get<1>(blue[i]);
	}
	sort(red,red+n,[](const tuple<int,int,int>& x, const tuple<int,int,int>& y) { return get<2>(red) > get<2>(red);});
	sort(blue,blue+n,[](const tuple<int,int,int>& x, const tuple<int,int,int>& y) { return get<2>(blue) > get<2>(blue);});
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < n;j++) {
			if (i==j) {continue;} else {
				if (!sel[j]&&get<0>(red[i]) < get<0>(blue[j])&&get<1>(red[i]) < get<1>(blue[j])) {
					ans++;
					sel[j] = 1;
				}
			}
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In lambda function:
a.cc:20:101: error: 'red' is not captured
   20 |         sort(red,red+n,[](const tuple<int,int,int>& x, const tuple<int,int,int>& y) { return get<2>(red) > get<2>(red);});
      |                                                                                                     ^~~
a.cc:20:25: note: the lambda has no capture-default
   20 |         sort(red,red+n,[](const tuple<int,int,int>& x, const tuple<int,int,int>& y) { return get<2>(red) > get<2>(red);});
      |                         ^
a.cc:9:28: note: 'std::tuple<int, int, int> red [n]' declared here
    9 |         tuple<int,int,int> red[n];
      |                            ^~~
a.cc:20:115: error: 'red' is not captured
   20 |         sort(red,red+n,[](const tuple<int,int,int>& x, const tuple<int,int,int>& y) { return get<2>(red) > get<2>(red);});
      |                                                                                                                   ^~~
a.cc:20:25: note: the lambda has no capture-default
   20 |         sort(red,red+n,[](const tuple<int,int,int>& x, const tuple<int,int,int>& y) { return get<2>(red) > get<2>(red);});
      |                         ^
a.cc:9:28: note: 'std::tuple<int, int, int> red [n]' declared here
    9 |         tuple<int,int,int> red[n];
      |                            ^~~
a.cc: In lambda function:
a.cc:21:103: error: 'blue' is not captured
   21 |         sort(blue,blue+n,[](const tuple<int,int,int>& x, const tuple<int,int,int>& y) { return get<2>(blue) > get<2>(blue);});
      |                                                                                                       ^~~~
a.cc:21:27: note: the lambda has no capture-default
   21 |         sort(blue,blue+n,[](const tuple<int,int,int>& x, const tuple<int,int,int>& y) { return get<2>(blue) > get<2>(blue);});
      |                           ^
a.cc:10:28: note: 'std::tuple<int, int, int> blue [n]' declared here
   10 |         tuple<int,int,int> blue[n];
      |                            ^~~~
a.cc:21:118: error: 'blue' is not captured
   21 |         sort(blue,blue+n,[](const tuple<int,int,int>& x, const tuple<int,int,int>& y) { return get<2>(blue) > get<2>(blue);});
      |                                                                                                                      ^~~~
a.cc:21:27: note: the lambda has no capture-default
   21 |         sort(blue,blue+n,[](const tuple<int,int,int>& x, const tuple<int,int,int>& y) { return get<2>(blue) > get<2>(blue);});
      |                           ^
a.cc:10:28: note: 'std::tuple<int, int, int> blue [n]' declared here
   10 |         tuple<int,int,int> blue[n];
      |                            ^~~~