Language: C++

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <sstream>
#include <cmath>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cout << __FILE__ << ":" << __LINE__ << endl;
#define INF 1e9

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

int64 gcd(int64 a, int64 b) {
    if (a < b) a, b = b, a;
    if (a % b == 0) return b;
    return gcd(b, a % b);
}

int64 modinv(int64 a, int64 m) {
    int64 b = m, u = 1, v = 0;
    while (b) {
        int64 t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// https://en.wikipedia.org/wiki/Trial_division
#define M map<int64, int64>
M f(int64 n) {
    M m;

    while (n % 2 == 0) {
        m[2]++;
        n = n / 2;
    }

    int64 c = 3;
    while (c * c <= n) {
        if (n % c == 0) {
            n = n / c;
            m[c]++;
        } else {
            c += 2;
        }
    }
    if (n != 1) m[n]++;
    return m;
}

// https://ei1333.github.io/luzhiled/snippets/math/divisor.html
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
    int64 N;
    cin >> N;

    vector<int64> items = divisor(N);

    int64 ans = 0;
    int64 c = 1;
    set<int64> p = {0};
    reps(1, i, 1 << items.size()) {
        // https://qiita.com/keymoon/items/6cf46473b5421bfe1d48#%E5%AE%9F%E8%A3%85
        int code = i ^ (i >> 1);
        int bitpos = 0;
        while (((1 << bitpos) & i) == 0) bitpos++;
        if (((1 << bitpos) & code) != 0) c *= items[bitpos];
        else c = c / items[bitpos];

        int64 a = c - 1;
        if (p.count(a) == 1) continue;
        p.insert(a);

        if (N % a == N / a) ans += a;
    }

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:113:34: error: conversion from 'vector<long int>' to non-scalar type 'vector<long long int>' requested
  113 |     vector<int64> items = divisor(N);
      |                           ~~~~~~~^~~