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<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))ans = false;
	}
	if (ans)cout << 0 << endl;
	else cout << 1 << endl;
	return 0;
}

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

int main(){

	int a, b, N, s[1000],f[1000];
	int ans = 0;
	cin >> a >> b;
	cin >> N;

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

	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(s[i] == f[j]) ans = 1;
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
  int a,b,n,t=0;
  cin >> a >> b >> n;
  int c[n*2];
  for(int i=0; i<n*2; i=i+2){
    int num,num2;
    cin >> num >> num2;
    if(num<a&&num2>a){
      t=1;
      break;
    }
    if(num<b&&num2>b){
      t=1;
      break;
    }
  }
  cout << t << endl;
}

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

int main(){
    short a,b,n;
    cin>>a>>b>>n;
    bool R[10001];
    for(int i=0;i<=10001;i++){
        R[i]=false;
    }
    for(int i=0;i<n;i++){
        short s,f;
        cin>>s>>f;
        for(int j=s;j<f;j++){
            R[j-1]=true;
        }
    }
    /*
    for(int i=0;i<20;i++){
        cout<<R[i]<<" ";
    }
    cout<<endl;
    */
    for(int i=a;i<b;i++){
        if(R[i-1]==true){
            cout<<1<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
	return 0;	
}

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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
int a,b;
int N;
int s[1001],f[1001];
int main() {
	cin>>a>>b;
	cin>>N;
	int R=0;
	for(int i=0;i<N;i++){
		cin>>s[i]>>f[i];
		if(s[i]<a && a<f[i])R+=1;
		if(s[i]<b && b<f[i])R+=1;
		if(s[i]<a && b<f[i])R+=1;
	}

	if(R>0)cout<<1<<endl;
	if(R==0)cout<<0<<endl;


	return 0;
}

C++: Hello

C++: #include <iostream>
using namespace std;
int main(){
  int a,b,N,A;
  cin>>a>>b>>N;
  for(int i=0;i<N;i++){
    int s,f;
    cin>>s>>f;
    if(a==f||b==s){
      A=0;
    }else if(a==s||b==s){
      A=1;
    }else
    if(a<s||a>f||b<s||b>f){A=1;}
  }
  cout<<A<<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])) {
			cout << "1" << endl;
			return 0;
		}
	}
	cout << "0" << endl;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int main(){
  int A,B;
  int N;
  cin>>A>>B>>N;
  FOR(i,0,N){
    int S,F;
    cin>>S>>F;
    if(B<=S||F<=A){
      continue;
    }else{
      cout<<1<<endl;
      return 0;
    }
  }
  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 << 0; break;
		}
		else{ cout << 1; }
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,n,a1,b1;
	int i,j,flg;
	scanf("%d %d %d",&a,&b,&n);
	flg=0;
	for(i=0;i<n;i++){
		scanf("%d %d",&a1,&b1);
		if(a<a1&&b>b1) flg=1;
		if(a==a1&&b>b1) flg=1;
		if(a<a1&&b==b1) flg=1;
		if(a==a1&&b==b1) flg=1;
	}
	printf("%d\n",flg);
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int a[102],b[102];
	int n;
	int time[1001];
	cin>>a[0]>>b[0];
	cin>>n;
	int i;
	for(i=0;i<1000;i++){
		time[i]=0;
	}
	for(i=1;i<=n;i++){
		cin>>a[i]>>b[i];
	}
	

	for(i=0;i<=n;i++){
		time[a[i]]++;
		time[b[i]]--;
	}
	
	for(i=0;i<1000;i++){
		if(0<i){
			time[i]+=time[i-1];
		}
	}
	
	bool flg=false;
	
	for(i=0;i<1000;i++){
		if(time[i]>1){
			flg=true;
		}
	}
	
	cout<<((flg)?"1":"0")<<endl;
	
	return 0;
}

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

int main() {
    int n, s, e, s2, e2;
    bool flag = false;
    scanf("%d %d", &s, &e);
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &s2, &e2);
        if (!flag) {
            if ((s<= s2 && e>= e2) || (s2 <= s && e2 >= e) || (s2 < s && e2 > s) || (s2 < e && e2 >=e)) {
                flag = true;
            }
        }
    }
    printf("%d\n", flag);
    return 0;
}

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=0;i<1010;i++)
  //cout<<dp[i]<<" ";
  //cout<<endl;
  for(int i=a+1;i<b;i++)
    if(dp[i]){
      flag=0;
      break;
    }
  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>

using namespace std;

bool check(int a, int b, int s, int f){
  if(f<=a){return false;}
  if(b<=s){return false;}
  return true;
}

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

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

int main(){
    bool res[1001];
    int a, b, N;
    bool ans = false;

    cin >> a >> b;
    for(int i=a;i<b;a++)
        res[i] = true;

    cin >> N;
    for(int i=0;i<N;i++){
        int s, f;
        cin >> s >> f;
        for(int j=s;j<f;j++){
            if(res[j])
                ans = true;
        }
    }

    cout << ans << endl;

    return 0;
}