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 <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<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iomanip>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

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

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

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

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

  int A[1000] = {0};
  int count1 = 0,count2 = 0;
  for(int i = a; i < b; i++){
    A[i] = 1;
    count1++;
  }

  int x,y;
  for(int i = 0; i < N; i++){
    cin >> x >> y;
    for(int i = x; i < y; i++){
      A[i] = 0;
    }
  }

  for(int i = 0; i < 1000; i++){
    if(A[i] == 1)count2++;
  }
  if(count1 == count2)cout << '0' << endl;
  else cout << '1' << 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++: //============================================================================
// Name        : tokuteigai.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int a,b,c,d,n;
	cin>>a>>b;
	cin>>n;
	for(int i=0;i<n+1;i++){
		cin>>c>>d;
		if(a<d&&d<b){
			cout<<"1"<<endl;
			return 0;
		}
		if(c<b&&a<c){
			cout<<"1"<<endl;
			return 0;
		}
		if(a==c&&b==d){
			cout<<"1"<<endl;
			return 0;
		}
		if(c<a&&b<d){
			cout<<"1"<<endl;
			return 0;
		}
		if(a==c){
			cout<<"1"<<endl;
			return 0;
		}
		if(b==d){
			cout<<"1"<<endl;
			return 0;
		}
		c=0;
		d=0;
	}
	cout<<"0"<<endl;
	return 0;
}

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

int main(void){
	int  a,b,n;
	cin >> a >> b >> n;
	int s[n], f[n];
	for(int i = 0; i  < n; i++){
		cin >> s[i] >> f[i];
	}
	int k = 0;
	sort(s, s+n);
	sort(f, f+n);

	for(int i = 0, j = 1; j < n; i++, j++){
		if(a >= f[i] && b <= s[j])k = 1;
	}
	if(a >= f[n-1]) k = 1;
	if(b <= s[0]) k = 1;
	if(k == 1) cout << 0;
	else cout << 1;
	cout << endl;
	return 0;
}

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

int main(){
    int a,b;    cin>>a>>b;
    int n;  cin>>n;
    int y[n][2];
    for(int i=0;i<n;i++){
        cin>>y[i][0]>>y[i][1];
    }

    int ans=0;

    for(int i=0;i<n;i++){
        for(int j=a;j<=b;j++){
            if(y[i][0]<=a&&a<y[i][1] || y[i][0]<b&&b<=y[i][1]|| a<=y[i][0]&&y[i][1]<=b){
                ans=1;
                break;
            }
        }
    }

    cout<<ans<<endl;



    return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
#include<math.h>
int main()
{
	static int c,n,a,b,s,f,y[1002];
	cin>>a>>b>>n;
	for(int i=0;i<n;i++)
	{
		cin>>s>>f;
		for(int j=s;j<f;j++)
			y[j]=1;
	}
	for(int i=a;i<=b-1;i++)
	{
		if(y[i]==1)
			break;
		else
			c++;	
	}
	if(b-a==c)
		cout<<"0"<<endl;
	else
		cout<<"1"<<endl;
	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
	int a, b, c, k[105], l[105];
	cin >> a >> b >> c;
	for (int i = 0; i < c; ++i) {
		cin >> k[i] >> l[i];
	}
	for (int i = 0; i < c; ++i) {
		if ((k[i] <= a && a < l[i] && b >= l[i]) || (b >= l[i] && a <= k[i]) || (k[i] <= a && l[i] >= b) || (a <= k[i] && b <= k[i] && l[i] >= b)) {
			cout << "1" << endl;
			return 0;
		}
	}
	cout << "0" << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int a, b;
    cin >> a >> b;
    int n;
    cin >> n;
    bool flag = false;
    for (int i = 0, s, f; i < n; i++) {
        cin >> s >> f;
        bool flag2 = false;
        if (b <= s) flag2 = true;
        if (f <= a) flag2 = true;
        if (!flag2) flag = true;
    }
    cout << flag << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll

signed main(){
  int sta,fin;
  cin>>sta>>fin;
  int n;
  cin>>n;
  bool ok[1005];
  for(int i=0; i<=1000; i++) ok[i]=true;
  
  for(int i=0; i<n; i++){
    int s,f;
    cin>>s>>f;
    for(int j=s; j<=f; j++){
      ok[j]=false;
    }
  }
  
  if(fin-sta==1){
    if(ok[fin]==false&&ok[sta]==false) cout<<1<<en;
    else cout<<0<<en;
    RE;
  }
  int ans=0;
  for(int i=sta+1; i<fin; i++){
    if(ok[i]==false) ans=1;
  }
  cout<<ans<<en;
}

C++: //============================================================================
// Name        : tokuteigai.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int a,b,c,d,n;
	cin>>a>>b;
	cin>>n;
	for(int i=0;i<n+1;i++){
		cin>>c>>d;
		if(a<d&&d<b){
			cout<<"1"<<endl;
			return 0;
		}
		if(c<b&&a<c){
			cout<<"1"<<endl;
			return 0;
		}
		if(a==c&&b==d){
			cout<<"1"<<endl;
			return 0;
		}
		if(c<a&&b<d){
			cout<<"1"<<endl;
			return 0;
		}
		c=0;
		d=0;
	}
	cout<<"0"<<endl;
	return 0;
}

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;
}