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

C++: #include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

vi a(10000);
int n,l,r;

int main(){
	cin>>l>>r>>n;
	for(int i=0;i<n;i++){
		int L,R;
		cin>>L>>R;
		for(int j=L;j<R;j++) a[j]=1;
	}
	for(int i=l;i<r;i++){
		if(a[i]){
			cout<<1<<endl;
			return 0;
		}
	}
	cout<<0<<endl;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a, b, c, d[100] = { 0 }, e[100] = { 0 };
	cin >> a >> b >> c;
	for (int i = 0; i < c; c++){
		cin >> d[i] >> e[i];
		if (b>d[i] && a < d[i]){
			cout << 1 << endl;
		}
		else if (b<d[i] && a>d[i]){
			cout << 1 << endl;
		}
	}
	cout << 0 << endl;
	return 0;
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int N;
  cin >> N;
  int ans = 0;
  FOR(i,0,N){
    int s, f;
    cin >> s >> f;
    if(!(b <= s || a >= f)) ans = 1;
  }
  cout << ans << endl;
}

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<d[j]||b<d[j]&&a>d[j]){
			cout << 1<<endl;
		}
	}
	cout << 0;
	return 0;
}

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

int main(){
  int a,b,n,c;
  cin>>a>>b>>n;
  for(int i=0;i<n;i++){
    int s=0,f=0;
    cin>>s>>f;
    for(int j=a;j<b;j++){
      for(int k=s;k<f;k++){
        if(j==k){
          c=1;
        }
      }
    }
  }
  cout<<c;
}

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};

int main(){
    int a, b; cin>>a>>b;
    vector<bool> v(1010, false);
    for(int i=a; i<b; i++){
        v[i] = true;
    }

    int n; cin>>n;
    int ans = 0;
    for(int i=0; i<n; i++){
        int s, f; cin>>s>>f;
        for(int j=s; j<f; j++){
            if(v[j]) ans = 1;
        }
    }

    cout << ans << endl;
}

C++: #include<iostream>
#include<algorithm>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    int a,b,n;
    bool ok=true;
    cin>>a>>b>>n;
    lol(i,n){
	int x,y;cin>>x>>y;
	if(a<=x&&x<b)ok=false;
	if(a<y&&y<=b)ok=false;
	if(x<=a&&b<=y)ok=false;
    }
    cout<<1-ok<<endl;
    return 0;
}

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 <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int a,b; cin >> a >> b;
	bool flag[1005];
	memset(flag,0,sizeof(flag));
	int n; cin >> n;
	for (int i = 0;i < n;i++){
		int s,f; cin >> s >> f;
		for (int j = s;j < f;j++){
			flag[j] = true;
		}
	}

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

	cout << 0 << endl;

	return 0;

}