Language: C++

#include <bits/stdc++.h>
using namespace std;

struct ios {
	static const int IN_LEN = 1 << 18 | 1;
	char buf[IN_LEN], *s, *t;
	inline char gc() {
		return (s == t) && (t = (s = buf) + fread(buf, 1, IN_LEN, stdin)), s == t ? 0 : (*s++);
	}
	template <typename _tp> inline ios & operator >> (_tp&x) {
		static char ch; ch = gc(), x = 0;
		while(ch and !isdigit(ch)) ch = gc();
		while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = gc();
		return *this;
	}
} io;

const int N = 201000;
typedef pair<int,int> pii;
pii b[N]; int st[N];
int n, R, C, tp, tot;

inline int get(int x, int y) {
	if(x and x != R and y and y != C) return -1;
	if(y == 0) return x;
	if(x == R) return R + y;
	if(y == C) return R + C + (R-x);
	return R + C + R + (C-y);
}

int main() {
	io >> R >> C >> n;
	for(int i=1,x,y,t1,t2;i<=n;++i) {
		io >> x >> y, t1 = get(x, y);
		io >> x >> y, t2 = get(x, y);
		if(t1 == -1 or t2 == -1) continue;
		b[++tot] = pii(t1, i);
		b[++tot] = pii(t2, i);
	}
	sort(b+1, b+tot+1);
	for(int i=1;i<=tot;++i)
		if(tp and st[tp] == b[i].second) --tp;
		else st[++tp] = b[i].second;
	puts(tp ? "NO" : "YES");
	return 0;
}#include <bits/stdc++.h>
using namespace std;

struct ios {
	static const int IN_LEN = 1 << 18 | 1;
	char buf[IN_LEN], *s, *t;
	inline char gc() {
		return (s == t) && (t = (s = buf) + fread(buf, 1, IN_LEN, stdin)), s == t ? 0 : (*s++);
	}
	template <typename _tp> inline ios & operator >> (_tp&x) {
		static char ch; ch = gc(), x = 0;
		while(ch and !isdigit(ch)) ch = gc();
		while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = gc();
		return *this;
	}
} io;

const int N = 201000;
typedef pair<int,int> pii;
pii b[N]; int st[N];
int n, R, C, tp, tot;

inline int get(int x, int y) {
	if(x and x != R and y and y != C) return -1;
	if(y == 0) return x;
	if(x == R) return R + y;
	if(y == C) return R + C + (R-x);
	return R + C + R + (C-y);
}

int main() {
	io >> R >> C >> n;
	for(int i=1,x,y,t1,t2;i<=n;++i) {
		io >> x >> y, t1 = get(x, y);
		io >> x >> y, t2 = get(x, y);
		if(t1 == -1 or t2 == -1) continue;
		b[++tot] = pii(t1, i);
		b[++tot] = pii(t2, i);
	}
	sort(b+1, b+tot+1);
	for(int i=1;i<=tot;++i)
		if(tp and st[tp] == b[i].second) --tp;
		else st[++tp] = b[i].second;
	puts(tp ? "NO" : "YES");
	return 0;
}

Compiler output:
a.cc:46:2: error: stray '#' in program
   46 | }#include <bits/stdc++.h>
      |  ^
a.cc:46:3: error: 'include' does not name a type
   46 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:49:8: error: redefinition of 'struct ios'
   49 | struct ios {
      |        ^~~
a.cc:4:8: note: previous definition of 'struct ios'
    4 | struct ios {
      |        ^~~
a.cc:61:3: error: conflicting declaration 'int io'
   61 | } io;
      |   ^~
a.cc:16:3: note: previous declaration as 'ios io'
   16 | } io;
      |   ^~
a.cc:63:11: error: redefinition of 'const int N'
   63 | const int N = 201000;
      |           ^
a.cc:18:11: note: 'const int N' previously defined here
   18 | const int N = 201000;
      |           ^
a.cc:65:5: error: redefinition of 'pii b [201000]'
   65 | pii b[N]; int st[N];
      |     ^
a.cc:20:5: note: 'pii b [201000]' previously defined here
   20 | pii b[N]; int st[N];
      |     ^
a.cc:65:15: error: redefinition of 'int st [201000]'
   65 | pii b[N]; int st[N];
      |               ^~
a.cc:20:15: note: 'int st [201000]' previously declared here
   20 | pii b[N]; int st[N];
      |               ^~
a.cc:66:5: error: redefinition of 'int n'
   66 | int n, R, C, tp, tot;
      |     ^
a.cc:21:5: note: 'int n' previously declared here
   21 | int n, R, C, tp, tot;
      |     ^
a.cc:66:8: error: redefinition of 'int R'
   66 | int n, R, C, tp, tot;
      |        ^
a.cc:21:8: note: 'int R' previously declared here
   21 | int n, R, C, tp, tot;
      |        ^
a.cc:66:11: error: redefinition of 'int C'
   66 | int n, R, C, tp, tot;
      |           ^
a.cc:21:11: note: 'int C' previously declared here
   21 | int n, R, C, tp, tot;
      |           ^
a.cc:66:14: error: redefinition of 'int tp'
   66 | int n, R, C, tp, tot;
      |              ^~
a.cc:21:14: note: 'int tp' previously declared here
   21 | int n, R, C, tp, tot;
      |              ^~
a.cc:66:18: error: redefinition of 'int tot'
   66 | int n, R, C, tp, tot;
      |                  ^~~
a.cc:21:18: note: 'int tot' previously declared here
   21 | int n, R, C, tp, tot;
      |                  ^~~
a.cc:68:12: error: redefinition of 'int get(int, int)'
   68 | inline int get(int x, int y) {
      |            ^~~
a.cc:23:12: note: 'int get(int, int)' previously defined here
   23 | inline int get(int x, int y) {
      |            ^~~
a.cc:76:5: error: redefinition of 'int main()'
   76 | int main() {
      |     ^~~~
a.cc:31:5: note: 'int main()' previously defined here
   31 | int main() {
      |     ^~~~