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, s, f, t[1001] = {0};

  cin >> a >> b >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s >> f;
    t[s] = 1;
    t[f] = 3;
    for (int j = s + 1; j < f; ++j) {
      t[j] = 2;
    }
  }
  for (int i = 0; i <= 10; ++i) cout << t[i];
  cout << endl;
  if (t[a] != 2 && t[b] != 2) {
    for (int i = a + 1; i < b; ++i) {
      if (t[i] != 0) {
        cout << "1" << endl;
        return 0;
      }
    }
    cout << "0" << endl;
    return 0;
  }
  cout << "1" << 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] || a>=f[i]){
      dup++;
    }
  }
  
  if(dup==N){
    cout << 0 << endl;
  }
  else{
    cout << 1 << endl;
  }

  return 0;
}

C++: #include <stdio.h>
#include <algorithm>
#include <iostream>
#include <numeric>
using namespace std;

int a,b;
int N;
int A[1000];
int main(void)
{
	fill(A,A+1000,0);
	cin>>a>>b;
	cin>>N;
	for(int i=0;i<N;i++){
		int k,s;
		cin>>k>>s;
		for(int q=k;q<s;q++){
			A[q]=1;
		}
	}
	for(int i=a;i<b;i++){
		if(A[i]==1){
			cout<<1<<endl;
			break;
		}
		if(i==(b-1)){
			cout<<0<<endl;
		}
	}

	


	return 0;
}

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

bool filled[1005];
int main() {
  int a, b, N;
  cin >> a >> b >> N;
  for(int i=0; i<1005; i++) filled[i]=false;
  for(int i=0; i<N; i++){
    int s, f;
    cin >> s >> f;
    for(int j=s; j<f; j++) filled[j]=true;
  }
  int ans=0;
  for(int i=a; i<b; i++){
    if(filled[i]) ans=1;
  }
  cout << ans << endl;
}

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;
  }
  int flag=1;
  for(int i=a;i<b;i++)
    if(dp[i]){
      flag=0;
      break;
    }
  if(flag)
    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;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

vector<string>sts{

"mon"
,"tue"
, "wed"
, "thu"
, "fri"
, "sat"
, "sun"
};

int main() {	
	int a,b;cin>>a>>b;
	int N;cin>>N;
	vector<int>oks(1010);
	for (int i = 0; i < N; ++i) {
		int l,r;cin>>l>>r;
		for (int j = l; j < r; ++j) {
			oks[j]=true;
		}
	}
	bool ans=true;
	for (int j = a; j < b; ++j) {
		if(oks[j])ans=false;
	}
	if (ans) {
		cout<<0<<endl;
	}
	else {
		cout<<1<<endl;
	}
}

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

C++: 
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int i = 0; i < (n); i++)

template <class T = int>
T in() { T x; std::cin >> x; return x; }
#define output(e) std::cout << e << '\n'

#ifdef LOCAL
#define db std::cout << "L" << __LINE__
#define de << "\n"
#define dv(x) << " " << #x << "->" << x
#else
#define db
#define de
#define dv(x)
#endif

//
// Implementation
//

int main() {
  int a = in();
  int b = in();
  int N = in();

  rep(i, N) {
    int s = in();
    int e = in();
    if (e > a && s < b) {
      output("1");
      return 0;
    }
  }
  output("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 sta,end,n;
	cin >> sta >> end >> n;

	bool jud = true;
	int tsta,tend;
	for(int i=0;i<n;i++){
		cin >> tsta >> tend;
		if(!((sta<=tsta&&end<=tend)||(sta>=tend&&end>=tend))){
			jud = false;
		}
	}

	if(jud){
		cout << 0 << endl;
	}else{
		cout << 1 << endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
signed main()
{
  int a,b,n,s,f,z=0;
  cin>>a>>b;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s>>f;
    if(a>s&&a<f || b>s&&b<f){
      z++;
    }else if(a==s || b==f){
      z++;
    }else if(a<s&&b>f){
      z++;
    }
  }
  if(z!=0){
    cout<<"1\n";
  }
  else{
    cout<<"0\n";
  }
}

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

bool book[MAX];

int main() {
    for (int i = 0; i < MAX; i++) {
        book[i] = false;
    }
    int a, b;
    cin >> a >> b;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int s, f;
        cin >> s >> f;
        for (int j = s; j < f; j++) {
            book[j] = true;
        }
    }

    for (int i = a; i < b; i++) {
        if (book[i]) {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int F[1000]={},a,b,N,s,f,p=0;
    cin>>a>>b>>N;
    for(int i=1;i<=N;i++){
        cin>>s>>f;
        for(int o=s;o<f;o++){
            F[o]=1;
        }
    }
    for(int i=a;i<b;i++){
        if(F[i]==1){
            p=1;
            break;
        }
    }
    cout<<p<<endl;
}