Harryxun/stf_run huggingface dataset:
# cards = [input() for _ in range(3)]
dict = {'a':0, 'b':1, 'c':2}
inv = ['A', 'B', 'C']
turn = 'a'
game = True
while game:
    turn = cards[dict[turn]][0]
    cards[dict[turn]] = cards[dict[turn]][1:]
    for i in range(3):
        if cards[i] == '':
            print(inv[i])
            game = False

### FIXED CODE ###

cards = [input() for _ in range(3)]
dict = {'a':0, 'b':1, 'c':2}
inv = ['A', 'B', 'C']
turn = 'a'
game = True
while game:
    if cards[dict[turn]] == '':
        print(inv[dict[turn]])
        game = False
    else:
        next_turn = cards[dict[turn]][0]
        cards[dict[turn]] = cards[dict[turn]][1:]
        turn = next_turn
    # print(turn, cards)
a=list(input())
k=int(input())
al = "abcdefghijklmnopqrstuvwxyz"
alpha2num=lambda x:ord(x)-ord('a')+1
ans=[""]*len(a)

for i in range(len(a)):
    num=alpha2num(a[i])
    need=27-num
    if need==26:
        need=0
    if need<=k and i!=len(a)-1:
        ans[i]="a"
        k-=need
    elif need<=k and i==len(a)-1:
        remain=k%26
        if need<=remain:
            go=remain-need
        ans[-1]=chr(ord("a")+go)
    elif need>k and i!=len(a)-1:
        ans[i]=a[i]
    elif need>k and i==len(a)-1:
        ans[-1]=chr(ord(a[-1])+k)
print(''.join(ans))



### FIXED CODE ###

def need(a):
    if a=="a":
        return 0
    else:
        return 123-ord(a)

s=list(input())
x=int(input())
i=0
while x>0:
    count=need(s[i])
    if x>=count:
        s[i]="a"
        x-=count
    
    if i==len(s)-1:
        s[i]=chr(ord(s[i])+(x%26))
        x=0
    i+=1
print("".join(s))
val = input()

res = val + val ** 2 + val ** 3

print(res.astype(int))

### FIXED CODE ###

val = int(input())

print(val + val **2 + val **3)
print('Yes' if input()[:3] in [str(i)*3 for i in range(0,10)] or input()[1:] in [str(i)*3 for i in range(0,10)] else 'No')

### FIXED CODE ###

n = input()
ans = [str(i)*3 for i in range(0,10)]
print('Yes' if n[:3] in ans or n[1:] in ans else 'No')
N=int(input())
A=list(map(int,input().split()))
cur=A[0]
ans=0
rp=1

for lp in range(N):
 while rp<N and cur & A[rp]==0:
  cur+=A[rp]
  rp+=1
 ans+=rp-lp
 cur-=A[lp]

print(ans)

### FIXED CODE ###

data=input().split()

h=int(data[0])
i=int(data[1])

c=h+i
if h-i>c: c=h-i
if h*i>c: c=h*i

print (c)
int(input())
list=[s]
num=2
while num<=1000000:
  if num%2==0:
    list.append(list[num-2]/2)
  else:
    list.append(list[num-2]*3+1)
  if list[num-1] in list[:num-1]:
    print(num)
    break
  num+=1

### FIXED CODE ###

s=int(input())
list=[s]
num=2
while num<=1000000:
  if list[num-2]%2==0:
    list.append(list[num-2]/2)
  else:
    list.append(list[num-2]*3+1)
  if list[num-1] in list[:num-1]:
    break
  num+=1
print(num)
from fractions import Fraction
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

tmp = []

for i in field:
    tmp.append(abs(i-x))


ans = tmp[0]

for i in range(1,n):
    ans = min(ans,fractions.gcd(ans,tmp[i]))

print(ans)

### FIXED CODE ###

n , x = map(int,input().split())

field = [int(i) for i in input().split()]

diff = list(map(lambda a:abs(a-x),field))

def gcd(x,y):
    # print(x,y)
    if x < y:
        x,y = y,x

    if x % y == 0:
        return y
    else:
        return gcd(y,x%y)

ans = diff[0]


for i in diff[1:]:
    ans = gcd(i,ans)

print(ans)
n,q = map(int, input().split())
s = input()
for i in range(q):
  l,r = map(int,input().split())
  print(s[l-1:r]).cound("AC")

### FIXED CODE ###

n,q = map(int, input().split())
s = input()
c = []
pre = ""
count = 0
for i in range(n):
  if pre == "A" and s[i] == "C":
    count += 1
  pre = s[i]
  c.append(count)
  
for i in range(q):
  l,r = map(int,input().split())
  print(c[r-1]-c[l-1])
N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]

l=[0]*(N+1)
l[0]=1

for i in range(N):
    c=l[i]%1000000007
    if i<=N-2:
        if i not in a:
            l[i+1]+=c
    elif i not in a:
        l[i+1]+=c
        l[i+2]+=c

print(l[N]%1000000007)

### FIXED CODE ###

N,M=map(int,input().split())
a={int(input()) for _ in range(M)}

l=[0]*(N+1)
l[0]=1

for i in range(N):
    c=l[i]%1000000007
    if i>N-2:
        if i not in a:
            l[i+1]+=c
    elif i not in a:
        l[i+1]+=c
        l[i+2]+=c

print(l[N]%1000000007)
s = input()
if len(s) <= 3:
	print('No')
else:
	if s[0] == Y and s[1] == A and s[2] == K and s[3] == I:
		print('Yes')
	else:
		print('No')

### FIXED CODE ###

s = input()
if len(s) <= 3:
	print('No')
else:
	if s[0] == 'Y' and s[1] == 'A' and s[2] == 'K' and s[3] == 'I':
		print('Yes')
	else:
		print('No')
a, b, c = map(int, input().split())
if a = b & a = c:
    print("Yes")
else:
    print("No")

    

### FIXED CODE ###

a, b, c = map(int, input().split())
if a == b & a == c:
    print("Yes")
else:
    print("No")
n = int(input())
for k in range(2,n + 1):
    if k * (k - 1) // 2 == n:
        print("Yes")
        break
    if k * (k - 1) // 2 > n:
        print("No")
        exit()

print(k)
answer = [[] for _ in range(k)]

num = [[i,j] for i in range(k) for j in range(i+1,k)]

for i,st in enumerate(num):
    s,t = st
    answer[s].append(i + 1)
    answer[t].append(i + 1)

for ans in answer:
    print(k-1,*ans)


### FIXED CODE ###

n=int(input())
k=2
while n>=k*(k-1)/2:
    if n==k*(k-1)/2:
        print('Yes')
        print(k)
        a=list([] for i in range(k))
        t=1
        for i in range(0,k):
            for j in range(1,k-i):
                a[i].append(t)
                a[i+j].append(t)
                t+=1
        for i in range(k):
            print(str(k-1)+" "+" ".join(map(str,a[i])))
        exit()
    else:
        k+=1
print('No')
import math
main()

def prime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n % i == 0:
            return False
    return True

def main():
    N = input()
    n = [input() for x in range(N)]
    c = 0

    for i in range(N):
        if prime(n[i]):
            c += 1

    print(c)

### FIXED CODE ###

import math

def main():
    N = input()
    n = [input() for x in range(N)]
    c = 0

    for i in range(N):
        if prime(n[i]):
            c += 1

    print(c)

def prime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n % i == 0:
            return False
    return True

main()
print(int(int(input())num / 3))

### FIXED CODE ###

print(int(int(input()) / 3))
R, G, B, N = map(int,input().split())
ans = 0
for r in range(N//R + 1):
  for g in range((N - r*R)//G + 1):
    if (N - rR - gG) % B == 0:
      ans += 1
print(ans)

### FIXED CODE ###

R, G, B, N = map(int,input().split())
ans = 0
for r in range(N//R + 1):
  for g in range((N - r*R)//G + 1):
    if (N - r*R - g*G) % B == 0:
      ans += 1
print(ans)
from decimal import Desimal
import sys
input = sys.stdin.readline


def main():
    a, b = [Desimal(i) for i in input().split()]
    a = int(a)
    b = int(float(b) * 100)
    ans = a * b // 100
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import decimal
import sys
input = sys.stdin.readline


def main():
    a, b = [decimal.Decimal(i) for i in input().split()]
    ans = a * b
    print(int(ans))


if __name__ == '__main__':
    main()
n = int(input())
x = input()

dp = [0] * (n+1)

for i in range(1,n+1):
    tmp = bin(i).count("1")
    dp[i] = dp[i%tmp] + 1

t = x.count('1')
po = []

for i in range(n):
    t1 = t
    if x[i] == '1':
        t1 -= 1
    else:
        t1 += 1
    po.append(t1)

t21 = 0
t22 = 0

for i in range(n):
    if x[i] == '1':
        t21 += pow(2, (n-i-1), t-1)
        t22 += pow(2, (n-i-1), t+1)
        t21 %= t-1
        t22 %= t+1

for i in range(n):
    if x[i] == '1':
        t3 = t21
    else:
        t3 = t22
    if x[i] == '1':
        t3 -= pow(2, (n-i-1), po[i])
    else:
        t3 += pow(2,(n-i-1), po[i])
    print(dp[t3%po[i]]+1)


### FIXED CODE ###

n = int(input())
x = input()

dp = [0] * (n+1)

for i in range(1,n+1):
    tmp = bin(i).count("1")
    dp[i] = dp[i%tmp] + 1

t = x.count('1')
po = []

for i in range(n):
    t1 = t
    if x[i] == '1':
        t1 -= 1
    else:
        t1 += 1
    po.append(t1)

t21 = 0
t22 = 0

for i in range(n):
    if x[i] == '1':
        if t > 1:
            t21 += pow(2, (n-i-1), t-1)
            t22 += pow(2, (n-i-1), t+1)
            t21 %= t-1
            t22 %= t+1
        else:
            t22 += pow(2, (n-i-1), t+1)
            t22 %= t+1

for i in range(n):
    if x[i] == '1':
        t3 = t21
    else:
        t3 = t22
    if po[i] == 0:
        print(0)
    else:
        if x[i] == '1':

            t3 -= pow(2, (n-i-1), po[i])
        else:
            t3 += pow(2,(n-i-1), po[i])
        print(dp[t3%po[i]]+1)
a, b, k = map(int, input().split())

tmp = list(range(a, b+1))
for a in sorted(list(set(tmp[:k] + tmp[-k:]))):
    print(a)


### FIXED CODE ###

A, B, K = map(int, input().split())

a_list = list(range(A, min(B, A+K)))
b_list = list(range(max(A, B-K+1), B+1))
for i in sorted(list(set(a_list + b_list))):
    print(i)
X=input()
if X>=400 and X<=599:
  print('8')
if X>=600 and X<=799:
  print('7')
if X>=800 and X<=999:
  print('6')
if X>=1000 and X<=1199:
  print('5')
if X>=1200 and X<=1399:
  print('4')
if X>=1400 and X<=1599:
  print('3')
if X>=1600 and X<=1799:
  print('2')
if X>=1800 and X<=1999:
  print('1')

### FIXED CODE ###

X=int(input())
if X>=400 and X<=599:
  print('8')
if X>=600 and X<=799:
  print('7')
if X>=800 and X<=999:
  print('6')
if X>=1000 and X<=1199:
  print('5')
if X>=1200 and X<=1399:
  print('4')
if X>=1400 and X<=1599:
  print('3')
if X>=1600 and X<=1799:
  print('2')
if X>=1800 and X<=1999:
  print('1')
import sys
sys.setrecursionlimit(2 * 10**5)
def input():
    return sys.stdin.readline()


n, q = map(int, input().split())
GRAPH = [[] for _ in range(n + 1)]
COUNTS = [0] * (n + 1)

for _ in range(n - 1):
    a, b = map(int, input().split())
    GRAPH[a].append(b)
    GRAPH[b].append(a)

for _ in range(q):
    p, x = map(int, input().split())
    COUNTS[p] += x

def dfs(now, prev):
    for vertex in GRAPH[now]:
        if vertex == prev:
            continue
        else:
            next = vertex
        COUNTS[next] += COUNTS[now]
        dfs(next, now)
dfs(1, 0)

answer = " ".join(map(str, COUNTS[1:]))
print(answer)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
def input():
    return sys.stdin.readline()


n, q = map(int, input().split())
GRAPH = [[] for _ in range(n + 1)]
COUNTS = [0] * (n + 1)

for _ in range(n - 1):
    a, b = map(int, input().split())
    GRAPH[a].append(b)
    GRAPH[b].append(a)

for _ in range(q):
    p, x = map(int, input().split())
    COUNTS[p] += x

def dfs(now, prev):
    for vertex in GRAPH[now]:
        if vertex == prev:
            continue
        else:
            next = vertex
        COUNTS[next] += COUNTS[now]
        dfs(next, now)
dfs(1, 0)

answer = " ".join(map(str, COUNTS[1:]))
print(answer)
# using dp with memoization, TLE
from sys import stdin
N, W = map(int, input().split())
m = stdin.read().splitlines()
s = [[int(i) for i in line.split()] for line in m]

dp = [0] * (W + 1)

for n in range(1, N + 1):
    for w in range(W, w - 1, -1):

        dp[w] = max(dp[w], dp[w - s[n - 1][0]] + s[n - 1][1])

print(dp[W])


### FIXED CODE ###

# using dp with memoization, TLE
from sys import stdin
N, W = map(int, input().split())
m = stdin.read().splitlines()
s = [[int(i) for i in line.split()] for line in m]

dp = [[0] * (W + 1) for _ in range(N + 1)]
dp[0][0] = 0

for n in range(1, N + 1):
    for w in range(0, W + 1):
        if w == 0:
            dp[n][0] = 0
            continue
        if w < s[n - 1][0]:
            dp[n][w] = dp[n - 1][w]
        else:
            dp[n][w] = max(dp[n - 1][w],
                           dp[n - 1][w - s[n - 1][0]] + s[n - 1][1])

print(dp[N][W])
N, M, K = map(int, input().split())

DIV = 10**9+7

def comb(l, r):
    if l == 0:
        return 1
    val = 1
    for i in range(r, r-l, -1):
        val *= i
    for i in range(l, 0, -1):
        val /= i
    return val

def calc_rec_num(N, M, xi, xj, yi, yj):
    cnt = 0
    cnt += N - yi
    cnt += M - yj
    # rotate
    cnt *= 2
    return cnt


p = comb(K-2, N*M-2)
ans = 0
for i in range(N):
    for j in range(M):
        if i == 0 and j == 0:
            continue
        d = i+j
        ans += d * calc_rec_num(N, M, 0, 0, i, j) * p

print(ans % DIV)


### FIXED CODE ###

from math import factorial
N, M, K = map(int, input().split())

MOD = 10**9+7

fact = [1] * (N*M+1)
for i in range(2, N*M+1):
    fact[i] = fact[i-1] * i % MOD

def comb(n, r):
    r = n-r if n-r < r else r
    return fact[n] * pow(fact[r], MOD-2, MOD) * pow(fact[n-r], MOD-2, MOD) % MOD

p = comb(N*M-2, K-2)
ans = 0
for i in range(N):
    for j in range(M):
        if i == 0 and j == 0:
            continue
        d = i+j
        cnt = (N-i) * (M-j)
        if i != 0 and j != 0:
            cnt *= 2
        ans += d * cnt % MOD
ans = ans * p % MOD

print(ans)
import sys
input = sys.stdin.readline
A,B,K = [int(i) for i in input().split()]
d = B - A + 1
li = [0] * d
count = 0
for i in range(d) :
    li[i] = A + count
    count+=1
if d > 2 * K + 1 :
    lia = [0] * 2 * K
    for i in range(K) :
        lia[i] = li[i]
    counta = 0
    for i in range(K,2 * K) :
        lia[i] = li[-K+counta]
        counta += 1
    for i in range(2 * K) :
        print(lia[i])
else :
    for i in range(d) :
        print(li[i])

### FIXED CODE ###

A,B,K = map(int,input().split())
if (2*K)<(B-A+2):
  for i in range(A,A+K):
    print(i)
  for i in range(B-K+1,B+1):
    print(i)
else:
  for i in range(A,B+1):
    print(i)
import math
N = int(input())
for i in range(N):
  if int(math.floor(i*1.08)) == N:
    print(i)
    return
print(-1)

### FIXED CODE ###

import math
N = int(input())
f = False
for i in range(N+1):
    if math.floor(i * 1.08) == N:
        print(i)
        f = True
        break
if not f:
    print(':(')
n = int(raw_input())
minv =  10**9
maxv = (-1)*10**9

  for j in range(0, n-1):
    if minv >= R[j]:
       minv = R[j]
    if maxv <= R[i+1] - minv:
       maxv = R[i+1] - minv
print maxv

### FIXED CODE ###

n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9  

for j in range(n-1):
    a = int(raw_input())
    b = a- minv
    if maxv < b:
       maxv = b 
    if minv > a:
       minv = a

print maxv
s = str(input())

if s[-1] == s[0]:
  if len(S)%2 == 0:
    print("First")
  else:
    print("Second")
  

else:
  if len(S)%2 == 1:
    print("First")
  else:
    print("Second")

### FIXED CODE ###

s = str(input())

if s[-1] == s[0]:
  if len(s)%2 == 0:
    print("First")
  else:
    print("Second")
  

else:
  if len(s)%2 == 1:
    print("First")
  else:
    print("Second")
txt = input()
cands = ["dream", "dreamer", "erase", "eraser"]

success = True
while len(txt) > 0:
    flag = False

    for cand in cands:
        subtxt = txt[len(txt) - len(cand):]
        if subtxt == cand:
            txt = txt[:len(txt) - len(cand)]
            flag = True
            print(txt)
            break

    if not flag:
        success = False
        break

if success:
    print("YES")
else:
    print("No")

### FIXED CODE ###

txt = input()
cands = ["dream", "dreamer", "erase", "eraser"]

success = True
while len(txt) > 0:
    flag = False

    for cand in cands:
        subtxt = txt[len(txt) - len(cand):]
        if subtxt == cand:
            txt = txt[:len(txt) - len(cand)]
            flag = True
            break

    if not flag:
        success = False
        break

if success:
    print("YES")
else:
    print("NO")
N = int(input())
T = [int(input()) for i in range(N)]
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(T))

### FIXED CODE ###

N = int(input())
a = [int(input()) for i in range(N)]
import fractions
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)
import math
x, y = map(int, input().split())
def func(x, y):
    return (x * y) / math.gcd(x, y)

print(int(func(x, y)))

### FIXED CODE ###

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

print(lcm(a,b))
hile True:
    try:
        line=input()

    except:
        break

    a,b,c,d,e,f=map(int, line.strip().split())

   
    
    y=(c*d-f*a)/(b*d-a*e)
    x=(c*e-f*b)/(a*e-b*d)

    if x<=0 and x>=-0.0005:
        x=0
    
    if y<=0 and y>=-0.0005:
        y=0
        
    print('{:.3f} {:.3f}'.format(x,y))
    
    

### FIXED CODE ###

while True:
    try:
        line=input()

    except:
        break

    a,b,c,d,e,f=map(int, line.strip().split())

   
    
    y=(c*d-f*a)/(b*d-a*e)
    x=(c*e-f*b)/(a*e-b*d)

    if x<=0 and x>=-0.0005:
        x=0.000
    
    if y<=0 and y>=-0.0005:
        y=0.000
        
    print('{:.3f} {:.3f}'.format(x,y))
import sys
sys.setrecursionlimit(1000000)
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = [ai // 2 for ai in a]
b.sort()
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
def lcm(a, b):
    return a * b // gcd(a, b)
LCM = lcm(b[0], b[1])
for bi in b:
    LCM = lcm(LCM, bi)
if LCM % 2:
    print(((m // LCM) + 1) // 2)
else:
    print(0)


### FIXED CODE ###

import fractions
n, m = map(int, input().split())
a = list(map(int, input().split()))

k = 0
while True:
    if a[0] % 2:
        break
    a[0] = a[0] // 2
    k += 1
base = 2 ** k

f = 0
for i in range(1,n):
    if a[i] % base:
        f = 1
        break
    a[i] = a[i] // base
    if a[i] % 2 == 0:
        f = 1
        break
if f:
    print(0)
else:
    LCM = a[0]
    for ai in a:
        LCM = LCM * ai // fractions.gcd(LCM, ai)
    LCM *= base // 2
    print(((m // LCM) + 1) // 2)
import sys, os, re
from pprint import pprint
from math import sin, cos, sqrt, radians

n, m = list(map(int, sys.stdin.readline().strip().split()))
g = [[] for x in range(n)]

for i in range(n):
    x, y = list(map(int, sys.stdin.readline().strip().split()))
    x -= 1
    y -= 1
ans = {0: -1}

while len(ans) < n:
    flag = False
    for k, v in ans.items():
        for node in g[k]:
            if node not in ans:
                ans[node] = k
                flag = True
    if flag == False:
        break

print("Yes")
for i in range(1, n):
    print(ans[i]+1)

### FIXED CODE ###


import sys, os, re
from pprint import pprint
from math import sin, cos, sqrt, radians

n, m = list(map(int, sys.stdin.readline().strip().split()))
g = [[] for x in range(n)]

for i in range(m):
    x, y = map(int, sys.stdin.readline().strip().split())
    x -= 1
    y -= 1
    g[x].append(y)
    g[y].append(x)

if [] in g:
    print("No")
    exit(0)

ans = {0: -1}
tmp = [0]

while len(ans) < n:
    tmp_next = []
    for k in tmp:
        for node in g[k]:
            if node not in ans:
                ans[node] = k
                tmp_next.append(node) 
                flag = True

        tmp = tmp_next
        if flag == False:
            break

    """
    flag = False    
    for k, v in list(ans.items()):
        for node in g[k]:
            if node not in ans:
                ans[node] = k
                flag = True
    if flag == False:
        break
    """

print("Yes")
for i in range(1, n):
    print(ans[i]+1)
x, n = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
notP = [i for i in range(1, 101) if i not in P]

ans = notP[0]
min_delta = abs(x - ans)

for p in notP:
  delta = abs(x - p)
  if delta<min_delta:
    ans = p
    min_delta = abs(x - ans)
    
print(ans)


### FIXED CODE ###

x, n = map(int, input().split())

import sys

if n==0:
  print(x)
  sys.exit()
  
P = list(map(int, input().split()))
P.sort()
notP = [i for i in range(0, 102) if i not in P]

ans = notP[0]
min_delta = abs(x - ans)

for p in notP:
  delta = abs(x - p)
  if delta<min_delta:
    ans = p
    min_delta = abs(x - ans)
    
print(ans)
A, B, K = map(int, input().split())
cnt = 0
ans = 0
for i in range(max(A, B)):
  if (A % i == 0 and B % i == 0):
    cnt += 1
  if cnt == K:
    print(i)
    exit()

### FIXED CODE ###

A, B, K = map(int, input().split())
AB = [A, B]
L = list()
for i in range(1,min(AB)+1):
  if A % i == 0 and B % i == 0:
    L.append(i)
print(L[len(L)-K])
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list()
for benefit, cost in a, b:
  if benefit - cost > 0:
    c.append(benefit - cost)
print(sum(c))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list()
for benefit, cost in zip(a, b):
  if benefit - cost > 0:
    c.append(benefit - cost)
print(sum(c))
A,B = map(float,input().split())
print(int(((A)*100(B)*100))/10000)

### FIXED CODE ###

a , b = input() . split()
c = int(a) *int(b)
print(c)
N, M, Q = list(map(int, input().split()))
a = []
b = []
c = []
d = []
dd = 0
for i in range(Q):
    t = list(map(int, input().split()))
    a.append(t[0])
    b.append(t[1])
    c.append(t[2])
    d.append(t[3])
    if t[1] - t[0] == t[3]:
        dd += t[4]

print(dd)
    

### FIXED CODE ###

from itertools import *
n, m, q = map(int, input().split())

aaa = []
for i in range(1, m+1):
    aaa.append(i)
l = []
for i in range(q):
    a = list(map(int, input().split()))
    l.append(a)
    
a = list(combinations_with_replacement(aaa, n))
ans = 0

for i in a:
    aa = 0
    for j in l:
        if i[j[1]-1] - i[j[0]-1] == j[2]:
            aa+=j[3]
        if aa > ans:
            ans = aa
print(ans)
max = max(x)
for i in range(max):
    if x[i] == 0:
        break
    else:
        print("Case {0}: {1}".format(i+1, x[i]))


### FIXED CODE ###

num = 1
while True:
    x = int(input())
    if x == 0: break
    print ("Case {0}: {1}".format(num,x))
    num += 1
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline

def main(N, DATA):
    dp = [[0 for _ in range(3)] for _ in range(N + 1)]

    for i in range(N):
        for j in range(3):
            for k in range(3):
                if j == k:
                    continue
                dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + DATA[i][k])

    res = 0

    for v in range(3):
        res = max(res, dp[N][v])

    return res


if __name__ == '__main__':
    N = int(input())
    DATA = [map(int, input().split()) for i in range(N)]
    r = main(N, DATA)
    print(r)


### FIXED CODE ###

import sys

input = sys.stdin.readline

vacation = int(input())
lst_happiness = [list(map(int, input().split())) for i in range(vacation)]

dp = [[0 for i in range(3)] for j in range(vacation+1)]
def chmax(a, b):
    if a > b:
        return a
    else:
        return b

for i in range(vacation):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i+1][k] = chmax(dp[i+1][k], dp[i][j] + lst_happiness[i][k])
ans = 0
for i in range(3):
    ans = chmax(ans, dp[vacation][i])
print(ans)
W,H,x,y = input().split()
W = int(W)
H = int(H)
x = int(x)
y = int(y)

if W/2 > x:
  sq1 = x * H
else:
  sq1 = (W-x) * H
  
if H/2 > y:
  sq2 = y * W
else:
  sq2 = (H-y) * W
if sq1 == sq2:
  print("{} 1".format(sq1))
elif sq1 > sq2:
  #print("{} 0".format(sq1))
#else:
 # print("{} 0".format(sq2))



### FIXED CODE ###

W,H,x,y = input().split()
W =float(W)
H = float(H)
x = float(x)
y = float(y)
sq = W*H/2
if x == W/2 and y == H/2:
  print("{} 1".format(sq))
else:
  print("{} 0".format(sq))
#include <iostream>
using namespace std;

int main()
{
    long long A, B;
    cin >> A >> B;
    long long ans = A;
    for (long long i = A + 1; i <= B; i++)
    {
        ans ^= i;
    }
    cout << ans << endl;
}

### FIXED CODE ###

A, B = map(int, input().split())


def xor(n):
    m = 0
    if n % 4 == 0:
        m = n
    elif n % 4 == 1:
        m = 1
    elif n % 4 == 2:
        m = n + 1
    return m


p = xor(A-1)
q = xor(B)
print(p ^ q)