Problem:


Score: 200 points

Problem Statement

A country decides to build a palace.

In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.

There are N places proposed for the place. The elevation of Place i is H_i meters.

Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.

Print the index of the place where the palace should be built.

It is guaranteed that the solution is unique.

Constraints

1 \leq N \leq 1000

0 \leq T \leq 50

-60 \leq A \leq T

0 \leq H_i \leq 10^5

All values in input are integers.

The solution is unique.

Input

Input is given from Standard Input in the following format:

N
T A
H_1 H_2 ... H_N

Output

Print the index of the place where the palace should be built.

Sample Input 1

2
12 5
1000 2000

Sample Output 1

1

The average temperature of Place 1 is 12-1000 \times 0.006=6 degrees Celsius.

The average temperature of Place 2 is 12-2000 \times 0.006=0 degrees Celsius.

Thus, the palace should be built at Place 1.

Sample Input 2

3
21 -11
81234 94124 52141

Sample Output 2

3



Sample input:
2
12 5
1000 2000


Sample output:
1

Submission status: Accepted

Solution code:
from sys import stderr, setrecursionlimit
from functools import reduce
from operator import add
setrecursionlimit(2147483647)
def f(): return [int(i) for i in input().split()]
def yes(n): print("Yes" if n else "No")
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)

n = int(input())
t, a = f()
h = [abs(t-i*0.006 - a) for i in f()]
print(h.index(min(h))+1)

Submission status: Accepted

Solution code:
input()
T, A = map(int, input().split())
H = map(int, input().split())
diff = [(i + 1, abs(A - T + h * 0.006)) for i, h in enumerate(H)]
print(min(diff, key=(lambda x: x[1]))[0])

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int, input().split()))
k = []
for i in h:
  k.append(abs(t - a - i * 0.006))
print(k.index(min(k))+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())

H = list(map(int, input().split()))

min_i, min_d = None, 10 ** 6
for i, hi in enumerate(H):
    d = abs(A - (T - 0.006 * hi))
    if d < min_d:
        min_i = i + 1
        min_d = d
        if d == 0:
            break

print(min_i)

Submission status: Accepted

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

E = 1e+10
p = -1
for i in range(N):
    a = T - 0.006 * H[i]
    e = abs(A - a)
    if e < E:
        E = e
        p = i

print(p+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=list(map(int,input().split()))
h=list(map(int,input().split()))
gap = [(i,abs(a - t + s*0.006)) for i,s in enumerate(h)]

print(sorted(gap, key=lambda x:x[1])[0][0] + 1)

Submission status: Accepted

Solution code:
i=lambda:map(int,input().split())
i()
t,a=i()
c=[abs(t-0.006*b-a)for b in i()]
print(c.index(min(c))+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
lis=list(map(int,input().split()))
li=abs((t-lis[0]*0.006)-a)
l=0
for i in range(1,n):
    b=abs((t-lis[i]*0.006)-a)
    if b<li:
        li=b
        l=i
print(l+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
lis=list(map(int,input().split()))
li=abs((t-lis[0]*0.006)-a)
l=0
for i in range(1,n):
    if abs((t-lis[i]*0.006)-a) < li:
        li=abs((t-lis[i]*0.006)-a)
        l=i
print(l+1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
lis = list(map(int,input().split()))

li = abs((t-lis[0]*0.006)-a)
l = 0
for i in range(1,n):
    if abs((t-lis[i]*0.006)-a) < li:
        li=abs((t-lis[i]*0.006)-a)
        l=i
print(l+1)

Submission status: Accepted

Solution code:
i=lambda:map(int,input().split());i();t,a=i();c=[abs(t-0.006*b-a)for b in i()];print(c.index(min(c))+1)

Submission status: Accepted

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

diff = [0] * N
for n in range(N):
    ave_temperature = T - H[n] * 0.006
    diff[n] = abs(A - ave_temperature)

print(diff.index(min(diff)) + 1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int, input().split())
H = [int(i) for i in input().split()]

min = (A-(T-0.006*H[0]))**2
ans = 0

for i in range(1,N):
    if min > (A-(T-0.006*H[i]))**2:
        min = (A-(T-0.006*H[i]))**2
        ans = i

print(ans+1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
import numpy as np

d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


coef = 0.006
N = d_in()
T, A = ds_in()
H_list = np.array(ds_in())

T_list = T - coef * H_list
idx = np.argmin((A - T_list)**2)
print(idx + 1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = input().rstrip().split()
hh = []
for i in range(n):
  j = abs(t - a - int(h[i]) * 0.006)
  hh.append(j)
print(hh.index(min(hh))+1)

Submission status: Accepted

Solution code:
N = int(input())
T,  A = map(int, input().split())
temp = [abs(float(A)-(float(T) - float(h) *0.006)) for h in input().split()] 
print(temp.index(min(temp))+1)

Submission status: Accepted

Solution code:
import sys

if __name__ == '__main__':
    N = int(input())
    T, A = map(int, input().split())
    H = list(map(int, input().split()))

    ans = 0
    best = sys.maxsize
    for i in range(0, N):
        target = T - 0.006 * H[i] - A
        if abs(target) < best:
            best = abs(target)
            ans = i + 1

    print(ans)

Submission status: Accepted

Solution code:
N=int(input())
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
temp = [abs(1000*T - 6*x - 1000*A) for x in H]
m = min(temp)
i = temp.index(m)
print(i+1)

Submission status: Accepted

Solution code:
#候補数を取得
N = int(input())
#TとAの値を取得
T, A = map(int, input().split())
#N個の国のHを配列に格納
H = list(map(int, input().split()))
#差を計算し絶対値をとる
min_index = [abs(A - (T - i*0.006)) for i in H]
#最小値を持つインデックスを探し出力
print(min_index.index(min(min_index))+1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=input()
T,A = (int(_) for _ in input().split())
H = [int(i) for i in input().split()]
for i in range(int(N)):
  H[i]=abs(A-(T-0.006*H[i]))
print(H.index(min(H))+1)

Submission status: Accepted

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

ans = 0
diff = 1e100
for i in range(N):
    d = abs(A - (T - H[i] * 0.006))
    if d < diff:
        ans = i
        diff = d
print(ans + 1)

Submission status: Accepted

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

H_temp = [abs(A-(T-0.006*i)) for i in H]

for i in range(len(H_temp)):
    if H_temp[i] == min(H_temp):
        print(i+1)

Submission status: Accepted

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

H_temp = [abs(A-(T-0.006*i)) for i in H]

temp = 999999
best_spot = None

for i in range(len(H_temp)):
    if H_temp[i] < temp:
        temp = H_temp[i]
        best_spot = i+1

print(best_spot)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
h = list(map(int, input().split()))

mint = 1000000
j = 0

for i in range(N):
    if mint > abs(a[1]-(a[0] - h[i] * 0.006)):
        mint = abs(a[1]-(a[0] - h[i] * 0.006))
        j = i + 1

print(j)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
Hs = list(map(int, input().split()))

minAH, mini = 10000000, None
for i in range(N):
    AH = abs(A - (T - Hs[i] * 0.006))
    if minAH > AH:
        minAH = AH
        mini = i + 1
print(mini)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    T, A = map(int, input().strip().split())
    H = list(map(int, input().strip().split()))
    t = []
    
    for h in H:
        arg_t_a = T - h * 0.006 - A
        t.append(arg_t_a * arg_t_a)
    print(t.index(min(t)) + 1)

if __name__ == "__main__":
    main()

Submission status: Accepted

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


min_diff = 10**5
min_i = 0
for idx, height in enumerate(H):
    temperature = T - 0.006*height
    diff = abs(temperature - A)
    if min_diff > diff:
        min_i = idx
        min_diff = diff

print(min_i+1)

Submission status: Accepted

Solution code:
input()
tmp = list(map(int, input().split(" ")))
T = tmp[0]
A = tmp[1]
H = list(map(int, input().split(" ")))

ans_diff = 999999
ans = -1

for i in range(len(H)):
    if abs(A - (T - (H[i] * 0.006))) < ans_diff:
        ans_diff = abs(A - (T - (H[i] * 0.006)))
        ans = i + 1

print(ans)

Submission status: Accepted

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

min_ave = 1000000

for i in range(len(H)):
    tem = T - (H[i]*0.006)
    if min_ave > abs(A-tem):
        min_ave = abs(A-tem)
        min_num = i+1

print(min_num)

Submission status: Accepted

Solution code:
n = int(input())
t, a = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

diff = 1000000
index = 0
for i in range(n):
    tmpDiff = abs(a - (t-h[i]*0.006))
    if tmpDiff < diff:
        diff = tmpDiff
        index = i
print(index+1)

Submission status: Accepted

Solution code:
#import nampy
import math

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

for i in range(n):
    h[i]=abs((t-h[i]*0.006)-a)
    
print(h.index(min(h))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

h = list(map(lambda x: abs((t - x*0.006) - a), h))

print(h.index(min(h))+1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
res = 0
diff = 10000
Hlist = input().split()
Hlist = [int(i) for i in Hlist]
for i in range(N):
    H = Hlist[i]
    average = T - H * 0.006
    a = abs(A-average)
    if diff >= a:
        res = i
    diff = min(diff,a)
print(res+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = input().split()
min = 1000000000
place = 0

for i in range(N):
  d = (T*1000 - int(H[i])*6) - A * 1000
  if d < 0: d = -d
  if d < min:
    min = d 
    place = i+1

print(place)

Submission status: Accepted

Solution code:
N = int(input())

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

H = list(map(int, input().split()))

mi = abs(T-H[0]*0.006-A)
num = 1

for i in range(N):
    tmp = abs(T-H[i]*0.006-A)
    if tmp<mi:
        mi = tmp
        num = i+1
        
print(num)

Submission status: Accepted

Solution code:
# https://beta.atcoder.jp/contests/abc113/tasks/abc113_b

def solve():
    _ = input()
    T, A = map(int, input().split())
    x = list(map(int, input().split()))
    nearest = 10 ** 5
    ans = 0

    for index, elevation in enumerate(x):
        current = T - elevation * 0.006

        if abs(A - current) < nearest:
            nearest = abs(A - current)
            ans = index + 1

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N = int(input())
T, A = map( int, input().split())
H = list( map( int, input().split()))
         
K = []
Ksorted=[]
tmp=[]
 
for i in range(N):
  tmp.append( T - H[i] * 0.006)
  K.append(abs( A - tmp[i]))
  Ksorted = sorted(K)
  
T = K.index(Ksorted[0])
print(T+1)

Submission status: Accepted

Solution code:
N = int(input())
T , A = map(int, input().split())
Hi = [int(i) for i in input().split()]
Temperatures = list(map(lambda x: abs(A - (T - 0.006*x)), Hi))
print(Temperatures.index(min(Temperatures))+1)

Submission status: Accepted

Solution code:
_ = input()
t, desire = map(int, input().split())
places_h = map(int, input().split())

def desire_delta(place_h, t, desire):
  avg_tmp = t - place_h * 0.006
  return max(desire - avg_tmp, avg_tmp - desire)

res = [(idx, desire_delta(h, t, desire)) for idx, h in enumerate(places_h)]

sorted_res = sorted(res, key=lambda place: place[1])

print(sorted_res[0][0] + 1)

Submission status: Accepted

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

K = abs(A - (T - H[0] * 0.006))
x = 0
ans = 0

for i in H:
    x += 1
    if K >= abs(A - (T - i * 0.006)):
        K = abs(A - (T - i * 0.006))
        ans = x

print(ans)

Submission status: Accepted

Solution code:
def main():
  n = input()
  t, a = map(int, input().split())
  h = list(map(lambda x: abs(a-(t-x*0.006)), map(int, input().split())))
  print(sorted(range(len(h)), key=lambda k: h[k])[0]+1)
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
ans=0
x=list(map(int,input().split()))
min=float("inf")
for i in range(N):
    a=abs(A-(T-x[i]*0.006))
    if a<min:
        ans=i
        min=a
print(ans+1)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
lis=list(map(int,input().strip().split()))
kekka=[]
a=len(lis)
for i in range (0,a):
    b=T-lis[i]*0.006
    if A>=b:
        c=A-b
    else:
        c=b-A
    c=abs(c)
    kekka.append(c)
d=min(kekka)
e=kekka.index(d)
print(e+1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
tmp = float('inf')
for i in range(N):
    t = abs(A-(T-H[i]*0.006))
    if tmp > t:
        tmp = t 
        ans = i
print(ans+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
min_abs = abs(a - (t - h[0]*0.006))
ans = 0
for i in range(1, n):
    tmp = abs(a - (t - h[i]*0.006))
    if min_abs > tmp:
        min_abs = tmp
        ans = i
print(ans + 1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
h = 0
D = 100000000
for x in H:
    d = abs(T - x * 0.006 - A)
    if D > d:
        D = d
        h = x
print(H.index(h) + 1)

Submission status: Accepted

Solution code:
n = int(input())
T,a = map(int,input().split())
li = list(map(int,input().split()))

m = 10**100
count = 0

for i in range(n):
    t = T - li[i] * 0.006
    if abs(t-a) < abs(m-a):
        m = t
        count = i+1

print(count)

Submission status: Accepted

Solution code:
n = int(input())
t, a = [int(i) for i in input().split(' ')]
h = [int(i) for i in input().split(' ')]

temp = []
for i in h:
    temp.append(t - i * 0.006)

near = 10001
ans = 0
for i, v in enumerate(temp):
    sub = a - v
    if abs(near) > abs(sub):
        near = sub
        ans = i+1

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
dtmin=10**6
ans=-1
for i in range(N):
  dt=abs(A-(T-0.006*H[i]))
  if(dt<dtmin):
    ans=i+1
    dtmin=dt
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))


for i in range(n):
	h[i]=abs(t-0.006*h[i]-a)
print(h.index(min(h))+1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))

l = 10**9
for i in range(len(h)):
    tmp = abs(a - (t - h[i]*0.006))
    if l > tmp:
        l = tmp
        ans = i+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a=map(int,input().split())
h = list(map(int,input().split()))
ans_num = 1<<30
ans = -1

for i in range(n):
    temp = abs(a-(t - h[i]*0.006))
    if ans_num >= temp:
        ans_num = temp
        ans = i
print(ans+1)

Submission status: Accepted

Solution code:
N = input()
T,A = map(int, input().split())
Hs = [int(x) for x in input().split()]

cs = [(index,abs(A- (T-h*0.006))) for index,h in enumerate(Hs)]
cs = min(cs, key=lambda x:x[1])
print(cs[0]+1)

Submission status: Accepted

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

res, height = 0, 100001
for i in range(N) :
    tmp = T - H[i] * 0.006
    if height > abs(A - tmp) :
        height = abs(A - tmp)
        res = i + 1

print(res)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
idx = -1
ans = 1e9
for i in range(len(h)):
	res = t-h[i]*0.006
	if abs(a-res) < ans:
		ans = abs(a-res)
		idx = i
print(idx+1)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
t,a = map(int, input().split())
h = input().split()

h = np.array(h, dtype = float)
h = t - 0.006 * h
h = abs(a-h)
print(np.argmin(h)+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
Hs = input().split()
loss = []
for i in range(N):
    loss.append([abs(T-int(Hs[i])*0.006-A), i+1])
print(sorted(loss)[0][1])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
T,A = map(int,input().split())
H = map(int,input().split())

anss = 99999
ans = 0
i = 1

for hi in H:
    if abs(anss) > abs(A - (T - hi *0.006)):
        anss = A - (T - (hi *0.006))
        ans = i
    i = i +1
    
print(ans)

Submission status: Accepted

Solution code:
def main():
    '''
    メイン関数
    '''
    # 入力を取得
    N = int(input())
    T, A = map(int, input().split())
    H_list = map(int, input().split())

    delta = 99999
    n = 1
    good = 0

    for H in H_list :
        temp = T - H * 0.006
        temp_delta = abs(A-temp)
        
        if temp_delta < delta :
            delta = temp_delta
            good = n
        n += 1

    print(good)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0
n = 0
for i, item in enumerate(H):
    if i == 0:
        ans = i + 1
        n = abs(T - item*0.006 - A)
    else:
        if abs(T - item*0.006 - A) < n:
            ans = i + 1
            n = abs(T - item*0.006 - A)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
hs = list(map(int, input().split()))

min = 99999
ans = 99999

for i in range(n):
    tmp = t - hs[i] * 0.006
    d = abs(a-tmp)
    if d < min:
        ans = i
        min = d

print(ans+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
Hs = map(int, input().split())
T_cal = [abs(T - H * 0.006 - A) for H in Hs]
print(T_cal.index(min(T_cal))+1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
h_list = list(map(int,input().split()))
temp_list = [abs(A-(T-h_list[i]*0.006)) for i in range(N)]
print(temp_list.index(min(temp_list))+1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    t, a = map(int, input().split())
    h = list(map(int, input().split()))
    tmp = [0 for _ in range(n)]
    diff = 10 ** 6

    for i, hi in enumerate(h):
        tmp[i] = abs(a - (t - hi * 0.006))

    ans = 0

    for index, j in enumerate(tmp, 1):
        if j < diff:
            diff = j
            ans = index

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

H = []
H = list(map(int,input().split()))

min = 0
min_val = 0
for i in range(N):
    a = abs(T - H[i] * 0.006 - A)
    if min == 0 or min_val > a:
        min = i+1
        min_val = a

print(min)

Submission status: Accepted

Solution code:
N = int(input())
T, A = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
h = [abs(A - (T - x * 0.006)) for x in H]

m = h[0]
ans = 1
for i in range(len(h)):
    if h[i] < m:
        m = h[i]
        ans = i + 1


print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
difmin = 10**5
imin = -1
for i, h in enumerate(H):
    dif = abs((T - h*0.006) - A)
    if difmin > dif:
        difmin = dif
        imin = i+1
print(imin)

Submission status: Accepted

Solution code:
n = int(input())
t, a = list(map(int, input().split()))
h_list = list(map(int, input().split()))
t_list = list(map((lambda h: t-h*0.006), h_list))
diff_list = list(map((lambda t: abs(a-t)), t_list))
print(diff_list.index(min(diff_list))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = list(map(int, input().split()))
h_list = list(map(int, input().split()))

t_list = list(map((lambda h: t-h*0.006), h_list))
diff_list = list(map((lambda t: abs(a-t)), t_list))

idx = 1
idx_diff_list = []
for diff in list(diff_list):
    idx_diff_list.append((idx, diff))
    idx += 1

print(min(idx_diff_list, key=(lambda t: t[1]))[0])

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
bestDiff = 1e99
bestIndex = 0
H = list(map(int, input().split()))
for i in range(N):
    diff = abs(A - (T - H[i] * 0.006))
    if(bestDiff > diff):
        bestDiff = diff
        bestIndex = i + 1
print(bestIndex)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
ans = []
for i in range(n):
  ans.append(abs((t-h[i]*0.006)-a))
print(ans.index(min(ans))+1)

Submission status: Accepted

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

tmp = 10000
i = 0
for index, h in enumerate(H):
    ond = T - h * 0.006
    diff = abs(ond - A)
    if diff < tmp:
        tmp = diff
        i = index + 1

print(i)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
j = 0
k = 0
flag = 0
s = []
while j < N:
  k = T - (0.006)*H[j]
  if k >= A:
    s.append(k - A)
  else:
    s.append(A - k)
  if s[j] <= s[flag]:
    flag = j
  j = j + 1
print(flag+1)

Submission status: Accepted

Solution code:
n = int(input())
T, A = map(int,input().split())
h = [int(i) for i in input().split()]
min_T = abs(T - h[0]*0.006 - A)
i_min = 0

for i,v in enumerate(h):
    if (min_T > abs(T - h[i]*0.006 - A)):
        min_T = abs(T - h[i]*0.006 - A);
        i_min = i
print(i_min+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]

min_diff = 9999999
min_cnt = 0
for c, h in enumerate(H):
    diff = abs(A - (T - h * 0.006))
    if min_diff >= diff:
        min_diff = diff
        min_cnt = c + 1

print(min_cnt)

Submission status: Accepted

Solution code:
N, = map(int, raw_input().split())
T, A = map(int, raw_input().split())
H = map(int, raw_input().split())
mi = 0
md = abs(T-0.006*H[0]-A)
for i in range(1, N):
  d = abs(T-0.006*H[i]-A)
  if d<md:
    md=d
    mi=i
print mi+1

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
w = [abs(a-t + 0.006*x) for x in h]
print(w.index(min(w))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

res = 0
cc = float('inf')
for i in range(n):
    d = (1000 * t - 6 * h[i]) - 1000 * a
    if d < 0: d = -d
    if cc > d:
        cc = d
        res = i + 1
print(res)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
t , a = map(int, input().split())
h = np.array([i for i in map(int, input().split())])
x = (t - a)/0.006
l = np.abs(h - x)
print(np.argmin(l)+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
i=0;
s=1e9;
d=0;
for h in map(int,input().split()):
    i+=1
    now=abs((t-a)*1000-h*6)
    if now<s:
        s=now
        d=i
print(d)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    t, a = map(int, input().split())
    h = list(map(int, input().split()))

    temp = []
    for h_i in h:
        temp.append(abs(a - (t - h_i * 0.006)))

    ans = temp.index(min(temp)) + 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#muri
N = int(input())
T, A = list(map(int,input().strip().split()))
H_list = list(map(int,input().strip().split()))
trueH = (T - A)/0.006
sa = float("inf")

for i in range(0,N):
    num = trueH - H_list[i]
    if abs(num) < sa:
        sa = abs(num)
        ans = i

print(ans+1)

Submission status: Accepted

Solution code:
import math

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

delta_temp_min = 100000000000
ans = 0

for i in range(N):
    temp_i = T-int(lst[i])*0.006
    delta_temp = math.sqrt((A-temp_i)**2)
    if delta_temp_min > delta_temp:
        ans = i
        delta_temp_min = delta_temp

print(str(ans+1))

Submission status: Accepted

Solution code:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=int(input())
    t,a= map(int, sys.stdin.readline().split(' '))
    b=list(map(int,sys.stdin.readline().split(' ')))
    v=(t-a)//(0.006)

    diff=mod
    ans=0

    for i in range(n):
        te=v-b[i]
        if(abs(te)<diff):
            diff=abs(te)
            ans=i

    print(ans+1)

    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    t,a = LI()
    h = LI()
    mi = -1
    ms = inf
    for i in range(n):
        s = abs(a-(t - h[i] * 0.006))
        if ms > s:
            ms = s
            mi = i

    return mi + 1


print(main())

Submission status: Accepted

Solution code:
import sys
 
def solve(N, T, A, ls_H):
    temperature = []
    difference = []
    near = []
    ti = 10**5//1
    for x in ls_H :
        air = T - x * 0.006
        temperature.append(air)
    #print(temperature)
    
    for y in temperature :
        til = A - y
        difference.append(til)
    #print(difference)
    
    for z in difference :
        near.append(abs(z))
    #print(near)
    
    for i in near :
        if ti > i :
            ti = i
    #print(ti)
    return near.index(ti) + 1


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    N = int(ws[0])
    ws = sys.stdin.readline().strip().split()
    T = int(ws[0])
    A = int(ws[1])
    ws = sys.stdin.readline().strip().split()
    ls_H = list(map(int, ws))
    return (N, T, A, ls_H)
 
def main():
    print(solve(*readQuestion()))
 # Uncomment before submission
main()

Submission status: Accepted

Solution code:
I=lambda:map(int,input().split())
a=lambda l:l.index(min(l))
N=I()
T,A=I()
print(a([abs(T-i*0.006-A)for i in I()])+1)

Submission status: Accepted

Solution code:
#coding:utf-8

def diff_A_temperature(T, A, x):
    H_T = T - (x * 0.006)
    diff_A = abs(H_T - A)

    return diff_A

def main():
    N = input()
    T, A = map(int, input().split())
    H_list = [int(i) for i in input().split()]
    H_diff_list = [diff_A_temperature(T, A, H) for H in H_list]
    print(H_diff_list.index(min(H_diff_list)) + 1)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input().strip())
T,A = map(int,input().strip().split())
Hs = [int(x) for x in input().strip().split()]
posTemp = 10000000
posId = 0
for i in range(N):
    if posTemp > abs(A - (T - Hs[i] * 0.006)):
        posTemp = abs(A - (T - Hs[i] * 0.006))
        posId = i + 1
print(posId)

Submission status: Accepted

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

ans = []
for i in range(N):
    ans.append(abs(A - (T - H[i] * 0.006)))

print(ans.index(min(ans))+1)

Submission status: Accepted

Solution code:
import numpy as np
import copy
import sys

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

def temp(t, x):
	return t-x*0.006

near=np.inf; arg_near=-1
for i in range(N):
	if (near > abs(A-temp(T, H[i]))):
		near = abs(A-temp(T, H[i]))
		arg_max = i+1
print(arg_max)

Submission status: Accepted

Solution code:
a = int(input())
b,c = list(map(int,input().split()))
d = list(map(int,input().split()))
ans = []

for i in range(a):
  ans.append(abs(c - (b - d[i] * 0.006)))
  
print(ans.index(min(ans))+1)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int, input().split())
H=list(map(int, input().split()))
m=10000000000
n=0
for i in range(N):
    if abs(A-T+H[i]*0.006)<m:
        m=abs(A-T+H[i]*0.006)
        n=i+1
print(n)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split(" "))
H = list(map(int, input().split(" ")))

cand = -1
cand_at = 10**10

for i in range(N) :
    temp_at = T - H[i] * 0.006
    if abs(A - temp_at) <= cand_at :
        cand = i + 1
        cand_at = abs(A - temp_at)
        
print(cand)

Submission status: Accepted

Solution code:
import sys
 
def solve(N, T, A, ls_H):
    dosi = []
    titen = []
    titen1 = []
    ti = 10**5//1
    for x in ls_H :
        do = T - x * 0.006
        dosi.append(do)
    #print(dosi)
    
    for y in dosi :
        til = A - y
        titen.append(til)
    #print(titen)
    
    for z in titen :
        titen1.append(abs(z))
    #print(titen1)
    
    for i in titen1 :
        if ti > i :
            ti = i
    #print(ti)
    return titen1.index(ti) + 1
 
def readQuestion():
    ws = sys.stdin.readline().strip().split()
    N = int(ws[0])
    ws = sys.stdin.readline().strip().split()
    T = int(ws[0])
    A = int(ws[1])
    ws = sys.stdin.readline().strip().split()
    ls_H = list(map(int, ws))
    return (N, T, A, ls_H)
 
def main():
    print(solve(*readQuestion()))
 # Uncomment before submission
main()

Submission status: Accepted

Solution code:
N = int(input())
Data = list(map(int, input().split()))
T = Data[0]
A = Data[1]
H = list(map(int, input().split()))

X = T-A
Min = abs(X - H[0] * 0.006)
Num = 0
for i in range(1,N):
  temp = abs(X - H[i] * 0.006)
  if Min > temp:
    Min = temp
    Num = i
print(Num+1)