Problem: 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.

Submission attempts (in order):
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 :
        subtraction = A -y
        difference.append(subtraction)
    #print(difference)
    
    for z in difference : 
        near.append(abs(z))
    #print(near)
    
    for i in near :
        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()

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 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()

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 :
        subtraction = A -y
        difference.append(subtraction)
    #print(difference)
    
    for z in difference : 
        near.append(abs(z))
    print(near)
    
    for i in near :
        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()

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 :
        subtraction = A -y
        difference.append(subtraction)
    #print(difference)
    
    for z in difference : 
        near.append(abs(z))
    #print(near)
    
    for i in near :
        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()

import sys

def solve(N, T, A, ls_H):
    dosi = []
    titen = []
    titen1 = []
    ti = 10**5//1
    for x in list1 :
        do = T - x * 0.006
        dosi.append(do)
    
    
    for y in dosi :
        ti = A - y
        titen.append(ti)
    
    
    for z in titen :
        titen1.append(abs(z))
    
    
    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()

import sys

def solve(N, T, A, ls_H):
    dosi = []
    titen = []
    titen1 = []
    ti = 10**5//1
    for x in list1 :
        do = T - x * 0.006
        dosi.append(do)
    
    
    for y in dosi :
        ti = A - y
        titen.append(ti)
    
    
    for z in titen :
        titen1.append(abs(z))
    
    
    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()

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 :
        subtraction = A -y
        difference.append(subtraction)
    #print(difference)
    
    for z in difference : 
        near.append(abs(z))
    #print(near)
    
    for i in near :
        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()

import sys

def solve(N, T, A, ls_H):
    dosi = []
    titen = []
    titen1 = []
    ti = 100000
    for x in ls_H :
        do = T - x * 0.006
        dosi.append(do)
    
    
    for y in dosi :
        ti = A - y
        titen.append(ti)
    
    
    for z in titen :
        titen1.append(abs(z))
    
    
    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()

import sys

def solve(N, T, A, ls_H):
    dosi = []
    titen = []
    titen1 = []
    ti = 100000
    for x in ls_H :
        do = T - x * 0.006
        dosi.append(do)
    
    
    for y in dosi :
        ti = A - y
        titen.append(ti)
    
    
    for z in titen :
        titen1.append(abs(z))
    
    
    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()

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 :
        subtraction = A -y
        difference.append(subtraction)
    #print(difference)
    
    for z in difference : 
        near.append(abs(z))
    print(near)
    
    for i in near :
        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()

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()

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted