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>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
  #include "dbgtoki.hpp"
  #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i)  
#else
  #define DUMP(i)  
#endif

#define GETTYPE(i) 
#define TOSTRING(x) #x
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a):i<(b);i++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;

int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,n;
  while(cin >> a >> b >> n){
    int ans = 0;
    REP(i,n){
      int ia,ib;
      cin >> ia >> ib;
      DUMP(ia < a && a < ib);
      DUMP(ia < b && b < ib);
      if((ia < a && a < ib) || (ia < b && b < ib) || ia == a || ib == b || a < ia && ib < b) ans = 1;
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
    int a,b,n;
    cin >>a >>b >>n;
    vector<vector<int> > vec(n,vector<int>(2));
    for(int i=0;i<n;i++){
        cin>>vec.at(i).at(0)>>vec.at(i).at(1);
        vec.at(i).at(0)++;
        vec.at(i).at(1)++;
    }
    vector<int> cat(1001,0);
    for(int i=0;i<n;i++){
        cat.at(vec.at(i).at(0)-1) ++;
        cat.at(vec.at(i).at(1)-1) --;
    }
    cat.at(a-1) ++;
    cat.at(b-1) --;
    vector<int> rsw(1001);
    rsw.at(0) =0;
    for(int i=1;i<1001;i++){
        rsw.at(i) = rsw.at(i-1) + cat.at(i-1);
        if(rsw.at(i)==2){
            cout <<1;
            break;
        }else if(i==1000){
            cout <<0;
        }
    }
    cout << endl;
    
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
#include<stack>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1LL<<60;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  int a,b;
  cin >> a >> b;
  int N;
  cin >> N;
  bool can = true;
  for(int i=0; i<N; i++){
    int s,f;
    cin >> s >> f;
    if(!(f<=a || b<=s)) can = false;
  }
  if(can){
    cout << 0 << endl;
  }else{
    cout << 1 << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,n,s,f;
  int t[1001]={};
  int q[1001]={};
  cin >> a >> b >> n;
  for(int i=0; i<n; i++){
        cin >> s >> f;
        for(int j=s; j<f+1; j++){
          t[j] = 1;
          q[s] = 1; q[f] = 2;
        }
  }
  /*for(int i=0; i<11; i++){
    cout << t[i]  <<  " ";
    if(i==10) cout << endl;
  }
  for(int i=0; i<11; i++){
    cout << q[i] << " ";
  }*/
        if(t[a]==0 && t[b]==0 || q[a]==2 && q[b]==1) cout << 0 << endl;
        else cout << 1 << endl;

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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];
    }
    for (int i = 0; i < N; i++) {
        if (b <= s[i] || f[i] <= a) continue;
        cout << "1\n";
        return 0;
    }
    cout << "0\n";
    return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*
<url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0360>
?????????============================================================
 ??°??£????????¶???????????¨?????????????????????????????\???????????¨?????????????????¶????????¨???????\??????§???????????????????????????????§????????¨????????????£???????????????
 ??¨???????????¨??????????´????????????§???????´??????????????§?????????¨???????????????????????????????????????????????°??????????´?????????????????????????????????????
 
 ??°??????????´????????????§????????¨??????????´???????????????¨????????????????????±?????????????????°????????????????????????
 ??????????????????????´??????????????????¨?????\???????´????????§??????????????????´???????????????????????¨??????????????????
 ???????????????????????????????????¨???????????¨????§?????????????????????°??§??????????????????
 
=================================================================

?§£??¬=============================================================
imos??§??????
================================================================
*/
ll imos[1010];
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll a,b; cin >> a >> b;
    ll N; cin >> N;
    for(int i = 0; i < N;i++){
        ll s,f; cin >> s >> f;
        imos[s]++; imos[f]--;
    }
    for(int i = 1; i < 1010;i++) imos[i] += imos[i-1];
    for(int i = a; i < b;i++){
        if(imos[i] == 1){
            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 <iostream>

using namespace std;

int main()
{
	int a, b;
	int N;
	int s, f;

	cin >> a >> b;
	cin >> N;

	int ret = 0;	// 良い
	for (int i = 0; i < N; i++) {
		cin >> s >> f;

		if ( ! (b <= s || f <= a) ) {
			ret = 1;	// ダメだった
		}
	}
	cout << ret << endl;
	return 0;
}