https://www.acmicpc.net/problem/1267
#include <iostream>
using namespace std;
int main() {
int n,a;
cin>>n;
int sy=0;
int sm=0;
for(int i=0;i<n;i++){
cin>>a;
sy+=(a/30+1)*10;
sm+=(a/60+1)*15;
}
if(sy>sm) printf("M %d\n",sm);
else if(sy<sm) printf("Y %d\n",sy);
else printf("Y M %d\n",sy);
}