This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdlib.h>
#include <stdio.h>
#include <map>
using namespace std;
#include "grader.h"
#include "lang.h"
#define SZ 100
int lan;
map<int, int> cnt[60]; int sum[60];
double pow2(double a){return a * a;}
void excerpt(int *E) {
	int i,k,l,v; double u,x=10000;
	map<int, int> now;
	map<int, int>::iterator I;
	for (k=0;k<100;k++) now[E[k]]++;
	for (i=0;i<lan;i++){
		u = 0;
		for (I=now.begin();I!=now.end();I++) if (cnt[i].count(I->first) == 0){
			u += pow2(I->second / 100.);
		}
		for (I=cnt[i].begin();I!=cnt[i].end();I++){
			if (now.count(I->first) == 0) u += pow2(1. * I->second / sum[i]);
			else u += pow2(1. * I->second / sum[i] - now[I->first] / 100.);
		}
		if (x > u){
			x = u;
			v = i;
		}
	}
	if (lan < 56 && x >= 0.03) v = lan;
	l = language(v);
	if (l == lan) lan++;
	sum[l] += 100;
	for (k=0;k<100;k++) cnt[l][E[k]]++;
}
Compilation message (stderr)
lang.cpp: In function 'void excerpt(int*)':
lang.cpp:39:4: warning: 'v' may be used uninitialized in this function [-Wmaybe-uninitialized]
  l = language(v);
  ~~^~~~~~~~~~~~~
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |