Harryxun/stf_run huggingface dataset:
n = int(input())
A = list(map(int,input().split()))
f = 1 
c = 0
while f == 1:
    f = 0
    for j in range(n-1,0,-1):
	if A[j] < A[j-1]:
            inc = A[j]
	    A[j] = A[j-1] 
	    A[j-1] = inc
	    f = 1
	    c += 1
print(" ".join(map(str,A)))
print(c)

### FIXED CODE ###

def bubblesort(a):
    count = 0
    swap = True
    while swap:
        swap = False
        for j in range(1,len(a))[::-1]:
            if a[j] < a[j-1]:
                ret = a[j]
                a[j] = a[j-1]
                a[j-1] = ret
                count += 1
                swap = True           
    print(" ".join(map(str,a)))
    print(count)
    
n = int(input())
a = list(map(int,input().split()))
bubblesort(a)
n = int(input())
s = input()
t = ''
abc = [chr(i) for i in range(65, 65+26)]
for i in s:
  m = abc.index(i)
  if m+n <= 25:
    t += abc[m+n]
  else:
    t += abc[m+n-25]
print(t)

### FIXED CODE ###

n = int(input())
s = input()
t = ''
abc = [chr(i) for i in range(65, 65+26)]
for i in s:
  m = abc.index(i)
  if m+n <= 25:
    t += abc[m+n]
  else:
    t += abc[m+n-26]
print(t)
import itertools

N,A,B,C=map(int,input().split())
L=[int(input()) for i in range(N)]

def score(x,NOW):
    L=len(NOW)
    ITE=list(itertools.product([0,1],repeat=L))

    ANS=10**15
    CANDI=[]

    for ite in ITE:
        if max(ite)==0:
            continue
        SUM=sum([NOW[i] for i in range(L) if ite[i]==1])        
        MAGIC=(ite.count(1)-1)*10
        

        if ANS>MAGIC+abs(x-SUM):
            ANS=MAGIC+abs(x-SUM)
            CANDI=ite

    return ANS,[NOW[i] for i in range(L) if CANDI[i]==0]

X=[[A,B,C],[A,C,B],[B,A,C],[B,C,A],[C,A,B],[C,B,A]]
ANS=10**15

for x in X:
    ANS1,L1=score(x[0],L)
    ANS2,L2=score(x[1],L1)
    ANS3,L3=score(x[2],L2)

    #print(ANS,ANS1,ANS2,ANS3,L1,L2,L3,A,B,C)

    if ANS>ANS1+ANS2+ANS3:
        ANS=ANS1+ANS2+ANS3

print(ANS)

### FIXED CODE ###

import itertools

N,A,B,C=map(int,input().split())
L=[int(input()) for i in range(N)]

def score(x,NOW):
    L=len(NOW)
    ITE=list(itertools.product([0,1],repeat=L))

    ANS=10**15
    CANDI=[]

    for ite in ITE:
        if max(ite)==0:
            continue
        SUM=sum([NOW[i] for i in range(L) if ite[i]==1])        
        MAGIC=(ite.count(1)-1)*10
        

        if ANS>MAGIC+abs(x-SUM):
            ANS=MAGIC+abs(x-SUM)
            CANDI=ite

    return ANS,[NOW[i] for i in range(L) if CANDI[i]==0]

X=[[A,B,C],[A,C,B],[B,A,C],[B,C,A],[C,A,B],[C,B,A]]
ANS=10**15

for x in X:
    ANS1,L1=score(x[0],L)
    if len(L1)==0:
        continue
    ANS2,L2=score(x[1],L1)
    if len(L2)==0:
        continue
    ANS3,L3=score(x[2],L2)

    #print(ANS,ANS1,ANS2,ANS3,L1,L2,L3,A,B,C)

    if ANS>ANS1+ANS2+ANS3:
        ANS=ANS1+ANS2+ANS3

print(ANS)
n=int(input())
k=int(input())
x=int(input())
y=int(input())

if n =< k:
  print(x * n)
else:
  print(k * x + (n - x) * y)

### FIXED CODE ###

n=int(input())
k=int(input())
x=int(input())
y=int(input())

if n <= k:
  print(x * n)
else:
  print(k * x + (n - k) * y)
def popularity(votes, N, M):
    
    total_votes = sum(votes)
    limit = total_votes / (4.0 * M)
    
    cnt = 0
    for vote in votes:
        if vote >= limit:
            cnt += 1
    	if cnt >= M:
			return "Yes"
    
    return "No"
  
N, M = [int (x) for x in input().split()]
votes = [int (x) for x in input().split()]
print(popularity(votes, N, M))


### FIXED CODE ###

def popularity(votes, N, M):
    
    total_votes = sum(votes)
    limit = total_votes / (4.0 * M)
    
    cnt = 0
    for vote in votes:
        if vote >= limit:
            cnt += 1
    
    if cnt >= M:
        return "Yes"
    
    return "No"
  
N, M = [int (x) for x in input().split()]
votes = [int (x) for x in input().split()]
print(popularity(votes, N, M))
while True:
	li= list(map(int, input().split()))
	li.sort()
	if li =[0,0]:
		break
	print(*li)


### FIXED CODE ###

while True:
	x,y=sorted(map(int,input().split()))
	if x==0 and y==0:
		break
	print(x, y)
n = int(input())
w = list(map(int,input().split()))
l=[]
for i in range(n):
    s_1=sum(w[:i])
    s_2=sum(w[i+1])
    l.append(abs(s_1,s_2))
print(min(l))

### FIXED CODE ###

n = int(input())
w = list(map(int,input().split()))
l=[]
for i in range(n):
    s_1=sum(w[:i])
    s_2=sum(w[i:])
    l.append(abs(s_1-s_2))
print(min(l))
T=int(input()
for _ in range(T):      
    N = int(input())
    A = list(map(int, input().split()))
    S = list(map(int, input()))

    for i in range(N-1, -1, -1):
        ai = A[i]
        if ai==0:
            continue
        top = ai.bit_length() - 1

        #assert ai & 1<<top
        for j in range(i-1, -1, -1):
            if A[j] >> top & 1:
                A[j] ^= ai
    print(A,S)
    for a, c in zip(A[::-1], S[::-1]):
        if c==1 and a:
            break
    else:
        print("0")
        continue
    print("1")

### FIXED CODE ###

T=int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    S = list(map(int, input()))

    for i in range(N-1, -1, -1):
        ai = A[i]
        if ai==0:
            continue
        top = ai.bit_length() - 1

        #assert ai & 1<<top
        for j in range(i-1, -1, -1):
            if A[j] >> top & 1:
                A[j] ^= ai
    #print(A,S)
    for a, c in zip(A[::-1], S[::-1]):
        if c==1 and a:
            break
    else:
        print("0")
        continue
    print("1")
def fib(n):
    l = [0] * (n+1)
    l[0] = 1
    l[1] = 1
    for i in range(2,n+1):
        l[i] = l[i-2] + l[i-1]
    return l[i]

print(fib(int(input())))



### FIXED CODE ###

def fib(n):
    if n ==0 or n == 1:
        return 1
    l = [0] * (n+1)
    l[0] = 1
    l[1] = 1

    for i in range(2,n+1):
        l[i] = l[i-2] + l[i-1]
    return l[i]

print(fib(int(input())))
import sys

input = sys.stdin.readline


def check(n, nums):
    kind = set(nums)

    if len(kind) not in (1, 2, 3):
        return False

    if len(kind) == 1 and 0 in kind:
        return True
    if n % 3 != 0:
        return False
    if len(kind) == 3:
        if len(set([nums.count(k) for k in kind])) != 1:
            return False
        kind = list(kind)
        if kind[0] ^ kind[1] ^ kind[2] == 0:
            return True
        else:
            return False
    else:
        a, b = kind
        a_c, b_c = nums.count(a), nums.count(b)
        if 0 not in kind:
            return False
        elif n / 3 != nums.count(0):
            return False
        else:
            return True


def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]
    print("Yes" if check(n, a_list) else "No")


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

input = sys.stdin.readline


def check(n, nums):
    kind = set(nums)
    if len(kind) > 3:
        return False
    if len(kind) == 1 and 0 in kind:
        return True
    if n % 3 != 0:
        return False
    if len(kind) == 3:
        a, b, c = kind
        return nums.count(a) == nums.count(b) == nums.count(c) and a ^ b ^ c == 0
    else:
        return 0 in kind and n / 3 == nums.count(0)


def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]
    print("Yes" if check(n, a_list) else "No")
    # 0 0 0
    # 1 0 1 1 0 1
    # 1 2 3


if __name__ == "__main__":
    main()
N=int(input())
if(N<105):
  print(0)
elif(105<=N<135):
  print(1)
elif(135<=N<165):
  print(2)
elif(165<=N<189):
  print(3)
elif(189<=N<195):
  print(4)
else:
  print(5)

### FIXED CODE ###

A,B=map(int,input().split())
print((A-1)*(B-1))
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 累積和、dp、しゃくとり
MOD = 998244353
N, S = lr()
A = lr()
# dp[k][j] kから始めた合計の個数
dp = np.array([[0] * 3000 for _ in range(N)])
dp[:, 0] = 1
answer = 0
cur = [0] * (N)
for i, a in enumerate(A):
    # iが現在地
    for j in range(i+1):
        dp[j][a:] += dp[j][:-a]
        temp = dp[j][S] - cur[j]
        answer += temp * (N-i)
        cur[j] = dp[j][S]
        #print(i, j, answer, temp, dp[j][S])
    answer %= MOD

print(answer % MOD)


### FIXED CODE ###

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 998244353
N, S = lr()
A = lr()
dp = [0] * (S+1)
answer = 0
for a in A:
    dp[0] += 1 # Lの数は１個ずつ加わる
    prev = dp.copy()
    for i in range(S-a+1):
        dp[i+a] += prev[i]
    answer += dp[-1] # その位置Rとした時

print(answer % MOD)
# 26
N = int(input())
A = [int(i) for i in input().split()]

def f(i,j):
  a = 0
  if not 2*j-1 <= i <= 2*j+1+(N-2*int(N/2)):
    a = 0
  elif i == 1 and j == 0:
    a = 0
  elif i == 1 and j == 1:
    a = A[0]
  elif i == 2 and j == 1:
    a = max(A[0],A[1])
  elif i == 2 and j == 0:
    a = 0
  else:
    a = max(f(i-2,j-1)+A[i-1],f(i-1,j))
  return a

print(f(N,int(N/2)))

### FIXED CODE ###

import math

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

B = [{} for _ in range(N+1)]


for i in range(1,N+1):
  if i == 1:
    B[1][0] = 0
    B[1][1] = A[0]
  elif i == 2:
    B[2][1] = max(A[0],A[1])
    if N % 2 == 1:
      B[2][0] = 0
  else:
    if N % 2 == 0:
      for j in range(math.ceil((i-1)/2),(i+1)//2+1):
        m1 = B[i-2][j-1]+A[i-1] if j-1 in B[i-2] else -float('inf')
        m2 = B[i-1][j] if j in B[i-1] else -float('inf')
        B[i][j] = max(m1,m2)
    else:
      for j in range(math.ceil((i-2)/2),(i+1)//2+1):
        m1 = B[i-2][j-1]+A[i-1] if j-1 in B[i-2] else -float('inf')
        m2 = B[i-1][j] if j in B[i-1] else -float('inf')
        B[i][j] = max(m1,m2)
      

print(B[N][N//2])
a, b = map(int, input().split())

horizontal_length = b * 2

uncovered_part = a - horizontal_length

if uncovered_part > 0:
  return
else:
  uncovered_part = 0
  
print str(uncovered_part)
  

### FIXED CODE ###

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

horizontal_length = b * 2

uncovered_part = a - horizontal_length

if uncovered_part < 0:
  uncovered_part = 0
  
print(str(uncovered_part))
N  = int(input())
t = [0]*100000
x= [0]*100000
y= [0]*100000

for n in range(N):
        t[n],x[n],y[n] = (map(int, input().split()))

can = True

for i in range(N):
    dt = t[i+1] - t[i]
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if dt < dist:
        can = False
    if (dist % 2 != dt % 2):
        can = False

if can == True:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

N = int(input())
T = [0]*100000
X= [0]*100000
Y= [0]*100000
x = 0
y = 0

for n in range(N):
        T[n],X[n],Y[n] = (map(int, input().split()))

flag = 1
for n in range(N):
    #print(n)
    if flag == 0:
        continue


    if n == 0:
        count = T[n]
    else:
        count = T[n] - T[n-1]
        x = X[n-1]
        y = Y[n-1]
    c = 0
    end = 0
    while True:
        if end == 1:
            break
        s_x = X[n] - x
        s_y = Y[n] - y
    #    print(str(s_x)+' '+str(s_y))

        if ((s_x != 0 or s_y !=0) )and (c!=count):
            if s_x >0:
                x +=1
                c += 1
            elif s_x < 0:
                x -= 1
                c+=1
            elif s_y > 0:
                y +=1
                c += 1
            elif s_y < 0:
                y -= 1
                c+=1
        elif  ((s_x == 0 and s_y == 0) )and (c!=count):
                x +=1
                c +=1
        elif c==count:
            if (x == X[n] and y ==Y[n]):
                flag = 1
                end=1
            else:
                flag=0
                end =1



if flag == 1:
    print('Yes')
else:
    print('No')
h,w,m=map(int,input().split())
hw=[[0]*w for i in range(h)]
for i in range(m):
    hi,wi=map(int,input().split())
    hw[hi-1][wi-1]=1    

ws=[0]*h
for i in range(h):
    ws[i]=0
    for j in range(w):
        ws[i]+=hw[i][j]
hs=[0]*w
for j in range(w):
    hs[j]=0
    for i in range(h):
        hs[j]+=hw[i][j]
        
hwmax=0
for i in range(h):
    for j in range(w):
        if hw[i][j]==1:
            x=ws[i]+hs[j]-1
        else:
            x=ws[i]+hs[j]
#        print(i,j,x)
        hwmax=max(hwmax,x)
        
print(hwmax)
            


### FIXED CODE ###


import sys
input=sys.stdin.readline

h,w,m=map(int,input().split())
hs=dict()
ws=dict()
hw=set()
for i in range(m):
    hi,wi=map(int,input().split())
    if hi-1 in ws:
        ws[hi-1]+=1
    else:
        ws[hi-1]=1
    if wi-1 in hs:
        hs[wi-1]+=1
    else:
        hs[wi-1]=1
    hw.add((hi-1,wi-1))    

wmax=max(list(ws.values()))
hh=[]
for ik,wv in ws.items():
    if wv==wmax:
        hh.append(ik)
hmax=max(list(hs.values()))
ww=[]
for jk,hv in hs.items():
    if hv==hmax:
        ww.append(jk)
        
for hi in hh:
    for wi in ww:
        if  not ((hi,wi) in hw):
#            print(hi,wi)
            print(wmax+hmax) 
            sys.exit()
print(wmax+hmax-1)
a,b,c=map(int, input().split())
if a<b && b<c: print("Yes")
else: print("No")

### FIXED CODE ###

a,b,c=map(int, input().split())
if a<b<c: print("Yes")
else: print("No")
import sys
sys.setrecursionlimit(10**6)
n = input()
G = [[] for i in xrange(n)]
for i in xrange(n-1):
    s, t, w = map(int, raw_input().split())
    G[s].append((t, w))
    G[t].append((s, w))

def dfs(s, prev):
    if prev != -1 and len(G[s]) == 1:
        return (0, s)
    res = (0, -1)
    for t, w in G[s]:
        if t == prev:
            continue
        cost, v = dfs(t, s)
        res = max(res, (cost + w, v))
    return res
co, t = dfs(0, -1)
if t != -1:
    print dfs(t, -1)[0]
else:
    print 0

### FIXED CODE ###

N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    s, t, w = map(int, input().split())
    G[s].append((t, w))
    G[t].append((s, w))

from collections import deque
def bfs(s):
    dist = [None]*N
    que = deque([s])
    dist[s] = 0
    while que:
        v = que.popleft()
        d = dist[v]
        for w, c in G[v]:
            if dist[w] is not None:
                continue
            dist[w] = d + c
            que.append(w)
    d = max(dist)
    return dist.index(d), d
u, _ = bfs(0)
v, d = bfs(u)

print(d)
N = int(input())
S = input()

West = []
East = []
count = 1
if S[0] == "W":
    WE = "W"
else:
    WE = "E"
for i in range(1, N):
    if S[i] == WE:
        count += 1
    else:
        if S[i] == "W":
            East.append(count)
            WE = "W"
        else:
            West.append(count)
            WE = "E"
        count = 1
if S[N-1] == "E":
    East.append(count)
else:
    West.append(count)

print(min(sum(West) - max(East) + 1, sum(East) - max(West) + 1))


### FIXED CODE ###

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

leader = S[0]
right = 0
left = 0

for i in range(1, N):
    if S[i] == "W":
        right += 1
        
result = right

for i in range(1, N):
    if S[i-1] == "E":
        left += 1
    if S[i] == "W":
        right -= 1
    result = max(result, right+left)
    
print(N - result - 1)
n, m = map(int, input().split())
datalist = [0 for i in range(n)]
ans = 0
root = [[] for i in range(n)]
for i in range(m):
    x, y, z = map(int, input().split())
    root[x - 1].append(y - 1)
    root[y - 1].append(x - 1)

def solve(now):
    global ans, root
    if datalist[now] == 0:
        ans += 1
    datalist[now] = 1
    for j in range(len(root[now])):
        if not datalist[root[now][j]]:
            datalist[root[now][j]] = 1
            solve(root[now][j])

for i in range(n):
    if not datalist[i]:
        #print(i,i,i)
        solve(i)

for i in datalist:
    if i == 0:
        ans += 1

#print(datalist)
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)

def visit_tree(now, num):
    visited[now] = num
    for i in range(len(tree[now])):
        if not visited[tree[now][i]]:
            visit_tree(tree[now][i], num)

n, m = map(int, input().split())
tree = [[] for _ in range(n)]
for i in range(m):
    x, y, z = map(int, input().split())
    tree[x - 1].append(y - 1)
    tree[y - 1].append(x - 1)

visited = [0 for _ in range(n)]
num = 0
for i in range(n):
    if not visited[i]:
        num += 1
        visit_tree(i, num)

print(num)
def cin():  return list(map(int,input().split()))

N = cin()[0]
a = cin()
b = [0 for _ in range(9)]
for i in range(N):
    ind = min(8, a[i] // 400)
    if ind <= 7:  b[ind] = 1
    else:  b[ind] += 1
ma = sum(b)
if cnt == N:  mi = sum(b[:-1])
else:  mi = 1
print(mi, ma)

### FIXED CODE ###

def cin():  return list(map(int,input().split()))

N = cin()[0]
a = cin()
b = [0 for _ in range(9)]
for i in range(N):
    ind = min(8, a[i] // 400)
    if ind <= 7:  b[ind] = 1
    else:  b[ind] += 1
ma = sum(b)
if b[ind] < N:  mi = sum(b[:-1])
else:  mi = 1
print(mi, ma)
N, X, T = map(int, input.split())
print((N + X - 1) / X * T)

### FIXED CODE ###

N, X, T = map(int, input().split())
print((N + X - 1) // X * T)
import math
import sys
input = sys.stdin.readline
N=int(input())
d={}
for i in [0]*N:
 s = ''.join(sorted(input().strip()))
 if s in d:
  d[s]+=1
 else:
  d[s]=1
e=0
for v in d.values():
 if v>=2:
  e+=int(math.factorial(v)/2)
print(e)


### FIXED CODE ###

import math
import sys
input = sys.stdin.readline
N=int(input())
d={}
for i in [0]*N:
 s = ''.join(sorted(input().strip()))
 if s in d:
  d[s]+=1
 else:
  d[s]=1
e=0
for v in d.values():
 if v>=2:
  e+=int(v*(v-1)/2)
print(e)
X,K,D = map(int,input().split())

m = X//D
if K >= m:
  if m%2 == K%2:
    print(abs(X%D))
  else:
    print(min(abs(X%D+D), abs(X%D-D)))
else:
  print( min( abs(X-D*K) , abs(X+D*K)

### FIXED CODE ###

X,K,D = map(int,input().split())
X = abs(X)

if X - (D*K) >= 0:
  print(X-D*K)
else:
  k = K - (X//D)
  if k % 2 == 0:
    print(X%D)
  else:
    print(min(abs(X%D+D), abs(X%D-D)))
#encoding:utf-8

import math
import sympy

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

facters = sympy.factorint(P)

ans = 1
for key in facters.keys():
    if facters[key]/N >= 1:
        ans *= key**(facters[key]//N)
print(int(ans))


### FIXED CODE ###

# encoding:utf-8
import copy
import numpy as np
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

A,B,C,D,E,F = map(int,input().split())

water = []
for ai in range(int(F/(A*100))+1):
    for bi in range(int(F/(B*100))+1):
        if (ai*A+bi*B)*100>F:pass
        else:
            water.append((ai*A+bi*B)*100)

suger = []
for ci in range(int(F/C)+1):
    for di in range(int(F/D)+1):
        if ci*C+di*D > F:
            pass
        else:suger.append(ci*C+di*D)

water = list(set(water))
suger = list(set(suger))
water.remove(0)
pure = 0
ans_s,ans_w = 0,A*100
for wi in range(len(water)):
    for si in range(len(suger)):
        if water[wi]+suger[si]>F:pass
        else:
            if pure<suger[si]/(water[wi]+suger[si])<=(E/(100+E)):
                ans_s = suger[si]
                ans_w = water[wi]
                pure = suger[si]/(water[wi]+suger[si])

print(ans_s+ans_w,end="")
print(" ",end="")
print(ans_s)
import fractions
a, b, c, d = list(map(int, input().split()))
e = c * d // fractions.gcd(c, d)

cko = b//c - (a-1)//c
dko = b//d - (a-1)//d
eko = b//e - (a-1)//e
print(b-a+1-cko-dko+eko)

### FIXED CODE ###

S = input()
if "11" in S or "22" in S or "33" in S or \
   "44" in S or "55" in S or "66" in S or \
   "77" in S or "88" in S or "99" in S or "00" in S :
    print("Bad")
else :
    print("Good")
import math
[A,B,H,M] = list(map(int,input().split()))

tm = 60*H + M
#print('time', tm)
#進んだ距離
Dji = 0.5 * tm
Dhu = 6 * tm
#print('1', Dji,Dhu)
'''
#げんじつ感のある角度に
Dji2 = Dji % 180
Dhu2 = Dhu % 180
#print('2', Dji2,Dhu2)

#間の角度
kaku = abs(Dji2 - Dhu2)
#print('kakudo',kaku)
'''
Dji2 = Dji % 360
Dhu2 = Dhu % 360
#print('2', Dji2,Dhu2)

if abs(Dji2 - Dhu2) <=180:
    kaku = abs(Dji2 - Dhu2)
else:
    kaku = 360 - abs(Dji2 - Dhu2)


#余弦定理
if kaku ==0:
    out = Dhu - Dji

if kaku == 180:
    out == Dhu + Dji
else:
    out = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(kaku)))


print(out)

### FIXED CODE ###


import math
[A,B,H,M] = list(map(int,input().split()))

tm = 60*H + M
#print('time', tm)
#進んだ距離
Dji = 0.5 * tm
Dhu = 6 * tm
#print('1', Dji,Dhu)
'''
#げんじつ感のある角度に
Dji2 = Dji % 180
Dhu2 = Dhu % 180
#print('2', Dji2,Dhu2)

#間の角度
kaku = abs(Dji2 - Dhu2)
#print('kakudo',kaku)
'''
Dji2 = Dji % 360
Dhu2 = Dhu % 360
#print('2', Dji2,Dhu2)

if abs(Dji2 - Dhu2) <=180:
    kaku = abs(Dji2 - Dhu2)
else:
    kaku = 360 - abs(Dji2 - Dhu2)


#余弦定理
if kaku ==0:
    out = B - A

if kaku == 180:
    out = B + A
else:
    out = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(kaku)))


print(out)
n = int(input())
alist = [input() for i in range(n)]
for i in range(n):
  for j in range(i+1,n):
    if alist[i] == alist[j]:
      print("No")
      exit()
for i in range(n):
  if all(alist[i][-1]==alist[i+1][0]):
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n = int(input())
alist = [input() for i in range(n)]
 
if len(set(alist))==n:
  if all(alist[i][-1]==alist[i+1][0] for i in range(n-1)):
    print("Yes")
    exit()
print("No")
a = list(input())
if a[0] == a[1] and a[1] == a[2]:
  print(Yes)
elif a[1] == a[2] and a[2] == a[3]:
  print(Yes)
else:
  print("No")
  

### FIXED CODE ###

a = list(input())
if a[0] == a[1] and a[1] == a[2]:
  print("Yes")
elif a[1] == a[2] and a[2] == a[3]:
  print("Yes")
else:
  print("No")
import collections

s = input()

c = collections.Counter(s)

for i in c:
  if c[i]%2!=0:
    print('No')
    sys.exit()
    
print('Yes')

### FIXED CODE ###

import collections
import sys 

s = input()

c = collections.Counter(s)

for i in c:
  if c[i]%2!=0:
    print('No')
    sys.exit()
    
print('Yes')
def popcount(n):
    ret=0
    while n>0:
        if n%2==1:
            ret+=1
        n//=2
    return ret

def f(n):
    ret=0
    while True:
        n%=popcount(n)
        if n==0:
            ret+=1
            break
        else:
            ret+=1
    return ret

N=int(input())
X=input()
base=0
for i in range(len(X)):
    x=int(X[-(i+1)])
    if x==1:
        base+=2**i

for i in range(len(X),0,-1):
    if X[-i]=='1':
        tmp=base-2**(i-1)
    else:
        tmp=base+2**(i-1)
    print(f(tmp))

### FIXED CODE ###

def popcount_int(n):
    return bin(n).count('1')

def popcount_bin(s):
    return s.count('1')

def poptimes(n,cnt=1):
    if n==0:
        return cnt
    else:
        n%=popcount_int(n)
        cnt+=1
        return poptimes(n,cnt)

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

S_int=int(S,2)
pc=popcount_bin(S)
pc_plus=S_int%(pc+1)
if pc!=1:
    pc_minus=S_int%(pc-1)

for i in range(N):
    if S[i]=='1':
        if pc!=1:
            tmp=pc_minus-pow(2,N-i-1,pc-1)
            print(poptimes(tmp%(pc-1)))
        else:
            print(0)
            continue
    else:
        tmp=pc_plus+pow(2,N-i-1,pc+1)
        print(poptimes(tmp%(pc+1)))
def maxreturn(t,n,a):
    ma=[0]*n
    b=[0]*n
    if t==n-1:
        for i in range(3):
           ma[i]=a[n-1][i]
    else:
      b=list(maxreturn(t+1,n,a))
      for i in range(3):
        for j in range(3):
            if i!=j:
                ma[i]=max(ma[i],a[t][i]+b[j])
                
    return ma
n=int(input())
a=[[0]*3]*n
for i in range(n):
    a[i]=list(map(int,input().split()))
ma=maxreturn(0,n,a)
print(max(ma))

### FIXED CODE ###

n=int(input())
a=[[0]*3]*n
for i in range(n):
    a[i]=list(map(int,input().split()))
b=[0]*3
for i in range(n-2,-1,-1):
    for j in range(3):
        t=0
        for k in range(3):
            if j!=k:
                t=max(t,a[i][j]+a[i+1][k])
        a[i][j]=t
print(max(a[0]))
N=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(N):
    B.append(A[i]-(i+1))
B.sort()
b=B[N/2]
ans=0
for i in B:
    ans+=abs(i-b)
print(ans)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(N):
    B.append(A[i]-(i+1))
B.sort()
b=B[N//2]
ans=0
for i in B:
    ans+=abs(i-b)
print(ans)