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 {
		fmt.Println(0)
	}
}

C++: //============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {


	int a,b,n;
	int s[101],f[101];
	int d=0;


	cin>>a>>b;
	cin>>n;


	for(int i=1; i<n+1; ++i){
		cin>>s[i]>>f[i];
		if(a<s[i]&&b>s[i]){
			d=1;
		}else if(f[i]<b&&f[i]>a){
			d=1;

		}
	}
		cout<<d<<endl;

		return 0;




}

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

int main(){
  int a,b,n;
  cin >> a >> b >> n;
  vector< int > s(n),f(n);
  for(int i=0;i<n;i++){
    cin >> s.at(i) >> f.at(i);
  }

  vector< int > p(1001,0);

  for(int j=0;j<n;j++){
    p.at(s.at(j)) += 1;
    p.at(f.at(j)) -= 1;
  }

  int judge=0;
/*  vector< int > sum(1002);
  sum.at(0) = 0;
  for(int i=1;i<1002;i++) sum.at(i) += sum.at(i-1)+p.at(i);
  if(sum.at(b+1)-sum.at(a+1) > 0) judge=1;
*/
  for(int i=1;i<1001;i++) p.at(i) += p.at(i-1);
  for(int i=a;i<b;i++){
    if(p.at(i) > 0) judge = 1;
  }

  cout << judge << endl;
}

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

int main(){
    int a,b,N; 
    cin >> a >> b >> N;
    int s[N],f[N];
    for(int i=0;i<N;i++){
        cin >> s[i] >> f[i];
    }
    int flag,fin;
    for(int i=0;i<N;i++){
        if(f[i]<=a){
            flag = 0;
        }else if(b<=s[i]){
            flag = 0;
        }else{
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<int, int>;
using namespace std;

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int sf[1010];

int main() {
    int a, b, n;
    cin >> a >> b >> n;
    priority_queue< P, vector<P>, greater<P> > que;
    rep(i, n) {
        int x, y;
        cin >> x >> y;
        que.push({x, y});
    }
    while (que.size()) {
        P p = que.top(); que.pop();
        sf[p.first]++;
        sf[p.second]--;
    }
    int tmp = 0;
    rep(i, b) {
        tmp += sf[i];
        if (i >= a) {
            if (tmp >= 1) {
                cout << 1 << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
}

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

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int a, b, n;
	cin >> a >> b;
	cin >> n;
	bool re[1000] = { false };
	for( int i = 0; i < n; i++ )
	{
		int s, f;
		cin >> s >> f;
		for( int j = s; j < f; j++ )re[j]=true;
	}
	bool check = true;
	for( int i = a; i < b; i++ )if( re[i] )check = false;
	cout << ( check ? 0 : 1 ) << endl;

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,d,e,count;
    cin>>a>>b>>c;
    count=0;
    for(int j=1;j<=c;j++){
        cin>>d>>e;
        if(a>d&&a<e){
            count=1;
        }else if(b>d&&b<e){
            count=1;
        }else if(a==d&&b==e){
            count=1;
        }else if(a<d&&b>e){
            count=1;
        }
    }
    cout<<count<<endl;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int a, b, n; cin >> a >> b >> n;
	vi sum(1010);
	rep(i, n){
		int x, y; cin >> x >> y;
		sum[x]++;
		sum[y]--;
	}
	rep(i, 1001) sum[i + 1] += sum[i];
	for(int i = a; i < b; i++) if(sum[i]){
		cout << 1 << endl;
		return 0;
	}
	cout << 0 << endl;
	
	return 0;
}

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

#define int long long
#define pb push_back 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for( int i = 0; i < (n); i++ )
#define Rrep(i, a, n) for( int i = (a); i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; 
typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

signed main() {
  int a, b, N;
  bool flag = false;
  cin >> a >> b;
  cin >> N;
  Rep(i, N) {
    int c, d;
    cin >> c >> d;
    if ( a <= c && c < b && a <= d && d < b ) flag = true;
  }

  if ( flag ) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {
	int a, b, n;
	cin >> a >> b >> n;
	bool flag = false;
	rep(i, n){
		int s, f;
		cin >> s >> f;
		if(b <= s || f <= a) continue;
		flag = true;
 	}
	cout << flag << endl;
}

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