Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
#include<unordered_map>
#include <numeric>
#include<string_view>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(i) i.begin(),i.end()
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;
void a(){
   ll D,T,S;
   cin >> D >> T >> S;
   if(D<=T*S){
       cout << "Yes" << endl;
   }else{
       cout << "No" << endl;
   }
}

void b(){
   string S,T; cin >> S >> T;
   ll ans = 0;
   for(ll i=0;i<S.size()-T.size()+1;i++){
       ll cnt = 0;
       for(ll j=0;j<T.size();j++){
           if(S[i+j]==T[j])cnt++;
       }
       chmax(ans,cnt);
   }
   cout << T.size()-ans << endl;
}

void c(){
    ll N; cin >> N;
    auto A = v<mint>(N,0);
    rep(i,N) cin >> A[i];
    mint ans=0;
    mint sum = 0;
    rep(i,N) sum+=A[i];
  
    for(ll i = N-1;i>=0;i--){
        ans+=(sum-A[i])*A[i];
    }
    cout << ans/2 << endl;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> rank;

    UnionFind(int N) : par(N),rank(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) {
            par[i] = i;
            rank[i]=0;
        }
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if(rank[rx]<rank[ry]){
            par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける    
        }else{
            par[ry]=rx;
            if(rank[rx]==rank[ry])rank[rx]++;
        }
        
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

class d{
     public:
     d(){
         ll N,M; cin >> N >> M;
         UnionFind tree(N);

         rep(i,M){
             ll A,B; cin >> A >> B;
             tree.unite(A-1,B-1);
         }

         ll ans = 0;
         map<ll,ll> sum;
         rep(i,N) {
             tree.root(i);
             sum[tree.par[i]]++;
         }

         for(auto i:sum){
             chmax(ans,i.second);
         }

         cout << ans << endl;

     }
};

ll gcd(ll a,ll b){
    return (b==0?a:gcd(b,a%b));
}


void e(){
    ll N; cin >> N;
    auto A = v<>(N,0);
    map<ll,ll> M;
    rep(i,N) {
        cin >> A[i];
        M[A[i]]++;
    }

    auto seed = accumulate(all(A),A[0],gcd);

    if(seed>1){
        cout << "not coprime" << endl;
        return;
    }

    rep(i,N){
        ll AA = A[i];
        for(ll j=2;j*j<=AA;j+=(j==2?1:2)){
            ll jj=j;
            while(AA%j==0){
                if(AA/j!=1)  M[AA/j]++;
                if(A[i]!=jj&&AA/j!=jj) M[jj]++;
                jj*=j;
                AA/=j;
            }
        }
    }

    ll ans = 0;
    for(auto i:M){
        chmax(ans,i.second);
    }

    if(ans==1){
        cout << "pairwise coprime" << endl;
    }else{ 
        cout << "setwise coprime" << endl;
    }
    
}

void f(){
    
}

int main(void){
    e();
    return 0;
 }

Compiler output:
a.cc: In function 'void e()':
a.cc:200:27: error: no matching function for call to 'accumulate(std::vector<long long int, std::allocator<long long int> >::iterator, std::vector<long long int, std::allocator<long long int> >::iterator, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, <unresolved overloaded function type>)'
  200 |     auto seed = accumulate(all(A),A[0],gcd);
      |                 ~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 4 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   template argument deduction/substitution failed:
a.cc:200:27: note:   couldn't deduce template parameter '_BinaryOperation'
  200 |     auto seed = accumulate(all(A),A[0],gcd);
      |                 ~~~~~~~~~~^~~~~~~~~~~~~~~~~