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<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
#include<set>
#include<bitset>
#include <cstdio>
#include <cmath>

using namespace std;

typedef long long ll;
#define put(n) cout<<(n)<<"\n"
#define FOR(i,num,N) for(int(i)=(num);(i)<(N);++(i))
#define RFOR(i,num,N) for(int (i)=(num);(i)>(N);--(i))
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()

int A,B,N,S,F;
vector<bool> sub(1001,false);
vector<pair<int,int>> n;
void dfs(int s,int f){
    FOR(i,s+1,f) sub[i] = true;
    FOR(i,0,N){
        if(n[i].first == f) dfs(f,n[i].second);
    }

}

int main(){
    cin>>A>>B>>N;
    n.resize(N);
    FOR(i,0,N){
        cin>>n[i].first>>n[i].second;
    }
    sort(n.begin(),n.end());
    FOR(i,0,N) dfs(n[i].first,n[i].second);
    FOR(i,A,B+1){
        if(sub[i]){
            cout<<1<<endl;
            return 0;
        } 
    }
    cout<<0<<endl;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,N,s[105],f[105];
	cin >> a>>b>>N;
	for (int i = 0; i < N; i++){
		cin >> s[i] >> f[i];
		if (f[i]>a&&s[i]<b){
			cout << 1 << endl;
			return 0;
		}
		
	} 
	cout << 0<<endl;
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
  int A, B, N;

  cin >> A >> B;
  cin >> N;

  for(int i = 0; i < N; i++) {
    int S, F;
    cin >> S >> F;
    if(min(F, B) - max(A, S) > 0) {
      cout << 1 << endl;
      return (0);
    }
  }

  cout << 0 << endl;
}

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

using namespace std;
using uint = unsigned int;
using int64 = long long;
using i64 = int64;
using uint64 = unsigned long long;
using vint = vector<int>;
using vint64 = vector<int64>;
template<typename T>
using p_que = priority_queue<T>;
#define rep(i,N) for(int i=0;i<(int)(N);++i)
#define rep1(i,N) for(int i=1;i<=(int)(N);++i)
#define fs first
#define sc second
#define eb emplace_back
#define all(x) x.begin(),x.end()

template<typename T>
vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "[";
	for (auto& e : v) os << e << ", ";
	return os << "]";
}

template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U> p) {
	return os << "P(" << p.first << ", " << p.second << ")";
}

template<class T, class U> ostream& operator<<(ostream& os, const map<T, U>& mp) {
	os << "{";
	for (auto& e : mp) os << e << " ";
	return os << "}";
}

void Main();
signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
}

/* Cut from here! */

//#define int long long

void Main() {
	int a, b; cin >> a >> b;
	int N; cin >> N;
	vector<int> used(1010, 0);
	for (int i = 0; i < N; ++i) {
		int s, f; cin >> s >> f;
		for (int j = s; j < f; ++j) used[j] = 1;
	}
	bool can = true;
	for (int i = a; i < b; ++i) {
		can =can&& (used[i] == 0);
	}
	if (can) cout << 0 << endl;
	else cout << 1 << endl;
}

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

int main(){
  int a,b;
  cin>>a>>b;
  int N;
  cin>>N;
  int tmp_s,tmp_e;
  bool flag=false;
  for(int i=0;i<N;i++){
    cin>>tmp_s>>tmp_e;
    if(a<tmp_e&&b>tmp_s)flag=true;
    else if(a==tmp_e&&b==tmp_s)flag=true;
  }
  cout<<flag<<endl;
}

C++: #include<cstdio>
int main(){
  int a,b,n,s,f,ans=0;
  scanf("%d %d %d",&a,&b,&n);
  for(int i=0;i<n;i++){
    scanf("%d %d",&s,&f);
    if(a < f && s < b) ans = 1;
  }
  printf("%d\n",ans);
  return(0);
}

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

bool overlap(int a, int b, int c, int d){
  assert( a < b ); assert( c < d );
  int aa = 0;
  for ( int i = 0; i < 10000; i++ ) aa += i;
  if ( d <= a ) return false;
  if ( b <= c ) return false;
  return true;
}

bool notOverlap(int a, int b, int c, int d){
  return b <= c || d <=a;
}

main(){
  int a, b, s, f, n;
  cin >> a >> b >> n;
  for ( int i = 0; i < n; i++ ){
    cin >> s >> f;
    if ( overlap(a, b, s, f) ){
      cout << 1 << endl;
      return 0;
    } else {
      assert(notOverlap(a, b, s, f));
    }
  }
  cout << 0 << endl;
  return 0;
}

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

int main(){
  int a,b;
  cin>>a>>b;
  int N;
  cin>>N;
  int tmp_s,tmp_e;
  bool flag=false;
  for(int i=0;i<N;i++){
    cin>>tmp_s>>tmp_e;
    if(a<tmp_e&&b>tmp_s)flag=true;
    else if(a==tmp_e&&b==tmp_s)flag=true;
  }
  cout<<flag<<endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const ll MOD=10000;
const ll INF=1000000010;
const int MAX=100001;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int a,b;cin>>a>>b;
    bool f=true;
    int n;cin>>n;
    for(int i=0;i<n;i++){
        int s,f;
        cin>>s>>f;
        if(b<s||a>f)continue;
        f=false;
    }
    if(f){
        cout<<1<<endl;
    }else{
        cout<<0<<endl;
    }
    return 0;
}

C++: 
#include <iostream>

using namespace std;

int main ()
{
	long a,b,n,aa[100],bb[100];

	cin >> a >> b >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> aa[i] >> bb[i];
	}

	for (int i = 0; i < n; i++)
	{
		if (aa[i] <= a && bb[i] > a)
		{
			cout << '1' << endl;
			break;
		}
		else if (aa[i] < b && bb[i] >= b)
		{
			cout << '1' << endl;
			break;
		}
		else if (i == n - 1)
		{
			cout << '0' << endl;
		}
	}
}

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

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

  int N;
  cin >> N;

  int s,f;
  int ans=0;
  for(int i=0;i<N;i++){
    cin >> s >> f;
    if(s<=a && a<f){
      ans++;
    }else if(s<b && b<=f){
      ans++;
    }
  }

  if(ans>0){
    cout << '1' << endl;
  }else{
    cout << '0' << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <cstring>
#include <climits>

#define LP(i,n) for(int i=0;i<n;i++)
#define Mset(x,v) memset(x,v,sizeof(x))
#define INF INT_MAX

using namespace std;
using LL=long long;

int R[1010];

int main(){
    int n,a,b,x=0,r=0;
    cin>>a>>b;
    R[a]++;
    R[b]--;
    cin>>n;
    LP(i,n){
        cin>>a>>b;
        R[a]++;
        R[b]--;
    }
    LP(i,1010){
        x+=R[i];
        if(x>=2) r=1;
    }
    cout<<r<<endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,n1;
  cin >>a>>b>>n1;
  bool n[1000];
  for(int i=0;i<1000;i++){
    n[i]=0;
  }
  int s[n1];
  int f[n1];
  for(int i=0;i<n1;i++){
    cin >>s[i]>>f[i];
  }
  for(int i=0;i<n1;i++){
    for(int j=s[i];j<f[i];j++){
      n[j]=1;
    }
  }
  int count=0;
  for(int i=a;i<b;i++){
    if(n[i]==0)count++;
  }
  if(count==b-a)cout <<0;
  else cout <<1;
}