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

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

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 < n; 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<bits/stdc++.h>
using namespace std;
int main(void){
	int a, b;
	cin >> a >> b;
	int tim[1000 + 1];
	fill(tim, tim + 1001, 0);
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		int s, f;
		cin >> s >> f;
		tim[s]++; tim[f]--;
	}
	int p = 0;
	int l[1001];
	fill(l, l + 1001, 0);
	for(int i = 0; i <= 1000; i++){
		p += tim[i];
		l[i] = p;
	}
	int flg = 0;
	for(int i = a; i < b; i++) if(l[i] > 0) flg = 1;
	cout << flg << 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;
    }
  }
}