Harryxun/stf_run huggingface dataset:
import sys
def input(): return sys.stdin.readline().strip()

def func(n):
    bin_num = bin(n).count("1")
    #print(n% bin_num)
    if n == 0: return 0
    return n % bin_num

def main():
    N = int(input())
    X = input()
    bit_num = X.count("1")

    X_minus = [0] * N
    X_plus = [0] * N
    X_minus[0], X_plus[0] = 1, 1
    rem_minus = int(X[-1])
    rem_plus = int(X[-1])
    for i in range(1, N):
        if bit_num != 1: X_minus[i] = (X_minus[i - 1] * 2) % (bit_num - 1)
        X_plus[i] = (X_plus[i - 1] * 2) % (bit_num + 1)
        if X[-i-1] == "1":
            rem_minus += X_minus[i]
            if bit_num != 1: rem_minus %= bit_num - 1
            rem_plus += X_plus[i]
            rem_plus %= bit_num + 1

    for i in range(N):
        #print("")
        #print("i={}".format(i))
        n = list(X)
        if X[i] == '0':
            n[N - i - 1] = '1'
            bin = bit_num + 1
        if X[i] == '1':
            n[N - i - 1] = '0'
            bin = bit_num - 1
        if bin == bit_num - 1: n = (rem_minus - X_minus[-i-1]) % bin
        if bin == bit_num + 1: n = (rem_plus + X_plus[-i-1]) % bin
        #print("bin={}, n={}".format(bin, n))

        if bin == 0:
            print(0)
            continue
        cnt = 1
        while n != 0:
            n = func(n)
            cnt += 1
        print(cnt)




if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    X = input()
    bit_num = X.count("1")

    X_minus = [0] * N # X_minus[i] = 2^i mod (bit_num - 1)
    X_plus = [0] * N # X_plus[i] = 2^i mod (bit_num + 1)
    X_minus[0], X_plus[0] = 1, 1
    for i in range(1, N):
        if bit_num != 1: X_minus[i] = (X_minus[i - 1] * 2) % (bit_num - 1)
        X_plus[i] = (X_plus[i - 1] * 2) % (bit_num + 1)
    #print("X_minus={}".format(X_minus))
    #print("X_plus={}".format(X_plus))

    rem_minus = 0
    rem_plus = 0
    for i in range(N):
        if X[N-i-1] == '1':
            if bit_num != 1: rem_minus = (rem_minus + X_minus[i]) % (bit_num - 1)
            rem_plus = (rem_plus + X_plus[i]) % (bit_num + 1)
    #print(rem_minus, rem_plus)

    for i in range(N):
        if X[i] == '0':
            bit = bit_num + 1
            n = (rem_plus + X_plus[-i-1]) % bit
        if X[i] == '1':
            bit = bit_num - 1
            if bit != 0: n = (rem_minus - X_minus[-i-1]) % bit
        if bit == 0 or bit == 1:
            print(bit)
            continue

        cnt = 1
        while n != 0:
            bit = bin(n).count("1")
            n %= bit
            cnt += 1
        print(cnt)




if __name__ == "__main__":
    main()
N, K = map(int, input().split())
h = list(map(int, input().split()))e

dp = [1000000000] * N
dp[0] = 0

for i in range(1, N):
    dp[i] = min(dp[i], abs(min(h[max(i-K,0):i]
                              ) - h[i] + dp[i]))

print(dp[N - 1])

### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
h = np.array(list(map(int, input().split())), dtype='int')
dp = np.ones(N, dtype='int') * 1000000000
dp[0] = 0

for i in range(1, N):
    dp[i] = min(dp[max(i-K,0):i] + abs(h[max(i-K,0):i] - h[i]))

print(dp[N - 1])
R = int(input())
if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else:
    print('AGC')


### FIXED CODE ###

S = input()
flg = 0
if S[0] == 'A':
    flg += 1
if S[1].isupper():
    flg += 1000
for i in range(2, len(S)-1):
    if S[i] == 'C':
        flg += 10
    elif S[i].isupper():
        flg += 1000
if S[-1].isupper():
    flg += 1000
if flg == 11:
    print('AC')
else:
    print('WA')
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())
c=a*b
if c%2==0:
  print("Even")
else:
  print("Odd")
def how_many_times_divisibles(j):
	counter=0
	while j%2==0:
		j/=2
		counter+=1
	return counter

n=int(input())
a=map(int,input().split())
ans=min(map(how_many_times_dibishibles,a))

print(ans)

### FIXED CODE ###

import numpy as np

def how_many_times_divisibles(j):
	counter=0
	while j%2==0:
		j/=2
		counter+=1
	return counter

n=int(input())
a=map(int,input().split())
ans=min(map(how_many_times_divisibles,a))
print(ans)
N, K = map(int, input().split())

XY = [tuple(map(int,input().split())) for i in range(N)]

dots = XY[:]

import sys
INT_MAX = sys.maxsize


def sub_f(x):
    right_x, left_x = x[0], x[1]
    ans = INT_MAX
    for ((_, under_y), (_, top_y)) in itertools.combinations(dots, 2):
        if under_y > top_y:
            under_y, top_y = top_y, under_y
        counter = 0
        for d_x, d_y in dots:
            if  (left_x <= d_x) and (d_x <= right_x) and (under_y <= d_y) and (d_y <= top_y):
                counter += 1

        if counter >= K:
            area = (top_y-under_y) * (right_x-left_x)
            ans = min(ans, area)
    return ans

import itertools
multiprocessing_inputs = []
for ((left_x, _), (right_x, _)) in itertools.combinations(dots, 2):
    if left_x > right_x:
        left_x, right_x = right_x, left_x
    
    multiprocessing_inputs.append((right_x, left_x))
    #ans_list.append(sub_f(right_x, left_x))


from multiprocessing import Pool
with Pool(5) as p:
    ans_list = p.map(sub_f, multiprocessing_inputs)

ans = min(ans_list)
print(ans)

### FIXED CODE ###

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

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    
dots = XY[:]

import sys
INT_MAX = sys.maxsize

ans = INT_MAX

import itertools
for ((left_x, _), (right_x, _)) in itertools.combinations(dots, 2):
    if left_x > right_x:
        left_x, right_x = right_x, left_x
    for ((_, under_y), (_, top_y)) in itertools.combinations(dots, 2):
        if under_y > top_y:
            under_y, top_y = top_y, under_y
        counter = 0
        for d_x, d_y in dots:
            if  (left_x <= d_x) and (d_x <= right_x) and (under_y <= d_y) and (d_y <= top_y):
                counter += 1
                
        if counter >= K:
            area = (top_y-under_y) * (right_x-left_x)
            if ans > area:
                ans = area
            
print(ans)
import sys, math
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    x, y = i2(N)

    Mw = max(x[i]+y[i] for i in range(N))
    mw = min(x[i]+y[i] for i in range(N))
    Mz = max(abs(a[i]-y[i]) for i in range(N))
    mz = min(abs(x[i]-y[i]) for i in range(N))

    print(max(Mz-mz, Mw-mw))
    


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys, math
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    x, y = i2(N)

    Mw = max(x[i]+y[i] for i in range(N))
    mw = min(x[i]+y[i] for i in range(N))
    Mz = max(x[i]-y[i] for i in range(N))
    mz = min(x[i]-y[i] for i in range(N))

    print(max(Mz-mz, Mw-mw))
    


if __name__ == '__main__':
    main()
n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[]
  y=[]
  for j in range(a):
    x,y=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
c=0
for i in range(n):
  l=[1]*n
  for j in range(i,n-i):
    if l[j]==0:continue
    for k in range(A[j]):
      b=X[j][k]
      #l[b] *= Y[j][k]

if c < l.count(1):
  c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
"""
the condition is straightforward.
each element of A and B must multiply to the same value.
to minimise the total of B, simply make that value as small
as possible (since A is fixed).

lcm(2, 3, 4) = 12
therefore B is
12/2, 12/3, 12/4
and the sum of B is
12/2 + 12/3 + 12/4

lcd of a list is loop: lcd(partial, new_value)
lcd(a, b) = ab / gcd(a, b)
"""

from fractions import gcd


def lcm(list_ints):
    lcm_ongoing = 1
    for val in list_ints:
        lcm_ongoing = int(round(val*lcm_ongoing/gcd(val, lcm_ongoing)))
    return lcm_ongoing


def flatten(N, A):
    # get lcm
    lcm_of_A = lcm(A)
    # get sum of lcm/values
    ans = sum(int(round(lcm_of_A/value)) for value in A)
    modulo_value = int(int(10e8)+7)
    return ans % modulo_value


if __name__ == "__main__":
    test1 = \
"""3
2 3 4"""
    test2 = \
"""5
12 12 12 12 12"""
    test3 = \
"""3
1000000 999999 999998"""
    test = test3
    # N = int(test.split("\n")[0])
    # A = list(map(int, test.split("\n")[1].split()))
    N = int(input())
    A = list(map(int, input().split()))
    print(flatten(N, A))


### FIXED CODE ###

"""
the condition is straightforward.
each element of A and B must multiply to the same value.
to minimise the total of B, simply make that value as small
as possible (since A is fixed).

lcm(2, 3, 4) = 12
therefore B is
12/2, 12/3, 12/4
and the sum of B is
12/2 + 12/3 + 12/4

lcd of a list is loop: lcd(partial, new_value)
lcd(a, b) = ab / gcd(a, b)
"""

from fractions import gcd


def lcm(list_ints):
    lcm_ongoing = 1
    for val in list_ints:
        lcm_ongoing = val*lcm_ongoing//gcd(val, lcm_ongoing)
    return lcm_ongoing


def flatten(N, A):
    # get lcm
    lcm_of_A = lcm(A)
    # get sum of lcm/values
    ans = sum(lcm_of_A//value for value in A)
    modulo_value = int(int(10e8)+7)
    return ans % modulo_value


if __name__ == "__main__":
    test1 = \
"""3
2 3 4"""
    test2 = \
"""5
12 12 12 12 12"""
    test3 = \
"""3
1000000 999999 999998"""
    test = test3
    # N = int(test.split("\n")[0])
    # A = list(map(int, test.split("\n")[1].split()))
    N = int(input())
    A = list(map(int, input().split()))
    print(flatten(N, A))
s = input()
mm1 = False
mm2 = False

if 0 < int(s[:2]) < 13:
    mm1 = True
if 0 < int(s[-2:]) < 13:
    mm2 = True

if mm1 == True and mm2 == True:
    print("AMBIGUOUS")
    return 
if mm1 == False and mm2 == False:
    print("NA")
    return
if mm1 == True and mm2 == False:
    print("MMYY")
    return
if mm1 == False and mm2 == True:
    print("YYMM")
    return
print("NA")

### FIXED CODE ###

import sys
s = input()
mm1 = False
mm2 = False

if 0 < int(s[:2]) < 13:
    mm1 = True
if 0 < int(s[-2:]) < 13:
    mm2 = True

if mm1 == True and mm2 == True:
    print("AMBIGUOUS")
    sys.exit()
if mm1 == False and mm2 == False:
    print("NA")
    sys.exit()
if mm1 == True and mm2 == False:
    print("MMYY")
    sys.exit()
if mm1 == False and mm2 == True:
    print("YYMM")
    sys.exit()
print("NA")
n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    x, y = map(int, input().split())
    G[x-1].append(y-1)
    G[y-1].append(x-1)
p = 10**9+7
Q = [0]
V = [False for i in range(n)]
C = [[] for i in range(n)]
while Q:
    x = Q.pop()
    V[x] = True
    for y in G[x]:
        if not V[y]:
            C[x].append(y)
            Q.append(y)
DP = [[None, None] for i in range(n)]
def dp(i, c):
    if DP[i][c] != None:
        return DP[i][c]
    tmp = 1
    for j in C[i]:
        if c == 0:
            tmp = (tmp*(dp(j, 0)+dp(j, 1))) % p
        else:
            tmp = (tmp*dp(j, 0)) % p
    DP[i][c] = tmp
    return DP[i][c]
print(dp(0, 0)+dp(0, 1))


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    x, y = map(int, input().split())
    G[x-1].append(y-1)
    G[y-1].append(x-1)
p = 10**9+7
Q = [0]
V = [False for i in range(n)]
C = [[] for i in range(n)]
while Q:
    x = Q.pop()
    V[x] = True
    for y in G[x]:
        if not V[y]:
            C[x].append(y)
            Q.append(y)
DP = [[None, None] for i in range(n)]
def dp(i, c):
    if DP[i][c] != None:
        return DP[i][c]
    tmp = 1
    for j in C[i]:
        if c == 0:
            tmp = (tmp*(dp(j, 0)+dp(j, 1))) % p
        else:
            tmp = (tmp*dp(j, 0)) % p
    DP[i][c] = tmp
    return DP[i][c]
print((dp(0, 0)+dp(0, 1))%p)
s = input()
t = input()
dp = [0]
lcs = ['']
for b in t:
    search_idx = 0
    ncs = lcs.copy()
    for i, curr_idx in enumerate(dp):
        char_idx = s.find(b, search_idx)
        if char_idx == -1:
            break
        next_idx = char_idx + 1
        if next_idx < curr_idx:
            dp[i] = next_idx
            ncs[i] = lcs[i - 1] + b
        search_idx = curr_idx
    else:
        char_idx = s.find(b, search_idx)
        if char_idx > -1:
            dp.append(char_idx + 1)
            ncs.append(lcs[-1] + b)
    lcs = ncs
print(lcs[-1])


### FIXED CODE ###

s = input()
t = input()
dp = [0]
lcs = ['']
for b in t:
    search_idx = 0
    ncs = lcs[:]
    for i, curr_idx in enumerate(dp):
        char_idx = s.find(b, search_idx)
        if char_idx == -1:
            break
        next_idx = char_idx + 1
        if next_idx < curr_idx:
            dp[i] = next_idx
            ncs[i] = lcs[i - 1] + b
        search_idx = curr_idx
    else:
        char_idx = s.find(b, search_idx)
        if char_idx > -1:
            dp.append(char_idx + 1)
            ncs.append(lcs[-1] + b)
    lcs = ncs
print(lcs[-1])
N, M = map(int, input().split())
dp = [0] * N
for _ in range(M):
    a = int(input())
    dp[a-1] = -1

k = 1000000007


for i in range(N):
    if dp[i] == -1:
        dp[i] = 0
        continue
    if i == 0:
        dp[i] = 1
        continue
    if i == 1:
        dp[i] = dp[i-1] + 1
        continue

    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= k



print(n)


### FIXED CODE ###

N, M = map(int, input().split())
dp = [0] * N
for _ in range(M):
    a = int(input())
    dp[a-1] = -1

k = 1000000007


for i in range(N):
    if dp[i] == -1:
        dp[i] = 0
        continue
    if i == 0:
        dp[i] = 1
        continue
    if i == 1:
        dp[i] = dp[i-1] + 1
        continue

    dp[i] = dp[i-1] + dp[i-2]

n = dp[-1] % k

print(n)
n = int(input())
m = n//15
l = n%15
x = 60*(m**2)
y = [0,1,2,0,4,0,0,7,8,0,0,11,0,13,14,0]
for i in range(1,l+1):
    if(y[i] != 0):
        x += y[i]+m*15
print(x)a

### FIXED CODE ###

n = int(input())
m = n//15
l = n%15
x = 60*(m**2)
y = [0,1,2,0,4,0,0,7,8,0,0,11,0,13,14,0]
for i in range(1,l+1):
    if(y[i] != 0):
        x += y[i]+m*15
print(x)
n, x = map(int, input().split())
m = []
sum = 0
for i in range(n):
    a = int(input())
    m.append(a)
    sum += a
m = sorted(m)
#print(m)
x -= sum

#cnt = n
#while x >= m[0]:
#    cnt += 1
#    x -= m[0]
cnt = n + x // m[0]

print(cnt)


### FIXED CODE ###

s = input()
sum = 700
for a in s:
    if a == 'o':
        sum += 100
print(sum)
N = int(input())
A = list(map(int, input().split()))

count = 0

flag = True
while flag:
    flag = False
    for j in range(N-1, 0, -1):
        if A[j] < A[j-1]:
            A[j-1], A[j] = A[j], A[j-1]
            flag = True
            count += 1

print(' '.join(map(str,A)))
print(count)



### FIXED CODE ###

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

count = 0

flag = True
while flag:
    flag = False
    for j in range(N-1, 0, -1):
        if A[j] < A[j-1]:
            A[j-1], A[j] = A[j], A[j-1]
            flag = True
            count += 1

print(' '.join(map(str,A)))
print(count)
r = int(input())

print r**2

### FIXED CODE ###

r = int(input())

print(r**2)
N = int(intput())
l=[]

for i in range(26):
    for j in range(16):
        l.append(i*4+j*7):

if N in l:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = int(input())
l=[]

for i in range(26):
    for j in range(16):
        l.append(i*4+j*7)

if N in l:
    print('Yes')
else:
    print('No')
a,b = map(int,input().split())
x = int(a+b)
y = int(a-b)
z = int(a*b)
l = []
l = l.append(x,y,z)
print(max(l))

### FIXED CODE ###

a,b = map(int,input().split())
x = int(a+b)
y = int(a-b)
z = int(a*b)

l = []
l.append(int(x))
l.append(int(y))
l.append(int(z))
print(max(l))
a,b,c = map(int,input().split())
if(a<=c and x<=a+b):
    print("YES")
else:
    print("NO")

### FIXED CODE ###

a,b,c = map(int,input().split())
if(a<=c and c<=a+b):
    print("YES")
else:
    print("NO")
from collections import Counter
from functools import reduce
n=int(input())
l=[]

for j in range(2,n+1):
  n=j
  for i in range(2,j+1):
    while not n%i:
      l.extend([i])
      n//=i
o=Counter(l)
p=int(1e9+7)
v=reduce(lambda x,y:x*y,map(lambda x:x+1,o.values()))%p
print(v)

### FIXED CODE ###

from collections import Counter
from functools import reduce
n=int(input())
l=[]

for j in range(2,n+1):
  b=j
  for i in range(2,j+1):
    while not b%i:
      l.extend([i])
      b//=i
o=Counter(l)
p=int(1e9+7)
if n!=1:
  v=reduce(lambda x,y:x*y,map(lambda x:x+1,o.values()))%p
else:
  v=1
print(v)
n=int(input())
a=[]
for i in range(n):
  p=int(input())
  a.append(p)

a.sort()
s=p[n-1]//2
print(sum(a)-s)

### FIXED CODE ###

n=int(input())
a=[]
for i in range(n):
  p=int(input())
  a.append(p)

a.sort()
s=a[n-1]//2
print(sum(a)-s)
N, K = map(int, input().split())
input_list = list(map(int,input().split()))
cnt = 0
for i in input_list:
    if i >= K:
        cnt += 1
print(cnt

### FIXED CODE ###

N, K = map(int, input().split())
input_list = list(map(int,input().split()))
cnt = 0
for i in input_list:
    if i >= K:
        cnt += 1
print(cnt)
M,K = list(map(int,input().split()))

if M==0:
    if K==0:
        print("0 0")
    else:
        print(-1)
elif M==1:
    if K==0:
        print("0 0 1 1")
    else:
        print(-1)
else:
    if K==0:
        ans = []
        for i in range(2**M):
            ans.append(i)
            ans.append(i)
        print(*ans)
    elif K<2**M:
        ans = [0,K,0]
        ansc = []
        for i in range(1,2**M):
            if i!=K:
                ansc.append(i)
                
        ans =ans+ansc + [K] + ansb +ansc[::-1]
        
        print(*ans)
    else:
        print(-1)

### FIXED CODE ###


M,K = list(map(int,input().split()))

if M==0:
    if K==0:
        print("0 0")
    else:
        print(-1)
elif M==1:
    if K==0:
        print("0 0 1 1")
    else:
        print(-1)
else:
    if K==0:
        ans = []
        for i in range(2**M):
            ans.append(i)
            ans.append(i)
        #ans = list(map(str,ans))
        print(*ans)
    elif K<2**M:
        ans = [0,K,0]
        ansc = []
        for i in range(1,2**M):
            if i!=K:
                ansc.append(i)
                
        ans =ans+ansc + [K] +ansc[::-1]
        #ans = list(map(str,ans))
        print(*ans)
    else:
        print(-1)
A, B = int(input().split())
if A*B % 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())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

tmp_S = {}
for s in S:
  if(s in tmp_S):
    tmp_S[s] += 1
  else:
    tmp_S[s] = 1
for t in T:
  if(t in tmp_S):
    tmp_S[t] -= 1
print(max(0, tmp_S.values()))

### FIXED CODE ###

N = int(input())
Blue = [input() for _ in range(N)]
M = int(input())
Red = [input() for _ in range(M)]
Blue_dic = {b: Blue.count(b) for b in Blue}
for k, v in Blue_dic.items():
  if(k in Red):
    Blue_dic[k] = v - Red.count(k)
print(max(max(Blue_dic.values()),0))
N = int(input())
 S = str(input())

 white = 0
 black = 0
 first_black_index = 0

 while S[first_black_index] == ".":
   first_black_index += 1
   if first_black_index == N:
     print(0)
     break

 last_black_index = N
 if first_black_index != N:
   while S[last_black_index-1] == "#":
     last_black_index -= 1
     if last_black_index == 0:
       print(0)
       break


 if first_black_index != N and last_black_index != 0:
   S = S[first_black_index:last_black_index]

   for i in range(len(S)):
     if S[i] == "#":
       black +=1
     else:
       white +=1

   print(min(white,black))


### FIXED CODE ###

N = int(input())
S = str(input())

white = S.count(".")
black = 0
ans = S.count(".")

for i in range(N):
  if S[i] == ".":
    white -=1
  else:
    black +=1
  ans = min(ans,white+black)

print(ans)
import sys
 
args = sys.argv
 
length = args[1]
focus = args[2]
abcs = args[3]
 
 
def change_upper_to_lower(str, num):
  if(str[int(num)] == "A"):
    str[int(num)] = "a"
  elif(str[int(num)] == "B"):
    str[int(num)] = "b"
  else:
    str[int(num)] = "c"
    
  return str
 
 
changed_abcs = change_upper_to_lower(abcs, focus)
 
print(changed_abcs)

### FIXED CODE ###

import sys

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

abcs = input()
 
def change_upper_to_lower(str, num):
  
  before = str[:int(num) - 1]
  after = str[int(num):]

  if(str[int(num) - 1] == "A"):
    newstr = before + "a" + after
  elif(str[int(num) - 1] == "B"):
    newstr = before + "b" + after
  else:
    newstr = before + "c" + after
    
  return newstr
 
 
changed_abcs = change_upper_to_lower(abcs, b)
 
print(changed_abcs)
n=int(input())
x=list(map(int,input().split()))
ans=1
for i in x:
    ans=ans*i
    if ans>10**18:
     ans=-1
     break
    elif ans=0
     break
print(ans)

### FIXED CODE ###

n=int(input())
x=list(map(int,input().split()))
ans=1
for i in x:
  if i==0:
    print(0)
    exit()

for i in x:
    ans=ans*i
    if ans>10**18:
      ans=-1
      break
print(ans)
from collections import deque
n = int(input())
d = deque()
for i in range(n):
    line = input().split()
    if len(line) == 2:
        command, ele = line
    else:
        command = line[0]

    if command == 'insert':
        d.appendleft(ele)
    elif command == 'delete':
        d.remove(ele)
    elif command == 'deleteFirst':
        d.popleft()
    elif command == 'deleteLast':
        d.pop()
print(' '.join(list(d)))

### FIXED CODE ###

from collections import deque
n = int(input())
d = deque()

for i in range(n):
    line = input().split()
    if len(line) == 2:
        command, ele = line
    else:
        command = line[0]

    if command == 'insert':
        d.appendleft(ele)
    elif command == 'delete':
        if ele in d:
            d.remove(ele)
    elif command == 'deleteFirst':
        d.popleft()
    elif command == 'deleteLast':
        d.pop()

print(' '.join(list(d)))
def MAP(): return list(map(int,input().split()))

#排他的論理和
def XOR(lst):
    #lst = [000,010,011...] type is str
    lst = sorted(lst,key = lambda x:len(x),reverse = True)
    n = len(lst[0])
    ans = []
    for i in range(1,n+1):
        tmp = 0
        for j in lst:
            if len(j)>=i:
                if j[-i]=="1":
                    tmp+=1
        if tmp%2==0:
            ans.insert(0,"0")
        else:
            ans.insert(0,"1")
    return "".join(ans)

#10進数→2進数
def binary(num):
    lst = []
    while num!=0:
        lst.insert(0,num%2)
        num = num//2
    return "".join(map(str,lst))

#2進数→10進数
def decimal(num):
    ans=0
    for i,x in enumerate(str(num)[::-1]):
        ans += int(x)*2**i
    return ans

A,B = MAP()
if A%2==0:
    lst = [1]*((B-A+1)//2)
else:
    lst = [A] + [1]*((B-A)//2)
if B%2==0:
    lst += [B]
print(decimal(XOR([binary(i) for i in lst])))


### FIXED CODE ###

def MAP(): return list(map(int,input().split()))
def f(x):
    tmp = (x+1)%4
    if tmp==0:
        return 0
    elif tmp==1:
        return x
    elif tmp==2:
        return 1
    else:
        return 1^x
A,B = MAP()
print(f(A-1)^f(B))
x1,y1,x2,y2=map(int,input().split())
d=((x1-x2)**2 + (y1-y2)**2)**(1/2)
print(d)


### FIXED CODE ###

x1,y1,x2,y2=map(float,input().split())
d=((x1-x2)**2 + (y1-y2)**2)**(1/2)
print(d)