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++: #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;
}

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

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

  int N;
  cin >> N;

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

  int dup = 0;
  for(int i=0; i<N; i++){
    if(b>s[i]&&b<f[i]){
      dup = 1;
    }
    if(a>s[i]&&a<f[i]){
      dup = 1;
    }
  }

  cout << dup << 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,s[120]={0},f[120]={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)hantei=1;
		else if(s[i]<a&&f[i]<b)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(){
    short a,b,n;
    cin>>a>>b>>n;
    bool R[10001];
    for(int i=0;i<=10001;i++){
        R[i]=false;
    }
    for(int i=1;i<=n;i++){
        short s,f;
        cin>>s>>f;
        for(int j=s+1;j<=f-1;j++){
            R[j]=true;
        }
    }
    for(int i=a;i<=b;i++){
        if(R[i]==true){
            cout<<1<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
	return 0;	
}
#include<iostream>
using namespace std;

int main(){
    short a,b,n;
    cin>>a>>b>>n;
    bool R[10001];
    for(int i=0;i<=10001;i++){
        R[i]=false;
    }
    for(int i=1;i<=n;i++){
        short s,f;
        cin>>s>>f;
        for(int j=s+1;j<=f-1;j++){
            R[j]=true;
        }
    }
    for(int i=a;i<=b;i++){
        if(R[i]==true){
            cout<<1<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
	return 0;	
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int tim[1001] = {0};
	int s, e, n, ans;
	cin >> s >> e;
	tim[s] = 1;
	tim[e] = -1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> s >> e;
		tim[s] = tim[s] + 1;
		tim[e] = tim[e] - 1;
	}
	for (int i = 1; i <= 1000; i++)
	{
		tim[i] = tim[i - 1] + tim[i];
		ans = tim[i];
		if (ans > 1)
			break;
	}
	if (ans > 1)
		cout << "1" << endl;
	else
		cout << "0" << endl;
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
 int x,y,n;
 cin>>x>>y>>n;
 for(int i = 0;i < n;i++){
     int s,f;
     cin>>s>>f;
    if(y>s&&x<f){
        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 <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int a, b, n;
    cin >> a >> b >> n;
    pair<int, int> new_record = {a, b};
    vector<int> temp(10001, 0);
    for(int i = 0; i < n; i++)
    {
        int s, f;
        cin >> s >> f;
        for(int j = s; j <= f; j++)
        {
            temp[j] = 1;
        }
    }
    for(int i = a + 1; i < b; i++)
    {
        if(temp[i] == 1)
        {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 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(b<=k[i]||l[i]<=a){
          x=0;
       }
       else{
          x=1;
          break;
       }
    }
    cout<<x<<endl;
    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<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 j=s;j<=f;j++)
      dp[j]=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||dp[i+1]==2){
	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 <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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 main() {
    vector<bool> vb(1001,0);
    int a,b;
    cin >> a >> b;
    int n;
    cin >> n;
    rep(i,n){
        int x,y;
        cin >> x >> y;
        for(int i = x;i<y;i++)vb[i] = 1;
    }
    //check
    for(int i = a;i<b;i++)if(vb[i] != 0){
        cout << 1 << endl;
        return 0;
    }
    cout << 0 << endl;
    return 0;
}

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

int main() {
    int a, b, n; cin >> a >> b >> n;
    vector<int> l(1001, 0), s(1001, 0);
    for(int i=0; i<n; i++){
        int s, f; cin >> s >> f;
        l[s]++;
        l[f]--;
    }
    l[a]++;
    l[b]--;
    s[0]=l[0];
    for(int i=1; i<1001; i++){
        s[i]=s[i-1]+l[i];
    }
    bool flg=0;
    for(int i=0; i<1001; i++){
        if(s[i]==2){
            flg=1;
            break;
        }
    }
    cout << flg << endl;
}