alexjercan/bugnet huggingface dataset:
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int n;
  while (cin >> n) {
    if (!n)
      break;
    int count = 0;
    for (int i = 1; i * i < n; i++) {
      if (i == 1)
        count++;
      else if (n % i == 0) {
        count += (i + n / i);
      }
    }
    if (count == n)
      cout << "perfect number" << endl;
    else if (count > n)
      cout << "abundant number" << endl;
    else
      cout << "deficient number" << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n;
  while (cin >> n) {
    if (!n)
      break;
    int count = 0;
    for (int i = 1; i <= n / 2; i++) {
      if (n % i == 0)
        count += i;
    }
    if (count == n)
      cout << "perfect number" << endl;
    else if (count > n)
      cout << "abundant number" << endl;
    else
      cout << "deficient number" << endl;
  }
  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long x, sum = 0;

  while (cin >> x) {
    if (x == 0) {
      break;
    }
    sum = 0;

    double n = pow(x, 1.0 / 2);

    for (int i = 1; i < n; ++i) {
      if (x % i == 0) {
        sum += i;
        if (i != 1) {
          sum += x / i;
        }
      }
      if (i == n - 1) {
        sum += n;
      }
    }

    if (x > sum) {
      cout << "deficient number" << endl;
    } else if (x < sum) {
      cout << "abundant number" << endl;
    } else {
      cout << "perfect number" << endl;
    }
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int x, sum = 0;

  while (cin >> x) {
    sum = 0;
    for (int i = 1; i < x; ++i) {
      if (i != x) {
        if (x % i == 0) {
          sum += i;
        }
      }
    }

    if (x > sum) {
      cout << "deficient number" << endl;
    } else if (x < sum) {
      cout << "abundant number" << endl;
    } else {
      cout << "perfect number" << endl;
    }
  }

  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define range(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, b) range(i, 0, b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main() {
  int n;
  while (cin >> n, n) {
    int sum = 0;
    for (int i = 1; i * i <= n; i++) {
      if (n % i == 0 && i != n) {
        sum += i;
        if (n / i != i && n / i != n)
          sum += n / i;
      }
    }
    if (sum > n) {
      cout << "abundant number" << endl;
    } else if (sum < n) {
      cout << "deficient number" << endl;
    } else {
      cout << "perfect number" << endl;
    }
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define range(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, b) range(i, 0, b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main() {
  int n;
  while (cin >> n, n) {
    int sum = 0;
    range(i, 1, n / 2 + 1) {
      if (n % i == 0) {
        sum += i;
      }
    }
    if (sum > n) {
      cout << "abundant number" << endl;
    } else if (sum < n) {
      cout << "deficient number" << endl;
    } else {
      cout << "perfect number" << endl;
    }
  }
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cmath>
#include <cstdio>
using namespace std;
int main() {
  int n;
  while (scanf("%d", &n) && n) {
    int r = -n, m = sqrt(n);
    for (int i = 1; i <= m; i++)
      if (n % i == 0) {
        r += i + n / i;
        if (i == n / i)
          r -= i;
      }
    printf("%s\\n", n > r   ? "deficient number"
                   : n < r ? "abundant number"
                           : "perfect number");
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n;
  while (cin >> n && n) {
    int r = 0;

    for (int i = 1; i <= n / 2; i++) {
      if (n % i == 0)
        r += i;
    }
    if (n > r)
      cout << "deficient number";
    else if (n < r)
      cout << "abundant number";
    else
      cout << "perfect number";
    cout << endl;
  }
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>

using namespace std;

int main() {
  int n = 0;
  while (cin >> n && n != 0) {
    int sum = 0;
    for (int i = 1; i < n; i++) {
      if (n % i == 0) {
        if (i > n / i)
          break;
        if (i != n / i)
          sum += i + (n / i);
        else
          sum += i;
      }
    }
    sum -= n;
    cout << (sum == n  ? "perfect number"
             : sum > n ? "abundant number"
                       : "deficient number")
         << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>

using namespace std;

int main() {
  int n = 0;
  while (cin >> n && n != 0) {
    int sum = 0;
    for (int i = 1; i < n; i++) {
      if (n % i == 0)
        sum += i;
    }

    cout << (sum == n  ? "perfect number"
             : sum > n ? "abundant number"
                       : "deficient number")
         << endl;
  }
  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#define INF 999999
using namespace std;
int main() {
  int N;
  while (cin >> N, N) {
    if (N == 1) {
      cout << "deficient number" << endl;
      continue;
    }
    int S = 1;
    for (int i = 2; i * i < N; i++) {
      if (N % i == 0) {
        S += i;
        S += N / i;
      }
    }
    if (N > S)
      cout << "deficient number" << endl;
    else if (N < S)
      cout << "abundant number" << endl;
    else
      cout << "perfect number" << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#define INF 999999
using namespace std;
int main() {
  int N;
  while (cin >> N, N) {
    int S = 0;
    for (int i = 1; i < N / 2; i++) {
      if (N % i == 0)
        S += i;
    }
    if (N > S)
      cout << "deficient number" << endl;
    else if (N < S)
      cout << "abundant number" << endl;
    else
      cout << "perfect number" << endl;
  }
  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int isPerfect(int x) {
  int sum = 0;
  for (int i = 1;; i++) {
    if (x % i == 0) {
      int a = x / i;
      if (a == i) {
        if (i != x)
          sum += i;
        break;
      }
      if (a < i)
        break;

      if (a != x)
        sum += a;
      sum += i;
    }
  }
  return x - sum;
}

int main() {
  while (1) {
    int N;
    cin >> N;
    if (N == 0)
      break;

    int ans = isPerfect(N);
    if (ans > 0)
      cout << "deficient number" << endl;
    else if (ans == 0)
      cout << "perfect number" << endl;
    else if (ans < 0)
      cout << "abundant number" << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int isPerfect(int x) {
  int sum = 0;
  for (int i = x / 2; i > 0; i--) {
    if (x % i == 0)
      sum += i;
  }
  return x - sum;
}

int main() {
  while (1) {
    int N;
    cin >> N;
    if (N == 0)
      break;

    int ans = isPerfect(N);
    if (ans > 0)
      cout << "deficient number" << endl;
    else if (ans == 0)
      cout << "perfect number" << endl;
    else if (ans < 0)
      cout << "abundant number" << endl;
  }
  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;

  while (1) {
    int S = 0;
    cin >> N;
    if (N == 0)
      break;
    for (int i = 1; i * i < N; i++) {
      if (N % i == 0) {
        S += i;
        S += N / i;
      }
    }
    if (S - N == N)
      cout << "perfect number" << endl;
    else if (S - N > N)
      cout << "abundant number" << endl;
    else if (S - N < N)
      cout << "deficient number" << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;

  while (1) {
    int S = 0;
    cin >> N;
    if (N == 0)
      break;
    for (int i = 1; i < N; i++) {
      if (N % i == 0) {
        S += i;
      }
    }
    if (S - N == N)
      cout << "perfect number" << endl;
    else if (S - N > N)
      cout << "abundant number" << endl;
    else if (S - N < N)
      cout << "deficient number" << endl;
  }
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>

#define i64 long long
using namespace std;
int main() {
  i64 r, n;
  while (scanf("%lld", &n), n) {
    r = 0LL;
    for (i64 i = 1LL; i * i < n; i++) {
      if (!(n % i)) {
        r += i;
        if (i > 1)
          r += n / i;
      }
    }
    // printf("%d %d\\n",n,r);
    if (r > n) {
      puts("abundant number");
    } else if (r == n && n != 1) {
      puts("perfect number");
    } else {
      puts("deficient number");
    }
  }
}

Error: TLE

Fixed submission:

#include <cstdio>
using namespace std;

int main() {
  int n;
  while (scanf("%d", &n), n) {
    long long p = (long long)n;
    long long r = 0;
    for (int i = 1; i < n / 2 + 1; i++) {
      if (!(n % i))
        r += i;
      if (p < r) {
        puts("abundant number");
        break;
      }
    }
    if (p > r)
      puts("deficient number");
    else if (p == r)
      puts("perfect number");
  }
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <stdio.h>
using namespace std;
int main() {

  int n;
  while (1) {

    scanf("%d", &n);
    if (n == 0)
      break;
    int s = 0;
    int t = 0;
    for (int i = 1; i * i <= n; i++) {
      t = n / i;

      if (n % i == 0) {
        s += i + t;
        if (n == t || t == i)
          s -= t;
      }
      // cout<<t<<endl;
    }
    if (n == 1)
      s = 0;
    // cout<<s<<endl;
    if (s > n)
      printf("abundant number\\n");
    if (s == n)
      printf("perfect number\\n");
    if (s < n)
      printf("deficient number\\n");
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main() {

  int n;
  while (1) {

    scanf("%d", &n);
    if (n == 0)
      break;
    int s = 0;
    for (int i = 1; i < n; i++)
      if (n % i == 0)
        s += i;

    if (s > n)
      printf("abundant number\\n");
    if (s == n)
      printf("perfect number\\n");
    if (s < n)
      printf("abundant number\\n");
  }
  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i, j) for (int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for (int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int MAX_N = 100000001;

int v[MAX_N];

string solve(int N) {
  if (N == 1)
    return "deficient number";
  int S = 1;
  double sq = sqrt(N);
  for (int i = 2; i < sq; i++)
    if (N % i == 0)
      S += i + N / i;
  if (sq == (int)sq)
    S += (int)sq;
  if (N > S)
    return "deficient number";
  else if (N < S)
    return "abundant number";
  return "perfect number";
}

int main() {
  int N;
  while (scanf("%d", &N) && N)
    printf("%s\\n", solve(N).c_str());
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i, j) for (int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for (int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int MAX_N = 100000001;

string solve(int N) {
  int S = 0;
  if (N == 1)
    return "deficient number";
  FOR(i, 1, N / 2 + 1) if (N % i == 0) S += i;
  if (N > S)
    return "deficient number";
  else if (N < S)
    return "abundant number";
  return "perfect number";
}

int main() {
  int N;
  while (cin >> N && N)
    cout << solve(N) << endl;
  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
  int n, sum, cnt;
  while (true) {
    cin >> n;
    if (n == 0)
      return 0;
    sum = cnt = 0;
    for (int i = 1; i <= sqrt(n); i++)
      if (n % i == 0)
        sum += i + n / i;
    if (sqrt(n) == (int)sqrt(n))
      sum -= n + (int)sqrt(n);
    else
      sum -= n;
    if (sum == n)
      puts("perfect number");
    else if (sum < n)
      puts("deficient number");
    else
      puts("abundant number");
  }
}

Error: TLE

Fixed submission:

#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
  int n, sum;
  while (true) {
    cin >> n;
    if (n == 0)
      return 0;
    sum = 0;
    for (int i = 1; i <= n / 2; i++)
      if (n % i == 0)
        sum += i;
    if (sum == n)
      puts("perfect number");
    else if (sum < n)
      puts("deficient number");
    else
      puts("abundant number");
  }
}
Problem p01224 (C++) — buggy submission, verdict: Memory Limit Exceeded

#include <bits/stdc++.h>
#define LL long long
using namespace std;
int main() {
  LL n;
  vector<LL> vc;
  while (cin >> n) {
    LL temp = n, res = 0;
    if (n == 0) {
      return 0;
    }
    for (int i = 1; i * i <= n; i++) {
      if (n % i == 0) {
        if (0 == n % i) {
          res += i;
          if (i != n / i) {
            res += n / i;
          }
        }
      }
    }
    res -= temp;
    cout << (res == temp  ? "perfect number"
             : res < temp ? "deficient number"
                          : "abundant number")
         << endl;
  }
  return 0;
}

Error: MLE

Fixed submission:

#include <bits/stdc++.h>
#define LL long long
using namespace std;
class Multiply {
public:
  LL operator()(const LL sum, const LL value) { return sum * value; }
};
int main() {
  LL n;
  vector<LL> vc;
  while (cin >> n) {
    LL temp = n;
    LL res = 0;
    vc.clear();
    if (n == 0) {
      return 0;
    } // 0??§??????

    for (int i = 2; i <= n; i++) { //?´??????°????§£
      LL x, count = 0;
      while (n % i == 0) {
        n /= i;
        x = i;
        // cout << x << " ";
        count++;
      }
      // cout << count << endl;
      LL j = 0, k = 1, sum = 0;
      while (j < count) { //??????
        k *= x;
        sum += k;
        j++;
      }
      vc.push_back(sum + 1);
      // cout << sum << " ";
    }
    res = accumulate(vc.begin(), vc.end(), 1, Multiply());
    res -= temp;
    cout << (res == temp  ? "perfect number"
             : res < temp ? "deficient number"
                          : "abundant number")
         << endl;
  }
  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1 << 29;
const double EPS = 1e-9;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};

// nt a[100000010]={-1};
int main() {
  int n;
  while (cin >> n, n) {
    int sum = 1;
    if (n == 1) {
      cout << "deficient number" << endl;
      continue;
    }
    for (int i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        if (i * i == n)
          sum += i;
        else
          sum += i + n / i;
      }
    }
    if (sum == n) {
      cout << "perfect number" << endl;
    } else if (sum > n) {
      cout << "abundant number" << endl;
    } else {
      cout << "deficient number" << endl;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1 << 29;
const double EPS = 1e-9;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};

int main() {
  int n;
  while (cin >> n, n) {
    int sum = 1;
    bool flag = true;
    for (int i = 2; i <= n / 2; i++) {
      if (n % i == 0) {
        sum += i;
        if (sum > n) {
          flag = false;
          break;
        }
      }
    }
    if (sum == n) {
      cout << "perfect number" << endl;
    } else if (sum > n) {
      cout << "abundant number" << endl;
    } else {
      cout << "deficient number" << endl;
    }
  }
  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  long int n, sum;
  while (1) {
    cin >> n;
    if (n == 0)
      break;
    sum = 0;
    for (int i = 1; i * i <= n; i++) {
      if (n % i == 0)
        sum += i + (n / i);
      if (i * i == n)
        sum -= i;
    }
    if (sum < n * 2)
      cout << "deficient number\\n";
    else if (sum == n * 2)
      cout << "perfect number\\n";
    else
      cout << "abundant number\\n";
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  long int n, sum;
  while (1) {
    cin >> n;
    long int sta = n;
    if (n == 0)
      break;
    sum = 0;
    if (n != 1) {
      for (int i = 1; i <= n / 2; i++) {
        if (n % i == 0)
          sum += i;
      }
    }
    if (sum > sta)
      cout << "abundant number\\n";
    else if (sum < sta)
      cout << "deficient number\\n";
    else if (sta == sum)
      cout << "perfect number\\n";
  }
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

int main() {
  unsigned long long n, sum;
  while (cin >> n, n) {
    sum = -n;

    for (int i = 1; i * i <= n; i++) {
      // cout << "OK" << endl;
      if (n % i == 0) {
        sum += i + n / i;
        if (i == n / i)
          sum -= i;
      }
    }

    if (sum == n)
      cout << "perfect number" << endl;
    else if (sum < n)
      cout << "deficient number" << endl;
    else if (sum > n)
      cout << "abundant number" << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

int main() {
  unsigned long long n, sum;
  while (cin >> n, n) {
    sum = 0;

    for (unsigned long long i = 1; i <= n / 2; i++) {
      // cout << "OK" << endl;
      if (n % i == 0 && n != 1) {
        sum += i;
      }
    }

    if (sum == n)
      cout << "perfect number" << endl;
    else if (sum < n)
      cout << "deficient number" << endl;
    else if (sum > n)
      cout << "abundant number" << endl;
  }
  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cmath>
#include <iostream>
using namespace std;
int main(void) {
  int n;
  while (cin >> n, n) {
    int s = 0;
    for (int i = 1; i <= (int)sqrt(n) && i != n; ++i) {
      if (n % i == 0) {
        s += (n / i != n) ? n / i : 0;
        s += (n / i != i) ? i : 0;
      }
    }
    if (n > s)
      cout << "deficient number" << endl;
    else if (n == s)
      cout << "perfect number" << endl;
    else if (n < s)
      cout << "abundant number" << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  int n;
  while (cin >> n, n) {
    int s = 0;
    for (int i = 1; i <= n / 2 && i != n; ++i)
      s += (n % i == 0) ? i : 0;
    if (n > s)
      cout << "deficient number" << endl;
    else if (n == s)
      cout << "perfect number" << endl;
    else if (n < s)
      cout << "abundant number" << endl;
  }
  return 0;
}
Problem p01224 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main(void) {

  long long n;

  while (cin >> n, n) {

    if (n == 1) {
      cout << "deficient number" << endl;
      continue;
    }

    long long total = 1;
    long long a = 0;

    for (int i = 2; a != i && i < n / 2; i++) {
      if (n % i == 0) {
        total += i;
        total += (n / i);
        a = n / i;
        if (a == i) {
          total -= i;
          break;
        }
      }
      if (total > n)
        break;
    }
    // cout << "a = " << a << endl;
    // cout << total << "    ";
    if (n == total)
      cout << "perfect number" << endl;
    if (n < total)
      cout << "abundant number" << endl;
    if (n > total)
      cout << "deficient number" << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main(void) {

  long long n;

  while (cin >> n, n) {

    if (n == 1) {
      cout << "deficient number" << endl;
      continue;
    }

    long long total = 1;
    long long a = 0;

    for (int i = 2; a != i && i < n; i++) {
      if (n % i == 0) {
        total += i;
        total += (n / i);
        a = n / i;
        if (a == i) {
          total -= i;
          break;
        }
      }
      if (total > n)
        break;
    }
    // cout << "a = " << a << endl;
    // cout << total << "    ";
    if (n == total)
      cout << "perfect number" << endl;
    if (n < total)
      cout << "abundant number" << endl;
    if (n > total)
      cout << "deficient number" << endl;
  }
  return 0;
}