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<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;i<b;i++){
		if(d[i]==1){
          
			ans=1;
			break;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  int n;
  cin >> n;
  pair <int,int> s[n];
  for(int i = 0;i<n;i++){
    int x,y;
    cin >> x >> y;
    s[i].first = x;
    s[i].second = y;
  }
  sort(s,s+n);
  int f = 0;
  while(s[f].first < a){
    
    f++;
  }
  f--;
  if(n != 0){
    if(s[f].second <= a && s[f+1].first >= b)
      cout << '0'<< endl;
    else
      cout << '1' << endl;
  }
  else{
    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(l[i]<=a){
          x=0;
       }
       else if(b<=k[i]){
          x=0;
       }
       else{
          x=1;
          break;
       }
    }
    cout<<x<<endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
void showResevation(int *arr){
    for(int i=0; i<10; i++){
        cout << arr[i] << " ";
    }
    cout << endl;
}
int main(void){
    int elRes[10] = {};
    int resStart, resEnd;
    cin >> resStart >> resEnd;
    for(int i=resStart-1; i<=resEnd-2; i++){
        elRes[i] = 1;
    }

    int loops, rs, re;
    cin >> loops;
    for(int i=0; i<loops; i++){
        cin >> rs >> re;
        for(int j=rs-1;j<=re-2;j++){
            if(elRes[j] == 1){
                cout << 1 << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, n;
    cin >> a >> b >> n;
    vector<bool> reserve(1001, false);
    for (int i = 0; i < n; i++)
    {
        int s, f;
        cin >> s >> f;
        for (int j = s; j < f; j++)
        {
            reserve[j] = true;
        }
    }
    for (int i = a; i < b; i++)
    {
        if (reserve[i])
        {
            cout << "1" << endl;
            return 0;
        }
    }
    cout << "0" << endl;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n, a, b, s, f, result = 0;
   cin >> a >> b >> n;
   rep(i, n) {
     cin >> s >> f;
     if (a < f && f <= b) result = 1;
     if (a <= s && s < b) result = 1;
   }
   cout << result << endl;
	return 0;
}

C++: //4
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include<bitset>

using namespace std;
#define loop(i,n) for(int i = 0; i < (n); ++i)
#define loops(i,f,n) for(int i = (f); i < (n); ++i)
#define INF 9999999
#define lint long long int
#define VEC vector<int>
#define VEC2 vector<vector<int>>

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x;
	int a, b, n;
	cin >> a >> b >> n;
	bool ans = false;
	loop(i, n)
	{
		int s, f;
		cin >> s >> f;
		if (!(f <= a || b <= s))ans = true;
	}
	cout << ans << endl;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

int main(){
	int a,b;
	int N,tp;
	int ch=0;
	vector<int> r;
	
	scanf("%d %d",&a,&b);
	scanf("%d",&N);
	for(int i=0;i<2*N;i++){
		scanf("%d ",&tp);
		r.push_back(tp);
	}
	sort(r.begin(),r.end());
	if(N==1&&r[0]==a&&r[1]==b){
		ch=0;
	}
	else{
		for(int i=0;i<2*N;i++){
			if(r[i]<=a){
				if(b<=r[i+1]){
					printf("0\n");
					ch=1;
					break;
				}
			}
		}
	}
	if(ch==0)
	printf("1\n");
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,n,k[100],l[100],x;
    cin>>a>>b>>n;
    for(int i=0;i<=100;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;
       }
       else x=0;
    }
    cout<<x<<endl;
    return 0;
}

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

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

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


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

	return 0;
}

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

int main(){
    bool times[1001];
    int a, b, n;
    cin >> a >> b >> n;

    for(int i=0;i<n;i++){
        int s, f;
        cin >> s >> f;
        for(int j=s;j<=f;j++)
            times[j] = true;
    }

    bool reserve = false;
    for(int i=a;i<=b;i++){
        if(times[i])
            reserve = true;
    }

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