Language: C++

#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;

ll modpow(ll x,ll n){
  if(!n)return 1;
  return modpow(x*x%MOD,n/2)*(n%2?x:1)%MOD;
}
namespace FastFourierTransform {
  using real = double;

  struct C {
    real x, y;

    C() : x(0), y(0) {}

    C(real x, real y) : x(x), y(y) {}

    inline C operator+(const C &c) const { return C(x + c.x, y + c.y); }

    inline C operator-(const C &c) const { return C(x - c.x, y - c.y); }

    inline C operator*(const C &c) const { return C(x * c.x - y * c.y, x * c.y + y * c.x); }

    inline C conj() const { return C(x, -y); }
  };

  const real PI = acosl(-1);
  int base = 1;
  vector< C > rts = { {0, 0},
                     {1, 0} };
  vector< int > rev = {0, 1};


  void ensure_base(int nbase) {
    if(nbase <= base) return;
    rev.resize(1 << nbase);
    rts.resize(1 << nbase);
    for(int i = 0; i < (1 << nbase); i++) {
      rev[i] = (rev[i >> 1] >> 1) + ((i & 1) << (nbase - 1));
    }
    while(base < nbase) {
      real angle = PI * 2.0 / (1 << (base + 1));
      for(int i = 1 << (base - 1); i < (1 << base); i++) {
        rts[i << 1] = rts[i];
        real angle_i = angle * (2 * i + 1 - (1 << base));
        rts[(i << 1) + 1] = C(cos(angle_i), sin(angle_i));
      }
      ++base;
    }
  }

  void fft(vector< C > &a, int n) {
    assert((n & (n - 1)) == 0);
    int zeros = __builtin_ctz(n);
    ensure_base(zeros);
    int shift = base - zeros;
    for(int i = 0; i < n; i++) {
      if(i < (rev[i] >> shift)) {
        swap(a[i], a[rev[i] >> shift]);
      }
    }
    for(int k = 1; k < n; k <<= 1) {
      for(int i = 0; i < n; i += 2 * k) {
        for(int j = 0; j < k; j++) {
          C z = a[i + j + k] * rts[j + k];
          a[i + j + k] = a[i + j] - z;
          a[i + j] = a[i + j] + z;
        }
      }
    }
  }

  vector< int64_t > multiply(const vector< int > &a, const vector< int > &b) {
    int need = (int) a.size() + (int) b.size() - 1;
    int nbase = 1;
    while((1 << nbase) < need) nbase++;
    ensure_base(nbase);
    int sz = 1 << nbase;
    vector< C > fa(sz);
    for(int i = 0; i < sz; i++) {
      int x = (i < (int) a.size() ? a[i] : 0);
      int y = (i < (int) b.size() ? b[i] : 0);
      fa[i] = C(x, y);
    }
    fft(fa, sz);
    C r(0, -0.25 / (sz >> 1)), s(0, 1), t(0.5, 0);
    for(int i = 0; i <= (sz >> 1); i++) {
      int j = (sz - i) & (sz - 1);
      C z = (fa[j] * fa[j] - (fa[i] * fa[i]).conj()) * r;
      fa[j] = (fa[i] * fa[i] - (fa[j] * fa[j]).conj()) * r;
      fa[i] = z;
    }
    for(int i = 0; i < (sz >> 1); i++) {
      C A0 = (fa[i] + fa[i + (sz >> 1)]) * t;
      C A1 = (fa[i] - fa[i + (sz >> 1)]) * t * rts[(sz >> 1) + i];
      fa[i] = A0 + A1 * s;
    }
    fft(fa, sz >> 1);
    vector< int64_t > ret(need);
    for(int i = 0; i < need; i++) {
      ret[i] = llround(i & 1 ? fa[i >> 1].y : fa[i >> 1].x);
    }
    return ret;
  }
};

main(){
    ll p=in();
    MOD=p;
    vector<ll> v;
    rep(i,p){
      v.pb(in());
    }
    vector<vector<ll>> x;
    x.pb({1});
    rep2(i,0,p-1){
      vector<ll> t;
      t.pb(0);
      rep(j,x[i].size()){
        t[j]+=(x[i][j]);
        t.pb(x[i][j]*(-i));
      }
      x.pb(t);
    }
    vector<vector<ll>> y;
    y.pb({1});
    rep3(i,p-1,0){
      vector<ll> t;
      t.pb(0);
      rep(j,y[p-i-1].size()){
        t[j]+=(y[p-i-1][j]);
        t.pb(y[p-i-1][j]*(-i));
      }
      y.pb(t);
    }
    vector<ll> ans(p);
    rep(i,p){
      if(!v[i])continue;
      vec l=x[i],r=y[p-1-i];
      vector<ll> t=FastFourierTransform::multiply(l, r);
      rep(j,p)t[j]%=p;
      ll temp=0,res=1;
      rep3(j,t.size()-1,0){
        temp=(temp+res*t[j])%p;
        res=(res*i)%p;
      }
      ll rr=modpow(temp,p-2);
      rep(j,p){
        ans[j]=(ans[j]+t[j]*rr%p+p)%p;
      }
    }
    rep3(i,p-1,0)cout<<ans[i]<<" ";
}



Compiler output:
a.cc:152:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  152 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:184:16: error: conversion from 'vector<long long int>' to non-scalar type 'vector<int>' requested
  184 |       vec l=x[i],r=y[p-1-i];
      |                ^
a.cc:184:27: error: conversion from 'vector<long long int>' to non-scalar type 'vector<int>' requested
  184 |       vec l=x[i],r=y[p-1-i];
      |                           ^
a.cc:185:50: error: conversion from 'vector<long int>' to non-scalar type 'vector<long long int>' requested
  185 |       vector<ll> t=FastFourierTransform::multiply(l, r);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~