Language: C++

#include <iostream>

using namespace std;

int bunkai(int);

bool data[1000000];
int n, m;

main(){

  while(1){
    cin >> n >> m;
    if(n==0 && m==0) break;
    for(int i=0;i<=n;i++) data[i]=false;
    int a=bunkai(n);
    for(int i=0;i<=m;i++) data[i]=false;
    int b=bunkai(m);
    if(a>=b) cout << 'a' << endl;
    else cout << 'b' << endl;
  }
  return 0;
}

int bunkai(int n){
  int num[10000];
  int k=0;
  while(1){
    if(n%2==0){
      n/=2;
      num[k]=2;
      k++;
    }
    else break;
  }
  for(int i=3;;i+=2){
    if(n==1) break;
    while(1){
      if(n%i==0){
	n/=i;
	num[k]=i;
	k++;
      }
      else break;
    }
  }

  sort(num, num+k);

  int sum=0;
  int max=num[k-1];

  for(int i=0;i<k;i++){
    sum+=num[i];
  }

  return max-sum;
}

Compiler output:
a.cc:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:15:27: error: reference to 'data' is ambiguous
   15 |     for(int i=0;i<=n;i++) data[i]=false;
      |                           ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:7:6: note:                 'bool data [1000000]'
    7 | bool data[1000000];
      |      ^~~~
a.cc:17:27: error: reference to 'data' is ambiguous
   17 |     for(int i=0;i<=m;i++) data[i]=false;
      |                           ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:7:6: note:                 'bool data [1000000]'
    7 | bool data[1000000];
      |      ^~~~
a.cc: In function 'int bunkai(int)':
a.cc:48:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   48 |   sort(num, num+k);
      |   ^~~~
      |   short