Language: C++

atcoder-tools: The pre-rendered templates are not found.#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/segtree>
// using namespace atcoder;

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
template<typename T>
ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
template<typename T>
ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
ll sz(string &s) {return (ll)s.size(); } 
ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }
bool checkindex(ll i,ll n){ return (i < n && i >= 0); }

int main(){
    ll n,x,m;
    cin >> n >> x >> m;
    
    vector<ll> vec;
    vec.push_back(x);
    ll check[m] = {};
    rep(i,0,m) check[i] = -1;
    check[x] = 0;
    ll cnt = 1;
    while(cnt < n){
        ll temp = vec[sz(vec)-1];
        temp *= temp;
        temp %= m;
        if(temp == 0){
            ll ans = 0;
            rep(i,0,sz(vec)){
                ans += vec[i];
            }
            cout << ans << endl;
            return 0;
        }
        else if(check[temp] == -1){
            check[temp] = cnt;
            vec.push_back(temp);
        }
        else{
            ll temp1 = 0,ans = 0;
            rep(i,0,sz(vec)){
                if(i < check[temp]) ans += vec[i];
                else temp1 += vec[i];
            }
            temp1 *= (n-check[temp])/(sz(vec)-check[temp]);
            ans += temp1;
            temp1 = check[temp];

            rep(i,0,(n-check[temp])%(sz(vec)-check[temp])){
                ans += vec[temp1++];
            }
            cout << ans << endl;
            return 0;
        }
        cnt++;
    }
    ll ans = 0;
    rep(i,0,sz(vec)){
        ans += vec[i];
    }
    cout << ans << endl;

    return 0;
}



Compiler output:
a.cc:1:57: error: stray '#' in program
    1 | atcoder-tools: The pre-rendered templates are not found.#include <bits/stdc++.h>
      |                                                         ^
a.cc:1:1: error: 'atcoder' does not name a type
    1 | atcoder-tools: The pre-rendered templates are not found.#include <bits/stdc++.h>
      | ^~~~~~~
a.cc:7:9: error: 'pair' does not name a type
    7 | typedef pair<ll,ll> P;
      |         ^~~~
a.cc:8:9: error: 'pair' does not name a type
    8 | typedef pair<P,ll> PLL;
      |         ^~~~
a.cc:9:9: error: 'pair' does not name a type
    9 | typedef pair<P,P> PP;
      |         ^~~~
a.cc:10:9: error: 'vector' does not name a type
   10 | typedef vector<ll> llVEC;
      |         ^~~~~~
a.cc:11:9: error: 'vector' does not name a type
   11 | typedef vector<P> PVEC;
      |         ^~~~~~
a.cc:12:9: error: 'priority_queue' does not name a type
   12 | typedef priority_queue<P,PVEC,greater<P> > PPQ;
      |         ^~~~~~~~~~~~~~
a.cc:13:9: error: 'priority_queue' does not name a type
   13 | typedef priority_queue<ll, llVEC, greater<ll> > llPQ;
      |         ^~~~~~~~~~~~~~
a.cc:23:7: error: 'vector' was not declared in this scope
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |       ^~~~~~
a.cc:23:15: error: expected primary-expression before '>' token
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |               ^
a.cc:23:18: error: 'vec' was not declared in this scope
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |                  ^~~
a.cc:23:22: error: expected ';' before '{' token
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |                      ^
      |                      ;
a.cc:25:4: error: redefinition of 'template<class T> ll sz'
   25 | ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
      |    ^~
a.cc:23:4: note: 'template<class T> ll sz<T>' previously declared here
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |    ^~
a.cc:25:7: error: 'priority_queue' was not declared in this scope
   25 | ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
      |       ^~~~~~~~~~~~~~
a.cc:25:23: error: expected primary-expression before ',' token
   25 | ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
      |                       ^
a.cc:25:25: error: 'vector' was not declared in this scope
   25 | ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
      |                         ^~~~~~
a.cc:25:33: error: expected primary-expression before '>>' token
   25 | ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
      |                                 ^~
a.cc:25:37: error: 'pq' was not declared in this scope
   25 | ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
      |                                     ^~
a.cc:27:4: error: redefinition of 'template<class T> ll sz'
   27 | ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
      |    ^~
a.cc:23:4: note: 'template<class T> ll sz<T>' previously declared here
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |    ^~
a.cc:27:7: error: 'priority_queue' was not declared in this scope
   27 | ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
      |       ^~~~~~~~~~~~~~
a.cc:27:23: error: expected primary-expression before ',' token
   27 | ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
      |                       ^
a.cc:27:25: error: 'vector' was not declared in this scope
   27 | ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
      |                         ^~~~~~
a.cc:27:33: error: expected primary-expression before '>' token
   27 | ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
      |                                 ^
a.cc:27:34: error: expected primary-expression before ',' token
   27 | ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
      |                                  ^
a.cc:27:36: error: 'greater' was not declared in this scope
   27 | ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
      |                                    ^~~~~~~
a.cc:27:45: error: expected primary-expression before '>>' token
   27 | ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
      |                                             ^~
a.cc:27:49: error: 'pq' was not declared in this scope
   27 | ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
      |                                                 ^~
a.cc:28:7: error: 'll sz' redeclared as different kind of entity
   28 | ll sz(string &s) {return (ll)s.size(); }
      |       ^~~~~~
a.cc:23:4: note: previous declaration 'template<class T> ll sz<T>'
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |    ^~
a.cc:28:7: error: 'string' was not declared in this scope
   28 | ll sz(string &s) {return (ll)s.size(); }
      |       ^~~~~~
a.cc:28:15: error: 's' was not declared in this scope; did you mean 'sz'?
   28 | ll sz(string &s) {return (ll)s.size(); }
      |               ^
      |               sz
a.cc: In function 'int main()':
a.cc:35:5: error: 'cin' was not declared in this scope
   35 |     cin >> n >> x >> m;
      |     ^~~
a.cc:37:5: error: 'vector' was not declared in this scope
   37 |     vector<ll> vec;
      |     ^~~~~~
a.cc:37:14: error: expected primary-expression before '>' token
   37 |     vector<ll> vec;
      |              ^
a.cc:37:16: error: 'vec' was not declared in this scope
   37 |     vector<ll> vec;
      |                ^~~
a.cc:44:25: error: missing template arguments before '(' token
   44 |         ll temp = vec[sz(vec)-1];
      |                         ^
a.cc:49:23: error: missing template arguments before '(' token
   49 |             rep(i,0,sz(vec)){
      |                       ^
a.cc:15:37: note: in definition of macro 'rep'
   15 | #define rep(i,a,n) for(ll i = a;i < n;i++)
      |                                     ^
a.cc:52:13: error: 'cout' was not declared in this scope
   52 |             cout << ans << endl;
      |             ^~~~
a.cc:52:28: error: 'endl' was not declared in this scope
   52 |             cout << ans << endl;
      |                            ^~~~
a.cc:61:23: error: missing template arguments before '(' token
   61 |             rep(i,0,sz(vec)){
      |                       ^
a.cc:15:37: note: in definition of macro 'rep'
   15 | #define rep(i,a,n) for(ll i = a;i < n;i++)
      |                                     ^
a.cc:65:41: error: missing template arguments before '(' token
   65 |             temp1 *= (n-check[temp])/(sz(vec)-check[temp]);
      |                                         ^
a.cc:69:40: error: missing template arguments before '(' token
   69 |             rep(i,0,(n-check[temp])%(sz(vec)-check[temp])){
      |                                        ^
a.cc:15:37: note: in definition of macro 'rep'
   15 | #define rep(i,a,n) for(ll i = a;i < n;i++)
      |                                     ^
a.cc:72:13: error: 'cout' was not declared in this scope
   72 |             cout << ans << endl;
      |             ^~~~
a.cc:72:28: error: 'endl' was not declared in this scope
   72 |             cout << ans << endl;
      |                            ^~~~
a.cc:78:15: error: missing template arguments before '(' token
   78 |     rep(i,0,sz(vec)){
      |               ^
a.cc:15:37: note: in definition of macro 'rep'
   15 | #define rep(i,a,n) for(ll i = a;i < n;i++)
      |                                     ^
a.cc:81:5: error: 'cout' was not declared in this scope
   81 |     cout << ans << endl;
      |     ^~~~
a.cc:81:20: error: 'endl' was not declared in this scope
   81 |     cout << ans << endl;
      |                    ^~~~