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>
using namespace std;
int main(){
    int a,b,n,k[101],l[101],x=0;
    cin>>a>>b>>n;
    for(int i=0;i<=n;i++){
       cin>>k[i]>>l[i];
       if(k[i]<a&&a<l[i]){
          x=1;
          break;
       }
       else if(k[i]<b&&b<l[i]){
          x=1;
       break;
       }
       else if(k[i]>a&&l[i]<b){
          x=1;
          break;
       }
    }
    cout<<x<<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 j = 0; j < c; j++){
		cin >> d[j] >> e[j];
		if (b < d[j] || a < e[j]){
			cout << 1<<endl;
		}
	}
	cout << 0;
	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;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int a, b;
	cin >> a >> b;
	int tim[1000 + 1];
	fill(tim, tim + 1001, 0);
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		int s, f;
		cin >> s >> f;
		tim[s]++; tim[f]--;
	}
	int p = 0;
	int l[1001];
	fill(l, l + 1001, 0);
	for(int i = 0; i <= 1000; i++){
		p += tim[i];
		l[i] = p;
	}
	int flg = 0;
	for(int i = a; i < b; i++) if(l[i] > 0) flg = 1;
	cout << flg << endl;
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int a,b,n,s,f,i=0;
  cin >> a >> b >> n;
  while(1){
    cin >> s >> f;
    if((a >= s && b <= f) || (s > a && s < b) || (f > a && f < b)){
      cout << '1' << endl;
      break;
    }
    if(++i == n){
      cout << '0' << endl;
      break;
    }
  }
}

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

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

    for(int i=0;i<n;i++){
        int s,f;
        cin >> s >> f;

        if(a>=s && a<f){
            cout << 1 << endl;
            return 0;
        }
        if(b>s && b<=f){
            cout << 1 << endl;
            return 0;
        }
        if(a<=s && b>=f){
            cout << 1 << endl;
            return 0;
        }
    }

    cout << 0 << endl;
    return 0;
}

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

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,n,k[102],l[102],x=0;
    cin>>a>>b>>n;
    for(int i=0;i<=n;i++){
       cin>>k[i]>>l[i];
       if(b<=k[i]||l[i]<=a){
          x=0;
       }
       else{
          x=1;
          break;
       }
    }
    cout<<x<<endl;
    return 0;
}

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

#define int long long

signed main() {
	int A, B, N;
	cin >> A >> B >> N;
	vector<bool> F(1010, false);
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		if (A == a && b == B) {
			cout << 1 << endl;
			return 0;
		}
		for (int j = a; j <= b; j++) {
			F[j] = true;
		}
	}
	bool ans = 1;
	for (int i = A+1; i < B; i++) {
		if (F[i])ans = false;
	}
	if (A + 1 == B) {
		if (F[A] && F[B])ans = false;
	}
	cout << !ans << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b,c,d,x = 0;
    cin >> a >> b;
    int A[1000] = {};
    int n;
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> c >> d;
        if(a > c && a < d){
          x += 1;
          break;
        }
        if(b > c && b < d){
          x += 1;
          break;
        }
        if(a == c && b == d){
          x += 1;
          break;
        }
        if(a < c && b > d){
          x += 1;
          break;
        }
    }
    cout << x << endl;
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a, b;   //a,bは新しい予約の開始時刻と終了時刻
    int n;      //元々ある予約の個数
    int s, f;
    
    //while(true){
        cin >> a >> b;
        cin >> n;
        
        int c = 0; //予約が重複する回数
        for(int i = 1; i <= n; i++){
            cin >> s >> f;
            if((s <= a && a < f) || (s < b && b <= f) || (a <= s && f <= b)) c++;
        }
        
        if(c == 0)
            cout << "0" << endl;
        else
            cout << "1" << endl;
    //}    
}

C++: #include<stdio.h>
int main()
{
	int a,b,n;
	int s,f,i;
	scanf("%d%d%d",&a,&b,&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&s,&f);
		if(a<f&&b>s){
			printf("1\n");
			return 0;
		}
	}
	printf("0\n");
	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);
    }
    vector<int> cat(1000,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 <<endl;
            break;
        }else if(i==1000){
            cout <<0 <<endl;
        }
    }
    
}

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 main(){
    int A,B,N,S,F;
    cin>>A>>B>>N;
    vector<int> sub(1001,0);
    for(int i=0;i<N;++i){
        cin>>S>>F;
        for(int j=S;j<=F;++j){
            ++sub[j];
            if(j>S&&j<F) ++sub[j];
        }
    }
    for(int i=A;i<=B;++i){
        if(sub[i] == 2){
            cout<<1<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
}

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

int main(){
  int a,b,n,t=0;
  cin >> a >> b >> n;
  int c[n*2];
  for(int i=0; i<n*2; i=i+2){
    int num,num2;
    cin >> num >> num2;
    if(num<a&&num2>a){
      t=1;
    }
    if(num<b&&num2>b){
      t=1;
    }
    if(num==a&&num2==b)t=1;
    if(a<num&&b>num2)t=1;
  }
  cout << t << endl;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<n;++i)

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