Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 400005;
const int T8 = 100000000;
const long double PI = 3.14159265358979323846264338327950288419716939937510L;

struct point {
	int x, y;
	point(int x=0, int y=0): x(x), y(y) {}
	bool operator < (const point& p) const {
		return x < p.x;
	}
};

int n;
point a, b, p[N];
int lis[N], size;

int main() {
	// printf("%.50lf\n", PI);
	scanf("%d%d%d%d", &a.x, &a.y, &b.x, &b.y);
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d%d", &p[i].x, &p[i].y);
	sort(p, p + n);
	if (a.x > b.x) swap(a, b);
	long double ans = 100.0L * (abs(1ll*a.x - b.x) + abs(1ll*a.y - b.y));
	int mx = min(a.x, b.x);
	int Mx = max(a.x, b.x);
	int my = min(a.y, b.y);
	int My = max(a.y, b.y);
	// special cases
	if (a.x == b.x) {
		for (int i = 0; i < n; ++i) {
			if (p[i].x == a.x) {
				// cout << "here" << endl;
				if (my < p[i].y && p[i].y < My) {
					ans += 10*PI - 20;
				}
			}
		}
	} else if (a.y == b.y) {
		for (int i = 0; i < n; ++i) {
			if (p[i].y == a.y) {
				if (mx < p[i].x && p[i].x < Mx) {
					ans += 10*PI - 20;
				}
			}
		}
	} else if (mx == Mx - 1) {
		int down = -1;
		int up = -1;
		for (int i = 0; i < n; ++i) {
			if (a.x == p[i].x) {
				down = p[i].y;
			}
			if (b.x == p[i].x) {
				up = p[i].y;
			}
		}
		if (down == -1 || up == -1 || down >= up) ans += 5*PI - 20;
		else ans += 15*PI - 40;
	} else if (my == My - 1) {
		int down = -1;
		int up = -1;
		for (int i = 0; i < n; ++i) {
			if (a.y == p[i].y) {
				down = p[i].x;
			}
			if (b.y == p[i].y) {
				up = p[i].x;
			}
		}
		if (down == -1 || up == -1 || down >= up) ans += 5*PI - 20;
		else ans += 15*PI - 40;
	} else {
		for (int i = 0; i < n; ++i) {
			if (p[i].x < mx || p[i].x > Mx || p[i].y < my || p[i].y > My) {
				continue;
			}
			int y = abs(p[i].y - a.y);
			int lb = lower_bound(lis, lis + size, y) - lis;
			lis[lb] = y;
			if (lb == size) ++size;
		}
		ans += size * (5*PI - 20);
	}
	cout.precision(15);
	cout << fixed << (double) ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:57: error: reference to 'size' is ambiguous
   82 |                         int lb = lower_bound(lis, lis + size, y) - lis;
      |                                                         ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:17:13: note:                 'int size'
   17 | int lis[N], size;
      |             ^~~~
a.cc:84:35: error: reference to 'size' is ambiguous
   84 |                         if (lb == size) ++size;
      |                                   ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:17:13: note:                 'int size'
   17 | int lis[N], size;
      |             ^~~~
a.cc:84:43: error: reference to 'size' is ambiguous
   84 |                         if (lb == size) ++size;
      |                                           ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:17:13: note:                 'int size'
   17 | int lis[N], size;
      |             ^~~~
a.cc:86:24: error: reference to 'size' is ambiguous
   86 |                 ans += size * (5*PI - 20);
      |                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:17:13: note:                 'int size'
   17 | int lis[N], size;
      |             ^~~~