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, s, f;
	int ans = 0;
	cin >> a >> b;
	cin >> N;

	for(int i = 0; i < N; i++){
		cin >> s >> f;
			//同じ時間を使用しているとき
			if(a == s && b == f) ans =1;
			//時間をすでに使用（被っている）させているとき
			for(int j = s+1; j < f; j++){
				if(a == j || b == j) ans = 1;
			}
			//時間の使い過ぎ
			for(int k = a+1; k < b; k++){
				if( k == s || k == f) ans = 1;
			}
	}

	cout << ans << endl;

	return 0;
}

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

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

  int N;
  cin >> N;

  int s,f;
  int ans[1000];
  for(int i=0;i<N;i++){
    cin >> s >> f;
    for(int j=s;j<=f;j++){
      ans[j]=1;
    }
  }

  if(ans[a+1]==1 || ans[b]==1){
    cout << '1' << endl;
  }else{
    cout << '0' << 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;
  //cout<<flag<<endl;
  for(int i=0;i<1010;i++){
    if(dp[i]==2){
      while(dp[i+1]==1){
	i++;
	dp[i]=1;
      }
      dp[i+1]=3;
    }
  }
  for(int i=a;i<=b;i++)
    if(dp[i]==1){
      flag=0;
      break;
    }
  /*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 <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){

	int start,end;
	scanf("%d %d",&start,&end);

	int N;
	scanf("%d",&N);

	int log_start,log_end;

	for(int loop = 0; loop <N; loop++){

		scanf("%d %d",&log_start,&log_end);
		if(log_end <= start || log_start >= end){
			//Do nothing
		}else{
			printf("1\n");
			return 0;
		}
	}

	printf("0\n");

	return 0;
}

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

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

  cin >> a >> b >> n;

  bool ans = false;
  while (n--) {
    int s, t;
    cin >> s >> t;

    if (t <= a || b <= s) continue;
    ans = true;
  }

  cout << ans << endl;
}

C++: #include<iostream>

using namespace std;

int main(void) {
	int a, b, n;
	int ans = 0;
	cin >> a >> b;
	cin >> n;
	int s[101][2];
	s[0][0] = a, s[0][1] = b;
	for (int i = 1;i < n+1;i++)
		cin >> s[i][0] >> s[i][1];
	for (int i = 0;i < n+1;i++) {
		for (int j = 0;j < n+1;j++) {
			if (s[i][1] > s[j][0] && s[i][0]<s[j][1] && i!=j) {
				ans = 1;
				break;
			}
			else if (s[i][1] < s[j][0] && s[i][0] > s[j][1] && i != j) {
				ans = 1;
				break;
			}
		}
		if (ans == 1)break;
	}
	cout<<ans<<endl;
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef std::vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())

int main() {

	int a, b, n, t[1001] = {}, ans = 0;
	cin >> a >> b;
	cin >> n;
	VI s(n), f(n);
	FOR(i, n) {
		cin >> s[i] >> f[i];
		t[s[i]]++;
		if (f[i] < 1000)t[f[i] + 1]--;
	}
	eFOR1(i, 1000)t[i] += t[i - 1];
	FOR(i, n) {
		t[s[i]] += 10;
		t[f[i]] -= 10;
	}
	for (int i = a; i <= b; i++) {
		if (i == a) {
			if (t[i] >= 1) {
				ans++;
				break;
			}
		}
		else if (i == b) {
			if (t[i] == 1 || t[i] < 0) {
				ans++;
				break;
			}
		}
		else {
			if (t[i] != 1) {
				ans++;
				break;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

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

C++: #include <iostream>
using namespace std;
bool overlap(int a,int b,int c,int d){
    if(d <= a){
        return false;
    }
    if(b <= c){
        return false;
    }
    return true;
}
int main(void){ 
    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;
        }
    }
    cout << 0 << endl;
    return 0;
}

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<<0<<endl;
    }else{
        cout<<1<<endl;
    }
    return 0;
}

C++: #include<algorithm>
#include <bits/stdc++.h>
#include <math.h>
#include <queue>
using namespace std;
int main(void){
	int d[1000]={0},a,b,s,t,n,ans=0;
	cin>>a>>b>>n;
	for(int i=0;i<n;i++){
		cin>>s>>t;
		for(int j=s;j<t;j++) d[j]=1;
	}
	for(int i=a;a<b;i++){
		if(d[i]==1){
			ans=1;
			break;
		}
	}
	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);
    }
    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);
    }
    for(int i=0;i<1001;i++){
        if(rsw.at(i) == 2){
            cout << 1 << endl;
            break;
        }else if(i==1000){
            cout << 0 << endl;
        }
    }


}

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

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