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

#define rep(i,n) for (int i=0;i<n;i++)
using namespace std;

int main(){
    vector<int> imos(1010,0);
    int a,b,n;
    cin>>a>>b;
    cin>>n;
    //imos[a]++;
    //imos[b+1]--;

    rep(i,n){
        int x,y;
        cin>>x>>y;
        imos[x]++;
        imos[y]--;
    }

    rep(i,1010){
        imos[i+1]+=imos[i];
      //  cerr<<imos[i]<<" ";
    }
    //cerr<<endl;
    for (int i=a;i<b;i++){
        if (imos[i]!=0){
            cout<<1<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
    return 0;


}

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

int main(){
  int a,b;
  cin >> a >> b;
  int n;
  cin >> n;
  pair <int,int> s[n];
  for(int i = 0;i<n;i++){
    int x,y;
    cin >> x >> y;
    s[i].first = x;
    s[i].second = y;
  }
  sort(s,s+n);
  int f = 0;
  while(s[f].first < a){
    
    f++;
    
  }
  f--;
  cout << f << endl;
  if(n != 0){
    if(f != -1){
      if(s[f].second <= a && s[f+1].first >= b)
	cout << '0'<< endl;
      else
	cout << '1' << endl;
      
    }
    else{
      if(s[0].second >= b && s[0].first > a)
	cout << '0' << endl;
      else
	cout << '1' << endl; 
    }
  }
  else{
    cout << '0'  << endl;
  }
  
 
}

C++: #include <bits/stdc++.h>

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

signed main(){
	int a,b; cin >> a >> b;
	int n; cin >> n;
	vector<bool> T(1001, false);
	for(int i = 0; i < n; i++){
		int s,t; cin >> s >> t;
		for(int j = s; j < t; j++){
			T[j] = true;
		}
	}
	for(int i = a; i < b; i++){
		if(T[i]){
			cout << 1 << endl;
			return 0;
		}
	}
	cout << 0 << endl;

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

int main(){
	int a,b;
	int N,tp;
	int ch=0;
	vector<int> r;
	
	scanf("%d %d",&a,&b);
	scanf("%d",&N);
	for(int i=0;i<2*N;i++){
		scanf("%d ",&tp);
		r.push_back(tp);
	}
	sort(r.begin(),r.end());
	for(int i=0;i<2*N;i++){
		if(r[i]<=a){
			if(b<=r[i+1]){
				printf("0\n");
				ch=1;
				break;
			}
		}
	}
	if(ch==0)
	printf("1\n");
}

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<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;
    dp[s]=2;
    dp[f]=3;
  }
  int flag=1;
  //cout<<flag<<endl;
  for(int i=0;i<1010;i++){
    if(dp[i]==2){
      while(dp[i+1]!=0){
	i++;
	dp[i]=1;
      }
      dp[i]=3;
    }
  }
  for(int i=a+1;i<b;i++)
    if(dp[i]==1){
      flag=0;
      break;
    }
  /*for(int i=0;i<1010;i++)
  cout<<dp[i]<<" ";
  cout<<endl;*/
  if(flag==0)
    cout<<1<<endl;
  else if(dp[a]==3)
    cout<<0<<endl;
  else if(dp[b]==2)
    cout<<0<<endl;
  else 
    cout<<0<<endl;
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;
int n, m, o, ans = 0, a, b;
int main() {
	cin >> n >> m >> o;
	rep(i, o) {
		cin >> a >> b;
		if (a > n&&a < m) ans = 1;
		else if (b > n&&b < m) ans = 1;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int a, b, N;
  cin >> a >> b >> N;
  
  int reserve[1100] = {};
  for (int i = a; i < b; i++) reserve[i]++;
  for (int i = 0; i < N; i++) {
    int s, f;
    cin >> s >> f;
    for (int j = s; j < f; j++) reserve[j]++;
  }

  for (int i = 0; i <= 1000; i++) {
    if (reserve[i] > 1) {
      cout << 1 << endl;
      return 0;
    }
  }

  cout << 0 << endl;
  return 0;
}

C++: #include <iostream>

int main()
{
    int a, b, N;
    std::cin >> a >> b >> N;
    bool dup = 0;
    for (int i = 0; i < N; i++) {
        int s, f;
        std::cin >> s >> f;
        for (int j = s; j < f; j++) {
            if (a <= j && j < b) {
                dup = 1;
            }
        }
    }
    std::cout << dup << std::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++: #include<stdio.h>
int main()
{
	int i,a,b,n,s,f;
	scanf("%d%d",&a,&b);
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&s,&f);
		if(a<f&&b>s){
			printf("1\n");
			return 0;
		}
	}
	printf("0\n");
    return 0;
}

C++: #include <iostream>

using namespace std;

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

    int s[N], f[N];

    for (int i=0; i<N; ++i)
    {
        cin >> s[i];
        cin >> f[i];
    }

    sort(s, s+N);
    sort(f, f+N);

    int si = 0;
    int fi = 0;
    int counter = 0;

    for (int i=0; i<1000; ++i)
    {
        if (si >= N) break;
        if (fi >= N) break;

        if (f[fi] == i) { --counter; ++fi; }

        if (a <= i && i <= b && counter != 0)
        {
            cout << 1 << endl;
            return 0;
        }

        if (s[si] == i) { ++counter; ++si; }
    }
    
    cout << 0 << endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
bool overlap(int a, int b, int c, int d){
  if ( d <= a ) return false;
  if ( b <= c ) return false;
  return true;
}
int main(void){
  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;
    }
  }
  cout << 0 << endl;
  return 0;
}

C++: //https://onlinejudge.u-aizu.ac.jp/challenges/sources/PCK/Prelim/0360?year=2017

#include <bits/stdc++.h>

using namespace std;

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

    int n;
    cin >> n;

    bool double_booked = false;
    for (int i = 0; i < n; ++i) {
        int s, f;
        cin >> s >> f;
        if (max(a, s) < min(b, f)) double_booked = true;
    }

    cout << (double_booked ? 1 : 0) << endl;
    return 0;
}

/*
 *
 */