#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#define PLAYER_A "Algosia\n"
#define PLAYER_B "Bajtek\n"
#define DRAW "remis\n"
int main() {
  std::vector<int> a_scores(18), b_scores(18);
  for (size_t i = 0; i < 18; i++) {
    std::cin >> a_scores[i];
  }
  for (size_t i = 0; i < 18; i++) {
    std::cin >> b_scores[i];
  }
  int a_sum = std::accumulate(a_scores.begin(), a_scores.end(), 0);
  int b_sum = std::accumulate(b_scores.begin(), b_scores.end(), 0);
  if (a_sum > b_sum) {
    std::cout << PLAYER_A;
    return 0;
  }
  if (a_sum < b_sum) {
    std::cout << PLAYER_B;
    return 0;
  }
  std::sort(a_scores.begin(), a_scores.end());
  std::sort(b_scores.begin(), b_scores.end());
  for (int i = 17; i > 0; i--) {
    if (a_scores[i] > b_scores[i]) {
      std::cout << PLAYER_A;
      return 0;
    } else if (b_scores[i] > a_scores[i]) {
      std::cout << PLAYER_B;
      return 0;
    }
  }
  std::cout << DRAW;
  return 0;
}
        1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  | #include <algorithm> #include <iostream> #include <numeric> #include <vector> #define PLAYER_A "Algosia\n" #define PLAYER_B "Bajtek\n" #define DRAW "remis\n" int main() { std::vector<int> a_scores(18), b_scores(18); for (size_t i = 0; i < 18; i++) { std::cin >> a_scores[i]; } for (size_t i = 0; i < 18; i++) { std::cin >> b_scores[i]; } int a_sum = std::accumulate(a_scores.begin(), a_scores.end(), 0); int b_sum = std::accumulate(b_scores.begin(), b_scores.end(), 0); if (a_sum > b_sum) { std::cout << PLAYER_A; return 0; } if (a_sum < b_sum) { std::cout << PLAYER_B; return 0; } std::sort(a_scores.begin(), a_scores.end()); std::sort(b_scores.begin(), b_scores.end()); for (int i = 17; i > 0; i--) { if (a_scores[i] > b_scores[i]) { std::cout << PLAYER_A; return 0; } else if (b_scores[i] > a_scores[i]) { std::cout << PLAYER_B; return 0; } } std::cout << DRAW; return 0; }  | 
            
        
                    English