Harryxun/stf_run huggingface dataset:
import math
from copy import copy
di = {}
di[0] = 0
for i in range(1, 2*(10**5)+1):
    di[i] = 0
for i in range(1, 2*(10**5)+1):
    count = 0
    for j in range(int(math.log2(i))+4):
        if (i>>j)&1:
            count += 1
    di[i] = di[i%count] + 1
n = int(input())
x = list(input())
x.reverse()
count = 0
for i in x:
    if i =='1':
        count += 1
mod_p = count + 1
mod_m = count - 1
di_p = {}
di_m = {}
for i in range(n):
    di_p[i] = pow(2, i, mod_p)
    if mod_m >= 1:
        di_m[i] = pow(2, i, mod_m)
s_p = 0
s_m = 0
for i in range(n):
    if x[i] == '1':
        s_p += di_p[i]
        s_m += di_m[i]
    else:
        continue
for i in range(n-1, -1, -1):
    sm = copy(s_m)
    sp = copy(s_p)
    if x[i] == '1' and (mod_m == 0 or mod_m == -1):
        print(0)
    elif x[i] == '1':
        sm -= di_m[i]
        sm %= mod_m 
        print(di[sm]+1)
    else:
        sp += di_p[i]
        sp %= mod_p
        print(di[sp]+1)


### FIXED CODE ###

import math
from copy import copy
di = {}
di[0] = 0
for i in range(1, 2*(10**6)+1):
    di[i] = 0
for i in range(1, 2*(10**6)+1):
    count = 0
    for j in range(int(math.log2(i))+4):
        if (i>>j)&1:
            count += 1
    di[i] = di[i%count] + 1
n = int(input())
x = list(input())
x.reverse()
count = 0
for i in x:
    if i =='1':
        count += 1
mod_p = count + 1
mod_m = count - 1
di_p = {}
di_m = {}
for i in range(n):
    di_p[i] = pow(2, i, mod_p)
    if mod_m >= 1:
        di_m[i] = pow(2, i, mod_m)
s_p = 0
s_m = 0
for i in range(n):
    if x[i] == '1':
        s_p += di_p[i]
        if mod_m >= 1:
            s_m += di_m[i]
    else:
        continue
for i in range(n-1, -1, -1):
    sm = copy(s_m)
    sp = copy(s_p)
    if x[i] == '1' and (mod_m == 0 or mod_m == -1):
        print(0)
    elif x[i] == '1':
        sm -= di_m[i]
        sm %= mod_m 
        print(di[sm]+1)
    else:
        sp += di_p[i]
        sp %= mod_p
        print(di[sp]+1)
import numpy as np

def LCS():
  X = input()
  Y = input()
  
  dp = np.zeros([len(Y) + 1,len(X) + 1],dtype = int)
  for y in range(len(Y)):
    for x in range(len(X)):
      if Y[y] == X[x]:
        #Xのi文字目とYのj文字目が一致した時のみ値が更新される
        #文字列が一致する直線、i - 1,j - 1目までの最大一致数に、1を足す
        dp[y + 1][x + 1] = dp[y][x] + 1
        
      else:
        dp[y + 1][x + 1] = max(dp[y][x + 1],dp[y + 1][x])
        
    
  x = len(X)
  y = len(Y)
  ans = ""
  
  while x > 0 and y > 0:
    if dp[y][x] == dp[y - 1][x]:
      y -= 1
    elif dp[y][x] == dp[y][x - 1]:
      x -= 1
    else:
      ans = Y[y - 1] + ans
      y,x = y - 1,x - 1
  
  print(ans)
  
LCS()


### FIXED CODE ###

import numpy as np
#文字列をASCII codeのリストで管理
S = np.array([ord(i) - 97 for i in input()], dtype=int)
T = np.array([ord(i) - 97 for i in input()], dtype=int)
ls = len(S)
lt = len(T)
#S[i] == T[j]であれば、i * j行列の[i,j]成分が1となる行列
equal = np.equal.outer(S,T).astype(int)
#print(equal)
 
dp = [np.zeros(lt + 1,dtype = int)]
#print(dp)
for i in range(ls):
  #追加された最後のdp列をx,newDPとする
  x = dp[-1].copy()
  newDP = x.copy()
  #一致しているところで1を足し、そうでないところはそのまま
  newDP[1:] = np.maximum(x[:-1] + equal[i],newDP[1:])
  #dp[i] = i以前のdpの最大値に更新
  np.maximum.accumulate(newDP, out = newDP)
  #最大共通部分を計算するだけなら一列のdp列を使い回せば良いが
  #文字列の復元のために、dp列を追加する
  dp.append(newDP)
  #print(dp)
 
 
ans = ""
i, j = ls, lt
#数列の復元と文字列への復元
while i > 0 and j > 0:
  if S[i - 1] == T[j - 1]:
    ans += chr(S[i - 1] + 97)
    i -= 1
    j -= 1
    continue
  if dp[i][j] == dp[i - 1][j]:
    i -= 1
  else:
    j -= 1

#リバース
print(ans[::-1])
a, b, c, d = map(int, input().split())

f = (c * d) // math.gcd(c, d)

ret_b = b - (b // c + b // d - b // f)
ret_a = (a - 1) - ((a - 1) // c + (a - 1) // d - (a - 1) // f)
ans = ret_b - ret_a
print(ans)


### FIXED CODE ###

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

f = (c * d) // fractions.gcd(c, d)

ret_b = b - (b // c + b // d - b // f)
ret_a = (a - 1) - ((a - 1) // c + (a - 1) // d - (a - 1) // f)
ans = ret_b - ret_a
print(ans)
n=int(input())
res=0
a1=int(input())
if a1!=0:
  print(-1)
  exit()
a2=int(input())
for  i in range(n-2):
  if a2-a1>1:
    print("-1")
    exit()
  if a2<=a1:
    res+=a1
  a1=a2
  a2=int(input())
if a2-a1>1:
    print("-1")
    exit()
res+=a2
print(res)

### FIXED CODE ###

n=int(input())
res=0
a1=int(input())
if a1!=0:
  print(-1)
  exit()
try:a2=int(input())
except:
      print("0")
      exit()
for  i in range(n-2):
  if a2-a1>1:
    print("-1")
    exit()
  if a2<=a1:
    res+=a1
  a1=a2
  a2=int(input()) 
if a2-a1>1:
    print("-1")
    exit()
if a2<=a1:
    res+=a1
res+=a2
print(res)
from collections import deque

def cndP(w):
    if len(w)>1:
        x = w.pop()
        cndP(w.copy())
        w.append(x)
        s = 0
        while(len(w)>0):
            s += w.pop()
            st.add(s)
    else:
        st.add(w[0])
        
def pIsAccptbl(w,k,p):
    tr = 0
    c = 0
    d = w.copy()
    while(d):
        tmp = d.popleft()
        if(tmp > p):
            return False
        
        if( tr + tmp > p):
            tr = tmp
            c += 1
        else:
            tr += tmp
        if c+1>k:
            return False
    return True

n,k = [int(x) for x in input().split()]
w = deque()

for i in range(n):
    w.append(int(input()))
    
st = set()
cndP(w.copy())
sorted_st = sorted(st)
for i in sorted_st:
    if pIsAccptbl(w,k,i):
        print(i)
        break

### FIXED CODE ###

from collections import deque

def isPa(w,k,p):
    tr = 0
    c = 0
    d = deque(w)
    while(d):
        tmp = d.popleft()
        if(tmp > p):
            return False
        
        if( tr + tmp > p):
            tr = tmp
            c += 1
        else:
            tr += tmp
        if c+1>k:
            return False
    return True

def MaxInP(w,k,p):
    maxinp = 0
    tmp = 0
    d = deque(w)
    while(d):
        tmp += d.popleft();
        if(tmp > p):
            if(tmp > maxinp):
                maxinp = tmp
            tmp = 0
    return maxinp

n,k = [int(x) for x in input().split()]
w = deque()
for i in range(n):
    w.append(int(input()))
    
mean = int(sum(w)/k)
maxinp = MaxInP(w,k,mean)

if k == 1:
    print(mean)
else:
    minP = mean
    maxP = maxinp
    while(True):
        m = int ((minP + maxP)/2)
        if ( isPa(w,k,m) ):
            maxP = m
        else:
            minP = m
        if (minP+1 == maxP or minP == maxP):
            print(maxP)
            break
n=int(input())
a=list(map(int,input().split()))
ans=a[0]
for i in range(1,n):
    ans=gcd(ans,a[i])
print(ans)


### FIXED CODE ###

from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
ans=a[0]
for i in range(1,n):
    ans=gcd(ans,a[i])
print(ans)
s = [int(input()) for i in range(3)]
temp = 0
for i in range(len(s)-1):
  for j in range(i):
    if s[i]-s[j] > s[5]:
      temp += 1
if temp == 0:
  print('Yay!')
else:
  print(':(')

### FIXED CODE ###

i = [int(input()) for i in range(6)]
temp = 0
if i[4] - i[3] > i[5]:
  temp += 1
if i[4] - i[2] > i[5]:
  temp += 1
if i[4] - i[1] > i[5]:
  temp += 1
if i[4] - i[0] > i[5]:
  temp += 1
if i[3] - i[2] > i[5]:
  temp += 1
if i[3] - i[1] > i[5]:
  temp += 1
if i[3] - i[0] > i[5]:
  temp += 1
if i[2] - i[1] > i[5]:
  temp += 1
if i[2] - i[0] > i[5]:
  temp += 1  
if i[1] - i[0] > i[5]:
  temp += 1  
if temp != 0:
  print(':(')
else:
  print('Yay!')
#!/usr/bin/env python3



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    St = list(input())
    T = input()

    # print(len(T))
    f = False
    for i in range(len(St)):
        if(St[i] == T[0]):
            cnt = 0
            for j in range(len(T)):
                if(T[j] == St[i+j] or St[i+j] == '?'):
                    # if(cnt == len(T)-1):
                    #     St[i:i+j] = T[j]
                    cnt += 1
                else:
                    break
            if(cnt == len(T)):
                for j in range(len(T)):
                    St[i+j] = T[j]
                f = True
    # print(St)
    if(f):
        print(''.join(St).replace('?', 'a'))
    else:
        print('UNRESTORABLE')
    
    
if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    S = input().replace('?', '.')
    T = input()

    import re
    import sys

    for i in range(len(S)-len(T),-1,-1):
        if(re.match(S[i:i+len(T)],T)):
            S = S.replace('.', 'a')
            print(S[:i]+T+S[i+len(T):])
            exit()
    else:
        print("UNRESTORABLE")
    
if __name__ == '__main__':
    main()
data = input().split()
data = data.sort()
print(data[2]+data[1])

### FIXED CODE ###

data = input().split()
print(int(sorted(data)[2] + sorted(data)[1]) + int(sorted(data)[0]))
import math
a, b = map(int, input().split())
n = math.gcd(a, b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

ans = set(prime_factorize(n))
print(len(ans)+1)

### FIXED CODE ###

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

def gcd(a, b):
    while b > 0:
        a, b = b, a%b
    return a
n = gcd(a, b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

ans = set(prime_factorize(n))
print(len(ans)+1)
import sys
sys.setrecursionlimit(10**6)

def cost(i,p=100,q=100,s=1,used=set()):
    if len(used)==n:
        return s
    if not used:
        used.add(i)
        x0,y0=xy[i]
        re=[]
        for j in range(n):
            if j==i:continue
            x,y=xy[j]
            used.add(j)
            re+=[cost(j,x-x0,y-y0,1,used)]
            used.remove(j)
        return min(re)
    x0,y0=xy[i]
    re=[]
    for j in range(n):
        if j in used:continue
        x,y=xy[j]
        used.add(j)
        if (x-x0,y-y0)==(p,q):
            re+=[cost(j,p,q,s,used)]
        else:
            re += [cost(j,p,q,s+1,used)]
        used.remove(j)
    return min(re)

n=int(input())
xy=[list(map(int,input().split())) for _ in range(n)]
mn=100
for i in range(n):
    c=cost(i)
    if c<mn:
        mn=c
print(mn)

### FIXED CODE ###

n=int(input())
xy=[list(map(int,input().split())) for _ in range(n)]
if n==1:
    print(1)
    exit()
pq={}
for i in range(n):
    x,y=xy[i]
    for j in range(n):
        if j==i:continue
        xx,yy=xy[j]
        p=xx-x
        q=yy-y
        pq.setdefault((p,q),0)
        pq[(p,q)]+=1
print(n-max(pq.values()))
sCard = [0] * 13
hCard = [0] * 13 
cCard = [0] * 13
dCard = [0] * 13

callNum = int(input())

for cardLoop in range(callNum-1):
    symbol, cardNum = input().split()
    cardNum = int(cardNum)
    if symbol == "S":
        sCard[cardNum-1] = cardNum
    elif symbol == "H":
        hCard[cardNum-1] = cardNum
    elif symbol == "C":
        cCard[cardNum-1] = cardNum
    elif symbol == "D":
        dCard[cardNum-1] = cardNum

sLack = 0
hCard = 0
cCard = 0
dCard = 0

for cardLoop in range(13):
    if sCard[cardLoop] == 0:
        sLack = sLack + 1
    elif hCard[cardLoop] == 0:
        hLack = hLack +1
    elif cCard[cardLoop] == 0:
        cLack = cLack +1    
    elif dCard[cardLoop] == 0:
        dLack = dLack +1

print("S " + str(sLack))
print("H " + str(hLack))
print("C " + str(cLack))
print("D " + str(dLack))


### FIXED CODE ###

sCard = [0] * 13
hCard = [0] * 13 
cCard = [0] * 13
dCard = [0] * 13

callNum = int(input())

for cardLoop in range(callNum):
    symbol, cardNum = input().split()
    cardNum = int(cardNum)
    if symbol == "S":
        sCard[cardNum-1] = cardNum
    elif symbol == "H":
        hCard[cardNum-1] = cardNum
    elif symbol == "C":
        cCard[cardNum-1] = cardNum
    elif symbol == "D":
        dCard[cardNum-1] = cardNum

sLack = 0
hLack = 0
cLack = 0
dLack = 0

for cardLoop in range(13):
    if sCard[cardLoop] == 0:
        print("S " + str(cardLoop+1))
for cardLoop in range(13):
    if hCard[cardLoop] == 0:
        print("H " + str(cardLoop+1))
for cardLoop in range(13):
    if cCard[cardLoop] == 0:
        print("C " + str(cardLoop+1))
for cardLoop in range(13):
    if dCard[cardLoop] == 0:
        print("D " + str(cardLoop+1))
W, H, x, y, r = list(map(int, input().split()))

if x >= r and x <= (W - r):
    if y >= r and y <= (H - r):
        print("Yes")
    else:
        print("No")
else:
    print("No")

### FIXED CODE ###

W, H, x, y, r = list(map(int, input().split()))

if x >= r and x <= (W - r):
    if y >= r and y <= (H - r):
        print("Yes")
    else:
        print("No")
else:
    print("No")
def solve():
    s = input()
    ans = 0
    hoge = []
    for i in s:
        if i == "R":
            ans += 1
            hoge.append(ans)
    print(min(hoge))
    return 0

if __name__ == "__main__":
    solve()

### FIXED CODE ###

def solve():
    s = input()
    ans = 0
    hoge = [0]
    for i in s:
        if i == "R":
            ans += 1
            hoge.append(ans)
        else:
            ans = 0
    print(max(hoge))
    return 0

if __name__ == "__main__":
    solve()
n = int(input())
numbers = list(map(int, input().split()))

res = 0

for i in range(n):
  count = 0
  while True:
    if numbers[i]%2 == 1:
      break
    else:
      count += 1
  
  if count > res:
    res = count

print(res)

### FIXED CODE ###

s = input()
count = 0

for i in range(3):
  if s[i] == '1':
    count += 1
    
print(count)
import collections

n = int(input())
m = [input() for i in range(n)]

ans = [0,0,0,0]

for i in m:
    if i == "AC":
        ans[0] += 1
    elif i == "WA":
        ans[1] += 1
    elif i == "TLE":
        ans[2] += 1
    elif i == "RE":
        nas[3] += 1
    
    
    
print("AC x "+str(ans[0])) 
print("WA x "+str(ans[1]))
print("TLE x "+str(ans[2]))
print("RE x"+str(ans[3]))

### FIXED CODE ###

n = int(input())
m = [input() for i in range(n)]
 
ans = [0,0,0,0]
 
for i in m:
    if i == "AC":
        ans[0] += 1
    elif i == "WA":
        ans[1] += 1
    elif i == "TLE":
        ans[2] += 1
    elif i == "RE":
        ans[3] += 1
    
    
    
print("AC x "+str(ans[0])) 
print("WA x "+str(ans[1]))
print("TLE x "+str(ans[2]))
print("RE x "+str(ans[3]))
n = int(input())
l = []
for i in range(n):
  l.append(''.join(sorted(input())))
s = set(l)

def f(k):
  return k*f(k-1) if k>1 else 1
def c(n, k):
  return f(n)//(f(n-k)*f(k)) if n>=k else 0

print(sum(c(l.count(a), 2) for a in s))

### FIXED CODE ###

n = int(input())
l = []
for i in range(n):
  l.append(''.join(sorted(input())))
l.sort()

cnt = 0
ans = 0
for i in range(n-1):
  if l[i+1] == l[i]:
    cnt += 1
    ans += cnt
  else:
    cnt = 0
print(ans)
s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print("Heisei")
elif s[0]=2019 and s[1]<5:
  print("Heisei")
else:
  print("TBD")

### FIXED CODE ###

s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print("Heisei")
elif s[0]==2019 and s[1]<5:
  print("Heisei")
else:
  print("TBD")
N=int(input())
S=str(input())
K=int(input())
Slist = list(S)
for i in range(N):
    if S[K-1]!=S[i]:
        Slist[i]='*'
        S_changed="".join(Slist)
print(S_changed)


### FIXED CODE ###

N=int(input())
S=str(input())
K=int(input())
Slist = list(S)
S_changed= S
for i in range(N):
    if S[K-1]!=S[i]:
        Slist[i]='*'
        S_changed="".join(Slist)
print(S_changed)
while(1):
  count = input()
  if count == 0: break
  original_cube = [1, 2, 3, 4, 5, 6]
  operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]}
  sum = 1
  for i in xrange(count):
    new_cube = []
    for e in operation[input()]:
      new_cube.append(previous_cube[e])
    sum += new_cube[0]
    previous_cube = new_ccube
  print sum

### FIXED CODE ###

while 1:
  n = input()
  if n == 0:  break
  d = range(1, 7)
  ans = 1
  for i in range(n):
    c = raw_input()[0]
    if c == 'N': S = [1,5,2,3,0,4]
    elif c == "S": S = [4,0,2,3,5,1]
    elif c == "E": S = [3,1,0,5,4,2]
    elif c == "W": S = [2,1,5,0,4,3]
    elif c == "R": S = [0,2,4,1,3,5]
    elif c == "L": S = [0,3,1,4,2,5]
    d = [d[s] for s in S]
    ans += d[0]
  print ans
from collections import deque
N, X, Y = map(int, input())
edge = [[] for _ in range(N)]
for i in range(N - 1):
    edge[i].append(i + 1)
    edge[i + 1].append(i)
edge[X-1].append(Y-1)
edge[Y-1].append(X-1)

cnt = [0] * (N - 1)


def search(i):
    node = deque([i])
    seen = [-1] * N
    seen[i] = 0

    while node:
        s = node.popleft()
        d = seen[s]
        for t in edge(s):
            if seen[t] == -1:
                seen[t] = d + 1
                if s < t:
                    cnt[d] += 1
                node.append(t)


for i in range(N - 1):
    search(i)
print(*cnt, sep="\n")

### FIXED CODE ###

from scipy.sparse.csgraph import dijkstra
import numpy as np
N, X, Y = map(int, input().split())
X -= 1
Y -= 1

g = np.zeros((N, N), dtype=int)
a = np.arange(N - 1)
np.add.at(g, (a, a + 1), 1)
np.add.at(g, (a + 1, a), 1)
np.add.at(g, (X, Y), 1)
np.add.at(g, (Y, X), 1)
fw = dijkstra(g, directed=False)
fw = (fw + 0.5).astype(int)
fw = np.tril(fw).ravel()
fw = fw[fw > 0]

cnt = np.bincount(fw).tolist()
ans = [0] * (N - 1)
for i, c in enumerate(cnt[1:]):
    ans[i] = c

print(*ans, sep="\n")
X = int(input())
DP = [0 for i in range(100000)]
DP[0] = 1
a = [100, 101, 102, 103, 104, 105]
for i in a:
    for j in range(X):
        if DP[j] == 1:
            DP[j + i] = 1
print(DP[X])

### FIXED CODE ###

X = int(input())
import sys
q = X // 100
r = X % 100
if r >= 0 and r <= 5 * q:
    print(1)
    sys.exit()
print(0)
N, M = (int(x) for x in input().split())
k = {}
j = True
ans = []

for i in range(M):
    a, b = input().split()
    a = int(a)
    ans.append("0")
    if a not in k.keys():
        k[a] = b
    else:
        if k[a] != b:
            j = False
            break

for n in range(N):
    if n + 1 in k.keys():
        ans[n] = k[n + 1]

if j:
    f = int("".join(ans))
    print(f)
else:
    print(-1)

### FIXED CODE ###

def main():
    N, M = (int(x) for x in input().split())
    SC = [list(map(int, input().split())) for _ in range(M)]
    for i in range(10 ** N):
        _str = str(i)
        k = True
        if len(_str) == N:
            for j in range(M):
                if _str[SC[j][0]-1] != str(SC[j][1]):
                    k = False
            if k:
                return print(i)
    return print('-1')

if __name__ == "__main__":
    main()
a = input()
ans = char(ord(a) + 1)

print(ans)

### FIXED CODE ###

s = input()

print(chr(ord(s) + 1))
a=stdin.readline().rstrip())

x=a.count("1")
print("x")






### FIXED CODE ###

from sys import stdin
a=stdin.readline().rstrip()
x=a.count("1")
print(x)
from collections import defaultdict,deque
import sys
input=sys.stdin.readline
N,M=map(int,input().split())
G=defaultdict(set)
for i in range(M):
  a,b,c=map(int,input().split())
  G[(a-1,c-1)].add((b-1,c-1))
  G[(b-1,c-1)].add((a-1,c-1))
  G[(a-1,-1)].add((a-1,c-1))
  G[(b-1,-1)].add((b-1,c-1))
  G[(a-1,c-1)].add((a-1,-1))
  G[(b-1,c-1)].add((b-1,-1))
def BFS(x):
  d={}
  for k in G.keys():
    d[k]=float("inf")
  d[x]=0
  stack=deque([(x,-1,0)])
  while stack:
    a,c,m=stack.popleft()
    if a==N-1 and c==-1:
      return m
    d[(a,c)]=min(d[(a,c)],m)
    if c>=0:
      for i in G[(a,c)]:
        if d[i]>10**30:
          stack.appendleft((i[0],i[1],m))
    else: 
      for i in G[(a,c)]:
        if d[i]>10**30:
          stack.append((i[0],i[1],m+1))
  return -1

print(BFS(0))



      
    

### FIXED CODE ###

from collections import defaultdict,deque
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
N,M=map(int,input().split())
if M==0:
  print(-1)
  exit()
G=defaultdict(set)
for i in range(M):
  a,b,c=map(int,input().split())
  G[a+(c<<30)].add(b+(c<<30))
  G[b+(c<<30)].add(a+(c<<30))
  G[a].add(a+(c<<30))
  G[b].add(b+(c<<30))
  G[a+(c<<30)].add(a)
  G[b+(c<<30)].add(b)
def BFS(x):
  d={}
  for k in G.keys():
    d[k]=float("inf")
  stack=deque([(x,0)])
  if x not in d:
    return -1
  while stack:
    s,m=stack.popleft()
    if s==N:
      return m
    if d[s]>m:
      d[s]=m
      if s>=(1<<30):
        for i in G[s]:
          if d[i]>10**30:
            stack.appendleft((i,m))
      else: 
        for i in G[s]:
          if d[i]>10**30:
            stack.append((i,m+1))
  return -1

print(BFS(1))
N = int(input())
H = list(map(int,input().split()))
cnt = 0
for i in range(N-1):
  if H[i]-H[i+1]=1:
    H[i] = H[i]-1
  elif H[i]-H[i+2]>1:
    cnt = 1
    break
if cnt == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

A,B,C = map(int,input().split())
ans = C-(A-B)
if ans<=0:
  print(0)
else:
  print(ans)
n=int(input())
sum=0

for i in range[n+1]:
  if i%3==1 or i%3==2:
    if i%5==1 or i%5==2 or i%5==3 or i%5==4:
      sum+=i
print sum


### FIXED CODE ###

n=int(input())
sum=0

for i in range(1,n+1):
  if i%3!=0 and i%5!=0:
    sum+=i
print(sum)
mod = 10**9 + 7
n = int(input())
lx = list(map(int, input().split()))

from math import factorial as kj

d = 0
lk = [0] * n

for i in range(1, n):
  d += kj(n-1) // i
  lk[i] = (lx[i] - lx[i-1]) * d

print(sum(lk) % mod)

### FIXED CODE ###

n = int(input())
l = [input().split() for _ in range(n)]
x = input()

flg = 0
ans = 0
for s, t in l:
    if flg == 1:
        ans += int(t)
    if s == x:
        flg = 1
print(ans)
[X,K,D]=[int(_) for _ in input().split()]
for _ in [0]*K:
  X = X-D if abs(X-D) < abs(X+D) else X+D
print(abs(X))

### FIXED CODE ###

[X,K,D]=[int(_) for _ in input().split()]
X=abs(X)
Y=X//D
if Y <= K:
  X-=Y*D
  if (K-Y)%2 != 0:
    X = abs(X-D) if abs(X-D) < abs(X+D) else abs(X+D)
else:
  X-=K*D
print(X)
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

r1,c1,r2,c2=map(int,input().split())

print((cmb(r2+c2+2,c2+1,mod)+cmb(r1+c1,r1,mod)-cmb(r1+c2+1,c2+1,mod)-cmb(r2+c1+1,c1,mod))%mod)

### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**6+2
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

r1,c1,r2,c2=map(int,input().split())

print((cmb(r2+c2+2,c2+1,mod)+cmb(r1+c1,r1,mod)-cmb(r1+c2+1,c2+1,mod)-cmb(r2+c1+1,c1,mod))%mod)
import collections
import bisect
n = int(input())
a = list(map(int,input().split()))
A = collections.Counter(a)
Key = set(a)
Key = list(Key)
Val = []
for val in A.values():
    Val.append(val)
ans = 0
for i in range(len(Val)):
    ans+= ((Val[i])*(Val[i]-1))//2
for i in range(n):
    s = bisect.bisect_left(Key,a[i])
    d1 = (Val[s]*(Val[s]-1))//2
    Val[s]-=1
    d2 = (Val[s]*(Val[s]-1))//2
    ans1 = ans - (d1-d2)
    print(ans1)
    Val[s]+=1

### FIXED CODE ###

import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

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

#ひとつものぞかず、同じ数のボールをとるのは？
c = collections.Counter(a)
maxa = 0
item = [0 for i in range(max(a))]
for key,value in c.items():
    item[key-1] = value
    maxa += (value)*(value-1)//2
for i in range(len(a)):
    d = (item[a[i]-1])*(item[a[i]-1]-1)//2-(item[a[i]-1]-1)*(item[a[i]-1]-2)//2
    print(maxa-d)
import numpy
h=int(input())
p=int(numpy.log2(h))
print(2**(p+1)-1)

### FIXED CODE ###

import numpy
h=int(input())
p=int(numpy.log2(h))
print(2**(p+1)-1)