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()
{
    int a, b, N;
    cin >> a;
    cin >> b;
    cin >> N;

    int s[N], f[N];

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

    sort(s, s+N);
    sort(f, f+N);

    int si = 0;
    int fi = 0;
    int counter = 0;

    for (int i=0;; ++i)
    {
        if (si >= N) break;
        if (fi >= N) break;

        if (f[fi] == i) { --counter; ++fi; }

        if (a <= i && i <= b && counter != 0)
        {
            cout << 1 << endl;
            return 0;
        }

        if (s[si] == i) { ++counter; ++si; }
    }
    
    cout << 0 << endl;
    return 0;
}

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

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

  cin >> a >> b >> N;

  s.resize(N);
  f.resize(N);

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

  
  for(int ix=0;ix<s.size();++ix){
    
    if(s[ix] <= a && a < f[ix]){

      cout << 1 << endl;
      return 0;

    }else if(s[ix] < b && f[ix] >= b){

      cout << 1 << endl;
      return 0;
    }else if (s[ix] >= a && f[ix] <= b){
      cout << 1 << endl;
      return 0;
    }
  }
  
  cout << 0 << endl;
  
  return 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<stdio.h>
int main()
{
	int n,a,b,c,d,i,j,flg,x[1000],y[1000],z[1000]={0};
	flg=0;
	scanf("%d %d",&a,&b);
	scanf("%d",&n);
	for(i=0;i<n;i++){
			scanf("%d %d",&x[i],&y[i]);
	}
	for(i=0;i<n;i++){
		c=x[i];
		for(j=0;j<y[i]-x[i];j++){
			z[c]=1;
			c++;
		}
	}
	d=b-a;
	for(i=0;i<d;i++){
		if(z[a]==0){
			z[a]=1;
		}
		else flg=1;
		a++;
	}
	if(flg==1){
		printf("1\n");
	}
	else printf("0\n");
	return 0;
}

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

int main() {
	int a, b, N;
	cin >> a >> b;
	cin >> N;
	if (N == 0){
		cout << '0' << endl;
		return 0;
	}
	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;
int main(){
  int a,b,n1;
  cin >>a>>b>>n1;
  bool n[1000];
  for(int i=0;i<1000;i++){
    n[i]=0;
  }
  int s[n1];
  int f[n1];
  for(int i=0;i<n1;i++){
    cin >>s[i]>>f[i];
  }
  for(int i=0;i<n1;i++){
    for(int j=s[i];j<f[i];j++){
      n[j]=1;
    }
  }
  int count=0;
  for(int i=a;i<b;i++){
    if(n[i]==0)count++;
  }
  if(count==b-a)cout <<0<<endl;
  else cout <<1<<endl;
}

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<iostream>
using namespace std;
int main(){
    int a,b,n,k[100],l[100],x=0;
    cin>>a>>b>>n;
    for(int i=1;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;
  cin>>a,b;
  int N;
  cin>>N;
  int s,f;
  for(int i=0;i<N;i++){
    cin>>s>>f;
    if(a<=f && b>=s){
      cout<<1<<endl;
      return 0;
    }
  }
  cout<<0<<endl;
  return 0;
}

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

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    int n; cin>>n;
    vector<int> v(1001,0);
    rep(i,a,b)v[i]++;

    rep(i,0,n){
        int s,f;
        cin>>s>>f;
        rep(j,s,f){
            if(v[j]){
                cout<<1<<endl;
                return 0;
            }
        }
    }
    cout<<0<<endl;

    return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;
int main(void)
{
	int a, b; cin >> a >> b;
	int c; cin >> c;
	if (c == 0)
	{
		cout << 0 << "\n";
		return 0;
	}
	vector<int>arr(1001, 0);
	for (int i = 0; i < c; i++)
	{
		int aa, cc; cin >> aa >> cc;
		if (aa ==a && cc ==b)
		{
			cout << 1 << "\n";
			return 0;
		}
		for (int j = aa; j < cc + 1; j++)
		{
			arr[j] = 1;
		}
	}
	if (b-a == 1 && arr[a] == 1 && arr[b] == 1)
	{
		cout << "1" << "\n";
		return 0;
	}
	for (int i = a + 1; i < b; i++)
	{
		if (arr[i] == 1)
		{
			cout << 1 << "\n";
			return 0;
		}
	}
	cout << 0 << "\n";
}

C++: #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

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

    bool flag = false;
    vector<int> reserve(1001, 0);

    rep(i,0,n){
        int s,f;
        cin >> s >> f;
        for(int i = s; i <= f; i++){
            reserve[i] = 1;
        }
    }

    rep(i,a,b){
        if(reserve[i] == 1){
           if((i == a && reserve[i+1] == 0) || (i == b && reserve[i-1] == 0)){
               continue;
           }else{
               cout << 1 << endl;
               return 0;
           }
        }
    }

    cout << 0 << endl;
}

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 < 100; 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>
using namespace std;

int main(){

	int a, b, N, s[1000],f[1000];
	int ans = 1;
	cin >> a >> b;
	cin >> N;

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

	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(s[i] == f[j] && i < j) ans = 0;
		}
	}

	cout << ans << endl;

	return 0;
}