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 <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;

int n, m, o, ans = 0, a, b;
int main() {
	cin >> n >> m >> o;
	rep(i, o) {
		cin >> a >> b;
		if (n > a&&n < b) ans = 1;
		else if (m > a&&m < b) ans = 1;
	}
	cout << ans << endl;
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#define INF 2147483647
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int a,b;
  int n;
  cin>>a>>b>>n;
  int dp[1010]={};
  for(int i=0;i<n;i++){
    int s,f;
    cin>>s>>f;
    for(int i=s;i<=f;i++)
      dp[i]=1;
    dp[s]=2;
    dp[f]=3;
  }
  int flag=1;
  for(int i=a+1;i<b;i++)
    if(dp[i]){
      flag=0;
      break;
    }
  //cout<<flag<<endl;
  for(int i=0;i<1010;i++){
    if(dp[i]==2){
      while(dp[i+1]!=0){
	i++;
	dp[i]=1;
      }
      dp[i]=3;
    }
  }
  //for(int i=0;i<1010;i++)
  //cout<<dp[i]<<" ";
  //cout<<endl;
  if(flag==0)
    cout<<1<<endl;
  else if(dp[a]==3)
    cout<<0<<endl;
  else if(dp[b]==2)
    cout<<0<<endl;
  else 
    cout<<0<<endl;
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int a,b;cin>>a>>b;
	int n;cin>>n;
	for(int i = 0; n > i; i++){
		int A,B;cin>>A>>B;
		if(!(b<=A || B<=a)){
			cout << 1 << endl;
			return 0;
		}
	}
	cout << 0 << endl;
}

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

int main(){
 int a,b;
 cin>>a>>b;
 int n;
 cin>>n;
 int s[n];
 int f[n];
 for(int i=0;i<n;i++){
     cin>>s[i]>>f[i];
 }
 int cnt=0;
 for(int i=0;i<n;i++){
     if(!(a>=f[i]||b<=s[i])){
         cnt++;
         break;
     }
 }
 if(cnt){
     cout<<1<<endl;
 }else{
     cout<<0<<endl;
 }
 return 0;
}

C++: #include<iostream>
#include<cmath>

using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    int n;
    cin >> n;
    int cnt=0;
    int x,y;
    for(int i=0;i<n;i++){
        cin >> x >> y;
        if(y>a and b>x){
            cnt=1;
            break;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

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

	for (int i = 0; i < N; i++){
		if (s.at(i) < a && a < f.at(i) || s.at(i) < b && b < f.at(i) || a << s.at(i) && s.at(i) << b || a << f.at(i) && f.at(i) << b || a == s.at(i) && b == f.at(i)){
			cout << '1' << endl;
			break;
		}
		if (i == N - 1)
			cout << '0' << endl;
	}
}

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

using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i, a, n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i, a, n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i, a, n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i, a, n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i, a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
//constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;

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

inline void init() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
}

template<class T>
inline istream &operator>>(istream &input, vector<T> &v) {
    for (auto &elemnt : v)input >> elemnt;
    return input;
}

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

    VI s, f;
    int start = 0;
    FOR(i, start, n) {
        int in, in1;
        cin >> in >> in1;
        s.push_back(in);
        f.push_back(in1);
    }
    s.push_back(a);
    f.push_back(b);
    sort(s.begin(), s.end());
    sort(f.begin(), f.end());

    for(int i=0;i<n;i++){
//        if(f[i] == f.empty() || s[i] == s.empty()){
//            break;
//        }
        if (s[i + 1] < f[i]) {
            cout << 1 << endl;
            return 0;
        } else if (s[i + 1] == s[i]) {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){

    int start_time, end_time, N, s[100]={}, f[100]={}, booking=0;
    cin >> start_time >> end_time >> N;
    for(int i=0; i<N; i++){
        cin >> s[i] >> f[i];
        if(end_time > s[i] && start_time < f[i]){
            booking = 1;
            break;
        }
    }
    if(booking == 1) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

/*
　新しく予約を取るときに、どのように取れば既存の予約と
　かぶらないかを考える。
*/

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

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

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

C++: #include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,b,n,s,f,i,j,fl;
	int flg[1001];
	scanf("%d %d",&a,&b);
	scanf("%d",&n);
	for(i=1;i<=1000;i++)	flg[i]=0;
	for(i=0;i<n;i++)	{
		scanf("%d %d",&s,&f);
		for(j=s;j<f;j++)	{
			flg[j]=1;
		}
	}
	fl=0;
	for(i=a;i<b;i++)	{
		if(flg[i]==1)	{
			fl=1;	break;
		}
	}
	printf("%d\n",fl);
	return 0;
}

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

int main(void){
  int a,b,n, ans=1;
  
  cin >> a >> b >> n;
  for (int i=0; i<n; i++){
    int s, f;
    cin >> s >> f;
    ans &= b<=s||f<=a;
  }
  cout << !ans << endl;
  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdio.h>

using namespace std;

//typedefリスト
typedef vector<long long int> vint;
typedef vector<vector<long long int>> vvint;
typedef vector<string> vstr;
typedef long long int llint;

llint gcd(llint x, llint y) {
	while (y != 0) {
		if (x > y) {
			llint r = x % y;
			x = y;
			y = r;
		}
		else {
			llint r = y % x;
			y = r;
		}
	}
	return x;
}

int main(void) {
	int a, b, N, ans = 0;
	cin >> a >> b >> N;
	vector<pair<int, int>> time(N);
	for (int i = 0; i < N; i++)cin >> time[i].first >> time[i].second;
	for (int i = 0; i < N; i++) {
		if (time[i].first >= b || time[i].second <= a);
		else ans = 1;
		
	}
	cout << ans << endl;
}