Language: C++

#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using llong = long long;
using ullong = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()
#define loop(i, times) for(llong i = 0; i < times; i++)
#define rloop(i, times) for(llong i = times -1; 0 <= i; i--)

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << msec << " msec" << std::endl;
}

#endif

struct Grid
{
	llong x_;
	llong y_;
	llong region_;
	bool operator > (const Grid& g) const
	{
		return (region_ > g.region_);
	}
	bool operator < (const Grid& g) const
	{
		return (region_ < g.region_);
	}
};


struct Grid
{
	llong x_;
	llong y_;
	llong region_;
	bool operator > (const Grid& g) const
	{
		return (region_ > g.region_);
	}
	bool operator < (const Grid& g) const
	{
		return (region_ < g.region_);
	}
};


struct Grid
{
	llong x_;
	llong y_;
	llong region_;
	bool operator > (const Grid& g) const
	{
		return (region_ > g.region_);
	}
	bool operator < (const Grid& g) const
	{
		return (region_ < g.region_);
	}
};

class ABC91C
{
public:
	ABC91C()
	{
		cin >> n_;
		count_pair_ = 0;
		r_grid_collection_.resize(n_);
		loop(i, n_)
		{
			cin >> r_grid_collection_[i].x_;
			cin >> r_grid_collection_[i].y_;
			r_grid_collection_[i].region_ = max(r_grid_collection_[i].x_, r_grid_collection_[i].y_);
		}
		sort(all(r_grid_collection_));
		b_grid_collection_.resize(n_);
		loop(i, n_)
		{
			cin >> b_grid_collection_[i].x_;
			cin >> b_grid_collection_[i].y_;
			b_grid_collection_[i].region_ = max(b_grid_collection_[i].x_, b_grid_collection_[i].y_);
		}
		sort(all(b_grid_collection_)));
	}
	void Run(void)
	{
		loop(i, (llong)r_grid_collection_.size())
			CompareAllBlue(r_grid_collection_[i]);

		cout << count_pair_;
	}
private:
	llong n_;
	llong count_pair_;
	vector<Grid> r_grid_collection_;
	vector<Grid> b_grid_collection_;
	void CompareAllBlue(Grid r)
	{
		if (b_grid_collection_.size() == 0)
			return;

		loop(i, (llong)b_grid_collection_.size())
		{
			if (r.x_ < b_grid_collection_[i].x_ && r.y_ < b_grid_collection_[i].y_)
			{
				b_grid_collection_.erase(b_grid_collection_.begin() + i);
				count_pair_++;
				break;
			}
		}
	}
	void Region(Grid g)
	{
		g.region_ = min(g.x_, g.y_);
	}
};


int main()
{
	ABC91C abc91c;
  
	TimeStart();
	abc91c.Run();
	TimeEnd();

  return 0;
}


Compiler output:
a.cc:59:8: error: redefinition of 'struct Grid'
   59 | struct Grid
      |        ^~~~
a.cc:43:8: note: previous definition of 'struct Grid'
   43 | struct Grid
      |        ^~~~
a.cc:75:8: error: redefinition of 'struct Grid'
   75 | struct Grid
      |        ^~~~
a.cc:43:8: note: previous definition of 'struct Grid'
   43 | struct Grid
      |        ^~~~
a.cc: In constructor 'ABC91C::ABC91C()':
a.cc:112:46: error: expected ';' before ')' token
  112 |                 sort(all(b_grid_collection_)));
      |                                              ^