Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
s = list(map(str, input().rstrip()))

ns = [x for x in s if x != "x"]


def is_palin(s):
    result = []
    for i in range((len(s) + 1) // 2):
        result.append(s[i] == s[- i - 1])
    return all(result)


if not is_palin(ns):
    print(-1)
    sys.exit()

i = 0
cnt = 0
while not is_palin(s):
    if s[i] != s[- i - 1]:
        if s[i] == "x":
            if i == 0:
                s.append("x")
            else:
                s.insert(-i, "x")
        else:
            s.insert(i, "x")
        cnt += 1
    i += 1

print(cnt)

### FIXED CODE ###

import sys
from collections import deque

s = deque(map(str, input().rstrip()))

cnt = 0
while s:
    if s[0] != s[-1]:
        if s[0] != "x" and s[-1] != "x":
            print(-1)
            sys.exit()
        elif s[0] == "x":
            tmp = s.popleft()
        else:
            tmp = s.pop()
        cnt += 1
    elif len(s) <= 1:
        break
    else:
        s.popleft()
        s.pop()

print(cnt)
### BUGGY CODE ###

import sys

N,A,B=map(int,input().split())
H=[]

for i in range(N):
    H.append(input())

L=-1
R=sys.maxsize

while R-L>1:
    MID=int((L+R)/2)
    SUM=0
    for i in range(N):
        Q=float(float(H[i])-float(MID*B)+float(A-B-1))//float(A-B)
        SUM+=max(0,int(Q))

    if SUM>MID:
        L=MID
    else:
        R=MID

print(R)


### FIXED CODE ###

import math

N,A,B=map(int,input().split())
H = [0] * N
H = [int(input()) for i in range(N)]

maxH = max(H)
L=-1
R=math.ceil(maxH / B)

def binary_search(D,U):
    MID=(D+U)//2
    if(MID==D):
        print(U)
    else:
        if sum(math.ceil(max(h-B*MID,0)/(A-B))for h in H)<=MID:
            binary_search(D,MID)
        else:
            binary_search(MID,U)


binary_search(L,R)
### BUGGY CODE ###

import copy

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

for _ in range(N):
    A_list.append(int(input()))

for i, a in enumerate(A_list):
    temp_A_list = copy.copy(A_list)
    temp_A_list.pop(i)
    print(max(temp_A_list))

### FIXED CODE ###

N = int(input())
A_list= []
for _ in range(N):
    A_list.append(int(input()))

sorted_A_list = sorted(A_list, reverse=True)

for a in A_list:
    if a == sorted_A_list[0]:
        ans = sorted_A_list[1]
    else:
        ans = sorted_A_list[0]
    print(ans)
### BUGGY CODE ###

def process():
    global S
    global cnt
    p = 0
    for i in range(len(S)-1):
        if S[i:i+2] == '01' or S[i:i+2] == '10':
            S=S[:i]+S[i+2:]
            p+=2
            
    cnt += p
    if p == 0:
        print(cnt)
    else:
        process()

S = str(input())
cnt = int()
process()


### FIXED CODE ###

from collections import Counter
S = input()
l = list()
for i in S:
    l.append(i)
c = Counter(l)
print(min(c['0'], c['1'])*2)
### BUGGY CODE ###

N, M = map(int, input().split())  # 品物の数、割引券の枚数
A = list(map(int, input().split()))  # 品物の値段
A.sort(reverse=True)
for _ in range(M):
    A[0] = A[0] // 2
    A.sort(reverse=True)
print(str(sum(A)))


### FIXED CODE ###

N, M = map(int, input().split())  # 品物の数、割引券の枚数
A = list(map(int, input().split()))  # 品物の値段
A.sort(reverse=True)
i = 0
for _ in range(M):
    A[i] = A[i] // 2
    if i <= N - 2 and A[i] < A[i + 1] and A[0] < A[i+1]:
        i += 1
    else:
        A.sort(reverse=True)
        i = 0
print(str(sum(A)))
### BUGGY CODE ###

H, N  = map(int, input().split())
dp = [float('inf')] * (H + 1)
dp[0] = 0
for i in range(N):
    a, b = map(int, input().split())
    for j in range(H):
        nj = min(j+a, H)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[H])

### FIXED CODE ###

H, N  = map(int, input().split())
dp = [float('inf')] * (H + 1)
dp[0] = 0
for i in range(N):
    a, b = map(int, input().split())
    for j in range(H):
        nj = min(j+a, H)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[H])
### BUGGY CODE ###

#https://atcoder.jp/contests/keyence2019/tasks/keyence2019_d
#2019-01-13
import sys
P = 10**9 + 7
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort(reverse = 1)
B.sort(reverse = 1)

if A[0] != N*M or B[0] != N*M:
    print(0)
    sys.exit()
for i in range(N-1):
    if A[i] == A[i+1]: 
        print(0)
        sys.exit()
for i in range(M-1):
    if B[i] == B[i+1]:
        print(0)
        sys.exit()

ans = 1
used_tate = []
used_yoko = []
oita = 0
#大きい数字から順番に、おける場所が制限されている。
for number in range(N*M, 0, -1):
    if number in A and number in B:
        used_tate += [1]
        used_yoko += [1]
        oita += 1
    elif number in A and number not in B:
        used_tate += [1]
        ans *= len(used_yoko)
        oita += 1
    elif number not in A and number in B:
        used_yoko += [1]
        ans *= len(used_tate)
        oita += 1
    else:
        ans *= len(used_tate)*len(used_yoko) -oita
        oita += 1 
    ans = ans%P
print(ans)


### FIXED CODE ###

#https://atcoder.jp/contests/keyence2019/tasks/keyence2019_d
#2019-01-13
import sys 
from collections import deque
P = 10**9 + 7
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort(reverse = 1)
B.sort(reverse = 1)
A = deque(A)
B = deque(B)

if A[0] != N*M or B[0] != N*M:
    print(0)
    sys.exit()
for i in range(N-1):
    if A[i] == A[i+1]: 
        print(0)
        sys.exit()
for i in range(M-1):
    if B[i] == B[i+1]:
        print(0)
        sys.exit()

ans = 1
used_tate = []
used_yoko = []
oita = 0

p = A.popleft()
q = B.popleft()
#大きい数字から順番に、おける場所が制限されている。
for number in range(N*M, 0, -1):
    if number == p and number == q:
        used_tate += [1]
        used_yoko += [1]
        oita += 1
        try:
            p = A.popleft()
        except:
            p = 0
        try:
            q = B.popleft()
        except:
            q = 0
    elif number == p and number != q:
        used_tate += [1]
        ans *= len(used_yoko)
        oita += 1
        try:
            p = A.popleft()
        except:
            p = 0
    elif number != p and number == q:
        used_yoko += [1]
        ans *= len(used_tate)
        oita += 1
        try:
            q = B.popleft()
        except:
            q = 0
    else:
        ans *= len(used_tate)*len(used_yoko) - oita
        oita += 1
    ans = ans%P
print(ans)
### BUGGY CODE ###

n = int(input())
V = list(map(int,input().split()))
Vodd = list()
Veven = list()
for x in range(0,n//2):
    Vodd.append(V[2*x])
    Veven.append(V[2*x+1]) 
oddcounts = {x:Vodd.count(x) for x in set(Vodd)}
evencounts = {x:Veven.count(x) for x in set(Veven)}

max_odd = max(oddcounts.items(),key=lambda x:x[1])
max_even = max(evencounts.items(),key=lambda x:x[1])

number = n - max_odd[1] - max_even[1]

if max_odd[0] == max_even[0]:
    if len(oddcounts) == 1:
        a = 0
    else:
        del oddcounts[max_odd[0]]
        max_odd1 = max(oddcounts.items(),key=lambda x:x[1])
        a = max_odd1[1]
    if len(evencounts) == 1:
        b = 0
    else:
        del evencounts[max_even[0]]
        max_even1 = max(oddcounts.items(),key=lambda x:x[1])
        b = max_even1[1]
    number = min(n - a - max_even[1],n - max_odd[1] - b)

print(number)

### FIXED CODE ###

from collections import Counter
n = int(input())
V = list(map(int,input().split()))
Vodd = list()
Veven = list()
for x in range(0,n//2):
    Vodd.append(V[2*x])
    Veven.append(V[2*x+1]) 

oddcounts = Counter(Vodd).most_common(2)
evencounts = Counter(Veven).most_common(2)

number = n - oddcounts[0][1] - evencounts[0][1]

if oddcounts[0][0] == evencounts[0][0]:
    if len(oddcounts) == 1:
        a = 0
    else:
        a = oddcounts[1][1]
    if len(evencounts) == 1:
        b = 0
    else:
        b = evencounts[1][1]
    number = min(n - a - evencounts[0][1],n - oddcounts[0][1] - b)

print(number)
### BUGGY CODE ###

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

    for i in range(n):
        print(A.count(i+1))


if __name__=="__main__":
    main()


### FIXED CODE ###

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

    mem = [0] * n
    for i in range(n-1):
        mem[a[i]-1] += 1

    for i in mem:
        print(i)

if __name__=="__main__":
    main()
### BUGGY CODE ###

import sys

def judge(x):
    print(x)
    sys.stdout.flush()
    ans = str(input())
    if ans == "Vacant":
        exit()
    else:
        return ans

n = int(input())

left = 0
mid = n//2
right = n-1

l = judge(left)
m = judge(mid)
r = judge(right)

while True:
    if ((mid-left)%2 == 0 and l == m) or ((mid-left)%2 == 1 and l != m):
        left = mid + 1
        right -= 1
        mid = (left + right)//2
    else:
        right = mid - 1
        left += 1
        mid = (left + right)//2

### FIXED CODE ###

import sys

def judge(x):
    print(x)
    sys.stdout.flush()
    ans = str(input())
    if ans == "0":
        exit()
    else:
        return ans



n = int(input())
left = 0
mid = n//2
right = n-1

l = judge(left)
m = judge(mid)
r = judge(right)

while True:
    if ((mid-left)%2 == 0 and l == m) or ((mid-right)%2 == 1 and r == m) or ((left-mid)%2 == 1 and l != m) or ((mid-right)% 2 == 0 and r != m):
        left = mid
        mid = (left + right)//2
        l = m
        m = judge(mid)
    else:
        right = mid
        mid = (left + right)//2
        r = m
        m = judge(mid)
### BUGGY CODE ###

import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): #startline-------------------------------------------
    k = int(input())
    ans = 0
    for i in range(1,k+1):
        for j in range(i,k+1):
            for l in range(j,k+1):
                ans += gcd(gcd(i,j),l)*6//math.factorial(4-len(set([i,j,l])))
    print(ans)
if __name__ == "__main__":
    main() #endline===============================================

### FIXED CODE ###

from math import gcd
def main(): #startline-------------------------------------------
    k = int(input())
    ans = 0
    for i in range(1,k+1):
        for j in range(1,k+1):
            for l in range(1,k+1):
                ans += gcd(gcd(i,j),l)

    print(ans)
if __name__ == "__main__":
    main() #endline===============================================
### BUGGY CODE ###

from collections import deque

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

graph = [[] for _ in range(N+1)]
ans = []

for i in range(N):
    graph[i].append(i+1)
    graph[i+1].append(i)
graph[X].append(Y)
graph[Y].append(X)


#print(graph)

for j in range(N):
    dist = [-1] * (N+1)
    #dist[j] = 0
    dist[j+1] = 0

    d = deque()
    d.append(j+1)
    #BFS実行部分
    while d:
        v = d.popleft()
        for i in graph[v]:
            if dist[i] != -1:
                continue
            dist[i] = dist[v] + 1
            d.append(i)
    ans.extend(dist[j+2:])

#print(ans)
for i in range(1, N):
    print(ans.count(i))
#print(*ans, sep="\n")


### FIXED CODE ###

from collections import deque

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

ans_list = [0 for _ in range(N-1)]

for i in range(1, N+1): #1 ～ N start
    for j in range(i+1, N+1): # i+1 ～ N goal
        ans1 = j - i
        ans2 = abs(i-X) + 1 + abs(j-Y)
        ans_list[min(ans1, ans2)-1] += 1
print(*ans_list, sep="\n")
### BUGGY CODE ###

N=int(input())
C=[int(input()) for i in range(N)]
C=[C[i] for i in range(N) if i ==0 or C[i-1]!=C[i]]

import collections
table=collections.defaultdict(list)
N=len(C)
dp=[0]*(N+1)
dp[N]=1
mod=10**9 + 7
for i,x in enumerate(C[::-1]):
  dp[N-1-i]=dp[N-i]
  for y in table[x]:
    dp[N-1-i]+=dp[y+1]
    dp[N-1-i]%=mod
  table[x].append(N-1-i)

print(dp[0])

### FIXED CODE ###

import sys
input=sys.stdin.readline
N=int(input())
C=[int(input())]
for i in range(N-1):
  tmp=int(input())
  if tmp != C[-1]:
    C.append(tmp)
  
import collections
table=collections.defaultdict(int)
N=len(C)
dp=[0]*(N+1)
dp[N]=1
mod=10**9 + 7
for i,x in enumerate(C[::-1]):
  dp[N-1-i]=dp[N-i] + table[x] 
  dp[N-1-i]%=mod
  table[x]+=dp[N-i]
print(dp[0])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():
  n = int(input())
  A = tuple(map(int, input().split()))
  B = tuple(map(int, input().split()))
  def f(n):
    dp = list(range(n+1))
    for a, b in zip(A, B):
      if b <= a:
        continue
      for i in range(n+1):
        if i-a >= 0:
          dp[i] = max(dp[i], dp[i-a]+b)
    return max(dp)
  m = f(n)
  A, B = B, A
  ans = f(m)
  print(ans)

if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
def f(n):
  dp = list(range(n+1))
  for a, b in zip(A, B):
    for i in range(n+1):
      if i-a >= 0:
        dp[i] = max(dp[i], dp[i-a]+b)
  return max(dp)
m = f(n)
A, B = B, A
ans = f(m)
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

class BIT:

    def __init__(self, N):
        self.N = N
        self.bit = [0] * (N+1)

    def add(self, x, a):
        while x <= self.N:
            self.bit[x] += a
            x += x & -x

    def sum(self, x):
        ret = 0
        while x != 0:
            ret += self.bit[x]
            x -= x & -x
        return ret

N, Q = map(int, input().split())
c = list(map(int, input().split()))
rl = [None] * Q
for i in range(Q):
    l, r = map(int, input().split())
    rl[i] = (r, l, i)
rl.sort()
bit = BIT(N+1)
ans = [None] * Q
last_idx = [-1] * (N+1)
j = 0
for r, l, i in rl:
    while j < r:
        if last_idx[c[j]] == -1:
            last_idx[c[j]] = j
        else:
            bit.add(last_idx[c[j]]+1, -1)
            last_idx[c[j]] = j
        bit.add(j+1, 1)
        j += 1
    ans[i] = bit.sum(r) - bit.sum(l-1)
for a in ans:
    print(a)
            

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N, Q = map(int, input().split())
    bit = [0] * (N+1)

    def add(x, a):
        while x <= N:
            bit[x] += a
            x += x & -x

    def sum(x):
        ret = 0
        while x != 0:
            ret += bit[x]
            x -= x & -x
        return ret

    c = list(map(int, input().split()))
    lr = [None] * Q
    for i in range(Q):
        l, r = map(int, input().split())
        lr[i] = (i, l, r)
    lr.sort(key=lambda x: x[2])
    ans = [None] * Q
    last_idx = [-1] * (N+1)
    j = 0
    for i, l, r in lr:
        while j < r:
            if last_idx[c[j]] == -1:
                last_idx[c[j]] = j
            else:
                add(last_idx[c[j]]+1, -1)
                last_idx[c[j]] = j
            add(j+1, 1)
            j += 1
        ans[i] = sum(r) - sum(l-1)
    for a in ans:
        print(a)
            
if __name__ == "__main__":
    main()
### BUGGY CODE ###

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

A.sort()
for i in range(M):
  A[-1] = A[-1] // 2
  A.sort()
  
print(sum(A))

### FIXED CODE ###

import heapq

N, M = map(int, input().split())
A = list(map(lambda x:int(x)*(-1), input().split()))
heapq.heapify(A)

for i in range(M):
  max_value = heapq.heappop(A)*(-1)
  heapq.heappush(A, (max_value//2)*(-1))
  
print((-1)*sum(A))
### BUGGY CODE ###

h, w = map(int,input().split())
s = [list(input()) for i in range(h)]

#障害物がない直線経路を前計算しておく
L = [[0] * w for i in range(h)]
R = [[0] * w for i in range(h)]
U = [[0] * w for i in range(h)]
D = [[0] * w for i in range(h)]

for i in range(h):
    for j in range(w):
        temp_L = s[i][j]
        temp_R = s[i][-(j + 1)]
        temp_U = s[i][j]
        temp_D = s[-(i + 1)][j]

        if temp_L == '#':L[i][j] = 0
        else:
            if j == 0:L[i][j] = 1
            else:L[i][j] = L[i][j - 1] + 1

        if temp_R == '#':R[i][-(j + 1)] = 0
        else:
            if j == 0:R[i][-(j + 1)] = 1
            else:R[i][-(j + 1)] = R[i][-(j + 1) + 1] + 1

        if temp_U == '#':U[i][j] = 0
        else:
            if i == 0:U[i][j] = 1
            else:U[i][j] = U[i - 1][j] + 1

        if temp_D == '#':D[-(i + 1)][j] = 0
        else:
            if i == 0:D[-(i + 1)][j] = 1
            else:D[-(i + 1)][j] = D[-(i + 1) + 1][j] + 1

ans = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':continue
        temp = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
        if ans < temp:ans = temp
print(ans)
#print(L,R,U,D,sep ='\n')

### FIXED CODE ###

h, w = map(int,input().split())
s = [list(input()) for i in range(h)]

L = [[0] * w for i in range(h)]
R = [[0] * w for i in range(h)]
D = [[0] * w for i in range(h)]
U = [[0] * w for i in range(h)]
for i in range(h):
    for j in range(w):
        if j == 0:
            if s[i][j] == '.':
                L[i][j] = 1
            if s[i][- (j + 1)] =='.':
                R[i][- (j + 1)] = 1

        if j != 0:
            if s[i][j] == '.':
                L[i][j] = L[i][j - 1] + 1
            if s[i][- (j + 1)] == '.':
                R[i][- (j + 1)] = R[i][- (j + 1) + 1] + 1

        if i == 0:
            if s[i][j] == '.':
                U[i][j] = 1
            if s[- (i + 1)][j] == '.':
                D[- (i + 1)][j] = 1
        if i != 0:
            if s[i][j] == '.':
                U[i][j] = U[i - 1][j] + 1
            if s[- (i + 1)][j] == '.':
                D[- (i + 1)][j] = D[- (i + 1) + 1][j] + 1
ans = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':continue
        temp = R[i][j] + L[i][j] + D[i][j] + U[i][j] -3
        if ans < temp:ans = temp
        #print(temp)
print(ans)
### BUGGY CODE ###

N = int(input())
for i in range(1,3501):
    h = i
    for j in range(1,3501):
        n = j
        wb = (4*h*n-N*n-N*h)
        if wb > 0:
            w = (N*h*n)/wb
            if w.is_integer() is True:
                print(h,n,int(w))
                exit()


### FIXED CODE ###

N = int(input())
for i in range(1,3501):
    h = i
    for j in range(1,3501):
        n = j
        wb = (4*h*n-N*n-N*h)
        if wb > 0:
            w = (N*h*n)/wb
            if w.is_integer() is True:
                print(h,n,int(w))
                exit()
### BUGGY CODE ###

import math
a,b,c = map(int,input().split())
k = int(input())
ans = 0
while(a >= b):
  b = b**2
  ans += 1
while(b >= c):
  c = c**2
  ans += 1
if(ans <= k):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a, b, c = map(int, input().split())
k = int(input())
ans = 0
while b <= a:
    b *= 2
    ans += 1
while c <= b:
    c *= 2
    ans += 1
print('Yes' if ans <= k else 'No')
### BUGGY CODE ###

from collections import deque

def getInts():
    return [ int(x) for x in input().split() ]

[N] = getInts()
As = getInts()

maxV = max(As)
minV = min(As)

count = 0
for i in range(N):
    r2 = min(i+As[i]+minV, N-1)
    for j in range(r2, N):
        if As[j]+As[i] == abs(i-j):
            count += 1
print(count)

### FIXED CODE ###

def getInts():
    return [ int(x) for x in input().split() ]

[N] = getInts()
As = getInts()
A = {}
for i in range(1, N+1):
    A[i] = As[i-1]

L = {}
R = {}
for i in range(1, N+1):
    if i - A[i] not in L:
        L[i-A[i]] = 1
    else:
        L[i-A[i]] += 1
    if i + A[i] not in R:
        R[i+A[i]] = 1
    else:
        R[i+A[i]] += 1
count = 0
for k in R.keys():
    if k in L:
        count += R[k]*L[k]
print(count)
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
res  = 1
for i in range(n):
    res *= a[i]
if res > 10**18:
    print(-1)
    sys.exit()
print(res)

### FIXED CODE ###

import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
res  = 1
if 0 in a:
    print(0)
    sys.exit()

for i in range(n):
    res *= a[i]
    if res > 10**18:
        print(-1)
        sys.exit()
print(res)
### BUGGY CODE ###

a,b,k = map(int,input().split())
ans = []
for i in range(a,b+1):
    
    if i <= a+k-1 or i >= b-k+1:ans.append(i)
print(*ans)

### FIXED CODE ###

a,b,k = map(int,input().split())
ans = []
for i in range(k):
    if a+i not in ans and a+i <=b:ans.append(a+i)
    if b-i not in ans and b-i >=a:ans.append(b-i)
ans.sort()
print(*ans)
### BUGGY CODE ###

N,M=map(int,input().split())
A=list(map(int,input().split()))
accumA=[]
tmp=0
for i in range(len(A)):
  tmp+=A[i]
  accumA.append(tmp)

accumA=[0]+accumA
cnt=0
for i in range(1,N+1):
  for j in range(i,N+1):
    s=accumA[j]-accumA[i-1]
    if s%M==0:
      cnt+=1

print(cnt)

### FIXED CODE ###

N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[0]
tmp=0
for i in A:
  tmp+=i
  B.append(tmp)

d = {}
for i in B:
  i %= M
  if i not in d:
    d[i] = 0
  d[i] += 1

ans = 0
for i in d.values():
  ans += i*(i-1)//2
print(ans)
### BUGGY CODE ###

n, p = map(int, input().split())
s = list(map(int, list(input())))[::-1]

if 10%p==0:
    result = 0
    for i in range(n):
        if s[i]%p==0:
            result += n-i
else:
    r = [0 for _ in range(p)]
    r[0] = 1
    t = 0
    ten = 1
    for i in range(n):
        t += (s[i]*ten)%p
        t %= p
        ten *= 10
        r[t] += 1
    result = 0
    for i in r:
        result += i*(i-1)//2
print(result)

### FIXED CODE ###

n, p = map(int, input().split())
s = list(map(int, list(input())))[::-1]

if 10%p==0:
    result = 0
    for i in range(n):
        if s[i]%p==0:
            result += n-i
else:
    r = [0 for _ in range(p)]
    r[0] = 1
    t = 0
    ten = 1
    for i in s:
        t = (t+i*ten)%p
        ten = (ten*10)%p
        r[t] += 1
    result = 0
    for i in r:
        result += i*(i-1)//2
print(result)
### BUGGY CODE ###

K,S=map(int,input().split())
x=dict()
ans=0
for i in range(K+1):
    for j in range(K+1):
        if (i+j)>S:
            break
        x=i
        y=j
        z=S-x-y
        if 0<=z:
            if z<=K:
                ans+=1
    
print(ans)

### FIXED CODE ###

K,S=map(int,input().split())
ans=0
for i in range(K+1):
    for j in range(K+1):
        z=S-i-j
        if 0<=z:
            if z<=K:
                ans+=1

print(ans)
### BUGGY CODE ###

S = input()
B = S.count('B')
W = S.count('W')
es = 'W' * W + 'B'* B
cnt = 0
while True:
    if es == S:
        break
    for i in range(len(S) - 1):
        if S[i] == 'B' and S[i + 1] == 'W':
            S = S[0:i] + 'W' + 'B' + S[i + 2:]
            cnt += 1
print(cnt)

### FIXED CODE ###

S = input()
B = S.count('B')
W = S.count('W')
es = 'W' * W + 'B'* B
bf = es.find('B')
blst = [0] * B
for i in range(B):
    blst[i] = bf + i
slst = [0] * B
bindex = 0
for i in range(len(S)):
    if S[i] == 'B':
        slst[bindex] = i
        bindex += 1

ans = 0
for i in range(B):
    ans += blst[i] - slst[i]

print(ans)