void swap(int &x, int &y) { int tmp = x; x = y; y = tmp; } int numberofprize(int a, int b, int c) { // write code here int res = 0; int minval = min(a, min(b, c)); if (a == minval) { if(b > c)swap(b, c); } else if (b == minval) { if (a > c) { swap(a, c); } swap(a, b); } else { if (a > b) { swap(a, b); } swap(b, c); swap(a, b); } res += a; b = b - a; c = c - a; while (c - 1 > b && b > 0 && c >= 3) { c = c - 3; b = b - 1; res += 1; } while (b >= 2) { b = b - 2; c = c - 2; res += 1; } while (c >= 5) { c = c - 5; res += 1; } return res; }