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<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--;
  
  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)
	cout << '0' << endl;
      else
	cout << '1' << endl; 
    }
  }
  else{
    cout << '0'  << endl;
  }
  
 
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-----------------------------------------------------------------------------

int a,b;
int n,ans,s,f;

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

	cin>>a>>b>>n;
	REP(i,n) {
		cin>>s>>f;
		if((s<=a&&f>a)||(s<b&&f>=b)||(a<=s&&f<=b)) ans++;
	}
	cout<<min(1,ans)<<endl;

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int a,b,x[1001],n,sum,flag;
int main(){
	cin>>a>>b>>n;
	x[a]++;
	x[b]--;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		x[a]+=2;
		x[b]-=2;
	}
	for(int i=0;i<1001;i++){
		sum+=x[i];
		if(sum>1&&sum%2)flag++;
	}
	cout<<(flag?1:0)<<endl;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef std::vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())

int main() {

	int a, b, n, t[1001] = {}, ans = 0;
	cin >> a >> b;
	cin >> n;
	VI s(n), f(n);
	FOR(i, n) {
		cin >> s[i] >> f[i];
		t[s[i]]++;
		if (f[i] < 1000)t[f[i] + 1]--;
	}
	eFOR1(i, 1000)t[i] += t[i - 1];
	FOR(i, n) {
		t[s[i]] += 10;
		t[f[i]] -= 10;
	}
	for (int i = a; i <= b; i++) {
		if (i == a) {
			if (t[i] >= 1) {
				ans++;
				break;
			}
		}
		else if (i == b) {
			if (t[i] == 1 || t[i] < 0) {
				ans++;
				break;
			}
		}
		else {
			if (t[i] == 1) {
				ans++;
				break;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

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;i++){
		cin>>c>>d;
		if(a<d){
			cout<<"1"<<endl;
			return 0;
		}
		if(c<b){
			cout<<"1"<<endl;
			return 0;
		}
	}
	cout<<"0"<<endl;
	return 0;
}

C++: #include <iostream>
using namespace	std;
int main(){

  int s1,e1,t[1001]={},q,s[1000],e[1000];
  cin>>s1>>e1>>q;
  for(int i=s1;i<e1;i++) t[i]=1;
  for(int i=0;i<q;i++) cin>>s[i]>>e[i];
  for(int i=0;i<q;i++){
    for(int j=s[i];j<e[i];j++) if(t[j]==1){
        cout<<1<<endl;
        return 0;
      }
  }
  cout<<0<<endl;
  return 0;

}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<int, int>;
using namespace std;

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int sf[1010];

int main() {
    int a, b, n;
    cin >> a >> b >> n;
    priority_queue< P, vector<P>, greater<P> > que;
    rep(i, n) {
        int x, y;
        cin >> x >> y;
        que.push({x, y});
    }
    while (que.size()) {
        P p = que.top(); que.pop();
        sf[p.first]++;
        sf[p.second]--;
    }
    int tmp = 0;
    rep(i, b) {
        tmp += sf[i];
        if (i >= a) {
            if (tmp >= 1) {
                cout << 1 << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
}

C++: #include <bits/stdc++.h>
typedef long long ll;
#define ALL(a) a, a+sizeof(a)/sizeof(a[0])
using namespace std;
ll gcd(ll n, ll m) {
	if (m == 0) return n;
	return gcd(m, n % m);
}

ll lcm(ll n, ll m) {
	return m / gcd(n, m) * n;
}

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

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

int main(){
  bool flag = false;
  int start,stop;
  cin >> start >> stop;
  int num;
  cin >> num;
  int book_start,book_stop;
  for(int i=0;i<num;i++){
    cin >> book_start >> book_stop;
    if(start>book_start && start<book_stop){
      flag = true;
    }
    if(stop>book_start && stop<book_stop){
      flag = true;
    }
  }

  cout << flag << endl;

}

C++: #include <iostream>
using namespace std;string w[7]={"thu","fri","sat","sun","mon","tue","wed"};
int main(){int i;cin>>i;cout<<w[i%7]<<endl;}

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

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

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

  int Flag=0;
  for(int i=a; i<b; i++){
    for(int j=0; j<N; j++){
      if(s[j]<=i && i<f[j]){
        Flag=1;
        break;
      }
    }
  }

  if(Flag==1){
    cout << "1" << endl;
  }else{
    cout << "0" << endl;
  }
  return 0;
}

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

int main()
{
    int a,b,n;
    cin >> a >> b >> n;
    int s[n],e[n];
    for(int i=0;i<n;i++)
        cin >> s[i] >> e[i];
    for(int i=0;i<n;i++){
        if((s[i]<=a&&e[i]>a)||(s[i]<b&&e[i]>=b)||(s[i]>=a&&e[i]<=b)){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
int main(){
    int a,b,n;
    cin >> a >> b >> n;
    int l,r,ok = 0;
    for(int i = 0; i < n; i++){
        cin >> l >> r;
        if(l < a && a < r)ok = 1;
        if(l < b && b < r)ok = 1;
        if(l == a && r == b)ok = 1;
        if(l > a && r < b)ok = 1;
        if(l < a && r > b)ok = 1;
    }
    cout << ok << 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;
}