Problem:
Mode Value Your task is to write a program which reads a sequence of integers and prints mode values of the sequence.
The mode value is the element which occurs most frequently. Input A sequence of integers a i (1 ≤ a i ≤ 100). The number of integers is less than or equals to 100. Output Print the mode values. If there are several mode values, print them in ascending order. Sample Input 5
6
3
5
8
7
5
3
9
7
3
4 Output for the Sample Input 3
5 For example, 3 and 5 respectively occur three times, 7 occurs two times, and others occur only one. So, the mode values are 3 and 5.

Solution (Python):
a = [0] * 100

while True :
    try :
        a[int(input())] += 1
    except :
        break
    
x = max(a)


for i in range(100) :
    if a[i] == x :
        print(i)

Solution (Python):


import collections

S = list()
for i in range(100):
    try:
        S.append(int(input()))
    except:
        break

A = list()

for j in range(len(collections.Counter(S).most_common())):
    if collections.Counter(S).most_common()[0][1] == collections.Counter(S).most_common()[j][1]:
        A.append(collections.Counter(S).most_common()[j][0])
A.sort()       
for z in range(len(A)):
    print(A[z])

Solution (Python):

import collections
a = list()
for i in range(100):
    try:
        a.append(int(input()))
    except:
        break
x = collections.Counter(a).most_common()[0][1]
z = collections.Counter(a).most_common()[0][0]

l = []

for j in range(len(collections.Counter(a).most_common())):
    y = collections.Counter(a).most_common()[j][1]
    v = collections.Counter(a).most_common()[j][0]
    if x == y:
        l.append(v)
    else:
        break
l.sort()
for k in range(len(l)):
    print(l[k])

Solution (Python):

a = [0]*101

while True:
    try:
        n = int(input())
        a[n] += 1
    except:
        break
    
for i in range(1,101):
    if a[i] == max(a):
        print(i)

Solution (Python):



l = [0] * 110

while True:
   try:
      n = int(input())
      l[n] += 1
   except EOFError:
      break

m = max(l)
for i in range(1, 101):
   if l[i] == m:
      print(i)

Solution (Python):
while True:
    try:
        alist = []
        while True:
            try:
                a = int(input())
                alist.append(a)
                
            except:
                break
    
        m = min(alist)
        M = max(alist)
        
        if m<1:
            break

        clist = [0]
        saihin = [0]
        for i in range(m,M+1,1):
            c = alist.count(i)
            if c>clist[0]:
                del(clist[0])
                clist.append(c)
                del(saihin[0])
            if c==clist[0]:
                saihin.append(i)

        l = len(saihin)
        for i in range(l):
            if saihin==[]:
                break
            print(saihin[0])
            del(saihin[0])
    
    except:
        break

Solution (Python):
import sys
readlines = sys.stdin.readlines
write = sys.stdout.write
def solve():
    mp = {}
    for line in readlines():
        v = int(line)
        mp[v] = mp.get(v, 0) + 1
    ma = max(mp.values())
    ans = [k for k, v in mp.items() if v == ma]
    ans.sort()
    write("\n".join(map(str, ans)))
    write("\n")
solve()

Solution (Python):
a=[0]*100
while True:
	try:
		a[int(input())]+=1
	except:
		break
for i in range(100):
	if a[i]==max(a):
		print(i)

Solution (Python):
a = [0] * 101
while 1:
    try:
        a[int(input())] += 1
    except:
        break
m = max(a)
for i, v in enumerate(a):
    if m == v:
        print(i)

Solution (Python):
a = list([0] * 100)

while True :
    try :
        a[int(input())-1] += 1
    except EOFError :
        break
    
x = max(a)
for i in range(100) :
    if a[i] == x :
        print(i+1)

Solution (Python):
y=[0]*100
while True:
    try:
        y[int(input())-1]+=1
    except:
        break
    
flag=False
for i in range(100)[::-1]:
    if flag:
        exit()
    for j in range(100):
        if y[j]==i:
            flag=True
            print(j+1)

Solution (Python):
a = []
while True:
    try:
        a.append(int(input()))
    except:break
c=[0]*101
for i in a:
    c[i] += 1
b=max(c)
for j in range(100):
    if c[j]==b:
        print(j)

Solution (Python):
mode = []
count = [0 for i in range(100)]
while(1):
	try:
		n = int(input())
		count[n-1] = count[n-1] + 1
	except EOFError:
		max_ = max(count)
		for i in range(100):
			if count[i] == max_:
				mode.append(i+1)
		for i in mode:
			print(i)
		break

Solution (Python):
N = []
A = [0 for i in range(100)]

while True :
    try :
        n = int(input())
        N.append(n)
        A[n - 1] += 1
        
    except :
        break
    
m = max(A)

M = [i for i, x in enumerate(A) if x == m]
l = len(M)

for i in range(l) :
    print(M[i] + 1)

Solution (Python):
a=[0]*100
while 1:
  try:
    a[int(input())-1]+=1
  except:
    break
[print(i+1)for i in range(100)if a[i]==max(a)]

Solution (Python):

cnt = [0] * 101
while True:
    try:
        index = int(input())
        cnt[index] += 1
    except EOFError:
        break
    	
max = max(cnt)
for i in range(100):
	if cnt[i] == max:
		print(i)

Solution (Python):
num = [[0,i+1] for i in range(100)]
while True:
    try:
        num[int(input())-1][0] += 1
    except:
        num.sort(reverse = True)
        ans = []
        for i in range(100):
            if num[i][0] == num[0][0]:
                ans.append(num[i][1])
            else:
                ans.sort()
                for z in ans:
                    print(z)
                break
        break

Solution (Python):

L = [0] * 101
while True:
    try:
        k = int(input())
        L[k] += 1
    except EOFError:
        break

max = max(L)
for i in range(101):
    if L[i] == max:
        print(i)

Solution (Python):
list=[]
while True:
    try:
        x=int(input())
    except:
        break
    list.append(x)

tmp=1
ans=[]
for i in range(100):
    num=0
    for l in range(len(list)):
        if i==list[l]:
            num+=1
    if num>tmp:
        tmp=num
        ans=[i]
    elif num==tmp:
        ans.append(i)
for n in range(len(ans)):
    print(ans[n])

Solution (Python):
a = [0] * 100

while 1:
    try:
        n = int(input())
        a[n] += 1
    except:
        break

v = max(a)
for i in range(100):
    if v == a[i]:
        print(i)

Solution (Python):
import sys

arr = []
for i in range(101):
    arr.append(0)
    
maxi = 0

for e in sys.stdin:
    arr[int(e)] += 1
    maxi = max(maxi, arr[int(e)])
    
for i in range(101):
    if arr[i] == maxi:
        print(i)

Solution (Python):
a=[0]*100
while 1:
  try:
    a[int(input())-1]+=1
  except:
    break
[print(i+1)for i in range(100)if a[i]==max(a)]

Solution (Python):
a = [0] * 100
while 1:
  try: a[int(input()) - 1] += 1
  except: break
[print(i+1) for i in range(100) if a[i] == max(a)]

Solution (Python):
list=[0]*100
while(True):
    try:
        list[int(input())-1]+=1
    except:
        for i in range(100):
            if list[i]==max(list):
                print(i+1)
        break

Solution (Python):
import sys
cnt = [0]*101
while True:
    try:
        cnt[int(input())] += 1
    except EOFError:
        break
max = max(cnt)
for i in range(101):
    if cnt[i] == max:
        print(i)

Solution (Python):
import sys
a=[0]*101
for i in sys.stdin:a[int(i)]+=1
[print(i)for i in range(101)if a[i]==max(a)]

Solution (Python):
a=[0]*100
while 1:
    try: a[int(input())-1]+=1
    except: break
[print(i+1) for i in range(100) if a[i]==max(a)]

Solution (Python):
import sys
cnt = [0]*101
while True:
  try:
    cnt[int(input())] +=1
  except EOFError:
    break
m = max(cnt)

for i in range(101):
  if cnt[i] == m:
    print(i)

Solution (Python):
import sys
cnt = [0] * 101
while True:
    try:
        cnt[int(input())] += 1
    except EOFError:
        break
max = max(cnt)
for i in range(101):
    if cnt[i] == max:
        print(i)

Solution (Python):
A=[]
B=[]
C=[]
while True:
  try:
    A.append(int(input()))
  except EOFError:
    break
    
for i in range(len(A)):
  count=0
  for j in range(len(A)):
    if A[i]==A[j]:
      count+=1
  B.append(count)
maxb=max(B)
for i in range(len(A)):
  if B[i]==maxb:
    if A[i] in C:
      pass
    else:
      C.append(A[i])
C.sort()
for i in range(len(C)):
  print(C[i])

Solution (Python):






import sys
import math


class mymath:
    
    pi = 3.14159265358979323846264338

    
    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

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

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

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


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

output = output()






















def get_input():
    N = []
    while True:
        try:
            
            N.append(int(input()))
        except EOFError:
            break
    return N

A = get_input()

N = []
maxnum = -1

for i in A:
    count = 0
    for j in A:
        if i == j:
            count += 1
    if maxnum < count:
        maxnum = count
        N = [i]
    elif maxnum == count:
        N.append(i)

N = set(N)
N = sorted(N)

for i in N:
    print(i)

Solution (Python):
if __name__ == '__main__':

	ans = dict()
	while True:
		try:
			n = int(input())

			if n not in ans:
				ans[n] = 1
			else:
				ans[n] += 1

		except EOFError:
			break


	a = max(ans.values())

	A = []
	for d in ans:
		if ans[d] == a:
			A.append(d)

	B = sorted(A)
	for i in B:
		print(i)

Solution (Python):
a = [0 for i in range(101)]
while True:
  try:
    n = int(input())
    a[n] += 1
  except EOFError:
    break

m = 0
for i in range(1, 101):
  m = max(m, a[i])
for i in range(1, 101):
  if a[i] == m:
    print(i)

Solution (Python):
data = [0 for _ in range(100)]

while True:
  try:
    input_data = int(input())
  except EOFError:
    break
  data[input_data-1] += 1

max_piv = max(data)
for i in range(100):
  if data[i] == max_piv:
    print(i+1)

Solution (Python):
import sys

counter = []
for i in range(0, 101):
	counter.append(0)

for line in sys.stdin:
	counter[int(line)] += 1

max = 0
for i in range(0, 101):
	if max < counter[i]: max = counter[i]
for i in range(0, 101):
	if max == counter[i]: print i

Solution (Python):

a = [0] * 100
while True:
    try:
        a[int(input()) - 1] += 1
    except:
        break

flag = False
for i in range(100)[::-1]:
    if flag:
        exit()
    for j in range(100):
        if a[j] == i:
            flag = True
            print(j + 1)

Solution (Python):
import sys
  
freq = {}

for s in sys.stdin:
    n = int(s.strip())
    if n not in freq:
        freq[n] = 1
    else:
        freq[n] += 1

sortedfreq = sorted(freq.items(), key=lambda x:-x[1])
modes = sorted(filter(lambda x: x[1] == sortedfreq[0][1], sortedfreq), key=lambda x:x[0])
for i in modes:
    print(i[0])

Solution (Python):
n=[0]*101
while 1:
    try:n[int(input())]+=1
    except:break
m_n=max(n)
for i in range(n.count(m_n)):
    print(n.index(m_n)+i)
    n.remove(m_n)

Solution (Python):
mode = []
count = [0 for i in range(100)]
while(1):
	try:
		n = int(input())
		count[n-1] = count[n-1] + 1
	except EOFError:
		max_ = max(count)
		for i in range(100):
			if count[i] == max_:
				mode.append(i+1)
		for i in mode:
			print(i)
		break

Solution (Python):
count_map = {}
while True:
    try:
        i = int(input())
        if i in count_map:
            count_map[i] += 1
        else:
            count_map[i] = 1
    except EOFError:
        break
max_count = max(count_map.values())
mode_values = []
for item in count_map.items():
    if item[1] == max_count:
        mode_values.append(item[0])
for mode in sorted(mode_values):
    print(mode)

Solution (Python):
import collections

alist = []

while(1):
    try:
        a = int(input())
    except:
        break
    alist.append(a)

ac = collections.Counter(alist)

cnt = 0
while(1):
    print(ac.most_common()[cnt][0])
    if cnt == len(alist):
        break

    if ac.most_common()[cnt][1] == ac.most_common()[cnt+1][1]:
        cnt += 1
    else:
        break

Solution (Python):
import sys
 
count = [0 for _ in range(101)]
mode = 0
 
for s in sys.stdin:
    x = int(s)
    count[x] += 1
    mode = max(mode, count[x])
 
for i in range(101):
    if count[i] == mode:
        print(i)

Solution (Python):
import sys
i_f = {}
for line in sys.stdin:
  v = int(line)
  if i_f.get(v) is None:
    i_f[v] = 0
  i_f[v] += 1

ans = {}
for i, f in i_f.items():
  if ans.get(f) is None:
    ans[f] = []
  ans[f].append(i)
ans = [ (a,vs) for a, vs in ans.items() ]
ans = max(ans, key=lambda x:x[0])


for i in sorted(ans[1]):
  print(i)

Solution (Python):
from collections import Counter
a = []
while(True):
    try:
        a.append(int(input()))
    except:
        c = Counter(a)
        d = c.most_common()
        print("\n".join(str(e[0]) for e in d if e[1] == d[0][1]))
        break

Solution (Python):
import sys

def solve():
    A = [0 for _ in range(101)]
    for i in sys.stdin:
        a = int(i)
        A[a] += 1
    
    M = max(A)
    for i, a in enumerate(A):
        if a == M:
            print(i)

if __name__ == "__main__":
    solve()