Given 100 boxes. Each contains arbitrary number of red, blue and green balls, i.e., 100 non-negative integer triples $(r_i,b_i,g_i)$.

Prove it's always possible to find 51 boxes so that the total number of balls of each color in these boxes is no less than the ones from the rest 49 boxes.

For n boxes, replace 51 with $\lfloor(n+3)/2\rfloor$, and prove that is the best lower bound.

This is a generalization of a high-school Olympiad question, which I was told to use pigeonhole principle. Could anyone shed light on how to apply it?

EDITED: Since this is not really related to the pigeon-hole principle, I have edited the title and the tag.

Besides the solution provided by domotorp, darij grinberg pointed to an elementary proof on mathlinks.

Also domotorp has found the origin of the problem (which was sort of buried in the comments).