Language: C++

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

double PI=3.141592653589793;

complex <double> dftn[2100007];
complex <double> dfts[2100007];

complex <double> a1[2100007];
complex <double> b1[2100007];
complex <double> a2[2100007];
complex <double> b2[2100007];

double cosi[2100007];
complex <double> omega[2100007];

inline int potenga(int v)
{
    for (int i=1; 1; i<<=1)
    {
        if (i>=v)
        {
            return i;
        }
    }
}

inline void dft(int n, int kier)
{
    int n2=n-1;
    int s=0;
    int p;
    int g;

    for (int i=2; i<=n; i<<=1)
    {

        for (int j=0; j<n; j++)
        {
            dfts[j]=dftn[j];
            dftn[j]=0;
        }

        p=n/i;

        if (kier)
        {
            g=0;
            for (int j=0; j<n; j++)
            {
                dftn[j]=dfts[(2*(j-s)+s)&n2]+omega[g]*dfts[(2*(j-s)+p+s)&n2];
                s++;
                if (s==p)
                {
                    g=j+1;
                    s=0;
                }
            }
        }
        else
        {
            g=n;
            for (int j=0; j<n; j++)
            {
                dftn[j]=dfts[(2*(j-s)+s)&n2]+omega[g]*dfts[(2*(j-s)+p+s)&n2];
                s++;
                if (s==p)
                {
                    g=n-j-1;
                    s=0;
                }
            }
        }
    }
}

void licz_omegi(int n1)
{
    double kat=2.0*PI/n1;
    int n2=n1-1;
    int dod=3*n1/4;

    for (int i=0; i<=n1; i++)
    cosi[i]=cos(kat*i);
    for (int i=0; i<=n1; i++)
    omega[i]=complex <double> (cosi[i], cosi[(i+dod)&n2]);
}

vector <long long> fft_dokladne(vector <long long> &jed, vector <long long> &dwa)
{
    int n1=potenga(jed.size()+dwa.size());

    licz_omegi(n1);

    long long M=32000;

    for (int i=0; i<jed.size(); i++)
    dftn[i]=jed[i]/M;
    for (int i=jed.size(); i<n1; i++)
    dftn[i]=0;
    dft(n1, 1);
    for (int i=0; i<n1; i++)
    a1[i]=dftn[i];

    for (int i=0; i<jed.size(); i++)
    dftn[i]=jed[i]%M;
    for (int i=jed.size(); i<n1; i++)
    dftn[i]=0;
    dft(n1, 1);
    for (int i=0; i<n1; i++)
    b1[i]=dftn[i];

    for (int i=0; i<dwa.size(); i++)
    dftn[i]=dwa[i]/M;
    for (int i=dwa.size(); i<n1; i++)
    dftn[i]=0;
    dft(n1, 1);
    for (int i=0; i<n1; i++)
    a2[i]=dftn[i];

    for (int i=0; i<dwa.size(); i++)
    dftn[i]=dwa[i]%M;
    for (int i=dwa.size(); i<n1; i++)
    dftn[i]=0;
    dft(n1, 1);
    for (int i=0; i<n1; i++)
    b2[i]=dftn[i];

    vector <long long> ret;
    for (int i=0; i<n1; i++)
    ret.push_back(0);

    for (int i=0; i<n1; i++)
    dftn[i]=a1[i]*a2[i];
    dft(n1, 0);
    for (int i=0; i<n1; i++)
    ret[i]+=(llround(dftn[i].real()/n1)%mod)*((M*M)%1000000007);

    for (int i=0; i<n1; i++)
    dftn[i]=a1[i]*b2[i]+b1[i]*a2[i];
    dft(n1, 0);
    for (int i=0; i<n1; i++)
    ret[i]+=(llround(dftn[i].real()/n1)%mod)*M;

    for (int i=0; i<n1; i++)
    dftn[i]=b1[i]*b2[i];
    dft(n1, 0);
    for (int i=0; i<n1; i++)
    ret[i]+=llround(dftn[i].real()/n1)%mod;

    for (int i=0; i<ret.size(); i++)
        ret[i]%=1000000007;

    return ret;
}

int n, m, k;

int s;

long long mod=1000000007;

long long sil[1000007];
long long odw[1000007];
long long do3[1000007];

vector <long long> d1, d2, d3;

long long wyn;

long long dziel(long long a, long long b)
{
    long long wyk=mod-2;
    while(wyk)
    {
        if (wyk&1)
        {
            a*=b;
            a%=mod;
        }
        b*=b;
        b%=mod;
        wyk>>=1;
    }
    return a;
}

long long komb(int a, int b)
{
    if (b<0 || b>a)
        return 0;
    return (sil[a]*((odw[b]*odw[a-b])%mod))%mod;
}

long long komz(int a, int b)
{
    return komb(a+b-1, b);
}

int main()
{
    scanf("%d%d%d", &n, &m, &k);
    s=n+m+k;
    sil[0]=1;
    odw[0]=1;
    do3[0]=1;
    for (int i=1; i<=s; i++)
        sil[i]=(sil[i-1]*i)%mod;
    odw[s]=dziel(1, sil[s]);
    for (int i=s-1; i; i--)
        odw[i]=(odw[i+1]*(i+1))%mod;
    for (int i=1; i<=s; i++)
        do3[i]=(do3[i-1]*3)%mod;
    for (int i=0; i<=m; i++)
        d1.push_back((komz(n, i)*odw[n+i-1])%mod);
    for (int i=0; i<=k; i++)
        d2.push_back(odw[i]);
    d3=fft_dokladne(d1, d2);
    for (int i=0; i<=m+k; i++)
        wyn+=(d3[i]*((sil[n+i-1]*do3[m+k-i])%mod))%mod;
    printf("%lld\n", wyn%mod);
    return 0;
}


Compiler output:
a.cc: In function 'std::vector<long long int> fft_dokladne(std::vector<long long int>&, std::vector<long long int>&)':
a.cc:137:41: error: 'mod' was not declared in this scope; did you mean 'modf'?
  137 |     ret[i]+=(llround(dftn[i].real()/n1)%mod)*((M*M)%1000000007);
      |                                         ^~~
      |                                         modf
a.cc:143:41: error: 'mod' was not declared in this scope; did you mean 'modf'?
  143 |     ret[i]+=(llround(dftn[i].real()/n1)%mod)*M;
      |                                         ^~~
      |                                         modf
a.cc:149:40: error: 'mod' was not declared in this scope; did you mean 'modf'?
  149 |     ret[i]+=llround(dftn[i].real()/n1)%mod;
      |                                        ^~~
      |                                        modf