結果

問題 No.3778 pow2!!pow2!!pow2!!
コンテスト
ユーザー tee_73009
提出日時 2026-10-24 12:59:32
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 493µs
コード長 20,099 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,318 ms
コンパイル使用メモリ 635,996 KB
実行使用メモリ 9,824 KB
最終ジャッジ日時 2026-10-24 13:13:36
合計ジャッジ時間 11,715 ms
ジャッジサーバーID
(参考情報)
judge6_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#line 2 "library/template/template.hpp"
//link: https://tee-73009.github.io/library/
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfenv>
#include <cfloat>
#include <chrono>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <tuple>
#include <type_traits>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <ext/pb_ds/assoc_container.hpp>

#if defined(__x86_64__)
#pragma GCC target("avx2")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

namespace tee {}
using namespace tee;

#line 1 "library/template/macro.hpp"


#line 4 "library/template/macro.hpp"
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using Mint = modint1000000007;
using vm = vector<mint>;
using vvm = vector<vm>;
using vM = vector<Mint>;
using vvM = vector<vM>;
#endif
#if __has_include(<boost/multiprecision/cpp_dec_float.hpp>)
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
#include <boost/array.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が32桁(10進数)の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部が1024桁(10進数)の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
//有理数型
using Rat = boost::rational<Bint>;
#endif
#define OVERLOAD_3(_1, _2, _3, name, ...) name
#define REP1(i, n) for (auto i = std::decay_t<decltype(n)>{}; (i) < (n); ++(i))
#define REP2(i, l, r) for (auto i = (l); (i) != (r); ++(i))
#define rep(...) OVERLOAD_3(__VA_ARGS__, REP2, REP1)(__VA_ARGS__)
#define RREP1(i, n) for (auto i = (n); (i) != (std::decay_t<decltype(n)>{}); --(i))
#define RREP2(i, l, r) for (auto i = (l); (i) != (r); --(i))
#define rrep(...) OVERLOAD_3(__VA_ARGS__, RREP2, RREP1)(__VA_ARGS__)
#define rep_(i,a) rep(i,a.size())
#define all(x) std::begin(x), std::end(x)
#define rall(x) std::rbegin(x), std::rend(x)
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define fin(...) ({print(__VA_ARGS__); return 0; })
#define break_with(...) ({ __VA_ARGS__; break; })
#define continue_with(...) ({ __VA_ARGS__; continue; })
using ll=long long;
using ld=long double;
using ull=unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<long long>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvs = vector<vs>;
using vvc = vector<vc>;
using vvb = vector<vb>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvb = vector<vvb>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using mi = map<int, int>;
using mll = map<ll, ll>;
using msi = map<string, int>;
using msl = map<string, ll>;
using mmi = map<int,mi>;
using mml = map<ll,mll>;
using Graph = vector<vector<ll>>;
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc="abcdefghijklmnopqrstuvwxyz";
template<class T> using pq = priority_queue<T>;
template<class T> using pqr = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define lb(v, k) (lower_bound((v).begin(), (v).end(), (k)) - (v).begin())
#define ub(v, k) (upper_bound((v).begin(), (v).end(), (k)) - (v).begin())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fix(n) fixed << setprecision(n)
#define _print(n) cout << " " << (n) << endl
#define print_(n) cout << (n) << " "
#define ioinit ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);cout<<fix(15);cerr<<fix(15)
inline void incheck() {
    if (!isatty(0)) {
        if ((cin >> ws).peek() != EOF) {
            throw runtime_error("Input not finished!");
        }
    }
}
template<class... T>
constexpr auto min(T... a){
    return min(initializer_list<common_type_t<T...>>{a...});
}
template<class... T>
constexpr auto max(T... a){
    return max(initializer_list<common_type_t<T...>>{a...});
}
template <typename T>
inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template <typename T>
inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
template <class T>
ll sum(const T &a) { return accumulate(all(a), 0LL); }
constexpr ll mod=998244353;
constexpr ll MOD=1000000007;
constexpr ld PI=3.141592653589793;
const vll dx4={0,-1,0,1};
const vll dy4={1,0,-1,0};
const vll dx8={1,0,-1,0,1,-1,1,-1};
const vll dy8={0,1,0,-1,1,-1,-1,1};
const vll dx6={1,0,-1,0,1,-1};
const vll dy6={0,1,0,-1,1,-1};
constexpr int inf = INT_MAX / 2;
constexpr ll INF= 1LL << 60;
template<typename F>
struct REC{
    private:
    F f;
    public:
    explicit constexpr REC(F&&f_):f(std::forward<F>(f_)){}
    template<typename... Args>
    constexpr auto operator()(Args&&...args)const{
        return f(*this, std::forward<Args>(args)...);
    }
};

#line 1 "library/template/inout.hpp"


#line 4 "library/template/inout.hpp"

namespace std {
//pair_out
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << p.first << " " << p.second;
    return os;
}
//pair_in
template <typename T, typename U>
istream &operator>>(istream &is, pair<T, U> &p) {
    is >> p.first >> p.second;
    return is;
}
//vector_out
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    int s = (int)v.size();
    for (int i = 0; i < s; i++) os << (i ? " " : "") << v[i];
    return os;
}
//vector_in
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (auto &x : v) is >> x;
    return is;
}
//__int128_t_in
istream &operator>>(istream &is, __int128_t &x) {
    string S;
    is >> S;
    x = 0;
    int flag = 0;
    for (auto &c : S) {
        if (c == '-') {
            flag = true;
            continue;
        }
        x *= 10;
        x += c - '0';
    }
    if (flag) x = -x;
    return is;
}
//__uint128_t_in
istream &operator>>(istream &is, __uint128_t &x) {
    string S;
    is >> S;
    x = 0;
    for (auto &c : S) {
        x *= 10;
        x += c - '0';
    }
    return is;
}
//__int128_t_out
ostream &operator<<(ostream &os, __int128_t x) {
    if (x == 0) return os << 0;
    if (x < 0) os << '-', x = -x;
    string S;
    while (x) S.push_back('0' + x % 10), x /= 10;
    reverse(begin(S), end(S));
    return os << S;
}
//__uint128_t_out
ostream &operator<<(ostream &os, __uint128_t x) {
    if (x == 0) return os << 0;
    string S;
    while (x) S.push_back('0' + x % 10), x /= 10;
    reverse(begin(S), end(S));
    return os << S;
}
//vector<vector>_out
template <typename T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v)
{
    for (int i = 0; i < (int)v.size(); i++)
    {
        if (i > 0) os << endl;
        os << v[i];
    }
    return os;
}
//vector<vector<vector>>_out
template <typename T>
ostream &operator<<(ostream &os, const vector<vector<vector<T>>> &v)
{
    for (int i = 0; i < (int)v.size(); i++)
    {
        os << "i = " << i << endl;
        os << v[i];
    }
    return os;
}
//map_out
template <typename T, typename S>
ostream &operator<<(ostream &os, const map<T, S> &m)
{
    for (auto &[key, val] : m)
    {
        os << key << ":" << val << " ";
    }
    return os;
}
//set_out
template <typename T>
ostream &operator<<(ostream &os, const set<T> &st)
{
    auto itr = st.begin();
    for (int i = 0; i < (int)st.size(); i++)
    {
        os << *itr << (i + 1 != (int)st.size() ? " " : "");
        itr++;
    }
    return os;
}
//multiset_out
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &st)
{
    auto itr = st.begin();
    for (int i = 0; i < (int)st.size(); i++)
    {
        os << *itr << (i + 1 != (int)st.size() ? " " : "");
        itr++;
    }
    return os;
}
//queue_out
template <typename T>
ostream &operator<<(ostream &os, queue<T> q)
{
    while (q.size())
    {
        os << q.front() << " ";
        q.pop();
    }
    return os;
}
//deque_out
template <typename T>
ostream &operator<<(ostream &os, deque<T> q)
{
    while (q.size())
    {
        os << q.front() << " ";
        q.pop_front();
    }
    return os;
}
//stack_out
template <typename T>
ostream &operator<<(ostream &os, stack<T> st)
{
    while (st.size())
    {
        os << st.top() << " ";
        st.pop();
    }
    return os;
}
//priority_queue_out
template <class T, class Container, class Compare>
ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq)
{
    while (pq.size())
    {
        os << pq.top() << " ";
        pq.pop();
    }
    return os;
}
#if __has_include(<atcoder/all>)
//998244353_in
istream &operator>>(istream &a, mint &b){
    long long tmp;
    a >> tmp;
    b = tmp;
    return a;
}
//998244353_out
ostream &operator<<(ostream &a, const mint &b){
    a << b.val();
    return a;
}
//1000000007_in
istream &operator>>(istream &a, Mint &b){
    long long tmp;
    a >> tmp;
    b = tmp;
    return a;
}
//1000000007_out
ostream &operator<<(ostream &a, const Mint &b){
    a << b.val();
    return a;
}
#endif
#if __has_include(<boost/multiprecision/cpp_dec_float.hpp>)
//Bint_in
istream &operator>>(istream &a, Bint &b){
    long long tmp;
    a >> tmp;
    b = tmp;
    return a;
}
//Real32_in
istream &operator>>(istream &a, Real32 &b){
    long double tmp;
    a >> tmp;
    b = tmp;
    return a;
}
//Real1024_in
istream &operator>>(istream &a, Real1024 &b){
    long double tmp;
    a >> tmp;
    b = tmp;
    return a;
}
#endif
#define ini(...) int __VA_ARGS__; input(__VA_ARGS__);
#define inl(...) long long __VA_ARGS__; input(__VA_ARGS__);
#define ins(...) string __VA_ARGS__; input(__VA_ARGS__);
#define inc(...) char __VA_ARGS__; input(__VA_ARGS__);
#define ing(name,size,n) Graph name(size); rep(i,n){inl(a,b);a--;b--;name[a].pb(b);name[b].pb(a);}
#define ing_on(name,size,n) Graph name(size); rep(i,n){inl(a,b);a--;b--;name[a].pb(b);}//有向
#define ing_cost(name,size,n) Graph_cost name(size); rep(i,n){inl(a,b,c);a--;b--;name[a].pb({b,c});name[b].pb({a,c});}//コスト付き
#define in1(s) for (int i = 0; i < (int)s.size();i++) input(s[i]);
#define in2(s, t) for (int i = 0; i < (int)s.size(); i++) input(s[i], t[i]);
#define in3(s, t, u) for (int i = 0; i < (int)s.size(); i++) input(s[i], t[i], u[i]);
#define in4(s, t, u, v) for (int i = 0; i < (int)s.size(); i++) input(s[i], t[i], u[i], v[i]);

inline void input() {}
template <typename T, class... U>
inline void input(T &t, U &...u) {
    cin >> t;
    std::input(u...);
}
inline void print() { cout << "\n"; }
template <typename T, class... U, char sep = ' '>
inline void print(const T &t, const U &...u) {
    cout << t;
    if (sizeof...(u)) cout << sep;
    std::print(u...);
}
} // namespace std

namespace tee {
inline void debug_out() { cerr << "\n"; }
template <typename T, class... U>
void debug_out(const T &t, const U &...u) {
    cerr << t;
    if (sizeof...(u)) cerr << ", ";
    debug_out(u...);
}
#define debug(...) cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: ", tee::debug_out(__VA_ARGS__)
}  // namespace tee

namespace fastio {

// 型判定用ヘルパー
template <typename T> struct is_vector : std::false_type {};
template <typename T, typename Alloc> struct is_vector<std::vector<T, Alloc>> : std::true_type {};

template <typename T> struct is_pair : std::false_type {};
template <typename T, typename U> struct is_pair<std::pair<T, U>> : std::true_type {};

// modint 型判定用ヘルパー (.val() メソッドを持つか判定)
template <typename T, typename = void>
struct is_modint : std::false_type {};

template <typename T>
struct is_modint<T, std::void_t<decltype(std::declval<T>().val())>> : std::true_type {};

template <typename T>
struct is_fastio_primitive : std::disjunction<
    std::is_same<T, char>,
    std::is_same<T, std::string>,
    std::is_integral<T>,
    std::is_same<T, __int128_t>,
    std::is_same<T, __uint128_t>
> {};

// 基本型の入力関数
template <class T>
inline T in() {
    if constexpr (std::is_same_v<T, char>) {
        return getchar_unlocked();
    } else if constexpr (std::is_same_v<T, std::string>) {
        char c; do { c = getchar_unlocked(); } while (isspace(c));
        std::string s;
        do { s.push_back(c); } while (not isspace(c = getchar_unlocked()));
        return s;
    } else if constexpr ((std::is_integral_v<T> and not std::is_same_v<T, char>) or std::is_same_v<T, __int128_t> or std::is_same_v<T, __uint128_t>) {
        char c; do { c = getchar_unlocked(); } while (isspace(c));
        bool minus = false;
        if constexpr (std::is_signed_v<T> or std::is_same_v<T, __int128_t>) {
            if (c == '-') {
                minus = true;
                c = getchar_unlocked();
            }
        }
        using UnsignedInteger = std::conditional_t<
            std::is_same_v<T, __int128_t> or std::is_same_v<T, __uint128_t>,
            __uint128_t,
            std::make_unsigned_t<std::conditional_t<
                std::is_same_v<T, __int128_t> or std::is_same_v<T, __uint128_t>,
                unsigned int,
                T
            >>
        >;
        UnsignedInteger n = 0;
        do { n = n * 10 + (c - '0'); } while (not isspace(c = getchar_unlocked()));
        return minus ? -static_cast<T>(n) : static_cast<T>(n);
    }
}

// 基本型の出力関数 (char 型を数値出力テンプレートから厳密に排除)
inline void out(char c) { putchar_unlocked(c); }
inline void out(const std::string &s) { for (char c : s) putchar_unlocked(c); }
inline void out(const char *s) { while (*s) putchar_unlocked(*s++); }

template <class Integer, std::enable_if_t<
    ((std::is_integral_v<Integer> and not std::is_same_v<Integer, char>) or 
     std::is_same_v<Integer, __int128_t> or 
     std::is_same_v<Integer, __uint128_t>), int> = 0>
inline void out(Integer n) {
    char s[45];
    int i = 0;
    using UnsignedInteger = std::conditional_t<
        std::is_same_v<Integer, __int128_t> or std::is_same_v<Integer, __uint128_t>,
        __uint128_t,
        std::make_unsigned_t<std::conditional_t<
            std::is_same_v<Integer, __int128_t> or std::is_same_v<Integer, __uint128_t>,
            unsigned int,
            Integer
        >>
    >;
    UnsignedInteger u;
    if constexpr (std::is_signed_v<Integer> or std::is_same_v<Integer, __int128_t>) {
        if (n < 0) {
            putchar_unlocked('-');
            u = -static_cast<UnsignedInteger>(n);
        } else {
            u = static_cast<UnsignedInteger>(n);
        }
    } else {
        u = n;
    }
    do { s[i++] = u % 10; u /= 10; } while (u);
    while (i) putchar_unlocked(s[--i] + '0');
}

// 再帰的・汎用的な入力処理
template <typename T>
inline void read_single(T &t) {
    if constexpr (is_fastio_primitive<T>::value) {
        t = in<T>();
    } else if constexpr (is_modint<T>::value) {
        long long tmp = in<long long>();
        t = tmp;
    } else if constexpr (is_vector<T>::value) {
        for (auto &x : t) read_single(x);
    } else if constexpr (is_pair<T>::value) {
        read_single(t.first);
        read_single(t.second);
    } else {
        std::cin >> t;
    }
}

inline void input() {}
template <typename T, class... U>
inline void input(T &t, U &...u) {
    read_single(t);
    fastio::input(u...);
}

// 再帰的・汎用的な出力処理
template <typename T>
inline void write_single(const T &t) {
    if constexpr (is_fastio_primitive<T>::value) {
        out(t);
    } else if constexpr (is_modint<T>::value) {
        out(t.val());
    } else if constexpr (is_vector<T>::value) {
        using ElementType = typename T::value_type;
        if constexpr (is_vector<ElementType>::value) {
            for (size_t i = 0; i < t.size(); ++i) {
                if (i > 0) putchar_unlocked('\n');
                write_single(t[i]);
            }
        } else {
            for (size_t i = 0; i < t.size(); ++i) {
                if (i > 0) putchar_unlocked(' ');
                write_single(t[i]);
            }
        }
    } else if constexpr (is_pair<T>::value) {
        write_single(t.first);
        putchar_unlocked(' ');
        write_single(t.second);
    } else {
        std::cout << t;
    }
}

inline void print() { putchar_unlocked('\n'); }
template <typename T, class... U, char sep = ' '>
inline void print(const T &t, const U &...u) {
    write_single(t);
    if (sizeof...(u)) putchar_unlocked(sep);
    fastio::print(u...);
}

}  // namespace fastio


#line 1 "library/template/arith_op.hpp"


#line 4 "library/template/arith_op.hpp"
namespace tee {
namespace detail {
template <class T> struct is_pair_or_vector : false_type {};
template <class T, class U> struct is_pair_or_vector<pair<T, U>> : true_type {};
template <class T, class A> struct is_pair_or_vector<vector<T, A>> : true_type {};
template <class V> using scalar_t = enable_if_t<!is_pair_or_vector<V>::value, int>;
}
}
namespace std {
template <class T, class U>
pair<T, U> &operator+=(pair<T, U> &a, const pair<T, U> &b) {
    a.first += b.first, a.second += b.second;
    return a;
}
template <class T, class U>
pair<T, U> &operator-=(pair<T, U> &a, const pair<T, U> &b) {
    a.first -= b.first, a.second -= b.second;
    return a;
}
template <class T, class U>
pair<T, U> operator+(pair<T, U> a, const pair<T, U> &b) { return a += b; }
template <class T, class U>
pair<T, U> operator-(pair<T, U> a, const pair<T, U> &b) { return a -= b; }
template <class T, class U>
pair<T, U> operator-(const pair<T, U> &a) { return {-a.first, -a.second}; }
template <class T, class U, class V, tee::detail::scalar_t<V> = 0>
pair<T, U> operator*(const pair<T, U> &a, const V &k) { return {a.first * k, a.second * k}; }
template <class T, class U, class V, tee::detail::scalar_t<V> = 0>
pair<T, U> operator*(const V &k, const pair<T, U> &a) { return {k * a.first, k * a.second}; }
template <class T>
vector<T> &operator+=(vector<T> &a, const vector<T> &b) {
    assert(a.size() == b.size());
    for (size_t i = 0; i < a.size(); i++) a[i] += b[i];
    return a;
}
template <class T>
vector<T> &operator-=(vector<T> &a, const vector<T> &b) {
    assert(a.size() == b.size());
    for (size_t i = 0; i < a.size(); i++) a[i] -= b[i];
    return a;
}
template <class T>
vector<T> operator+(vector<T> a, const vector<T> &b) { return a += b; }
template <class T>
vector<T> operator-(vector<T> a, const vector<T> &b) { return a -= b; }
template <class T>
vector<T> operator-(vector<T> a) {
    for (auto &x : a) x = -x;
    return a;
}
template <class T, class V, tee::detail::scalar_t<V> = 0>
vector<T> operator*(vector<T> a, const V &k) {
    for (auto &x : a) x = x * k;
    return a;
}
template <class T, class V, tee::detail::scalar_t<V> = 0>
vector<T> operator*(const V &k, vector<T> a) {
    for (auto &x : a) x = k * x;
    return a;
}
}

#line 2 "main.cpp"
void solve(){
    string s;
    fastio::input(s);
    rep(i,s.size()) fastio::write_single(s);
    fastio::print();
}
signed main(){
    ioinit;
    ll t=1;
    //input(t);
    while(t--) solve();
    incheck;
}
0