Harryxun/stf_run huggingface dataset:
def f(x,y,z):
    if x=="S" and y=="o":
        return z
    if x=="S" and y=="x":
        return g(z)
    if x=="W" and y=="o":
        return g(z)
    if x=="W" and y=="x":
        return z
def g(x):
    if x=="S":
        return "W"
    if x=="W":
        return "S"
def check(x,y):
    t[0]=x
    t[1]=y
    for j in range(1,N-1):
        t[j+1] = f(t[j],s[j],t[j-1])
    x1 = f(t[N-1],s[N-1],t[N-2])
    y1 = f(x1,s[0],t[N-1])
    if x==x1 and y==y1:
        return True
    else:
        return False
N = int(input())
s = input().strip()
t = [0 for _ in range(N)]
if s[0]=="o":
    if check("S","S"):
        print("".join(t))
    elif check("S","W"):
        print("".join(t))
    elif check("W","S"):
        print("".joint(t))
    elif check("W","W"):
        print("".join(t))
    else:
        print(-1)
else:
    if check("S","S"):
        print("".join(t))
    elif check("S","W"):
        print("".join(t))
    elif check("W","S"):
        print("".joint(t))
    elif check("W","W"):
        print("".join(t))
    else:
        print(-1)

### FIXED CODE ###

def f(x,y,z):
    if x=="S" and y=="o":
        return z
    if x=="S" and y=="x":
        return g(z)
    if x=="W" and y=="o":
        return g(z)
    if x=="W" and y=="x":
        return z
def g(x):
    if x=="S":
        return "W"
    if x=="W":
        return "S"
def check(x,y):
    t[0]=x
    t[1]=y
    for j in range(1,N-1):
        t[j+1] = f(t[j],s[j],t[j-1])
    x1 = f(t[N-1],s[N-1],t[N-2])
    y1 = f(x1,s[0],t[N-1])
    if x==x1 and y==y1:
        return True
    else:
        return False
N = int(input())
s = input().strip()
t = [0 for _ in range(N)]
if check("S","S"):
    print("".join(t))
elif check("S","W"):
    print("".join(t))
elif check("W","S"):
    print("".join(t))
elif check("W","W"):
    print("".join(t))
else:
    print(-1)
N = int(input())
uvw = [[int(x) for x in input().split()] for _ in range(N-1)]

par = [i for i in range(N)]
dist = [0]*N

def root(x):
    if(par[x]==x):
        return x
    else:
        return root(par[x])

def unite(x,y,z):
    rx = root(x)
    ry = root(y)
    if rx==ry:
        return
    else:
        par[rx] = ry
        dist[rx] = z%2

def dist_type(x):
    if(par[x]==x):
        return 0
    else:
        return (dist_type(par[x])+dist[x])%2

for u,v,w in uvw:
    unite(u-1,v-1,w%2)

for i in range(N):
    print(dist_type(i))


### FIXED CODE ###

N = int(input())
uvw = [[int(x) for x in input().split()] for _ in range(N-1)]

path = [[] for _ in range(N)]

ans = [-1]*N
ans[0] = 0

for u,v,w in uvw:
    path[u-1].append([v-1,w%2])
    path[v-1].append([u-1,w%2])
    
Q = [0]     
while Q:
    v = Q.pop(-1)
    for p,d in path[v]:
        if ans[p] == -1:
            ans[p] = (ans[v]+d)%2
            Q.append(p)
            
for a in ans:
    print(a)
A = int(input())
B = int(input())

rist = [ A+B , A-B , A*B]

rist.sort()
print(rist[3])

### FIXED CODE ###

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

rist = [ A+B , A-B , A*B]

print(max(rist))
nums = input().split()
a - int(numus[0])
b = int(numus[1])
print(a*b,(a+b)*2)

### FIXED CODE ###

nums = input().split()
a = int(nums[0])
b = int(nums[1])
print(a * b,(a + b) * 2)
a = input()
if "7" in a:
  print(Yes)
else:
  print(No)


### FIXED CODE ###

a = input()
if "7" in a:
  print("Yes")
else:
  print("No")
from functools import lru_cache

input()
arr = [(v, idx) for idx, v in enumerate(map(int, input().split()))]

dp = [-1 for _ in range(len(arr))]


def maximize(global_idx, temp_arr):
    if len(temp_arr) == 0:
        return 0

    # if dp[global_idx] != -1:
    #     return dp[global_idx]

    mx = 0

    for idx, child in enumerate(temp_arr):
        v, local_idx = child
        mx = max(mx, abs(global_idx - local_idx) * v + maximize(global_idx + 1, temp_arr[:idx] + temp_arr[idx + 1:]))

    dp[global_idx] = mx
    return dp[global_idx]


print(maximize(0, arr[:]))


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 9)

input()

arr = list(sorted([(v, idx) for idx, v in enumerate(map(int, input().split()))], reverse=True))

d = [[-1 for _ in range(len(arr))] for _ in range(len(arr))]


def dp(l, r, idx):
    if idx == len(arr):
        return 0

    if d[l][r] != -1:
        return d[l][r]

    left = abs(arr[idx][1] - l) * arr[idx][0] + dp(l + 1, r, idx + 1)
    right = abs(arr[idx][1] - r) * arr[idx][0] + dp(l, r - 1, idx + 1)

    d[l][r] = max(left, right)
    return max(left, right)


print(dp(0, len(arr) - 1, 0))
n = int(input())
h = list(map(int, input().split()))
ans = []
for i in range(0,n-1):
  count = 0
  while h[i] >= h[i+1]:
    count += 1
    if h[i] < h[i+1]:
      break
  ans.append(count)
print(max(ans))

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
ans = -1*float('inf')
cnt = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    cnt += 1
  else:
    ans = max(ans, cnt)
    cnt = 0
ans = max(ans, cnt)
print(ans)
A, B, C, K = map(int, input().split())
sum = 0

if K >= A:
	sum = sum + A
	K = K - A
else:
	sum = K
	K = 0
if K >= B and K >= 1:
	K = K - B
else:
	K = 0
if K >= 1:
	sum = sum - K
	K = K - K

if sum >= 1:
	print(sum)
else:
	print(0)

### FIXED CODE ###

S = input()
T = input()

if S == T[:-1]:
	print("Yes")
else:
	print("No")
import sys
sys.setrecursionlimit(114514)

H, W = map(int, input().split())
S = [input() for y in range(H)]
visited = [[False] * W for y in range(H)]

def color(y, x):
    if y < 0 or H <= y or x < 0 or W <= x or visited[y][x]:
        return "@"
    else:
        return S[y][x]


def dfs(y, x):
    b = 0
    w = 0
    nxt = "n"
    if color(y, x) == ".":
        w = 1
        nxt = "#"
    elif color(y, x) == "#":
        b = 1
        nxt = "."
    
    visited[y][x] = True
    if color(y - 1, x) == nxt:
        _b, _w = dfs(y - 1, x)
        b += _b
        w += _w
    if color(y + 1, x) == nxt:
        _b, _w = dfs(y + 1, x)
        b += _b
        w += _w
    if color(y, x - 1) == nxt:
        _b, _w = dfs(y, x - 1)
        b += _b
        w += _w
    if color(y, x + 1) == nxt:
        _b, _w = dfs(y, x + 1)
        b += _b
        w += _w

    return (b, w)

    
ans = 0
for y in range(H):
    for x in range(W):
        b, w = dfs(y, x)
        ans += b * w

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(300000)

H, W = map(int, input().split())
S = [input() for y in range(H)]
visited = [[False] * W for y in range(H)]

def color(y, x):
    if y < 0 or H <= y or x < 0 or W <= x or visited[y][x]:
        return "@"
    else:
        return S[y][x]


def dfs(y, x):
    b = 0
    w = 0
    nxt = "n"
    if color(y, x) == ".":
        w = 1
        nxt = "#"
    elif color(y, x) == "#":
        b = 1
        nxt = "."
    
    visited[y][x] = True
    if color(y - 1, x) == nxt:
        _b, _w = dfs(y - 1, x)
        b += _b
        w += _w
    if color(y + 1, x) == nxt:
        _b, _w = dfs(y + 1, x)
        b += _b
        w += _w
    if color(y, x - 1) == nxt:
        _b, _w = dfs(y, x - 1)
        b += _b
        w += _w
    if color(y, x + 1) == nxt:
        _b, _w = dfs(y, x + 1)
        b += _b
        w += _w

    return (b, w)

    
ans = 0
for y in range(H):
    for x in range(W):
        b, w = dfs(y, x)
        ans += b * w

print(ans)
N,K = map(int, input().split())
S = input()


if S[K-1] == "A":
    S[K-1] = "a"
elif S[K-1] == "B":
    S[K-1] = "b"
elif S[K-1] == "C":
    S[K-1] = "c"

print("".join(S))

### FIXED CODE ###

n, k = map(int,input().split())
s = list(input())
 
if s[k-1] == "A":
  s[k-1] = "a"
elif s[k-1] == "B":
  s[k-1] = "b"
elif s[k-1] == "C":
  s[k-1] = "c"
 
print("".join(s))
n, m = map(int, input().split())

fib = [0]*n
fib[0] = 1
fib[1] = 1
for x in range(2, n):
    fib[x] = fib[x-1] + fib[x-2]

mod = 10**9+7
ans = 1
prev_a = -1
for i in range(m):
    a = int(input())
    if a - 1 == prev_a:
        ans = 0
        break
    else:
        ans = (ans * fib[a - prev_a - 2]) % mod
    prev_a = a

ans = (ans * fib[n - a - 1]) % mod
print(ans)

### FIXED CODE ###

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

fib = [0]*(n + 1)
fib[0] = 1
fib[1] = 1
for x in range(2, n+1):
    fib[x] = fib[x-1] + fib[x-2]

mod = 10**9+7
ans = 1
prev_a = -1
a = 0
for i in range(m):
    a = int(input())
    if a - 1 == prev_a:
        ans = 0
        break
    else:
        ans = (ans * fib[a - prev_a - 2]) % mod
    prev_a = a

if m == 0:
    ans = fib[n] % mod
else:
    ans = (ans * fib[n - a - 1]) % mod
print(ans)
x. y, z = map(int, input().split())

print(z, x, y)

### FIXED CODE ###

x, y, z = map(int, input().split())

print(z, x, y)
N = int(input())
A = list(map(int,input().split()))
B = set(A)

Al = 0
cnt = 0
def solution(N,A,B,Al,cnt):
  for a in B:
      cnt = A.count(a)
      Al +=  cnt*(cnt-1)//2

  for k in range(N):
      cnt = A.count(A[k])
      print(Al - cnt +1)
solution(N,A,B,Al,cnt):


### FIXED CODE ###

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

from collections import Counter
cnt_A = Counter(A)

All = 0
cnt = 0
for a in B:
    cnt = cnt_A[a]
    All +=  cnt*(cnt-1)//2

for k in range(N):
    ans_k = 0
    cnt = cnt_A[A[k]]
    ans_k = cnt - 1
    Ans = All - ans_k
    print(Ans)
n=int(input())
xy=[]
for _ in range(n):
	xy+=[list(map(int,input().split()))]

dic={}
for e in xy:
	for f in xy:
		if e==f:continue
		tmp=(e[0]-f[0],e[1]-f[1])
		dic[tmp]=dic.get(tmp,0)+1

mx=max(dic.values())
print(n-mx)



### FIXED CODE ###

n=int(input())
xy=[]
for _ in range(n):
	xy+=[list(map(int,input().split()))]

dic={}
for e in xy:
	for f in xy:
		if e==f:continue
		tmp=(e[0]-f[0],e[1]-f[1])
		dic[tmp]=dic.get(tmp,0)+1

mx=max(dic.values()) if dic else 0
print(n-mx)
N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())
    MA += a[i]
    MB += b[i]

dp = [[0 for i in range(MA+1)] for j in range(MB+1)]
src = [[0 for i in range(MA+1)] for j in range(MB+1)]
src[0][0] = 1


for it_N in range(N):
    for it_MA in reversed(range(MA-a[it_N]+1)):
        for it_MB in reversed(range(MB-b[it_N]+1)):
            MAa = it_MA + a[it_N]
            MBb = it_MB + b[it_N]

            if src[it_MA][it_MB] == 1:

                src[MAa][MBb] = 1
                if dp[MAa][MBb] == 0:
                    dp[MAa][MBb] = dp[it_MA][it_MB] + c[it_N]
                else:
                    dp[MAa][MBb] = min([dp[MAa][MBb], dp[it_MA][it_MB] + c[it_N]])


ans = -1
for a in range(1, MA+1):
    for b in range(1, MB+1):
        if a/b == rate and dp[a][b] != 0:
            if ans == -1:
                ans = dp[a][b]
            else:
                ans = min([dp[a][b], ans])
print(ans)


### FIXED CODE ###


N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
MC = 0
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())
    MA += a[i]
    MB += b[i]
    MC += c[i]
    
dp = [[[MC for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0

for it_N in range(N):
    for it_MA in range(MA+1):
        for it_MB in range(MB+1):
            if it_MA >= a[it_N] and it_MB >= b[it_N]:
                if dp[it_N][it_MA-a[it_N]][it_MB-b[it_N]] != MC:
                    dp[it_N+1][it_MA][it_MB] = min(dp[it_N][it_MA-a[it_N]][it_MB-b[it_N]] + c[it_N], dp[it_N][it_MA][it_MB])
                else:
                    dp[it_N+1][it_MA][it_MB]=dp[it_N][it_MA][it_MB]
            else:
                dp[it_N+1][it_MA][it_MB]=dp[it_N][it_MA][it_MB]

ans = -1
for a in range(1, MA+1):
    for b in range(1, MB+1):
        if a/b == rate and dp[N][a][b] != MC:
            if ans == -1:
                ans = dp[N][a][b]
            else:
                ans = min(dp[N][a][b], ans)
print(ans)
a = (input())
b = a[0]
c = a[2]
if b = c:
print("Yes")
else:
print("No")


### FIXED CODE ###

N = input()
A = int(N[0])
B = int(N[1])
C = int(N[2])
if A==C:
 print("Yes")
else:
 print("No")
import sys
sys.setrecursionlimit(10 ** 9)

h,w = map(int,input().split())
maze = [list(input().rstrip()) for _ in range(h)]
#print(maze)

from collections import deque
b = 0
INF = float("inf")
checked = [[INF]*w for i in range(h)]

q = deque([])
q.append((0,0))
checked[0][0] = 1
while len(q)>0:
    pos = q.popleft()
    if pos == (w-1,h-1):
        b = (checked[w-1][h-1])
        break
    if pos[0] > 0:
        if not maze[pos[0] - 1][pos[1]] == '#' and checked[pos[0] - 1][pos[1]] == INF:
            checked[pos[0] - 1][pos[1]] = checked[pos[0]][pos[1]] + 1
            q.append((pos[0] - 1, pos[1]))

    if pos[0] < w - 1:
        if not maze[pos[0] + 1][pos[1]] == '#' and checked[pos[0] + 1][pos[1]] == INF:
            checked[pos[0] + 1][pos[1]] = checked[pos[0]][pos[1]] + 1
            q.append((pos[0] + 1, pos[1]))

    if pos[1] > 0:
        if not maze[pos[0]][pos[1] - 1] == '#' and checked[pos[0]][pos[1] - 1] == INF:
            checked[pos[0]][pos[1] - 1] = checked[pos[0]][pos[1]] + 1
            q.append((pos[0], pos[1] - 1))

    if pos[1] < h - 1:
        if not maze[pos[0]][pos[1] + 1] == '#' and checked[pos[0]][pos[1] + 1] == INF:
            checked[pos[0]][pos[1] + 1] = checked[pos[0]][pos[1]] + 1
            q.append((pos[0], pos[1] + 1))
a = []
for i in range(h):
    a.append(maze[i].count("."))
print(sum(a)-b)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

h,w = map(int,input().split())
maze = [list(input().rstrip()) for _ in range(h)]
#print(maze)

from collections import deque
b = 0
INF = float("inf")
checked = [[INF]*w for i in range(h)]

q = deque([])
q.append((0,0))
checked[0][0] = 1
while len(q)>0:
    pos = q.popleft()
    if pos == (h-1,w-1):
        b = (checked[h-1][w-1])
        break
    if pos[0] > 0:
        if not maze[pos[0] - 1][pos[1]] == '#' and checked[pos[0] - 1][pos[1]] == INF:
            checked[pos[0] - 1][pos[1]] = checked[pos[0]][pos[1]] + 1
            q.append((pos[0] - 1, pos[1]))

    if pos[0] < h - 1:
        if not maze[pos[0] + 1][pos[1]] == '#' and checked[pos[0] + 1][pos[1]] == INF:
            checked[pos[0] + 1][pos[1]] = checked[pos[0]][pos[1]] + 1
            q.append((pos[0] + 1, pos[1]))

    if pos[1] > 0:
        if not maze[pos[0]][pos[1] - 1] == '#' and checked[pos[0]][pos[1] - 1] == INF:
            checked[pos[0]][pos[1] - 1] = checked[pos[0]][pos[1]] + 1
            q.append((pos[0], pos[1] - 1))

    if pos[1] < w - 1:
        if not maze[pos[0]][pos[1] + 1] == '#' and checked[pos[0]][pos[1] + 1] == INF:
            checked[pos[0]][pos[1] + 1] = checked[pos[0]][pos[1]] + 1
            q.append((pos[0], pos[1] + 1))
a = []
for i in range(h):
    a.append(maze[i].count("."))
if not b == 0:
    print(sum(a)-b)
else:
    print(-1)
n, m = map(int, input().split())
py = []
mli = [0]*m
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p] += 1
    pi = '{0:06d}'.format(p)
    yi = '{0:06d}'.format(mli[p])
    li[i] = str(pi)+str(yi)

for i in li:
    print(i)

### FIXED CODE ###

n, m = map(int, input().split())
py = []
mli = [0]*n
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p-1] += 1
    pi = str(p).zfill(6)
    yi = str(mli[p-1]).zfill(6)
    li[i] = pi+yi

for i in li:
    print(i)
N, K = map(int, input().split())

S = list(input())

S[K-1] = S[K-1].lower

for i in S:
    s_new += i
    
print(s_new)

### FIXED CODE ###

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

S = list(input())

S[K-1] = S[K-1].lower()

s_new = ""
for i in range(N):
  s_new += S[i]
    
print(s_new)
b = raw_input()
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")

### FIXED CODE ###

b = raw_input()
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")
n,k=map(int,input().split())
s=input()
if s[k-1]=='A':
  s[k-1]='a'
elif s[k-1]=='B':
  s[k-1]='b'
else:
  s[k-1]='c'
print(s)


### FIXED CODE ###

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

print(s[:k-1]+s[k-1].lower()+s[k:])
import fractions 
n = int(input())
t = [int(input()) for i in range(n)]
t.sort()
def lcm(a, b):
  return (a * b) // fractions.gcd(a, b)

#入力tについて、最小公倍数を求めればそれが答えとなる
ans = lcm(t[0], t[1])
for i in range(2, n):
  ans = lcm(ans, t[i])

print(ans)

### FIXED CODE ###

import fractions 
n = int(input())
t = [int(input()) for i in range(n)]
def lcm(a, b):
  return (a * b) // fractions.gcd(a, b)

#入力tについて、最小公倍数を求めればそれが答えとなる
if n == 1:
  print(t[0])
else:
  ans = lcm(t[0], t[1])
  for i in range(2, n):
    ans = lcm(ans, t[i])
  print(ans)
import math

def main():
    n = int(input())

    area = (n ** 2) * math.pi
    measure = (n * 2) *math.pi

    print("{0:.6f} {1:.6f}".format(area,measure))

if __name__ == "__main__":
    main()

### FIXED CODE ###

import math

def main():
    n = float(input())

    area = (n * n) * math.pi
    measure = (n * 2) *math.pi

    print("{0:.6f} {1:.6f}".format(area,measure))

if __name__ == "__main__":
    main()
L = [2, 1]
for i in range(84):
  L.append(L[i]+L[i+1])
A = int(input())
print(L[A])

### FIXED CODE ###

L = [2, 1]
for i in range(85):
  L.append(L[i]+L[i+1])
A = int(input())
print(L[A])
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

a, b = sorted(list(map(int, input().split())))
divisors_ = set(divisors(a)) & set(divisors(b))

prime_divisors = [x for x in divisors_ if is_prime(x)]
print(len(prime_divisors) + 1)

### FIXED CODE ###

def is_prime(n):
    assert n >= 1,  'Argument Error! n is "1 <= n".'
    for i in range(2, n + 1):
        if i ** 2 > n:
            break
        if n % i == 0:
            return False
    return n != 1

def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

a, b = sorted(list(map(int, input().split())))
divisors_ = set(divisors(a)) & set(divisors(b))

prime_divisors = [x for x in divisors_ if is_prime(x)]
print(len(prime_divisors) + 1)
N = int(input())
a = math.ceil(N/2)/N
print(a)

### FIXED CODE ###

import math
N = int(input())
a = math.ceil(N/2)/N
print(a)
a , b = map(int , input().split())
c=str(a)+str(b)
c=int(c)
if math.sqrt(c):
    print("Yes")  
else :
    print("No")


### FIXED CODE ###

a , b = map(int , input().split())
c=str(a)+str(b)
c=int(c)
for i in range (1000):
    if c== int(i*i):
        print("Yes")  
        break      
    elif i==1000-1:
        print("No")
        break
def solve(K, ABs):
    if not ABs return 0
    ansK = sum(b for a, b in ABs if (K | a) == K)
    pool = []
    for i in range(30, -1, -1):
        if (K & (1<<i)):
            pool.append(i)
        else:
            if pool:
                break
    for p in pool:
        v = 1 << p
        t = sum(b for a, b in ABs if not(a & v))
        if t > ansK: ansK = t
    return ansK
   

N, K = map(int, input().split())
ABs = []
for i in range(N):
    a, b = map(int, input().split())
    if a > K: continue
    ABs.append([a, b])

print(solve(K, ABs))

### FIXED CODE ###

def solve(K, ABs):
    if not ABs: return 0
    ansK = sum(b for a, b in ABs if (K | a) == K)
    pool = []
    for i in range(30, -1, -1):
        if (K & (1<<i)):
            pool.append(i)
    for p in pool:
        v = 1 << p
        KK = (K >> p) << p
        KKK = (K >> p)
        t = sum(b for a, b in ABs if (not(a & v) and (a | KK) >> p == KKK))
        if t > ansK: ansK = t
    return ansK
   

N, K = map(int, input().split())
ABs = []
for i in range(N):
    a, b = map(int, input().split())
    if a > K: continue
    ABs.append([a, b])

print(solve(K, ABs))
a,b = map(int,input(),split())
print(a*b-a-b+1)

### FIXED CODE ###

A, B = map(int, input().split())
print(A*B-A-B+1)
n=int(input())
sum=0
while (n!=0):
  sum+=int(n%10)
  n/=10
print(sum)
if (sum%9==0):
  print("Yes")
else:
  print("No")


### FIXED CODE ###


def check(st) : 

	n = len(st) 
	digitSum = 0
	
	for i in range(0,n) : 
		digitSum = digitSum + (int)(st[i]) 

	
	return (digitSum % 9 == 0) 


st =input()

if(check(st)) : 
	print("Yes") 
else : 
	print("No")
r = map(int(), input())
print(r**2)

### FIXED CODE ###

r = int(input())
print(r**2)
S.W=map(int,input().split())
if W>=S:
    print("unsafe")
else:
    print("safe")

### FIXED CODE ###

S,W=map(int,input().split())
if W>=S:
    print("unsafe")
else:
    print("safe")
import math
num_max = 100000
isPrimeNum = [True for i in range(0,num_max+1)]

isPrimeNum[0] == False
isPrimeNum[1] == False

for i in range(2, int(math.sqrt(num_max))):
    if isPrimeNum[i] == True:
        for j in range (i**2, num_max, i):
            isPrimeNum[j] = False
        


num_len = int(input())
cnt = 0

for i in range(num_len):
    num = int(input())
    if isPrimeNum[num]==True:
        cnt = cnt + 1

print(str(cnt))

### FIXED CODE ###

def isPrimeNum(in_num):
    if in_num <= 1:
        return False
    elif in_num == 2:
        return True
    elif in_num % 2 == 0:
        return False
    else:
        if pow(2, in_num-1, in_num) == 1:
            return True
        else:
            return False


num_len = int(input())
cnt = 0
for i in range(num_len):
    num = int(input())
    if isPrimeNum(num)==True:
        cnt = cnt + 1

print(str(cnt))
n, m = map(int, input().split())
a = list(map(int, input().split()))

A = sum(a)
l = a.sort(reverse=True)

if l[m-1] >= A/(4*m):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

A = sum(a)
a.sort(reverse=True)

if a[m-1] >= A/(4*m):
    print("Yes")
else:
    print("No")
import sys
print('python-izm')

args = sys.argv

n = args[1]
a = args[2]
b = args[3]

if n*a > b:
    print("b")
else:
    print("a")



### FIXED CODE ###

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

if N*A < B:
    print(N*A)
else:
    print(B)
s = list(input())

cnt = 0
i = 0

while i < len(s):
    while len(s) != 0 and s[i] != s[i + 1]:
        s.pop(i)
        s.pop(i)
        cnt += 2
        i -= 1
    i += 1

print(cnt)


### FIXED CODE ###

s = list(input())

# Note: init
# cnt = 0
# i = 1
#
# while i < len(s):
#     while len(s) != 0 and s[i - 1] != s[i]:
#         s.pop(i)
#         s.pop(i - 1)
#         i -= 1
#         cnt += 2
#     i += 1
#
# print(cnt)


cnt = min(s.count("0"), s.count("1"))
print(cnt*2)