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

Solution (Python):


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

Solution (Python):
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
    
    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()
    
    if num_referee != "0":
        culc(int(num_referee))
    else:
        break

Solution (Python):
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)

Solution (Python):
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)))

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
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)))

Solution (Python):
while 1:
    n=int(input())
    if n==0:break
    score=[]
    for i in range(n):
        score.append(int(input()))
    score.sort()
    score=score[1:-1]
    print(sum(score)//len(score))

Solution (Python):
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)

Solution (Python):
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)))

Solution (Python):

n=int(input())
while n!=0:
    s=int(input())
    x=s
    m=s
    for i in range (n-1):
        p=int(input ())
        if m>p:
      
            m=p
        elif x<p:
        
            x=p
    
        s+=p
   
    s-=x
    s-=m
    s/=n-2
    print(int(s))
    n=int(input())

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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)))

Solution (Python):

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

Solution (Python):
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)