Problem:


Problem A: ICPC Score Totalizer Software

The International Clown and Pierrot Competition (ICPC), is one of the
most distinguished and also the most popular events on earth in the
show business.

One of the unique features of this contest is the great number of
judges that sometimes counts up to one hundred.  The number of judges
may differ from one contestant to another, because judges with any
relationship whatsoever with a specific contestant are temporarily
excluded for scoring his/her performance.

Basically, scores given to a contestant's performance by the judges
are averaged to decide his/her score.  To avoid letting judges with
eccentric viewpoints too much influence the score, the highest and the
lowest scores are set aside in this calculation.  If the same highest
score is marked by two or more judges, only one of them is ignored.
The same is with the lowest score.  The average, which may contain
fractions, are truncated down to obtain final score as an integer.

You are asked to write a program that computes the scores of
performances, given the scores of all the judges, to speed up the event
to be suited for a TV program.

Input

The input consists of a number of datasets, each corresponding to a
contestant's performance.  There are no more than 20 datasets in the input.

A dataset begins with a line with an integer n, the number of
judges participated in scoring the performance (3 ≤ n ≤
100).  Each of the n lines following it has an integral
score s (0 ≤ s ≤ 1000) marked by a judge.  No
other characters except for digits to express these numbers are in the
input.  Judges' names are kept secret.

The end of the input is indicated by a line with a single zero in it.

Output

For each dataset, a line containing a single decimal integer
indicating the score for the corresponding performance should be
output.  No other characters should be on the output line.

Sample Input

3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
353
242
402
274
283
132
402
523
0

Output for the Sample Input

342
7
300
326



Sample input:
3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
353
242
402
274
283
132
402
523
0


Sample output:
342
7
300
326

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *

int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline()[:-1]
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]

def main():
    while 1:
        n=II()
        if n==0:break
        aa=[II() for _ in range(n)]
        aa.sort()
        print(sum(aa[1:n-1])//(n-2))

main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    while True:
        N = int(input())
        if N == 0:
            break

        arr = []
        for _ in range(N):
            arr.append(int(input().strip()))
        
        n = sum(arr)
        n -= max(arr) + min(arr)

        print(n // (N - 2))

Submission status: Accepted

Solution code:
while 1:
    n = int(input())
    if n == 0:
        break
    a = []
    for i in range(n):
        a.append(int(input()))
    print((sum(a)-max(a)-min(a))//(n-2))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    while N != 0:
        s = [int(input()) for i in range(N)]
        s.sort()
        print(sum(s[1:N-1])//(N-2))
        N = int(input())
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    judges = []

    for i in range(n):
        judges.append(int(input()))

    print((sum(judges) - max(judges) - min(judges)) // (len(judges) - 2))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    lista = []
    for i in range(n):
        lista.append(int(input()))
    lista.sort()
    lista.pop(0)
    lista.pop(-1)
    ave = sum(lista)//(n-2)
    print(ave)

Submission status: Accepted

Solution code:
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

while 1:
    n=int(input().rstrip())
    if n==0:
        break
    print(sum(sorted([int(input().rstrip()) for _ in range(n)])[1:-1])//(n-2))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ICPC A

while 1:
    n = int(input())
    if n == 0:
        break
    s = [int(input()) for _ in range(n)]
    s.sort()
    ans = sum(s[1:n-1])/(n-2)
    print(int(ans))

Submission status: Accepted

Solution code:
person = int(input())
while person != 0:
    scores = []
    for i in range(person):
        scores.append(int(input()))     
    scores.sort()
    del scores[0]
    del scores[-1]
    print(int(sum(scores)/len(scores)))
    person = int(input())

Submission status: Accepted

Solution code:
while True :
    num = int(input())
    if num == 0 :
        break
    A = []
    for i in range(num):
        sco = int(input())
        A.append(sco)
        A.sort()
    del A[num - 1]
    del A[0]

    B = int(sum(A)/(num-2))
    print(B)

Submission status: Accepted

Solution code:
ans_list = []

while True:
    n = int(input())
    if n == 0:
        break
    s = sorted([int(input()) for _ in range(n)])
    ans = sum(s[1:-1]) // (n-2)
    ans_list.append(ans)

for ans in ans_list:
    print(ans)

Submission status: Accepted

Solution code:
from math import *

while True:
    a = int(input())
    if a == 0: break

    #print('a')
    score_list = []
    #max_score = 0
    #min_score = 1000
    for i in range(a):
        score_list.append(int(input()))
    #print(score_list)
    max_ = max(score_list)
    min_ = min(score_list)

    #print('b')
    ans_list = []
    flag = 0
    for score in score_list:
        if score == max_ and not flag:
            flag = 1
            continue
        else:
            ans_list.append(score)

    new_ans_list = []
    flag = 0
    for score in ans_list:
        if score == min_ and not flag:
            flag = 1
            continue
        else:
            new_ans_list.append(score)

    avg = sum(new_ans_list)/len(new_ans_list)
    print(int(avg))

Submission status: Accepted

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

def main():
    while 1:
        n = int(input())
        if n == 0:
            return 0
        s_l = []
        for _ in range(n):
            s_l.append(int(input()))
        ans = int((sum(s_l) - max(s_l) - min(s_l))/(n-2))
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def solve(n, score):
    score = sorted(score)
    return sum(score[1:-1])//len(score[1:-1])

def main():
    ans = []
    while True:
        n = int(input())
        if (n == 0):
            break
        score = [int(input()) for i in range(n)]
        ans.append(solve(n, score))
    
    for i in ans:
        print(i)

main()

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    x = []
    for i in range(n):
        x.append(int(input()))
    x = sorted(x)
    x.pop(0)
    x.pop(-1)
    print(sum(x) // len(x))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    s = sorted([int(input()) for i in range(n)])
    s = s[1:-1]
    print(sum(s)//len(s))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    point = []
    for i in range(n):
        point.append(int(input()))
    point.sort()
    del point[0]
    del point[-1]
    print(sum(point) // (n - 2))

Submission status: Accepted

Solution code:
# coding=utf-8

###
### for atcorder program
###

import sys
import math
import array

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]
#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def main():
    ans = []
    while(True):
        N = int(input())
        point = []

        if N == 0:
            break

        for i in range(N):
            point.append(int(input()))
    
        pointsum = sum(point)-(max(point)+min(point))

        ans.append(pointsum//(N-2))
        
    for i in ans:
        print(i)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
while True:
  n=int(input())
  if n==0:
    break
  lists=[]
  for i in range(n):
    lists.append(int(input()))
  a=max(lists)
  b=min(lists)
  x=int(len(lists))
  average=(sum(lists)-a-b)/(x-2)
  print(int(average))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    sum_ = 0
    max_ = 0
    min_ = 1000
    for i in range(n):
        tmp = int(input())
        sum_ += tmp
        max_ = max(max_, tmp)
        min_ = min(min_, tmp)
    sum_ -= max_
    sum_ -= min_
    print(int(sum_/(n-2)))

Submission status: Accepted

Solution code:
def solve(n):
    a = [int(input()) for i in range(n)]
    print((sum(a)-max(a)-min(a))//(n-2))


while(True):
    n = int(input())
    if(n == 0):
        quit()
    solve(n)

Submission status: Accepted

Solution code:
while 1:
    n = int(input())
    if n == 0:
        break
    s = [int(input()) for i in range(n)]
    print((sum(s)-max(s)-min(s))//(n-2))

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    while True:
        n = II()
        if not n:
            break
        a = IR(n)
        a.sort()
        print(sum(a[1:-1])//(n-2))
            
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if not n:
        break
    print(sum(sorted([int(input()) for _ in range(n)])[1:-1]) // (n - 2))

Submission status: Accepted

Solution code:
N = int(input())
while N != 0:
        total = 0
        minimam = 1000
        maximam = 0
        for _ in range(N):
                s = int(input())
                total += s
                minimam = min(minimam, s)
                maximam = max(maximam, s)
        print(int((total-minimam-maximam)/(N-2)))
        N = int(input())

Submission status: Accepted

Solution code:
Ps = []

while True:
    i = int(input())
    if i == 0:
        break
    P = []
    P.append(i)
    for ii in range(i):
        P.append(int(input()))

    Ps.append(P)

for p in Ps:
    p[0] = 0
    p.sort()
    p[1] = 0
    p[-1] = 0
    print(int(sum(p) / (len(p) - 3)))

Submission status: Accepted

Solution code:
# ICPC Score Totalizer Software

ans = []

while True:
    n = int(input())
    if n == 0:
        break
    point = [int(input()) for i in range(n)]
    ans.append((sum(point) - max(point) - min(point)) // (n - 2))

for i in range(len(ans)):
    print(ans[i])

Submission status: Accepted

Solution code:
def culc(num_referee):
    data=[]
    for i in range(num_referee):
        data.append(int(input()))
    data.sort()
    sum_data=0
    data[0]=0
    data[len(data)-1]=0
    #print(data)
    for j in data:
        sum_data=sum_data+j
    avg=sum_data/(len(data)-2)
    print(int(avg))


num_referee=1
while(1):
    num_referee=input()
    #print(num_referee)
    if num_referee != "0":
        culc(int(num_referee))
    else:
        break

Submission status: Accepted

Solution code:
n = 1
while n != 0:
    n = int(input())
    S = []
    S = [int(input()) for _ in range(n)]
    if n==0:
        break
    ans = (sum(S)-min(S)-max(S))/(n-2)
    Ans = int(ans)
    print(Ans)

Submission status: Accepted

Solution code:
while True:
    N = int(input())
    if N == 0:
        break
    S = []
    for i in range(N):
        S.append(int(input()))
    a = sum(S)-max(S)-min(S)
    print(int(a/(N-2)))

Submission status: Accepted

Solution code:
while True:
  n=int(input()) #審判の数
  if n==0:#入力終了
   break
  l=[]
 
  s=0
  for i in range(n):
    j=int(input()) #得点
    l.append(j)
    s+=j
  print((s-max(l)-min(l)) //(n-2))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    score = []
    ans = 0
    if n==0:
        break
    for i in range(n):
        score.append(int(input()))
    score.sort()
    for i in range(1,len(score)-1):
        ans+=score[i]
    print(ans//(n-2))

Submission status: Accepted

Solution code:
while True:
  N = int(input())
  if N == 0:
    break
  L = []
  for i in range(N):
    L.append(int(input()))
  L.sort()
  A = sum(L)
  print((A-L[0]-L[len(L)-1])//(N-2))

Submission status: Accepted

Solution code:
from statistics import mean
import math

while True:
    n = int(input())
    if n == 0:
        break
    s = [int(input()) for _ in range(n)]
    s.remove(max(s))
    s.remove(min(s))
    print(math.floor(mean(s)))

Submission status: Accepted

Solution code:
list2=[]
while True:
    try:
        N=int(input())
        list1=[int(input()) for _ in range(N)]
        list2.append(int((sum(list1)-max(list1)-min(list1))/(N-2)))
    except:
        break
for tmp in list2:
    print(tmp)

Submission status: Accepted

Solution code:
import math
while True:
    score = []
    n = int(input())
    if n == 0:
        break
    else:
        for i in range(n):
            score.append(int(input()))
    
    score.remove(min(score))
    score.remove(max(score))
    
    print(math.floor(sum(score)/len(score)))

Submission status: Accepted

Solution code:
# your code goes here
n=int(input())
while n!=0:
    s=int(input())
    x=s
    m=s
    for i in range (n-1):#n-2?:?
        p=int(input ())
        if m>p:
      #      s+=m
            m=p
        elif x<p:
        #    s+=x
            x=p
    #    else:
        s+=p
   #     print (s)
    s-=x
    s-=m
    s/=n-2
    print(int(s))
    n=int(input())

Submission status: Accepted

Solution code:
while 1:
    n = int(input())
    if n == 0:
        break

    pt = []
    for _ in range(n):
        pt.append(int(input()))

    pt.sort()
    pt.pop(0)
    pt.pop()

    ans = int(sum(pt) / len(pt))
    print(ans)

Submission status: Accepted

Solution code:
while True:
    N=int(input())
    if(N==0): break
    s = [int(input()) for i in range(N)]
    print(sum(sorted(s)[1:-1]) // (N-2))

Submission status: Accepted

Solution code:
from statistics import mean
while True:
  N = int(input())
  if N == 0:
    break
  S = []
  for i in range(N):
    S.append(int(input()))
  S.remove(max(S))
  S.remove(min(S))
  print(int(mean(S)))

Submission status: Accepted

Solution code:
# coding: utf-8
def q0():
    while True:
        data=[]
        n=int(input())
        if n==0:
            return
        for i in range(n):
            data.append(int(input()))
        print((sum(data)-max(data)-min(data))//(n-2))

def q1():
    while True:
        n,r=map(int,input().split())
        if n==0:
            return
        deck=[n-i for i in range(n)]
        for i in range(r):
            p,c=map(int,input().split())
            deck=deck[p-1:p-1+c]+deck[0:p-1]+deck[p-1+c:]
        print(deck[0])


question=[q0,q1]

question[0]()

Submission status: Accepted

Solution code:
while True:
    n = int(raw_input())
    if n == 0: break

    ls = [int(raw_input()) for i in range(n)]
    ls.sort()
    print sum(ls[1:-1]) / (n-2)

Submission status: Runtime Error

Solution code:
def tax(p,x):
    return p*(100+x) // 100 # 整数除算
def solve(X,Y,S):
    for a in range(1,S):
        for b in range(1,S):
            sum = tax(a,X)+tax(b,X)
            if sum == S:
# 新税でのtax(a,Y)+tax(b,Y) について検討 
                if sum > S:
                    break
# b増加ならばsum増加のため1 
    return best 
while True:
    X,Y,S = map(int, input().strip().split('')) 
    if X == 0:
        break
print(solve(X,Y,S))

Submission status: Runtime Error

Solution code:
def tax(p,x):
    return p*(100+x) // 100 # 整数除算
def solve(X,Y,S):
    for a in range(1,S):
        for b in range(1,S):
            sum = tax(a,X)+tax(b,X)
            if sum == S:
# 新税でのtax(a,Y)+tax(b,Y) について検討 
            if sum > S:
                    break
# b増加ならばsum増加のため1 
    return best 
while True:
    X,Y,S = map(int, input().strip().split('')) 
    if X == 0:
        break
print(solve(X,Y,S))

Submission status: Runtime Error

Solution code:
def tax(p,x):
    return p*(100+x) // 100 # 整数除算
def solve(X,Y,S):
    for a in range(1,S):
        for b in range(1,S):
            sum = tax(a,X)+tax(b,X)
            if sum == S:
# 新税でのtax(a,Y)+tax(b,Y) について検討 
            if sum > S:
                break
# b増加ならばsum増加のため1 
    return best 
while True:
    X,Y,S = map(int, input().strip().split('')) 
    if X == 0:
        break
print(solve(X,Y,S))

Submission status: Runtime Error

Solution code:
def tax(p,x):
    return p*(100+x) // 100
def solve(X,Y,S):
    for a in range(1,S):
        for b in range(1,S):
            sum = tax(a,X)+tax(b,X)
            if sum == S:
            if sum > S:
                break
    return best 
while True:
    X,Y,S = map(int, input().strip().split('')) 
    if X == 0:
        break
print(solve(X,Y,S))

Submission status: Runtime Error

Solution code:
def tax(p,x):
    return p*(100+x) // 100
def solve(X,Y,S):
    for a in range(1,S):
        for b in range(1,S):
            sum = tax(a,X)+tax(b,X)
            if sum == S:
                tax(a,Y)+tax(b,Y) 
            if sum > S:
                break
    return best 
while True:
    X,Y,S = map(int, input().strip().split('')) 
    if X == 0:
        break
print(solve(X,Y,S))

Submission status: Runtime Error

Solution code:
while True:
    #審判の数
    n = int(input())
    if n == 0:
        break
    while n >= 3 and n <= 100: #審判の数は３〜１００人
        a = [0]*n               #空いてる配列
        for i in range(n):       #空いてる配列に点数を入れる
            s = int(input())
            a[i] = s
        tensu = (sum(a) - min(a) -max(a))/(len(a)-2) #一番でかい点数と一番小さい点数は一つずつ引いて平均
        print(int(tensu))        #平均点！

Submission status: Runtime Error

Solution code:
while True:
    n = int(input())
    if n == 0:
        exit()
    score = []
    for i in range(n):
        score.append(int(input()))
    print((sorted(score)[1:-1])//(n-2))

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-
#ICPC得点集計ソフトウェア
import sys
def solve(n):
	nums = []
	for i in xrange(n):
		temp = input()
		nums.append(temp)
	nums.sort()
	sum = 0
	for i in xrange(1,n-1):
		sum += nums[i]
	return sum / (n-2)


if __name__ == "__main__":
	while :
		N = input()
		if N == 0:
			sys.exit()
		else:
			print solve(N)

Submission status: Runtime Error

Solution code:
import sys
import math


def load_file(file_name):
    f = open(file_name)
    lines = f.readlines()
    f.close()
    return lines

def change_type(lines):
    new_line = []
    for line in lines:
        new_line.append(int(line))
    return new_line


def make_group(lines):
    group = []
    number = lines[0]
    lines.remove(lines[0])
    i = 0
    while i < number:
        group.append(lines[0])
        lines.remove(lines[0])
        i += 1
    return (lines, group)

def get_average(group):
    max_score = max(group)
    min_score = min(group)
    group.remove(max_score)
    group.remove(min_score)
    average = int(math.floor(sum(group)/len(group)))
    return average


def main(argv):
    lines = load_file('sample_score.txt')
    #for line in lines:
        #print line
    groups = []
    lines = change_type(lines)
    while lines[0] != 0:
        lines, group = make_group(lines)
        groups.append(group)
    for group in groups:
        print get_average(group)

if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Runtime Error

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

def main(n):
    scores = []
    for i in range(n):
        scores.append(int(raw_input))
    scores.remove(max(scores))
    scores.remove(min(scores))
    print math.floor(sum(scores)/len(scores))

while 1:
    n = int(raw_input)
    if n == 0:
        break
    main(n)

Submission status: Runtime Error

Solution code:
while True:

  n = int(raw_input())

  if n == 0:
    break

  l = []

  for i in range(n):
    l.append(int(raw_input())

  print (sum(l) - max(l) - min(l)) / (len(l) - 2)

Submission status: Runtime Error

Solution code:
#coding: utf-8

import sys
import math

l = []
for line in sys.stdin:
    l.append(int(line))

check = 0
point_list = []
for i in range(len(l)):
    if check == 0:
        last_row = i + l[n]
        check = 1
        continue
    else:
        point_list.append(i)
        if i == last_row:
            point_list.sort()
            point_list = point_list[1:-1]
            ave = sum(point_list)/len(point_list)
            print math.floor(ave)
            check = 0

Submission status: Runtime Error

Solution code:
#coding: utf-8

import sys
import math

l = []
for line in sys.stdin:
    l.append(int(line))

check = 0
point_list = []
for i in range(len(l)):
    if check == 0:
        last_row = i + l[i]
        check = 1
        continue
    else:
        point_list.append(i)
        if i == last_row:
            point_list.sort()
            point_list = point_list[1:-1]
            ave = sum(point_list)/len(point_list)
            print math.floor(ave)
            check = 0

Submission status: Runtime Error

Solution code:
#coding: utf-8

import sys
import math

l = []
for line in sys.stdin:
    l.append(int(line))

check = 0
point_list = []
for i in range(len(l)):
    if check == 0:
        last_row = i + l[i]
        check = 1
    else:
        point_list.append(i)
        if i == last_row:
            point_list.sort()
            point_list = point_list[1:-1]
            ave = sum(point_list)*1.0 / len(point_list)
            print int(math.floor(ave))
            check = 0

Submission status: Runtime Error

Solution code:
#coding: utf-8

import sys
import math

l = []
for line in sys.stdin:
    l.append(int(line))

check = 0
point_list = []
for i in range(len(l)-1):
    if check == 0:
        last_row = i + l[i]
        check = 1
    else:
        point_list.append(i)
        if i == last_row:
            point_list.sort()
            point_list = point_list[1:-1]
            ave = sum(point_list)*1.0 / len(point_list)
            print int(math.floor(ave))
            check = 0

Submission status: Runtime Error

Solution code:
str=readlines()
print(str)

Submission status: Runtime Error

Solution code:
str=readlines()
print(str)
print("aaa")

Submission status: Runtime Error

Solution code:
str=read()
print(str)
print("aaa")

Submission status: Runtime Error

Solution code:
while True:
    n=int(input())
    points=[]
    for i in range(n):
        points.append(int(input()))
    points.remove(max(points))
    points.remove(min(points))
    print(sum(points)/len(points))
    if int(input())==0:break

Submission status: Runtime Error

Solution code:
while True:
    n=int(input())
    points=[]
    for i in range(n):
        points.append(int(input()))
    points.remove(max(points))
    points.remove(min(points))
    print(int(sum(points)/len(points)))
    if int(input())==0:break

Submission status: Runtime Error

Solution code:
while True:
    n = int(raw_input())

    if !n:
        break

    L = [int(raw_input()) for _ in range(n)]

    print (sum(L) - max(L) - min(L)) / (n - 2)

Submission status: Runtime Error

Solution code:
while True:
    N = int(input())
    if 3
    N == 0:
        break
    S = []
    for i in range(N):
        S.append(int(input()))
    print((sum(S) - max(S) - min(S))//(len(S)-2))

Submission status: Runtime Error

Solution code:
import math

def main():
    f = true
    r = []
    while f:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m)/(n-2)))
    res = ''
    for j in r:
        res += str(j)
    print(j)

Submission status: Runtime Error

Solution code:
import math

def main():
    f = true
    r = []
    while f:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m)/(n-2))))
    res = ''
    for j in r:
        res += str(j)
    print(j)
    
main()

Submission status: Runtime Error

Solution code:
while(True):
  n = input()
  if n == 0:
    break;
  sl = 1001
  sh = 0
  ret = 0
  for i in range(n):
    tmp = input()
    sum += tmp
    if tmp < sl:
      sl = tmp
    if tmp > sh:
      sh = tmp
  ret -= (sl + sh)
  print "%d" % (ret/n)

Submission status: WA: Presentation Error

Solution code:
import sys
F = sys.stdin
Continue = True
Ans = ""
while Continue:
    N = int(F.readline().strip("\n"))
    if N == 0:
        Continue = False
        break
    else:
        Score = [None] * N
        for i in range(N):
            Score[i] = int(F.readline().strip("\n"))
        Score.sort()
        Ans += str(sum(Score[1:N-1])//(N-2)) + "\n"
print(Ans)