akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>

using namespace std;

int main(){
	while(1){
		int b;
		scanf("%d", &b);
		//scanf("%d", &b) // AOJではscanf_s()が使えないことに注意
		if(!b) break;
		int high=1, low=1, sum=1;
		while(1){
			if(sum == b) break;
			else if(sum < b){
				high++;
				sum += high;
			} else{
				sum -= low;
				low++;
			}
		}
		int ans1 = low; //借りるフロアの中での最下層
		int ans2 = high - low + 1; //借りるフロアの総数
		printf("%d %d\n", ans1, ans2);

		//cout << low << " " << high-low+1 << endl;
	}
	return 0;
}


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

#define REP(i, n) for(int i=0;i<n;i++)

typedef unsigned long ul;
using namespace std;


int a, b, c;

void solve() {
    if ((a - c) * (c - b) > 0) {
        cout << "Yes";
    } else {
        cout << "No";
    }
}

int main() {
    cin >> a >> b >> c;
    solve();
    return 0;
}


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

using Weight=long long;

struct Edge{
  int to;
  Weight cost;
};

const Weight INF=1e12;
  
using Edges=vector<Edge>;
using Graph=vector<Edges>;

vector<int> isLeaf;

Weight removal(int v,int pre,Graph& g){
  auto res=0;
  for(int i=0;i<g[v].size();++i){
    if(g[v][i].to!=pre){
      res+=removal(g[v][i].to,v,g);
    }
  }
  if(res==0){
    isLeaf[v]=true;
    res+=g[v][0].cost;
  }
  return res;
}

Weight way(int v,int pre,Graph &g){
  if(isLeaf[v]){
    return -g[v][0].cost;
  }
  Weight res=0;
  for(int i=0;i<g[v].size();i++){
    if(g[v][i].to==pre) continue;
    res=max(res,g[v][i].cost+way(g[v][i].to,v,g));
  }
  return res;
}
int main(){
  int n;
  while(cin>>n,n){
    Graph org(n);
    vector<int> p(n);
    for(int i=1;i<n;i++){
      cin>>p[i];
      p[i]--;
    }
    Weight sum=0;
    vector<Weight> d(n);
    for(int i=1;i<n;i++) cin>>d[i];
    for(int i=1;i<n;i++){
      org[i].push_back(Edge{p[i],d[i]});
      org[p[i]].push_back(Edge{i,d[i]});
      sum+=d[i];
    }
    Weight res=INF;
    for(int root=0;root<n;root++){
      isLeaf.assign(n,0);
      auto g=org;
      auto ret=removal(root,-1,g);
      auto minu=way(root,-1,g);
      res=min(res,sum*3-ret*2-minu);
    }
    cout<<res<<endl;
  }
	 
  return 0;
}


Measured memory_bytes: 3320
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

ll sum(VL& a, int l, int r) {
    chmin(r, int(a.size()));
    if (r <= 0)return 0;
    if (0 < l)return a[r - 1] - a[l - 1];
    return a[r - 1];
}
int main() {
    init();

    int n, q; cin >> n >> q;
    VL a(n), odd(n), even(n), acc(n); cin >> a;
    FOR(i, 0, n) {
        acc[i] = a[i];
        if (i&1)odd[i] += a[i];
        else even[i] += a[i];
        if (0 < i) {
            acc[i] += acc[i - 1];
            odd[i] += odd[i - 1];
            even[i] += even[i - 1];
        }
    }

    function<bool(int, ll)> check = [&](int k, ll x) {
        if (n - 2 * k + 1 < 0)return false;
        if (abs(x - a[n - k]) < abs(x - a[n - 2 * k + 1]))return false;
        return true;
    };

    while (q--) {
        ll x; cin >> x;
        int ok = 0, ng = n;
        while (ng - ok > 1) {
            int mid = (ok + ng) / 2;
            if (check(mid, x))ok = mid;
            else ng = mid;
        }
        ll ans = sum(acc, n - ok, n);
        if (n & 1)ans += sum(even, 0, n - 2 * ok);
        else ans += sum(odd, 0, n - 2 * ok);
        cout << ans << "\n";
    }
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define JN ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define mod 1000000007

#define pb push_back
#define mp make_pair

using namespace std;
typedef unsigned long long int ull;
typedef long long int          ll;

int n, m;

int dp[1005][1005];
string s[1005];


int main()
{
    JN;

    cin >> n >> m;

    for(int i=1; i<=n; i++)
        cin >> s[i];

    dp[1][1] = 1;

    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            
            if(s[i][j-1] == '.')
            {
                if(dp[i][j] == 0)
                    dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
            }
            else
                dp[i][j] = 0;
        }
        
    }


    

    cout << dp[n][m]%mod << "\n";
    
    return 0;

}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    double N, D, count=0;
    cin >> N >> D;
    vector<double> X(N), Y(N);
    rep(i,N){
        cin >> X[i] >> Y[i];
        ll ans=X[i]*X[i]+Y[i]*Y[i];
        if(ans<=D*D) count++;
    }
    cout << count << endl;
}

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

int main() {
    int N, X;
    cin >> N;
    X = int(N / 1.08);
    if (int((X - 1) * 1.08) == N) {
        cout << X - 1 << endl;
    } else if (int(X * 1.08) == N) {
        cout << X << endl;
    } else if (int((X + 1) * 1.08) == N) {
        cout << X + 1 << endl;
    } else {
        cout << ":(" << endl;
    }

    return 0;
}

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

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

int main() {
	int a,b,c;
	cin >> a >> b >> c;

	int x=a-b;
	c-=x;
	if(c<=0)	cout << 0 << endl;
	else	cout << c << endl;

	return 0;
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    ll same_length = 0;
    repd(i, 1, n + 1) {
        if (s.substr(n - i, i) == t.substr(0, i)) {
            same_length = i;
        }
    }
    cout << n * 2 - same_length << endl;
    return 0;
}



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

long long solve(int N, const vector<int> &a) {
    int iter = 1;
    for (int i = 0; i < N; ++i) {
        if (a[i] == iter) ++iter;
    }

    if (iter == 1) return -1;
    else return N - (iter - 1);
}

int main() {
    int N; cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    cout << solve(N, a) << endl;
}


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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define pf push_front
#define sz(x) (int)(x).size()
#define lb lower_bound 
#define ub upper_bound 
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef vector<string> vs;
typedef unsigned long long ull;
typedef long double ld;
typedef map<int,int> mii;

const int MOD = 1e9+7;
const ll INF = 1e18; //
const ld PI = acos((ld)-1);

void solve () {
	ll n,d;
	cin >> n >> d;
	ll x,y,cnt = 0;
	F0R(i,n) {
		cin >> x >> y;
		ld dist = x*x+y*y;
		dist = sqrt(dist);
		ll z = ceil(dist);
		if (z <= d) {
			++cnt;
		}
	}
	cout << cnt << '\n';
}

int main () {
#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output1.txt","w",stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}



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

class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());

		var length = n.ToString().Length;
		var ans = length;
		for (long i = 10; i * i <= n; ++i) {
			if (n % i == 0) {
				long temp = n / i;
				var cans = Math.Max(temp.ToString().Length, i.ToString().Length);
				ans = Math.Min(ans, cans);
			}
		}

		Console.WriteLine(ans);

		//デバッグ実行での確認用。そのまま提出しても問題なし
		Console.ReadKey();
	}
}


Measured memory_bytes: 13140
N = int(input())
a = input().split()
ans = 0
ci = -2
t = 1
for i in range(0,N):
	a[i] = int(a[i])
a.append(0)
for i in range(0,N):
	if a[i]==a[i+1]:
		ci = i
		t += 1
	if a[i]!=a[i+1]:
		if ci == i-1:
			ans += int(t/2)
			t = 1
print(ans)

Measured memory_bytes: 3064
/**
    And in the end, the love you take is equal to the love you make.

        I LOVE YOU LAURA.
**/

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

#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_DISABLE_PERFCRIT_LOCKS

#define findOrder find_by_order
#define orderKey order_of_key

#define isOn(mask, i) (mask & (1 << i))
#define turn(mask, i) (mask |= (1 << i))
#define switch(mask, i) (mask &= ~(1 << i))
#define change(mask, i) (mask ^= (1 << i))
#define lowbit(mask) (mask & (-mask))
#define turnAll(mask, n) (mask = (1 << n) - 1)
#define switchLastBit(mask) (mask & (mask - 1))
#define turnLastZero(mask) (mask | (mask + 1))
#define modulo(x, mod) ((x) & (mod - 1))
#define log2(x) (31 - __builtin_clz(x))

#define mkp make_pair
#define pb push_back
#define pf push_front
#define eb emplace_back
#define ef emplace_front
#define ins insert
#define rsz resize
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) ((int)x.size())
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define debug(x) (cerr << x << " ")

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdb;
typedef pair<int, ii> tri;
typedef complex<ld> cd;

typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ld> vdb;
typedef vector<cd> vcd;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vll> matrix;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_tree;

const ll mod = 1e9+7;
const int maxn = 3005;
const int pi = 2 * acos(0.0);
const db eps = 1e-9;

int n;
db arr[maxn];
db dp[maxn][maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cout.precision(10); cout << fixed;

    cin >> n;

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

    dp[0][0] = 1.0000;
    for (int i = 0; i < n; i++){
        for (int j = 0; j <= i; j++){
            dp[i + 1][j + 1] += dp[i][j] * arr[i];
            dp[i + 1][j] += dp[i][j] * (1 - arr[i]);
        }
    }

    db ans = 0.0000;
    for (int i = (n + 1) >> 1; i <= n; i++){
        ans += dp[n][i];
    }

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 69120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
  string n;
  cin >>n;
  if(n[0]=='7'||n[1]=='7'||n[2]=='7'){cout<<"Yes"<<endl;}
  else{cout <<"No"<<endl;}
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
using namespace std;

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    cout << max(0,c-(a-b)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const double EPS=1e-2;
int main(){
	int n;
    string s;
    cin >> n >> s;

    set<int> st;
    for(int i=0; i<1000; ++i){
        string t;
        if(i<10) t += '0';
        if(i<100) t += '0';
        t += to_string(i);
        reverse(t.begin(),t.end());
        vector<int> v={t[2]-'0', t[1]-'0', t[0]-'0'};
        int k=2;
        for(int j=0; j<n; ++j){
            if(s[j]-'0'==v[k]){
                --k;
                if(k==-1){
                    st.insert(i);
                    break;
                }
            }
        }
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll mod = 1e9 + 7;

ll mod_exp(ll a, ll b){
	if(b == 0)
		return 1ll;
	if(b % 2 == 0){
		ll t = mod_exp(a, b / 2) % mod;
		return t * t % mod;
	}
	return a * mod_exp(a, b - 1) % mod;
}

ll inv(ll x){
	return mod_exp(x, mod - 2) % mod;
}

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	const int maxn = 1e6 + 5;
	
	int n;
	cin >> n;
	
	vector<ll> p(maxn), v(n);
	
	for(int i = 0; i < n; i++){
		ll x;
		cin >> x;
		v[i] = x;
		
		for(ll j = 2; j * j <= x; j++){
			ll cnt = 0;
			while(x % j == 0){
				cnt++;
				x /= j;
			}
			
			if(cnt)
				p[j] = max(p[j], cnt);
		}
		
		if(x > 1)
			p[x] = max(p[x], 1ll);
	}
	
	ll ans = 0, lcm = 1;
	
	for(ll i = 1; i < maxn; i++)
		for(ll j = 0; j < p[i]; j++)
			lcm = (lcm * i) % mod;
	
	for(int i = 0; i < n; i++){
		
		ll x = v[i], cur = lcm;
		
		for(ll j = 2; j * j <= x; j++){
			ll cnt = 0;
			while(x % j == 0){
				cnt++;
				x /= j;
				cur = (cur * inv(j)) % mod;
			}
		}
		
		if(x > 1)
			cur = (cur * inv(x)) % mod;
			
		ans = (ans + cur) % mod;
		
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 8192
import Data.Map as Map (Map, lookup, insert, empty, toList) 
 
main = do
  n <- getLine
  xs <- map read . words <$> getLine
  putStrLn . show $ solve' xs

solve' :: [Int] -> Int
solve' xs = 
  let kv = toList $ solve xs empty
  in sum $ map (\(k,v) -> if k > v then v else v-k) kv
  
solve :: [Int] -> Map.Map Int Int -> Map.Map Int Int
solve [] mp = mp
solve (x:xs) mp = 
  case Map.lookup x mp of
    Nothing -> solve xs (insert x 1 mp)
    Just v -> solve xs (insert x (v+1) mp)


Measured memory_bytes: 52604
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>

typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)
using namespace std;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;

int main() {
	ll a; cin >> a;
	if (a == 1) {
		cout << 1 << endl;
		return 0;
	}
	double ans = 0;
	if (a & 1) {
		double p = a;
		ans = ((p - 1) / 2 + 1) / p;
		//ans = (double)((p / 2 + 1) / p);
	}
	else {
		double p = a;
		ans = (double)p / 2 / p;
	}
	printf("%0.8f", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,a,b) for (int i = (b-1); i >= (a); i--)
#define REP(i,n) FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int a;
  string s;
  cin >> a >> s;

  cout << (a>=3200?s:"red") << endl;
} 

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

int main() {
	int N; cin >> N;
	double v[55];
	double sum = 0;
	
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	sort(v, v + N);
	sum = v[0];
	for (int i = 1; i < N; i++) {
		sum = (sum + v[i]) / 2;
	}
	cout << sum;
}

Measured memory_bytes: 256
import collections,sys
def s():
  d = collections.deque()
  input()
  for e in sys.stdin:
    if "i"==e[0]: d.appendleft(e[7:-1])
    else:
      if " "==e[6]:
        m = e[7:0-1]
        if m in d: d.remove(m)
      elif "i"==e[7]: d.popleft()
      else: d.pop()
  print(*d)

s()



Measured memory_bytes: 69740
#include <iostream>
using namespace std;
int main(){
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if((x >= r)&&(x <= w-r)){
        if((y >= r)&&(y <= h-r)){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
 
#define  int    long long int
 #define    sp(x)                 setprecision(x)
#define    bp(x)           __builtin_popcount(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff         first
#define  ss    second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
int ff[1000006];
int32_t main()
{
    fast
    int n,ans=0,x,c;
    cin>>n;
    int a[n+1];
    f(i,1,n)
    {
        cin>>a[i];
        ff[a[i]]++;
    }
    f(i,1,n)
    {
        c=1;
        x=a[i];
        if(ff[x]>1)
             continue;
        ff[x]--;
        for(int j=1;j*j<=x;j++)
        {
            if(x%j==0)
            {
                if(ff[j] || ff[x/j])
                    c=0;
            }
        }
        ff[x]++;
        ans+=c;
    }
    cout<<ans;
}

Measured memory_bytes: 12892
#include <iostream>
#include <string>
using namespace std;
int main(){
double v;
double t;
double y;
double n;
int a;
int b;
while(cin >>v){
t=v/9.8;
y=4.9*t*t;
n=(y+5)/5;
a=n+1;
cout <<a<<endl;
}}

Measured memory_bytes: 1224
#!/usr/bin/env python3
n,k = map(int,input().split())
ans_prob = 0
beki_cnt = 0
for i in range(n,0,-1):
    while True:
        #print(beki_cnt,i)
        if i >= k / (2** beki_cnt): 
            ans_prob += 1/ ((2**beki_cnt) * n)
            
            #print(i,ans_prob)
            break
        else:   beki_cnt += 1
print(ans_prob)

Measured memory_bytes: 3060
object Main {

  def main(args: Array[String]): Unit = {
    val (num, limit) = {
      val nw = io.StdIn.readLine().split(" ").map(_.toInt)
      (nw(0), nw(1))
    }
    val items = (for (_ <- 0 until num) yield io.StdIn.readLine())
      .map { str =>
        val vw = str.split(" ").map(_.toInt)
        (vw(0), vw(1))
      }

    val dp = Array.ofDim[Int](num + 1, limit + 1)
    items.zipWithIndex.foreach { case ((v, w), i) =>
      for (l <- 1 to limit) {
        if (w <= l) {
          dp(i + 1)(l) = Math.max(dp(i)(l), dp(i)(l - w) + v)
        } else {
          dp(i + 1)(l) = dp(i)(l)
        }
      }
    }

    println(dp(num)(limit))
  }

}

Measured memory_bytes: 48476
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;


typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;


void solve(){
	int n;
	cin >>n;
	int d = n%10;
	if(d==3 ){
		cout << "bon"<< endl;
	}	
	else if(d== 0 || d ==1 || d ==6 || d==8)
		cout << "pon" << endl;
	else{
		cout << "hon" << endl;
	}
}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("in","r",stdin);
		freopen("out","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


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

typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    
    int N,K;
    cin>> N >> K;
    int temp = N-1;
    int t = K;
    int nums[N];
    for(int i=0;i<N;i++)
    {
        cin>>nums[i];
    }
    
    sort(nums,nums+N);
    
    while(K--)
    {
        nums[temp--] = 0;
    }
    ll sum = 0;
    for(int i=0;i<N-t;i++)
    {
        sum += nums[i];
    }
    cout<<sum<<" ";
    
    return 0;
}

Measured memory_bytes: 1024
line=[]
d=0

n,k=map(int,input().split(" "))

for j in range(n):
  p=int(input())
  line.append(p)
  
#print(line)
line.sort()
#print(line)
#print(line[1]-line[0])  
min=line[k]-line[0]
for mm in range(0,n-k+1):
  d=(line[mm+k-1]-line[mm])
  if min>d:
    min=d
    
print(min)
  

Measured memory_bytes: 7508
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) ((int)(x).size())
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1e9;
// const ll INF = 1e15;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


// --------------------------------------------------------

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

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

  int N;
  ull LCM, T;
  cin >> N >> LCM;
  REP(i, N - 1) {
    cin >> T;
    LCM = LCM * (T / gcd(max(LCM, T), min(LCM, T)));
    // test(LCM);
  }

  cout << LCM << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cctype>
#include <ctime>
#include <climits>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <tuple>
#include <cmath>
#include <algorithm>

using namespace std;

#ifndef M_PI
    #define M_PI 3.14159265358979323846
#endif

#define pii pair<int, int>
#define pll pair<long long, long long>
#define mp make_pair
#define fr first
#define sc second
#define tiii tuple<int, int, int>
#define tlll tuple<long long, long long, long long>
#define mt make_tuple
#define ll long long
#define ld long double
#define pb push_back
#define all(x) x.begin(), x.end()

#define int long long

int a['z' + 1];

int32_t main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    fill(a, a + 'z' + 1, 0);
    int ans = 0;
    for (int i = 0; i < (int)s.size(); i++)
    {
        ans += i - a[s[i]];
        a[s[i]]++;
    }
    cout << ans + 1 << endl;
    return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n;
    cin >> n;
    vector<pii> A(n);
    REP(i, n) {
        int a;
        cin >> a;
        A[i] = {a, i};
    }
    sort(ALL(A));
    int ans = 0;
    REP(i, n) {
        ans += (A[i].second % 2) != (i % 2);
    }
    cout << ans / 2 << endl;
    return (0^_^0);
}



Measured memory_bytes: 1792
n,x = map(int,input().split())
a = list(map(int,input().split()))	
if sum(a)<x:
    print(n-1)
elif sum(a)==x:
    print(n)
else:
    diff=sum(a)-x
    a.sort(reverse = True)
    cnt=0
    while diff > 0 and cnt < n:
        diff -= a[0+cnt]
        cnt+=1
    print(n-cnt)





Measured memory_bytes: 3060
def 解():
    N = int(input())
    aH = [int(_) for _ in input().split()]

    dp = [0]*(N)
    dp[1] = abs(aH[0] - aH[1])
    for i in range(2,N):
        dp[i] = min(abs(aH[i]-aH[i-1])+dp[i-1],abs(aH[i]-aH[i-2]) +dp[i-2])
    print(dp[-1])
解()


Measured memory_bytes: 13900
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>

#define isNum(a) (a >= '0' && a <= '9')
#define SP putchar(' ')
#define EL putchar('\n')
#define File(a) freopen(a ".in", "r", stdin), freopen(a ".out", "w", stdout)

template<class T>
void read(T&);
template<class T>
void write(const T&);

typedef long long ll;
typedef unsigned long long ull;
typedef const long long & cll;
typedef const int & ci;
typedef std::pair<int, int> pii;
const int iinf = 2147483647;
const ll llinf = 9223372036854775807ll;
using std::min;
using std::max;
using std::abs;
using std::sort;

int main () {
  int a, b;
  read(a), read(b);
  puts(a == b ? "Yes" : "No");
  return 0;
}

template<class T>
inline void read(T &Re) {
  T k = 0;
  char ch = getchar();
  int flag = 1;
  while (!isNum(ch)) {
    if (ch == '-') {
      flag = -1;
    }
    ch = getchar();
  }
  while (isNum(ch)) {
    k = (k << 1) + (k << 3) + ch - '0';
    ch = getchar();
  }
  Re = flag * k;
}
template<class T>
inline void write(const T &Wr) {
  if (Wr < 0) {
    putchar('-');
    write(-Wr);
  } else {
    if (Wr < 10) {
      putchar(Wr + '0');
    } else {
      write(Wr / 10);
      putchar((Wr % 10) + '0');
    }
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	 //cin.tie(0);
	//ios::sync_with_stdio(false);
	std::cout << std::fixed;
	std::cout << std::setprecision(12);
	//std::cout << std::defaultfloat;
	int n;
	cin>>n;
	LD ans=0;
	FOR(i,0,n){
		int t;
		cin>>t;
		ans+=1./t;
	}
	cout<<1./ans<<endl;

	return 0;
}


Measured memory_bytes: 256
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll N,K;cin>>N>>K;
    vector<bool> f(N);REP(i,N)f[i]=false;
    REP(i,K){
        ll d;cin>>d;
        REP(j,d){
            ll n;cin>>n;n--;
            f[n]=true;
        }
    }
    ll cnt=0;
    REP(i,N){
        if(!f[i])cnt++;
    }
    cout<<cnt<<"\n";
}

Measured memory_bytes: 3600
import collections

# print('input >>')
N, K, Q = map(int, (input().split()))
points = [K] * N
A = []
for _ in range(Q):
    A.append(int(input()))

Acount = collections.Counter(A)

for answerer, times in Acount.items():
    points[answerer - 1] += times

# print('----------output----------')

for answerer in range(N):
    print('Yes') if points[answerer] > Q else print('No')

Measured memory_bytes: 13936
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<sstream>
#include<algorithm>
using namespace std;
int Solve(int n)
{
	if(n<10)
		return 0;
	stringstream ss;
	ss<<n;
	string s=ss.str();
	int t=0;
	for(int i=1;i<s.size();++i)
		t=max(t,atoi(s.substr(0,i).c_str())*atoi(s.substr(i).c_str()));
	return 1+Solve(t);
}

int main()
{
	int q,n;
	for(scanf("%d",&q);q--;)
	{
		scanf("%d",&n);
		printf("%d\n",Solve(n));
	}
	return 0;
}

Measured memory_bytes: 1260
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <ios>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int R, G;
    cin >> R >> G;
    cout << 2 * G - R << "\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
long long int big[60][2] = {};

int main() {
	int n;
	string s;
	cin >> n;
	cin >> s;
	long long int r = 0;
	long long int g = 0;
	long long int b = 0;
	long long int sum = 0;

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'R') {
			r++;
		}
		if (s[i] == 'G') {
			g++;
		}
		if (s[i] == 'B') {
			b++;
		}
	}

	for (int i = 0; i < s.size(); i++) {
		for (int j = 1; j < s.size(); j++) {
			if (i - j >= 0 && i + j < s.size()) {
				if (s[i] != s[i - j] && s[i] != s[i + j] && s[i - j] != s[i + j]) {
					sum--;
				}
			}
		}
	}
	cout << r * g * b + sum;
}

Measured memory_bytes: 3592
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
	let b:Vec<char> = get_input().chars().collect();
    let ans = match b[0] {
    	'T' => 'A',
    	'A' => 'T',
    	'G' => 'C',
    	_ => 'G',
	};
	println!("{}", ans);
 }

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmin(x,y) x = min(x,y)

const ll INF = 1e18;

ll dp[20][20];

vector<ll> calc(vector<P>& a) {
  int n = a.size();
  sort(a.begin(), a.end());
  rep(i,n+1)rep(j,n+1) dp[i][j] = INF;
  dp[0][0] = 0;
  rep(l,n) {
    for (int r = l+1; r <= n; ++r) {
      {
        ll now = INF;
        for (int k = l; k < r; ++k) {
          ll s = 0;
          for (int i = l; i < r; ++i) {
            s += abs(a[i].first-a[k].first)*ll(a[i].second);
          }
          chmin(now, s);
        }
        rep(j,n) chmin(dp[r][j+1], dp[l][j]+now);
      }
      {
        ll now = 0;
        for (int i = l; i < r; ++i) {
          now += abs(a[i].first)*ll(a[i].second);
        }
        rep(j,n+1) chmin(dp[r][j], dp[l][j]+now);
      }
    }
  }
  vector<ll> res(n+1, INF);
  rep(j,n+1) res[j] = dp[n][j];
  return res;
}

int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n), p(n);
  rep(i,n) cin >> x[i] >> y[i] >> p[i];
  vector<ll> ans(n+1,INF);
  rep(s,1<<n) {
    vector<P> ax, ay;
    rep(i,n) {
      if (s>>i&1) ax.emplace_back(x[i],p[i]);
      else ay.emplace_back(y[i],p[i]);
    }
    vector<ll> dx = calc(ax);
    vector<ll> dy = calc(ay);
    rep(i,dx.size())rep(j,dy.size()) {
      ans[i+j] = min(ans[i+j], dx[i]+dy[j]);
    }
  }

  rep(i,n+1) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,x,i,flak=1;
    vector<int>v;
    cin>>n;
    v.push_back(n);
    while(1)
    {
        if(n%2==0)
        {
            n/=2;
            v.push_back(n);
            for(i=0;i<v.size()-1;i++)
            {
                if(v[i]==n)
                {
                    flak=0;
                    break;
                }
            }
        }
            else if(n%2!=0)
            {
                n=(3*n+1);
                v.push_back(n);
            for(i=0;i<v.size()-1;i++)
            {
                if(v[i]==n)
                {
                    flak=0;
                    break;
                }
            }
            }
            if(flak==0)
                break;
    }
    cout<<v.size()<<endl;
    v.clear();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


string S,T,U;

int main(){

	cin >> S;
	cin >> T;

	int A,B;
	scanf("%d %d",&A,&B);

	cin >> U;
	if(S == U){

		A--;
	}else{

		B--;
	}

	printf("%d %d\n",A,B);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <numeric>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF (LL)1e15
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

//#define int long long

/*************** using variables ***************/
int n;
vector<int> a;
/**********************************************/

signed main(){
    cin >> n;
    a.resize(n);
    REP(i, n) cin >> a[i];
    int a_sum = 0, b_sum = 0;
    sort(all(a), std::greater<int>());
    REP(i, n){
        if(i % 2 == 0) a_sum += a[i];
        else b_sum += a[i];
    }

    cout << abs(a_sum - b_sum) << endl;
}


Measured memory_bytes: 256
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
// https://atcoder.jp/contests/abc168/tasks/abc168_a
string ans[3] = {"hon","pon","bon"};
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

	ll k;
	string s;
	cin >> k >> s;
	if(s.length() <= k){
		cout << s;
	}
	else{
		for(int i = 0;i<k;i++){
			cout << s[i];
		}
		cout << "...";
	}

    return 0;
}

Measured memory_bytes: 3620
import collections
N=int(input())
S=[]
for i in range(N):
    S.append(input())


s=collections.Counter(S).most_common()
s.sort(key=lambda x: x[0])
s.sort(key=lambda x: x[1], reverse=True)
for k, v in s:
    if v==s[0][1]:
        print(k)
    else:
        break



Measured memory_bytes: 45032
def f_d():
    import heapq
    _, m = map(int, input().split())
    *a, = map(lambda x: -1*int(x), input().split())
    heapq.heapify(a)
    for _ in range(m):
        v = heapq.heappop(a)
        heapq.heappush(a, ((-1*v)//2)*-1)
    print(int(sum(a)*-1))

if __name__ == "__main__":
    f_d()


Measured memory_bytes: 14252
#include "iostream"
#include <string>
#include <cmath>
#include <math.h>
using namespace std;
int main() {
	int n;
	int m;
	cin >> n >> m;
	long nx[50];
	long ny[50];
	long mx[50];
	long my[50];
	for (int i = 0; i < n; i++) {
		cin >> nx[i]>>ny[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> mx[i] >> my[i];
	}
	int ans[50];
	for (int i = 0; i < n; i++) {
		ans[i] = 0;

		long dist = abs(nx[i] - mx[0]) + abs(ny[i] - my[0]);
		for (int j = 0; j < m; j++) {
			if (dist > abs(nx[i] - mx[j]) + abs(ny[i] - my[j])) {
				ans[i] = j;
				dist = abs(nx[i] - mx[j]) + abs(ny[i] - my[j]);
			}
		}
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i]+1<<endl;
	}
	return(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{
    vector<int> v;
    int a,i,b,c;
    cin>>a;
    for(i=0;i<a;i++)
    {
        cin>>b;
        if(b==0)
        {
            cin>>c;
            v.push_back(c);
        }
        else if(b==1)
        {
            cin>>c;
            cout<<v[c]<<endl;
        }
        else if(b==2)
        {
            v.pop_back();
        }
    }
}



Measured memory_bytes: 3932
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
using graph = vector<vector<int>>;

const double pi = 3.14159265358979323846;
const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	ll a, b, c, k; cin >> a >> b >> c >>k;
	if(k <= a) cout << k << endl;
	else if(k > a && a + b >= k) cout << a << endl;
	else{
		cout << a - (k -(a + b)) << endl;
	}
} 

Measured memory_bytes: 3632
from math import comb, factorial, gcd, isqrt, perm, exp, log, log2, log10, sqrt, pi, acos, asin, atan ,atan2, cos, sin, tan

a,b,h,m=map(int,input().split())
h%12
t=min(abs(30*h+0.5*m-6*m),360-abs(30*h+0.5*m-6*m))
c=(a**2+b**2-2*a*b*cos(pi*t/180))**0.5
print(c)

Measured memory_bytes: 9508
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  map<ll,ll> ma;
  ll n;
  cin>>n;
  rep(i,0,n){
    ll a;
    cin>>a;
    ma[a]++;
  }
  ll ans = 0;
  map<ll,ll>::iterator itr = ma.begin();
  while(itr!=ma.end()){
    ll a = (*itr).fi;
    ll b = (*itr).se;
    if(b%2==1)ans++;
    itr++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define int long long
using namespace std;
typedef long long ll;
ll k,x,a,b,c;
signed main()
{

    //ios_base::sync_with_stdio(0),cin.tie(0);
    while(cin>>k>>x)
    {

        for(int i=x-k+1;i<=x+k-1;i++)
            cout<<i<<" ";
        cout<<"\n";
    }

    return 0;
}


Measured memory_bytes: 256
use text_io::*;
// use std::collections::*;
// use std::process::exit;

fn main() {
    let mut a:usize = read!();
    let mut b:usize = read!();
    if a<10&&b<10 {
        println!("{}",a*b);
    }
    else {
        println!("-1");
    }
}

Measured memory_bytes: 2140
def main():
    n = int(input())
    if n <= 1:
        print(1)
    else:
        fib_list = [1, 1] + [None] * (n - 1)
        for i in range(2, n + 1):
            fib_list[i] = fib_list[i - 1] + fib_list[i - 2]
        print(fib_list[n])


if __name__ == "__main__":
    main()



Measured memory_bytes: 5600
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import math

def gcd(a, b):
    return math.gcd(a, b)

def lcm(a, b):
    return a * b / gcd(a, b)

class slist(list):
    def __init__(self, *args, **kw):
        list.__init__(self, *args, **kw)
        self.sort()

    def append(self, value):
        bisect.insort(self,value)

    def index_left(self, value):
        return bisect.bisect_left(self, value)


if __name__ == '__main__':
    S = input()
    if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
        print('Bad')
    else:
        print('Good')


Measured memory_bytes: 3444