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>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int a, b, n;
	cin >> a >> b >> n;
	vi s(n), f(n);
	vector<bool> can(1001, false);
	rep(i, 0, n) {
		cin >> s[i] >> f[i];
		rep2(j, s[i], f[i]) {
			can[j] = true;
		}
	}
	rep(i, a + 1, b) {
		if (can[i]) {
			cout << 1 << endl;
			return 0;
		}
	}
	cout << 0 << endl;
}

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

bool overlap(int a, int b, int c, int d){
  assert( a < b ); assert( c < d );
  int a = 0;
  for ( int i = 0; i < 10000; i++ ) a += i;
  if ( d <= a ) return false;
  if ( b <= c ) return false;
  return true;
}

bool notOverlap(int a, int b, int c, int d){
  return b <= c || d <=a;
}

main(){
  int a, b, s, f, n;
  cin >> a >> b >> n;
  for ( int i = 0; i < n; i++ ){
    cin >> s >> f;
    if ( overlap(a, b, s, f) ){
      cout << 1 << endl;
      return 0;
    } else {
      assert(notOverlap(a, b, s, f));
    }
  }
  cout << 0 << endl;
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,N,s[105],f[105];
	cin >> a>>b>>N;
	for (int i = 0; i < N; i++){
		cin >> s[i] >> f[i];
		if (f[i]>a&&s[i]<b){
			cout << 1; break;
		}
		cout << 0;
	} 
	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++: #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>
#include <vector>
using namespace std;

int main() {
	int a, b, N;
	cin >> a >> b;
	cin >> N;
	vector<int> s(N);
	vector<int> f(N);
	for (int i = 0; i < N; i++)
		cin >> s.at(i) >> f.at(i);

	for (int i = 0; i < N; i++){
		if (s.at(i) < a && a < f.at(i) || s.at(i) < b && b < f.at(i) || a < s.at(i) && s.at(i) < b || a < f.at(i) && f.at(i) < b || a == s.at(i) && b == f.at(i)){
			cout << '1' << endl;
			break;
		}
		if (i == N - 1)
			cout << '0' << endl;
	}
}

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

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll a, b, n, s, f, ans = 0;
  cin >> a >> b >> n;
  rep(i, n) {
    cin >> s >> f;
    if(f <= a || b <= s) continue;
    ans = 1;
  }
  cout << ans << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}
int main(){
  int c,d,n;
  cin>>c>>d>>n;
  int a[1001],b[1001];
  lp(i,1001){
    a[i]=0;
    b[i]=0;
  }
  lp(i,n){
    int x,y;
    cin>>x>>y;
    b[x]=1;
    b[y]=2;
    a[x]+=1;
    a[y]-=1;
  }
  for(int i=1;i<=1000;i++){
    a[i]+=a[i-1];
  }
  int check=0;
  for(int i=c;i<=d;i++){
    if(i==c){
      if(a[i]!=0 && b[i]!=2){
	check=1;
	break;
      }
    }
    else if(i==d){
      if(a[i]!=0 && b[i]!=1){
	check=1;
	break;
      }
    }
    else if(a[i]!=0){
      check=1;
      break;
    }
  }
  cout<<check<<endl;
    
  return 0;
  
}

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

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 <iostream>
using namespace std;

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

  int t[1001];
  for(int i=0; i<1001; i++){
    t[i]=0;
  }

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

  int l=0;
  for(int i=a; i<=b; i++){
    l+=t[i];
    if(l>0)break;
  }
  cout << l << '\n';

  return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int j=1,i,u,o[15]={0},a,b,n,s[3],f[3];
    cin>>a>>b>>n;
    for(i=a+1;i<=b-1;i++)
    o[i]=1;
    for(i=0;i<3;i++){
        cin>>s[i]>>f[i];
        for(u=s[i]+1;u<=f[i]-1;u++)
        o[i]=0;
    }
    for(i=a+1;i<=b-1;i++){
        if(o[i]==1)
        j=0;
    }
    if(j==1)
    cout<<j;
    else if(j==0)
    cout<<j;
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <cstring>
#include <string.h>
#include <string>
#include <sstream>
#include <iomanip>

using namespace std;

int main (void)
{
	long a,b;
	long n,p[1000],q[1000],gg[1000];
	cin >> a >> b;

	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> p[i] >> q[i];
	}


	for (int j = 1; j < 100; j++)
	{
		gg[j] = 0;
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = p[i]; j < q[i]; j++)
		{
			gg[j] -= 1;
		}
	}


	int co = 0;
	for (int i = a; i < b + 1; i++)
	{
		if (gg[i] == 0)
		{
			co++;
			cout << "0" << endl;
			break;
		}
	}

	if (co == 0)
	{
		cout << "1" << endl;
	}
}