akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//using namespace std;
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb push_back
#define mp std::make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
const ll MOD=1e9+7;
//const ll MOD=998244353;
//const ll MOD=100000;
const ll MAX=500000;
const ll INF=(1ll<<60);
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
struct Binary_indexed_tree{
    int N;
    vi bit;
    Binary_indexed_tree(int n):N(n){
        bit.resize(N+1,0);
    }
    void add(int x,int a){
        for(x;x<=N;x+=(x&-x)) bit[x]+=a;
    }
    ll sum(int x){
        ll ret=0;
        for(x;x>0;x-=(x&-x)) ret+=bit[x];
        return ret;
    }
};
ll modpow(ll X,ll Y){
    ll sum=X,cnt=1;
    vi A;
    while(cnt<=Y){
        A.pb(sum);
        sum*=sum;
        sum%=MOD;
        cnt*=2;
    }
    int M=A.size();
    ll ret=1;
    REP(i,1,M){
        if(Y>=(1ll<<M-i)){
            Y-=(1ll<<M-i);
            ret*=A[M-i];
            ret%=MOD;
        }
    }
    return ret;
}
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
    fac[0]=fac[1]=finv[1]=finv[0]=inv[0]=inv[1]=1;
    rep(i,2,MAX){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=modpow(i,MOD-2);
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(ll n,ll r){
    if(n<r||n<0||r<0) return 0;
    return fac[n]*finv[r]%MOD*finv[n-r]%MOD;
}
signed main(){
    int H,W,K; cin>>H>>W>>K;
    vector<string> S(H);
    rep(i,0,H) cin>>S[i];
    vi P={0,1,0,-1},R={1,0,-1,0};
    ll ans=INF;
    vii F(H,vi(W,-1));
    std::queue<pii> que;
    rep(i,0,H){
        rep(j,0,W){
            if(S[i][j]=='S'){
                que.push(mp(i,j));
                F[i][j]=0;
                break;
            }
        }
    }
    while(!que.empty()){
        int X=que.front().first,Y=que.front().second; que.pop();
        if(F[X][Y]==K) break;
        rep(i,0,4){
            int A=X+P[i],B=Y+R[i];
            if(0<=A&&A<H&&0<=B&&B<W){
                if(F[A][B]==-1&&S[A][B]=='.'){
                    F[A][B]=F[X][Y]+1;
                    que.push(mp(A,B));
                }
            }
        }
    }
    rep(i,0,H){
        rep(j,0,W){
            if(F[i][j]!=-1){
                vi A(4);
                A[0]=i;
                A[1]=H-i-1;
                A[2]=j;
                A[3]=W-j-1;
                sort(ALL(A));
                ans=std::min(ans,1+(K+A[0]-1)/K);
            }
        }
    }
    cout<<ans<<endl;
}


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

typedef long long ll;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define REPM(i,n) for(ll i=(n-1); 0=<i; i--)
#define VI vector<int>
#define VL vector<ll>
#define VD vector<double>
#define VS vector<string>
#define V_SORT_U(x) sort(x.begin(), x.end());
#define V_SORT_D(x) sort(x.begin(), x.end(),greater<int>());
#define V_SUM(x) accumulate(x.begin(), x.end(), 0)
#define STR_TRANS_UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define STR_TRANS_LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);

int main(void){
    string N;
    cin >> N;

    if( N.substr(N.length()-1,1) == "3")
    {
        cout << "bon";
    }
    else if( N.substr(N.length()-1,1) == "0" ||
    N.substr(N.length()-1,1) == "1" ||
    N.substr(N.length()-1,1) == "6" ||
    N.substr(N.length()-1,1) == "8")
    {
        cout << "pon";
    }
    else{
        cout << "hon";
    }
    return 0;
}

Measured memory_bytes: 3632
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()
	P = inputList()

	ans = 0
	mmin = 0
	for i,val in enumerate(P):
		if i == 0:
			ans += 1
			mmin = val
			continue

		if val <= mmin:
			ans += 1
			mmin = val
			#print("{} {} {}".format(i,val,mmin))
		else:
			pass

	print(ans)



if __name__ == "__main__":
	main()


Measured memory_bytes: 72100
mod=10**9+7
def f(a,r):
    s=[[0,0],[0,0]]
    s[0][0]=(a[0][0]*r[0][0]+a[0][1]*r[1][0])%mod
    s[0][1]=(a[0][0]*r[0][1]+a[0][1]*r[1][1])%mod
    s[1][0]=(a[1][0]*r[0][0]+a[1][1]*r[1][0])%mod
    s[1][1]=(a[1][0]*r[0][1]+a[1][1]*r[1][1])%mod
    return s
b=[[1,1],[1,0]]
k=[b]
for i in range(20):
    k.append(f(k[-1],k[-1]))
n,m=map(int,input().split())
t=0
ans=1
if m==0:
    s=bin(n-t)[2:]
    s="0"*(21-len(s))+s
    s=s[::-1]
    p=[[1,0],[0,1]]
    for j in range(21):
        if s[j]=="1":
            p=f(p,k[j])
    ans=(ans*p[0][0])%mod
    print(ans)
else:
    for i in range(m):
        a=int(input())
        if t==a:
            print(0)
            break
        else:
            s=bin(a-1-t)[2:]
            s="0"*(21-len(s))+s
            s=s[::-1]
            p=[[1,0],[0,1]]
            for j in range(21):
                if s[j]=="1":
                    p=f(p,k[j])
            ans=(ans*p[0][0])%mod
            t=a+1
            if i==m-1:
                s=bin(n-t)[2:]
                s="0"*(21-len(s))+s
                s=s[::-1]
                p=[[1,0],[0,1]]
                for j in range(21):
                    if s[j]=="1":
                        p=f(p,k[j])
                ans=(ans*p[0][0])%mod
    else:
        print(ans)


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

int main(){
	ios::sync_with_stdio(false);
	int a,b,m,ma=1e9,mb=1e9;
	cin>>a>>b>>m;
	vector<int>aa(a),bb(b);
	for(int i=0;i<a;++i){
		cin>>aa.at(i);
		ma=min(aa.at(i),ma);
	}
	for(int i=0;i<b;++i){
		cin>>bb.at(i);
		mb=min(bb.at(i),mb);
	}
	int ans=ma+mb;
	for(int i=0,pa,pb,minus;i<m;++i){
		cin>>pa>>pb>>minus;
		ans=min(ans,aa.at(pa-1)+bb.at(pb-1)-minus);
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define mp std::make_pair
#define INF 10000000000000

typedef long long ll;

ll arr[401];
std::pair<ll, ll> memo[401][401];
bool vis[401][401];

std::pair<ll, ll> SLIME(int i, int j)
{
	if(i == j)
	return mp(0, arr[i]);	
	else if(i+1 == j)
	return mp((arr[i] + arr[j]), (arr[i] + arr[j]));
	if(vis[i][j])
	return memo[i][j];
	ll ans1 = INF, ans2 = INF;
	for(int k=i;k<j;k++)
	{
		std::pair<ll, ll> px1 = SLIME(i, k);
		std::pair<ll, ll> px2 = SLIME(k+1, j);
		if(ans1 > ((px1.second + px2.second) + px1.first + px2.first))
		{	
			ans1 = std::min(ans1, (px1.second + px2.second) + px1.first + px2.first);
			ans2 = (px1.second + px2.second);
		}	
	}
	vis[i][j] = 1;
	memo[i][j] = mp(ans1, ans2);
	return memo[i][j];
}

int main(void)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	memset(vis, 0, sizeof(vis));
	int n;
	std::cin>>n;
	for(int i=1;i<=n;i++)
	std::cin>>arr[i];
	ll ans = SLIME(1, n).first;	
	std::cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i) 
#endif

#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());

using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int EPS = 1e-9;
const int MOD = 1e9+7;

ll mod_pow(ll x, ll n, ll mod){
  if(n == 0)return 1;
  ll res;
  if(mod == -1)res = mod_pow(x * x,n/2,mod);
  else res = mod_pow(x * x % mod,n/2,mod);
  if(n%2 == 1 && mod != -1)res = res * x % mod;//(nが2の累乗ではない時にもう一度処理を行う)
  else if(n%2 == 1)res = res * x;
  return res;
}
int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s,t;
  cin >> s >> t;
  int ind = -1;
  REP(i,SZ(s)-SZ(t) + 1){//現在探索中の部分文字列の頭文字
    DUMP(i);
    DUMP(s[i]);
    bool isOk = true;
    REP(j,SZ(t)){
      if(s[i+j] != t[j] && s[i+j] != '?'){
	DUMP(s[i+j]);
        isOk = false;
	break;
      }
    }
    if(isOk){
      ind = i;
    }
  }
  if(ind != -1){
    REP(j,SZ(t)){
      s[ind+j] = t[j];
    }
    replace(ALL(s),'?','a');
    cout << s << endl;
  }else{
    cout << "UNRESTORABLE" << endl; 
  }
  return 0;
}



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

int main(){
int a, b, k, S, sum;
  sum = 0;
  cin >> a >> b >> k;
  
  if(a >= b){
  S = b;
  }
  else{
  S = a;
  }
  
  for(int i = S; i > 0; i--){
  if((a % i == 0) && (b % i == 0)){
  sum++;
    if(k == sum){
    cout << i << endl;
    }
  }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(i);
// sort(arr, arr+n, greater<int>());
// const long double pi = acos(-1.0);
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}



	int main(void)
	{
		fast();
		ll x;
		cin>>x;
		ll c=0;
		ll an = 100;
		while(1)
		{
			if(an<x)
			{
				an=an+(an*0.01);
				c++;
			}
			else
			{
				break;
			}
		}
	    cout<<c<<endl;
	    return 0;
	}

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

#define endl "\n"
#define lli long long int
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define ct1(x) cout<<x<<endl;
#define ct2(x,y) cout<<x<<" "<<y<<endl;
#define ct3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
#define ct4(w,x,y,z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define ct5(v,w,x,y,z) cout<<v<<" "<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define ct6(u,v,w,x,y,z) cout<<u<<" "<<v<<" "<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define sq(x) ((x)*(x))
#define all(x) x.begin(),x.end()
#define ff first
#define ss second

const int MOD = (int)1e9 + 7;

lli solve(){
	lli n, i,x;
    cin>>n;
    vector<lli>v;
    vector<lli>dp(n,0);
    for(i=0; i<n; i++){
    	cin>>x;
    	v.pb(x);
    }
    if(n==0)
    	return 0;
    if(n==1)
    	return abs(v[1]-v[0]);
    dp[1]=abs(v[1]-v[0]);
    // cout<<dp[1]<<" ";
    for(i=2; i<n; i++){
    	dp[i]=min((dp[i-2]+abs(v[i-2]-v[i])),(dp[i-1]+abs(v[i-1]-v[i])));
    }
    // cout<<"a";
    return dp[n-1];
}

int main() {
    FASTER
	// lli testCases;
	// cin>>testCases;
	// for(lli caseLevel=1; caseLevel<=testCases; caseLevel++)
	// {
	    // cout<<"Case #"<<caseLevel<<": ";
        cout<<solve()<<endl;
        // cout<<endl;
	// } /
	return 0;
}

Measured memory_bytes: 5016
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;


template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "{";
    for (int i = 0; i < v.size(); ++i) {
        if(i) os << ", ";
        os << v[i];
    }
    return os << "}";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
    return os << "{" << p.first << ", " << p.second << "}";
}


int main() {
    int n;
    cin >> n;
    vector<int> v(1<<n);
    for (auto &&k : v) scanf("%d", &k);
    multiset<int, greater<>> s;
    s.insert(v.begin(),v.end());
    vector<int> u(1<<n);
    u[0] = *s.begin();
    s.erase(s.begin());
    for (int i = 1; i < (1 << n); i *= 2) {
        for (int j = 0; j < i; ++j) {
            auto x = s.upper_bound(u[j]);
            if(x == s.end()){
                puts("No");
                return 0;
            }
            u[j+i] = *x;
            s.erase(x);
        }
    }
    puts("Yes");
    return 0;
}



Measured memory_bytes: 14592
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <tuple>
using namespace std;

int n, q, ans[100005], dis[100005];
vector <tuple <int, int, int> > g[100005];

int par[100005], sz[100005];
int son[100005], dep[100005];
int ind[100005], top[100005], indx;
void dfs1(int u, int parent, int depth) {
  dep[u] = depth, par[u] = parent, sz[u] = 1;
  for (int i = 0; i < (int)g[u].size(); ++ i) {
    int v = get <0> (g[u][i]);
    if (v == parent) continue;
    dfs1(v, u, depth + 1), sz[u] += sz[v];
    if (sz[v] > sz[son[u]]) son[u] = v;
  }
}
void dfs2(int u, int topv) {
  top[u] = topv, ind[u] = ++ indx;
  if (son[u]) dfs2(son[u], topv);
  for (int i = 0; i < (int)g[u].size(); ++ i) {
    int v = get <0> (g[u][i]);
    if (v == par[u] || v == son[u]) continue;
    dfs2(v, v);
  }
}
inline int get_lca(int u, int v) {
  while (top[u] != top[v]) {
    if (dep[top[u]] < dep[top[v]])
      swap(u, v);
    u = par[top[u]];
  }
  if (dep[u] < dep[v]) return u;
  return v;
}

int dist[100005];
void dfs3(int u, int parent) {
  for (int i = 0; i < (int)g[u].size(); ++ i) {
    int v = get <0>(g[u][i]), w = get <2>(g[u][i]);
    if (v == parent) continue;
    dist[v] = dist[u] + w, dfs3(v, u);
  }
}

vector <tuple <int, int, int> > qry[100005];
int d[100005], cnt[100005];
void dfs4(int u, int parent) {
  for (int i = 0; i < (int)g[u].size(); ++ i) {
    int v = get <0>(g[u][i]), c = get <1> (g[u][i]), w = get <2>(g[u][i]);
    if (v == parent) continue;
    d[c] += w, cnt[c] ++;
    dfs4(v, u);
    d[c] -= w, cnt[c] --;
  }
  for (int i = 0; i < (int)qry[u].size(); ++ i) {
    int id = get <0>(qry[u][i]), c = get <1>(qry[u][i]);
    int t = get <2>(qry[u][i]), nowd = dis[id];
    int x = d[c], y = nowd * cnt[c];
    ans[id] += (y - x) * t;
  }
}

int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1; i < n; ++ i) {
    int u, v, c, d;
    scanf("%d %d %d %d", &u, &v, &c, &d);
    g[u].emplace_back(v, c, d);
    g[v].emplace_back(u, c, d);
  }
  dfs1(1, 0, 1);
  dfs2(1, 1);
  dfs3(1, 0);
  for (int i = 1; i <= q; ++ i) {
    int c, u, v;
    scanf("%d %d %d %d", &c, dis + i, &u, &v);
    int lca = get_lca(u, v);
    ans[i] = dist[u] + dist[v] - 2 * dist[lca];
    qry[u].emplace_back(i, c, 1);
    qry[v].emplace_back(i, c, 1);
    qry[lca].emplace_back(i, c, -2);
  }
  dfs4(1, 0);
  for (int i = 1; i <= q; ++ i)
    printf("%d\n", ans[i]);
  return 0;
}

Measured memory_bytes: 25272
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define fs first
#define sc second

int main(void){
    int n;
    cin >> n;
    vector<int> b(n-1);
    rep(i,n-1) cin >> b[i];
    int ans = b[0]+b[n-2];
    rep(i,n-2) ans += min(b[i],b[i+1]);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int n,x,i,sum,min;
scanf("%d %d",&n,&x);
  int a[n];
  scanf("%d",&a[0]);
  sum=a[0];
  min=a[0];
  for(i=1;i<n;++i)
  {
  scanf("%d",&a[i]);
  sum=sum+a[i];
  if(a[i]<min) min=a[i];
  }
  
  printf("%d",n+(x-sum)/min);
  
  
return 0;}

Measured memory_bytes: 1692
//
//  main.cpp
//  A
//
//  Created by 黄道煜 on 2018/7/21.
//  Copyright © 2018年 黄道煜. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;

int n, t, ans;

int main()
{
    scanf("%d", &n);
    for(int i=1; i<=n; i++)
    {
        scanf("%d", &t);
        ans+=t-1;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

struct P {
    int point;
    string name;

    P() {}
    P(int point, string name) : point{point}, name{name} {}

    bool operator < (const P& p) const {
        if (point != p.point) {
            return point > p.point;            
        }
        return name < p.name;
    }
};

bool c(int X, int K, int L, const vector<P>& info, const vector<int>& p)
{
    int sum = 0;
    int rnk = K - X;
    for (int i = 0; i < X; i++) {
        if (p[i] <= rnk) {
            rnk = min(rnk + 1, K);
            continue;
        }

        if (info[p[i]].name < info[rnk].name) {        
            sum += info[rnk].point - info[p[i]].point;
        } else {
            sum += info[rnk].point - info[p[i]].point + 1;
        }
        if (sum > L) return 0;
    }
    return (sum <= L);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, M, K, L;
    while (cin >> N >> M >> K >> L, N > 0) {
        string name;
        int point;
        vector<P> info;
        for (int i = 0; i < N; i++) {
            cin >> name >> point;
            info.emplace_back(point, name);
        }

        sort(info.begin(), info.end());
        
        map<string, int> num;
        for (int i = 0; i < N; i++) {
            num[info[i].name] = i;
        }
        
        vector<int> p(M);
        string fav;
        for (int i = 0; i < M; i++) {
            cin >> fav;
            p[i] = num[fav];
        }

        sort(p.begin(), p.end());

        int l = 0, r = min(K, M);
        while (r - l > 1) {
            int mid = (l + r) / 2;
            if (c(mid, K, L, info, p)) {
                l = mid;
            } else {
                r = mid;
            }
        }

        if (c(r, K, L, info, p)) {
            cout << r << endl;
        } else {
            cout << l << endl;
        }
    }        
    return 0;
}

Measured memory_bytes: 15760
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;


int main() {

	int n;
	cin >> n;

	int ans = 1;

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

		int num = i;
		if (i*i > n)
		{
			break;
		}
		while (num * i <= n) {
			num *= i;
		}
		ans = max(ans, num);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  int h, a;
  cin >> h >> a;

  cout << (h + a - 1) / a << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)

#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define op(i) cout << (i) << endl;
#define F first
#define S second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const ll mod = 1e9 + 7;
const ll infl = 1e17;

int main()
{
    ll n, k;
    cin >> n >> k;
    vll dist(n, infl);
    map<ll, set<ll>> edge;
    vector<set<ll>> near(n);
    ll a, b;
    rep(i,n-1){
        cin>>a>>b;
        a--;
        b--;
        edge[a].insert(b);
        edge[b].insert(a);
    }
    dist[0] = 0;
    ll ans = 1;
    set<ll> check;
    check.insert(0);
    vector<bool> used(n, false);
    vll one(n, 0);
    while (!(check.empty())){
        ll now = *check.begin();
        check.erase(now);
        ll two = one[now];
        for (auto nex:edge[now]){
            two += one[nex];
            one[nex]++;
            if(used[nex]==false)check.insert(nex);
        }
        if (k-two<0){
            cout << 0 << endl;
            return 0;
        }
        ans = (ans * (k - two)) % mod;
        used[now] = true;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 29952
import random
import numpy as np

def is_prime(q,k=50):
    if q == 2: return 1
    if q < 2 or q&1 == 0: return 0

    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return 0
    return 1
  
chk = np.array([0]*10**5)
for i in range(10**5):
  chk[i] = is_prime(i+1,10)
  
ans = np.array([0]*10**5)
for i in range(2,10**5):
  ans[i] = chk[i]&chk[(i+1)//2]
np.cumsum(ans,out=ans)

import sys
input = sys.stdin.readline
q = int(input())
for i in range(q):
  l,s = map(int,input().split())
  print(ans[s-1]-ans[max(0,l-2)])

Measured memory_bytes: 17036
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    string s;
    cin >> s;
    int n = s.size();
    int ans = INF;
    rep(i, n - 2) {
        int tmp = 0;
        tmp += (s[i]-'0') * 100;
        tmp += (s[i+1] - '0') * 10;
        tmp += (s[i+2] - '0');
        ans = min(ans, abs(tmp - 753));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class D
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var h = read();
		var roots = Enumerable.Range(0, h[0] - 1).Select(i => read()).ToArray();
		map = roots.Concat(roots.Select(r => new[] { r[1], r[0] })).GroupBy(r => r[0]).ToDictionary(g => g.Key, g => g.Select(r => r[1]).ToArray());
		ops = Enumerable.Range(0, h[1]).Select(i => read()).GroupBy(a => a[0]).ToDictionary(g => g.Key, g => g.Sum(a => a[1]));

		c = new int[h[0]];
		FindPoints(1, 0);
		Console.WriteLine(string.Join(" ", c));
	}

	static Dictionary<int, int[]> map;
	static Dictionary<int, int> ops;
	static int[] c;
	static int sum;

	static void FindPoints(int p, int p0)
	{
		if (ops.ContainsKey(p)) sum += ops[p];
		c[p - 1] = sum;
		if (map.ContainsKey(p)) foreach (var q in map[p]) if (q != p0) FindPoints(q, p);
		if (ops.ContainsKey(p)) sum -= ops[p];
	}
}


Measured memory_bytes: 106224
N,W=map(int,input().split())
w=[0 for i in range(N)]
v=[0 for i in range(N)]
t=[[] for i in range(4)]
for i in range(N):
    w[i],v[i]=map(int,input().split())
    t[w[i]-w[0]].append(v[i])
for i in range(4):
    t[i].sort(reverse=True)
ans=0
s=[[0 for j in range(len(t[i])+1)] for i in range(4)]
for i in range(4):
    for j in range(1,len(t[i])+1):
        s[i][j]=s[i][j-1]+t[i][j-1]
for a0 in range(len(s[0])):
    for a1 in range(len(s[1])):
        for a2 in range(len(s[2])):
            for a3 in range(len(s[3])):
                tmp=s[0][a0]+s[1][a1]+s[2][a2]+s[3][a3]
                wt=a0*w[0]+a1*(w[0]+1)+a2*(w[0]+2)+a3*(w[0]+3)
                if wt>W:
                    continue
                if ans<tmp:
                    ans=tmp
print(ans)


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

using namespace std;


int main()
{
  long long a, n, b, res;

  cin>>n;

  a = (int)sqrt((double)n);
  b = a;

  while(1){
    if(n%a == 0){
      res = a + n/a - 2;
      break;
    }
    a--;

  }

  printf("%lld\n", res);

  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define REP(i,n) for(int i=0;i<n;++i)
#define REP1(i,n) for(int i=1;i<=n;++i)
#define SZ(i) int(i.size())
#define eb emplace_back
#define ALL(i) i.begin(),i.end()
#define X first
#define Y second
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"#%d: %s = ",__LINE__,#__VA_ARGS__),_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
template<typename It> ostream& _printRng(ostream &os,It bg,It ed)
{
    os<<"{";
    for(It it=bg;it!=ed;it++) {
        os<<(it==bg?"":",")<<*it;
    }
    os<<"}";
    return os;
}
template<typename T> ostream &operator << (ostream &os,vector<T> &v){return _printRng(os,v.begin(), v.end());}
template<typename T> void pary(T bg, T ed){_printRng(cerr,bg,ed);cerr<<endl;}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#define pary(...)
#endif

const int MAXN = 100005;
const ll MOD = 1000000007;

int n, m;
bool dired[MAXN];
int G[MAXN];

vector<int> edge[MAXN], tree[MAXN];
vector<int> seq;

int cnt[MAXN];

bool vis[MAXN];
void span (int nd, int par) {
    vis[nd] = true;
    for (auto v : edge[nd]) {
        int u = G[v] ^ nd;
        if (!vis[u]) {
            tree[nd].eb(u);
            span(u, nd);
        }
    }
    seq.eb(nd);
}


/*********************GoodLuck***********************/
int main () {
    IOS();

    cin >> n >> m;
    REP (i, m) {
        int u, v;
        cin >> u >> v;
        G[i] = u ^ v;

        edge[u].eb(i);
        edge[v].eb(i);
    }

    if (m & 1) {
        cout << -1 << endl;
    } else {
        span(1, -1);

        for (auto v : seq) {
            for (auto u : edge[v]) {
                if (!dired[u]) {
                    if (cnt[v] & 1) {
                        cout << v << " " << (G[u]^v) << endl;
                        cnt[v]++;
                    } else {
                        cout << (G[u]^v) << " " << v << endl;
                        cnt[G[u]^v]++;
                    }
                }
                dired[u] = true;
            }
        }
    }
}


Measured memory_bytes: 20092
# E
s = list(input())
N = len(s)
res = True
if s[0] == "0" or s[N-1] == "1":
    res = False
for i in range(N-1):
    if s[i] != s[N-2-i]:
        res = False
if res == False:
    print(-1)
else:
    k = 1
    for i in range(N-1):
        if s[i] == "1":
            while k < i+1:
                print(str(k)+" "+str(i+1))
                k += 1
    while k < N:
        print(str(k)+" "+str(N))
        k += 1

Measured memory_bytes: 5152
#include<iostream>
#include<algorithm>
using namespace std;
    int n;
    int a[100000];
    int b[100000];
    int c[100000];//over
    int d[100000];//need

    int last=0;

int delneed(int k,int val){
    while(val>0){
        if(c[k]>val){
            c[k]-=val;
            val=0;
            last=1;
        }else if(c[k]==val){
            c[k]=0;
            val=0;
            k--;
            last=0;
        }else if(c[k]>0){
            val-=c[k];
            c[k]=0;
            k--;
            last=0;
        // }else if(c[k]==0){
        //     k--;
        }else{
            return -1;
        }
        //cout<<c[k]<<"  "<<k<<endl;
    }
    return k;
}

int main(){


    cin>>n;

    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];

        c[i]=a[i]-b[i];
        d[i]=b[i]-a[i];
    }

    sort(c,c+n);
    //sort(d,d+n);

    int k=n-1;
    int nd=0;
    int tmp;
    for(int i=0;i<n;i++){
        if(d[i]>0){
            nd++;
            if((k=delneed(k,d[i])) == -1){
                cout<<-1<<endl;
                return 0;
            }
        }
    }
    //cout<<nd<<"  s "<<(n-k-1)<<endl;
    cout<<nd + (n-k-1) + last <<endl;
    return 0;
}

Measured memory_bytes: 1792
struct MyIo{

}

impl MyIo{
    fn readline()->Vec<String>{
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let ret:Vec<String> = buf.split_whitespace().map(|c|c.to_string()).collect();
        ret
    }
}


fn main() {
    let mut input = MyIo::readline().into_iter();
    let A = input.next().unwrap().parse::<u64>().unwrap();
    let B = input.next().unwrap().parse::<u64>().unwrap();


    let yes = "Yay!";
    let no = ":(";

    if A<9 && B<9{
        println!("{}",yes);
    }else{
        println!("{}",no);
    }

}


Measured memory_bytes: 4352
#include <stdio.h>
int main(void){
    int N;
    int i;
    int a[100001];
    int b[100001];
    long long int count = 0;
    scanf("%d",&N);
    for (i = 0; i < N + 1; i++){
        scanf("%d",&a[i]);
    }
    for (i = 0; i < N; i++){
        scanf("%d",&b[i]);
    }
    for (i = 0; i < N; i++){
        //  怪物の数より倒せる数のほうが多い場合
        if (a[i] <= b[i]){
            count = count + a[i];
            b[i] = b[i] - a[i];
            //  次の町の怪物の数より倒せる数のほうが多い場合
            if (a[i + 1] <= b[i]){
                count = count + a[i + 1];
                a[i + 1] = a[i + 1] - b[i];
                if (a[i + 1] < 0){
                    a[i + 1] = 0;
                }
            //  次の町の怪物の数より倒せる数が少ない場合
            }else{
                count = count + b[i];
                a[i + 1] = a[i + 1] - b[i];
                b[i] = 0;
            }
        //  怪物の数より倒せる数のほうが少ない場合
        }else{
            count = count + b[i];
            b[i] = 0;
        }
    }
    printf("%lld",count);
    
}


Measured memory_bytes: 896
#include<stdio.h>
#define N 100000
#define NIL -1
 
struct Node{
  int p, l, r;
};
 
struct Node T[N];
int n, H=0, D[N];
 
int getDepth(int);
void print(int);
 
int main(){
  int i, j, d, v, c, l;   
  scanf("%d", &n);   
  for ( i = 0; i < n; i++ ){
    T[i].p = T[i].l = T[i].r = NIL;
  }
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &v, &d);
    for ( j = 0; j < d; j++ ){
      scanf("%d", &c);
      if ( j == 0 ){
	T[v].l = c;
      }
      else{
	T[l].r = c;
      }
      l = c;
      T[c].p = v;      
    }
  }
  for ( i = 0; i < n; i++ ){
    D[i] = getDepth(i);
    if ( D[i] > H ){
      H = D[i];
    }
  }  
  for ( i = 0; i < n; i++ ){
    print(i);
  }
  return 0;
}

int getDepth(int i){
  int a = 0;
  while(1){
    i = T[i].p;
    if ( i == NIL ) {
      break;
    }
    a++;
  }
  return a;
}

void print(int i){
  int j, c;
  printf("node %d: parent = %d, depth = %d, ",i,T[i].p,D[i]);
  if ( T[i].p == NIL ){
    printf("root, ");
  }
  else if ( T[i].l == NIL ){
    printf("leaf, ");
  }
  else{
    printf("internal node, ");
  }
  printf("[");
  for(j = 0, c = T[i].l; c != NIL; j++, c = T[c].r){
    if (j) {
      printf(", ");
    }
    printf("%d", c);
  }
  printf("]\n");
}

Measured memory_bytes: 2176
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
      
def main():
  n,m = map(int,input().split())
  u = UnionFind(n)
  
  for _ in range(m):
    x,y,_ = map(int,input().split())
    u.union(x-1,y-1)
  print(u.group_count())
  
if __name__ == "__main__":
  main()



Measured memory_bytes: 7856
H, W = map(int, input().split())
A = [list(map(int, input().split())) for i in range(H)]
B = [list(map(int, input().split())) for i in range(H)]

C = [[abs(A[i][j] - B[i][j]) for j in range(W)] for i in range(H)]
M = (H+W)*80

dp = [[0 for j in range(W)] for i in range(H)]

for i in range(H):
    for j in range(W):
        if i == 0:
            if j == 0:
                dp[i][j] = (1 << M) << C[i][j]
            else:
                dp[i][j] |= dp[i][j-1] >> C[i][j]
                dp[i][j] |= dp[i][j-1] << C[i][j]

        else:
            if j != 0:
                dp[i][j] |= dp[i][j-1] >> C[i][j]
                dp[i][j] |= dp[i][j-1] << C[i][j]

            dp[i][j] |= dp[i-1][j] >> C[i][j]
            dp[i][j] |= dp[i-1][j] << C[i][j]

dp = bin(dp[i][j])[2:]
dp = dp[::-1]
ans = M
for i, x in enumerate(dp):
    if x == "1":
        ans = min(ans, abs(i - M))

print(ans)


Measured memory_bytes: 20596
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,m;
  bool can=true;
  cin >> n >> m;
  ll a[m],b[m],cnt[n];
  fill(cnt,cnt+n,0);
  for(int i=0;i<m;i++){
    cin >> a[i]>>b[i];
    a[i]--;
    b[i]--;
    cnt[a[i]]++;
    cnt[b[i]]++;
  }
  for(int i=0;i<n;i++){
    if(cnt[i]%2!=0){
      can=false;
      break;
    }
  }
  if(can) cout <<"YES\n";
  else cout <<"NO\n";
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string s="aiueo";
    string t;
    cin>>t;
    bool f=false;
    for(int i=0;i<5;i++){
        if(s[i]==t[0]){
            f=true;
        }
    }
    if(f){
        cout<<"vowel"<<endl;
    }else{
        cout<<"consonant"<<endl;
    }
}


Measured memory_bytes: 256
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    currency = 1000
    stock = 0
    for i in range(n - 1):
        currency += A[i] * stock
        stock = 0
        if A[i + 1] > A[i]:
            stock, currency = divmod(currency, A[i])
    print(currency + A[-1] * stock)
resolve()

Measured memory_bytes: 61924
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
t=sum(a)

for i in range(n):
    if b[i]-a[i]>=0:
        a[i+1]-=(b[i]-a[i])
        if a[i+1] < 0:
            a[i+1]=0
        a[i]=0
    else:
        a[i]-=b[i]


ans=t-sum(a)        
        
print(ans)

Measured memory_bytes: 18468
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int time = m * 1900 + (n - m) * 100;
        System.out.println(time * (int)Math.pow(2, m));
    }
}

Measured memory_bytes: 21588
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)
#define MOD (1e9+7)

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll beki(ll a, ll b) {
	ll tmp = 1;
	REP(i, b) tmp *= a;
	return tmp;
}

int N;
int d[100010];

int main() {
	cin >> N;
	REP(i, N) cin >> d[i];
	sort(d, d + N);
	int l = N / 2 - 1, r = N / 2;
	cout << d[r] - d[l] << endl;
}

Measured memory_bytes: 640
import java.util.*;
class Main {
	static Integer sup[]=new Integer[10000001];
	static void sol(){
		int i,j;
		for(i=0;i<10000001;i++)
		sup[i]=i;
		for(i=4;i<10000001;i+=2)
		sup[i]=2;
		for(i=3;i*i<10000001;i++){
			if(sup[i]==i){
				for(j=i*i;j<10000001;j+=i){
					if(sup[j]==j)sup[j]=i;
				}
			}
		}
	}
	static int nofac(int n){
	    if(n==1)return 1;
	    int ans = 1;
	    int y = sup[n];
	    int cnt = 1;
	    int j = n / y;
	    while (j != 1) {
	        if (sup[j] == y)
	            cnt ++;
	        else {
	            y = sup[j];
	            ans = ans*(cnt + 1);
	            cnt = 1;
	        }
	        j = j / sup[j];
	    }
	    ans = ans *(cnt + 1);
	    return ans;
	}

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		sol();
		int ans=0;
        for(int i=1;i<=n-1;i++){
            ans+=nofac(n-i);
        }
        System.out.println(ans);

	}

}


Measured memory_bytes: 243620
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n,m;
  cin>>n>>m;

  vector<int> as(n),bs(n);
  if(n&1){
    for(int i=0;i<n;i++) as[i]=i,bs[i]=(n-1)-i;
  }else{
    for(int i=0;i<n;i++) as[i]=i,bs[i]=(n-1)-i;
    for(int i=n/4;i<n;i++) as[i]=i,bs[i]=(n-2)-i;
  }

  for(int i=0;i<m;i++) cout<<as[i]+1<<' '<<bs[i]+1<<newl;
  return 0;
}


Measured memory_bytes: 4456
N = int(input())
a = list(map(int, input().split()))


min_cost = -1
for i in range(-100, 101):
  cost = 0
  for k in range(N):
    cost += (i - a[k])**2
  if min_cost == -1:
    min_cost = cost
  else:
    min_cost = min(min_cost, cost)

print(min_cost)


Measured memory_bytes: 39024
#define MOD 1000000007
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ll N, K, Q; cin >> N >> K >> Q;
    vector<ll> point(N, K - Q);
    for (int i = 0; i < Q; i++)
    {
        int a; cin >> a;
        point[a-1]++;
    }
    for (ll p : point)
    {
        if (p > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int arr[3];
    for (int i = 0; i < 3; i++) {
        cin >> arr[i];
    }

    swap (arr[0], arr[1]);
    swap (arr[0], arr[2]);

    for (int i = 0; i < 3; i++) {

        cout << arr[i] << " ";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  string s;
  cin >> s;
  if(s[0] == '9' || s[1] == '9')cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

using namespace std;

int n, t, c[105], f[105];

int main() {
    cin >> n >> t;
    for(int i = 1; i <= n; i++)
        cin >> c[i] >> f[i];
    int mn = INT_MAX;
    for(int i = 1; i <= n; i++) {
        if(f[i] <= t)
            mn = min(mn, c[i]);
    }
    if(mn == INT_MAX)
        cout << "TLE";
    else
    cout << mn;
}


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

fn main() {
    let n: usize = read();
    let p: Vec<usize> = (0..n).map(|_| read::<usize>() - 1).collect();

    let mut r: Vec<i64> = vec![0; n];
    for i in 0..n {
        r[p[i]] = (i + 1) as i64;
    }

    let a: Vec<i64> = (0..n).map(|i| (i + 1) as i64 * 30000).collect();
    let b: Vec<i64> = (0..n).map(|i| (n - i - 1) as i64 * 30000 + r[i]).collect();
    for i in 0..n {
        if i != 0 {
            print!(" ");
        }
        print!("{}", a[i]);
    }
    println!();
    for i in 0..n {
        if i != 0 {
            print!(" ");
        }
        print!("{}", b[i]);
    }
    println!();
}

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")
}


Measured memory_bytes: 4732
import Control.Monad

main = do
  n <- read <$> getLine
  forM_ (loop n) $ \str -> putStrLn str

 where
   loop :: Int -> [String]
   loop 1 =  ["a"]
   loop n = [prev ++ [new] | prev <- loop (n-1), new <- take n ['a'..], new=='a' || (pred new) `elem` prev]-- ++ [take n ['a'..]]

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#define ALL(a) (a).begin(),(a).end()

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>que;

int main() {
  ll N,M;
  cin>>N>>M;

  ll ko[N];
  ll flag[N];

  FOR(i,0,N-1){
    ko[i]=1;
    flag[i]=0;
  }
  flag[0]=1;

  FOR(i,0,M-1){
    ll tp1,tp2;
    cin>>tp1>>tp2;
    
    ko[tp1-1]--;
    ko[tp2-1]++;
    if(flag[tp1-1]==1)flag[tp2-1]=1;
    if(ko[tp1-1]==0)flag[tp1-1]=0; 


  }



  ll ans=0;
  FOR(i,0,N-1){
    if(flag[i]==1)ans++;
  }

  cout<<ans<<endl;



return 0;
 
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
	int n;
	cin >> n;
	vector<int> c(n), s(n), f(n);
	f[n - 1] = 1;
	rep(i, n - 1)	cin >> c[i] >> s[i] >> f[i];
	for(int i = 0; i < n; ++i){
		int time = s[i];
		for(int j = i; j < n; ++j){
			if(time < s[j])	time = s[j];
			if(time % f[j]) time += f[j] - time % f[j];
			time += c[j];
		}
		cout << time << endl;
	}
}


Measured memory_bytes: 256
// 自分の得意な言語で
// Let's チャレンジ！！

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  var a = lines[0];
  var s = lines[1];
  if(a >= 3200) {
    console.log(s);
  } else {
    console.log('red');
  }
})

Measured memory_bytes: 17096
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(8);
    int n; cin >> n;
    if (n % 2 == 0) {
        cout << double(0.500000000000)<< endl;
    }    
    else cout << double((n+1.000000000000)/(2*n)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,d,ans,A[100][100];
bool mark[1000005];
int main(){
	scanf("%d%d",&n,&d);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=d;j++){
			scanf("%d",&A[i][j]);
		}
	}
	for(int i=1;i<=1000;i++)mark[i*i]=1;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			int s=0;
			for(int k=1;k<=d;k++)s+=(A[i][k]-A[j][k])*(A[i][k]-A[j][k]);
			if(mark[s])ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

long long memo[11];

long long mm(int n){
    if (n==2) return memo[2]=11;
    else if(memo[n]!=0) return memo[n];
    else return memo[n]=mm(n-1)*10+pow(2,n-2);
}

long long kai(queue<int> s){
    int N=s.size();
    int f=s.front();
    if(N==1) return f;
    else{
        s.pop();
        return 2*kai(s)+f*mm(N);
    }
}

int main(){
    string S;
    cin>>S;
    queue<int> data;
    for(int i=0;i<S.size();i++) {
        data.push(S.at(i)-'0');
    }
    cout<<kai(data)<<endl;
}

Measured memory_bytes: 384