Harryxun/stf_run huggingface dataset:
n,m,q=map(int, input().split())  
a=[list(map(int, input().split())) for i in range(m)]
b=[list(map(int, input().split())) for i in range(q)]
x=[0]*(n+1)
print(x)
for i in range(m):
    x[a[i][0]-1]+=1
    x[a[i][1]]-=1

print(x)
x = itertools.accumulate(x)
x=list(x)
print(x)

for i in range(q):
    print(x[b[i][1]]-x[b[i][0]])

### FIXED CODE ###

import itertools
import numpy as np
n,m,q=map(int, input().split())  
a=[list(map(int, input().split())) for i in range(m)]
b=[list(map(int, input().split())) for i in range(q)]

x=[[0]*(501) for i in range(501)]

for i in range(m):
    x[a[i][0]][a[i][1]]+=1



for i in range(501):
    x[i] = list(itertools.accumulate(x[i]))
  
x=np.array(x)
for i in range(501):
    x[:,i] = list(itertools.accumulate(x[:,i]))



for i in range(q):
    v1=b[i][0]
    v2=b[i][1]
    
    a1=x[v2,v2]
    a2=x[v2,v1-1]
    a3=x[v1-1,v2]
    a4=x[v1-1,v1-1]
    print(a1-a2-a3+a4)
a=input()
if a[0]==a[1]:
  print("Bad")
  elif a[1]==a[2]:
    print("Bad")
    elif a[2]==a[3]:
      print("Bad")
      else:
        print("Good")

### FIXED CODE ###

s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print("Bad")
else:
  print("Good")
a = int(input())
b = int(input())
h = int(input())
print(int((a+b)＊h//2))

### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())
ans=(a+b)*h/2
print(int(ans))
from math import factorial

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

X_max = 0
X_min = 0

for i in range(N-K+1):
    X_max += (factorial(N-1-i) / factorial(K-1) / factorial(N-K-i))*A[-(i+1)]
    X_min += (factorial(N-1-i) / factorial(K-1) / factorial(N-K-i))*A[i]
    X_max %= 1000000007
    X_min %= 1000000007

print(int(X_max - X_min))

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

p = 1000000007
X_max = 0
X_min = 0


def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p


fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


for i in range(N-K+1):
    n = cmb(N-1-i, K-1, p)
    X_max += n*A[-(i+1)]
    X_max %= p
    X_min += n*A[i]
    X_min %= p

print(int((X_max - X_min) % p))
2000 20000000

### FIXED CODE ###

N,Y=map(int,input().split())

Y=int(Y/1000)
A=B=C=-1

for c in range(N+1):
  for b in range(N+1):
    a=N-b-c
    if c+5*b > Y:
      break
    if c+5*b+10*a == Y:
      A,B,C=a,b,c
      
print(A,B,C)
"""everything has a cost!"""

from math import *
import random, functools, collections, sys

__author__ = 'p7x'


# sys.stdin = open('in.txt', 'r')
# sys.stdout = open('out.txt', 'w')
# sys.stderr = open('err.txt', 'w')

i, j = 0, 0
n , m = 0, 0

def read(ti, tj) -> int:
    if (ti < n and (tj == m or a[ti] < b[tj])):
            return 1
    elif (tj < m and (ti == n or b[tj] < a[ti])):
        return 2
    elif (ti < n and tj < m):
        return read(ti+1, tj+1)
    else:
        if (ti == i): return 3
        else: return 1


if __name__ == '__main__':
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    
    mins = 0
    while (mins < k):
        v = read(i, j)
        if (v == 1):
            mins += a[i]
            i += 1
        elif (v == 2):
            mins += b[j]
            j += 1
        else:
            break
    if mins > k:
        print(i+j-1)
    else:
        print(i+j)

### FIXED CODE ###

"""everything has a cost!"""

from math import *
import random, functools, collections, sys

__author__ = 'p7x'


# sys.stdin = open('in.txt', 'r')
# sys.stdout = open('out.txt', 'w')
# sys.stderr = open('err.txt', 'w')


if __name__ == '__main__':
    n,m,k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    for i in range(1,len(a)):
        a[i] += a[i-1]
    for i in range(1,len(b)):
        b[i] += b[i-1]

    j = len(b)-1
    while j > -1 and b[j] > k:
        j -= 1
    ans = j+1
    i = len(a)-1
    while i > -1 and a[i] > k:
        i -= 1
    ans = max(i+1,ans)

    for inx in range(i+1):
        while j > -1 and a[inx] + b[j] > k:
            j -= 1
        ans = max(inx+j+2,ans)
    print(ans)
s=list(input())

int a
while a < 3:
  if s[a] == "1":
    s[a] = "9"
  else s[a] == "9":
    s[a] = "1"
  a += 1

print(int(s))

### FIXED CODE ###

s=list(input())


a = 0
while a < 3:
  if s[a] == "1":
    s[a] = "9"
  elif s[a] == "9":
    s[a] = "1"
  a += 1

s = ''.join(s)


print(s)
a = int(input())
s = input()

if a>=3200: print(s)
else: print 'red'


### FIXED CODE ###

a = int(input())
s = input()

if a>=3200: print(s)
else: print('red')
A,B,C,K=(int(x) for x in input().split())

if(K<=A+B):
    print(A)
if(K>A+B):
    print(A-(K-A-B))

### FIXED CODE ###

n,m,x=(int(i) for i in input().split())
a=[]
c=[]
for i in range(n):
  a.append(list(map(int,input().split())))
  c.append(a[i][0])
  del a[i][0]
  
INF=1001001001
ans=INF

for s in range(1<<n):
  cost=0
  d=[0]*m
  for i in range(n):
    if(s>>i&1):
      cost+=c[i]
      for j in range(m):
        d[j]+=a[i][j]
  ok=True
  for j in range(m):
    if(d[j]<x):
      ok=False
  if ok:
    ans=min(ans,cost)
if ans==INF:
  print(-1)
else:
  print(ans)
import sys,bisect
input=sys.stdin.readline

N=int(input())
vw=[(-1,-1)]
for i in range(N):
    vw.append(tuple(map(int,input().split())))

dp=[[0 for i in range(100001)] for i in range(2**10)]
for i in range(vw[1][1],100001):
    dp[1][i]=vw[1][0]
MAX=min(2**10,N+1)
for i in range(2,MAX):
    v,w=vw[i]
    for j in range(w):
        dp[i][j]=dp[i//2][j]
    for j in range(w,100001):
        dp[i][j]=max(dp[i//2][j],dp[i//2][j-w]+v)

for i in range(int(input())):
    v,L=map(int,input().split())
    if 2**10>v:
        print(dp[v][L])
    else:
        t=[]
        while v>=2**10:
            t.append(vw[v])
            v//=2
        n=len(t)
        temp=[[0,0] for i in range(2**n)]
        for i in range(1,2**n):
            m=i.bit_length()
            temp[i][0]=temp[i-2**(m-1)][0]+t[m-1][0]
            temp[i][1]=temp[i-2**(m-1)][1]+t[m-1][1]
        ans=0
        for i in range(2**n):
            ans=max(ans,temp[i][0]+dp[v][L-temp[i][1]]*(L>=temp[i][1]))
        print(ans)

### FIXED CODE ###

import sys,random,time,bisect
input=sys.stdin.buffer.readline

start=time.time()
N=int(input())
vw=[(-1,-1)]
for i in range(N):
    vw.append(tuple(map(int,input().split())))

dp=[[] for i in range(2**9)]
def make_dp(v):
    t=[[0,0] for i in range(15)]
    V=v
    id=0
    while v>=1:
        t[id]=vw[v]
        id+=1
        v//=2
    n=id
    temp=[[0,0] for i in range(2**n)]
    for i in range(n):
        for j in range(2**i,2**(i+1)):
            temp[j][0]=temp[j-2**i][0]+t[i][0]
            temp[j][1]=temp[j-2**i][1]+t[i][1]
    temp.sort(key=lambda x:x[1])
    for i in range(1,2**n):
        temp[i][0]=max(temp[i][0],temp[i-1][0])

    dp[V]=[0]*(10**5+1)
    for i in range(2**n-1):
        L=temp[i][1]
        R=temp[i+1][1]
        if L>10**5:
            break
        elif R>10**5:
            R=10**5+1
        for j in range(L,R):
            dp[V][j]=temp[i][0]
    else:
        L=temp[-1][1]
        if L<=10**5:
            for j in range(L,10**5+1):
                dp[V][j]=temp[-1][0]

MAX=min(2**9,N+1)
for i in range(1,MAX):
    make_dp(i)

Q=int(input())
query=[[] for i in range(N+1)]
for i in range(Q):
    v,L=map(int,input().split())
    query[v].append((L,i))

ans=[0]*Q
temp=[[0,0] for i in range(2**9)]
t=[[0,0] for i in range(15)]
def solve(v):
    V=v
    id=0
    while v>=2**9:
        t[id]=vw[v]
        id+=1
        v//=2
    n=id
    for i in range(n):
        for j in range(2**i,2**(i+1)):
            temp[j][0]=temp[j-2**i][0]+t[i][0]
            temp[j][1]=temp[j-2**i][1]+t[i][1]

    for L,ID in query[V]:
        res=0
        for i in range(2**n):
            if L>=temp[i][1]:
                res=max(res,temp[i][0]+dp[v][L-temp[i][1]])
        ans[ID]=res

for i in range(1,N+1):
    if query[i]:
        solve(i)

for i in range(Q):
    print(ans[i])
S = input()
T = input()
S = list(S)
T = list(T)
l = len(S)
if S == T[:-1] and l<=10 and l>=1 and S.islower():
    print(True)
else:
    print(False)

### FIXED CODE ###

S = input()
T = input()
l = len(S)
if S == T[:-1] and l<=10 and l>=1 and S.islower():
    print('Yes')
else:
    print('No')
a=input()
a.replace("/", "")
print("Heisei" if int(a)<=20190430 else "TBD")

### FIXED CODE ###

a=input()
print("Heisei" if int(a.replace("/", ""))<=20190430 else "TBD")
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n)
l1=[0]*(n)
for i in range(n):
    l[a[i]-1]+=1
    
def combinations_count(n,r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))

for i in range(n):
    if l[i]>=2:
        l1[i]+=combinations_count(l[i],2)

l1sum=sum(l1)
for i in range(n):
    if l[a[i]-1]-1>=2:print(l1sum-l1[a[i]-1]+combinations_count(l[a[i]-1]-1,2))
    else:print(l1sum-l1[a[i]-1])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
l=[0]*(n)
l1=[0]*(n)
for i in range(n):
    l[a[i]-1]+=1
    
for i in range(n):
    if l[i]>=2:
        l1[i]+=l[i]*(l[i]-1)//2

l1sum=sum(l1)
for i in range(n):
    if l[a[i]-1]-1>=2:print(l1sum-l1[a[i]-1]+ (l[a[i]-1]-1)*(l[a[i]-1]-2)//2)
    else:print(l1sum-l1[a[i]-1])
# 入力
A, B = map(int,input().split())

# 処理
if A == B:
    print('Draw')
elif A == 1:
    print('Alice')
elif B == 1:
    print('Bob')
elif A > B:
    print('Alice')
else:

### FIXED CODE ###

# 入力
A, B = map(int,input().split())

# 処理
if A == B:
    print('Draw')
elif A == 1:
    print('Alice')
elif B == 1:
    print('Bob')
elif A > B:
    print('Alice')
else:
    print('Bob')
X = int(input())

def check(num):
    max_div = int(num**0.5)
    for div in range(2, max_div+1):
        if num % div == 0:
            return False
    else:
        return True

num = X
while True:
    if check(num):
    print(num)
    break
    
    num += 1

### FIXED CODE ###

X = int(input())

def check(num):
    max_div = int(num**0.5)
    for div in range(2, max_div+1):
        if num % div == 0:
            return False
    else:
        return True

num = X
while True:
    if check(num):
        print(num)
        break
    
    num += 1
from collections import deque

h,w = map(int,input().split())
maze = [[False for _ in range(w)] for _ in range(h)]


for i in range(h):
    maze[i] = list(input())

#print(maze)

def bfs(x,y):
    seen = [[False for _ in range(w)] for _ in range(h)]
    dist = [[False for _ in range(w)] for _ in range(h)]
    
    if(maze[y][x] == "#"):
        return [[0]]
    
    dist[y][x] = 0
    d = deque()
    d.append(x + w*y)
    #print(d)
    while d:
        #print(d)
        base = d.popleft()
        #print(base)
        xx = base%w
        yy = base//w
        #print(*seen,sep='\n')
        #print("-------")
        if(seen[yy][xx] == True):
            continue
        else:
            seen[yy][xx] = True
        
        for px,py in [(-1,0),(1,0),(0,-1),(0,1)]:
            #print(xx+px,yy+py)
            if (0<= xx+px < w and 0<= yy+py < h):
                if(maze[yy+py][xx+px] == "." and seen[yy+py][xx+px] == False):
                    d.append(xx+px+(yy+py)*w)
                    dist[yy+py][xx+px] = dist[yy][xx] + 1
    
    return dist

result = bfs(0,2)  

#print(*result,sep ="\n")
ans = 0
for j in range(h):
    for k in range(w):
        res = 0
        result = bfs(k,j)
        for i in result:
            res = max(max(i),res)
        ans = max(ans,res)
        


print(ans)


### FIXED CODE ###

from collections import deque

h,w = map(int,input().split())
maze = [[False for _ in range(w)] for _ in range(h)]


for i in range(h):
    maze[i] = list(input())

#print(maze)

def bfs(x,y):
    seen = [[False for _ in range(w)] for _ in range(h)]
    dist = [[False for _ in range(w)] for _ in range(h)]
    
    if(maze[y][x] == "#"):
        return [[0]]
    
    dist[y][x] = 0
    d = deque()
    d.append(x + w*y)
    #print(d)
    while d:
        #print(d)
        base = d.popleft()
        #print(base)
        xx = base%w
        yy = base//w
        #print(*seen,sep='\n')
        #print("-------")
        if(seen[yy][xx] == True):
            continue
        else:
            seen[yy][xx] = True
        
        for px,py in [(-1,0),(1,0),(0,-1),(0,1)]:
            #print(xx+px,yy+py)
            if (0<= xx+px < w and 0<= yy+py < h):
                if(maze[yy+py][xx+px] == "." and seen[yy+py][xx+px] == False):
                    d.append(xx+px+(yy+py)*w)
                    dist[yy+py][xx+px] = dist[yy][xx] + 1
    
    return dist

#result = bfs(0,2)  

#print(*result,sep ="\n")
ans = 0
for j in range(h):
    for k in range(w):
        res = 0
        result = bfs(k,j)
        for i in result:
            res = max(max(i),res)
        ans = max(ans,res)
        


print(ans)
from collections import defaultdict

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N-1)]

d = defaultdict(list)
class Tree:
    def __init__(self, v):
        self.v = v
        self.neighbors = []

    def set_rank(self,rank,parent):
        self.rank = rank
        for neighbor in self.neighbors:
            if neighbor == parent:
                continue
            neighbor.set_rank(rank=rank+1,parent=self)



trees = {i:Tree(i) for i in range(1,N+1)}

for a,b in AB:
    trees[a].neighbors.append(trees[b])
    trees[b].neighbors.append(trees[a])
trees[1].set_rank(1,None)

group0 = [node.v for node in  trees.values() if node.rank %2 ==0]
group1 = [node.v for node in  trees.values() if node.rank %2]
x = [set(),set(),set()]
for i in range(1,N+1):
    x[i%3].add(i)
if len(group1) < len(group0):
    group1,group0 = group0,group1

result = {}
if len(group0) <= len(x[0]):
    while group0 and x[0]:
        result[group0.pop()]= x[0].pop()
    y = x[0]|x[1]|x[2]
    while group1:
        result[group1.pop()] = y.pop()
else:
    while x[2] and group0:
        result[group0.pop()] = x[2].pop()
    while x[1] and group1:
        result[group1.pop()] = x[1].pop()
    while group0 and x[0]:
        result[group0.pop()] = x[0].pop()
    while group1 and x[0]:
        result[group1.pop()] = x[0].pop()
    if group0 or group1:
        print(-1)
        exit()


print(' '.join(str(result[i]) for i in range(1,N+1)))



### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N - 1)]


class Tree:
    def __init__(self, v):
        self.v = v
        self.neighbors = []

    def set_rank(self, rank, parent):
        self.rank = rank
        for neighbor in self.neighbors:
            if neighbor is parent:
                continue
            neighbor.set_rank(rank=rank + 1, parent=self)


trees = {i: Tree(i) for i in range(1, N + 1)}

for a, b in AB:
    trees[a].neighbors.append(trees[b])
    trees[b].neighbors.append(trees[a])
try:
    trees[1].set_rank(1, None)
except:
    print(-1)
    exit()

group0 = [node.v for node in trees.values() if node.rank % 2 == 0]
group1 = [node.v for node in trees.values() if node.rank % 2]
x = [set(), set(), set()]
for i in range(1, N + 1):
    x[i % 3].add(i)
if len(group1) < len(group0):
    group1, group0 = group0, group1
result = {}
if len(group0) <= len(x[0]):
    while group0 and x[0]:
        result[group0.pop()] = x[0].pop()
    y = x[0] | x[1] | x[2]
    while group1 and y:
        result[group1.pop()] = y.pop()
else:
    while x[2] and group0:
        result[group0.pop()] = x[2].pop()
    while x[1] and group1:
        result[group1.pop()] = x[1].pop()
    while group0 and x[0]:
        result[group0.pop()] = x[0].pop()
    while group1 and x[0]:
        result[group1.pop()] = x[0].pop()
    if group0 or group1:
        print(-1)
        exit()

print(' '.join(str(result[i]) for i in range(1, N + 1)))
import numpy as np
x1,y1,x2,y2 = map(int,input().split())
v = np.array([x1,y1])
w = np.array([x2,y2])
u = w - v
T = np.array([[0,-1],[1,0]])
v1 = np.matmul(T,u) + w
v2 = np.matmul(T,v1 - w) + v1
print(v1[0],v1[1],v2[0],v2[1])

### FIXED CODE ###

u,v,x,y = map(int,input().split())
[p,q] = [x-(y-v),y+(x-u)]
[r,s] = [p-(q-y),q+(p-x)]
print(p,q,r,s)
from fractions import gcd
import sys
input = sys.stdin.readline

N = int(input())

T = list([int(input()) for _ in range(N)])

ans = T[0]

for i in T:
    ans = int(ans/gcd(ans, i))* i
print(ans)
    

### FIXED CODE ###

from fractions import gcd
import sys
input = sys.stdin.readline

N = int(input())

T = list([int(input()) for _ in range(N)])

ans = T[0]

T= set(T)

for i in T:
    ans = i//gcd(ans, i)* ans
print(ans)
a = int(input())
s = input()

res = a >= 3200 ? s : "red"
print(res)

### FIXED CODE ###

a = int(input())
s = input()

res = s if a >= 3200 else "red"
print(res)
def ctonum(c):
	alp="qwertyuiopasdfghjklzxcvbnm"
	for i in range(len(alp)):
		if c == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=countS

S,T=input(),input()

for i in range(len(S)):
	countS[ctonum[S[i]]]+=1
	countT[ctonum[T[i]]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

#!/usr/bin/python
# -*- coding: utf-8 -*-
s = raw_input()
t = raw_input()
dd1 = {}
dd2 = {}
flag = True
for i in xrange(len(s)):
    c1, c2 = s[i], t[i]
    if dd1.get(c1, c2) != c2:
        flag = False
        break
    if dd2.get(c2, c1) != c1:
        flag = False
        break
    dd1[c1] = c2
    dd2[c2] = c1
print 'Yes' if flag else 'No'
a,b,c=map(int,input().split())
if ((a+b==10 and a==5) and c==7) or ((a+b=12 and c==5) and (a==5 or b==5)):
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a,b,c=map(int,input().split())
if ((a+b==10 and a==5) and c==7) or ((a+b==12 and c==5) and (a==5 or b==5)):
  print("YES")
else:
  print("NO")
N,Q = map(int,input().split())
S = input()
cnt = []
lrs = []
for i in range(Q):
        lrs.append(list(map(int,input().split())))

for k in range(len(S) - 1):
    if S[k] == 'A':
            if S[k+1] == 'C':
                    cnt.append(1)
    else:
            cnt.append(0)



for lr in lrs:
    sums = 0
    for k in range(lr[0]-1,lr[1]-1):
        sums += cnt[k]
    print(sums)

### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
cnt = [0] * (N + 1)
lrs = []
for i in range(Q):
        lrs.append(list(map(int,input().split())))

for i in range(N):
        cnt[i+1] = cnt[i] + (1 if S[i:i+2] == "AC" else 0)
for lr in lrs:
        print(cnt[lr[1] - 1] - cnt[lr[0] - 1])
import math
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10**7)
a, b, x = map(int, input().split())

if a*a*b/2 < x:
    l = 2*b - 2*x/(a*a)
    print(90 - math.degrees(math.atan(a/l)))

elif a*a*b/2 == x:
    print(90 - math.degrees(math.atan(a/b)))

else:
    l = 2*x / (a*b)
    print(90 - math.degrees(math.atan(l/b)))


### FIXED CODE ###

import math
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10**7)
a, b, x = map(int, input().split())

if a*a*b == x:
	print(0)

elif a*a*b/2 < x:
    l = 2*b - 2*x/(a*a)
    print(90 - math.degrees(math.atan(a/l)))

elif a*a*b/2 == x:
    print(90 - math.degrees(math.atan(a/b)))

else:
    l = 2*x / (a*b)
    print(90 - math.degrees(math.atan(l/b)))
if ("N" in a and"S"in a)or(not"N" in a and not "S" in a):
    if ("W" in a and"E"in a)or(not"W" in a and not "E" in a):
        print("Yes")
    else:
        print("No")
else:
    print("No")

### FIXED CODE ###

a=list(input())
if ("N" in a and"S"in a)or(not"N" in a and not "S" in a):
    if ("W" in a and"E"in a)or(not"W" in a and not "E" in a):
        print("Yes")
    else:
        print("No")
else:
    print("No")
n = int(input())

order = list(map(int, input().split()))
menu = {}
tmp = list(map(int, input().split()))
for i in range(n):
    menu[i] = tmp[i]
# print(menu)
add = {}
tmp = list(map(int, input().split()))
for i in range(n-1):
    add[i] = tmp[i]

result = 0

for i in range(len(order)):
    # print(order[i]-1, menu[order[i]-1])
    result += menu[order[i]-1]
    if i < len(order)-1:
        if order[i+1] - order[i] == 1:
            # print(add[i-1])
            result += add[i-1]

print(result)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(n):
    ans += b[a[i] - 1]
    if i>0 and a[i] == a[i-1]+1:
        ans += c[a[i-1]-1]
        
print(ans)
from functools import lru_cache
@lru_cache(maxsize=1000000000)
def XOR(n):
    if n == 1:
        return 1
    else:
        return XOR(n-1)^n
    
A,B=map(int,input().split())
if A>1:
    print(XOR(B)^XOR(A-1))
else:
    print(XOR(B))

### FIXED CODE ###

#D問題
A,B = map(int,input().split())
def f(n):
    if n%2 == 0:
        if (n//2)%2 == 0:
            return n
        else:
            return n+1
    else:
        if ((n-1)//2)%2 == 0:
            return 1
        else:
            return 0
        
FB = f(B)
FA = f(A-1)
print(FB^FA)
n = int(input())
s = input()
slimes = list(s)
i = 0
while i < n - 1:
  s = slimes[i]
  if slimes[i + 1]:
    while s == slimes[i + 1]:
      slimes.pop(i + 1)
      n -= 1
  i += 1
print(n)

### FIXED CODE ###

n = int(input())
s = input()

ans = 1
current = s[0]
for i in range(n):
  if current != s[i]:
    ans += 1 
    current = s[i]
print(str(ans))
a = int(input())
b = int(input())
c = a * b
if c%2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")
N=int(input())
A=list(map(int,input().split()) )
import math

se = A[0]
for i in range(1,N):
    se = math.gcd(se,A[i])
set_wise = se==1

NMAX = 10**6+2
divisors = [i for i in range(NMAX+1)]
p=2
while p*p <=NMAX:
    if divisors[p]==p:
        for r in range(2*p,NMAX+1,p):
            if divisors[r]==r:
                divisors[r]=p
    p+=1
    
from collections import defaultdict
def soinsu_osak(to_devide):
    d = defaultdict(int)
    while to_devide>1:
        d[divisors[to_devide]]+=1
        to_devide //= divisors[to_devide]
    return list(d.keys())

been=[0]*NMAX
f=False
for aa in A:
    soinsu = soinsu_osak(aa)
    for s in soinsu:
        if been[s]==0:
            been[s]=1
        else:
            pair_wise=False
            f=True
            break
    if f:
        break

if pair_wise:
    print("pairwise coprime")
elif set_wise:
    print("setwise coprime")
else:
    print("not coprime")

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()) )
import math

se = A[0]
for i in range(1,N):
    se = math.gcd(se,A[i])
set_wise = se==1

NMAX = 10**6+2
divisors = [i for i in range(NMAX+1)]
p=2
while p*p <=NMAX:
    if divisors[p]==p:
        for r in range(2*p,NMAX+1,p):
            if divisors[r]==r:
                divisors[r]=p
    p+=1
    
from collections import defaultdict
def soinsu_osak(to_devide):
    d = defaultdict(int)
    while to_devide>1:
        d[divisors[to_devide]]+=1
        to_devide //= divisors[to_devide]
    return list(d.keys())

been=[0]*NMAX
pair_wise=True
f=False
for aa in A:
    soinsu = soinsu_osak(aa)
    for s in soinsu:
        if been[s]==0:
            been[s]=1
        else:
            pair_wise=False
            f=True
            break
    if f:
        break

if pair_wise:
    print("pairwise coprime")
elif set_wise:
    print("setwise coprime")
else:
    print("not coprime")
n,m = map(int,input().split())
a = [0]*n
b = [0]*n
c = [0]*m
d = [0]*m

for i in range(n):
    a[i],b[i] = map(int,input().split())
for i in range(m):
    c[i],d[i] = map(int,input().split())
    
D = [[0]*m]*n
for i in range(n):
    for j in range(m):
        D[i][j] = abs(a[i]-b[i])+abs(c[i]-d[i])

for i in range(n):
    print(D[i].index(min(D[i]))+1)

### FIXED CODE ###

n,m = map(int,input().split())
a,b = [[] for i in range(n)],[[] for i in range(n)]
c,d = [[] for i in range(m)],[[] for i in range(m)]
for i in range(n):
    a[i],b[i] = map(int,input().split())
for i in range(m):
    c[i],d[i] = map(int,input().split())

check = [[] for i in range(m)]
for i in range(n):
    for j in range(m):
        check[j] = abs(a[i]-c[j])+abs(b[i]-d[j])
    print(check.index(min(check))+1)