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<bits/stdc++.h>
#define loop(times) for(int i=0;i<times;i++)
using namespace std;


int main()
{
    int a,b,N,t=1;
    cin>>a>>b>>N;
    
    int s[N],f[N];
    int p[1001];
    int c[1001];
    loop(1000)p[i]=0,s[i]=0;
    
    loop(N){
        cin>>s[i]>>f[i];
        p[s[i]]+=1;
        p[f[i]]-=1;
    }
    p[a]+=1;
    p[b]-=1;
    if(c[0]==2){
    cout<<1<<endl;
    t=0;
    }
    loop(1000){
    c[i+1]=c[i]+p[i];
    if(c[i+1]==2){
    cout<<1<<endl;
    t=0;
    break;
    }
    }
    if(t==1)cout<<0<<endl;
}

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

int main() {
  int a, b, N; cin >> a >> b >> N;
  vector<int> s(N + 1), f(N + 1), time(1001);
  for (int i = 1; i <= N; i++) {
    cin >> s[i] >> f[i];
    for (int j = s[i]; j < f[i]; j++) time[j]++;
  }
  for (int j = a; j < b; j++) time[j]++;
  int is_zero = 0;
  for (int i = 0; i <= 1000; i++) if (time[i] >= 2) is_zero = 1;
  if (is_zero) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main(){
	int reservation[1001];
	for(int i = 0; i < 1001; i++){
		reservation[i] = 0;
	}
	int a, b;
	cin >> a >> b;
	int N;
	cin >> N;
	for(int i = 0; i < N; i++){
		int s, f;
		for(int j = s; j < f; j++){
			reservation[j] = 1;
		}
	}
	bool flag = true;
	for(int i = a; i < b; i++){
		if(reservation[i] == 1){
			flag = false;
			break;
		}
	}
	if(flag){
		cout << "0\n";
	}
	else{
		cout << "1\n";
	}
}

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

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

  int N;
  cin >> N;

  int s,f;
  int ans=0;
  for(int i=0;i<N;i++){
    cin >> s >> f;
    if(s<=a && a<f){
      ans++;
    }else if(s<b && b<=f){
      ans++;
    }
  }

  if(ans>0){
    cout << '1' << endl;
  }else{
    cout << '0' << endl;
  }

  return 0;
}