akhauriyash/Code-Regression huggingface dataset:
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
 */
//入力終了→Ctrl+D
import java.time.Year;
import java.util.*;
import java.awt.*;
import java.awt.Graphics.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int[] a = new int[6];
        int[] b = new int[6];
        for (int i = 0; i < 6; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < 6; i++) {
            b[i] = sc.nextInt();
        }
        String s = "";
        for (int i = 0; i < 4; i++) {
            s += "N";
        }
        for (int i = 0; i < 4; i++) {
            s += "E";
        }
        dice1.init(a);
        dice2.init(b);
        for (int k = 0; k < s.length(); k++) {
            for (int j = 0; j < 4; j++) {
                if (Arrays.equals(dice1.men,dice2.men)) {
                    out.println("Yes");
                    exit(0);
                }
                roll(dice1.men, 'L');
            }
            roll(dice1.men, s.charAt(k));
        }
        out.println("No");
    }
    static class dice1 {
        static int[] men = new int[6];
        static void init(int[] a) {
            men=a.clone();
        }
    }
    static class dice2 {
        static int[] men = new int[6];
        static void init(int[] a) {
            men=a.clone();
        }
    }
    static void roll(int[] men,char c) {
        int t = men[0];
        switch (c) {
            case 'S':
                men[0] = men[4];
                men[4] = men[5];
                men[5] = men[1];
                men[1] = t;
                break;
            case 'E':
                men[0] = men[3];
                men[3] = men[5];
                men[5] = men[2];
                men[2] = t;
                break;
            case 'W':
                men[0] = men[2];
                men[2] = men[5];
                men[5] = men[3];
                men[3] = t;
                break;
            case 'N':
                men[0] = men[1];
                men[1] = men[5];
                men[5] = men[4];
                men[4] = t;
                break;
            case 'L':
                t=men[1];
                men[1]=men[3];
                men[3]=men[4];
                men[4]=men[2];
                men[2]=t;
                break;
            default:
                break;
        }
    }
}


Measured memory_bytes: 26484
using System;

namespace AOJ.Volume1
{
    class AizuPR
    {
        public static void Main()
        {
            int cnt = int.Parse(Console.ReadLine());
            for (int i = 0; i < cnt; i++)
            {
                var input = Console.ReadLine();
                int len = input.Length;
                for (int p = 0; p <= len - 7; p++)
                {
                    if (input.Substring(p, 7) == "Hoshino")
                    {
                        input = input.Remove(p, 7).Insert(p, "Hoshina");
                    }
                }
                Console.WriteLine(input);
            }
        }
    }
}

Measured memory_bytes: 5528
def main():
    from itertools import product

    H, W, K = map(int, input().split())
    G = [input() for _ in range(H)]

    tot = sum(g.count('#') for g in G)

    ans = 0
    for row_select in product([0, 1], repeat=H):
        for col_select in product([0, 1], repeat=W):
            cnt = tot
            for r, ser in enumerate(row_select):
                for c, sec in enumerate(col_select):
                    if (G[r][c] == '#') and (ser or sec):
                        cnt -= 1
            if cnt == K:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18

using namespace std;

int main(void){
  string s;
  cin >> s;
  
  if (
      s == "hi" ||
      s == "hihi" ||
      s == "hihihi" ||
      s == "hihihihi" ||
      s == "hihihihihi" 
     )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
    

  return 0;
}


Measured memory_bytes: 256
s=input();n=len(s)
def f(i,t,k):
 if k>n-i:return 0
 a=max(t,int(s[i]));i+=1;
 return(f(i,9,k)+(a-1)*f(i,9,k-1)+f(i,t,k-1)if k-1 else a+(n-i)*9)if a else f(i,t,k)
print(f(0,0,int(input())))

Measured memory_bytes: 42088
#include<stdio.h>
int main()
{
    int A,B,C,x;
    scanf("%d%d%d",&A,&B,&C);
    x=A+B+C;
    if(x>=22)
    {
        printf("bust\n");
    }
    else
        {
        printf("win\n");
    }

       return 0;
}



Measured memory_bytes: 1620
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;

int main(){
  int n;
  scanf("%d",&n);
  int a[n],cp[n];
  REP(i,n) scanf("%d",&a[i]);
  memcpy(cp, a, sizeof(int)*n);
  sort(cp, cp+n);
  int max1 = cp[n-1];
  int max2 = cp[n-2];
  REP(i,n){    
    if(a[i] < max1)printf("%d\n",max1);
    else printf("%d\n",max2);  
  }
 
}

Measured memory_bytes: 3200
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

diff = []
for height in h:
    temp = t - (height * 0.006)
    diff.append(abs(a - temp))

minimum = min(diff)
ans = diff.index(minimum) + 1

print(ans)


Measured memory_bytes: 9256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
while(true){
   var n=arr.shift()-0;
   if(n==0)break;
   var yx=[];
   for(var i=0;i<n;i++)yx.push(arr.shift().split(" ").map(Number));
   var xy=[];
   var hand=[];
   for(var i=0;i<n;i++){
      xy[i]=[];
      hand[i]=[];
      for(var j=0;j<n;j++){
         xy[i][j]=yx[j][i];
         hand[i][j]=[0,0];
      }
   }
   yx.forEach(function(v,i){
      var min=v.reduce(function(a,b){return Math.min(a,b);});
      v.forEach(function(V,I){
         if(V==min)hand[i][I][0]=1;
      });
   });
   xy.forEach(function(v,i){
      var max=v.reduce(function(a,b){return Math.max(a,b);});
      v.forEach(function(V,I){
         if(V==max)hand[I][i][1]=1;
      });
   });
   var ans=(function(){
      for(var i=0;i<n;i++){
         for(var j=0;j<n;j++){
            if(hand[i][j][0]==1 && hand[i][j][1]==1)return yx[i][j];
         }
      }
      return 0;
   })();
   console.log(ans);
}

Measured memory_bytes: 15736
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let id_count: i64 = read();
    let gate_count: i64 = read();
    let mut max = id_count;
    let mut min = 1;
    for _ in 0..gate_count {
        let l = read();
        if l > min {
            min = l;
        }
        let r = read();
        if r < max {
            max = r;
        }
    }
    if max < min {
        println!("0");
    } else {
        println!("{}", max - min + 1);
    }
}



Measured memory_bytes: 4352
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef pair< ll, ll > P;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007    //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

// debug
#define DEBUG(x) cout << #x << ": " << x << endl
#define DEBUG2(x, y) cout << #x << ": " << x << " " << #y << ": " << y << endl
#define DEBUG_VEC(v)   \
  cout << #v << ":";   \
  REP(i, v.size())     \
  cout << " " << v[i]; \
  cout << endl
#define DEBUG_ARR(v, n) \
  cout << #v << ":";    \
  REP(i, n)             \
  cout << " " << v[i];  \
  cout << endl

#define ROAD 1
#define WALL -1

struct C
{
  ll x, y;
  C(ll _x, ll _y) : x(_x), y(_y) {}
};

ll H, W;
// 迷路
vector< vector< ll > > S;
// ある地点からの最小到達数
vector< vector< ll > > M;
queue< C > q;

vector< ll > dx = {-1, 0, 1, 0};
vector< ll > dy = {0, 1, 0, -1};

// ある座標Pから次のstepに移動するのを移動できなくなるまで繰り返す
void f(C st)
{
  q.push(st);
  M[st.y][st.x] = 0;

  while (!q.empty())
  {
    C c = q.front();
    q.pop();
    FOR(i, 0, 3)
    {
      ll ny = c.y + dy[i];
      ll nx = c.x + dx[i];
      if (ny >= 0 && ny < H && nx >= 0 && nx < W && S[ny][nx] != WALL)
      {
        if (M[c.y][c.x] + 1 < M[ny][nx])
        {
          // まだ到達していない かつ 次の地点に行けるなら+1してqueueにつむ
          M[ny][nx] = M[c.y][c.x] + 1;
          q.push(C(nx, ny));
        }
      }
    }
  }
}

signed main()
{
  cin >> H >> W;
  S.assign(H, vector< ll >(W, 0));

  REP(h, H)
  {
    REP(w, W)
    {
      char s;
      cin >> s;
      S[h][w] = (s == '.' ? ROAD : WALL);
    }
  }

  ll ans = 0;
  REP(y, H)
  {
    REP(x, W)
    {
      if (S[y][x] != WALL)
      {
        M.assign(H, vector< ll >(W, INF));
        f(C(x, y));

        REP(h, H)
        {
          REP(w, W)
          {
            if (S[h][w] != WALL)
            {
              ans = max(ans, M[h][w]);
            }
          }
        }
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main() {
    int h, w, x, y, r;
    cin >> w >> h >> x >> y >> r;

    if(x>=r && y>=r && x+r<=w && y+r<=h){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3072
N = int(input())
Ans = [0] * (N + 1)


def calc(a, b, c):
    return a ** 2 + b ** 2 + c ** 2 + a * b + b * c + c * a


for i in range(1, N):
    for j in range(1, N):
        for k in range(1, N):
            x = calc(i, j, k)
            if x > N:
                break
            Ans[x] += 1

for a in Ans[1:]:
    print(a)

Measured memory_bytes: 74772
#include <bits/stdc++.h>
using namespace std;

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using ilpair=pair<int,ll>;
using lipair=pair<ll,int>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;

#define PI 3.141592653589793
#define INTINF ((1<<30)-1)
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353
#define MMPRIME (1ll<<61)-1

#define len length()
#define pushb push_back
#define fi first
#define se second

#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

template<class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

template<class T>
inline void out(T a) {
	cout<<a<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

ll binpow(ll a, ll ex, ll p) {
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}


ll N,K;

void input() {
	cin>>N>>K;
}

void solve() {
	cout<<K*binpow(K-1,N-1,LLINF)<<endl;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t) {
		input();
		solve();
		t--;
	}
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5, P = 1e9 + 7;
int n;
int x[maxn], inv[maxn];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> x[i];
	}
	inv[1] = 1;
	for(int i = 2; i <= n; ++i) {
		inv[i] = 1LL * (P - P / i) * inv[P % i] % P;
	}
	for(int i = 2; i <= n; ++i) {
		inv[i] = (inv[i] + inv[i - 1]) % P;
	}
	int ans = 0;
	for(int i = 1; i < n; ++i) {
		ans = (ans + 1LL * inv[i] % P * (x[i + 1] - x[i]) % P) % P;
	}
	for(int i = 1; i < n; ++i) {
		ans = 1LL * ans * i % P;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 62;
const ll MODULO = 1e9+7;

int main(){
    int n;
    cin >> n;
    vector<int> b;
    for (int i = 0; i < n; i++) {
        int y; cin >> y;
        b.push_back(y);
    }
    vector<int> p;
    while (b.size() > 0) {
        int max = *max_element(b.begin(), b.end());
        int init_size = b.size();
        bool deleted = false;
        for (int i = max; i >= 1; i--) {
            if (init_size > b.size()) break;
            for (int j = 0; j < b.size(); j++) {
                if (init_size > b.size()) break;
                if (i == b[j] && j + 1 == i) {
                    p.push_back(j + 1);
                    b.erase(b.begin()+j);
                    // cout << j + 1 << endl;
                    deleted = true;
                }
            }
        }
        if (init_size == b.size()) {
            cout << -1 << endl;
            return 0;
        }
    }
    for (int i = p.size() - 1; i >= 0; i--) {
        cout << p[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<cstdio>
using namespace std;

int main()
{
	int count=0,i;
	string ss1,ss2;
	
	cin >> ss1;

	for(i=0;i<(int)ss1.size();i++)
	{
		ss1[i] = toupper((int)ss1[i]);
	}
	while(1)
	{
		cin >> ss2;
		if(ss2=="END_OF_TEXT") break;
		
		for(i=0;i<(int)ss2.size();i++)
		{
			ss2[i] = toupper((int)ss2[i]);
		}

		if(ss2 == ss1) count++;

	}

	cout << count << endl;


	return 0;
}

Measured memory_bytes: 1192
import sys
readline = sys.stdin.readline

S = readline().rstrip()
N = len(S)
DIV = 10 ** 9 + 7

dp = [[0] * 13 for i in range(N)]

x0 = S[0]
if x0 == "?":
  for i in range(10):
    dp[0][i] = 1
else:
  dp[0][int(x0)] = 1
  
for i in range(1, N):
  x = S[i]
  if x == "?":
    for j in range(13):
      for k in range(10):
        ind = (j * 10 + k) % 13
        dp[i][ind] += dp[i - 1][j]
        dp[i][ind] %= DIV
  else:
    for j in range(13):
      ind = (j * 10 + int(x)) % 13
      dp[i][ind] += dp[i - 1][j]
      dp[i][ind] %= DIV

print(dp[-1][5])


Measured memory_bytes: 96280
#include <iostream>
#include <string>
using namespace std;

int index(char c){
	if(c == 'A') return 0;
	if(c == 'I') return 1;
	if(c == 'V') return 5;
	if(c == 'X') return 10;
	if(c == 'L') return 50;
	if(c == 'C') return 100;
	if(c == 'D') return 500;
	if(c == 'M') return 1000;
}
int main(){
	string s;
	while(cin >> s){
		int total = 0;
		int size = s.size();
		s.push_back('A');
		for(int i = 0; i < size;i++)
		{
			if(index(s[i]) < index(s[i+1])) total -= index(s[i]);
			else total += index(s[i]);
		}
		cout << total << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

const int INF = 1e18;
const int mod = 1e9 + 7;
const int N = 105;

int i, a, b, c, d;

void solve()
{
    cin >> a >> b >> c >> d;
    int ans = max({b * d, b * c, d * a, c * a});
    cout << ans;
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fastio;
    int t;
    //cin >> t;
    t = 1;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3644
N, Q = map(int, input().split())

tree = {}
for i in range(1, N + 1):
    tree[i] = []
for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a] += [b]

count = [0] * (N + 1)
for i in range(Q):
    p, x = map(int, input().split())
    count[p] += x

stack = [1]
while stack:
    label = stack.pop()
    if tree[label] != []:
        for next_label in tree[label]:
            count[next_label] += count[label]
        stack += tree[label]

ans = count[1:]
print(*ans)


Measured memory_bytes: 66532
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

bool is_number(char c) {
    int d = c - '0';
    return d >= 0 && d <= 9;
}

void say_no() {
    cout << "No" << endl;
    exit(0);
}

int main() {
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    int n = a+b+1;

    rep(i, n) {
        if (i < a) {
            if (!is_number(s[i])) say_no();
        }
        else if (i > a) {
            if (!is_number(s[i])) say_no();
        }
        else {
            if (s[i] != '-') say_no();
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

bitset<1000001> primes;
// sqrt(n) までの素数を求める。 10^12 まで対応
void create_primes(int64_t n) {
	primes.flip();

	int64_t u_b = sqrt(n + 1);
	assert(u_b < 1000002);

	{
		for (int64_t j = 4; j <= u_b; j += 2) {
			primes.reset(j);
		}
	}
	for (int64_t i = 3; i <= u_b; i += 2) {
		if (!primes.test(i)) continue;

		for (int64_t j = i * 2; j <= u_b; j += i) {
			primes.reset(j);
		}
	}
}

struct FactorInfo {
	int64_t v;
	int64_t c;
};

// n の素因数分解を行う。 
vector<FactorInfo> make_factors(int64_t n)
{
	create_primes(n);

	int64_t v = n;
	int64_t limit = sqrt(n + 1);

	vector<FactorInfo> ans;
	FOR_LE(i, 2, limit) {
		if (!primes.test(i)) continue;

		int64_t count = 0;
		while (v % i == 0) {
			v /= i;
			count++;
		}

		if (count != 0) {
			ans.push_back({ i, count });
		}
	}

	if (v != 1) {
		ans.push_back({ v , 1 });
	}

	return ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int64_t n; cin >> n;
	
	vector<FactorInfo> factors = make_factors(n);

	int64_t ans = 0;
	for (auto f : factors) {
		int i = 1;
		int r = f.c;
		while (i <= r) {
			r -= i;
			ans++;
			i++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}


int main() {
  int x,y;
  cin>>x>>y;
  for(int i=0;i<=x;i++){
    if(2*i+4*(x-i)==y){cout<<"Yes"<<endl;return 0;}
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF (int)1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<long long> vl;

signed main() {
  int ans,n,d;
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> d;
  ans = n/(2*d+1);
  if(n%(2*d+1) != 0) ans++;
  cout << ans << endl;
}


Measured memory_bytes: 256
D = int(input())
C = list(map(int,input().split()))
 
s = [[] for _ in range(D)]
last = [0]*26
 
for i in range(D):
    s[i] = list(map(int,input().split()))

for d in range(D):
    P = [0]*26
    for i in range(26):
        P[i] += s[d][i]
        for j in range(26):
            if i == j:
                continue
            P[i] -= C[j] * (d+1 - last[j])
    d_maxP = P.index(max(P))
    last[d_maxP] = d+1
    print(d_maxP + 1)

Measured memory_bytes: 9492
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#define pb push_back
using namespace std;
typedef pair<int,int> pii;
typedef long long int lli;

int a[4],b[4];
int c[4][4];
int main(void){
  for(int i=1;i<4;i++){
    for(int j=1;j<4;j++){
      cin>>c[i][j];
    }
  }
  bool f=true;
  for(int j=1;j<3;j++){
    for(int i=1;i<3;i++){
      if(c[i][j]-c[i+1][j]!=c[i][j+1]-c[i+1][j+1])f=false;
      if(c[i][j]-c[i][j+1]!=c[i+1][j]-c[i+1][j+1])f=false;
    }
  }
  if(f) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys

N = int(input())

list = []
for i in range(0, N):
    x, y, h = [int(x) for x in input().split()]
    list.append((x, y, h))

for X in range(0, 101):
    for Y in range(0, 101):
        b = True
        H = 0
        for Cx, Cy, Ch in list:
            if Ch != 0:
                H = Ch + abs(X - Cx) + abs(Y - Cy)
        for Cx, Cy, Ch in list:
            h = max(H - abs(X - Cx) - abs(Y - Cy), 0)
            if Ch != h:
                b = False
        if b == True:
            print(X, Y, H)
            sys.exit(0)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
 using namespace std;     
 int main()
{
    int n,i,k,j,p;
    cin >> n >> k;
    int arr[n];
    for(i=0;i<n;i++)
        cin >> arr[i];
    int dp[n];
    dp[0]=0;dp[1]=abs(arr[0]-arr[1]);
    for(i=2;i<n;i++)
        dp[i]=INT_MAX;
    for(i=2;i<n;i++)
    {
        p=i-k;
        if(p<0)
            p=0;
        for(j=p;j<i;j++)
        {
            dp[i]=min(dp[i],dp[j]+abs(arr[i]-arr[j]));
        }
    }
    cout << dp[n-1];
    
}

Measured memory_bytes: 1024
n, m = map(int, input().split())
nums = [1 for _ in range(n)]
tf = [False for _ in range(n)]
tf[0] = True

for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    nums[x] -= 1
    nums[y] += 1
    if tf[x]:
        tf[y] = True
        if nums[x] == 0:
            tf[x] = False
print(tf.count(True))

Measured memory_bytes: 10528
#include<bits/stdc++.h>
using namespace std ;
int a[1200000];
int main()
{
	int n;
	cin>>n;
	int flag=0;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		if(a[i]%2==0){
			if(a[i]%3==0||a[i]%5==0){
				continue;
			}
			else{
				flag=1;
				break;
			}
		}
	}
	if(flag){
		cout<<"DENIED";
	}
	else{
		cout<<"APPROVED";
	}
} 


Measured memory_bytes: 256
#include <iostream>
#define ll long long int
    using namespace std;

int main()
{
    ll n, x, t, temp= 0;
    cin>>n>>x>>t;
    if(n%x==0){
        temp = n/x;
    }
    else
    {
        temp = n/x +1;
    }
    cout<<temp*t<<endl;    
}

Measured memory_bytes: 3628
import itertools
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

#n = 8
#a = [7,3,5,4,2,1,6,8]
#b = [3,8,2,5,4,6,7,1]

anum=0
bnum=0
x = [i for i in range(1,n+1)]
candi = itertools.permutations(x)
for i,data in enumerate(candi):
  if not anum:
    if list(data) == a:
      anum = i+1
  if not bnum:
    if list(data) == b:
      bnum = i+1
  if anum and bnum:
    break

print(abs(bnum-anum))

    

Measured memory_bytes: 3064
//vec[i]の範囲外エラー表示
#define _GLIBCXX_DEBUG
//includeとusing
#include <bits/stdc++.h>
using namespace std;
//型名省略
using ll = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using pll = pair<ll, ll>;
//定数
const ll INF = 1e9;
const ll MOD = 1e9+7;
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define xrep(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define all(A) A.begin(), A.end()
//入力
ll llin() {ll x; cin >> x; return x;}
string stin() {string s; cin >> s; return s;}
vl vlin(ll n) {vl a(n); rep(i,n){cin >> a[i];} return a;}
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}


//main関数
int main() {
    string s; cin >> s;

    ll ans = 0;
    rep(tmp,1 << s.size() - 1) {
        bitset<9>op(tmp);
        ll count = 0;
        rep(i,s.size() - 1){
            if(op.test(i)){
                ans += stoll(s.substr(count,i + 1 - count));
                count = i + 1;
            }
        }
        ans += stoll(s.substr(count));
    }
    cout << ans << endl;

}


Measured memory_bytes: 3640
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <iterator>
#include <algorithm>
#include <cfenv>
#include <random>
#include <numeric>
#include <cmath>
#include <iosfwd>
#include <iostream>
#include <ios>
#include <streambuf>
#include <istream>
#include <ostream>
#include <iomanip>
#include <sstream>
#include <fstream>


typedef long long ll;

using namespace std;

int main(){
    char N[5];
    cin >> N;
    int flg = 0;
    for(int i = 0 ; i <= 2 ; i++){
        if(N[i] == '7'){
            flg++;
            break;
        }

    }
    if(flg){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int a,b;
    Scd2(a,b);

    printf ("%d\n", 6-a-b );

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int a[m];
    long long sum = 0;
    for(int i = 0; i< m; i ++) cin >> a[i], sum += a[i];
    int ans = n-sum;
    if(ans >= 0) cout << ans << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 3640
package main
import (
	"fmt"
)
func main()  {
	var N,K int
	fmt.Scan(&N,&K)
	pena,acc:=0,0
	plob :=map[int]int{}

	for i := 0; i < K; i++ {
		var p int
		var s string
		fmt.Scan(&p,&s)
		a,b:=plob[p]
		if !b {
			if s=="WA" {
				plob[p]=1
			}else{
				plob[p]=0
				acc++
			}
		}else{
			if a>0 {  
				if s=="WA" {
					plob[p]++;
				}else {
					acc++
					pena+=plob[p]
					plob[p]=0
				}
			}
		}

	}

	

	fmt.Println(acc,pena)

}



Measured memory_bytes: 8064
#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename H, typename... T> void debug_out(H h, T... t) {  cerr << " " << (h);  debug_out(t...); }
void read() {}
template <typename H, typename... T> void read(H &h, T&... t) { cin >> h; read(t...) ;}

#ifndef LOCAL
#define endl '\n'
#define debug(...) //
#else
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#endif

int g[3][3];
int g2[3][3];
int s[3];

bool test(int b) {
  int ok = true;
  for (int r = 0; r < 3; r++) {
    ok &= (((s[r] - b) % 3) == 0);
  }
  if (!ok)
    return false;

  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      g2[i][j] = g[i][j] - (s[i] - b) / 3;
    }
  }

  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      ok &= g2[j][i] == g2[0][i];
    }
  }
  return ok;
}

void solve() {
  int total = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> g[i][j];
      total += g[i][j];
      s[i] += g[i][j];
    }
  }

  for (int b = 0; b <= total; b++) {
    if (test(b)) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main() {
#ifndef LOCAL
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif
  //int tc; cin >> tc;
  //while (tc--)
  solve();
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  vector<int>x(n);
  vector<int>y(n);
  vector<int>num(n);
  for(int i=0;i<n;i++){
    cin>>x[i]>>y[i];
    num[i]=i;
  }
  double sum=0;
  double count=1;
  for(int i=0;i<n-1;i++){
    do{
    //for(int j=i+1;i<n;i++){
      sum+=sqrt((x[num[i]]-x[num[i+1]])*(x[num[i]]-x[num[i+1]])+(y[num[i]]-y[num[i+1]])*(y[num[i]]-y[num[i+1]]));
    }while(next_permutation(num.begin(),num.end()));
  }
  for(int i=1;i<=n;i++){
    count*=i;
  }
  double ave=sum/count;
  cout<<fixed<<setprecision(12)<<ave<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
lint ans;

signed main(){
  lint N; cin >> N;
  vector<vector<lint> > a(10, vector<lint> (10)), b(10, vector<lint> (10));
  for(lint i = 1; i <= N; i++){
    string s = to_string(i);
    lint n = s.size();
    a[s[0] - '0'][s[n - 1] - '0']++;
    b[s[0] - '0'][s[n - 1] - '0']++;
  }
  lint ans = 0;
  for(lint i = 0; i < 10; i++){
    for(lint j = 0; j < 10; j++) ans += a[i][j] * b[j][i]; 
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
N = int(input())


def sumdigit(n):
    return sum(map(int, list(str(n))))


s = sumdigit(1) + sumdigit(N-1)  # 初期値
for i in range(N // 2):
    A = i + 1
    B = N - A
    tmp = sumdigit(A) + sumdigit(B)
    s = min(s, tmp)
print(str(s))

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
using ll = long long;

int main() {
  ll A[100010];
  int n, q;
  ll x;
  cin >> n >> q;
  for (int i = 0; i < n; ++i)
    cin >> A[i];
  while (cin >> x) {
    ll ct = 0;
    ll s = 0;
    for (int f = 0, b = 0; f < n; ++f) {
      s += A[f];
      while (s > x)
        s -= A[b++];
      ct += (f - b + 1);
    }
    cout << ct << endl;
  }
}



Measured memory_bytes: 3868
#include <bits/stdc++.h>
#include<chrono>
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;

int main() {
	cin >> N >> M;
	vector<ll> A(N + 1), sum(N + 1,0);
	map<ll, ll>m;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		sum[i] = sum[i - 1] + A[i];
		sum[i] %= M;
		m[sum[i]] = 0;
	}
	for (int i = 0; i <= N; i++) {
		m[sum[i]] ++ ;
	}
	for (auto it = m.begin(); it != m.end(); it++) {
		pair<ll, ll>item = *it;
		ans += item.second*(item.second - 1) / 2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>
#define qi ios::sync_with_stdio(0)

bool debug=true;

/*    *************************************
	  * Written in New Computer           *
	  * The following code belongs to     *
	  * XiaoGeNintendo of HellHoleStudios *
	  *************************************
*/
template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){
	os<<ptt.first<<","<<ptt.second;
	return os;
}
template<typename T>ostream& operator<<(ostream& os,vector<T> vt){
	os<<"{";
	for(int i=0;i<vt.size();i++){
		os<<vt[i]<<" ";
	}
	os<<"}";
	return os;
}

int path[505][505];

void dfs(int l,int r,int x){
	if(l==r){
		return;
	}
	int m=(l+r)/2;
	for(int i=l;i<=m;i++){
		for(int j=m+1;j<=r;j++){
			path[i][j]=x;
		}
	}
	
	dfs(l,m,x+1);
	dfs(m+1,r,x+1);
}

int main(int argc,char* argv[]){
	int n;
	cin>>n;
	dfs(1,n,1);
	
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			cout<<path[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}



Measured memory_bytes: 1408
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
mod = 10**9+7
#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]
# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
#a/b = a*(b`)となるb`を求める
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod+x%mod)%mod
factorial = [1 for i in range(n+1)]
factorial[0] = 1
for i in range(1,n + 1):
    factorial[i] = factorial[i-1] * i
    factorial[i] %= mod
def mod_combi(a,b):
    if b == 0:
        return 1
    elif a == 0 or a < b:
        return 0
    elif a == b:
        return 1
    else:
        return (factorial[a] * mod_inv(factorial[b], mod) * mod_inv(factorial[a-b],mod)) % mod
ans = 0
#それぞれについて、最小になる場合と最大になる場合をもとめ、ans に加算する。
for i in range(n):
    patt_max = mod_combi(i, k-1)
    patt_min = mod_combi(n-i-1, k-1)
    ans += (patt_max - patt_min) * a[i]
    ans %= mod
print(ans)

Measured memory_bytes: 64752
#include<stdio.h>
int main()
{
    int a,b,n,i,j,x,y,sum=0;
    scanf("%d",&n);
    int array[n];
    scanf("%d",&array[0]);
    a=array[0];
    for(i=1; i<n; i++)
        {
            scanf("%d",&array[i]);
            if(a<array[i])
                {
                    a=array[i];
                }


        }
    for(i=0; i<n; i++)
        {
            sum=sum+array[i];
        }
    sum=sum-a;
    if(a<sum)
        printf("Yes");
    else
        printf("No");

    return 0;



}


Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <map>
using namespace std;
vector<long long> divisor(long long n){//nの約数列挙
    vector<long long> res;
    for(long long i = 1; i * i <= n; i++){
        if(n % i == 0){
            if(i != 1) res.push_back(i);
            if(i != n / i) res.push_back(n / i);
        }
    }
    return res;
}


long long gcd(long long x, long long y){
    if(x < y) swap(x, y);
    if(x % y == 0) return y;
    return gcd(y, x % y);
}
int main(){
    long long N;
    cin >> N;
    long long cnt = 0;
    if(N == 1){
        cout << 1 << endl;
        return 0;
    }
    vector<long long> sisuu = divisor(N);
    for(int i = 0; i < (int) sisuu.size(); i++){
        long long n = N;
        while(n > 1){
            if(n % sisuu[i] == 0) {
                n/= sisuu[i];
                if(n == 1) cnt++;
            }
            else{
                if(n % sisuu[i] == 1) cnt++;
                break;
            }
        }
    }
    vector<long long> yak = divisor(N - 1);
    cnt += yak.size();
    cout << cnt << endl;
}

Measured memory_bytes: 3676
#include <iostream>
#include <string>
#include <stack>
#include <queue>

using namespace std;

int main() {
	int a,i,max=0,num=0;
	string b;
	cin >> a ;
	cin >> b;
	for(i=0;i<a;i++){
		if(b[i]=='I'){
			num++;
		}else{
			num--;
		}
		if(max<num) max=num;
	}
	
	cout << max <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N = 0, M = 0;
  cin >> N >> M;
  
  vector<int> k(M, 0);
  vector<vector<int>> s(M, vector<int>(N, 0));
  for (int i = 0; i < M; ++i) {
    cin >> k[i];
    for (int j = 0; j < k[i]; ++j) {
      cin >> s[i][j];
    }
  }
  
  vector<int> p(M, 0);
  for (int i = 0; i < M; ++i) {
    cin >> p[i];
  }
  
  size_t stN = static_cast<size_t>(N);
  
  set<int> si;
  for (int k = 0; k < pow(2, N); ++k) {
    si.insert(k);
  }
  
  for (int i = 0; i < M; ++i) {
    for (auto it = si.begin(); it != si.end();) {
      int sum_i = 0;
      for (int j = 0; j < k[i]; ++j) {
        sum_i += ((*it) >> (s[i][j] - 1));
      }
      if (sum_i % 2 != p[i]) {
        it = si.erase(it);
      } else {
        ++it;
      }
    }
  }
  
  cout << si.size() << endl;
  
  return 0;
}

Measured memory_bytes: 256
n=int(input())
a=[0]+list(map(int,input().split()))
b=[0]*(n+1)
for i in reversed(range(1,n+1)):
    ans=0
    for j in range(i,n+1,i):
        ans+=b[j]
    if ans%2==a[i]:
        b[i]=0
    else:
        b[i]=1
c_=[]
for c,d in enumerate(b):
    if d==1:
        c_.append(str(c))
print(len(c_))
print(' '.join(c_))
        






Measured memory_bytes: 22512
#include <bits/stdc++.h>
using namespace std;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define Fix( x ) setprecision( x ) << fixed
#define mem( a , x ) memset( a , x , sizeof( a ) )
#define bug( a , b ) cerr<< #a <<" = "<<a<<" , "<< #b <<" = "<<b<<"\n";
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define FOR( i , a , b ) for( int i = a; i <= b; i++ )
#define ROF( i , a , b ) for( int i = a; i >= b; i-- )
#define sz( V ) (int)V.size( )
#define all( V ) V.begin( ),V.end( )
#define Found( S , val ) S.find( val ) != S.end( )
#define Unique( V ) sort( all( V ) ), V.erase( unique( all( V ) ), V.end() )
typedef pair < int , int > ii;
typedef pair < int , ii > iii;
typedef long long int LL;
typedef unsigned long long uLL;
const int inf = (int)1e9;
const LL INF = (LL)1e18;
const int N = 100005;
const int mod = 1000000007;
const double eps = 1e-8;
const double pi = acos( -1.0 );

LL a[ 2*N ];
int n;


LL calc( LL b ) {
    LL res = 0;
    for( int i = 1; i <= n; i++ ) res += abs( a[i]-(b+i) );
    return res;
}
LL TernarySearch( LL l , LL r ) {
    LL lo = l , hi = r , midL , midR;
    LL ret = 2*INF;
    int iter = 500;
    while( iter-- ) {
        midL = ( 2*lo+hi )/3 , midR = ( lo+2*hi )/3;
        LL x = calc( midL ) , y = calc( midR );
        if( x < y ) hi = midR , ret = min( ret , x );
        else lo = midL;
    }
    return min( ret , min( calc(lo) , calc(hi) ) );
}
int main( int argc, char const *argv[] ) {
        fast_io;
        cin >> n;
        for( int i = 1; i <= n; i++ ) cin >> a[i];
        cout << TernarySearch( -inf , inf ) << endl;
        return 0;
}








Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define MOD7 1000000007
#define LL_INF 1LL << 60
#define LL_MINF -1LL << 60
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long double PI = (acos(-1));


int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    reverse(all(A));
    for(int i = 0; i < N; i++){
        cout << A[i];
        if(i != N - 1) cout << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 3080
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int a,b;
	cin>>a>>b;
	int sa = b-a;
	int Ah = 0;
	for(int i=1;i<sa;++i){
		Ah += i;
	}
	int ans = Ah-a;

	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long double ld;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

ll fib[50];

void solve(){

    int n;
    cin >> n;
    fib[0]=1;
    fib[1]=1;
    for(int i=2; i<=n; i++){
        fib[i]=fib[i-1]+fib[i-2];
    }
    cout << fib[n] << endl;

}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}



Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n, 0));

  function<void(const vector<int>&, int)> f = [&f, &a](const vector<int>& s, int l) {
    for (int i = 0; i < s.size(); i++) {
      for (int j = 0; j < i; j++) {
        if (i % 2 != j % 2) a[s[i]][s[j]] = a[s[j]][s[i]] = l;
      }
    }
    for (int o = 0; o < 2; o++) {
      vector<int> t;
      for (int i = o; i < s.size(); i += 2) t.push_back(s[i]);
      if (t.size() >= 2) f(t, l + 1);
    }
  };
  vector<int> t(n);
  iota(begin(t), end(t), 0);
  f(t, 1);

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) cout << a[i][j] << ' ';
    cout << endl;
  }
}


Measured memory_bytes: 1536
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

std::vector<std::pair<int64_t, int64_t>> FactorizeIntoPrimeFactors(const int64_t N) {
  std::vector<std::pair<int64_t, int64_t>> result;
  if (N <= 0LL || N == 1LL) {
    return result;
  }
  int64_t remaining = N;
  for (int64_t i = 2LL; i * i <= remaining; ++i) {
    int64_t count = 0LL;
    while (remaining % i == 0LL) {
      ++count;
      remaining /= i;
    }
    if (count > 0LL) {
      result.push_back(std::pair<int64_t, int64_t>(i, count));
    }
  }
  if (remaining > 1) {
    result.push_back(std::pair<int64_t, int64_t>(remaining, 1));
  }
  return result;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int64_t N, M;
  cin >> N >> M;
  int64_t result = -1;
  const int64_t limit = static_cast<int64_t>(sqrt(static_cast<double>(M)));
  for (int64_t i = 1; i <= limit; ++i) {
    if (M % i == 0) {
      if (i >= N) {
        result = max(result, M / i);
      }
      const int64_t j = M / i;
      if (j >= N) {
        result = max(result, M / j);
      }
    }
  }
  if (result < 0) {
    result = 1;
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3680
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define ll long long
using namespace std;
ll rec(ll num) {
    ll ans = 0;
    if (num == 1) return 1;
    ans += 1 + 2 * rec(num/2);
    return ans;
}
int main() {
    ll H;
    cin >> H;
    cout << rec(H) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+10;
int main()
{
    string s;
    cin >> s;
    if(s[2]==s[3] && s[4]==s[5])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair <int, int>;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main() {
  string N;
  cin >> N;
  ll sum = 0;
  rep(i, N.size()) sum += N[i]-'0';
  if (sum%9==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3728