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++: // #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

int imos[2010];
int main() {
    int a, b; cin >> a >> b;
    int N; cin >> N;
    for(int i=0; i<N; i++) {
        int s, t; cin >> s >> t;
        imos[s]++;
        imos[t]--;
    }

    for(int i=1; i<=2000; i++) imos[i] += imos[i-1];
    bool ok = true;
    for(int i=a; i<b; i++) ok &= (imos[i] == 0);

    cout << (ok ? 0 : 1) << 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(){
	cin>>l>>r>>n;
	for(int i=0;i<n;i++){
		int L,R;
		cin>>L>>R;
		while(L<R) a[L++]=1;
	}
	for(int i=l;i<r;i++){
		if(a[i]){
			cout<<1<<endl;
			return 1;
		}
	}
	cout<<0<<endl;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
#define INF = 1000000000;
#define LLINF = 1LL << 62;
#define mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int v[1001];
int main() {
    int a, b, n;
    cin >> a >> b >> n;
    int s, f;
    FOR(i, n){
        cin >> s >> f;
        v[s]++, v[f]--;
    }
    FOR(i, 1000)v[i + 1] += v[i];
    int ans = 0;
    for (int i = a; i < b; i++)if (v[i])ans = 1;
    cout << ans << endl;
}

C++: #include<iostream>
#include<stdio.h>
#include<cstdio>
#include<string>
using namespace std;
int main(){
	int a, b, N;
	cin >> a >> b >> N;
	while (N--){
		int s, f;
		cin >> s >> f;
		if (a < s&& f < b){
			cout << 1 << endl;
			abort;
		return 0;
		}
		
	}
	cout << 0 << endl;
	
}

C++: #include<bits/stdc++.h>
#define loop(times) for(int i=0;i<times;i++)
using namespace std;


int main()
{
    int a,b,N,t=1;
    cin>>a>>b>>N;
    
    int s[N],f[N];
    int p[1001];
    int c[1001];
    loop(1000)p[i]=0,s[i]=0;
    
    loop(N){
        cin>>s[i]>>f[i];
        p[s[i]]+=1;
        p[f[i]]-=1;
    }
    p[a]+=1;
    p[b]-=1;
    loop(1000){
    c[i+1]=c[i]+p[i];
    if(c[i+1]==2){
    cout<<1<<endl;
    t=0;
    break;
    }
    }
    if(t==1)cout<<0<<endl;
}

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

int main(){
    bool res[1001];
    int a, b, N;
    bool ans = false;

    cin >> a >> b;
    for(int i=a;a<b;a++)
        res[a] = true;

    cin >> N;
    for(int i=0;i<N;i++){
        int s,f;
        cin >> s >> f;
        for(int j=s;j<f;j++){
            if(res[s])
                ans = true;
        }
    }

    cout << ans << endl;

    return 0;
}

C++: #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;


int main(){
  
  int a,b,N;
  cin>>a>>b;
  cin>>N;
  int s[100],f[100];
  for(int i=0;i<N;i++){
    cin>>s[i]>>f[i];
  }
  int judge=0;
  for(int i=0;i<N;i++){
      if(s[i]<=a && f[i]>a){
        judge=judge+1;
      }
      if(s[i]<b && f[i]>=b){
        judge=judge+1;
      }
      if(a<=s[i] && b>s[i]){
        judge=judge+1;
      }
      if(a<f[i] && b>=f[i]){
        judge=judge+1;
      }
  }
  if(judge==0){
    cout<<0<<endl;
  }
  else{
    cout<<1<<endl;
  }
  
 /* int X;
  cin>>X;
  if(X%7==0){
    cout<<"thu"<<endl;
  }
  if(X%7==1){
    cout<<"fri"<<endl;
  }
  if(X%7==2){
    cout<<"sat"<<endl;
  }
  if(X%7==3){
    cout<<"sun"<<endl;
  }
  if(X%7==4){
    cout<<"mon"<<endl;
  }
  if(X%7==5){
    cout<<"tue"<<endl;
  }
  if(X%7==6){
    cout<<"wed"<<endl;
  }
 */
	
	/*int m,f,b;
	cin>>m>>f>>b;
	if(b-m<=0){
		cout<<0<<endl;
	}
	if(b-m>0 && b-m<=f){
		cout<<b-m<<endl;
	}
	if(b-m>0 && b-m>f){
		cout<<"NA"<<endl;
	}*/
	/*int a,b;
	cin>>a>>b;
	cout<<(a+b)/2<<endl;*/
	
	/*random_device rnd;
	mt19937 mt(rnd());
	uniform_int_distribution<> rnd3(1, 3);
	
	string p1, p2, p3, p4;
	cin >> p1 >> p2 >> p3 >> p4;
	
	int t = rnd()%3;
	
	if(t == 0){
		cout << "1:" << p1 << ',' << p2 << endl;
		cout << "2:" << p3 << ',' << p4 << endl;
	}
	if(t == 1){
		cout << "1:" << p1 << ',' << p3 << endl;
		cout << "2:" << p2 << ',' << p4 << endl;
	}
	if(t == 2){
		cout << "1:" << p1 << ',' << p4 << endl;
		cout << "2:" << p2 << ',' << p3 << endl;
	}*/
	
	/*
	switch(type){
		case 0:
			cout << "1:" << p1 << ',' << p2 << endl;
			cout << "2:" << p3 << ',' << p4 << endl;
			break;
		case 1:
			cout << "1:" << p1 << ',' << p3 << endl;
			cout << "2:" << p2 << ',' << p4 << endl;
			break;
		case 2:
			cout << "1:" << p1 << ',' << p4 << endl;
			cout << "2:" << p2 << ',' << p3 << endl;
			break;
	}
	*/
	
	
	return 0;
}

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 < n; 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;
}