Harryxun/stf_run huggingface dataset:
A, B, H, M = input().split()

def get_point(radians_theta, r):
    # 0° -> x:0, y=r とみなす
    # radians_theta 0 ~ 360
    x = r * math.sin(math.radians(radians_theta))
    y = r * math.cos(math.radians(radians_theta))
    return x, y

def calc_rad_big_hand(H, M):
    # 長針
    return H * 30 + M / 2

def calc_rad_little_hand(M):
    # 短針
    return M * 6

def calc_result(A,B,H,M):
    H = int(H)
    M = int(M)
    big_hand_rad = calc_rad_big_hand(H, M)
    little_hand_rad = calc_rad_little_hand(M)
    big_x, big_y = get_point(big_hand_rad, A)
    little_x, little_y = get_point(little_hand_rad, B)
    return math.sqrt((big_x - little_x)**2 + (big_y-little_y)**2)
  
print(calc_result(A,B,H,M))

### FIXED CODE ###

import math

A, B, H, M = input().split()
# print(A, B, H, M)

def get_point(radians_theta, r):
    # 0° -> x:0, y=r とみなす
    # radians_theta 0 ~ 360
    # print(radians_theta, r)
    x = r * math.sin(math.radians(radians_theta))
    y = r * math.cos(math.radians(radians_theta))
    return x, y

def calc_rad_big_hand(H, M):
    # 長針
    return H * 30 + M / 2

def calc_rad_little_hand(M):
    # 短針
    return M * 6

def calc_result(A,B,H,M):
    H = int(H)
    M = int(M)
    A = int(A)
    B = int(B)
    big_hand_rad = calc_rad_big_hand(H, M)
    little_hand_rad = calc_rad_little_hand(M)
    big_x, big_y = get_point(big_hand_rad, A)
    little_x, little_y = get_point(little_hand_rad, B)
    return math.sqrt((big_x - little_x)**2 + (big_y-little_y)**2)

print(calc_result(A,B,H,M))
n,m = list(map(int,input().split()))
locations = list(map(int,input().split()))
locations = sorted(locations)
distance = list()

if m == 1:
    print(0)
else:
    for i in range(len(locations) - 1):
        distance.append(locations[i+1] - locations[i])
    
    distance = sorted(distance)

    if n != 1:
        for i in range(n-1):
            distance.pop()
    
    print(sum(distance))

### FIXED CODE ###

n,m = list(map(int,input().split()))
locations = list(map(int,input().split()))
locations = sorted(locations)
distance = list()

if n >= m:
    print(0)
else:
    for i in range(len(locations) - 1):
        distance.append(locations[i+1] - locations[i])
    
    distance = sorted(distance)

    if n != 1:
        for i in range(n-1):
            distance.pop()
    
    print(sum(distance))
import networkx as nx

import io
import os


input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
N, D = [int(x) for x in input().split()]
XY = [[int(x) for x in input().split()] for i in range(N)]


graph = nx.DiGraph()


# a_i = 0 means choose x, a_i = 1 means choose y
# Store i for a_i==0 and i+N for a_i==1
for i, (x1, y1) in enumerate(XY):
    for j in range(N):
        if i != j:
            x2, y2 = XY[j]
            if abs(x1 - x2) < D:
                # a_i==0 => a_j==1
                graph.add_edge(i, j + N)
            if abs(x1 - y2) < D:
                # a_i==0 => a_j==0
                graph.add_edge(i, j)
            if abs(y1 - x2) < D:
                # a_i==1 => a_j==1
                graph.add_edge(i + N, j + N)
            if abs(y1 - y2) < D:
                # a_i==1 => a_j==0
                graph.add_edge(i + N, j)


SCC = nx.algorithms.components.strongly_connected_components(graph)
assignment = {}
for comp in SCC:
    for x in comp:
        if (x < N and x + N in comp) or (x >= N and x - N in comp):
            print("No")
            exit()
        if x not in assignment:
            assignment[x] = True
            assignment[(x + N) % (2 * N)] = False
print("Yes")
for i in range(N):
    print(XY[i][0] if assignment[i] else XY[i][1])


### FIXED CODE ###

import networkx as nx

import io
import os


input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
N, D = [int(x) for x in input().split()]
XY = [[int(x) for x in input().split()] for i in range(N)]

graph = nx.DiGraph()
for i in range(2 * N):
    graph.add_node(i)

# f_i = 0 means choose x for flag i, f_i = 1 means choose y
# Node i is (f_i==0), node (i+N) is (f_i==1)
for i, (x1, y1) in enumerate(XY):
    for j in range(N):
        if i != j:
            x2, y2 = XY[j]
            if abs(x1 - x2) < D:
                # f_i==0 => f_j==1
                graph.add_edge(i, j + N)
            if abs(x1 - y2) < D:
                # f_i==0 => f_j==0
                graph.add_edge(i, j)
            if abs(y1 - x2) < D:
                # f_i==1 => f_j==1
                graph.add_edge(i + N, j + N)
            if abs(y1 - y2) < D:
                # f_i==1 => f_j==0
                graph.add_edge(i + N, j)


SCC = nx.algorithms.components.strongly_connected_components(graph)
assignment = {}
for comp in SCC:
    for x in comp:
        if (x < N and x + N in comp) or (x >= N and x - N in comp):
            print("No")
            exit()
        if x not in assignment:
            assignment[x] = True
            assignment[(x + N) % (2 * N)] = False

print("Yes")
for i in range(N):
    print(XY[i][0] if assignment[i] else XY[i][1])
n = int(input())
t = [int(input()) for i in range(n)]

def gcd(a, b):
  if a<b:
    a, b = b, a
  if b==0:
    return a
  return gcd(b, a%b)

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

ans = 1
for i in range(n):
  ans = lcm(ans, t[i])
print(int(ans))

### FIXED CODE ###

n = int(input())
t = [int(input()) for i in range(n)]

def gcd(a, b):
  if a<b:
    a, b = b, a
  if b==0:
    return a
  return gcd(b, a%b)

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

ans = 1
for i in range(n):
  ans = lcm(ans, t[i])
print(ans)
#coding:utf-8

def funuke():
    N = input()
    strs = []
    for n in range(N):
        input_lines = input()
        strs.append(list(input_lines))
    result = strs[0]
    for n in range(1,N):
        result = duplicate(result, strs[n])
    result.sort()
    print("".join(result))

def duplicate(xs,ys):
    result = []
    for x in xs:
        if x in ys:
            result.append(x)
            ys.remove(x)
    return result


if __name__=="__main__":
    funuke()

### FIXED CODE ###

def funuke():                                   
    N = int(raw_input())                        
    strs = []                                   
    for n in range(N):                          
        input_lines = raw_input()               
        strs.append(list(input_lines))          
    result = strs[0]                            
    for n in range(1,N):                        
        result = duplicate(result, strs[n])     
    result.sort()                               
    print("".join(result))                      
                                                
def duplicate(xs,ys):                           
    result = []                                 
    for x in xs:                                
        if x in ys:                             
            result.append(x)                    
            ys.remove(x)                        
    return result                               
                                                
                                                
if __name__=="__main__":                        
    funuke()
from string import ascii_lowercase
from functools import lru_cache
n = int(input())

@lru_cache
def make(n):
    if n == 1:
        return ['a']
    else:
        lst = []
        for s in make(n-1):
            for c in ascii_lowercase[:len(set(s))+1]:
                lst.append(s + c)
        return lst
for s in make(n):
    print(*s, sep='')

### FIXED CODE ###

from string import ascii_lowercase
from functools import lru_cache
n = int(input())

@lru_cache(maxsize=10)
def make(n):
    if n == 1:
        return ['a']
    else:
        lst = []
        for s in make(n-1):
            for c in ascii_lowercase[:len(set(s))+1]:
                lst.append(s + c)
        return lst
for s in make(n):
    print(*s, sep='')
from collections import deque

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

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

ans = [0] * N
queue = deque()


def bfs():
    queue.append(0)
    while queue:
        now = queue.popleft()

        for c in nei_L[now]:
            if ans[c] == -1:
                ans[c] = now
                queue.append(c)


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


### FIXED CODE ###

from collections import deque

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

nei_L = [[] for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    nei_L[a - 1].append(b - 1)
    nei_L[b - 1].append(a - 1)

ans = [-1] * N
queue = deque()


def bfs():
    queue.append(0)
    while queue:
        now = queue.popleft()

        for c in nei_L[now]:
            if ans[c] == -1:
                ans[c] = now
                queue.append(c)


bfs()

if -1 in ans[1:]:
    print("No")
else:
    print("Yes")
    for i in range(1, N):
        print(ans[i] + 1)
a

### FIXED CODE ###

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

a.sort()
import operator
bc_list.sort(key=operator.itemgetter(1),reverse=True)

s=0

ans=0
for i in range(m):
    for j in range(s,s+bc_list[i][0]):
        if j>=n:
            break
        if a[j]<bc_list[i][1]:
            ans+=bc_list[i][1]
            s+=1
        else:
            break

for i in range(s,n):
    ans+=a[i]
print(ans)
import sys
 
args = sys.argv

print(args[0])
 
a = int(args[1])
b = int(args[2])
 
sum = a + b
minus = a - b
sub = a * b
 
if (sum - minus) < 0:
  print("足し算のが引き算より小さい")
  if (sum - sub) < 0:
    print("足し算のが掛け算より小さい")
    print(sum)
  else:
    print("掛け算のが足し算より小さい")
    print(sub)
else:
  print("引き算のが足し算より小さい")
  if (minus - sub) < 0:
    print("引き算のが掛け算より小さい")
    print(minus)
  else:
    print("掛け算のが引き算より小さい")
    print(sub)


### FIXED CODE ###

import sys

a, b = map(int, input().split())
 
sum = a + b
minus = a - b
sub = a * b
 
if (sum - minus) > 0:
  if (sum - sub) > 0:
    print(sum)
  else:
    print(sub)
else:
  if (minus - sub) > 0:
    print(minus)
  else:
    print(sub)
a,b = int(input())
if a%500 <= b:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a = int(input())
b = int(input())
if a%500 <= b:
  print("Yes")
else:
  print("No")
import numpy as np

H, W, M = map(int, input().split())

G = np.zeros((H, W))
for _ in range(M):
    h, w = map(int, input().split())
    G[h-1, w-1] += 1

h_idx = np.argmax(np.sum(G, axis=0))
w_idx = np.argmax(np.sum(G, axis=1))

print(int(sum(G[:, h_idx]) + sum(G[w_idx]) - G[h_idx, w_idx]))

### FIXED CODE ###

H, W, M = map(int, input().split())

hdic = {}
wdic = {}
hws_h = {}
hws_w = {}

for m in range(M):
    h, w = map(int, input().split())
    if h in hdic.keys():
        hdic[h] += 1
        hws_h[h].append(w)
    else:
        hdic[h] = 1
        hws_h[h] = [w]
    
    if w in wdic.keys():
        wdic[w] += 1
        hws_w[w].append(h)
    else:
        wdic[w] = 1
        hws_w[w] = [h]

hmax = max(hdic.values())
wmax = max(wdic.values())

hs = []
ws = []

hs = [k for k, v in hdic.items() if v==hmax]
ws = [k for k, v in wdic.items() if v==wmax]

f = 1

if len(ws) < len(hs):
    for h in hs:
        wlist = hws_h[h]
        for w in ws:
            if w not in wlist:
                f = 0
                break
        if f == 0:
            break
        
else:
    for w in ws:
        hlist = hws_w[w]
        for h in hs:
            if h not in hlist:
                f = 0
                break
        if f == 0:
            break

print(hmax + wmax - f)
a, b = map((int, input().split()))
print(a + b if b % a == 0 else b-a)

### FIXED CODE ###

a, b = map(int, input().split())
print(a + b if b % a == 0 else b - a)
d = int(input())
t = int(input())
s = int(input())

if t*s >= d:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

d, t, s = map(int, input().split())

if t*s >= d:
  print('Yes')
else:
  print('No')
H,W=map(int,input().split())
ans=[]*(H+2)
ans[0]=["#"]*(W+2)
ans[H+1]=["#"]*(W+2)
for i in range(1,H+1):
  ans[i]="#"+input()+"#"
for i in range(H+2):
  print("".join(ans[i]))

### FIXED CODE ###

H,W=map(int,input().split())
ans=[[] for i in range(H+2)]
ans[0]=["#"]*(W+2)
ans[H+1]=["#"]*(W+2)
for i in range(1,H+1):
  ans[i]="#"+input()+"#"
for i in range(H+2):
  print("".join(ans[i]))
N = int(input())
A = list(map(int, input().split()))

A = sorted(A)

count_m = 0
count_z = 0
count_p = 0
sum_abs = 0

for i in range(N):
    if A[i] < 0:
        count_m += 1
        sum_abs -= A[i]
    elif A[i] == 0:
        count_z += 1
    else:
        count_p += 1
        sum_abs += A[i]

if count_m + count_z == 0:
    print(sum_abs-2*min(A))
    tmp = A[0]
    for i in range(N-2):
        print(tmp, A[i+1])
        tmp -= A[i+1]
    print(A[-1], tmp)

elif count_p + count_z == 0:
    print(sum_abs+2*max(A))
    tmp = A[-1]
    for i in range(N-1):
        print(tmp, A[i])
        tmp -= A[i]

elif count_p + count_m == 0:
    print(0)
    for i in range(N-1):
        print(0, 0)

elif count_z > 20 and count_p > 20 and count_p > 20:
    print(A[2*N])
    print(sum_abs)
    cmz = count_m + count_z
    tmp = A[-1]
    for i in range(cmz - 1):
        print(tmp, A[i])
        tmp -= A[i]
    tmp_2 = A[cmz-1]
    for i in range(count_p-1):
        print(tmp_2, A[i+cmz])
        tmp_2 -= A[i+cmz]
    print(tmp, tmp_2)

else:
    print(sum_abs)
    cmz = count_m + count_z
    tmp = A[-1]
    for i in range(cmz - 1):
        print(tmp, A[i])
        tmp -= A[i]
    tmp_2 = A[cmz-1]
    for i in range(count_p-1):
        print(tmp_2, A[i+cmz])
        tmp_2 -= A[i+cmz]
    print(tmp, tmp_2)

### FIXED CODE ###

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

A = sorted(A)

count_m = 0
count_z = 0
count_p = 0
sum_abs = 0

for i in range(N):
    if A[i] < 0:
        count_m += 1
        sum_abs -= A[i]
    elif A[i] == 0:
        count_z += 1
    else:
        count_p += 1
        sum_abs += A[i]

if count_m + count_z == 0:
    print(sum_abs-2*min(A))
    tmp = A[0]
    for i in range(N-2):
        print(tmp, A[i+1])
        tmp -= A[i+1]
    print(A[-1], tmp)

elif count_p + count_z == 0:
    print(sum_abs+2*max(A))
    tmp = A[-1]
    for i in range(N-1):
        print(tmp, A[i])
        tmp -= A[i]

elif count_p + count_m == 0:
    print(0)
    for i in range(N-1):
        print(0, 0)

else:
    print(sum_abs)
    cmz = count_m + count_z
    tmp = A[-1]
    for i in range(cmz - 1):
        print(tmp, A[i])
        tmp -= A[i]
    tmp_2 = A[cmz-1]
    if count_p != 0:
        for i in range(count_p-1):
            print(tmp_2, A[i+cmz])
            tmp_2 -= A[i+cmz]
        print(tmp, tmp_2)
import math
class point:
    def __init__(self):
        self.x = 0.0
        self.y = 0.0
 
def koch(n,a,b):
    if n == 0 :
        return
 
    rad = 1.0471975511965976 ???# 60 deg
    s = point()
    t = point()
    u = point()
    tmp = point()
 
    s.x = (2 * a.x + b.x) / 3.0
    s.y = (2 * a.y + b.y) / 3.0
 
    t.x = (2 * b.x + a.x) / 3.0
    t.y = (2 * b.y + a.y) / 3.0
 
    tmp.x, tmp.y = s.x-t.x ,s.y-t.y
    u.x = (tmp.x * math.cos(rad) + tmp.y * math.sin(rad)) + t.x
    u.y = (-tmp.x * math.sin(rad) + tmp.y * math.cos(rad)) + t.y
 
 
    koch(n-1, a, s)
    print(s.x, s.y)
 
    koch(n-1, s, u)
    print(u.x, u.y)
 
    koch(n-1, u, t)
    print(t.x, t.y)
 
    koch(n-1, t, b)
 
    return
 
a = point()
b = point()
a.x, a.y =   0.0, 0.0
b.x, b.y = 100.0, 0.0
n = int(input())

print(a.x, a.y)
koch(n, a, b)
print(b.x, b.y)

### FIXED CODE ###

import math
class point:
    def __init__(self):
        self.x = 0.0
        self.y = 0.0
 
def koch(n,a,b):
    if n == 0 :
        return
 
    rad = 1.0471975511965976
    s = point()
    t = point()
    u = point()
    tmp = point()
 
    s.x = (2 * a.x + b.x) / 3.0
    s.y = (2 * a.y + b.y) / 3.0
 
    t.x = (2 * b.x + a.x) / 3.0
    t.y = (2 * b.y + a.y) / 3.0
 
    tmp.x, tmp.y = s.x-t.x ,s.y-t.y
    u.x = (tmp.x * math.cos(rad) + tmp.y * math.sin(rad)) + t.x
    u.y = (-tmp.x * math.sin(rad) + tmp.y * math.cos(rad)) + t.y
 
 
    koch(n-1, a, s)
    print(s.x, s.y)
 
    koch(n-1, s, u)
    print(u.x, u.y)
 
    koch(n-1, u, t)
    print(t.x, t.y)
 
    koch(n-1, t, b)
 
    return
 
a = point()
b = point()
a.x, a.y =   0.0, 0.0
b.x, b.y = 100.0, 0.0
n = int(input())

print(a.x, a.y)
koch(n, a, b)
print(b.x, b.y)
ソースコード 

Copy
Copy
A=[]
flag=0
for i in range(3):
  A.append(list(map(int,input().split())))
n=int(input())
for i in range(n):
  s=int(input())
  for k in range(3):
    if s in A[k]:
      A[k][A[k].index(s)]=0

if A[0]==[0,0,0] or A[1]==[0,0,0] or A[2]==[0,0,0]:
  print("Yes")
  flag=1
elif A[1][1]==0 and A[2][2]==0 and A[0][0]==0:
  print("Yes")
  flag=1
elif A[0][2]==0 and A[1][1]==0 and A[2][0]==0:
  print("Yes")
  flag=1
else:
  for i in range(3):
    if A[0][i]==0 and A[1][i]==0 and A[2][i]==0:
      print("Yes")
      flag=1
      break
if flag == 0:
  print("No")

### FIXED CODE ###

A=[list(map(int,input().split())) for i in range(3)]
n=int(input())
for k in range(n):
  s=int(input())
  for i in range(3):
    for j in range(3):
      if s == A[i][j]:
        A[i][j]=0   
if A[0][0]==0 and A[1][0]==0 and A[2][0]==0:
  print("Yes")
   
elif A[0][1]==0 and A[1][1]==0 and A[2][1]==0:
  print("Yes")
elif A[0][2]==0 and A[1][2]==0 and A[2][2]==0:
  print("Yes")
elif [0,0,0] in A:
  print("Yes")
  
elif A[0][2]==0 and A[1][1]==0 and A[2][0]==0:
  print("Yes")
  
elif A[0][0]==0 and A[1][1]==0 and A[2][2]==0:
  print("Yes")
  
else:
  print("No")
import sys
  
input()
minv = int(input())
maxv = -1000000000
  
for r in map(int,sys.stdin.readlines()):
  m = r-minv
  if maxv < m: 
    maxv = m
    if m < 0: minv = r
  elif m < 0: minv = r
  
print(maxv


### FIXED CODE ###

import sys
  
input()
minv = int(input())
maxv = -1000000000
  
for r in map(int,sys.stdin.readlines()):
  m = r-minv
  if maxv < m: 
    maxv = m
    if m < 0: minv = r
  elif m < 0: minv = r
  
print(maxv)
import copy

N = int(input())
X = int(input(), 2)

def rev(num, i):
  i = N - 1 - i
  return num ^ (1 << i)



def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f



for i in range(N):
  X = rev(X, i)
    
  fn = copy.deepcopy(X)
  cnt = 0
  
  while fn != 0:
    fn = fn % popcount(fn)
    cnt += 1
  print(cnt)
  
  X = rev(X, i)

      

### FIXED CODE ###

N = int(input())
X = input()

X_int = int(X, 2)
cnt1 = bin(X_int).count('1')
pcXi01 = cnt1 + 1
pcXi10 = cnt1 - 1
zero_idx = N + 5
if cnt1 == 1:
  for i in range(N):
    if X[i] == '1':
      zero_idx = i

if pcXi10 < 1:
  pcXi10 = 1
Xmod01 = X_int % pcXi01
Xmod10 = X_int % pcXi10

tmp01 = [1]
tmp10 = [-1]
for i in range(N - 1):
  tmp01.append(tmp01[i]*2 % pcXi01)
  tmp10.append(tmp10[i]*2 % pcXi10)

init_n = [0] * N
next_n = [0] * N
for i in range(N):
  if X[i] == '0':
    next_n[i] = (Xmod01 + tmp01[N - 1 - i]) % pcXi01
  else:
    next_n[i] = (Xmod10 + tmp10[N - 1 - i]) % pcXi10

for i in range(N):
  fn = 0
  if i == zero_idx:
    print(0)
    continue

  n = next_n[i]
  fn += 1
  while n != 0:
    n = n % bin(n).count('1')
    fn += 1
  
  print(fn)
import heapq

n = int(input())
a, b = [], []
used = [False] * (n + 1)
used[n] = True
for i in range(n):
    a_i, b_i = map(int, input().split())
    heapq.heappush(a, (-a_i, -b_i, i))
    heapq.heappush(b, (-b_i, -a_i, i))

flag = True
ans = 0
for _ in range(n):
    i, j = n, n
    while used[i]:
        a_i, b_i, i = heapq.heappop(a)
    while used[j]:
        b_j, a_j, j = heapq.heappop(b)
    if abs(a_i - a_j) > abs(b_i - b_j):
        if flag:
            ans -= a_i
        else:
            ans += b_i
        used[i] = True
        heapq.heappush(b, (b_j, a_j, j))
    else:
        if flag:
            ans -= a_j
        else:
            ans += b_j
        used[j] = True
        heapq.heappush(b, (b_i, a_i, i))
    flag = not flag
print(ans)

### FIXED CODE ###

n = int(input())
happy, a, b = [], [], []
for i in range(n):
    happy.append(tuple(map(int, input().split())))
happy.sort(key=lambda x: x[0] + x[1], reverse=True)
ans = 0
for i, (a, b) in enumerate(happy):
    if i % 2 == 0:
        ans += a
    else:
        ans -= b
print(ans)
#b is limit
a,b=map(int,input().split())
r=input()

if len(r)==1:
  print(0)
  exit()
  
i=1  
count=0
while i<len(r):
  if r[i-1:i+1]=="RL":
    count+=1
  i+=1
result=(a-1)-2*max(0,count-b)

if r[0]!=r[-1]:
  count-b<=0:
    result-=1

  
print(result)
  



### FIXED CODE ###

n,k=map(int,input().split())
r=input()

c=0
for i in range(1,n):
  if r[i-1]==r[i]:
    c+=1
  
print(min(n-1,c+2*k))
X ,Y = mao(int,input().split())

if (Y != 1)and(Y!=X):
  print(X)
else:
  print(-1)

### FIXED CODE ###

X ,Y = map(int,input().split())
 
if X%Y !=0:
  print(X)
else:
  print(-1)
param_n, param_d = map(int, input().split())

param_count = 0
for i in param_n:
    param_a, param_b = map(int, input().split())
    
    if (param_a)*(param_a) + (param_b)*(param_b) <= (param_d)*(param_d):
        param_count = param_count + 1
        
print(param_count)

### FIXED CODE ###

param_n, param_d = map(int, input().split())

param_count = 0
for i in range(param_n):
    param_a, param_b = map(int, input().split())
    
    if (param_a)*(param_a) + (param_b)*(param_b) <= (param_d)*(param_d):
        param_count = param_count + 1
        
print(param_count)
import sys
sys.setrecursionlimit(10*20)
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
MOD = 1000000007
def Fib(n, A, MOD, memo={}):
    if n in A:
        return 0
    elif n == 1:
        return 1
    elif n == 2:
        if 1 in A:
            return 1
        else:
            return 2
    elif n in memo:
        return memo[n]
    else:
        memo[n] = ( Fib(n-1, A, MOD, memo) + Fib(n-2, A, MOD, memo) ) % MOD
        return memo[n]

print(Fib(N, A, MOD))


### FIXED CODE ###

N, M = map(int, input().split())
A = set([int(input()) for _ in range(M)])
MOD = 1000000007
memo = [0]*(N+1)
memo[0] = 1
if 1 not in A:
    memo[1] = 1
for i in range(2, N+1):
    if i not in A:
        memo[i] = (memo[i-2] + memo[i-1])%MOD
print(memo[N])
def dfs(a, b, k):
    global cnt
    seen[a][b] = True
    na = a + 1
    nb = b + 1
    if na <= N and seen[na][b] is False and k >= book_a[na]:
        k -= book_a[na]
        cnt = max(cnt, na + b)
        dfs(na, b, k)
    if nb <= M and seen[a][nb] is False and k >= book_b[nb]:
        k -= book_b[nb]
        cnt = max(cnt, a + nb)
        dfs(a, nb, k)
        
N, M, k = map(int, input().split())
book_a = [int(x) for x in input().split()]
book_b = [int(x) for x in input().split()]
book_a.insert(0, 0)
book_b.insert(0, 0)
cnt = 0
seen = [[False] * (M + 1) for _ in range(N + 1)]
dfs(0, 0, k)
print(cnt)

### FIXED CODE ###

a = int(input())
print(a + a ** 2 + a ** 3)