akhauriyash/Code-Regression huggingface dataset:
use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let n = get!(usize);
    let mut v = Vec::new();
    for _ in 0..n {
        let mut tmp: Vec<char> = get!(String).chars().collect();
        tmp.sort();
        let tmp2: String = tmp.into_iter().collect();
        v.push(tmp2);
    }
    // eprintln!("{:?}", v);
    let mut map = HashMap::new();
    let mut ans: u64 = 0;
    for i in 0..n {
        let counter = map.entry(v[i].clone()).or_insert(0);
        ans += *counter;
        *counter += 1;
    }
    // eprintln!("{:?}", map);
    println!("{}", ans);
}


Measured memory_bytes: 19996
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
int n;
int a;
int vis[1000011]={0};
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",&a);
		vis[a+1]++;
		vis[a]++;
		vis[a+2]++;
	}
	int maxx=0;
	for(int i=0;i<=100005;i++){
	    maxx=max(maxx,vis[i]);
	}
	cout<<maxx;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    ll n,m,k,a,b,x,y;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;

    cin>>n;

    cout<<"0"<<" "<<"0"<<" ";

    b = 1;

    if(n%1000000000)x = 1000000000-(n%1000000000);
    else x = 0;

    a = 1000000000;

    y = (n+b*x)/a;

    cout<<a<<" "<<b<<" ";
    cout<<x<<" "<<y<<" ";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 200005;
const int MM = 1000000007;

int N, M;
vector<int> G[MX];
int chk[MX];

int main()
{
	ll K;
	scanf("%lld", &K);
	printf("50\n");
	for(int i = 0; i < K%50; i++) printf("%lld ", K/50+50);
	for(int i = K%50; i < 50; i++) printf("%lld ", K/50+50 - K%50-1);
	printf("\n");
}



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

int main() {
	int n, W;
	cin >> n >> W;
	vector<int> w(n+1), v(n+1);
	for (int i = 0; i < n; i++) {
		cin >> w[i] >> v[i];
	}
	vector<vector<long long>> dp(n+1, vector<long long>(W+1));
	for (int i = 0; i < n; i++) {
		for (int j = W; j >= 0; j--) {
			dp[i+1][j] = dp[i][j];
			if (j + w[i] <= W) {
				dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]], dp[i][j] + v[i]);
			}
		}
	}
	cout << dp[n][W] << endl;
}

Measured memory_bytes: 80256
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};
const main=()=>{
  to(ceil(tn()/2)-1)
}
main()


Measured memory_bytes: 7372
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll a,b;

int main(void){
	scanf("%lld%lld",&a,&b);
	if(b<0){
		ll cnt=b-a;
		printf("%s\n",cnt%2LL==0?"Negative":"Positive");
	}else if(b==0){
		printf("Zero\n");
	}else{
		if(a<=0){
			printf("Zero\n");
		}else{
			printf("Positive\n");
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int n, k;
int main()
{
    cin >> n;
  cin >> k;
    int h[n];
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    int count;
    for (int i = 0; i < n; i++)
    {
        if (h[i] >= k)
        {
            count += 1;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 640
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール
// ランレングス圧縮 O(N)
template <class RandomAccessIterator>
vector<ll> run_length(RandomAccessIterator first, RandomAccessIterator last) {
    vector<ll> rl;
    for (RandomAccessIterator itr = first; itr != last; ) {
        RandomAccessIterator jtr = itr++;
        while ((itr != last && *itr == *(itr-1))) itr++;
        rl.push_back(itr - jtr);
    }
    return rl;
}

// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n; cin >> n;
    string s; cin >> s;

    cout << run_length(ALL_OF(s)).size() << endl;
    
}

Measured memory_bytes: 1480
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
//コンビネーションを10^9+7で割った余りを求める
const int MOD=1000000007;
int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<int>> c(h,vector<int> (w));
    bool p=false;
    rep(i,h){
        rep(j,w){
            cin>>c[i][j];
        }
    }
    int l=0,r=0;
    int ans=0;
    string s="";
    while(1){
        
        if(c[l][r]%2!=0 && !p){
            p=true;
            if(l==h-1 && h%2==0 && r==0){}
            else if(l==h-1 && h%2==1 && r==w-1){}
            //cout<<l+1<<" "<<r+1<<" ";
            else{
                s+=to_string(l+1)+" "+to_string(r+1)+" ";
            }
        }
        else if(c[l][r]%2==0 && p){
            //cout<<l+1<<" "<<r+1<<endl;
            ans++;
            if(l==h-1 && h%2==0 && r==0 || l==h-1 && h%2==1 && r==w-1){
                s+=to_string(l+1)+" "+to_string(r+1)+"\n";
                break;
            }
            s+=to_string(l+1)+" "+to_string(r+1)+"\n";

            s+=to_string(l+1)+" "+to_string(r+1)+" ";
            //cout<<l+1<<" "<<r+1<<" ";
        }
        else if(c[l][r]%2!=0 && p){
            p=false;
            //cout<<l+1<<" "<<r+1<<endl;
            s+=to_string(l+1)+" "+to_string(r+1)+"\n";
            ans++;
        }
        else{//c[l][r]が偶数でコインを持ってない

        }
        
       //cout<<l<<" "<<r<<endl;
       if(l==h-1 && h%2==0 && r==0){
           break;
       }
       if(l==h-1 && h%2==1 && r==w-1){
           break;
       }
        if(r==w-1 && l%2==0){
            l++;
            continue;
        }
        if(r==0 && l%2==1){
            l++;
            continue;
        }
        if(l%2==0){
            r++;
        }
        else{
            r--;
        }
    }
    cout<<ans<<endl;
    cout<<s;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
#define pow10(n) int(1e##n + n)

int N;

void rec(string s, char mx)
{
    if (s.length() == N)
    {
        cout << s << endl;
        return;
    }
    for (char c = 'a'; c <= mx; c++)
    {
        rec(s + c, (c == mx ? char(c + 1) : mx));
    }
};

void solve()
{
    cin >> N;

    rec(""s, 'a');
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double llf;
typedef pair<int, int> pii;
const int maxn = 5e2 + 5;
const int inf = 2e9 + 7;
int a[maxn], b[maxn];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	deque<char>q;
	string s;
	int t, cnt = 0;
	cin >> s >> t;
	for (int i = 0; i < s.size(); ++i)q.push_back(s[i]);
	while (t--) {
		int op, pos;
		cin >> op;
		if (op == 1)cnt++;
		else {
			char c;
			cin >> pos >> c;
			if (pos == 1 && cnt % 2 == 0 || pos == 2 && cnt % 2 == 1)q.push_front(c);
			else q.push_back(c);
		}
	}
	if (cnt % 2 == 1)for (int i = q.size() - 1; i >= 0; --i)cout << q[i];
	else for (int i = 0; i < q.size(); ++i)cout << q[i];

	return 0;
}


Measured memory_bytes: 976
/**
 * 	author: krayr
 * 	created: 18.05.2019
**/

#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
#define mp make_pair
#define forn(i, s, n) for(int i = s; i < int(n); i++)

typedef long long ll;
//~ const double pi = 2*acos(0.0);
//~ const long long mod = 1e9+7;
//~ const int MAX_N = 1e6+5;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
       
    #ifdef _DEBUG
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
	int n; cin >> n;
	vector<int> vec(n);
	
	forn(i, 0, n) cin >> vec[i];
	
	sort(vec.begin(), vec.end());
	
	
	for(int i = vec[1]; i > 0; i--){
		int c = 0;
		for(int j = 0; j < n; j++){
			if(vec[j] % i != 0) c++;
		}
		
		if(c < 2){
			cout << i << "\n";
			break;
		}
	}
    

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ford(i,a,b) for(int i=(a);i>=b;i--)
#define rep(i,a,b) for(int i=(a);(i)<=(b);(i)++)
#define ll long long
#define mp map<int,int>
#define N 100005
using namespace std;
int a[N],ans[N];
int main() {
	int n;
	cin>>n;
	rep(i,1,n) cin>>a[i];
	rep(i,1,n)
		if(i%2==1)ans[1]+=a[i];
		else ans[1]-=a[i];
	cout<<ans[1]<<" ";
	rep(i,2,n) {
		ans[i]=a[i-1]*2-ans[i-1];
		cout<<ans[i]<<" ";
	}
	return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define MAX 3001
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define Mod 1000000007
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
using namespace __gnu_pbds; 
using namespace std;

typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> new_data_set; 

double p[MAX];
double dp[MAX][MAX];
ll total;
double f(ll index,ll req){
	if(req==0) return 1;
	if(index==total && req<=0){
		return 1;
	}else if(index==total) return 0;
	if(dp[index][req]>=0) return dp[index][req];
	// cout<<p[index]<<endl;
	double first = f(index+1,req)*(1.0-p[index]);
	double second = f(index+1,req-1)*(p[index]);
	dp[index][req]=first+second;
	// return first+second;
	return dp[index][req];
}

int main(){
	ios_base::sync_with_stdio(false);
	For(i,0,MAX) For(j,0,MAX) dp[i][j]=-1; 
	ll n;cin>>n;total=n;
	For(i,0,n) cin>>p[i];
	cout<<setprecision(10)<<fixed;
	cout<<f(0,n/2+1)<<endl;
}


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

 
int main(){
   int n;
    cin>>n;
    vector<string>v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    int fl=0;
    map<string ,int>m;
    for(int i=0;i<n;i++){
        if(i==0)
            m[v[i]]++;
        else{
            if(m.find(v[i])!=m.end())
                fl=1;
            if(v[i][0]!=v[i-1][v[i-1].size()-1])
                fl=1;
            m[v[i]]++;
        }
    }
    if(fl==0)
        cout<<"Yes";
    else cout<<"No";
    cout<<endl;
    
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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; }

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }




string S;
int main() {
    while (cin >> S) {
        bool ok = true;
        for (int i = 0; i < S.size(); ++i) {
            if (i & 1) {
                if (S[i] == 'R') ok = false;
            }
            else {
                if (S[i] == 'L') ok = false;
            }
        }
        if (ok) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


















Measured memory_bytes: 256
import math
def num_divisors_trial_division(n):
    num = 0
    for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
    
    return num

N = int(input())
if N == 105:
    print("1")
    exit()
elif N < 105:
    print("0")
    exit()
lists = []
cnt = 1
for i in range(106,N+1):
    if i % 2 == 1:
        if num_divisors_trial_division(i) == 8:
            cnt += 1
print(cnt)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int,input().split()))

def nc2(x): return x*(x-1)//2
dic = {i+1:0 for i in range(N)}
for a in A: dic[a] += 1

tmp = 0
for i in range(N):
    tmp += nc2(dic[i+1])

for i in range(1,N+1):
    print(tmp-dic[A[i-1]]+1)

Measured memory_bytes: 38524
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BCountingRoads {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, m;
	    in >> n >> m;
	    vector<int> ab[n];
	    int a, b;
	    for(int i=0; i<m; i++){
            in >> a >> b;
            a--; b--;
            ab[a].push_back(b);
            ab[b].push_back(a);
	    }

	    for(int i=0; i<n; i++){
	        out << ab[i].size() << endl;
	    }
	}
};


int main() {
	BCountingRoads solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true){
			long n = Long.parseLong(br.readLine());
			long newNumber = n;
			
			if(n == 0){
				break;
			}
			
			int[] digits = new int[10];
			int i = 9;
			while(n > 0){
				digits[i] = (int)(n % 8);
				if(digits[i] >= 4){
					digits[i]++;
				}
				if(digits[i] >= 6){
					digits[i]++;
				}
				n /= 8;
				i--;
			}
			
			boolean start = false;
			for(i = 0; i < 10 ; i++){
				if(!start && digits[i] != 0){
					start = true;
				}
				if(start){
					System.out.print(digits[i]);
				}
			}
			System.out.println();
		}
	}

}

Measured memory_bytes: 44168
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	h := make([]int, n)
	good := make([]bool, n)
	for i := 0; i < n; i++ {
		h[i] = nextInt()
		good[i] = true
	}
	for i := 0; i < m; i++ {
		ai := nextInt() - 1
		bi := nextInt() - 1
		if h[ai] > h[bi] {
			good[bi] = false
		} else if h[ai] < h[bi] {
			good[ai] = false
		} else {
			good[ai] = false
			good[bi] = false
		}
	}
	ans := 0
	for i := 0; i < n; i++ {
		if good[i] {
			ans++
		}
	}
	fmt.Println(ans)
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}


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

int main(){
   long long int n;
   cin >> n;
   long long int res=0;
   for(long long int i=1;i<=n;i++){
       if(i%3==0){
       }else if(i%5==0){
       }else{
           res+=i;
       }
   }
   cout << res << endl;
}

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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);

template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }

PII solve(string s) {
    int n = s.size();
    rep(i, n - 1) {
        if (s[i] == s[i + 1]) {
            return MP(i + 1, i + 2);
        }
    }
    rep(i, n - 2) {
        if (s[i] == s[i + 2]) {
            return MP(i + 1, i + 3);
        }
    }
    return MP(-1, -1);
}

int main(void) {
    string s = in<string>();
    auto ans = solve(s);
    cout << ans.fst << " " << ans.snd << endl;

    return 0;
}



Measured memory_bytes: 512
n = int(input())
marks = []
markd = []
markc = []
markh = []

for i in range(n):
    mark, number = input().split()
    if mark == 'S':
        marks.append(number)
    elif mark == 'D':
        markd.append(number)
    elif mark == 'C':
        markc.append(number)
    else:
        markh.append(number)

for i in range(1, 14, 1):
    nums = str(i)
    if nums not in marks:
        print('S', nums)

for i in range(1, 14, 1):
    numh = str(i)
    if numh not in markh:
        print('H', numh)

for i in range(1, 14, 1):
    numc = str(i)
    if numc not in markc:
        print('C', numc)
        
for i in range(1, 14, 1):
    numd = str(i)
    if numd not in markd:
        print('D', numd)

        


Measured memory_bytes: 5604
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
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; }
using namespace std;

int N;
double v[1010];

int main() {
    cin >> N;
    rep(i, N) cin >> v[i];
    sort(v, v+N);

    rep(i, N-1) {
        v[i + 1] = (v[i] + v[i + 1]) / 2;
    }
    cout << setprecision(16) << v[N-1] << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const long long LINF = 1000000000000000018ll;
const int INF = 1000000009;
const int mod = 1000000007;
const int mod2 = 998244353;

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

int main() {
  std::cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::setprecision(20) << std::fixed;

  int N, M;
  cin >> N >> M;

  vector<vector<int>> G(N);
  vector<long long> H(N);

  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }

  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    G[A - 1].push_back(B - 1);
    G[B - 1].push_back(A - 1);
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    bool is_ok = true;
    for (int j = 0; j < (int)G[i].size(); j++) {
      int adj = G[i][j];
      if (H[i] <= H[adj]) {
        is_ok = false;
      }
    }
    if (is_ok) {
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 9272
#define M 99999
T[M+1],t[M/2];main(i,j,m,a,b,p,q){
for(i=2;i<=M;i++)if(!T[i])for(j=i*2;j<=M;j+=i)T[j]=1;
for(i=2,j=0;i<=M;i++)if(!T[i])t[j++]=i;
for(;scanf("%d%d%d",&m,&a,&b),m;printf("%d %d\n",p,q))for(i=0;;i++)if(t[i]*t[i]>m)i=-1,m--;else if(p=t[i],q=m/t[i],p*q==m&&!T[q]&&a*q<=b*p)break;
exit(0);}

Measured memory_bytes: 1028
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <map>
#include <vector>
#include <cstring>
using namespace std;
typedef long long ll;
int main(){
	int m,d;
	scanf("%d%d",&m,&d);
	int ans=0;
	for(int d1=2;d1<=9;d1++){
		for(int d10=2;d10<=9;d10++){
			if(d1*d10<=m && d10*10+d1<=d){
				ans++;
			}
		}
	}
	printf("%d\n",ans);
	
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	ll n; cin >> n;
	ll sum = 0;
	ll cop = n;
	ll cnt = 0; ll chk;
	while (n) {
		cnt++;
		chk = n % 10;
		sum += n % (ll)10; n /= (ll)10;
	}
	cnt--;
	cout << max(sum, (ll)9 * cnt + chk-(ll)1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);
int main(){
    int d;cin>>d;
    ll c[26];
    rep(i,26)cin>>c[i];
    ll s[d][26];
    rep(i,d)rep(j,26)cin>>s[i][j];
    ll t[d];
    ll v=0;
    vi pas(26,0);
    vi shoki(d);
    int today =0;
    rep(i,d){
        ll ma =-INFL;
        ll p =-1;
        rep(j,26){
            if(ma<s[i][j]){
                ma=s[i][j];
                p=j;
            }
        }
        t[i]=p;
    }
    rep(i,d)cout<<t[i]+1<<endl;
    rep(i,d){
        v+=s[i][t[i]];
        pas[t[i]]=i+1;
        rep(j,26){
            if(j==t[i])continue;
            v-=c[j]*(i+1-pas[j]);
        }
    }

}

Measured memory_bytes: 3708
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	a := make([]int, n)
	b := make([]int, n)
	c := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
		sc.Scan()
		b[i], _ = strconv.Atoi(sc.Text())
		sc.Scan()
		c[i], _ = strconv.Atoi(sc.Text())
	}

	dp := make([][3]int, n+10)
	dp[0][0] = a[0]
	dp[0][1] = b[0]
	dp[0][2] = c[0]
	for i := 1; i <n; i++ {
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i]
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i]
		dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i]
	}
	fmt.Println(max(dp[n-1][0],dp[n-1][1], dp[n-1][2]))
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}


Measured memory_bytes: 8332
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// ABC043 B - バイナリハックイージー
// 2020.06.15

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S; cin >> S;
  int N = S.size();
  string ans;
  REP(i, N){
    if(S[i] == '0') ans.push_back('0');
    if(S[i] == '1') ans.push_back('1');
    if(S[i] == 'B' && ans.size() != 0) ans.erase(ans.size()-1);
  }
  cout << ans << endl;
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mp(v1, v2)       make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------
int main(void) {
  while(1){
    int n, x;
    cin >> n >> x;
    if(n==0) return 0;
    int ans = 0;
    REP(i,1,n-1){
      REP(j,i+1,n){
        REP(k,j+1,n+1){
          if(i+j+k==x) ans++;
        }
      }
    }
    prt(ans);
  }
}



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

using namespace std;

long long cost(vector<int> X, int p) {
    long long ans = 0;
    for (auto x : X) {
        ans += (x - p) * (x - p);
    }
    return ans;
}

int main() {
    long long X;
    cin >> X;
    for(int i = 1 ; i <= 50000 ; i++){
        if( i * 108 / 100 == X ){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
}

Measured memory_bytes: 256
n,y = map(int, input().split())
 
 
a,b,c = -1,-1,-1
 
for ai in range(n+1):
 
    if ai*1000>y:
        break
 
#    if ai * 1000 == y:
#        a,b,c = ai,0,0
#        break
 
    remain = n-ai
    for bi in range(remain+1):
        ci = remain - bi
        
        if y == ai * 1000 + bi * 5000 + ci * 10000:
            a,b,c = ai,bi,ci
 
print('{} {} {}'.format(c,b,a))
 

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,int> PP;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,M,S,T;
    cin >> N >> M;
    vector<int> G[N];
    rep(i,0,M){
        int u,v;
        cin >> u >> v;
        G[u-1].push_back(v-1);
    }
    cin >> S >> T;
    S--,T--;
    vector< vector<int> > dist (N, vector<int>(3, INF));
    dist[S][0] = 0;
    queue<P> que;
    que.push(P(S,0));
    while(!que.empty()){
        auto p = que.front();
        que.pop();
        int now = p.first, cnt = p.second;
        for(auto next:G[now]){
            if(dist[now][cnt] + 1 >= dist[next][(cnt+1)%3])continue;
            dist[next][(cnt+1) % 3] = dist[now][cnt] + 1;
            que.push(P(next, (cnt+1) % 3) );
        }
        //cout << p.first << " " << p.second  << endl;
    }
    if(dist[T][0] == INF)cout << -1 << endl;
    else cout << dist[T][0] / 3<< endl;
}

Measured memory_bytes: 11136
#include<iostream>
#include<string>
using namespace std;
int main() {
	int a, b;
	char ss;
	string s;
	cin >> a >> s >> b;
	ss = s[b-1];
	for (int i = 0; i < a; ++i) {
		if (s[i] != ss)cout << "*";
		else cout << s[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

void DFS(void);
void DFS_visit(int);

int n, A[N][N], d[N], f[N], color[N], time;

int main()
{
  int i, j, u, k, v;

  scanf("%d",&n);

  for(i = 0; i < n; i++)
    {
      scanf("%d%d",&u,&k);
      u--;
      for(j = 0; j < k; j++)
	{
	  scanf("%d",&v);
	  v--;
	  A[u][v] = 1;
	}
    }

  DFS();

  return 0;
}

void DFS(void)
{
  int u;
  for(u = 0; u < n; u++)
    {
      color[u] = WHITE;
    }
  time = 0;

  for(u = 0; u < n; u++)
    {
      if(color[u] == WHITE)DFS_visit(u);
    }
  for(u = 0; u < n; u++)
    {
      printf("%d %d %d\n",u+1, d[u],f[u]);
    }
}

void DFS_visit(int u)
{
  int v;

  color[u] = GRAY;
  d[u] = ++time;

  for(v = 0; v < n; v++)
    {
      if(A[u][v] == 0)continue;
      if(color[v] == WHITE)DFS_visit(v);
    }
  color[u] = BLACK;
  f[u] = ++time;
}




Measured memory_bytes: 2088
C = []
S = []
F = []

def arrive(time, i):
    times = -(-(time - S[i]) // F[i])
    ans = 0 if times < 0 else times
    return S[i] + F[i] * ans


def solve():
    N = int(input())
    for i in range(N-1):
        c,s,v = map(int, input().split())
        C.append(c)
        S.append(s)
        F.append(v)

    for start_sta in range(N):
        now = 0
        for station in range(start_sta,N-1):
            arr = arrive(now, station)
            now = arr + C[station]
        print(int(now))

solve()


Measured memory_bytes: 3064
N, Y = map(int, input().split())

ans = '-1 -1 -1'
for x in range(N + 1):
    for y in range(N + 1 - x):
        z = N - (x + y)
        if 10000 * x + 5000 * y + 1000 * z == Y:
            ans = '{} {} {}'.format(x, y, z)
            break
print(ans)

Measured memory_bytes: 3060
l = [1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000]
X = int(input())
while 1:
  if X in l:
    print(X)
    break
  X -= 1
  

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

map<ll, int> prime_factor(ll n) {
    map<ll, int> ret;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

int main() {
    ll N; cin >> N;
    ll ans = 0;
    for (auto p : prime_factor(N)) {
        ll x = p.second;
        ll i = 1;
        while (x >= i) {
            x -= i;
            i++;
            ans++;
        }
    }
    cout << ans << endl;
}

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

int calc(int a, char op, int b) {
    int ans = 0;
    if ( op == '+' ){
    ans = a + b ;
    } else if ( op == '-' ){
    ans = a - b ;
    } else if ( op == '*' ){
    ans = a * b ;
    } else if ( op == '/' ){
    ans = a / b ;
    } 
    return ans;
}


int main(){
    int a, b ;
    char op ;
    
    cin >> a >> op >> b ;
    
    do {
        cout << calc(a, op, b) << endl;
        cin >> a >> op >> b ;
    } while ( op != '?' ) ;
    
    return 0 ;
}



Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <string>
using namespace std;

int main()
{   
    int N, X;
    vector<int> L;
    cin >> N >> X;
    int l, n;
    L.push_back(0);
    for(int i = 0; i < N; i++){
        cin >> l;
        L.push_back(l);
    }
    int distance = 0;
    int bound = 0;
    for(int i = 0; i <= N; i++){
        distance += L[i];
        if(distance <= X){
            bound ++;
        } else {
            break;
        }
    }
    cout << bound << endl;

    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,ans=0;
  string a,b,c;
  cin >> n >> a >> b >> c;
  for(int i=0; i<n; i++) {
    if(a[i]!=b[i]&&b[i]!=c[i]&&c[i]!=a[i]) {
      ans+=2;
    }
    else if((a[i]==b[i]&&b[i]!=c[i])||(b[i]==c[i]&&a[i]!=b[i])||(c[i]==a[i]&&a[i]!=b[i])) {
      ans++;
    }
    else if(a[i]==b[i]&&b[i]==c[i]) {
      ans+=0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cmath>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
using namespace std;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define rg register
#define il inline
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define rep0(i,n) for(register int i=0;i<(n);++i)
#define per0(i,n) for(register int i=(n)-1;i>=0;--i)
#define rep(i,st,ed) for(register int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(register int i=(ed);i>=(st);--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &a,const T &b){return a<b?a:b;}
template<typename T> il T qmax(const T &a,const T &b){return a>b?a:b;}
template<typename T> il void getmin(T &a,const T &b){if(a>b) a=b;}
template<typename T> il void getmax(T &a,const T &b){if(a<b) a=b;}
il void fileio(string s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e17+7;
const int N=1e5+7,M=N<<1;

int v[M],nxt[M];
int head[N],deg[N],val[N],n;

il void addedge(int p,int x,int y){
	v[p]=y,nxt[p]=head[x],head[x]=p;
}

il bool dfs(int u,int p){
	if(deg[u]==1) return true;
	ll sum=0;
	vector<ll> a;
	for(int e=head[u];e;e=nxt[e]){
		if(v[e]==p) continue;
		if(!dfs(v[e],u)) return false;
		sum+=val[v[e]];
		a.pb(val[v[e]]);
	}
	ll x=sum-val[u];
//	cerr<<u<<" "<<x<<endl;
	if(x<0||x>val[u]) return false;
	val[u]-=x;
	ll cur=0,rest=0;
	rep0(i,a.size()){
		int num=qmin(rest,a[i]);
		if(num>=x) return true;
		x-=num,a[i]-=num;
		int num2=qmin(cur,a[i]/2);
		if(num2>=x) return true;
		x-=num2,a[i]-=num2*2;
		rest+=a[i],cur+=num+num2;
	}
	return false;
}

int main(){
//	fileio("test");
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",val+i);
	if(n==2) return puts(val[1]==val[2]?"YES":"NO"),0;
	rep(i,1,n-1){
		int x,y;
		scanf("%d%d",&x,&y);
		addedge(lch(i),x,y);
		addedge(rch(i),y,x);
		++deg[x],++deg[y];
	}
	rep(i,1,n) if(deg[i]!=1){
	//	cerr<<i<<endl;
		if(!dfs(i,0)||val[i]) puts("NO");
		else puts("YES");
		return 0;
	}
	assert(false);
	return 0;
} 

Measured memory_bytes: 8832
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
#define int long long
using ll = long long;
using namespace std;
const int INF = 1LL << 50;
using P       = pair<int, int>;

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

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

signed main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int red = 0;
    int b   = 0;
    for (auto c : s) {
        if (c == 'R') {
            red++;
        } else {
            b++;
        }
    }
    cout << (red > b ? "Yes" : "No") << endl;
}


Measured memory_bytes: 888
#include<iostream>
using namespace std;
int main() {
	//A
	/*char a[3];
	cin >> a;
	if (a[1] == 'B') { cout << "ARC"; }
	else { cout << "ABC"; };
	return 0;
	*/

	int n;
	int k;
	int d[100];
	int a[100][100];
	int sunuke[100];
	cin >> n;
	cin >> k;
	int i,j;
	for (i = 0; i < n; i++) {
		sunuke[i] = 0;
	}
	for (i = 0; i < k; i++) {
		cin >> d[i];
		for (j = 0; j < d[i]; j++)
		{
			cin >> a[i][j];
			sunuke[a[i][j]-1]++;
		}
	}
	int c = 0;
	for (i = 0; i < n; i++) {
		if (sunuke[i] == 0) { c++; }
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 3576
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a=0,b,c,d;
  cin >>a;
  if(a%10==9||a/10==9) cout <<"Yes\n";
  else cout <<"No\n";
  return (0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
int n;
scanf("%d",&n);
int a[n];
vector<int >b(n);
for(int i=0;i<n;i++)
{
    scanf("%d",&a[i]);
b[i]=a[i];
}
sort(b.begin(),b.end());

for(int i=0;i<n;i++)
{
    if(a[i]<b[n/2])cout<<b[n/2]<<" ";
    else cout<<b[(n/2)-1]<<" ";
    
}

return 0;
}

Measured memory_bytes: 3712
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        
        var sc = new Scanner(System.in);
    
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        var p = new int[n];
        for(int i = 0; i < n; i++){
            p[i] = Integer.parseInt(sc.next());
        }
    
        Arrays.sort(p);
        int sum = 0;
        for(int i = 0; i < k; i++){
            sum += p[i];
        }
        System.out.println(sum);
    }
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll N, m;
vector<ll> A;

bool f(ll now, ll x) {
    if (m == now) {
        return true;
    }
    if (x == N) {
        return false;
    }
    return f(now + A[x], x + 1) || f(now, x + 1);
}

void Main() {
    cin >> N;
    A.assign(N, 0);
    rep(i, N) cin >> A[i];
    ll Q;
    cin >> Q;
    rep(i, Q) {
        cin >> m;
        bool ok = f(0, 0);
        cout << (ok ? "yes" : "no") << '\n';
    }

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}



Measured memory_bytes: 3232