TnT/CodeNet4Repair huggingface dataset:
Problem:
There are K pieces of cakes. Mr. Takahashi would like to eat one cake per day, taking K days to eat them all.  There are T types of cake, and the number of the cakes of type i (1 ≤ i ≤ T) is a_i.  Eating the same type of cake two days in a row would be no fun, so Mr. Takahashi would like to decide the order for eating cakes that minimizes the number of days on which he has to eat the same type of cake as the day before.  Compute the minimum number of days on which the same type of cake as the previous day will be eaten.

Incorrect submission (verdict: Wrong Answer):
import heapq
K, T = map(int, input().split())
a = tuple(map(int, input().split()))
cakes = []
heapq.heapify(cakes)
for i in range(T):
    heapq.heappush(cakes, [-1*a[i], i])
print(cakes)
now = -1
ans = 0
for _ in range(K):
    cake_num, cake_idx = heapq.heappop(cakes)
    cake_num *= -1
    if cake_idx == now and len(cakes) > 1 and cakes[0][1]:
        next_cake_num, next_cake_idx = heapq.heappop(cakes)
        next_cake_num -= 1
        heapq.heappush(cakes, [next_cake_num, next_cake_idx])
        now = next_cake_idx
    else:
        cake_num -= 1
        if now == cake_idx:
            ans += 1
        now = cake_idx
    heapq.heappush(cakes, [cake_num, cake_idx])
print(ans)



Fixed, accepted submission:
import heapq
K, T = map(int, input().split())
a = tuple(map(int, input().split()))
cakes = []
heapq.heapify(cakes)
for i in range(T):
    heapq.heappush(cakes, [-1*a[i], i])
# print(cakes)
now = -1
ans = 0
for _ in range(K):
    cake_num, cake_idx = heapq.heappop(cakes)
    cake_num *= -1
    if cake_idx == now and len(cakes) > 1 and cakes[0][0] != 0:
        next_cake_num, next_cake_idx = heapq.heappop(cakes)
        next_cake_num *= -1
        next_cake_num -= 1
        heapq.heappush(cakes, [-1 * next_cake_num, next_cake_idx])
        now = next_cake_idx
    else:
        cake_num -= 1
        if now == cake_idx:
            ans += 1
        now = cake_idx
    heapq.heappush(cakes, [-1 * cake_num, cake_idx])
# print(cakes)
print(ans)
Problem:
This contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters.  Mr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way.  You are given a string s consisting of uppercase English letters. Determine whether the string `CF` can be obtained from the string s by deleting some characters.

Incorrect submission (verdict: Wrong Answer):
s = input()
result = "No"
for i in range(len(s)):
	if s[i] == "C":
		for j in range(i+1, len(s)):
			if s[j] == "F":
				result = "YES"
		break
print(result)

Fixed, accepted submission:
s = input()
result = "No"
for i in range(len(s)):
	if s[i] == "C":
		for j in range(i+1, len(s)):
			if s[j] == "F":
				result = "Yes"
		break
print(result)
Problem:
Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:                 SelectionSort(A) 1 for i = 0 to A.length-1 2     mini = i 3     for j = i to A.length-1 4         if A[j] < A[mini] 5             mini = j 6     swap A[i] and A[mini]   Note that, indices for array elements are based on 0-origin.  Your program should also print the number of swap operations defined in line 6 of the pseudocode in the case where i ≠ mini.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
A = [int(e) for e in input().split()]

def selection_sort(A, N):
    steps = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[minj] > A[j]:
                minj = j
                steps += 1
        A[minj], A[i] = A[i], A[minj]

    print(A)
    print(steps)
    return A

selection_sort(A, N)


Fixed, accepted submission:
N = int(input())
A = [int(e) for e in input().split()]

def selection_sort(A, N):
    steps = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            steps += 1
        A[minj], A[i] = A[i], A[minj]

    for e in A[:-1]:
        print(e, end=' ')
    print(A[-1])
    print(steps)
    return A

selection_sort(A, N)
Problem:
There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors.  Find the number of the possible ways to paint the balls.

Incorrect submission (verdict: Wrong Answer):
N, K = map(int, input().split())
print(K * pow(K, N - 1))


Fixed, accepted submission:
N, K = map(int, input().split())
print(K * pow(K - 1, N - 1))
Problem:
You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:    * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.

Incorrect submission (verdict: Wrong Answer):
s = input().replace('eraser', '').replace('erase', '') \
    .replace('dreamer', '').replace('dream', '')
if s:
    print('NO')
else:
    print('YES')
print(s)

Fixed, accepted submission:
s = input().replace('eraser', '').replace('erase', '') \
    .replace('dreamer', '').replace('dream', '')
if s:
    print('NO')
else:
    print('YES')
Problem:
Write a program which computes the digit number of sum of two integers a and b.

Incorrect submission (verdict: Wrong Answer):
import sys
a = []
for line in sys.stdin:
    a.append(line)
for i in a:
    print(i[0] + i[1])



Fixed, accepted submission:
while True:
    try:
        a, b = map(int,input().split())
        s = str(a + b)
        print(len(s))
    except EOFError:
        break
Problem:
Write a program which reads a sequence and prints it in the reverse order.

Incorrect submission (verdict: Wrong Answer):
length = int(input())
nums = list(map(int, input().split()))
print(nums[::-1])

Fixed, accepted submission:
length = int(input())
nums =  input().split()
print(" ".join(nums[::-1]))
Problem:
Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.  Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence.  Here, the distance between two points s and t on a number line is represented by |s-t|.

Incorrect submission (verdict: Wrong Answer):
a,b,c=map(int,input().split()); print("A" if abs(b-a) < abs(c-b) else "B")

Fixed, accepted submission:
a,b,c=map(int,input().split()); print("A" if abs(b-a) < abs(c-a) else "B")
Problem:
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.

Incorrect submission (verdict: Wrong Answer):
a, b = map(int, input().split())

if (a % 2 == 0 ) or ( b % 2 == 0 ) :
	'even'
else :
	'odd'

Fixed, accepted submission:
a, b = map(int, input().split())

if (a % 2 == 0 ) or ( b % 2 == 0 ) :
	print('Even')
else :
	print('Odd')
Problem:
You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen.  Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2, ... n-1$), and reports the maximum value of $R_j - R_i$ where $j > i$ .

Incorrect submission (verdict: Wrong Answer):
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]

for i in range(1,n-1):
    if(max < A[i+1]-A[i]):
        max = A[i+1]-A[i]

print(max)


Fixed, accepted submission:
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n):
    if(max < A[i]-min):
        max = A[i]-min
    if(min > A[i]):
        min = A[i]

print(max)
Problem:
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.

Incorrect submission (verdict: Wrong Answer):
a,b=map(int,input().split())
t = a*b%2
if t==0:
    print("even")
else:
    print("odd")

Fixed, accepted submission:
a,b=map(int,input().split())
t = a*b%2
if t==0:
    print("Even")
else:
    print("Odd")
Problem:
We have a grid with H rows and W columns, where all the squares are initially white.  You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions:    * Choose one row, then paint all the squares in that row black.   * Choose one column, then paint all the squares in that column black.  At least how many operations do you need in order to have N or more black squares in the grid? It is guaranteed that, under the conditions in Constraints, having N or more black squares is always possible by performing some number of operations.

Incorrect submission (verdict: Wrong Answer):
import math

H = int(input())
W = int(input())
N = int(input())

if(H >= W):
  print(math.ceil(N // H))
else:
  print(math.ceil(N // W))

Fixed, accepted submission:
import math

H = int(input())
W = int(input())
N = int(input())

if(H >= W):
  print(math.ceil(N / H))
else:
  print(math.ceil(N / W))
Problem:
Write a program which reads a $ n \times m$ matrix $A$ and a $m \times 1$ vector $b$, and prints their product $Ab$.  A column vector with m elements is represented by the following equation.  \\[ b = \left( \begin{array}{c} b_1 \\\ b_2 \\\ : \\\ b_m \\\ \end{array} \right) \\]  A $n \times m$ matrix with $m$ column vectors, each of which consists of $n$ elements, is represented by the following equation.  \\[ A = \left( \begin{array}{cccc} a_{11} & a_{12} & ... & a_{1m} \\\ a_{21} & a_{22} & ... & a_{2m} \\\ : & : & : & : \\\ a_{n1} & a_{n2} & ... & a_{nm} \\\ \end{array} \right) \\]  $i$-th element of a $m \times 1$ column vector $b$ is represented by $b_i$ ($i = 1, 2, ..., m$), and the element in $i$-th row and $j$-th column of a matrix $A$ is represented by $a_{ij}$ ($i = 1, 2, ..., n,$ $j = 1, 2, ..., m$).  The product of a $n \times m$ matrix $A$ and a $m \times 1$ column vector $b$ is a $n \times 1$ column vector $c$, and $c_i$ is obtained by the following formula:  \\[ c_i = \sum_{j=1}^m a_{ij}b_j = a_{i1}b_1 + a_{i2}b_2 + ... + a_{im}b_m \\]

Incorrect submission (verdict: Wrong Answer):
n, m = [int(i) for i in input().split()]
matrix = []
for ni in range(n):
    matrix.append([int(x) for x in input().split()])
vector = []
for ni in range(m):
    vector.append(int(input()))

print(matrix)
print()
print(vector)

for ni in range(n):
    sum = 0
    for mi in range(n):
        sum += matrix[ni][mi]* vector[mi]
    print(sum)

Fixed, accepted submission:
n, m = [int(i) for i in input().split()]
 
matrix = []
for ni in range(n):
    matrix.append([int(a) for a in input().split()])
 
vector = []
for mi in range(m):
    vector.append(int(input()))
 
for ni in range(n):
    sum = 0
    for mi in range(m):
        sum += matrix[ni][mi] * vector[mi]
 
    print(sum)
Problem:
E869120 found a chest which is likely to contain treasure.   However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.   He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`.  One more thing he found is a sheet of paper with the following facts written on it:    * Condition 1: The string S contains a string T as a contiguous substring.   * Condition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.  Print the string S.   If such a string does not exist, print `UNRESTORABLE`.

Incorrect submission (verdict: Wrong Answer):
import re

s = str(input())
t = str(input())





NS = []

for i in range(len(s)):
    s_res = s[:i]
    s_obj = s[i:]
    
    
    s_res.replace('?', 'a')

    s_w = s_obj.replace('?', '.') 
    s_re = re.compile(s_w)

    matchobj = s_re.fullmatch(t)
    if matchobj:
        start = matchobj.start()
        end = matchobj.end()
        print('-' * 30)
        print('i' + str(i))
        print(start)
        print(end)
        print('-' * 30)
        
        new_s = s_res + s_obj[:start] + t + s_obj[end:]
        new_s = new_s.replace('?', 'a')
        NS.append(new_s)

if len(NS) >= 1:
    NS = sorted(NS)
    ans = NS[0]
else:
    ans = 'UNRESTORABLE'

print(ans)

Fixed, accepted submission:
import re

s = str(input())
t = str(input())










NS = []

for i in range(len(s)):
    
    s_res = s[:i]
    s_res = s_res.replace('?', 'a')
    
    
    
    s_obj = s[i:i+len(t)]
    s_obj = s_obj.replace('?', '.')
    s_comp = re.compile(s_obj)

    s_res_f = s[i+len(t):]
 
    matchobj = s_comp.fullmatch(t)

    if matchobj:
        start = matchobj.start()
        new_s = s_res + t + s_res_f
        new_s = new_s.replace('?', 'a')
        NS.append(new_s)

if len(NS) == 0:
    ans = 'UNRESTORABLE'
else:
    ans = sorted(NS)[0]

print(ans)
Problem:
Write a program which reads two integers x and y, and prints them in ascending order.

Incorrect submission (verdict: Wrong Answer):
A=1
B=1
x=[]
while True:
    if A==0 and B==0:
        break
    else:
        A, B= map(int, input().split())
        if A > B:
            print(B,A)
        else:
            print(A,B)
           

Fixed, accepted submission:

x=[]
while True:
    A, B= map(int, input().split())   
    if A==0 and B==0:
        break
    else:
        if A > B:
            print(B,A)
        else:
            print(A,B)
Problem:
Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.  To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

Incorrect submission (verdict: Wrong Answer):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    ABC = list(map(int, input().split()))
    print('Yes' if ABC.count(5) == 2 and ABC.count(7) == 1 else 'No')


if __name__ == "__main__":
    main()


Fixed, accepted submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    ABC = list(map(int, input().split()))
    ABC.sort()
    print('YES' if [5, 5, 7] == ABC else 'NO')


if __name__ == "__main__":
    main()
Problem:
Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key.  To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this string is empty. When each key on the keyboard is pressed, the following changes occur to the string:    * The `0` key: a letter `0` will be inserted to the right of the string.   * The `1` key: a letter `1` will be inserted to the right of the string.   * The backspace key: if the string is empty, nothing happens. Otherwise, the rightmost letter of the string is deleted.  Sig has launched the editor, and pressed these keys several times. You are given a string s, which is a record of his keystrokes in order. In this string, the letter `0` stands for the `0` key, the letter `1` stands for the `1` key and the letter `B` stands for the backspace key. What string is displayed in the editor now?

Incorrect submission (verdict: Wrong Answer):
S=str(input())
str_ = ""
for i in range(len(S)):
  if S[i] == "0" or "1":
    str_ = str_ + S[i]
  elif len(str_) != 0:
    str_ = str_.rstrip()
print(str_)

Fixed, accepted submission:
S=str(input())
str_ = ""
for i in range(len(S)):
  if S[i] == "0" or S[i] == "1":
    str_ = str_ + S[i]
  elif len(str_) != 0:
    str_ = str_[:-1]
print(str_)
Problem:
You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.

Incorrect submission (verdict: Wrong Answer):
input()[::2]

Fixed, accepted submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 27 01:06:34 2019

@author: yuta
"""

def oddstring(s):
    print(s[::2])

oddstring(input())
Problem:
You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".

Incorrect submission (verdict: Wrong Answer):
import re

S = input()
pattern = r"(.+keyence|k.+eyence|ke.+yence|key.+ence|keye.+nce|keyen.+ce|keyenc.+e|keyence.+|keyence)"
if re.fullmatch(pattern, S):
    print("YES")
else:
    print("NO")


Fixed, accepted submission:
nums = list(map(int, input().split()))
if 1 in nums and 9 in nums and 7 in nums and 4 in nums:
    print("YES")
else:
    print("NO")
Problem:
This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_.  When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.  What is the abbreviation for the N-th round of ABC? Write a program to output the answer.

Incorrect submission (verdict: Wrong Answer):
N = input()
print("abc{}".format(N))

Fixed, accepted submission:
N = input()

print("ABC"+N)
Problem:
There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X.

Incorrect submission (verdict: Wrong Answer):
x=int(input())
#n=1
#while 1/2*(n**2+n)<x:
#  n+=1
#print(n)

left=0
right=x
while right-left>1:
  mid=(left+right)//2
  
  if (mid**2+mid)/2==x:
    break
  if (mid**2+mid)/2<x:
    left=mid
  else:
    right=mid
print(right)

Fixed, accepted submission:
x=int(input())
#n=1
#while 1/2*(n**2+n)<x:
#  n+=1
#print(n)

left=0
right=x
while right-left>1:
  mid=(left+right)//2
  if (mid**2+mid)/2==x:
    right=mid
    break
  if (mid**2+mid)/2<x:
    left=mid
  else:
    right=mid
print(right)
Problem:
You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x?

Incorrect submission (verdict: Wrong Answer):
from decimal import Decimal
a, b, x = map(Decimal, input().split())
int(Decimal(b/x) - Decimal(a/x))

Fixed, accepted submission:
from decimal import Decimal
a, b, x = map(Decimal, input().split())
bx = (b/x)
aq, amod = divmod(a, x)
if a==0 or amod==0:
    print(int(bx-aq)+1)
else:
    print(int(bx-aq))
Problem:
You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order.

Incorrect submission (verdict: Wrong Answer):
s = input()
s_asc = ''.join(sorted(s))
 
t = input()
t_desc = ''.join(sorted(t, reverse=True))

print(s_asc)
print(t_desc)

if s_asc < t_desc:
	print('Yes')
else:
	print('No')

Fixed, accepted submission:
s = input()
s_asc = ''.join(sorted(s))
 
t = input()
t_desc = ''.join(sorted(t, reverse=True))


if s_asc < t_desc:
	print('Yes')
else:
	print('No')
Problem:
You went shopping to buy cakes and donuts with X yen (the currency of Japan).  First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop.  How much do you have left after shopping?

Incorrect submission (verdict: Wrong Answer):
X = int(input())
A = int(input())
B = int(input())

N = 0
while True:
   if (X-A-B*N)> 0:
       N +=1

   else:
       print(X-A-B*N)
       break

Fixed, accepted submission:
X = int(input())
A = int(input())
B = int(input())

N = 0
while True:
   if (X-A-B*N)>= 0:
       N +=1

   else:
       print(X-A-B*(N-1))
       break
Problem:
Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes:    * Hit his pocket, which magically increases the number of biscuits by one.   * Exchange A biscuits to 1 yen.   * Exchange 1 yen to B biscuits.  Find the maximum possible number of biscuits in Snuke's pocket after K operations.

Incorrect submission (verdict: Wrong Answer):
K, A, B = map(int, input().split())
if A >= B - 1:
    print(K + 1)

Fixed, accepted submission:
K, A, B = map(int, input().split())
if A >= B - 1 or A >= K:
    print(K + 1)
else:
    K -= (A + 1)
    ans = 0
    if K >= 2:
        ans = B + ((B - A) * (K // 2))
        ans += K % 2
    elif K != 0:
        ans = B + 1
    else:
        ans += B
    print(ans)
Problem:
Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.  The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)  Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?

Incorrect submission (verdict: Wrong Answer):
# -*- coding: utf-8 -*-

x = int(input())

money = 100
year = 0

while (money <= x):
    money = int(money*1.01)

print('{}'.format(year))


Fixed, accepted submission:
# -*- coding: utf-8 -*-

x = int(input())

money = 100
year = 0

while (money < x):
    money = int(money * 1.01)
    year = year + 1

print('{}'.format(year))
Problem:
You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order.

Incorrect submission (verdict: Wrong Answer):
s = input()
t = input()
p = []
q = []
m = len(s)
n = len(t)
ans = 0
for i in range(m):
    p.append(s[i])
p.sort()
for j in range(n):
    q.append(t[j])
q.sort()
if m >= n:
    ans = "No"
else:
    ans = "Yes"
for k in range(min(m,n)):
    if ord(p[k]) < ord(q[k]):
        ans = "Yes"
        break
    elif ord(p[k]) > ord(q[k]):
        ans = "No"
        break
print(ans)

Fixed, accepted submission:
s = input()
t = input()
p = []
q = []
m = len(s)
n = len(t)
if m >= n:
    ans = "No"
else:
    ans = "Yes"
for i in range(m):
    p.append(s[i])
p.sort()
for j in range(n):
    q.append(t[j])
q.sort(reverse=True)
for k in range(min(m,n)):
    if ord(p[k]) < ord(q[k]):
        ans = "Yes"
        break
    elif ord(p[k]) > ord(q[k]):
        ans = "No"
        break
print(ans)
Problem:
Niwango-kun is an employee of Dwango Co., Ltd.   One day, he is asked to generate a thumbnail from a video a user submitted.   To generate a thumbnail, he needs to select a frame of the video according to the following procedure:    * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the number of the frames of the video, and each a_i denotes the representation of the i-th frame of the video.   * Select t-th frame whose representation a_t is nearest to the average of all frame representations.   * If there are multiple such frames, select the frame with the smallest index.  Find the index t of the frame he should select to generate a thumbnail.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
at = input().split(" ")
a = []
for i in at:
    a.append(int(i))
avg = sum(a) / N
mdif, flag = abs(a[0]-avg), 0
for i in range(len(a)):
    if a[i]-avg < mdif:
        mdif = a[i] - avg
        flag = i
print(flag)


Fixed, accepted submission:
N = int(input())
at = input().split(" ")
a = []
for i in at:
    a.append(int(i))
avg = sum(a) / N
mdif, flag = abs(a[0]-avg), 0
for i in range(len(a)):
    if abs(a[i]-avg) < mdif:
        mdif = abs(a[i]-avg)
        flag = i
print(flag)