Harryxun/stf_run huggingface dataset:
import math
s = int(input())
r = math.floor(math.sqrt(s))
k = r**2 - s
def search_prime(k):
    p = math.floor(math.sqrt(k))
    for i in range(2,p + 1):
        if k % i == 0:
            return i
    return 1
prime = search_prime(k)
print("{} {} {} {} {} {}".format(0, 0, prime,r,r, int(k / prime)))


### FIXED CODE ###

import math
s = int(input())
r = math.floor(math.sqrt(s)) + 1
k = r**2 - s
if r == 10**9 + 1:
    print("{} {} {} {} {} {}".format(0, 0, 1,r - 1,r - 1, 0))
    exit()
def search_prime(k):
    p = math.floor(math.sqrt(k))
    for i in range(2,p + 1):
        if k % i == 0:
            return i
    return 1
prime = search_prime(k)
print("{} {} {} {} {} {}".format(0, 0, prime,r,r, int(k / prime)))
7
5 0 7 8 3 3 2

### FIXED CODE ###

n=int(input())
d=list(map(int,input().split()))
s=[0]*int(n*(n-1)/2)
cnt=0
for i in range(n):
  for j in range(i+1,n):
    s[cnt]=d[i]*d[j]
    cnt+=1
print(sum(s))
n = int(input())
a = int(input())
b = int(input())
if n == 1:
  print("Hello World")
if n == 2:
  print(a+b)

### FIXED CODE ###

n = int(input())
if n == 1:
  print("Hello World")
elif n == 2:
  a = int(input())
  b = int(input())
  print(a+b)
N = int(input())
p = list(map(int,input().split()))

q = []
for x in range(N):
    q.append(x+1)

i = 0
c = 0
ans = "NO"
while(i < N):
    if p[i] != q[i]:
        c += 1
    if c > 2:
        break
    i += 1

if (c == 2) && (c == 0):
    ans = "YES"

print(ans)


### FIXED CODE ###

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

q = []
for x in range(N):
    q.append(x+1)

i = 0
c = 0
ans = "NO"
while(i < N):
    if p[i] != q[i]:
        c += 1
    if c > 2:
        break
    i += 1

if (c == 2) or (c == 0):
    ans = "YES"

print(ans)
k = int(input())
S = input()
if len(S) > K:
  print(S[:K])
else:
  print(S)

### FIXED CODE ###

K = int(input())
S = input()
if len(S) > K:
  print(S[:K]+"...")
else:
  print(S)
l=[]
total=0
for i in range(5):
    t=int(input())
    if t%10 !=0:
        total +=(t+9)//10*10
        l.append((t+9)//10*10-t)
    else:
        total +=t
a=max(l)
print(total-a)

### FIXED CODE ###

l=[]
total=0
a=0
for i in range(5):
    t=int(input())
    if t%10 == 0:
        total +=t
    else:    
        total +=(t//10+1)*10
        a=max(a,10-(t%10))
print(total-a)
N,M=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(M)]
s=[sc[i][0] for i in range(M)]
c=[sc[i][1] for i in range(M)]
sc.sort()
sets=list(set(s))
setc=list(set(c))
if len(sets)!=len(setc):
    print(-1)
if sets==0 and setc==0:
    print(0)
if sc[0][0]==1 and sc[0][1]==0:
    print(-1)
else:
    if len(sets)==3:
        print(sc[0][1]*100+sc[1][1]*10+sc[2][1])
    elif len(sets)==2:
        if len(sc)==3:
            sc=[sc[0],sc[2]]
        if sc[0][0]==1:
            if sc[1][0]==2:
                print(sc[0][1]*100+sc[1][1]*10)
            if sc[1][0]==3:
                print(sc[0][1]*100+sc[1][1])
        if sc[0][0]==2:
            print(100+sc[0][0]*10+sc[0][1])
    elif len(sets)==1:
        if sc[0][0]==1:
            print(sc[0][1]*100)
        if sc[0][0]==2:
            print(100+sc[0][1]*10)
        if sc[0][0]==3:
            print(100+sc[0][1])

### FIXED CODE ###

N,M=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(M)]
s=[sc[i][0] for i in range(M)]
c=[sc[i][1] for i in range(M)]

for i in range(1000):
    if len(str(i)) == N:
        for j in range(M):
            if str(i)[s[j]-1] != str(c[j]):
                break
        else:
            print(i)
            break
else:
    print(-1)
a,b,c = int(input().split(" "))
if (a+b+c < 22): print("bust")
else: print("win")

### FIXED CODE ###

input = input().split()

a = int(input[0])
b = int(input[1])
c = int(input[2])

if (a + b + c < 22): print("win")
else: print("bust")
A, B, K = map(int, input().split())

ans = []

for i in range(1, max(A, B)):
    if A%i == 0 and B%i == 0:
        ans.append(i)
print(ans[K-1])

### FIXED CODE ###

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

ans = []

for i in range(1, min(A, B)+1):
    if A%i == 0 and B%i == 0:
        ans.append(i)
ans.sort(reverse=True)
print(ans[K-1])
n=int(input())
x=[0]*n
y=[0]*n
h=[0]*n
for i in range(n):
  x[i],y[i],h[i]=map(int, input().split())
for i in range(101):
  for j in range(101):
    alist=[0]*n
    for k in range(n):
      if h[k]>0:
        alist[k]=(h[k]+abs(x[k]-i)+abs(y[k]-j))
    if len(set(alist))==1:
      ans=True
      for k in range(n):
        if h[k]==0:
          if alist[0]<(h[k]+abs(x[k]-i)+abs(y[k]-j)):
            ans=False
      if ans:
        ansx=i
        ansy=j
        ansh=alist[0]
print(ansx,ansy,ansh)

### FIXED CODE ###

n=int(input())
alist=[list(map(int, input().split())) for i in range(n)]
alist.sort(key=lambda x:x[2],reverse=True)
for i in range(101):
  for j in range(101):
    h=abs(alist[0][0]-i)+abs(alist[0][1]-j)+alist[0][2]
    ans=True
    for k in range(n):
      if max((h-abs(alist[k][0]-i)-abs(alist[k][1]-j)),0)!=alist[k][2]:
        ans=False 
    if ans:
      ansx=i
      ansy=j
      ansh=h
print(ansx,ansy,ansh)
#!/usr/bin/env python3

N = int(input().split()[0])
a_list = list(map(int, input().split()))

# 最初が0から始まる場合
b_list = [0] * N
b_list[-1] = a_list[-1]

for i in range(1, N + 1):
    # 大きい方から決めていく
    idx = N - i
    total = 0
    for j in b_list[:: idx + 1]:
        # idx + 1の倍数のボールの個数を数える
        total += b_list[j]

    if total % (idx + 1) != a_list[idx]:
        b_list[idx] = 1

idx_list = [str(i + 1) for i, b in enumerate(b_list) if b == 1]
ans = sum(b_list)
print(ans)
print(" ".join(idx_list))


### FIXED CODE ###

#!/usr/bin/env python3

N = int(input().split()[0])
a_list = list(map(int, input().split()))

# 最初が0から始まる場合
a_list = [0] + a_list
b_list = [0] * (N + 1)
# インデックスがずれるのがややこしいので、
# b_list[0]は欠番として1始まりで考えていく

for i in range(N):
    # 大きい方から決めていく
    idx = N - i
    total = sum(b_list[idx : N + 1 : idx])

    if total % 2 != a_list[idx]:
        b_list[idx] = 1

idx_list = [str(i) for i, b in enumerate(b_list) if b == 1]
ans = sum(b_list[1:])
print(ans)
if ans != 0:
    print(" ".join(idx_list))
N, K = map(int, input().split())
x = list(map(int, input().split()))

count_m = 0
count_p = 0
for i in range(N):
    if x[i] > 0:
        count_m = i
        count_p = N-i
        break
    elif x[i] == 0:
        count_m = i
        count_p = N-i-1
        K -= 1
        N -= 1
        x.remove(x[i])
        break
if count_m == 0 and count_p == 0:
    count_m = N

ans = 0
    

y = K
z = K - y
# for j in range(1, y):
#     if count_m-j>0 and count_m+y-1-j<N-1:

#         print(j)

#         print(x[count_m+y-1-j],x[count_m-j] ,x[count_m-1])



if count_m >= 1:

    tmp = min(x[count_m+y-1-j]-x[count_m-j] *2
              for j in range(1, y) if count_m-j>0  and count_m+y-1-j<N-1)
    tmp2 = min(x[count_m+y-1-j]*2-x[count_m-j]
               for j in range(1, y) if count_m-j>0 and count_m+y-1-j<N-1)
else:
    tmp = tmp2 = 1000000000

if N==0:
    ans = 0

elif count_p>=K:
    # print(y, "1chi")
    ans = min(tmp, tmp2, x[count_m+min(y, count_p)-1])
elif count_m>=K:
    #print("ni")
    ans = min(tmp, tmp2, -x[count_m-K])
else:
    # print("san")
    ans = min(tmp, tmp2)


print(ans)


### FIXED CODE ###

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

count_m = 0
count_p = 0
for i in range(N):
    if x[i] > 0:
        count_m = i
        count_p = N-i
        break
    elif x[i] == 0:
        count_m = i
        count_p = N-i-1
        K -= 1
        N -= 1
        x.remove(x[i])
        break
if count_m == 0 and count_p == 0:
    count_m = N

ans = 0
    

y = K
z = K - y


if count_m >= 1 and count_p>=1:
    # for j in (range(1,y)):
    #     if count_m-j>=0  and count_m+y-1-j<N:
    #         print(x[count_m+y-1-j], x[count_m-j])
    tmp = min(x[count_m+y-1-j]-x[count_m-j] *2 for j in range(1, y) if count_m-j>=0  and count_m+y-1-j<N)
    tmp2 = min(x[count_m+y-1-j]*2-x[count_m-j] for j in range(1, y) if count_m-j>=0 and count_m+y-1-j<N)
else:
    tmp = tmp2 = 1000000000

if N==0:
    ans = 0


elif count_p>=K:
    # print(y, "1chi")
    ans = min(tmp, tmp2, x[count_m+min(y, count_p)-1])
elif count_m>=K:
    #print("ni")
    ans = min(tmp, tmp2, -x[count_m-K])
else:
    #print("san", tmp, tmp2)
    ans = min(tmp, tmp2)


print(ans)
(a,b) = [int (x) for x in input().split()]

x = a // b
y = a % b
z = a / b

print('{1} {2} {3:.6f}'.format(x,y,z))

### FIXED CODE ###

(a,b) = [int (x) for x in input().split()]
 
x = a // b
y = a % b
z = a / b
 
print('{0} {1} {2:.6f}'.format(x,y,z))
N = int(input())
F = 999;
for i in range(1,int(sqrt(N))+1):
    
    if N%i == 0: #余りが0 = iは整数なので整数同士の割り算ということ(余りを求める際には少数まで商を求めない）
        F =  min(F , max( len(str(i)) , len(str(N//i)) ) )
print(F)
        

### FIXED CODE ###

from math import sqrt

# C-Digits in Multiplication
# 問題URl:http://abc057.contest.atcoder.jp/tasks/abc057_c

N = int(input())
F = 999;
for i in range(1,int(sqrt(N))+1):
    
    if N%i == 0: #余りが0 = iは整数なので整数同士の割り算ということ(余りを求める際には少数まで商を求めない）
        F =  min(F , max( len(str(i)) , len(str(N//i)) ) )
print(F)
n, k = input().split()
print(len(str(int(n, int(k)))))

### FIXED CODE ###

import numpy as np
n, r = map(int, input().split())
print(len(str(np.base_repr(n,r))))
n = int(input())
l = list(range(1,n))
print(sum(l))

### FIXED CODE ###

n = int(input())-1
print(n*(n+1)//2)
def main():
    X = int(input())
    n_5,a = [(0,0)],1
    while a**5 <= X:
        n_5.append((a,a**5))
        n_5.append((-a,-a**5))
        a += 1
    n_5.sort()

    for a in range(len(n_5)):
        for b in range(len(n_5)):
            if n_5[a][1] - n_5[b][1] == X:
                a_ans,b_ans = n_5[a][0],n_5[b][0]
                break

    print(a_ans,b_ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

def cal(a,b):
    return a**5-b**5

def main():
    X = int(input())
    update = True
    for i in range(10**3):
        for j in range(10**3):
            if cal(i,j) == X:
                a,b = i,j
                update = False
                break
            if cal(i,-j) == X:
                a,b = i,-j
                update = False
                break
        if not update:
            break

    print(a,b)

if __name__ == "__main__":
    main()
W, H, N = map(int, input().split())

left, bottom = 0, 0
right, top = W, H

for x, y, a in map(int, input().split()):
  
  if a == 1:
    left = max(left, x)
  elif a == 2:
    right = min(right, x)
  elif a == 3:
    bottom = max(bottom, y)
  else:
    top = min(top, y)

print(max(0, right-left) * max(0, top-bottom))
    



### FIXED CODE ###

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

left, bottom = 0, 0
right, top = W, H

for x, y, a in (map(int, input().split()) for _ in range(N)):
  
  if a == 1:
    left = max(left, x)
  elif a == 2:
    right = min(right, x)
  elif a == 3:
    bottom = max(bottom, y)
  else:
    top = min(top, y)

print(max(0, right-left) * max(0, top-bottom))
import numpy as np
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x


def main():
    N,M=[int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    b = [x//2 for x in a]

    # l = np.lcm.reduce(b)
    l = lcm(b)
    for x in b:
        if l // x % 2 == 0:
            print(0)
            return

    ans = (M//lcm+1)//2
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import fractions
from functools import reduce


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

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


def main():
    N,M=[int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    b = [x//2 for x in a]

    # l = np.lcm.reduce(b)
    l = lcm(b)
    for x in b:
        if l // x % 2 == 0:
            print(0)
            return

    ans = (M//l+1)//2
    print(ans)


if __name__ == '__main__':
    main()
from sys import stdin
l = int(stdin.readline().rstrip().split())

m = l[0] * l[1]
if m % 2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

li = list(map(int, input().rstrip().split()))

if (li[0] * li[1]) % 2 == 0:
  print("Even")
else:
  print("Odd")
a, b, c, d = map(int, input().split())

if a - d <= c <= a + d:
  print("Yes"):
elif a - d <= b <= a + d and c - d <= b <= c + d:
  print("Yes")
else:
  print("No")
  

### FIXED CODE ###

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

if a - d <= c <= a + d:
  print("Yes")
elif a - d <= b <= a + d and c - d <= b <= c + d:
  print("Yes")
else:
  print("No")
while 1:
    a=[i+1 for i in range(10)]
    try:b=list(map(int,input().split()))
    except:break
    for i in b:a.remove(b)
    print('YES' if sum([1 for i in a if i<=20-sum(b[:2])])/7>=0.5 else 'NO')

### FIXED CODE ###

while 1:
    a=[i+1 for i in range(10)]
    try:b=list(map(int,input().split()))
    except:break
    for i in b:a.remove(i)
    c=sum(b[:2])
    print(['NO','YES'][sum([1 for i in a if c+i<=20])/7>=0.5])
import math
a,b,c=map(int,input().split())
a=math.sqrt(a)
b=math.sqrt(b)
c=math.sqrt(c)
s=a+b
if s<＝c:
    print('Yes')
else :
    print('No')


### FIXED CODE ###

import math
a,b,c=map(int,input().split())
if c-a-b<0:
    print('No')
elif 4*a*b<(c-a-b)**2:
    print('Yes')
else :
    print('No')
#input
n, a, b = map(int, input().split())

#output
mod = 10**9 + 7

n_ = 10**9 + 1
fun = [1]*(n_+1)
for i in range(1,n_+1):
    fun[i] = fun[i-1]*i%mod
rev = [1]*(n_+1)
rev[n_] = pow(fun[n_],mod-2,mod)
for i in range(n_-1,0,-1):
    rev[i] = rev[i+1]*(i+1)%mod
def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod

answer = 2**n - 1 - cmb(n, a) - cmb(n, b)
print(answer % mod)

### FIXED CODE ###

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

#output
mod = pow(10, 9) + 7

def cmb(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    k = min(n-k,k)
    value = 1
    inv = [1] * (k+1)
    if k >= 1:
        value *= (n-k+1) % mod
    for i in range(2,k+1):
        inv[i] = mod-inv[mod%i]*(mod//i)%mod
        value = value * (n-k+i) * inv[i] % mod
    return value

answer = (pow(2, n, mod) - 1 - cmb(n, a) - cmb(n, b)) % mod
print(answer % mod)
line = input(),split(' ')
A, B = [int(i) for i in line]

S = (A-1)*(B-1)

print(S)

### FIXED CODE ###

l = input().split()
A = int(l[0])
B = int(l[1])
print((A * B)- A -B + 1)
N = int(input())
S = list(input())

if S == ['#'] * N or S == ['.'] * N:
    print(0)
    exit()
ans = 0
b, w = 0, 0
for j in range(N):
    if S[j] == '.':
        w += 1
    else:
        b += 1
    if b == w and b != 0 and w != 0:
        ans += b
        num = j
        b, w = 0, 0

b, w = 0, 0
for j in range(N - 1, num, -1):
    if S[j] == '.':
        w += 1
    else:
        b += 1
    if b == w and b != 0 and w != 0:
        ans += b
        b, w = 0, 0

print(ans)

### FIXED CODE ###

N = int(input())
S = list(input())

w_cnt = [0]
w = 0
for s in S:
    if s == '.':
        w += 1
    w_cnt.append(w)

b_cnt = [0]
b = 0
for s in S[::-1]:
    if s == '#':
        b += 1
    b_cnt.append(b)
b_cnt.reverse()


ans = float('inf')
i = 0
for b, w in zip(b_cnt, w_cnt):
    ww, bb = i, N - i
    ans = min(ans, abs(b - bb) + abs(w - ww))
    i += 1
print(ans)
a,b=map(int,input().split())
if a+b>=10:print('error')
  else:print(a+b)

### FIXED CODE ###

a,b=map(int,input().split())
if (a+b)>=10:print('error')
else:print(a+b)
a = random.randint(1,10000)
b = random.randint(1,10000)
if a * b %= 0:
  print('Even')
else:
  print('Odd')


### FIXED CODE ###

a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')
ans = 0
n, w = map(int, input().split())
lst = [[0,0]]
for _ in range(n):
    a, b = map(int, input().split())
    lst.append([a,b])
dp = [[0] * (w+1) for _ in range(n+1)]

for i in range(0, n):
    for sum_w in range(0, w+1):
        if sum_w  >= lst[i+1][0]:
            dp[i+1][sum_w] = max(dp[i][sum_w -  lst[i+1][0]] + lst[i+1][1], dp[i][sum_w])
        else:
            dp[i+1][sum_w] = dp[i][sum_w]
        ans = max(ans, dp[i+1][sum_w])    
print(ans)


### FIXED CODE ###

n, w = map(int, input().split())
lst = [[0,0]]
vmax = 0
for _ in range(n):
    a, b = map(int, input().split())
    lst.append([a,b])
    vmax += b

dp = [[w+1] * (vmax+1) for _ in range(n+1)]
dp[0][0] = 0
ans = 0

for i in range(0, n):
    for sum_v in range(0, vmax+1):
        if sum_v  >= lst[i+1][1]:
            dp[i+1][sum_v] = min(dp[i][sum_v -  lst[i+1][1]] + lst[i+1][0], dp[i][sum_v])
        else:
            dp[i+1][sum_v] = dp[i][sum_v]
        if dp[i+1][sum_v] <= w:
            ans = max(ans, sum_v)

print(ans)
h, w = [int(item) for item in input().split()]
field = []
for i in range(h):
    field.append(input().rstrip())

black = 0; white = 0
visited = [[0] * w for _ in range(h)]

def dfs(is_black, i, j):
    global black
    global white
    visited[i][j] = 1
    for x, y in [[1,0], [0,1], [0,-1], [-1,0]]:
        if i+x < 0 or i+x >= h or j+y < 0 or j+y >= w:
            continue
        if visited[i + x][j + y] != 0:
            continue
        if is_black:
            if field[i+x][j+y] == ".":
                white += 1
                dfs(False, i+x, j+y)
        if not is_black:
            if field[i+x][j+y] == "#":
                black += 1
                dfs(True, i+x, j+y)

ans = 0
for i in range(h):
    for j in range(w):
        if visited[i][j] != 0:
            continue
        if field[i][j] == "#":
            white = 0; black = 1
            dfs(True, i, j)
        else:
            white = 1; black = 0
            dfs(False, i, j)
        ans += white * black

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
h, w = [int(item) for item in input().split()]
field = []
for i in range(h):
    field.append(input().rstrip())

black = 0; white = 0
visited = [[0] * w for _ in range(h)]

def dfs(is_black, i, j):
    global black
    global white
    visited[i][j] = 1
    for x, y in [[1,0], [0,1], [0,-1], [-1,0]]:
        if i+x < 0 or i+x >= h or j+y < 0 or j+y >= w:
            continue
        if visited[i + x][j + y] != 0:
            continue
        if is_black:
            if field[i+x][j+y] == ".":
                white += 1
                dfs(False, i+x, j+y)
        if not is_black:
            if field[i+x][j+y] == "#":
                black += 1
                dfs(True, i+x, j+y)

ans = 0
for i in range(h):
    for j in range(w):
        if visited[i][j] != 0:
            continue
        if field[i][j] == "#":
            white = 0; black = 1
            dfs(True, i, j)
        else:
            white = 1; black = 0
            dfs(False, i, j)
        ans += white * black

print(ans)
from math import gcd
a, b = map(int, input().split())
print(a*b//gcd(a, b))

### FIXED CODE ###

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x%y==0:
        return y
    else:
        return gcd(y, x%y)
        
a, b = map(int, input().split())
print(a*b//gcd(a, b))
import numpy as np
import math

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

sum_dif =  sum(B) - sum(A)

difference = list(np.array(B) - np.array(A))
manipulation_A = sum([d // 2 for d in difference if d > 0])
manipulation_B = sum([-d for d in difference if d < 0])

if sum_dif < man_required_A + man_required_B:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

import math

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

total_manipulation =  sum(B) - sum(A)

manipulation_A = 0
manipulation_B = 0

for i in range(N):
    if A[i] < B[i]:
        manipulation_A += math.ceil((B[i] - A[i]) / 2)
        manipulation_B += (B[i] - A[i]) % 2
    elif A[i] > B[i]:
        manipulation_B += A[i] - B[i]

if total_manipulation - max(manipulation_A, manipulation_B) >= 0:
    print("Yes")
else:
    print("No")
N = int(input())
A = [0]*(100001)
for a in list(map(int, input().split())):
    A[a] += 1

# MFPF = Most Frequent Prime Factor
MFPF_n = 0
for i in range(2, 100001):
    n = i
    tmp = 0
    while n < 100001:
        tmp += A[n]
        n += i
    MFPF_n = max(MFPF_n, tmp)

if MFPF_n < 2:
    print('pairwise coprime')
elif MFPF_n - A[1] < N:
    print('setwise coprime')
else:
    print('not coprime')

### FIXED CODE ###

from collections import defaultdict

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

Ones = A.count(1)
R = max(A)
nums = [0]*(R+1)

# 素因数テーブルの作成
D = [0]*(R+1)
for i in range(2, R+1):
    if D[i]:
        continue
    n = i
    while n < R+1:
        if D[n] == 0:
            D[n] = i
        n += i

# 素因子をカウント
for a in A:
    tmp = a
    while tmp > 1:
        prime_factor = D[tmp]
        nums[prime_factor] += 1
        while tmp%prime_factor == 0:
            tmp //= prime_factor
y = max(nums)
if y < 2:
    print('pairwise coprime')
elif y-Ones < N:
    print('setwise coprime')
else:
    print('not coprime')
#!/usr/bin/env pypy

MAX = 10**4 + 1

n, k = map(int, input().split())
cost = list(map(int, input().split()))
dp = [MAX] * (n)
dp[0] = 0

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

print(dp[-1])


### FIXED CODE ###

#!/usr/bin/env pypy

import sys
inp = sys.stdin.readline
out = print
MAX = 10**9
 
n, k = map(int, inp().split())
cost = list(map(int, inp().split()))
dp = [MAX] * (n)
dp[0] = 0
 
for i in range(1, n):
    dp[i] = min(dp[j] + abs(cost[i] - cost[j]) for j in range(max(0, i - k), i))
 
out(dp[-1])
import math

input = str(input()).split(" ")
for index in range(len(input)):
    input[index] = int(input[index])
x = input[0]
y = input[1]

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

def thingo(x,y):
    test = lcm(x,y)
    if (test-x >= x):
        return test-x
    else:
        return -1
print(thingo(x,y))


### FIXED CODE ###

x,y = map(int,input().split())
 
if x%y == 0:
  print(-1)
else:
  print(x)
n=int(input())
p = list(map(int, input().split()))
count=0
for i in range(n-2)
	if p[i]>p[i+1]>p[i+2] or p[i+2]>p[i+1]>p[i]:
    	count=count+1
print(count)

### FIXED CODE ###


n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
	if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1] < p[i]:
		ans += 1
print(ans)
t=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
p,q=[0],[0]
x,y=[(a[0]-b[0])*t[0],(a[1]-b[1])*t[1]]
if x+y==0:
    print("infinity")
elif (x<0 and y<0) or (x>0 and y>0):
    print(0)
elif (x<0 and x+(x+y)>0) or (x>0 and x+(x+y)<0):
    print(1)
elif x<0 and x+y>0:
    print(y//(x+y)*2-1)
else:
    print(hhh)

### FIXED CODE ###

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
 
P = (A1 - B1) * T1
Q = (A2 - B2) * T2
if P > 0:
	P *= -1
	Q *= -1
 
if P + Q < 0:
	print(0)
elif P + Q == 0:
	print("infinity")
else:
	S = (-P) // (P + Q)
	T = (-P) % (P + Q)
	if T != 0:
		print(S * 2 + 1)
	else:
		print(S * 2)
import sys
 
def read_input():
  return sys.stdin.readline().strip().split(' ')
 
def task(s):
  rainy_til = []
  l = len(s)
  i = 0
  while i < l:
    if s[i] == 'R':
      last_rainy = rainy_til[i-1] if i > 0 else 0
      rainy_til[i] = last_rainy + 1
    else:
      rainy_til[i] = 0
  return max(rainy_til)
 
def main():
  s = read_input()
  result = task(s)
  print(result)

main()


### FIXED CODE ###

import sys


def read_input():
    return sys.stdin.readline().strip().split(' ')


def task(s):
    rainy_til = []
    l = len(s)
    i = 0
    while i < l:
        if s[i] == 'R':
            last_rainy = rainy_til[i - 1] if i > 0 else 0
            rainy_til.append(last_rainy + 1)
        else:
            rainy_til.append(0)
        i += 1
    return max(rainy_til)


def main():
    [s] = read_input()
    result = task(s)
    print(result)


main()
A,B,C,K = input().split()
if A >= K:
  print(K)
elif A+B >= K:
  print(A)
else:
  print(A + A + B - K)

### FIXED CODE ###

A,B,C,K = input().split()
if int(A) >= int(K):
  print(K)
elif int(A)+int(B) >= int(K):
  print(A)
else:
  print(int(A) + int(A) + int(B) - int(K))
N=int(input())
S=str(input())
cnt=1

for i in range(len(S)):
  if S[i]==S[i+1]:
    continue
  else:
    cnt+=1
print(cnt)

### FIXED CODE ###

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

for i in range(len(S)-1):
  if S[i]==S[i+1]:
    continue
  else:
    cnt+=1
print(cnt)