Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline
 
N = int(input())
X = list(input().rstrip())
X10 = int('0b'+"".join(X),2)
X10_num1 = X.count('1')
X10_pulse = X10%(X10_num1+1)
X10_ninus = X10%(X10_num1-1)


for i in range(N,0,-1):
    a = X10
    if a>>(i-1) & 1:
        a -= 2**(i-1)
        amari = (X10_ninus - (2**(i-1))%(X10_num1-1))%(X10_num1-1)
        #print(bin(X10),bin(a),X10,a,amari)
    else:
        a += 2**(i-1)
        amari = (X10_pulse + (2**(i-1))%(X10_num1+1))%(X10_num1+1)
        #print(bin(X10),bin(a),X10,a,amari)
    nc = amari
    if a ==0:
        co = 0
    else:
        co = 1
        while nc >0:
            bin_str = bin(nc)
            cou1 = bin_str.count('1')
            nc = nc%cou1
            co +=1
    
    print(co)


### FIXED CODE ###

#AIsing2020 d

def f(n):
        cnt = 0
        while n:
            cnt+= 1
            n = n%bin(n).count('1')
        return cnt

def main():
    N = int(input())
    X = input()
    X10 = int(X,2)
    X10_num1 = X.count('1')
    X10_pulse = X10%(X10_num1+1)
    X10_ninus = X10%(X10_num1-1) if X10_num1 >1 else 0


    for i in range(N,0,-1):
        j = N-i
        if (X[j] == '1') and X10_num1 >1:
            mod = X10_num1-1
            amari = (X10_ninus - pow(2,i-1,mod))%(mod) 
        elif (X[j] == '1') and X10_num1 ==1:
            print(0)
            continue
        else:
            mod = X10_num1+1
            amari = (X10_pulse + pow(2,i-1,mod))%(mod)

        print(1+f(amari))


main()
n,k = list(map(int,input().split()))
S = input()
print(S.replace(S[k], S[k].lower()))

### FIXED CODE ###

n,k = list(map(int,input().split()))
S = input()
print( S[:k-1]+S[k-1].lower()+ S[k:])
from collections import defaultdict

lines = []
while True:
    line = input()
    if line:
        lines.append(line)
    else:
        break

correct = 0
penalty = 0
d = dict()
d = defaultdict(lambda: 0, d)

for line in lines[1:]:
    n = line.split()[0]
    m = line.split()[1]

    if d[n] == -1:
        continue
    if m == "WA":
        d[n] += 1
    else:
        penalty += d[n]
        d[n] = -1
        correct += 1

print(str(correct) + " " + str(penalty))



### FIXED CODE ###

from collections import defaultdict

params = input().split()
n = int(params[0])
m = int(params[1])

penaltyCount = dict()
penaltyCount = defaultdict(lambda: 0, penaltyCount)

correct = 0
penalty = 0

for i in range(m):
    submission = input().split()
    p = int(submission[0]) - 1
    status = submission[1]

    if penaltyCount[p] == -1:
        continue
    if status == "WA":
        penaltyCount[p] += 1
    else:
        penalty += penaltyCount[p]
        penaltyCount[p] = -1
        correct += 1

print(str(correct) + " " + str(penalty))
n,k = [int(i) for i in input().split()]

steps = [int(i) for i in input().split()]
dp = ['inf'] * n

for i in range(1, n):
    start = max(0, i-k)
    dp[i] = (dp[start:i] + abs(steps[i] - steps[start:i])).min()

print(dp[n - 1])

### FIXED CODE ###

import numpy as np
 
 
N, K = map(int, input().split())
inputs = np.array([int(i) for i in input().split()])
 
dp = np.zeros(N, dtype=int)
for i in range(1, N):
    start = max(0, i-K)
    dp[i] = (dp[start:i] + abs(inputs[i] - inputs[start:i])).min()
 
print(dp[-1])
N,M = map(int,input().split())
l=[]
r=[]
for i in range(M):
  a,b=map(int,input().split())
  l.append(a)
  r.append(b)
  
  
ans=min(b)-max(a)+1
print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
L=[]
R=[]
for i in range(m):
  L.append(l[i][0])
  R.append(l[i][1])
print(max(min(R)-max(L)+1,0))
n,m,x=map(int,input().split())
a=[int(input())>x for i in range(m)]
print(sum(a))

### FIXED CODE ###

N, M, X = map(int, input().split())
*A, = map(int, input().split())

print(min(len([x for x in A if x < X]), len([x for x in A if x > X])))
import math
import sys

comb=[0,0,0,1,3,6,10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, 861, 903, 946, 990, 1035, 1081, 1128, 1176, 1225, 1275, 1326, 1378, 1431, 1485, 1540, 1596, 1653, 1711, 1770, 1830, 1891, 1953, 2016, 2080, 2145, 2211, 2278, 2346, 2415, 2485, 2556, 2628, 2701, 2775, 2850, 2926, 3003, 3081, 3160, 3240, 3321, 3403, 3486, 3570, 3655, 3741, 3828, 3916, 4005, 4095, 4186, 4278, 4371, 4465, 4560, 4656, 4753, 4851, 4950]
n=int(input())
k=int(input())
s=str(n)
L=len(s)

ans=0
if n<k:
    ans=0

elif k==1:
    for i in range(L):
        for a in range(1,10):
            if a*(10**i)<=n:
                ans+=1

elif k==2:
    for i in range(1,L):
        for j in range(i):
            for a in range(1,10):
                for b in range(1,10):
                    if a*(10**i)+b*(10**j)<=n: ans+=1


elif k==3 and L<4:
    for a in range(10):
        for b in range(10):
            for c in range(10):
                if a*100+b*10+c<=n: ans+=1

elif k==3 and L>=4:
    a=0
    while True:
        a+=1

    for i in range(L):
        ans+=comb[i]
    ans*=9**3
    ans+=comb[L]* 81 * (int(s[0])-1) #1桁目 1-int(s[0])-1
    if int(s[1])>0:
        ans+=comb[L-1]*81
        ans+=(L-2)*9*(int(s[1])-1)


    m=int(s[2:])

    for i in range(L-1):
        for a in range(1,10):
            if a*(10**i)<=m: ans+=1
                

print(ans)

### FIXED CODE ###

s,t=map(lambda x:x,input().split())
a,b=map(int,input().split())
if input()==s:
    print(a-1,b)
else: print(a,b-1)
i for range(4):
  A, B, C, X = [int(input())]
count = 0
if 500*a + 100*b +50*c == X for a in range(A+1) for b in range(B+1) for c in range(C+1):
  count += 1
print(count)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
print(sum(500*a+100*b+50*c==X for a in range(A+1) for b in range(B+1) for c in range(C+1)))
# -*- coding: utf-8 -*-
import sys

N = input()
S = input()

res = ''
left, right = 0, 0
lit = S.split(')(')
for i, l in enumerate(lit):
    if len(lit) > 1:
        kakko = l + ')' if i % 2 == 0 else '(' + l
    j = 0
    while True:
        if len(kakko)-1 < j:
            break
        if kakko[j] == '(':
            if len(kakko) - 2 > j:
                if kakko[j+1] == ')':
                    res += '()'
                    j += 2
                else:
                    left += 1
                    j += 1
            else:
                left += 1
                j += 1
        else:
            if left != 0:
                left -= 1
            res = '(' + res + ')'
            j += 1
    part = '(' * left + ')' * left
    res  += part
print(res)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys, re

N = input()
S = input()
# pattern = re.compile(r'\)\(')
sentence = ''
left, right = 0, 0
# lit = []
for s in S:
    sentence += s
    if s == '(':
        left += 1
    else:
        right += 1
    if left - right < 0:
        sentence = '(' + sentence
        left += 1
if left - right > 0:
    sentence = sentence + ')' * (left - right)
print(sentence)
from collections import Counter
n, *A = map(int, open(0).read().split())
ans = 0
for k, v in  Counter(A):
  if v % 2 == 1:
    ans += 1
print(ans)

### FIXED CODE ###

from collections import Counter
n, *A = map(int, open(0).read().split())
ans = 0
for v in  Counter(A).values():
  if v % 2 == 1:
    ans += 1
print(ans)
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  t=input()
  if d==1:
    list=[int(t)]
  else:
    list=list(map(int,t.split()))
  lists.append(list)
ans=[0]*n
for list in lists:
  for i in range(1,len(list)+1):
    ans[i-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

### FIXED CODE ###

n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  lis=list(map(int,input().split()))
  lists.append(lis)
ans=[0]*n
for list in lists:
  for i in range(len(list)):
    ans[list[i]-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)
N, K = map(int, input().split())
x = [int(i) for i in input().split()]

time = 10 ** 20
# 0以上の最小の整数
base = 0
index = 0

for i in range(N):
    if x[i] >= 0:
        base = x[i]
        index = i
        break

for i in range(max(0, index - K), index + 1):
    if x[i+K-1] < 0:
        time = min(abs(x[i]) * 2, time)
    elif x[i] < 0 and  x[i+K-1] >= 0:
        time = min(min(abs(x[i]), x[i+K-1]) * 2 + max(abs(x[i]), x[i+K-1]), time)
    else:
        time = min(x[i+K-1] * 2, time)

print(time)

### FIXED CODE ###

# 無駄なところも数えて良いっていう考え方もある。
# 常に最適化しないといけないわけではない

N, K = map(int, input().split())
x = [int(i) for i in input().split()]

time = 10 ** 20

for i in range(N - K + 1):
    x_min = x[i]
    x_max = x[i + K - 1]
    if x_min >= 0:
        this_time = x_max
    elif x_max <= 0:
        this_time = abs(x_min)
    else:
        this_time = x_max - x_min + min(x_max, abs(x_min))

    if time > this_time:
        time = this_time

print(time)
total=s=i=0
try:
 while True:
  a,b = map(int,input().split(','))
  total += a*b
  s+=b
  i+=1
except:
 result=s/i+0.5 
 print(total)
 print(round(result))

### FIXED CODE ###

while True:
 try:
   a,b,c=map(float,input().split(','))
   bmi=b/c**2
   if bmi>=25:
     print(int(a))
 except:
  break
X = int(input())
check =[]
check2=[]
for i in range(1,33):
    for s in range(2,11):
        check.append(pow(i,s))
print(check)

for i in check:
    if i<X:
        check2.append(i)

print(max(check2))


### FIXED CODE ###

X = int(input())
check =[]
check2=[]
for i in range(1,33):
    for s in range(2,11):
        check.append(pow(i,s))

#print(check)
for i in check:
    if i<=X:
        check2.append(i)
print(max(check2))
from functools import *
from itertools import *

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

def gcd(a, b):
    a , b = (a, b) if a > b else (b, a)
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
        pass
    return b

Bs = sorted(As)
x = gcd(Bs[0], Bs[1])
y = gcd(Bs[1], Bs[2])
z = gcd(Bs[2], Bs[0])
w = max(x, y, z)
print(reduce(gcd, chain([w], islice(Bs, 3, None))))



### FIXED CODE ###

import sys
from collections import deque
from functools import *
from itertools import *

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

def gcd(a, b):
    if a == 0 or b == 0:
        return max(a, b)
    a , b = (a, b) if a > b else (b, a)
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
        pass
    return b

def gcd_acc(acc, x):
    if len(acc) == 0:
        acc.append(x)
        return acc
    last = acc[-1]
    acc.append(gcd(last, x))
    return acc

def candidates(As):
    length = len(As)
    L = iter(reduce(gcd_acc, As, deque()))
    R = reversed(reduce(gcd_acc, reversed(As), deque()))
    next(R)

    yield next(R)

    if length == 1:
        return

    for _ in range(length-2):
        yield gcd(next(L), next(R))
        pass
    yield next(L)
    pass

print(max(candidates(As)))
S = input()
slen = len(S)
i = int(0)
j = int(0)
while slen >= i:
	if i%2 == 1 and S[i] == "R","U","D":
		j = 0
	elif i%2 == 0 and S[i] == "L","U","D":
		j = 0
	else:
		j += 1
  i+1
if j == 0:
	print("No")
else:
	print("Yes")

### FIXED CODE ###

S = list(input())
if False not in [i not in "L" for i in S[::2]] and False not in [i not in "R"for i in S[1::2]]:
	print("Yes")
else:
	print("No")
N = int(input())
a_list = list(map(int, input().split()))
Q = int(input())

r = [0] * (10^5)
for a in a_list:
    r[a-1] += a

for i in range(Q):
    b, c = map(int, input().split())
    tmp = r[b-1] // b
    r[b-1] = 0
    r[c-1] += tmp * c
    print(sum(r))

### FIXED CODE ###

from collections import Counter

N = int(input())
a = Counter(map(int, input().split()))
Q = int(input())

sum_a = sum(a.elements())

for i in range(Q):
    b, c = map(int, input().split())
    a[c] += a[b]
    sum_a += (c-b) * a[b]
    a[b] = 0
    print(sum_a)
_,l=map(int,open(0).read().split())
l.sort()
print("YNeos"[::sum(l[:-1])<=l[-1]])

### FIXED CODE ###

_,*l=map(int,open(0).read().split())
l.sort()
print("YNeos"[sum(l[:-1])<=l[-1]::2])
import sys
input = sys.stdin.buffer.readline  # これを使わないとTLEしてしまう
sys.setrecursionlimit(10**7)

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

# 木構造をリストで表現する
graph = [[] for _ in range(N+1)]

for a, b in AB:
    graph[a].append(b)
    graph[b].append(a)

# 各操作で与えられる値を、各頂点ごとに集計しておく
P = [0] * (N+1)
for p, x in PX:
    P[p] += x

Count = [0] * (N+1)


def dfs(v, parent, point):
    # 現在いる頂点vの親までの値をpointとする
    Count[v] = point + p[v]
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x, v, Count[v])


dfs(1, 0, 0)

res = ' '.join(map(str, Count[1:]))
print(res)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

 
N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
 
graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)
 
value = [0] * (N+1)
for p,x in PX:
    value[p] += x
 
def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])
 
dfs(1,0,0)
 
answer = ' '.join(map(str,value[1:]))
print(answer)
n, m = map(int, input().split())

G = [[] for _ in range(m)]
for _ in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    G[u].append(v)
    G[v].append(u)

# print(G)

ans = [-1] * n
d = [10**9] * n
d[0] = 1

ans[0] = 'Yes'
# print(ans)

from collections import deque

q = deque([0])

pos = 0
while q:
    _q = q.popleft()
    # print(ans, q, d)
    for x in G[_q]:
        if ans[x] == -1:
            ans[x] = _q
            q.append(x)
    pos += 1

# print(ans)

if -1 in ans:
    print('No')
else:
    print('Yes')
    for _ans in ans[1:]:
        print(_ans+1)


### FIXED CODE ###

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

G = [[] for _ in range(n)]
for _ in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    G[u].append(v)
    G[v].append(u)

ans = [-1] * n

from collections import deque

q = deque([0])

while q:
    _q = q.popleft()
    for x in G[_q]:
        if ans[x] == -1:
            ans[x] = _q + 1
            q.append(x)

if -1 in ans:
    print('No')
else:
    ans[0] = 'Yes'
    for _ans in ans:
        print(_ans)
N = int(input())
A = list(map(int, input().split()))
 
xor = 0
for i in A:
    A ^= i
 
for j in range(N):
    print(A^a[i], end=' ')


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
xor = 0
for i in A:
    xor ^= i
 
for j in range(N):
    print(xor^A[j], end=' ')
def dfs(v, p, c):
    res[v] = c
    for next in link[v]:
        if next[0] == p:
            continue
        if next[1]:
            dfs(next[0], v, c)
        else:
            dfs(next[0], v, 1-c)


N = int(input())
link = [[] * N for _ in range(N)]
res = [0] * N
for i in range(N-1):
    u, v, w = map(int, input().split())
    link[u-1].append([v-1, w % 2])
    link[v-1].append([u-1, w % 2])

dfs(0, -1, 1)

for i in range(N):
    print(res[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def dfs(v, p, c):
    res[v] = c
    for next in link[v]:
        if next[0] == p:
            continue
        if next[1] % 2:
            dfs(next[0], v, 1-c)
        else:
            dfs(next[0], v, c)


N = int(input())
link = [[] * N for _ in range(N)]
res = [0] * N
for i in range(N-1):
    u, v, w = map(int, input().split())
    link[u-1].append([v-1, w])
    link[v-1].append([u-1, w])

dfs(0, -1, 1)

for i in range(N):
    print(res[i])
import sys
input = sys.stdin.readline

s = input().rstrip()
x, y = [int(x) for x in input().split()]

horizontal = []
vertical = []

switch = 1
distance = 0

for i in range(len(s)):
    if s[i] == "F":
        distance += 1
    elif switch:
        horizontal.append(distance)
        distance = 0
        switch ^= 1
    else:
        vertical.append(distance)
        distance = 0
        switch ^= 1

if switch:
    horizontal.append(distance)
else:
    vertical.append(distance)

dp_x = [[0] * (2 * sum(horizontal) + 1) for _ in range(len(horizontal) + 1)]
dp_y = [[0] * (2 * sum(vertical) + 1) for _ in range(len(vertical) + 1)]

sx = sum(horizontal)
sy = sum(vertical)

if not (-sx <= x <= sx and -sy <= y <= sy):
    print("No")
    exit()

dp_x[0][0 + sx] = 1
dp_y[0][0 + sy] = 1
dp_x[1][horizontal[0] + sx] = 1

for i in range(2, len(horizontal) + 1):
    x_ = horizontal[i - 1]
    for j in range(-sx, sx + 1):
        if -sx <= j - x_ <= sx: 
            dp_x[i][j + sx] = max(dp_x[i][j + sx], dp_x[i - 1][j - x_ + sx])
        if -sx <= j + x_ <= sx:
            dp_x[i][j + sx] = max(dp_x[i][j + sx], dp_x[i - 1][j + x_ + sx])


for i in range(1, len(vertical) + 1):
    y_ = vertical[i - 1]
    for j in range(-sy, sy + 1):
        if -sy <= j - y_ <= sy: 
            dp_y[i][j + sy] = max(dp_y[i][j + sy], dp_y[i - 1][j - y_ + sy])
        if -sy <= j + y_ <= sy:
            dp_y[i][j + sy] = max(dp_y[i][j + sy], dp_y[i - 1][j + y_ + sy])

if x_error == 0:
    dp_x[-1][x + sx] = 1
if y_error == 0:
    dp_y[-1][y + sy] = 1

if dp_x[-1][x + sx] and dp_y[-1][y + sy]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import sys
input = sys.stdin.readline

s = input().rstrip()
x, y = [int(x) for x in input().split()]

horizontal = []
vertical = []

switch = 1
distance = 0

for i in range(len(s)):
    if s[i] == "F":
        distance += 1
    elif switch:
        horizontal.append(distance)
        distance = 0
        switch ^= 1
    else:
        vertical.append(distance)
        distance = 0
        switch ^= 1

if switch:
    horizontal.append(distance)
else:
    vertical.append(distance)

dp_x = [[0] * (2 * sum(horizontal) + 1) for _ in range(len(horizontal) + 1)]
dp_y = [[0] * (2 * sum(vertical) + 1) for _ in range(len(vertical) + 1)]

sx = sum(horizontal)
sy = sum(vertical)

if not (-sx <= x <= sx and -sy <= y <= sy):
    print("No")
    exit()

dp_x[0][0 + sx] = 1
dp_y[0][0 + sy] = 1
dp_x[1][horizontal[0] + sx] = 1

for i in range(2, len(horizontal) + 1):
    x_ = horizontal[i - 1]
    for j in range(-sx, sx + 1):
        if -sx <= j - x_ <= sx: 
            dp_x[i][j + sx] = max(dp_x[i][j + sx], dp_x[i - 1][j - x_ + sx])
        if -sx <= j + x_ <= sx:
            dp_x[i][j + sx] = max(dp_x[i][j + sx], dp_x[i - 1][j + x_ + sx])


for i in range(1, len(vertical) + 1):
    y_ = vertical[i - 1]
    for j in range(-sy, sy + 1):
        if -sy <= j - y_ <= sy: 
            dp_y[i][j + sy] = max(dp_y[i][j + sy], dp_y[i - 1][j - y_ + sy])
        if -sy <= j + y_ <= sy:
            dp_y[i][j + sy] = max(dp_y[i][j + sy], dp_y[i - 1][j + y_ + sy])

if dp_x[-1][x + sx] and dp_y[-1][y + sy]:
    print("Yes")
else:
    print("No")
from collections import deque
n, m = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(m)]

ans = [deque([]) for _ in range(m+10)]
ans2 = [[] for _ in range(m+10)]
for i in range(m):
    s = li[i][0]
    t = li[i][1]

    ans[s].append(t)
    ans[t].append(s)


stack = deque([1])
while stack:
    v = stack[0]

    if ans[v]:
        w = ans[v].popleft()
        if ans2[w] == []:
            ans2[w].append(v)
        stack.append(w)
    else:
        stack.popleft()

print('Yes')
for i in range(2, m+1):
    print(ans2[i][0])

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(m)]

ans = [deque([]) for _ in range(m+10)]
ans2 = [[] for _ in range(m+10)]
for i in range(m):
    s = li[i][0]
    t = li[i][1]

    ans[s].append(t)
    ans[t].append(s)

stack = deque([1])
while stack:
    v = stack[0]

    if ans[v]:
        w = ans[v].popleft()
        if True:
            ans2[w].append(v)
        stack.append(w)
    else:
        stack.popleft()

print('Yes')
for i in range(2, n+1):
    print(ans2[i][0])
n=int(input())
mn=n
for i in range(n):
  if n%i==0:
    j=n//i
    mn=min(mn,i+j)
print(mn)

### FIXED CODE ###

N=int(input())
move=10**12
for n in range(1,int(N**.5)+1):
    if N%n==0:
        move=min(move,N//n+n-2)
print(move)
import bisect

input()
A=sorted([int(i) for i in input().split()])
B=sorted([int(i) for i in input().split()])
C=sorted([int(i) for i in input().split()])

ans=0
for b in B:
  ans+=bisect.bisect_left(A,b)*bisect.bisect_right(C,b

print(ans)

### FIXED CODE ###

import bisect

N=int(input())
A=sorted([int(i) for i in input().split()])
B=sorted([int(i) for i in input().split()])
C=sorted([int(i) for i in input().split()])

ans=0
for b in B:
  ans+=bisect.bisect_left(A,b)*(N-bisect.bisect_right(C,b))

print(ans)
A, B = map(int, input().split())
sum_num = 0

for i in range(2):
    if A >= B:
        sum_num = A
        A -= 1
    else:
        sum_num = B
        B -= 0

print(sum_num):


### FIXED CODE ###

A, B = map(int, input().split(' '))
sum_num = 0

for i in range(2):
    if A >= B:
        sum_num += A
        A -= 1
    else:
        sum_num += B
        B -= 1

print(sum_num)
from collections import deque

def main():
    N = int(input())
    # path = [[] for _ in range(N)]
    path = [[] for _ in range(N-1)]
    ab = []
    ans = {}
    visited = [False] * N
    visited[0] = True
    for _ in range(N-1):
        a, b = map(int, input().split())
        path[a-1].append(b-1)
        # path[b-1].append(a-1)
        ab.append((a-1, b-1))
    
    que = deque([(0, 0)])
    while que:
        k = 1
        pre, c = que.popleft()
        for next_node in path[pre]:
            if visited[next_node]:
                continue
            
            if c == k:
                k += 1
            visited[next_node] = True
            ans[(pre, next_node)] = k
            que.append((next_node, k))
            k += 1
            

    print(max(ans.values()))
    for key in ab:
        print(ans[key])

if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import deque

def main():
    N = int(input())
    path = [[] for _ in range(N)]
    ab = []
    ans = {}
    visited = [False] * N
    visited[0] = True
    for _ in range(N-1):
        a, b = map(int, input().split())
        path[a-1].append(b-1)
        path[b-1].append(a-1)
        # ab.append(str(a-1)+str(b-1))
        ab.append((a-1, b-1))
    
    que = deque([(0, 0)])
    while que:
        # k = 1
        k = 0
        pre, c = que.popleft()
        for next_node in path[pre]:
            if visited[next_node]:
                continue
            k += 1
            if c == k:
                k += 1
            visited[next_node] = True
            # ans[str(pre)+str(next_node)] = k
            ans[(pre, next_node)] = k
            que.append((next_node, k))
            

    print(max(ans.values()))
    for key in ab:
        print(ans[key])

if __name__ == '__main__':
    main()
import numpy as np
import sys
input = sys.stdin.readline


def get_primes(a=10**6):
    table = np.ones(a+1)
    table[:2] = False
    for i in range(2, a):
        table[i+i::i] = False
    primes = np.where(table==True)[0]
    return primes


def main():
    n = int(input())
    A = np.array(input().split(), dtype=np.int64)
    primes = get_primes(A.max())

    if A.max() == 1:
        print("pairwise coprime")

    fact_counts = (A.reshape([1, -1]) % primes.reshape([-1, 1])) == 0

    if count == 1:
        print("pairwise coprime")
    elif count != n:
        print("setwise coprime")
    else:
        print("not coprime")


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = list(map(int, input().split()))

    counts = [0] * (10**6 + 1)
    for a in A:
        counts[a] += 1

    ans = 1
    for i in range(2, 10**6+1):
        co_primes = 0
        for j in range(i, 10**6+1, i):
            co_primes += counts[j]
        if ans < co_primes:
            ans = co_primes

    if ans == 1:
        print("pairwise coprime")
    elif ans < n:
        print("setwise coprime")
    else:
        print("not coprime")


if __name__ == "__main__":
    main()