Go: package main

import "fmt"

func main() {
	var sTime, fTime, exists, eSTime, eFTime int

	fmt.Scan(&sTime, &fTime)
	fmt.Scan(&exists)

	var flag bool

	for i := 0; i < exists; i++ {
		fmt.Scan(&eSTime, &eFTime)

		if sTime > eSTime && sTime < eFTime {
			flag = true
		}
		if fTime > eSTime && fTime < eFTime {
			flag = true
		}
		if eSTime > sTime && eFTime < fTime {
			flag = true
		}
	}

	if flag {
		fmt.Println(1)
	} else {package main

import "fmt"

func main() {
	var sTime, fTime, exists, eSTime, eFTime int

	fmt.Scan(&sTime, &fTime)
	fmt.Scan(&exists)

	var flag bool

	for i := 0; i < exists; i++ {
		fmt.Scan(&eSTime, &eFTime)

		if sTime > eSTime && sTime < eFTime {
			flag = true
		}
		if fTime > eSTime && fTime < eFTime {
			flag = true
		}
		if eSTime > sTime && eFTime < fTime {
			flag = true
		}
	}

	if flag {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}

		fmt.Println(0)
	}
}

C++: #include "bits/stdc++.h"

using namespace std;
int main(void)
{
	int a, b; cin >> a >> b;
	int c; cin >> c;
	if (c == 0)
	{
		cout << 0 << "\n";
		return 0;
	}
	vector<int>arr(1001, 0);
	for (int i = 0; i < c; i++)
	{
		int aa, cc; cin >> aa >> cc;
		if (aa ==a && cc ==b)
		{
			cout << 1 << "\n";
			return 0;
		}
		for (int j = aa; j < cc + 1; j++)
		{
			arr[j] = 1;
		}
	}
	if (b-a == 1 && arr[a] == 1 && arr[b] == 1)
	{
		cout << "1" << "\n";
		return 0;
	}
	for (int i = a + 1; i < b; i++)
	{
		if (arr[i] == 1)
		{
			cout << 1 << "\n";
			return 0;
		}
	}
	cout << 0 << "\n";
}

C++: #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int a,b,n;
    cin >> a >> b >> n;

    bool flag = false;
    vector<int> reserve(1001, 0);

    rep(i,0,n){
        int s,f;
        cin >> s >> f;
        for(int i = s; i <= f; i++){
            reserve[i] = 1;
        }
    }

    rep(i,a,b){
        if(reserve[i] == 1){
           if((i == a && reserve[i+1] == 0) || (i == b && reserve[i-1] == 0)){
               continue;
           }else{
               cout << 1 << endl;
               return 0;
           }
        }
    }

    cout << 0 << endl;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a, b, n, i, z = 0;
	int x[100], y[100];
	cin >> a >> b >> n;
	for (i = 0; i < 100; i++){
		cin >> x[i] >> y[i];
		if (x[i] <= a&&y[i] >= a){
			z = 1;
		}
		if (x[i] <= b&&y[i] >= b){
			z = 1;
		}
	}
	cout << z << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;

int main(){

	int a, b, N, s[1000],f[1000];
	int ans = 1;
	cin >> a >> b;
	cin >> N;

	for(int i = 0; i < N; i++){
		cin >> s[i] >> f[i];
	}

	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(s[i] == f[j] && i < j) ans = 0;
		}
	}

	cout << ans << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=1005;
bool a[M];
int n,l,r;

int main(){
	fill(a,a+M,0);
	cin>>l>>r>>n;
	for(int i=0;i<n;i++){
		int L,R;
		cin>>L>>R;
		while(L<R) a[L++]=1;
	}
	while(l<r){
		if(l>=M) cout<<2<<endl;
		if(a[l]){
			cout<<1<<endl;
			return 1;
		}
		l++;
	}
	cout<<0<<endl;
}

C++: /*
　　　　 ∧＿∧　にっぽんちゃちゃちゃ
　／＼（　・∀・）／ヽ
（ ●　と　　　つ　● ）　にっぽんちゃちゃちゃ
　＼/⊂、 ノ　　＼ノ
　　　　　し'
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define MOD 1000000007
#define INF 9223372036854775807

signed main() {
int x=0,y=0,z=0,w=0,n=0;
int a=0,b=0;
std::cin >> a>>b;
std::cin >> x;
rep(i,x){
  std::cin >> y>>z;
  if(b>y&&a<z){
    n=1;
}
}
std::cout << n << '\n';

}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int main() {
	int a, b, N;
	cin >> a >> b >> N;
	
	int ans = 0;
	REP(i, N) {
		int s, f;
		scanf("%d %d", &s, &f);
		
		ans |= a < s && s < b;
		ans |= a < f && f < b;
		
		ans |= s < a && a < f;
		ans |= s < b && b < f;
	}
	
	cout << ans << endl;
	
	return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
  int a,b,n,t=0;
  cin >> a >> b >> n;
  int c[n*2];
  for(int i=0; i<n*2; i=i+2){
    int num,num2;
    cin >> num >> num2;
    if(num<a&&num2>a){
      t=1;
    }
    if(num<b&&num2>b){
      t=1;
    }
    if(num==a&&num2==b)t=1;
  }
  cout << t << endl;
}