Harryxun/stf_run huggingface dataset:
def collaz(n):
    if n%2 == 0:
        return n//2
    else:
        return 3*n+1

s = int(input())

box = [-1]*(int(1e10))

i = 1

while 1:
    if box[collaz(s)] == 1:
        print(i+1)
        break
    else:
        box[collaz(s)] = 1
        s = collaz(s)
        i += 1
    

### FIXED CODE ###

def collaz(n):
    if n%2 == 0:
        return n//2
    else:
        return int(3*n+1)

s = int(input())

box = [-1]*(int(1e6+1))

box[s] = 1

i = 1

while 1:
    if box[collaz(s)] == 1:
        print(i+1)
        break
    else:
        box[collaz(s)] = 1
        s = collaz(s)
        i += 1
while 1:
	n=input()
	if n==0:break
	p=raw_input().split()+["end"]
	sp=p[0]
	for i in range(n):
		if str(int(p[i])+1)!=p[i+1]:
			print sp+"-"+p[i], if sp!=p[i] else sp,
			sp=p[i+1]
	print

### FIXED CODE ###

while 1:
	n=input()
	if n==0:break
	p=raw_input().split()+["end"]
	sp=p[0]
	for i in range(n):
		if str(int(p[i])+1)!=p[i+1]:
			if sp!=p[i]:
				print sp+"-"+p[i],
			else:
				print sp,
			sp=p[i+1]
	print
L, R = map(int,input().split())

mod = 2019
for i in range(1000):
  if L <= 3**i%(1e9+7) <= R or L <= 673**i%(1e9+7) <= R or L <= 3*673*i%(1e9+7) <= R or L <= 3*i%(1e9+7) <= R or L <= 673*i%(1e9+7) <= R or L <= 3*673**i%(1e9+7) <= R:
    print(0)
    exit()
else:
  print(min((L*(L+1))%mod, R*(R-1)%mod, R*L%mod))

### FIXED CODE ###

L, R = map(int,input().split())

R = min(R, L+673)
ans = 2018
for i in range(L, R+1):
  for j in range(i+1, R+1):
    ans = min(ans, i*j%2019)
print(ans)
N, M, Q = map(int, input().split())

A = []
B = []
C = []
D = []

for i in range(Q):
    a, b, c, d = map(int, input().split())
    A.append(a)
    B.append(b)
    C.append(c)
    D.append(d)


def dfs(nums):

    if len(nums) == N + 1:
        score = 0
        for j in range(Q):
            if nums[B[j]] - nums[A[j]] == C[j]:
                score += D[j]
        return score

    max_score = 0
    for i in range(nums[-1], M+1):
        new_nums = nums + [i]
        max_score = max(max_score, dfs(new_nums))

    return max_score

nums[1]
res = dfs(nums)
print(res)

### FIXED CODE ###

N, M, Q = map(int, input().split())
 
A = []
B = []
C = []
D = []
 
for i in range(Q):
    a, b, c, d = map(int, input().split())
    A.append(a)
    B.append(b)
    C.append(c)
    D.append(d)
 
 
def dfs(nums):
 
    if len(nums) == N + 1:
        score = 0
        for j in range(Q):
            if nums[B[j]] - nums[A[j]] == C[j]:
                score += D[j]
        return score
 
    max_score = 0
    for i in range(nums[-1], M+1):
        new_nums = nums + [i]
        max_score = max(max_score, dfs(new_nums))
 
    return max_score
 
nums = [1]
res = dfs(nums)
print(res)
N=int(input())
S=list(input())
if S[0] == S[1]:
  S[0]==" "
for i in range(1,N):
  if S[i-1]==S[i]:
    S[i-1]=" "
A=[]
for i in range(N):
      if S[i]!=" ":
            A.append(S[i])
print(len(A))


### FIXED CODE ###

N=int(input())
S=list(input())
if N == 1:
  print(1)
if N>=2:
  if S[0] == S[1]:
    S[0]==" "
  for i in range(1,N):
    if S[i-1]==S[i]:
      S[i-1]=" "
  A=[]
  for i in range(N):
        if S[i]!=" ":
              A.append(S[i])
  print(len(A))
import sys
import collections

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    x = [list(map(int, input().split())) for _ in range(n)]

    dist = [(x[j][0] - x[i][0], x[j][1] - x[i][1]) for j in range(n) for i in range(n)]
    c = collections.Counter(dist)
    ans = c.most_common()
    print(n - ans[1][1])

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import collections

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    x = [list(map(int, input().split())) for _ in range(n)]

    if n == 1:
        print(1)
    else:
        dist = [(x[j][0] - x[i][0], x[j][1] - x[i][1]) for j in range(n) for i in range(n)]
        c = collections.Counter(dist)
        ans = c.most_common()
        print(n - ans[1][1])

if __name__ == '__main__':
    main()
def main():
  from statistics import mean
  from math import floor,ceil

  n = int(input())
  x = list(map(int, input().split()))
  x_mean = mean(x) 
  if x_mean == 0.5:
      greater_than_x = len([i for i in x if i > x_mean])
      if greater_than_x * 2 >= n:
          x_mean = ceil(x_mean)
      else:
          x_mean = floor(x_mean)
  elif x_mean % 1 > 0.5:
      x_mean = ceil(x_mean)
  else:
      x_mean = floor(x_mean)
  x2 = [(num - x_mean)**2 for num in x]
  print(sum(x2))

main()

### FIXED CODE ###

def main():
  from statistics import mean
  from math import floor,ceil

  n = int(input())
  x = list(map(int, input().split()))
  x_mean = mean(x) 
  if x_mean == 0.5:
      greater_than_x = len([i for i in x if i > x_mean])
      if greater_than_x * 2 >= n:
          x_mean = ceil(x_mean)
      else:
          x_mean = floor(x_mean)
  elif x_mean % 1 > 0.5:
      x_mean = ceil(x_mean)
  else:
      x_mean = floor(x_mean)
  x2 = [(num - x_mean)**2 for num in x]
  print(sum(x2))

main()
N = int(input())

mod = 10 ** 9 + 7

print((pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)) % mod)

### FIXED CODE ###

N = int(input())

print(((10 ** N - 2 * 9 ** N + 8 ** N) % (10 ** 9 + 7)))
n=int(input())
a=list(map(int,input().split()))
if n==1:
print(a[0])
else:
l=list(map(lambda z:z**2,a)
x=sum(a)
y=sum(l)
t=(x-y)//2
if t>(10**9+7):
       print(t%(10**9+7))
else:
       print(t)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
l=list(map(lambda z:z**2,a))
x=sum(a)**2
y=sum(l)
t=(x-y)//2
if t>(10**9+7):
       print(t%(10**9+7))
else:
       print(t)
s=input()
count=0
for i in range(len(s)):
    if s[i]=="A" or s[i]=="?":
        for j in range(len(s)-1,i+1,-1):
            if s[j]=="C" or s[j]=="?":
                k=s[i+1:j]
                bb=k.count("B")
                dd=k.count("?")
                count=((count+bb*3**dd+dd*3**(dd-1))/(10**9+7))
print(int(count))

### FIXED CODE ###

import sys
input = sys.stdin.readline
MOD = 10 ** 9 + 7

def main():
    string = input().strip()
    n = len(string)
    dp = [[0, 0, 0, 0] for _ in range(n + 1)]
    dp[0][0] = 1
    for i, s in enumerate(string):
        if s == "A":
            dp[i + 1][0] = dp[i][0]
            dp[i + 1][1] = dp[i][1] + dp[i][0]
            dp[i + 1][2] = dp[i][2]
            dp[i + 1][3] = dp[i][3]
        elif s == "B":
            dp[i + 1][0] = dp[i][0]
            dp[i + 1][1] = dp[i][1]
            dp[i + 1][2] = dp[i][2] + dp[i][1]
            dp[i + 1][3] = dp[i][3]
        elif s == "C":
            dp[i + 1][0] = dp[i][0]
            dp[i + 1][1] = dp[i][1]
            dp[i + 1][2] = dp[i][2]
            dp[i + 1][3] = dp[i][3] + dp[i][2]
        else:
            dp[i + 1][0] = 3 * dp[i][0]
            dp[i + 1][1] = 3 * dp[i][1] + dp[i][0]
            dp[i + 1][2] = 3 * dp[i][2] + dp[i][1]
            dp[i + 1][3] = 3 * dp[i][3] + dp[i][2]
        for j in range(4):
            dp[i + 1][j] %= MOD
    print(dp[-1][-1] % MOD)
    
main()
import sys,os
import math
from fractions import Fraction 
from collections import defaultdict
from random import randint

# sys.stderr=open('err.txt','w')
# sys.stdout=open('output.txt','w')
# sys.stdin=open('input.txt','r')

def linput():
    return list(minput())

def minput():
    return map(int, sys.stdin.readline().strip().split())

###############################################################

def make_set(a,parent):
    parent[a]=a

def find_set(a,parent):
    if parent[a]==a:
        return a
    parent[a]=find_set(parent[a])
    return parent[a]

def union_set(a,b,parent):
    x=find_set(a)
    y=find_set(b)
    if x==y:
        return
    else:
        parent[y]=x

n,m=minput()
parent=[0]*n
for i in range(n):
    make_set(i,parent)
ans=0
for i in range(m):
    x,y=minput()
    if x>y:
        x,y=y,x
    x=x-1
    y=y-1
    union_set(x,y,parent)
# print(parent)
di = defaultdict(int)
for i in parent:
    di[i]+=1
# print(di)
for k,v in di.items():
    ans=max(ans,v)
print(ans)


### FIXED CODE ###


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

par = [i for i in range(N)]

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

def unite(x, y):
  x = find(x)
  y = find(y)
  if x > y:
    par[x] = y
    find(x)
  else:
    par[y] = x
    find(y)
if M > 0:  
  for i in range(M):
    a, b = map(int, input().split())
    unite(a - 1, b - 1)
  
  ans = [0] * N
  Max = 0
  for i in range(N):
    find(i)
  for i in par:
    ans[i] += 1
  for i in ans:
    if i > Max:
      Max = i
  
  print(Max)
else:
  print(1)
abcd = input()
bin_pattern_digit = len(abcd) - 1

for i in range(1 << bin_pattern_digit):
    # 初期値:一番左の桁の値。
    result = int(abcd[0:1])
    for j in range(bin_pattern_digit):
        # +を入れた場合
        # 例：1234のパターン1「+」2の場合：i=0の時に+2(abcd[1:2])する必要がある。
        #                 3「-」4の場合：i=2の時に-4(abcd[3:4])する必要がある。
        if i & 1 << j:
            result += int(abcd[j + 1:j + 2])
        # -を入れた場合
        else:
            result -= int(abcd[j + 1:j + 2])

    # 合計が7なら終了
    if result == 7:
        break

# 注意：
# bit変数(i)の結果を確認する場合、文字列とスライスの併用(str(bit(i[0:1])))は使えない。
# 数値と同じで、先頭0は消される = 桁数が可変であるため。
# i & 1 << 0  # 1桁目が真か確認。
# i & 1 << 1  # 2桁目が真か確認。
# -dev-
print(abcd[0:1] + conv_bin(i, 2) + abcd[1:2] + conv_bin(i, 1) + abcd[2:3] + conv_bin(i, 0) + abcd[3:4] + "=7")


### FIXED CODE ###


def conv_bin(i, digit):
    if i & 1 << digit:
        return "+"
    else:
        return "-"


if __name__ == "__main__":
    abcd = input()
    bin_pattern_digit = len(abcd) - 1

    for i in range(1 << bin_pattern_digit):
        # 初期値:一番左の桁の値。
        result = int(abcd[0:1])
        for j in range(bin_pattern_digit):
            # +を入れた場合
            # 例：1234のパターン1「+」2の場合：i=0の時に+2(abcd[1:2])する必要がある。
            #                 3「-」4の場合：i=2の時に-4(abcd[3:4])する必要がある。
            if i & 1 << (bin_pattern_digit - j -1 ):
                # result += int(abcd[j + 1:j + 2])
                result += int(abcd[j + 1])
            # -を入れた場合
            else:
                # result -= int(abcd[j + 1:j + 2])
                result -= int(abcd[j + 1])

        # 合計が7なら終了
        if result == 7:
            break

    # 注意：
    # bit変数(i)の結果を確認する場合、文字列とスライスの併用(str(bit(i[0:1])))は使えない。
    # 数値と同じで、先頭0は消される = 桁数が可変であるため。
    # i & 1 << 0  # 1桁目が真か確認。
    # i & 1 << 1  # 2桁目が真か確認。
    # -dev-
    print(abcd[0:1] + conv_bin(i, 2) + abcd[1:2] + conv_bin(i, 1) + abcd[2:3] + conv_bin(i, 0) + abcd[3:4] + "=7")
n,m,q = map(int,input().split())
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

mm = [0]*m

for k in range(1,m+1,1):
    mm[k-1]=k

A = list(itertools.combinations_with_replacement(mm, n))
su = 0
ans = 0

for x in range(len(A)):
    l=A[x]
    su = 0
    for h in range(q):
        if l[b[h]-1]-l[a[h]-1] == c[h]:
            su += d[h]

    if su > ans:
        ans = su

print(str(ans))

### FIXED CODE ###

import itertools

n,m,q = map(int,input().split())
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

mm = [0]*m

for k in range(1,m+1,1):
    mm[k-1]=k

A = list(itertools.combinations_with_replacement(mm, n))
su = 0
ans = 0

for x in range(len(A)):
    l=A[x]
    su = 0
    for h in range(q):
        if l[b[h]-1]-l[a[h]-1] == c[h]:
            su += d[h]

    if su > ans:
        ans = su

print(str(ans))
def LCS():
  x = raw_input()
  y = raw_input()
  X = len(x)
  Y = len(y)

  lcs = 0
  for i in range(X + 1):
    c[i][0] = 0
  for j in range(Y + 1):
    c[0][j] = 0

  for i in range(1,X + 1):
    for j in range(1, Y + 1):
      if X[i] == Y[j]: 
        c[i][j] = c[i - 1][j - 1] + 1

      else:
        c[i][j] = max(c[i - 1][j], c[i][j - 1])
  lcs = max(c[i][j], lcs)

  print lcs

q = input()

for i in range(q):
  LCS()

  
    

### FIXED CODE ###

def LCS():
    X = raw_input()
    Y = raw_input()
 
    a, b = len(X), len(Y)
    c1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = X[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == Y[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
 
n = input()
for i in range(n):
    print LCS()
n = int(input())
nums = list(map(int, input().split()))

res = nums.copy()

for i in range(n // 2, 0, -1):
    res[i] = 0
    for j in range(1, n // i + 1):
        res[i] += res[i * j]
    res[i] %= 2
for elem in res:
    print(elem)


### FIXED CODE ###

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

bs = nums.copy()
res = []

for i in range(n // 2, 0, -1):
    val = 0
    for j in range(1, n // i + 1):
        if i * j <= n:
            val += bs[i * j - 1]
    bs[i - 1] = val % 2
for i in range(n):
    if bs[i] > 0:
        res.append(i + 1)
m = sum(bs)
print(m)
if m > 0:
    print(' '.join(map(str, res)))
from sys import stdin
import math
colomns = int(stdin.readline().rstrip())
datas = [stdin.readline().rstrip().split() for _ in range(1,colomns+1,1)]
for data in datas:
    A = int(data[0])
    B = int(data[1])
    C = int(data[2])
    D = int(data[3])
    if A < B:
        print("No")
        continue
    if D < B:
        print("No")
        continue
    if C > B:
        print("Yes")
        continue
    g = math.gcd(B,D)
    if (B - g + A % g) >C :
        print("No")
    else:
        print("Yes")     
    


### FIXED CODE ###

from sys import stdin
from fractions import gcd
columns = int(stdin.readline().rstrip())
datas = [stdin.readline().rstrip().split() for _ in range(columns)]
for data in datas:
    A = int(data[0])
    B = int(data[1])
    C = int(data[2])
    D = int(data[3])
    if A < B:
        print("No")
        continue
    if D < B:
        print("No")
        continue
    if C > B:
        print("Yes")
        continue
    g = gcd(B,D)
    if (B - g + A % g) >C :
        print("No")
    else:
        print("Yes")
u = int(input())
two = 0
five = 0
while u > 1:
  if u % 2 == 0:
    two = two  + 1
  if u % 5 == 0:
    five = five + 1
  u = u - 2
print(min(two ,five)

### FIXED CODE ###

def findTrailingZeros(n): 
      
    if (n%2!=0): 
        return 0

    else: 
        ans = 0
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        return ans 
  
n = int(input())
  
print(findTrailingZeros(n))
import array

def merge_sort(A):
    if len(A) <= 1:
        return A, 0
    mid = len(A) // 2
    left, lcount = merge_sort(A[:mid])
    right, rcount = merge_sort(A[mid:])
    merged, count = merge(left, right)
    return merged, lcount + rcount + count

def merge(left, right):
    lpos = 0
    rpos = 0
    rcount = 0
    merged = array.array('h', [])  # List is too slow, so use array instead
    len_left = len(left)
    len_right = len(right)
    while lpos < len_left and rpos < len_right:
        if left[lpos] < right[rpos]:
            merged.append(left[lpos])
            lpos += 1
        else:
            merged.append(right[rpos])
            rpos += 1
            rcount += len(left[lpos:])
    
    if left[lpos:]:
        merged.extend(left[lpos:])
    if right[rpos:]:
        merged.extend(right[rpos:])
    
    return merged, rcount
    
if __name__ == '__main__':
    n = int(raw_input())
    A = array.array('h', map(int, raw_input().split()))
    
    sorted, count = merge_sort(A)
    #print ' '.join(str(x) for x in sorted)
    print count

### FIXED CODE ###

from array import array

def merge_sort(A):
    if len(A) <= 1:
        return A, 0
    mid = len(A) // 2
    left, lcount = merge_sort(A[:mid])
    right, rcount = merge_sort(A[mid:])
    merged, count = merge(left, right)
    return merged, lcount + rcount + count

def merge(left, right):
    lpos = 0
    rpos = 0
    rcount = 0
    merged = array('I', [])  # List is too slow. Use an array instead.
    len_left = len(left)
    len_right = len(right)
    while lpos < len_left and rpos < len_right:
        if left[lpos] < right[rpos]:
            merged.append(left[lpos])
            lpos += 1
        else:
            merged.append(right[rpos])
            rpos += 1
            #rcount += len(left[lpos:])
            rcount += len_left - lpos
    
    if left[lpos:]:
        merged.extend(left[lpos:])
    if right[rpos:]:
        merged.extend(right[rpos:])
    
    return merged, rcount
    
if __name__ == '__main__':
    n = int(raw_input())
    A = array('I', map(int, raw_input().split()))
    
    sorted, count = merge_sort(A)
    #print ' '.join(str(x) for x in sorted)
    print count
N = int(input())
dlist = list(map(int, input().split()))

dlist.sort()
print(dlist[N/2]-dlist[N/2-1])

### FIXED CODE ###

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

dlist.sort()
N = int(N/2)
print(dlist[N]-dlist[N-1])
# EDP F-LCS
import sys
input = sys.stdin.readline


def main():
    S = input()
    T = input()

    dp = [[[0, ""] for j in range(len(t)+1)] for i in range(len(s)+1)]

    for i, s in enumerate(S):
        for j, t in enumerate(T):
            if s == t:
                dp[i+1][j+1] = [dp[i][j][0]+1, dp[i][j][1]+s[i]]
            else:
                if dp[i+1][j][0] >= dp[i][j+1][0]:
                    dp[i+1][j+1] = dp[i+1][j]
                else:
                    dp[i+1][j+1] = dp[i][j+1]

    print(dp[len(s)][len(t)][1])


if __name__ == "__main__":
    main()


### FIXED CODE ###

# EDP F-LCS
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

ans = ""


def main():
    S = input()
    T = input()
    LS = len(S)
    LT = len(T)
    dp = [[0 for j in range(LT+1)] for i in range(LS+1)]

    for i, s in enumerate(S):
        for j, t in enumerate(T):
            if s == t:
                dp[i+1][j+1] = dp[i][j]+1
            else:
                if dp[i+1][j] >= dp[i][j+1]:
                    dp[i+1][j+1] = dp[i+1][j]
                else:
                    dp[i+1][j+1] = dp[i][j+1]

    def rec(i, j):
        if i == 0 or j == 0:
            return

        if S[i-1] == T[j-1]:
            global ans
            ans += S[i-1]
            rec(i-1, j-1)
        elif dp[i-1][j] > dp[i][j-1]:
            rec(i-1, j)
        else:
            rec(i, j-1)

    rec(LS, LT)
    print(ans[::-1])


if __name__ == "__main__":
    main()
n,k=map(int, input().split())
if k%2==0:
    x=0
    y=0
    for i in range(1,n+1):
        if i%k==k//2:
            x+=1
        if i%k==0:
            y+=1
    ans=0
    if x>=1:
        ans+=com(x,1)
    if x>=2:
        ans+=6*com(x,2)
    if x>=3:
        ans+=6*com(x,3)
    if y>=1:
        ans+=com(y,1)
    if y>=2:
        ans+=6*com(y,2)
    if y>=3:
        ans+=6*com(y,3)
    print(ans)
else:
    x=0
    for i in range(1,n+1):
        if i%k==0:
            x+=1
    ans=0
    if x>=1:
        ans+=com(x,1)
    if x>=2:
        ans+=6*com(x,2)
    if x>=3:
        ans+=6*com(x,3)
    print(ans)
    
def com(a,b):
    r=1
    for i in range(b):
        r*=(a-i)
        r//=i+1
    return r

### FIXED CODE ###

n,k=map(int, input().split())
def com(a,b):
    r=1
    for c in range(b):
        r*=(a-c)
        r//=c+1
    return r
if k%2==0:
    x=0
    y=0
    for i in range(1,n+1):
        if i%k==k//2:
            x+=1
        if i%k==0:
            y+=1
    ans=0
    if x>=1:
        ans+=com(x,1)
    if x>=2:
        ans+=6*com(x,2)
    if x>=3:
        ans+=6*com(x,3)
    if y>=1:
        ans+=com(y,1)
    if y>=2:
        ans+=6*com(y,2)
    if y>=3:
        ans+=6*com(y,3)
    print(ans)
else:
    x=0
    for i in range(1,n+1):
        if i%k==0:
            x+=1
    ans=0
    if x>=1:
        ans+=com(x,1)
    if x>=2:
        ans+=6*com(x,2)
    if x>=3:
        ans+=6*com(x,3)
    print(ans)
import sys
sys.setrecursionlimit(30000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))

### FIXED CODE ###

import sys
sys.setrecursionlimit(150000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))
N = input()
T, A = map(int, input().split())
H = list(map(int, input().split()))

for i in range(N)
    H[i] = abs(A - (T - H[i] * 0.006))
print(H.index(min(H)) + 1)

### FIXED CODE ###

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

for i in range(N):
    H[i] = abs(A - (T - H[i] * 0.006))
print(H.index(min(H)) + 1)
x = int(input())
score_A = 0
score_B = 0
ans = []
while x:
    for i in range(x):
        y = [int(i) for  i in input().split()]
        if y[0] > y[1]:
            score_A += sum(y)
        elif y[0] < y[1]:
            score_B += sum(y)
        else:
            score_A += y[0]
            score_B += y[1]
    ans.append([score_A,score_B])
    score_A = 0 ; score_B = 0
    x = int(input()
for i in ans:
    print(*i)


### FIXED CODE ###

x = int(input())
score_A = 0
score_B = 0
ans = []
while x:
    for i in range(x):
        y = [int(i) for  i in input().split()]
        if y[0] > y[1]:
            score_A += sum(y)
        elif y[0] < y[1]:
            score_B += sum(y)
        else:
            score_A += y[0]
            score_B += y[1]
    ans.append([score_A,score_B])
    score_A = 0 ; score_B = 0
    x = int(input())
for i in ans:
    print(*i)
strings = input()
lists = []
count = 0
for i in strings:
    if i == 'R':
        count += 1
    elif i == 'S':
        lists.append(count)
        count = 0
print(max(lists))

### FIXED CODE ###

strings = input()
lists = []
count = 0
for i in strings:
    if i == 'R':
        count += 1
    elif i == 'S':
        lists.append(count)
        count = 0
lists.append(count)
print(max(lists))
n = int(input())
a = list(map(int,input().split()))
print(''.join(a[::-2]+a[n%2::2]))

### FIXED CODE ###

n = int(input())
a = input().split()
print(" ".join(a[::-2]+a[n%2::2]))
#D
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
else:
    a=deque([])
    if s[0]=="1":
        a.append([0])
    for i in range(1,n):
        if s[i-1:i+1]=="01":
            a.append([i])
        elif s[i-1:i+1]=="10":
            a[-1].append(i-1)
    if s[n-1]=="1":
        a[-1].append(n-1)
    if a[0][0]!=0:
        a.appendleft([0,0])
    if a[-1][1]!=n-1:
        a.append([n-1,n-1])
    if len(a)-1<=k:
        print(n)
    else:
        t=0
        for i in range(len(a)-k):
            t=max(t,a[i+k][1]-a[i][0]+1)
        print(t)

### FIXED CODE ###

#D
from collections import deque
n,k=map(int,input().split())
s=input()
if n==1:
    print(1)
elif "1" not in s:
  	print(len(s))
else:
    a=deque([])
    if s[0]=="1":
        a.append([0])
    for i in range(1,n):
        if s[i-1:i+1]=="01":
            a.append([i])
        elif s[i-1:i+1]=="10":
            a[-1].append(i-1)
    if s[n-1]=="1":
        a[-1].append(n-1)
    if a[0][0]!=0:
        a.appendleft([0,0])
    if a[-1][1]!=n-1:
        a.append([n-1,n-1])
    if len(a)-1<=k:
        print(n)
    else:
        t=0
        for i in range(len(a)-k):
            t=max(t,a[i+k][1]-a[i][0]+1)
        print(t)