Harryxun/stf_run huggingface dataset:
from collections import defaultdict


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

g = defaultdict(list)
for _ in range(m):
    l, r, d = map(int, input().split())
    g[l].append((r, d))
    g[r].append((l, -d))


checked = {}
ds = defaultdict(int)


def check(v, cur_d=0):
    if (not (v in ds)):
        ds[v] = cur_d
    if v in checked:
        return True
    checked[v] = True
    for next_v, d in g[v]:
        if not (next_v in ds):
            ds[next_v] = ds[v] + d
        if not (ds[next_v] - ds[v] == d):
            return False
        elif check(next_v) is False:
            return False
    return True


valid = True
for v in range(1, n + 1):
    if v in checked:
        continue
    valid &= check(v)

if valid:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

import sys

sys.setrecursionlimit(200002)

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

g = [[] for _ in range(n)]
for _ in range(m):
    l, r, d = map(int, input().split())
    l -= 1
    r -= 1
    g[l].append((r, d))
    g[r].append((l, -d))


ds = [None for _ in range(n + 1)]


def check(v):
    for next_v, d in g[v]:
        if ds[next_v] is None:
            ds[next_v] = ds[v] + d
            if check(next_v) is False:
                return False
        elif not (ds[next_v] - ds[v] == d):
            return False
    return True


valid = True
for v in range(n):
    if ds[v] is None:
        ds[v] = 0
    if check(v) is False:
        valid = False
        break

if valid:
    print("Yes")
else:
    print("No")
N, K = map(int, input().split())
T_list = list(map(int, input().split()))
T_list = [T_list[i]-1 for i in range(N)]

if K < N:
  while i < K:
  point = T_list[point]
  i += 1  

else:
  point = 0
  syuuki = 0
  i = 0
  while i < N:
    point = T_list[point]
    if point == 0:
      syuuki = i+1
      break
    i += 1

  second_point = point
  if syuuki != 0:
    L = K % syuuki

  else:
    j = 0
    while j < N:
      point = T_list[point]
      if point == second_point:
        syuuki = j+1
        break
      j += 1
    L = (K-i) % syuuki

  k = 0
  while k < L:
    point = T_list[point]
    k += 1
  
print(point+1)

### FIXED CODE ###

N, K = map(int, input().split())
T_list = list(map(int, input().split()))
T_list = [T_list[i]-1 for i in range(N)]
point = 0
syuuki = 0

if K < N:
  i = 0
  while i < K:
    point = T_list[point]
    i += 1  

else:
  i = 0
  while i < N:
    point = T_list[point]
    if point == 0:
      syuuki = i+1
      break
    i += 1
  second_point = point
  
  if syuuki != 0:
    L = K % syuuki

  else:
    j = 0
    while j < N:
      point = T_list[point]
      if point == second_point:
        syuuki = j+1
        break
      j += 1
    L = (K-i) % syuuki

  k = 0
  while k < L:
    point = T_list[point]
    k += 1
  
print(point+1)
n, k = map(int, input().split())
    p = list(map(int, input().split()))
    ex = [0 for _ in range(n)]
    for i in range(n):
        ex[i] = (p[i]+1)/2

    sumex = sum(ex[:k])
    tmp = sum(ex[:k])
    for i in range(n-k):
        tmp = tmp + (ex[i+k] - ex[i])
        sumex = max(sumex, tmp)
    print(sumex)

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
ex = [0 for _ in range(n)]
for i in range(n):
    ex[i] = (p[i]+1)/2

sumex = sum(ex[:k])
tmp = sum(ex[:k])
for i in range(n-k):
    tmp = tmp + (ex[i+k] - ex[i])
    sumex = max(sumex, tmp)
print(sumex)
from collections import defaultdict
n,k=map(int,input().split())
l=list(map(int,input().split()))
d=defaultdict(int)
for i in range(n):
    d[i+1]=l[i]
visited=set()
l=[]
i=1
while True:
    l.append(i)
    if i not in visited:
        visited.add(i)
    else:
        break
    i=d[i]
first=l.index(l[-1])

k=(len(l)-first)%((len(l)-1)-first)
k+=first
if k<first:
    print(l[k])
else:
    print(l[k-1])

### FIXED CODE ###

s=input()
t=input()
if len(t)==len(s)+1 and t[0:len(s)]==s:
    print("Yes")
else:
    print("No")
S = [1 if(_ =="B") else 0 for _ in input()]
ans = 0
first = S.index(1)
count = first
start = first
for s in S[start:]:
    if(s == 0):
        ans += count -first
        first += 1
    count += 1
print(ans)

### FIXED CODE ###

S = [1 if(_ =="B") else 0 for _ in input()]+[1]
ans = 0
if(S.index(1) == len(S)-1):
    print(0)
else:
    S.pop(-1)
    first = S.index(1)
    count = first
    start = first
    for s in S[start:]:
        if(s == 0):
            ans += count -first
            first += 1
        count += 1
    print(ans)
# 170Dと同じような方法g使える．ただしN=10^7なので，うまくわからないけどなぁ...
N = int(input())
Res = [0] * (N+1)
import numpy as np
Res = np.array(Res)
for i in range(1,N+1):
    Res[::i] += 1
Range = np.arange(N+1)
Res = Res * Range
print(np.sum(Res))


### FIXED CODE ###

# (1,2,3,4,5..,N) + (1,2,3,4,...,N/2) * 2 + (1,2,...,N/3) * 3 + ...+(1,) * N
# 累積和を使うことでO(1)でそれぞれの計算をする．N回ループをするので，合計O(N)の計算量で終了する

N = int(input())

S=[0]*(N+1)
for i in range(1,N+1):
    S[i] = S[i-1] + i

ans = 0
for i in range(1,N+1):
    ind = int(N/i)
    ans += S[ind] * i

print(ans)
def main():
  H,W,K = map(int,input().split())
  import numpy as np
  from collections import deque
  ans = 10000
  S = np.array([list(map(int,list(input()))) for _ in range(H)])
  cum = [[0]*W for _ in range(H+1)]
  for j in range(W):
    for i in range(1,H+1):
      cum[i][j] = cum[i-1][j]+S[i-1][j]

  cum = np.array(cum)
  for i in range(2**(H-1)):
    q = deque([0])
    for h in range(H):
      if (i>>h)&1:
        q.append(h+1)
    q.append(H)
    p = deque()
    judge = False
    for a in range(len(q)-1):
      x = cum[q[a+1]]-cum[q[a]]
      if (x>K).any():
        judge = True
        break
      else:
        p.append(x)

    if judge:
      continue

    t_a = len(q)-2
    l = [0]*len(p)
    for w in range(W):
      for x,a in enumerate(p):
        l[x]+=a[w]
        if l[x]>K:
          t_a+=1
          l = [0]*len(p)
          for z,b in enumerate(p):
            l[z] = b[w]
          break
    ans = min(ans,t_a)

  print(ans)
  
main()

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
A_set = list(set(A))
l = [0]*(N+2)
ans = [0]*(N+2)
for a in A:
  l[a]+=1
comb = [0]*(N+2)
for i in range(2,N+1):
  comb[i] = i*(i-1)//2
  
for i in range(2,N+1):
  ans[i]=comb[i]-comb[i-1]
  
total = 0
for a in A_set:
  total += comb[l[a]]

for a in A:
  print(int(total-ans[l[a]]))
# -*- coding: utf-8 -*-
from collections import Counter
def main():
    N = int(input())
    S = [str(input()) for i in range(N)]
    c = Counter(S)
    ans = []
    tmp = []
    tmp = c.most_common()
    cmax = c.most_common()[0][1]
    for i in range(N):
        if tmp[i][1] != cmax:
            break
        ans.append(tmp[i][0])
    ans.sort()
    print('\n'.join(ans))
if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import Counter
def main():
    N = int(input())
    S = [input() for i in range(N)]
    c = Counter(S)
    ans = []
    tmp = []
    tmp = c.most_common()
    cmax = c.most_common()[0][1]
    ans = [k for k , j in c.items() if j == cmax]
    ans.sort()
    print('\n'.join(ans))
if __name__ == '__main__':
    main()
import math
A,B=map(int,input().split())
print(str(math.gcd(A,B)))


### FIXED CODE ###

from fractions import gcd
A,B=map(int,input().split())
x=(A*B)//(gcd(A,B))

print(x)
N = input()
p = []
for i in range(N):
    p.append(input())

print(sum(p)-max(p)//2)



### FIXED CODE ###

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

print(sum(p)-max(p)//2)
n = input()
A = map(int, raw_input().split())
q = input()
M = map(int, raw_input().split())

def solve(i, m):
if m == 0:
   return True
if i >= n or m > sum(A):
   return False
res = solve(i + 1, m) or solve(i + 1, m - A[i])
return res

for m in M:
   if solve(0,m):
      print 'yes'
   else:
      print 'no'

### FIXED CODE ###

n = input()
A = map(int, raw_input().split())
q = input()
M = map(int, raw_input().split())

def solve(i, m):
   if m == 0:
     return True
   if i >= n or m > sum(A):
     return False
   res = solve(i + 1, m) or solve(i + 1, m - A[i])
   return res

for m in M:
  if solve(0,m):
     print "yes"
  else:
     print "no"
K = int(input())

def isRunRun(X):
    x = str(X)
    sa = 0
    for i in range(len(x)-1):
        if abs(int(x[i]) - int(x[i+1])) > 1:
            return False
    return True

if K > 23527:
    num = 99999999
    count = 23527
elif K > 10000:
    num = 22111101
    count = 10000
elif K > 5000:
    num = 110111
    count = 1000
else:
    num = 1
    count = 0

while count < K:
    if isRunRun(num):
        count += 1
    num += 1

print(num-1)

### FIXED CODE ###

# 1行、2変数を受け取るとき
X, Y, Z = map(int, input().split())

print("{} {} {}".format(Z, X, Y))
N, K = map(int, input().split())
costs = list(map(int, input().split())) + [0] * 100010


def chmin(i, j, dp, costs):
    if dp[i+j] > dp[i] + abs(costs[i] - costs[i+j]):
        dp[i+j] = dp[i] + abs(costs[i] - costs[i+j])
        return True
    return False


dp = [float('inf')] * 100010
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        chmin(i, j, dp, costs)

print(dp[N-1])

### FIXED CODE ###

N, K = map(int, input().split())
vals = list(map(int, input().split()))
costs = [0] * 100010
for i in range(len(vals)):
    costs[i] = vals[i]

dp = [float('inf')] * 100010
dp[0] = 0
for i in range(1, N):
    for j in range(1, K+1):
        if i-j >= 0:
            dp[i] = min(dp[i], dp[i-j] + abs(costs[i] - costs[i-j]))

# print(dp)
print(dp[N-1])
A=input()
B=input()
C=input()
s="a"
while (len(a)!=0 or s!="a") and (len(b)!=0 or s!="b") and (len(c)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(a)==0:
    print("A")
elif len(b)==0:
    print("B")
else:
    print("C")


### FIXED CODE ###

A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(A)==0 and s=="a":
    print("A")
elif len(B)==0 and s=="b":
    print("B")
else:
    print("C")
n=int(input())
for i in range(n):
	if i**2+i>=2*n:
		p=i
		break
total=(p*(p+1))//2
for i in range(1,p+1):
	if total-n!=i:
		print(i)

### FIXED CODE ###

n=int(input())
for i in range(n+1):
	if i**2+i>=2*n:
		p=i
		break
total=(p*(p+1))//2
for i in range(1,p+1):
	if total-n!=i:
		print(i)
N, M = map(int, input().split())
S = list(input())
temp = S[0]
ind = 0
cs = [1]
for i in range(N - 1):
  if S[i] == S[i + 1]:
    cs[ind] += 1
  else:
    cs.append(1)
    ind += 1
    temp = S[i + 1]
#print(cs)
cscs = [cs[0]] + [0] * (len(cs))
for i in range(len(cs) - 1):
  cscs[i + 1] = cscs[i] + cs[i + 1]
cscs = [0] + cscs
css = [cs[0]] + [0] * (len(cs))
for i in range(len(cs) - 1):
  css[i + 1] = css[i] + cs[i + 1] - 1
css = [0] + css
#print(css)
#print(cscs)
res = 0
for i in range(max(len(cs) - 2 * M + 1, 1)):
  temp = css[-2] - css[i + 2 * M] + css[max(i - 1, 0)]
  #print(temp,css[-2],css[i + 2 * M],css[max(i - 1, 0)])
  res = max(res, cscs[i + 2 * M] - cscs[i] + temp)
  #print(res - 1, i, i + 2 * M)
if len(css) - 2 <= 2 * M + 1:
  print(N - 1)
else:
  print(res - 1)



### FIXED CODE ###

N, M = map(int, input().split())
S = list(input())
temp = S[0]
ind = 0
cs = [1]
for i in range(N - 1):
  if S[i] == S[i + 1]:
    cs[ind] += 1
  else:
    cs.append(1)
    ind += 1
    temp = S[i + 1]
#print(cs)
cscs = [cs[0]] + [0] * (len(cs))
for i in range(len(cs) - 1):
  cscs[i + 1] = cscs[i] + cs[i + 1]
cscs = [0] + cscs
css = [cs[0]] + [0] * (len(cs))
for i in range(len(cs) - 1):
  css[i + 1] = css[i] + cs[i + 1] - 1
css = [0] + css
#print(css)
#print(cscs)
res = 0
for i in range(len(css) - 2 * M):
  temp = css[-2] - css[i + 2 * M] + css[max(i, 0)]
  #print(temp,css[-2],css[i + 2 * M],css[max(i - 1, 0)])
  res = max(res, cscs[i + 2 * M] - cscs[i] + temp)
  #print(res - 1, i, i + 2 * M)
if len(css) - 2 <= 2 * M + 1:
  print(N - 1)
else:
  print(res - 1)
a,b,c = map(int,input().split())
print("Yes" if c>=a and c<=B else "No")

### FIXED CODE ###

a,b,c = map(int,input().split())
print("Yes" if c>=a and c<=b else "No")
A = int(input())
B = int (input())
print(A * B)

### FIXED CODE ###

#169 値A＊Bを整数として出力せよ。

#1 入力をプログラムで扱えるように受け取ること
a, b = map(int, input().split())
#print(a, b)

#2 受け取った入力値を使って、適切に処理{計算}すること
answer = a * b

#3 計算した結果を出力すること
print(answer)
_ = input()
t, desire = map(int, input().split())
places_h = map(int, input().split())

def desire_delta(place_h, t, desire):
  avg_tmp = t - place_h * 0.006
  return max(desire - avg_tmp, avg_tmp - desire)

res = [(idx, desire_delta(h, t, desire)) for idx, h in enumerate(place_h)]

sorted_res = sorted(res, key=lambda idx, delta: delta)

print(sorted_res[0])


### FIXED CODE ###

_ = input()
t, desire = map(int, input().split())
places_h = map(int, input().split())

def desire_delta(place_h, t, desire):
  avg_tmp = t - place_h * 0.006
  return max(desire - avg_tmp, avg_tmp - desire)

res = [(idx, desire_delta(h, t, desire)) for idx, h in enumerate(places_h)]

sorted_res = sorted(res, key=lambda place: place[1])

print(sorted_res[0][0] + 1)
a,b,c,d = map(int,input().split())

if a < b:
    x = b
if a < b:
    x = a

if c < d:
    y = d
if c > d:
    y = c
print(x*y)

### FIXED CODE ###

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

ri1 = [a,b]
ri2 = [c,d]
ma = -10**20

for i in range(2):
    for j in range(2):
        a = ri1[i]*ri2[j]
        if a > ma:
            ma = a
print(ma)
import math
s = [1 if x == "R" else -1 for x in input()]
ans = [0]*len(s)
i = 0
while i < len(s):
    locate = i
    if locate != len(s)-1:
        while s[locate+1] == s[i]:
            locate += 1
            if locate >= len(s):
                break
    count = locate - i + 1
    tmp = math.ceil(count/2)
    if s[i] == 1:
        ans[locate] += tmp
        ans[locate+1] += count - tmp
    else:
        ans[i] += tmp
        ans[i-1] += count - tmp
    i = locate + 1
print(*ans)


### FIXED CODE ###

import math
s = [1 if x == "R" else -1 for x in input()]
ans = [0]*len(s)
i = 0
while i < len(s):
    locate = i
    if locate < len(s)-1:
        while s[locate+1] == s[i]:
            locate += 1
            if locate >= len(s)-1:
                break
    count = locate - i + 1
    tmp = math.ceil(count/2)
    if s[i] == 1:
        ans[locate] += tmp
        ans[locate+1] += count - tmp
    else:
        ans[i] += tmp
        ans[i-1] += count - tmp
    i = locate + 1
print(*ans)
import sys

N = int(sys.stdin.readline().strip())
X = sys.stdin.readline().strip()

def f(num):
    if num == 0:
        return 0
    elif num == 1 or num == 2:
        return 1
    
    b = bin(num)
    popcnt = b.count('1')
    
    if num % popcnt == 0:
        return 1
    else:
        return f(num % popcnt) + 1

nX = int(X, 2)
pcnt = X.count('1')
nXp = nX%(pcnt+1)
nXm = nX%(pcnt-1)
delta = 2**(N-1)
for i in range(0, N):
    if X[i] == '0':
        if pcnt + 1 == 0:
            print(0)
            continue
        print(f((nXp + (delta%(pcnt+1)))%(pcnt+1)) + 1)
    else:
        print(f((nXm - (delta%(pcnt-1)))%(pcnt-1)) + 1)
        if pcnt - 1 == 0:
            print(0)
            continue
    delta = int(delta/2)

### FIXED CODE ###

import sys

N = int(sys.stdin.readline().strip())
X = sys.stdin.readline().strip()

def popcount(n):
    cnt = 0
    while n > 0:
        cnt += n & 1
        n //= 2
    return cnt

def f(n):
    cnt = 0
    while n != 0:
        n = n % popcount(n)
        cnt += 1
    return cnt

#nX = int(X, 2)
pcnt = X.count('1')
MOD1 = pcnt + 1
MOD2 = pcnt - 1

nXp = 0
nXm = 0

pow1 = [1] * N
pow2 = [0] * N
for i in range(1, N):
    pow1[i] = (pow1[i-1] * 2) % MOD1
if MOD2 != 0:
    pow2[0] = 1
    for i in range(1, N):
        pow2[i] = (pow2[i-1] * 2) % MOD2

for i in range(N):
    if X[i] == '1':
        nXp += pow1[N-1-i]
nXp %= MOD1

if MOD2 != 0:
    for i in range(N):
        if X[i] == '1':
            nXm += pow2[N-1-i]

    nXm %= MOD2
    

for i in range(0, N):
    if X[i] == '0':
        k = (nXp + pow1[N-1-i]) % MOD1
        print(f(k) + 1)
    else:
        if MOD2 == 0:
            print(0)
        else:
            k = (nXm - pow2[N-1-i]) % MOD2
            print(f(k) + 1)
import re
S,T=open(0)
S=S.replace('?','.')
s=len(S)
t=len(T)
B='z'*s
c=0
for i in range(s-t+1):
 if re.search(S[i:i+t],T):A=min(A,(S[:i]+T+S[i+t:]).replace('.','a'));c=1
print(A if c else 'UNRESTORABLE')


### FIXED CODE ###

import re
S,T=open(0)
S=S.replace('?','.')
T=T[:-1]
s=len(S)
t=len(T)
for i in range(s-t,-1,-1):
 if re.match(S[i:i+t],T):print((S[:i]+T+S[i+t:]).replace('.','a'));exit()
print('UNRESTORABLE')
n = int(input())
alist = list(map(int,input().split()))
from collections import Counter
adic = Counter(alist)
count = 0
for key,value in adic:
  if int(key) =< value:
    count+=(value-int(key))
  else:
    count+=value
print(count)

### FIXED CODE ###

n = int(input())
alist = list(map(int,input().split()))
from collections import Counter
adic = Counter(alist)
count = 0
for k,v in adic.items():
  if int(k) <= v:
    count+=(v-int(k))
  else:
    count+=v
print(count)
n = input()
a = input().split()
s = 0
m = a[0]
M = a[0]
for i in range(0,n):
    s = s + a[i]
    if m > a[i]:
        m = a[i]
    if M < a[i]
        M = a[i]
print m,M,s

### FIXED CODE ###

n = int(input())
suretsu = list(map(int,input().split()))

wa = 0
minimum = suretsu[0]
maximum = suretsu[0]

for i in range(n):
    wa += suretsu[i]
    if suretsu[i] > maximum:
        maximum = suretsu[i]
    if suretsu[i] < minimum:
        minimum = suretsu[i]
    
print (minimum,maximum,wa)
x,n=map(int,input().split())
p=list(map(int,input().split()))
c=0
ans=[]
if n==0:
    print(0)
else:
    for i in range(1,101):
        if x-i not in p:
            ans.append(x-i)
            c+=1
        elif x+i not in p:
            ans.append(x+i)
            c+=1
        if c!=0:
            break
print(min(ans))

### FIXED CODE ###

x,n=map(int,input().split())
p=list(map(int,input().split()))
if n==0:
    print(x)
else:
    for i in range(0,101):
        if x-i not in p:
            print(x-i)
            break
        elif x+i not in p:
            print(x+i)
            break
import math
n = int(input())
a = list(map(int, input().split()))
work = math.round(sum(a)/n, 0) 
result = 0
for el in a:
    result += (work-el)**2
print(result)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
work = sum(a)/n
work = int(work) if work-int(work)<0.5 else int(work)+1
result = 0
for el in a:
    result += (work-el)**2
print(result)
def insertionSort(A, n, g):
    global cnt 

    for i in range(g,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt+=1
        A[j+g] = v

def shellSort(A, n):
    global cnt
    cnt = 0
    #g = 3
    #g = n // 2 * 2
    g = 2
    #m = max(n // g,1)
    #m = min(m, 100)
    #print(m)  # 1行目
    #G = list(range(g*m,g,-g))
    G = [1]
    for i in range(1,101):
        # gの2乗分ずつGのリスト値を変えていく
        # mは結果のリストから取得 
        #print("g**i:{} ,n:{}".format(g**i, n))
        if g**i <= n:
            m = i+1
            G.append(g**i)
            g += 1
        else:
            break
    G.reverse() 
    print(m)  # 1行目
    print(" ".join(list(map(str,G))))  # 2行目
    for i in range(0,m):
        insertionSort(A, n, G[i])
    print(cnt)  # 3行目
    for i in range(0,len(A)):
        print(A[i]) # 4行目以降

cnt = 0
n = int(input())
A = []
for i in range(n):
    A.append(int(input()))

shellSort(A,n)


### FIXED CODE ###

def insertionSort(A, n, g):
    global cnt 

    for i in range(g,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt+=1
        A[j+g] = v

def shellSort(A, n):
    global cnt
    cnt = 0
    g = 1
    G = [1]
    m = 1
    for i in range(1,101):
        tmp = G[i-1]+(3)**i
        if tmp <= n:
            m = i+1
            G.append(tmp)
            g += 1
        else:
            break
    G.reverse() 
    print(m)  # 1行目
    print(" ".join(list(map(str,G))))  # 2行目

    for i in range(0,m):
        insertionSort(A, n, G[i])
    print(cnt)  # 3行目
    for i in range(0,len(A)):
        print(A[i]) # 4行目以降

cnt = 0
n = int(input())
A = []
for i in range(n):
    A.append(int(input()))
shellSort(A,n)
R= input()
print(R*3.14*2)

### FIXED CODE ###

import math
R = int(input())
print(2*math.pi*R)
import sys

v = []
for line in sys.stdin:
  v.append(int(line))

if v[1] % v[0] == 0:
  print(v[1] + v[0])
else:
  print(v[0] - v[1])

### FIXED CODE ###

import sys

v = []
for line in sys.stdin:
  v = [int(l) for l in line.split()]

if v[1] % v[0] == 0:
  print(v[0] + v[1])
else:
  print(v[1] - v[0])
N,M = map(int,input().split())

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+1)
ACed = [0]*(N+1)

for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        WA[num] += 1
    else:
        ACed[num] = 1

print(sum(ACed),end=" ")
print(sum(WA))

### FIXED CODE ###

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+N)
ACed = [0]*(N+M)
tmp_num = [0]*(M+N)
tmp = 0
for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        tmp_num[num] += 1
    elif RES[i][1] == "WA" and ACed[num]:
        tmp += 1
    else:
        ACed[num] = 1
        WA[num] = tmp_num[num]

print(sum(ACed),end=" ")
print(sum(WA))
import bisect
s = list(input())
t = list(input())
n = len(s)
m = len(t)
alphabet = [[] for _ in range(26)]
for i in range(n):
  alphabet[ord(s[i])-ord('a')+1] += [i] 

loop = 0
pre = -1
for i in range(m):
  c = ord(t[i]) - ord('a') + 1
  if len(alphabet[c]) == 0:
    print(-1)
    exit()
  idx = bisect.bisect_left(alphabet[c], pre+1)
  if idx == len(alphabet[c]):
    loop += 1
    pre = alphabet[c][0]
  else:
    pre = alphabet[c][idx]

print(pre + loop * n + 1)



### FIXED CODE ###

import bisect
s = list(input())
t = list(input())
n = len(s)
m = len(t)
alphabet = [[] for _ in range(26)]
for i in range(n):
  alphabet[ord(s[i])-ord('a')] += [i] 
loop = 0
pre = -1
for i in range(m):
  c = ord(t[i]) - ord('a')
  if len(alphabet[c]) == 0:
    print(-1)
    exit()
  idx = bisect.bisect_left(alphabet[c], pre+1)
  if idx == len(alphabet[c]):
    loop += 1
    pre = alphabet[c][0]
  else:
    pre = alphabet[c][idx]

print(pre + loop * n + 1)
def candy():
   n=int(input())
    a=0
    for i in range (0,n)
       a=a+1
    print(a)
    
candy(10)
       

### FIXED CODE ###

def candy():
  n=int(input())
  a=0
  for i in range (1,n+1):
    a=a+i

  print(a)
    

candy()
s=input()
w=str()
b=str()
cnt1=0
cnt2=0
for i in range(n):
    if i%2==0:
        w+='1'
        b+='0'
    else:
        w+='0'
        b+='1'
for i in range(n):
    if s[i]!=w[i]:
        cnt1+=1
    if s[i]!=b[i]:
        cnt2+=1
print(min(cnt1,cnt2))

### FIXED CODE ###

s=input()
w=str()
b=str()
cnt1=0
cnt2=0
for i in range(len(s)):
    if i%2==0:
        w+='1'
        b+='0'
    else:
        w+='0'
        b+='1'
for i in range(len(s)):
    if s[i]!=w[i]:
        cnt1+=1
    if s[i]!=b[i]:
        cnt2+=1
print(min(cnt1,cnt2))
n = input()
summ = 0
lst = list(map(int, input().split()))
for i in range(len(lst) - 1):
    if lst[i] > lst[i + 1]:
        k = lst[i] - lst[i + 1]
        lst.replace(lst[i + 1], lst[i + 1] + k)
        summ += k
print(summ)

### FIXED CODE ###

n = input()
summ = 0
lst = list(map(int, input().split()))
for i in range(len(lst) - 1):
    if lst[i] > lst[i + 1]:
        k = lst[i] - lst[i + 1]
        lst[i + 1] = lst[i + 1] + k
        summ += k
print(summ)
n, k = map(int, input().split())
w = max((n-k+1) / n, 0)
coin_win = 0
for i in range(1, min(k, n+1)):
    for x in range(1, 18):
        if i * (2 ** x) >= k:
            coin_win += 1 / (2 ** x)
            break
print(w + (1-w) * coin_win / min(k-1, n))

### FIXED CODE ###

n, k = map(int, input().split())
w = max((n-k+1) / n, 0)
coin_win = 0
for i in range(1, min(k, n+1)):
    for x in range(1, 18):
        if i * (2 ** x) >= k:
            coin_win += 1 / (2 ** x)
            break
if k != 1:
    print(w + (1-w) * coin_win / min(k-1, n))
else:
    print(w)