Cod sursa(job #878575)
#include <fstream>
#include <vector>
#include <algorithm>
#include <map>
#include <iostream>
using std::vector;
using std::map;
int main()
{
std::ifstream in("elmaj.in");
std::ofstream out("elmaj.out");
int N;
in >> N;
map<int, int> A;
for (int i = 0; i < N; ++i)
{
int temp;
in >> temp;
std::cout << temp;
A[temp]++;
}
for ( map<int, int>::iterator it = A.begin(); it != A.end(); ++it)
if ( it -> second >= N / 2 + 1 ) out << it -> first << " " << it -> second;
in.close();
out.close();
return 0;
}