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 <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<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  int a,b,n,x,y;
  bool flag = false;
  cin >> a >> b >> n;
  for(int i=0;i<n;i++){
    cin >> x >> y;
    if(x > a && y < b) flag = true;
  }

  if(flag) cout << 1 << endl;
  else cout << 0 << endl;

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
#define INF 100000000
#define IINF 9999999999999;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

// 1

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

    int a, b, n, s, f;
    cin >> a >> b >> n;
    rep(i, n){
        cin >> s >> f;
        if(a < f && b > s){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << 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,b,n;
  cin>>c>>b>>n;
  int a[1001];
  lp(i,1001){
    a[i]=0;
  }
  lp(i,n){
    int x,y;
    cin>>x>>y;
    a[x+1]+=1;
    a[y-1]-=1;
  }
  for(int i=1;i<=1000;i++){
    a[i]+=a[i-1];
  }
  int check=0;
  for(int i=c;i<=b;i++){
    if(a[i]!=0){
      check=1;
      break;
    }
  }
  cout<<check<<endl;
    
  return 0;
  
}

C++: #include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int main() {
	int a, b, N;
	cin >> a >> b >> N;
	
	int ans = 0;
	REP(i, N) {
		int s, f;
		scanf("%d %d", &s, &f);
		
		ans |= a == s;
		ans |= b == f;
		ans |= a < s && f < b;
		ans |= s < a && a < f;
		ans |= s < b && b < f;
	}
	
	cout << ans << endl;
	
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  int a,b,N,s,f,i,sum=0;
  cin >> a >> b;
  cin >> N;
  for(i=0;i<N;i++){
    cin >> s >> f;
    if(a>s&&a<f){
      sum=1;
    }
    if(b>s&&b<f){
      sum=1;
    }
    if(a<s&&b>s){
      sum=1;
    }
    if(a<f&&b>f){
      sum=1;
    }
    if(a==s){
      sum=1;
    }
  }
  cout << sum << 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 <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int main() {
	int a, b, N;
	cin >> a >> b >> N;
	
	bool ans = false;
	REP(i, N) {
		int s, f;
		scanf("%d %d", &s, &f);
		
		ans |= a < s && f < b;
		ans |= s < a && a < s;
		ans |= f < b && b < f;
	}
	
	printf("%d\n", (int)ans);
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,n,k[100],l[100],x;
	cin>>a>>b>>n;
	for(int i=0;i<=100;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;
}
	else x=0;
}
	cout<<x<<endl;
return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a, b; cin >> a >> b;
	int n; cin >> n;
	bool b00l = false;
	for (int i = 0; i < n; i++) {
		int c, d; cin >> c >> d;
		if ((a < c&&c < b) || (a < d&&d < b)) {
			b00l = true;
		}
	}
	cout << b00l << endl;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int a, b, n;
    cin >> a >> b >> n;
    pair<int, int> new_record = {a, b};
    vector<int> temp(1001, 0);
    for(int i = 0; i < n; i++)
    {
        int s, f;
        cin >> s >> f;
        for(int j = s; j < f; j++)
        {
            temp[j] = 1;
        }
    }
    bool flag = true;
    for(int i = a; i < b; i++)
    {
        if(temp[i] == 1)
        {
            flag = false;
        }
    }
    if(flag)
    {
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }
    return 0;
}

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

int main(){
  int a, b, N, s, f;
  int flag = 0;
  cin >> a >> b >> N;
  for (int i=0; i<N; i++){
    cin >> s >> f;
    if (!flag && a < f && b > s)
      flag = 1;
  }
  cout << flag;
  return 0;
}

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<s||a>f||b<s||b>f){A=1;}
    if(a==f||b==s){
      A=0;
    }else if(a==s||b==s){
      A=1;
    }
  }
  cout<<A<<endl;
  return 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<iostream>

using namespace std;

int a, b, N;

int main() {
	cin >> a >> b >> N;
	bool f = false;
	for (int i = 0; i < N; i++) {
		int s, e;
		cin >> s >> e;
		if ((s <= a && a < e) || (s < b && b <= e) || (a <= s && e <= b))f = true;

	}
	if (f)cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}

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

int main() {
  int a, b, n; cin >> a >> b >> n;  //yoyaku
  vector<int> v(1001);
  for (int i = 0; i < n; i++) {
    int s, f; cin >> s >> f;
    for (int j = s; j <= f; j++) {
      v.at(j) = 1;
    }
  }
  int ans = 0;
  if (b - a == 1) {
    if (!(v.at(a) == 1 && v.at(b) == 1)) {
      ans = 0;
    } else {
      ans = 1;
    }
  } else {
    for (int i = a + 1; i < b; i++) {
      if (v.at(i) != 0) {
        ans = 1;
      }
    }
  }
  cout << ans << endl;
}