Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>

typedef long long LL;

const int MAXN = 2e5;
const LL INF = 0x3f3f3f3f;

int n;
int mins[MAXN | 1], maxs[MAXN | 1];
LL ans;

struct Num {
	int a, b;
	Num() {}
	friend bool operator < (const Num &x, const Num &y) {
		return x.a < y.a;
	}
} p[MAXN | 1];

inline int read() {
	register int x = 0;
	register char ch = getchar();
	while (!isdigit(ch)) ch = getchar();
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x;
}

	n = read();
	int min = 0, max = INF;
	int bmax = -1, rmax = -1;
	int bmin = INF, rmin = INF;
	for (int i = 1; i <= n; ++i) {
		p[i].a = read();
		p[i].b = read();
		if (p[i].a > p[i].b) std::swap(p[i].a, p[i].b);
		bmax = std::max(bmax, p[i].b);
		bmin = std::min(bmin, p[i].b);
		rmax = std::max(rmax, p[i].a);
		rmin = std::min(rmin, p[i].a);
	}
	std::sort(p + 1, p + 1 + n);
	ans = 1LL * (bmax - bmin) * (rmax - rmin);
	bmin = rmin;
	LL ans2 = INF;
	maxs[1] = mins[1] = p[1].b;
	for (int i = 2; i <= n; ++i) {
		maxs[i] = std::max(maxs[i - 1], p[i].b);
		mins[i] = std::min(mins[i - 1], p[i].b);
		if (i != n) ans2 = std::min(ans2, 1LL * std::max(maxs[i], p[n].a) - std::min(mins[i], p[i + 1].a));
	}
	printf("%d\n", std::min(ans, ans2 * (bmax - bmin)));
	return 0;
}


Compiler output:
a.cc: In function 'int read()':
a.cc:23:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   23 |         register int x = 0;
      |                      ^
a.cc:24:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |         register char ch = getchar();
      |                       ^~
a.cc: At global scope:
a.cc:33:9: error: 'n' does not name a type
   33 |         n = read();
      |         ^
a.cc:37:9: error: expected unqualified-id before 'for'
   37 |         for (int i = 1; i <= n; ++i) {
      |         ^~~
a.cc:37:25: error: 'i' does not name a type
   37 |         for (int i = 1; i <= n; ++i) {
      |                         ^
a.cc:37:33: error: expected unqualified-id before '++' token
   37 |         for (int i = 1; i <= n; ++i) {
      |                                 ^~
a.cc:46:18: error: expected constructor, destructor, or type conversion before '(' token
   46 |         std::sort(p + 1, p + 1 + n);
      |                  ^
a.cc:47:9: error: 'ans' does not name a type
   47 |         ans = 1LL * (bmax - bmin) * (rmax - rmin);
      |         ^~~
a.cc:48:9: error: 'bmin' does not name a type
   48 |         bmin = rmin;
      |         ^~~~
a.cc:50:9: error: 'maxs' does not name a type
   50 |         maxs[1] = mins[1] = p[1].b;
      |         ^~~~
a.cc:51:9: error: expected unqualified-id before 'for'
   51 |         for (int i = 2; i <= n; ++i) {
      |         ^~~
a.cc:51:25: error: 'i' does not name a type
   51 |         for (int i = 2; i <= n; ++i) {
      |                         ^
a.cc:51:33: error: expected unqualified-id before '++' token
   51 |         for (int i = 2; i <= n; ++i) {
      |                                 ^~
a.cc:56:15: error: expected constructor, destructor, or type conversion before '(' token
   56 |         printf("%d\n", std::min(ans, ans2 * (bmax - bmin)));
      |               ^
a.cc:57:9: error: expected unqualified-id before 'return'
   57 |         return 0;
      |         ^~~~~~
a.cc:58:1: error: expected declaration before '}' token
   58 | }
      | ^