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)
	}
}

Python: x, y = map(int, input().split())
n = int(input())

ans = 0
for _ in range(n):
    a, b = map(int, input().split())
    if x < b and a < y:
        ans = 1

print(ans)

Python: n,m = map(int,input().split())
a = int(input())
for i in range(a):
  a,b = map(int,input().split())
  if b <= n or m <= a:continue
  else:
    print("1")
    exit()
print("0")

Python: def overlap(a, b, c, d):
    if d <= a:  return False
    if b <= c:  return False
    return True
 
a,b = map(int, input().split())
res = 0
for i in range(int(input())):
    s, t = map(int, input().split())
    if overlap(a, b, s, t): res = 1
print(res)

Python: a, b = map(int, input().split())
n = int(input())

booking = True
for i in range(n):
	s, f = map(int, input().split())
	if(f <= a or b <= s):
		continue
	else:
		booking = False
print(int(not(booking)))

Python: a, b = map(int, input().split())
n = int(input())
l = sorted([list(map(int, input().split())) for _ in range(n)])
line = [0]*(max(l)[1]+2)
line[a] += 1
line[b] -= 1
for a, b in l:
    line[a] += 1
    line[b] -= 1
for i in range(len(line)-1):
    line[i+1] += line[i]
if line.count(2):
    print(1)
else:
    print(0)

Python: def overlap(a, b, c, d):
    if d <= a:  return False
    if b <= c:  return False
    return True
 
a, b = map(int, input().split())
res = 0
for i in range(int(input())):
    s, t = map(int, input().split())
    if overlap(a, b, s, t): res = 1
print(res)

Python: # N = int(sys.stdin.readline())
# INF = float("inf")
import sys

# N,M = map(int,sys.stdin.readline().split())
# abx = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(M)) # multi line with multi param

# imos=[[0]*(N) for _ in range(N)]

# for a,b,x in abx:
#     imos[a-1][b-1] += 1
#     if a+x-1+1 < N and b+x-1+1 < N:
#         imos[a+x-1+1][b+x-1+1] -= 1
#         imos[a+x-1+1][b-1+1] -= 1
# print(imos)
# for r in range(N):
#     for c in range(N):
#         imos[r][c] += imos[r-1][c-1]#+imos[r][c-1]
# print(imos)

a,b = map(int,sys.stdin.readline().split())
N = int(sys.stdin.readline())
sf = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
M = 1000
imos = [0]*(M+1)
imos[a] += 1
imos[b] -= 1

for s,f in sf:
    imos[s] += 1
    imos[f] -= 1
for i in range(M):
    imos[i+1] += imos[i]
for i in range(a,b+1):
    if imos[i] > 1:
        print("1")
        exit()
print("0")

Python: def check(a, b, lst):
  for s, f in lst:
    if not(b <= s or f <= a):
      return 1
  return 0

a, b = map(int, input().split())
n = int(input())
lst = [tuple(map(int, input().split())) for _ in range(n)]
print(check(a, b, lst))

Python: a, b = map(int, input().split())
N = int(input())
flag = 0
for _ in range(N):
    s, f = map(int, input().split())
    if a > s and f > b:
        flag = 1
    elif a < f < b:
        flag = 1
    elif a < s < b:
        flag = 1
    if flag:
        break
print(1 if flag else 0)

Python: a,b=map(int,input().split())
N=int(input())
s=[]
f=[]
h=0
for i in range(N):
    int_s,int_f=map(int,input().split())
    s.append(int_s)
    f.append(int_f)

for j in range(N):
    if s[j]<=a and b<=f[j]:
        h+=1
        break
    elif a<=s[j] and f[j]<=b:
        h+=1
        break
    elif s[j]<b<f[j]:
        h+=1
        break
    elif s[j]<a<f[j]:
        h+=1
        break
print(h)

Python: a, b = map(int, input().split())
N = int(input())
T = [0]*1001
ok = 0
for i in range(N):
    s, f = map(int, input().split())
    if s < b and a < f:
        ok = 1
print(ok)

Python: a, b = map(int, input().split())
N = int(input())
books = []
for i in range(N):
    books.append(list(map(int, input().split())))

is_booked = 0
for i in range(len(books)):
    if books[i][0] <= a < books[i][1]:
        is_booked = 1

print(is_booked)

Python: def ans(res, L, N):
    for i in range(N):
        count = 0
        for new in res:
            for k in L[i]:
                if(new == k):
                    count += 1
        if(count >= 2):
            return 1
    return 0



a, b = map(int, input().split())
res  = []
for i in range(a,b+1, 1):
    res.append(i)
N = int(input())
L = []
for i in range(N):
    l = []
    s, f = map(int, input().split())
    for i in range(s,f + 1,1):
        l.append(i)
    L.append(l)
print(ans(res, L, N))

Python: a, b = map(int, input().split())
N = int(input())
flag = 0
for _ in range(N):
    s, f = map(int, input().split())
    if not (f <= a or b <= s):
        flag = 1
        break
print(1 if flag else 0)

Python: b,e = map(int, input().split())

r = [0] * 1000
for _ in range(int(input())):
    b1, e2 = map(int, input().split())
    for x in range(b1, e2):
        r[x] = 1

def check():
    for x in range(b, e):
        if r[x] == 1:
            return 1
    return 0

print(check())

Python: def overlap(a, b, c, d):
    if d <= a:  return False
    if b <= c:  return False
    return True

a, b = map(int, input().split())
res = 0
for i in range(int(input())):
    s, t = map(int, input().split())
    if overlap(a, b, s, t): res = 1
print(res)

Python: a,b = map(int,list(input().split(" ")))
n = int(input())
c = [0 for i in range(1002)]
ans = 0
c[a]+=1
c[b]-=1
for i in range(n):
      s,f = map(int,list(input().split(" ")))
      c[s]+=1
      c[f]-=1
for i in range(1,1001):
      c[i] += c[i-1]
      if(c[i]>1):
            ans = 1
print(ans)

Python: a,b=map(int,input().split())
c=0
for i in range (int(input())):
  s,t=map(int,input().split())
  if not (t<=a or b<=s):
    c=1
print(c)

Python: import itertools

a,b = map(int,input().split())

N = int(input())
reserved = [0]*1001
for _ in range(N):
    s, f = map(int,input().split())
    reserved[s] += 1
    reserved[f] -= 1

cumsum = list(itertools.accumulate(reserved))

#print(cumsum)

if sum(cumsum[a:b]):
    print(1)
else:
    print(0)

Python: def main():
    a,b = map(int,input().split())

    n = int(input())
    s,f = [],[]
    for i in range(n):
        ss,ff = map(int,input().split())
        s.append(ss)
        f.append(ff)

    for i in range(n):
        if f[i] <= a or b <= s[i]:
            continue
        else:
            return 1
    return 0

if __name__ == '__main__':
    print(main())

Python: a,b=map(int,input().split())
c=0
for i in range(int(input())):
    s,t=map(int,input().split())
    if not (t<=a or b<=s):
        c=1
print(c)

Python: a,b=map(int,input().split())
n = int(input())
t = 0
for i in range(n):
    s,f=map(int,input().split())
    if s<b<=f or s<=a<f:
        t=1
    elif a<=s and b>=f:
        t=1
print(t)

Python: a, b = map(int, input().split())
N = int(input())
books = []
for i in range(N):
    books.append(list(map(int, input().split())))

is_booked = 0
for i in range(len(books)):
    if books[i][0] <= a < books[i][1]:
        is_booked = 1
    elif a < books[i][0] < b:
        is_booked = 1

print(is_booked)