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:


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

    ans_num = 1
    ans_temp = T - location[0] * 0.006

    for i in range(1, num):
        temp = T - location[i] * 0.006
        if abs(A - ans_temp) > abs(A - temp):
            ans_temp = temp
            ans_num = i + 1
    print(ans_num)

Submission status: Accepted

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

Submission status: Accepted

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

def tmp(y,x):
	return y-0.006*x
min=10**6
j=0
for i in range(len(h)):
	ze=abs(a-tmp(t,h[i]))
	if min>ze:
		min=ze
		j=i

print(j+1)

Submission status: Accepted

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

def av_temp(t, h):
    return t - (h*0.006)

print(sorted([(i, abs(a - av_temp(t, h))) for i, h in enumerate(heights)], key=lambda x: x[1])[0][0]+1)

Submission status: Accepted

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

mean_temp = [abs(a - (t - x*0.006)) for x in h]

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
t, a = map(int, input().split())

h = list(map(int, input().split()))
results = []
for x in h:
    results.append(t - x * 0.006)

results = [abs(x - a) for x in results]
r = np.argsort(results)
print(r[0] + 1)

Submission status: Accepted

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

for i in range(n):
    dic[i] = abs(a - (t - h[i] * 0.006))

ans = [val for val in dic.items() if val[1] == min(dic.values())]

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

Submission status: Accepted

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

temp_data=[T-0.006*h for h in H]

output_i=0
for i in range(N):
    if(min(abs(temp_data[i]-A),abs(temp_data[output_i]-A))==abs(temp_data[i]-A)):
        output_i=i
    else:
        continue

print(output_i+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
near_H = (T-A)/0.006
ans = []
for  i in range(N):
    ans.append(abs(H[i]-near_H))
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()))

t_2 = (t-a)/0.006
res = 1000000

for m in range(n):
  num_ = abs(t_2 - h[m])
  if res > num_:
    res = num_
    res_2 = m + 1
print(res_2)

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:
def solution(h, t, a):
    n = len(h)
    foo, goo = -1, 0
    for i in range(n):
        cur = abs(t * 1000- h[i] * 6 - a * 1000)
        if foo == -1 or goo > cur:
            goo = cur
            foo = i
    return foo

def main():
    n = int(input().strip())
    t, a = [int(i) for i in input().strip().split()]
    h = [int(i) for i in input().strip().split()]
    print(solution(h, t, a) + 1)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
t, a = tuple(map(int, input().split()))
h = list(map(int, input().split()))
mine = 1000
mini = 0
d=[0 for i in range(n)]
def tmp(x):
    return t - 0.006*x

for i in range(n):
    d[i] = abs( a - tmp(h[i]) )
    if mine > d[i]:
        mine = d[i]
        mini = i

print(mini+1)

Submission status: Accepted

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

f = lambda x:t-x*0.006

tmp = list(map(f,h))

MIN = 500000000000000000000
idx = 0

for i in range(len(tmp)):
    if abs(tmp[i]-a)<MIN:
        MIN = abs(tmp[i]-a)
        idx = i+1

print(idx)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T , A = (int(i) for i in input().split())
H_list = [int(h) for h in input().split()]
 
A_list = [abs((T-0.006*H_list[n])-A) for n in range(N)]
 
number = 0
for n ,x in enumerate(A_list):
    if x == min(A_list):
        number = n+1
print(number)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
tav = t - 0.006 * np.array(h)
tdiff = np.abs(a - tav)

print(1 + np.argmin(tdiff))

Submission status: Accepted

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

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

mine = 100000
mini = 0
for i in range(n):
    if abs(a - temp(h[i])) < mine:
        mine = abs(a - temp(h[i]))
        mini = i

print(mini + 1)

Submission status: Accepted

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

k=[t-h[i]*0.006 for i in range(n)]
l=10000
p=0
for i in range(n):
    if abs(a-k[i])<l:
        l=abs(a-k[i])
        p=i+1
print(p)

Submission status: Accepted

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

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

m = min(listT)
mi =listT.index(m) + 1

print(mi)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

out = None
num = None

for i in range(N):
    avg = T - H[i]*0.006
    if num == None:
        out = i
        num = abs(A - avg)
        continue

    if num > abs(A - avg):
        out = i
        num = abs(A - avg)

print(out+1)

Submission status: Accepted

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

abs_diff = list(map(lambda x: abs(T-x*0.006 - A), H))
min_index = abs_diff.index(min(abs_diff)) + 1
print(min_index)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
T,A = map(int,input().split(" "))
H =  list(map(lambda x:abs(T - float(x)*0.006 - A),input().split(" ")))
print(np.argmin(H)+1)

Submission status: Accepted

Solution code:
import numpy as np
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(np.argmin(H)+1)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys


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

    nearest = [0, sys.maxsize]
    for i, x in enumerate(h, 1):
        tmp = abs((t - x * 0.006) - a)
        if tmp < nearest[1]:
            nearest = [i, tmp]

    print(nearest[0])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
T,A = list(map(int,input().split(" ")))
H = list(map(int,input().split(" ")))
res = 1000000
c = 1
for i in range(N):
    tmp = T-(H[i]*0.006)
    d = abs(tmp-A)
    if d < res:
        res = d
        c = i+1
print(c)

Submission status: Accepted

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

best=float('inf')
bp=1
for i in range(n):
    avr = t-(hl[i]*0.006)
    dif = abs(avr-a)
    if dif < best:
        best = dif
        bp = i+1
print(bp)

Submission status: Accepted

Solution code:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest113-B
#  https://beta.atcoder.jp/contests/abc113/tasks/abc113_b

def bestpalace(n,t,a,placeList) :
	repeatRange = range(0,n)
	bestTemp = 1000
	bestTempPlace = -1
	for i in repeatRange:
		aveTemp = abs(a-(t-placeList[i]*0.006))
		if aveTemp < bestTemp:
			bestTemp = aveTemp
			bestTempPlace = i

	return bestTempPlace


if __name__ == '__main__':
	line1 = input()
	line2 = input()
	line3 = input()
	n = int(line1)
	t,a = map(int,line2.split())
	placeList = list(map(int,line3.split()))
	ans=bestpalace(n,t,a,placeList)+1
	print(ans)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
mylist=[]
for i in range (N):
  C=T-H[i]*0.006
  D=abs(A-C)
  mylist.append(D)
E=mylist.index(min(mylist))
F=E+1
print(F)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
t = 10 ** 10

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

print(ans)

Submission status: Accepted

Solution code:
one = input()
two = input().split()
three = input().split()

N = int(one)
T = int(two[0])
A = int(two[1])
H = list(map(int,three))

for i in range(1,N):
    tem = list(map(lambda x: T-0.006*x,H))

tem_dif = list(map(lambda x: abs(x-A),tem))

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

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = input().split()
ans = []
for i in h:
  ans.append(abs(t-int(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()))
d = float('inf')
ans = 0
for i in range(n):
	d = min(d, abs(a-(t-0.006*h[i])))
	if d == abs(a-(t-0.006*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()))
L = []

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

Submission status: Accepted

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
T, A = list(map(int, input().split()) )

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

# print(H, len(H))

temps = []
for h in H:
    temps.append(T-h*0.006)
    temps[-1] =  abs(
        temps[-1] - A
    )

import numpy as np
# print(temps, A)
print(np.array(temps).argmin()+1)

Submission status: Accepted

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


def calcTemp(x, y):
    return x - y * 0.006


min = 1000000
counter = 1
numPlace=0
for height in H:
    tmp = abs(A - calcTemp(T, height))
    if min > tmp:
        min = tmp
        numPlace = counter
    counter += 1
print(numPlace)

Submission status: Accepted

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

ans = 0
best = int(1e9)

for i in range(1, N+1):
    now =  abs(A - (T - H[i] * 0.006))
    if now < best:
        ans = i
        best = now
print(ans)

Submission status: Accepted

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


total = None
result = 0

for i, x in enumerate(h):
    temp =   t - 0.006* x
    if total is None or abs(a - temp) < total:
        total = abs(a - temp)
        result = i + 1
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np


num = int(input())
t, a = map(int, input().split())


h = np.array(list(map(int, input().split())))
b = t - 0.006 * h
i = np.argmin(np.abs(b - a))

print(i + 1)

Submission status: Accepted

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

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

ave_dis = None
num = 0

for i in range(1, N+1):
    ave = T - H[i-1]*0.006

    ave_dis_tmp = abs(A - ave)

    if ave_dis == None or ave_dis > ave_dis_tmp:
        num = i
        ave_dis = ave_dis_tmp

print(num)

Submission status: Accepted

Solution code:
import statistics as st


#'''
nn = int(input())
base_temp, ave_temp = map(int, input().split())
hh = [int(i) for i in input().split()]
'''

n=2
base_temp = 12
ave_temp = 5
hh = [1000, 2000, 1200]
'''

def temp(b, h):
    return b - h * 0.006

list = []

for h in hh:
    list.append(temp(base_temp, h))



#print(list)
#m = st.mean(list)

list2 = [abs(i - ave_temp) for i in list]
#print(list2)

print(list2.index(min(list2)) + 1)
'''
for h in hh:
    list2.append(temp(base_temp, h))
'''



#print(temp(12, 1000))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys


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

result = -1
min_diff_of_temprature = sys.maxsize
for i in range(n):
    diff_of_temprature = abs(a - (t - 0.006 * h[i]))
    if diff_of_temprature < min_diff_of_temprature:
        result = i
        min_diff_of_temprature = diff_of_temprature

print(result + 1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
input()
b = list(map(int,input().split()))
t = b[0]
a = b[1]
c = list(map(int,input().split()))
c_temp = [abs(a-(t-i*0.006)) for i in c]
print(c_temp.index(min(c_temp))+1)

Submission status: Accepted

Solution code:
n = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]
a = []
ans = 0
saitekionndo = 1000000000000
for i in range(n):
    a.append([abs((T-H[i]*0.006)-A)])
    if abs((T-H[i]*0.006)-A)<saitekionndo:
        saitekionndo = abs((T-H[i]*0.006)-A)
        ans = i+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
l = [(i, abs(a - (t - x * 0.006))) for i, x in enumerate(h)]
target = min(l, key = lambda x: x[1])
print(target[0]+1)

Submission status: Accepted

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

for x in h:
    l.append(abs(a - (t - x * 0.006)))

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

Submission status: Accepted

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

Submission status: Accepted

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

H=[int(x) for x in input().split()]

ans=0
cnt=10**10

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

Submission status: Accepted

Solution code:
i=input;i();t,a=map(int,i().split());l=list(map(lambda x:abs(t-int(x)*0.006-a),i().split()));print(l.index(min(l))+1)

Submission status: Accepted

Solution code:
input();t,a=map(int,input().split());l=list(map(lambda x:abs(t-int(x)*0.006-a),input().split()));print(l.index(min(l))+1)

Submission status: Accepted

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

best = 9999
ans = 0
for i in range(1,N+1):
    h = H[i-1]
    if abs(A-(T-h*0.006))<best:
        best = abs(A-(T-h*0.006))
        ans = i
        #print(i,best)
        
print(ans)

Submission status: Accepted

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

result = 0

for i in range(len(Hs)):
    temp = T - (Hs[i] * 0.006)
    sa = abs(temp - A)
    if sa < hikaku:
        hikaku = sa
        result = i + 1

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

idx_of_result = 0
min_diff = sys.maxsize
for i, h_i in enumerate(h):
    temprature = t - h_i * 0.006
    diff = abs(temprature - a)
    if diff < min_diff:
        min_diff = diff
        idx_of_result = i

print(idx_of_result + 1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
delta = float('inf')
index = 0

for i, v in enumerate(h):
  temp = abs(a - (t - v * 0.006))
  if temp < delta:
    delta = temp
    index = i+1

print(index)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
H = [h for h in map(int,input().split())]
list = []
for _ in H:
    kion = T-(_*0.006)
    sa = abs(A-kion)
    list.append(sa)
list2 = [x for x in list]
list.sort()
best = list[0]
print(list2.index(best)+1)

Submission status: Accepted

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

n = 0
for i in range(N):
    if abs(A - (T - H[i] * 0.006)) < abs(A - (T - H[n] * 0.006)):
       n = i

print(n + 1)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for i in range(N):
    if abs(T-0.006*H[i]-A) < abs(T-0.006*H[ans]-A):
        ans = i

print(ans+1)

Submission status: Accepted

Solution code:
N = int(input())
input2 = input()
t,a = input2.split(' ')
T = int(t)
A = int(a)
input3 = input()
H = list(map(int,input3.split(' ')))

answer = 0
min = 0
for i in range(N):
    heikin = T - H[i] * 0.006
    #print(heikin)
    #print(abs(A - heikin))
    #print(min)
    if i != 0:
        if min > abs(A - heikin):
            min = abs(A - heikin)
            answer = i + 1
    else:
        min = abs(A - heikin)
        answer = 1
print(answer)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
   # N , M , A , B = list(map(int,input().split()))
    T,A = list(map(int,input().split()))
    H = list(map(int,input().split()))
    diff = []
    for i in H:
        diff.append(abs(A - (T - i*0.006)))
    print(diff.index(min(diff)) + 1)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

temps = []
for i in highs:
    diff = abs(A - (T - i*0.006))
    temps.append(diff)
    
print(temps.index(min(temps))+1)

Submission status: Accepted

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

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

Submission status: Accepted

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

diff = 10000
point = 10000

for x in range(n):
    temp = t - int(h[x]) * 0.006
    tmp = abs(a - temp)

    if tmp < diff:
        diff = tmp
        point = x + 1

print(point)

Submission status: Accepted

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

diffs = list(map(lambda h: abs(a - (t - h * 0.006)) , hs))
minind = diffs.index(min(diffs)) + 1
print(minind)

Submission status: Accepted

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

import sys
diff_of_min = sys.maxsize
idx_of_min = 0
for i, h_i in enumerate(h):
    temprature = t - h_i * 0.006
    diff = abs(a - temprature)
    if diff < diff_of_min:
        idx_of_min = i
        diff_of_min = diff

print(idx_of_min + 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
t,a = li()
h = list(li())

ans = -1
res = 10**18
for i,hi in enumerate(h):
    if abs(a-(t-0.006*hi)) < res:
        res = abs(a-(t-0.006*hi))
        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 = 0
temp = 10000
for k in range(N):
    if abs(A-(T-H[k]*0.006)) < temp:
        temp = abs(A-(T-H[k]*0.006))
        ans = k+1
print(ans)

Submission status: Accepted

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

diff = float('inf')
ans = 0

for i in range(n):
    if abs(t - h[i] * 0.006 - a) < diff:
        diff = abs(t - h[i] * 0.006 - a)
        ans = i + 1

print(ans)

Submission status: Accepted

Solution code:
import sys
fin = sys.stdin.readline

N = int(fin())
T, A = [int(elem) for elem in fin().split()]
avg_temps = [1000 * T - 6 * int(elem) for elem in fin().split()]

min_diff = float('inf')
closest_place = -1

for place, avg_temp in enumerate(avg_temps, start=1):
    diff = abs(avg_temp - 1000 * A)
    if diff < min_diff:
        min_diff = diff
        closest_place = place

print(closest_place)

Submission status: Accepted

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

ans_i = -1
ans_d = 10**18
for i,h in enumerate(H):
    t = T - h * 0.006
    if abs(t-A) < ans_d:
        ans_d = abs(t-A)
        ans_i = i
print(ans_i + 1)

Submission status: Accepted

Solution code:
def Ave_tmp(Hi):
    return T-Hi*0.006

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

Ave_tmp_list = list(map(Ave_tmp, H_list))

min = 1000000000
ans = 0
for i, Ave_tmp in enumerate(Ave_tmp_list):
    if(abs(Ave_tmp - A) < min):
        min = abs(Ave_tmp - A)
        ans = i+1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
m = input()
t = int(m.split()[0])
a = int(m.split()[1])
c = None
d = 9999
k = input().split()
for i in range(n):
    w = t - int(k[i]) * 0.006
    if abs(a - w) < d:
        c = i+1
        d = abs(a - w)
print(c)

Submission status: Accepted

Solution code:
import sys
N = input()
TA = input()
T, A = TA.split()
Hinp = input()
H = Hinp.split()
ansnum = None
ans = 0
def getdiff(A, ans):
    return abs(max(ans, A) - min(ans, A))
def chk(A, _ans, ans):
    new_d, old_d = getdiff(A, _ans), getdiff(A, ans)
    if new_d < old_d:
        return True
    return False
def showans(ans):
    print(ans)
    sys.exit()
for i, x in enumerate(H):
    _ans = int(T) - int(x) * 0.006
    if _ans == A:
        showans(i+1)
    if not ansnum or chk(int(A), _ans, ansnum):
        ans = i+1
        ansnum = _ans
showans(ans)

Submission status: Accepted

Solution code:
import sys
N = input()
TA = input()
T, A = TA.split()
Hinp = input()
H = Hinp.split()
ansnum = None
ans = 0
def getdiff(A, ans):
    return abs(max(ans, A) - min(ans, A))
def chk(A, _ans, ans):
    new_d, old_d = getdiff(A, _ans), getdiff(A, ans)
    if new_d < old_d:
        return True
    return False
for i, x in enumerate(H):
    _ans = int(T) - int(x) * 0.006
    if _ans == A:
        break
    if not ansnum or chk(int(A), _ans, ansnum):
        ans = i+1
        ansnum = _ans
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
TA=input().split(" ")
T = int(TA[0])
A = int(TA[1])
H=input().split(" ")
ans = 1
diff = abs(T - int(H[0]) * 0.006 - A)
for i in range(N):
    # print(i)
    if( diff > abs(T - int(H[i]) * 0.006 - A) ):
        diff = abs(T - int(H[i]) * 0.006 - A)
        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, best = 0, float('inf')
for i in range(N):
    x = H[i]
    temp = (T - x * 0.006)
    diff = abs(A - temp)
    if best > diff:
        ans = i
        best = diff
print(ans + 1)

Submission status: Accepted

Solution code:
T=int(input())
a,b=map(int,input().split())
ll=list(map(int,input().split()))
mins=0
for i in range(len(ll)):
    ans=a-0.006*ll[i]
    if abs(ans-b)<abs((a-0.006*ll[mins])-b):
        mins=i

print(mins+1)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

min = abs((t - h[0] * 0.006) - a)
mini = 0

for i in range(1,len(h)):
    tmp = abs((t - h[i] * 0.006) - a)

    if tmp < min :
        min = tmp
        mini = i     
        
print(mini+1)

Submission status: Accepted

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

N = int(input())

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

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

answer = 0

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

answer += 1
print(answer)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
Highs = list(map(int,input().split()))
for i in range(N):
    Highs[i] = abs(A - (T - Highs[i]*0.006) )
print(Highs.index(min(Highs))+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())
temp = list(map(int, input().split()))
t = temp[0]
a = temp[1]
highs = list(map(int, input().split()))

answer = 0
close = -1
for i in range(n):
    high = highs[i]
    c = abs(a - (t - high * 0.006))
    if close < 0 or c < close:
        close = c
        answer = i
print(answer + 1)

Submission status: Accepted

Solution code:
import numpy as np
n = input()
t, a = map(int, raw_input().split())
h = map(int, raw_input().split())
v = map(lambda _: abs(t - 0.006*_ - a), h)
print np.argmin(v) + 1

Submission status: Accepted

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

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

temp = sub.copy()
temp.sort()
index = sub.index(temp[0])

print(index+1)

Submission status: Accepted

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

X = [abs(T - h * 0.006 - A) for h in H]
m = min(X)

for i, x in enumerate(X):
    if x == m:
        print(i+1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

def main():
    N = int(input())
    T, A = map(int, input().split())
    H = [v for v in map(int, input().split())] # N
    result = sys.float_info.max
    for i in range(0, N):
        tmp = abs(A - (T - H[i] * 0.006))
        if  tmp < result:
            result = tmp
            answer = i + 1

    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a=int(input())
#print(a)
b,c=map(int,input().split())
d=[int(i) for i in input().split()]
#print(d)
e={}
for i in range(a):
	e.update({abs(b-d[i]*0.006-c):i+1})
#print(e)
e=sorted(e.items())
#print(e)
print(e[0][1])

Submission status: Accepted

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

Submission status: Accepted

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

place_temperature = 0
diff_A =[]
for i in range(N):
    place_temperature= T - height[i] * 0.006
    diff_A.append(abs(A - place_temperature))

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

Submission status: Accepted

Solution code:
import numpy as np

def getNearestValue(list, num):
    """
    概要: リストからある値に最も近い値を返却する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]

num = int(input())
temperature = list(map(int, input().split(" ")))
height = list(map(int, input().split(" ")))

place_temperature = []
for i in range(num):
    place_temperature.append(temperature[0] - height[i] * 0.006) 


near_temperature = getNearestValue(place_temperature, temperature[1])
print(place_temperature.index(near_temperature) + 1)