Harryxun/stf_run huggingface dataset:
n, m = list(map(int, input().split()))
p = [input().split() for i in range(m)]

s = {i + 1 for i in range(n)}

ac = 0
wa = {i + 1:[0, False] for i in range(n)}


for i in range(m):
  if int(p[i][0]) in s:
    if p[i][1] == 'WA':
      wa[int(p[i][0])][0] += 1
    else:
      ac += 1
      s.discard(int(p[i][0]))
      wa[int(p[i][0])][1] = True
      
wa_wa = 0
for i in range(1, n + 1):
  if wa[i][1]:
    wa_wa += wa[i][0]
print(ac, wa_wa)
n, m = list(map(int, input().split()))
p = [input().split() for i in range(m)]

s = {i + 1 for i in range(n)}

ac = 0
wa = {i + 1:[0, False] for i in range(n)}


for i in range(m):
  if int(p[i][0]) in s:
    if p[i][1] == 'WA':
      wa[int(p[i][0])][0] += 1
    else:
      ac += 1
      s.discard(int(p[i][0]))
      wa[int(p[i][0])][1] = True
      
wa_wa = 0
for i in range(1, n + 1):
  if wa[i][1]:
    wa_wa += wa[i][0]
print(ac, wa_wa)


### FIXED CODE ###

n, m = list(map(int, input().split()))
p = [input().split() for i in range(m)]

s = {i + 1 for i in range(n)}

ac = 0
wa = {i + 1:[0, False] for i in range(n)}


for i in range(m):
  if int(p[i][0]) in s:
    if p[i][1] == 'WA':
      wa[int(p[i][0])][0] += 1
    else:
      ac += 1
      s.discard(int(p[i][0]))
      wa[int(p[i][0])][1] = True
      
wa_wa = 0
for i in range(1, n + 1):
  if wa[i][1]:
    wa_wa += wa[i][0]
print(ac, wa_wa)
a, b = map(int,input().split())
A = list(str(a)*b,) B = list(str(b)*a)
C = max(len(A),len(B))
for i in range(C)
  if A[i] > B[i]:
  　　　　print(str(B))
         break
  elif B[i] > A[i]:
         print(str(A))
         break
  

### FIXED CODE ###

a,b = map(int,input().split())
C = min(a,b)
D = max(a,b)
print(str(C)*D)
from collections import deque

H,W = map(int,input().split())
C_h,C_w = map(lambda x:int(x)-1,input().split())
D_h,D_w = map(lambda x:int(x)-1,input().split())
S = [input() for _ in range(H)]

INF = int(1e7)
dist = [[INF]*(W) for _ in range(H)]
dist[C_h][C_w] = 0
deq = deque()
deq.append((C_h,C_w))

move_a = [(1, 0), (0, 1), (-1, 0), (0, -1)]
move_b = [(-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), (-1, -2), (-1, -1), (-1, 1), (-1, 2), (0, -2), (0, 2), (1, -2), (1, -1), (1, 1), (1, 2), (2, -2), (2, -1), (2, 0), (2, 1), (2, 2)]

while len(deq):
  h,w = deq.popleft()
  for dh,dw in move_a:
    nh,nw = h+dh,w+dw
    if nh>=0 and nw>=0 and nh<H and nw<W and S[nh][nW]!='#' and dist[nh][nw] > dist[h][w]:
      dist[nh][nw] = dist[h][w]
      deq.appendleft((nh,nw))
  for dh,dw in move_b:
    nh,nw = h+dh,w+dw
    if nh>=0 and nw>=0 and nh<H and nw<W and S[nh][nW]!='#' and dist[nh][nw] > dist[h][w]+1:
      dist[nh][nw] = dist[h][w]+1
      deq.append((nh,nw))

print(dist[D_h][D_w] if dist[D_h][D_w]<INF else -1)


### FIXED CODE ###

from collections import deque

H,W = map(int,input().split())
C_h,C_w = map(lambda x:int(x)-1,input().split())
D_h,D_w = map(lambda x:int(x)-1,input().split())
S = [input() for _ in range(H)]

INF = int(1e10)
dist = [[INF]*(W) for _ in range(H)]
deq = deque()
deq.append((C_h,C_w,0))

move_a = [(1,0),(0,1),(-1,0),(0,-1)]
move_b = [(i,j)for i in range(-2,2+1) for j in range(-2,2+1) if abs(i)+abs(j)>=2]

while len(deq):
  h,w,c = deq.popleft()
  if dist[h][w] <= c:
    continue
  dist[h][w] = c
  for dh,dw in move_a:
    nh,nw = h+dh,w+dw
    if nh<0 or nw<0 or nh>=H or nw>=W:
      continue
    if S[nh][nw] == '#':
      continue
    if dist[nh][nw] > c:
      deq.appendleft((nh,nw,c))
  for dh,dw in move_b:
    nh,nw = h+dh,w+dw
    if nh<0 or nw<0 or nh>=H or nw>=W:
      continue
    if S[nh][nw] == '#':
      continue
    if dist[nh][nw] > c+1:
      deq.append((nh,nw,c+1))
  
print(dist[D_h][D_w] if dist[D_h][D_w]<INF else -1)
a, b = map(int, raw_input().split())


if a % 3 == 0 or b % 3 == 0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")



### FIXED CODE ###

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


if a % 3 == 0 or b % 3 == 0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")
H,W=map(int,input().split())
M=[[0 for i in range(W)] for i in range(H)]
for _ in range(H):
    s=input()
    for i in range(W):
        if s[i]=='#':
            M[_][i]=1
dp=[[10**6 for i in range(W)] for i in range(H)]
if M[0][0]==1:
    dp[0][0]=1
else:
    dp[0][0]=0
for j in range(W-1):
    if M[j+1][0]==0:
        dp[j+1][0]=dp[j][0]
    else:
        if M[j][0]==1:
            dp[j+1][0]=dp[j][0]
        else:
            dp[j+1][0]=dp[j][0]+1
for i in range(H-1):
    if M[0][i+1]==0:
        dp[0][i+1]=dp[0][i]
    else:
        if M[0][i]==1:
            dp[0][i+1]=dp[0][i]
        else:
            dp[0][i+1]=dp[0][i]+1
for i in range(1,H):
    for j in range(0,W-1):
        if M[i][j+1]==0:
            dp[i][j+1]=min(dp[i-1][j+1],dp[i][j])
        elif M[i][j+1]==1:
            if M[i-1][j+1]==1:
                if M[i][j]==1:
                    dp[i][j+1]=min(dp[i-1][j+1],dp[i][j])
                else:
                    dp[i][j+1]=min(dp[i-1][j+1],dp[i][j]+1)
            else:
                if M[i][j]==1:
                    dp[i][j+1]=min(dp[i-1][j+1]+1, dp[i][j])
                else:
                    dp[i][j+1]=min(dp[i-1][j+1]+1,dp[i][j]+1)
print(dp[H-1][W-1])

### FIXED CODE ###

H,W=map(int,input().split())
M=[[0 for i in range(W)] for i in range(H)]
for _ in range(H):
    s=input()
    for i in range(W):
        if s[i]=='#':
            M[_][i]=1
dp=[[10**6 for i in range(W)] for i in range(H)]
if M[0][0]==1:
    dp[0][0]=1
else:
    dp[0][0]=0
for j in range(W-1):
    if M[0][j+1]==0:
        dp[0][j+1]=dp[0][j]
    else:
        if M[0][j]==1:
            dp[0][j+1]=dp[0][j]
        else:
            dp[0][j+1]=dp[0][j]+1
for i in range(H-1):
    if M[i+1][0]==0:
        dp[i+1][0]=dp[i][0]
    else:
        if M[i][0]==1:
            dp[i+1][0]=dp[i][0]
        else:
            dp[i+1][0]=dp[i][0]+1
for i in range(1,H):
    for j in range(0,W-1):
        if M[i][j+1]==0:
            dp[i][j+1]=min(dp[i-1][j+1],dp[i][j])
        elif M[i][j+1]==1:
            if M[i-1][j+1]==1:
                if M[i][j]==1:
                    dp[i][j+1]=min(dp[i-1][j+1],dp[i][j])
                else:
                    dp[i][j+1]=min(dp[i-1][j+1],dp[i][j]+1)
            else:
                if M[i][j]==1:
                    dp[i][j+1]=min(dp[i-1][j+1]+1, dp[i][j])
                else:
                    dp[i][j+1]=min(dp[i-1][j+1]+1,dp[i][j]+1)
print(dp[H-1][W-1])
a = input()
b = input()
c = input()
x = input()


counter = 0
for aa in range(0,int(a)+1):
    for bb in range(0,int(b)+1):
        for cc in range(0, int(c)+1):
            sumx = 500 * aa + 100 * bb + 50 * cc
            if x == sumx:
                counter += 1
                print(f'{aa},{bb},{cc}')
print(counter)

### FIXED CODE ###

a = input()
b = input()
c = input()
x = input()


counter = 0
for aa in range(0,int(a)+1):
    for bb in range(0,int(b)+1):
        for cc in range(0, int(c)+1):
            sumx = 500 * aa + 100 * bb + 50 * cc
            if int(x) == sumx and int(x) % 50 == 0 and 50 <= int(x) <= 20000:
                counter += 1
print(counter)
s=input()
ans=0
for i in range(4):
  if s[i]='+':
    ans += 1
  else:
    ans -= 1
print(ans)

### FIXED CODE ###

s=input()
ans=0
for i in range(4):
  if s[i]=='+':
    ans += 1
  else:
    ans -= 1
print(ans)
import sys
N = int(input())
A = list(map(int, input().split()))
 
ans = 1

if A.count(0) != 0:
    print(0)
    sys.exit()

for i in A:

    ans = ans*i
    if ans > int(10**18):
        print(-1)
        sys.exit()
 
if ans > int(10**18):
    print(-1)
else:
    print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
print(N*M)
A, B = map(int, input().split())
l1 = [1,2,3]
l2 = [A, B]
l = l1 - l2
print(l[0])

### FIXED CODE ###

print(6 - int(input())- int(input()))
S = sorted(list(map(str, input())))
T = sorted(list(map(str, input())), reverse = True)
len = min(len(S), len(T))

flg = 2

for i in range(len):
	if S[i] < T[i]:
		flg = 1
		break
	elif S[i] > T[i]:
		flg = 0
		break

if flg == 1:		
	print("Yes")
elif flg == 0:
	print("No")
else:
	if len(S) < len(T):
		print("Yes")
	else:
		print("No")

### FIXED CODE ###

S = sorted(list(map(str, input())))
T = sorted(list(map(str, input())), reverse = True)
length = min(len(S), len(T))

flg = 2

for i in range(length):
	if S[i] < T[i]:
		flg = 1
		break
	elif S[i] > T[i]:
		flg = 0
		break

if flg == 1:		
	print("Yes")
elif flg == 0:
	print("No")
else:
	if len(S) < len(T):
		print("Yes")
	else:
		print("No")
import math
def input_from_console():
    a, b, c, d = map(int, input().split())
    return a, b, c, d


def solve(a, b, c, d):
    def how_many(to, divide):
        if to >= divide:
            n = to // divide
        else:
            n = 0
        return n
    count_by_c = how_many(b, c) - how_many(a - 1, c)
    count_by_d = how_many(b, d) - how_many(a - 1, d)
    # print('gcd', int(c*d / math.gcd(c,d)))
    count_by_cd = how_many(b, int(c*d / math.gcd(c,d))) - how_many(a - 1, int(c*d / math.gcd(c,d)))
    result = b - a + 1 - (count_by_c + count_by_d - count_by_cd)
    # print(count_by_c,  count_by_d, count_by_cd)

    # print(result)
    return result

def main():
    a, b, c, d = input_from_console()
    print(solve(a, b, c, d))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


### FIXED CODE ###

def input_from_console():
    a, b, c, d = map(int, input().split())
    return a, b, c, d

def gcd(i,j):
    i, j = max(i,j), min(i,j)
    if i % j == 0:
        return j
    else:
        while i % j !=0:
            k = i % j
            i, j = j, k
        else:
            return k

def solve(a, b, c, d):
    def how_many(to, divide):
        if to >= divide:
            n = to // divide
        else:
            n = 0
        return n
    count_by_c = how_many(b, c) - how_many(a - 1, c)
    count_by_d = how_many(b, d) - how_many(a - 1, d)
    # print('gcd', int(c*d / math.gcd(c,d)))
    count_by_cd = how_many(b, int(c*d / gcd(c,d))) - how_many(a - 1, int(c*d / gcd(c,d)))
    result = b - a + 1 - (count_by_c + count_by_d - count_by_cd)
    # print(count_by_c,  count_by_d, count_by_cd)

    # print(result)
    return result

def main():
    a, b, c, d = input_from_console()
    print(solve(a, b, c, d))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()
def gcd(l):
    if len(l) == 1:
        return l[0]

    return gcd([gcd2(l[0], l[1])] + l[2:])


def gcd2(a, b):
    if b == 0:
        return a

    return gcd2(b, a % b)


n, s = map(int, input().split())
x = list(map(int, input().split()))

x = [abs(xi - s) for xi in x]
print(gcd(x))


### FIXED CODE ###

def gcd(l):
    if len(l) == 1:
        return l[0]

    v = gcd2(l[0], l[1])
    for i in range(2, n):
        v = gcd2(v, l[i])

    return v


def gcd2(a, b):
    if b == 0:
        return a

    return gcd2(b, a % b)


n, s = map(int, input().split())
x = list(map(int, input().split()))

x = [abs(xi - s) for xi in x]
print(gcd(x))
from sys import stdin
readline = stdin.readline

def main():
    H, W, M = map(int, readline().rstrip().split())
    HW = [[0] * (W + 1) for _ in range(H + 1)]
    HB = [0] * (H + 1)
    HS = set()
    WB = [0] * (W + 1)
    WS = set()
    for _ in range(M):
        h, w = map(int, readline().rstrip().split())
        HW[h][w] = 1
        HB[h] += 1
        HS.add(h)
        WB[w] += 1
        WS.add(w)
    ans = 0
    for h in HS:
        for w in WS:
            tmp = HB[h] + WB[w]
            if HW[h][w] == 1:
                tmp -= 1
            ans = max(ans, tmp)
    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    import sys
    from collections import defaultdict
    readline = sys.stdin.readline

    H, W, M = map(int, readline().rstrip().split())
    HB = [0] * H
    WB = [0] * W
    HW = defaultdict(lambda : False)
    for _ in range(M):
        h, w = map(int, readline().rstrip().split())
        h -= 1
        w -= 1
        HW[(h,w)] = True
        HB[h] += 1
        WB[w] += 1
    hb = max(HB)
    max_h = [i for i, x in enumerate(HB) if x == hb]
    wb = max(WB)
    max_w = [i for i, x in enumerate(WB) if x == wb]
    
    ans = hb + wb
    for mh in max_h:
        for mw in max_w:
            if HW[(mh, mw)] == False:
                print(ans)
                sys.exit(0)
    print(ans - 1)

if __name__ == "__main__":
    main()
def main(n,a,b,c):
  import bisect
  ab=[] #ab[i]:上部にi個目を選んだ時、中部に選べるもののうち最小のインデックス。選べないならnになる
  ab.append(bisect.bisect_right(b,a[0]))
  bc=[]
  bc.append(bisect.bisect_right(c,b[0]))
  for i in range(1,n):
    if a[i]<b[ab[i-1]]:
      ab.append(ab[i-1])
    else:
      ab.append(bisect.bisect_right(b[ab[i-1]:],a[i])+ab[i-1])
    if b[i]<c[bc[i-1]]:
      bc.append(bc[i-1])
    else:
      bc.append(bisect.bisect_right(c[bc[i-1]:],b[i])+bc[i-1])
  ans=0
  for i in range(n):
    for j in range(ab[i],n):
      ans+=n-bc[j]
  print(ans)
if __name__=='__main__':
  n=int(input())
  a=sorted(list(map(int,input().split())))
  b=sorted(list(map(int,input().split())))
  c=sorted(list(map(int,input().split())))
  main(n,a,b,c)


### FIXED CODE ###

def main(n,a,b,c):
  import bisect
  ans=0
  for i in range(n):
    na=bisect.bisect_left(a,b[i])
    nc=n-bisect.bisect_right(c,b[i])
    ans+=na*nc
  print(ans)
if __name__=='__main__':
  n=int(input())
  a=sorted(list(map(int,input().split())))
  b=sorted(list(map(int,input().split())))
  c=sorted(list(map(int,input().split())))
  main(n,a,b,c)
N,M,X=map(int,input().split())
li=[]
Ans=100001

for i in range(N):
    array=list(map(int,input().split()))
    li.append(array)

for j in range(2**N):
    b=bin(j)
    b=b[2:]
    b="0"*(N-len(b))+b
    
    
    c=0
    x=0
    y=0
    z=0

    for k in range(len(b)):
        if b[k]==str(1):
            c+=li[k][0]
            x+=li[k][1]
            y+=li[k][2]
            z+=li[k][3]
    if x>=X and y>=X and z>=X and Ans>c:
        Ans=c

if Ans==100001:
    print("-1")
else:
    print(Ans)


### FIXED CODE ###

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

li=[]
ans=100000000000000000000000000000000

for j in range(N):
    a=list(map(int,input().split()))
    li.append(a)

for k in range(2**N):
    temp=0
    skill=[0]*M
    k=str(bin(k))
    k=k[2:]
    while len(k)!=N:
        k="0"+k
    for l in range(N):
        if k[l]=="1":
            temp+=li[l][0]
            for m in range(1,M+1):
                skill[m-1]+=li[l][m]
    if min(skill)>=X:
        if ans>temp:
            ans=temp
if ans==100000000000000000000000000000000:
    print(-1)
else:
    print(ans)
N = int(input())
T = list(map(int,input().split()))
M = int(input())

for i in range(N):
  P,X = list(map(int,input().split()))
  Z = T[:]
  Z[P-1] = X
  print(sum(Z))

### FIXED CODE ###

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

for i in range(c):
  d = list(map(int,input().split()))
  e = b[:]
  e[d[0]-1] = d[1]
  print(sum(e))
N = float(input())
T, A = map(float, input().split())
H = list(map(float, input().split()))
l = [i for i in H abs(T - i * 0.006)]

print(min(l))

### FIXED CODE ###

N = int(input())
T, A = map(float, input().split())
H = list(map(float, input().split()))
ans = [0] * N
for i in range(N):
  ans[i] = abs(T - H[i] * 0.006 - A)

print(ans.index(min(ans)) + 1)
import sys
N, M = map(int, input().split())
MOD = 10 ** 9 + 7
NMAX = 10 ** 5
sys.setrecursionlimit(10 ** 6)

memo = [None for _ in range(NMAX+1)]
def fibo(n):
    if memo[n]:
        return memo[n]
    if n == 0:
        return 0
    elif n < 3:
        return 1
    else:
        return fibo(n-1) + fibo(n-2)

nc = 1
b = 0
for i in range(M):
    a = int(input())
    nc = (nc * fibo(a - b)) % MOD
    b = a + 1

nc = (nc * fibo(N + 1 - b)) % MOD

print(nc)


### FIXED CODE ###

import sys
N, M = map(int, input().split())
MOD = 10 ** 9 + 7

NG = [False for _ in range(N+1)]
for _ in range(M):
    NG[int(input())] = True

dp = [None for _ in range(N+1)]
dp[0] = 1
dp[1] = 0 if NG[1] else 1
for i in range(2, N+1):
    if NG[i]:
        dp[i] = 0
    else:
        dp[i] = (dp[i-2] + dp[i-1]) % MOD

print(dp[-1])
print(chr(ord(input()) + 1)

### FIXED CODE ###

print(chr(ord(input()) + 1))
def euc(i, j):
    if i > j:
        i, j = j, i
    while j%i != 0:
        k = abs(j - i)
        j = i%k
        i = k
        if i > j:
            i, j = j, i
    return i


N = int(input())
sum = 0
for i in range(1, N + 1):
    for j in range(1, N + 1): 
        ij = euc(i, j)
        for k in range(1, N + 1):
            sum += euc(ij, k)
print(sum)

#print(euc(9, 18))


### FIXED CODE ###

def euc(i, j):
    if i > j:
        i, j = j, i
    while j%i != 0:
        k = j - i
        if k > i:
            i, k = k, i
        j = i%k
        if j == 0:
            return(k)
        i = k
        if i > j:
            i, j = j, i
    return i


N = int(input())
sum = 0
for i in range(1, N + 1):
    for j in range(1, N + 1): 
        ij = euc(i, j)
        for k in range(1, N + 1):
            sum += euc(ij, k)
print(sum)

#print(euc(2, 3))
W, H, x, y, r = map(int, input().split())
if x >= r and x + r <= W and y >= r and y + r <= H
 print("Yes")
else:
 print("No")


### FIXED CODE ###

W, H, x, y, r = map(int, input().split())
if x >= r and x + r <= W and y >= r and y + r <= H:
  print("Yes")
else:
  print("No")
A,B,C = map(int, input().split())

if A==B && B==C && A==C:
    print("No")

elif A!=B && B!=C && A!=C:
    print("No")

else :
    print("Yes")

### FIXED CODE ###

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

if A==B and B==C and A==C:
    print("No")

elif A!=B and B!=C and A!=C:
    print("No")

else :
    print("Yes")
X,Y=map(int,input().split())
N=10**9+7
def kaizyou(n):
    l=[1]
    for i in range(1,n+1):
        ll=(l[i-1]*i)%N
        l.append(ll)
    return l
def modpow(a,n,p):#a^n mod p ,O(log n)
    res=1
    while n>0:
        if n&1:#１とのビット論理積が１、つまり奇数
            res=res*a%p
        a=a*a%p
        n>>=1
        #ビットの右シフト_2進数表記のnを小数点を固定して右に１桁ずらす_１桁小さくなる
    return res
if (2*X-Y)%3==0 and (2*Y-X)%3==0:
    nx=int((2*X-Y)/3)
    ny=int((2*Y-X)/3)
    l=kaizyou(nx+ny)
    nxdv=modpow(l[nx],N-2,N)
    nydv=modpow(l[ny],N-2,N)
    ans=l[-1]*nxdv%N
    ans=ans*nydv%N
    print(ans)
else:
    print(0)


### FIXED CODE ###

X,Y=map(int,input().split())
N=10**9+7
def kaizyou(n):
    l=[1]
    for i in range(1,n+1):
        ll=(l[i-1]*i)%N
        l.append(ll)
    return l
def modpow(a,n,p):#a^n mod p ,O(log n)
    res=1
    while n>0:
        if n&1:#１とのビット論理積が１、つまり奇数
            res=res*a%p
        a=a*a%p
        n>>=1
        #ビットの右シフト_2進数表記のnを小数点を固定して右に１桁ずらす_１桁小さくなる
    return res
if (2*X-Y)%3==0 and (2*Y-X)%3==0 and 2*X-Y>=0 and 2*Y-X>=0:
    nx=int((2*X-Y)/3)
    ny=int((2*Y-X)/3)
    l=kaizyou(nx+ny)
    nxdv=modpow(l[nx],N-2,N)
    nydv=modpow(l[ny],N-2,N)
    ans=l[-1]*nxdv%N
    ans=ans*nydv%N
    print(ans)
else:
    print(0)
N, K = map(int, input().split())
S = list(input())

res = 0
left = 0
right = 0
# start
cnt = 0
for i in range(N-1):
    if S[i] == "0" and S[i+1] == "1":
        cnt += 1
    if cnt == K and S[i+1] == "0":
        right = i + 1
        break
    if i == N - 2:
        right = N
    
res = max(res, right - left)

while right < N:
    left += 1
    right += 1
    while left < N:
        if S[left] == "1" and S[left-1] == "0":
            break
        else:
            left += 1
    while right < N:
        if S[right] == "0" and S[right+1] == "1":
            break
        else:
            right += 1
    res = max(res, right - left)
    
print(res)

### FIXED CODE ###

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

res = 0
left = 0
right = 0
# start
cnt = 0
for i in range(N-1):
    if S[i] == "0" and S[i+1] == "1":
        cnt += 1
    if cnt == K and S[i+1] == "0":
        right = i
        break
    if i == N - 2:
        right = N - 1
    
res = max(res, right - left + 1)

while right < N-1:
    left += 1
    right += 1
    while left < N:
        if S[left] == "1" and S[left-1] == "0":
            break
        else:
            left += 1
    while right < N - 1:
        if S[right] == "1" and S[right+1] == "0":
            break
        else:
            right += 1
    res = max(res, right - left + 1)
    
print(res)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
A,B=map(int,input(),split())
if A + B <10:
  print("{}".format(A+B))
else:
  print("error")

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
A , B =map(int,input().split())
if A + B <10:
  print("{}".format(A+B))
else:
  print("error")
a, b, c = map(int, input().split())
ans = 0
for i range(1, a+1):
    N = [int(x) for x in str(i)]
    sum = sum(N)
    if b <= sum and sum <= c:
        ans += sum

print(ans)


### FIXED CODE ###

A, B, C, D = map(int, input().split())
L = A+B
R = C+D
if L > R:
    print('Left')
elif L < R:
    print('Right')
else:
    print('Balanced')
N = int(input())
total = 0
for i in range(1,N+1):
	if N%3!=0 and N%5!=0:
    	total += i
print(total)    

### FIXED CODE ###

N = int(input())
total = 0
for i in range(1, N+1):
    if (i % 3) != 0 and (i % 5) != 0:
        total = total+i
print(total)
from __future__ import print_function

import sys
input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


# import re
# import array
# import copy
# import functools
# import operator

# import math
# import string
import fractions
# from fractions import Fraction
from fractions import gcd

# import collections
# import itertools
# import bisect

# import heapq
# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace
# from queue import PriorityQueue as pq
from queue import Queue

# from itertools import accumulate

# from collections import deque
# from collections import Counter

from operator import mul
from functools import reduce

# def lcm(n,m):
#     return int(n*m/gcd(n,m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


# import random
# import time


def main():
    h = int(input().strip())
    print(2**(h - 1) - 1)
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


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

    def rec(m,j):
        if m==0:
            return 0
        else:
            return 2**j + rec(m//2,j+1)
            
        
    print(rec(n,0))

if __name__ == '__main__':
    main()
a,b,c = map(int,input().split())
print(c,a,b)
x,y,z = map(int,input().split())
print(z,y,x)


### FIXED CODE ###

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