akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int M = in.nextInt();

        Queue<Long> Q = new PriorityQueue<>(Comparator.reverseOrder());
        for (int n = 0; n < N; n++) {
            Q.add(in.nextLong());
        }

        for (int m = 0; m < M; m++) {
            long a = Q.poll();
            Q.add(a / 2);
        }

        long res = 0;
        for (int n = 0; n < N; n++) {
            res += Q.poll();
        }

        System.out.println(res);
    }
}



Measured memory_bytes: 58548
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

// 約数列挙：nの約数を昇順に返す
vector<long long> enumDivisors(long long n){
    vector<long long> ret;
    for(long long i=1; i*i<=n; i++){
        if(n%i == 0){
            ret.push_back(i);
            if(n/i != i) ret.push_back(n/i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main(){
    Init();
    ll n; cin >> n;
    ll cnt = 0;

    for(ll i=1; i<=n; i+=2){
        auto p = enumDivisors(i);
        if(p.size() == 8) cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")
 
// #include <bits/extc++.h>
// using namespace __gnu_pbds;
 
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;
 
// #define X first
// #define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back
 
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);
 
const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    int n, a, b, c, d, goal;
    cin >> n >> a >> b >> c >> d, goal = abs(a - b);
    
    for (int i = 0; i < n; ++i) {
        if (i*c - (n-1-i)*d <= goal and goal <= i*d - (n-1-i)*c) {
            cout << "YES\n"; return 0;
        }
        if (i*d - (n-1-i)*c <= goal and goal <= i*c - (n-1-i)*d) {
            cout << "YES\n"; return 0;
        }
    }
    
    cout << "NO\n"; return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main()
{for(;;){
	int s,x;
	s=0;
	scanf("%d",&s);
	if(!s) return 0;
	for(int i=0;i<9;i++){
		scanf("%d",&x);
		s-=x;
	}
	printf("%d\n",s);
	}
}

Measured memory_bytes: 1028
def factorize(n):
    """
    nの値を素因数分解し、素因数とその指数をtupleにまとめたリストを返す
    e.g.
    factorize(20)
    [(2, 2), (5, 1)]
    """
    b = 2
    fct = []
    while b * b <= n:
        cnt = 0
        while n % b == 0:
            cnt += 1
            n //= b
        if cnt > 0:
            fct.append((b, cnt))
        b += 1
    if n > 1:
        fct.append((n, 1))
    return fct


N, P = map(int, input().split())
ans = 1
for p, e in factorize(P):
    if e >= N:
        ans *= p ** (e // N)
print(ans)


Measured memory_bytes: 39152
#include <cstdio>
#include <algorithm>
#include <vector>
#include <numeric>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

int N, M;
bool adj[10][10];
int ans;

int main()
{
  scanf( "%d%d", &N, &M );
  rep( i, M )
  {
    int a, b;
    scanf( "%d%d", &a, &b );
    --a; --b;
    adj[a][b] = adj[b][a] = true;
  }

  std::vector<int> perm( N-1 );
  std::iota( all(perm), 1 );

  do
  {
    bool fl = true;

    rep( i, N-1 )
    {
      int prv = i ? perm[i-1] : 0;

      fl &= adj[prv][perm[i]];
    }

    if( fl )
      ++ans;
  } while( std::next_permutation(all(perm)) );

  printf( "%d\n", ans );
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
struct node
{
	int s,e;
}a[200005];
bool cmp(node a,node b)
{
	return a.e<b.e;
}
int main()
{
	int n,m,i,j,k,s,t;
	while(~scanf("%d",&n))
	{
		for(i=0;i<n;i++)
		scanf("%d%d",&a[i].s,&a[i].e);
		sort(a,a+n,cmp);
		m=0;
		for(i=0;i<n;i++)
		{
			m+=a[i].s;
			if(m>a[i].e)
			{
				m=-1;
				break;
			}
		}
		if(m==-1) printf("No\n");
		else  printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

int main(){
    lint r, D, x;
    cin >> r >> D >> x;
    for(int i = 0; i < 10; i++){
        x = r * x - D;
        cout << x << endl;
    }
}


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

int main(){
  int h,n;
  cin >> h >> n;
  int k=0;
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    k+=a;
  }
  if(k<h)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<vector<double>>dp(3000,vector<double>(3000,-1.0));
double func(double a[],ll i, ll x)
{
    if(i<0)
    {
        if(x==0)
        return 1;
     return 0;
    }
    if(x==0)
    return 1;
    if(dp[i][x]!=-1)
    return dp[i][x];
    
    return dp[i][x]=a[i]*func(a,i-1,x-1)+((1-a[i])*(func(a,i-1,x)));
    
}
 
int main() {
   
   ll n,i;
   cin>>n;
   double a[n];
   for(i=0;i<n;i++)
    cin>>a[i];
    // memset(dp,-1,sizeof(dp));
    int x=(n/2)+1;
    cout<< setprecision(16)<<func(a,n-1,x)<<endl;

}

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

int N,W,H;
int X[100001],Y[100001];

int main(){

  cin >> N >> W >> H;
  for(int i=0;i<N;i++){
    int x,y,w;
    cin >> x >> y >> w;
    X[max(0,x-w)] = max(X[max(0,x-w)], w + min(w,x));
    Y[max(0,y-w)] = max(Y[max(0,y-w)], w + min(w,y));
    //  cout << max(0,x-w) << " "<< w + min(w,x)+1 << " , " << x + w << endl;
  }

  bool f = true;
  for(int i=0;i<W;i++){
    if( i )  X[i] = max(X[i-1]-1,X[i]);
    if( X[i] == 0 ){
      f = false;
    }
  }
  if( f ) cout << "Yes" << endl;
  else {
    f = true;
    for(int i=0;i<H;i++){
      if( i ) Y[i] = max(Y[i-1]-1,Y[i]);
      if( Y[i] == 0 ) f = false;
      //    cout <<"y = " <<  i << " : " << Y[i] << endl;
  }
    
    if( f ) cout << "Yes" << endl;
    else cout << "No" << endl;
    
  }

}

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

int main()
{
	int S;
	int h;
	int m;
	int s;
	cin >> S;
	h = S / 3600;
	m = (S % 3600) / 60;
	s = (S % 60);
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n,m;

vll par;
vll rnk;
void init(lli n){
    par = vll(n);
    rnk = vll(n);
    for(lli i = 0;i < n;i++) par[i] = i;
}
lli find(lli x){
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
}
void unite(lli x,lli y){
    x = find(x);y = find(y);
    if(x == y) return;
    if(rnk[x] < rnk[y]) par[x] = y;
    else {
        par[y] = x;
        if(rnk[x] == rnk[y]) rnk[x]++;
    }
}
bool same(lli x,lli y){
    return find(x) == find(y);
}

struct edge{
    lli from,to;
    lli cost;
};

vector<edge> e;

lli ans;

int main(){
    cin >> n >> m;
    e = vector<edge> (m);
    for(lli i = 0;i < m;i++) cin >> e[i].from >> e[i].to >> e[i].cost;
    sort(e.begin(),e.end(),[](edge a,edge b){
        return a.cost < b.cost;
    });
    init(n);
    for(lli i = 0;i < m;i++){
        if(!same(e[i].from,e[i].to)){
            ans += e[i].cost;
            unite(e[i].from,e[i].to);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5140
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<vector<int>>vec(N,vector<int>(10));
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < 10; j++) {
            cin >> vec[i][j];
        }
    }
    vector<vector<int>>P(N,vector<int>(11));
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < 11; j++) {
            cin >> P[i][j];
        }
    }
    int ans = -1000000000000;
    for(int bit = 1; bit < (1 << 10); bit++) {
        int cnt = 0;
        for(int i = 0; i < N; i++) {
            int sum = 0;
            for(int j = 0; j < 10; j++) {
                if(((bit>>j)&1) && vec[i][j]) {
                    sum++;
                }
            }
            cnt += P[i][sum];
        }
        if(cnt > ans) {
            ans = cnt;
        }
    }
    cout << ans << endl;
}

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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<int> num(26);
    for (int i=0; i<n; ++i) {
        num[s[i] - 'a'] = 1 - num[s[i] - 'a'];
    }
    for (int i=0; i<26; ++i) {
        if (num[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

using namespace std;

map <string , bool> mp;
int n;
bool b;
string s;
char last;

int main()
{
	cin >> n;
	for(int i = 0 ; i < n ; i++)
	{
		cin >> s;
		if(i == 0)
			last = s[s.size() - 1];
//		cout << last << "#";
		if(mp[s])
		{
			b = 1;
		}
		else
		{
			mp[s] = 1;
			if(s[0] != last && i != 0)
				b = 1;
			last = s[s.size() - 1];
		}
	}
	if(b)
		cout << "No";
	else
		cout << "Yes";
}

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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define INF 1e18
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
    return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
    return a / gcd(a, b) * b;
}

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

int a, b, q;
vl s, t;

llint dist(llint x)
{
    llint rec = INF;
    auto ita = lower_bound(s.begin(), s.end(), x);
    auto itb = lower_bound(t.begin(), t.end(), x);

    vl v;
    v.pb(*ita); v.pb(*(ita - 1));
    v.pb(*itb); v.pb(*(itb - 1));

    for(int i = 0; i < 4; i++) {
	int m = i < 2 ? 2 : 0;
	for(int j = m; j < m + 2; j++) {
	    rec = min(rec, abs(x - v[i]) + abs(v[i] - v[j]));
	}
    }
    
    return rec;
}

int main()
{
    ci >> a >> b >> q;
    llint ss, tt;
    s.pb(-INF); t.pb(-INF);
    rep(i, a) { ci >> ss; s.pb(ss); }
    rep(i, b) { ci >> tt; t.pb(tt); }
    s.pb(INF); t.pb(INF);

    llint x;
    rep(i, q) {
	ci >> x;

	co << dist(x) << en;
    }
  
    return 0;
}


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int D;
vector<LL> c(26);
vector<vector<LL>> s;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

LL solve(const vector<LL>& t) {
  LL ans = 0;
  vector<LL> last(26, 0);
  for (int d = 1; d <= D; ++d) {
    int i = d - 1;
    int j = t[i];
    last[j] = d;
    ans += s[i][j];
    for (int k = 0; k < 26; ++k) {
      ans -= c[k] * (d - last[k]);
    }
  }
  return ans;
}

int main() {
  cin >> D;
  cin >> c;
  s.resize(D, vector<LL>(26, 0));
  for (int i = 0; i < D; ++i) cin >> s[i];

  vector<LL> t(D);
  for (int d  =  0; d < D; ++d) t[d] = d % 26;

  LL prev = solve(t);
  int d = 0;
  for (int i = 0; i < 200000; ++i) {
    auto t_bk = t;
    t[d % D] = rand() % 26;

    LL score = solve(t);
    if (score > prev) {
      prev = score;
    } else {
      t = t_bk;
      ++d;
    }
  }

  for (int x : t) cout << x + 1 << endl;
}


Measured memory_bytes: 3720
import sys
from fractions import gcd

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to only numbers
rs = lambda: stdin.readline().rstrip()  # ignores trailing space

A, B = rl()
answer = A * B // gcd(A, B)
print(answer)


Measured memory_bytes: 5076
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <functional>

template <class T>
using lp_queue=std::priority_queue<T, std::vector<T>, std::greater<T>>;
constexpr intmax_t INF=1LL<<61;

struct Edge {
  size_t src, dst;
  Edge() {}
  Edge(size_t s, size_t d): src(s), dst(d) {}
};

struct UnionFind {
  size_t size_;
  std::vector<int> tree;
  UnionFind(size_t n): size_(n), tree(n, -1) {}
  bool unite(size_t u, size_t v) {
    u = find_root(u);
    v = find_root(v);
    if (u == v) return false;
    if (-tree[u] < -tree[v]) std::swap(u, v);  // ?

    tree[u] += tree[v];
    tree[v] = u;
    return true;
  }
  size_t find_root(size_t u) {
    if (tree[u] < 0) return u;
    return (u = find_root(tree[u]));
  }
  bool connected(size_t u, size_t v) {
    return find_root(u) == find_root(v);
  }
};

using Graph=std::vector<std::vector<Edge>>;

size_t connect(const std::vector<Edge> &es, Graph &g, size_t K)  {
  std::map<size_t, size_t> com1;
  std::map<size_t, size_t> rev;
  for (const auto &e: es) {
    if (com1.find(e.src) == com1.end()) {
      size_t tmp=com1.size();
      com1[e.src] = tmp;
      rev[tmp] = e.src;
    }
    if (com1.find(e.dst) == com1.end()) {
      size_t tmp=com1.size();
      com1[e.dst] = tmp;
      rev[tmp] = e.dst;
    }
  }
  UnionFind uf(com1.size());
  for (const auto &e: es) {
    //fprintf(stderr, "%zu -- %zu\n", e.src, e.dst);
    uf.unite(com1[e.src], com1[e.dst]);
  }
  std::map<size_t, size_t> com2;
  for (size_t i=0; i<com1.size(); ++i) {
    size_t p=uf.find_root(i);
    //fprintf(stderr, "%zu's root: %zu\n", i, p);
    if (com2.find(p) == com2.end()) {
      size_t tmp=com2.size();
      com2[p] = tmp;
    }
  }

  for (size_t i=0; i<com2.size(); ++i)
    g.emplace_back();

  for (size_t i=0; i<com1.size(); ++i) {
    size_t child=rev[i];
    size_t parent=K+com2[uf.find_root(i)];
    //fprintf(stderr, "%zu <-> %zu\n", child, parent);
    g[child].emplace_back(child, parent);
    g[parent].emplace_back(parent, child);
  }

  return com2.size();
}

std::vector<intmax_t> shortest(const Graph &g, size_t s) {
  lp_queue<std::pair<intmax_t, size_t>> q;
  q.emplace(0, s);
  std::vector<intmax_t> d(g.size(), INF);
  d[s] = 0;
  while (!q.empty()) {
    intmax_t w=q.top().first;
    size_t v=q.top().second;
    q.pop();
    if (w > d[v]) continue;
    w = d[v];
    for (const auto &e: g[v]) {
      if (d[e.dst] > d[e.src] + 1) {
	d[e.dst] = d[e.src] + 1;
	q.emplace(d[e.dst], e.dst);
      }
    }
  }

  return d;
}

int main() {
  int N, M;
  scanf("%d %d", &N, &M);

  std::map<size_t, std::vector<Edge>> es;
  for (int i=0; i<M; ++i) {
    size_t p, q;
    size_t c;
    scanf("%zu %zu %zu", &p, &q, &c);
    --p, --q;
    es[c].emplace_back(p, q);
  }

  size_t K=N;
  Graph g(N);
  for (const auto &p: es) {
    //fprintf(stderr, "c: %zu\n", p.first);
    const std::vector<Edge> &e=p.second;
    K += connect(e, g, K);
  }

  intmax_t res=shortest(g, 0)[N-1];
  if (res < INF) {
    printf("%jd\n", res/2);
  } else {
    printf("-1\n");
  }
}


Measured memory_bytes: 54536
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
using namespace std;

void solve(){
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  int ans = 0, flag = 1;
  for(int i = n - 1; i >= 0; i--){
    if(flag == 1){
      ans += a[i];
      flag = 0;
    }
    else{
      ans -= a[i];
      flag = 1;
    }
  }
  cout << ans << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>

using namespace std;
int main() {
    vector<int> a(3);
    lp(i,3)
        cin>>a[i];
    sort(a.begin(),a.end());
    cout<<a[0]+a[1]<<endl;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextLong()
    val a = (0 until n).map { sc.next().toLong() }
    println(problem081b(n, a))
}

fun problem081b(n: Long, a: List<Long>): Long {
    val a = a.toMutableList()
    var count = 0L
    while (true) {
        var flg = false
        for (i in 0 until a.size) {
            if (a[i] % 2 == 0L) {
                a[i] = a[i] / 2
            } else {
                flg = true
                break
            }
        }
        if (flg) break
        count++
    }
    return count
}

Measured memory_bytes: 31520
#include <iostream>
#include <vector>
#include <cmath>
#include <random>

typedef long long ll;

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<ll> vec(n);

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

    ll right = vec[n - 1]; // 一番右
    ll left = vec[0]; // 一番左
    ll roffset = 1;
    ll loffset = 1;
    while(roffset + loffset < n){
        if(right > left){
            left += vec[loffset];
            loffset++;
        }else{
            right += vec[n - 1 - roffset];
            roffset++;
        }
    }

    cout << abs(right - left) << endl;

    return 0;
}


Measured memory_bytes: 1792
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	ans := 0
	for i := 0; i < n; i++ {
		a[i] = nextInt(sc)
		ans += a[i] - 1
	}
	fmt.Println(ans)
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n>>m>>d;
      double ans;
      ans=(double)((m-1)*2*(n-d))/(n*n);
      if(d==0)ans=(double)((m-1)*(n-d))/(n*n);
      printf("%.15f\n",ans);
     

       
return 0;
}


Measured memory_bytes: 256
X, K, D = map(int, input().split())
X = abs(X)
D = abs(D)
if X > K * D:
    X = X - K*D
else:
    quo = X//D
    X = X - D*quo
    res = K - quo
    if res % 2 == 1:
        X = X - D
    else:
        pass

print(abs(X))

Measured memory_bytes: 9100
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
using namespace std;

int main(void) {
	int a, b;
	int flag = 0;
	cin >> a >> b;
	if ((a <= 0) && (b >= 0)) {
		cout << "Zero" << endl;
	}
	else {
		FOR(i, a, b) {
			if (i > 0) {
				break;
			}
			else {
				if (flag == 0) {
					flag = 1;
				}
				else {
					flag = 0;
				}
			}
		}
		if (flag == 0) {
			cout << "Positive" << endl;
		}
		else {
			cout << "Negative" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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 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; }
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; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int a[100010];
signed main()
{
    int n;
    cin >> n;
    REP(i, n)
        cin >> a[i];
    map<int, int> mp;
    for (int i = 0; i < n; i++)
    {
        mp[a[i]]++;
    }
    int ans = 0;
    for (auto &u : mp)
    {
        if(u.second >= u.first){
            ans += u.second - u.first;
        }
        else{
            ans += u.second;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7040
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
int main() {
  long long n;
  long long result = 1LL;
  cin >> n;
 
  long long m[n];
  
  for (long long i = 0; i < n; ++i) {
    long long mm;
    cin >> mm;
    m[i] = mm;
  }
  sort(m, m+n);
  for (long long i = 0; i < n; ++i) {
    if (m[i] > 1000000000000000000LL/result) {
      result = -1;
      break;
    }
    result *= m[i];
    if (result == 0) break;

  }
  cout << result << endl;
}






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

int main()
{
    int n,m,h,a,b,i,j,c=0,x;

    cin>>n>>m;

    vector<int>v[n+5];
    int H[n+5];

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

        v[a].push_back(b);
        v[b].push_back(a);
    }
    for(i=1;i<=n;i++){
        for(j=0,x=0;j<v[i].size();j++){
            if(H[v[i][j]]>=H[i]){
                x=1;
                break;
            }
        }
        if(x==0){
            c++;
        }
    }
    cout<<c<<endl;

    return 0;
}

Measured memory_bytes: 9160
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>

using namespace std;
vector<int> pre,in,post;
int n,pos;

void rec(int l,int r){
    if(l>=r) return;
    int root=pre[pos++];
    int m=distance(in.begin(),find(in.begin(),in.end(),root));
    rec(l,m);
    rec(m+1,r);
    post.push_back(root);
}

void solve(){
    pos=0;
    rec(0,pre.size());
    for(int i=0;i<n;i++){
        if(i) cout<<" ";
        cout<< post[i];
    }
    cout<<endl;
}

int main()
{
    int k;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>k;
        pre.push_back(k);
    }

    for(int i=0;i<n;i++){
        cin>>k;
        in.push_back(k);
    }
    solve();
    return 0;
}



Measured memory_bytes: 3156
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static Scanner;

class Program
{
    static void Main()
    {
        new Program().Solve();
    }

    public void Solve()
    {
        int A = ReadInt();
        int B = ReadInt();
        int M = ReadInt();
        int[] a = ReadInt(A).ToArray();
        int[] b = ReadInt(B).ToArray();
        int[] x = new int[M];
        int[] y = new int[M];
        int[] c = new int[M];
        for (int i = 0; i < M; i++)
        {
            x[i] = ReadInt();
            y[i] = ReadInt();
            c[i] = ReadInt();
        }
        int min = a.Min() + b.Min();
        for (int i = 0; i < M; i++)
        {
            int temp = a[x[i] - 1] + b[y[i] - 1] - c[i];
            min = Math.Min(min, temp);
        }
        Console.WriteLine(min);
    }
}

static class Scanner
{
    static Queue<string> que = new Queue<string>();

    static void Scan()
    {
        var line = Console.ReadLine();
        if (line == null) throw new EndOfStreamException();
        foreach (var s in line.Split()) que.Enqueue(s);
    }

    public static string Read()
    {
        if (!que.Any()) Scan();
        return que.Dequeue();
    }
    public static int ReadInt() { return int.Parse(Read()); }
    public static long ReadLong() { return long.Parse(Read()); }
    public static double ReadDouble() { return double.Parse(Read()); }
    public static decimal ReadDecimal() { return decimal.Parse(Read()); }

    // 以下遅延実行に注意
    // ToArray() 等と組み合わせると安全
    public static IEnumerable<string> Read(long n)
    {
        for (long i = 0; i < n; i++) yield return Read();
    }
    public static IEnumerable<int> ReadInt(long n) { return Read(n).Select(int.Parse); }
    public static IEnumerable<long> ReadLong(long n) { return Read(n).Select(long.Parse); }
    public static IEnumerable<double> ReadDouble(long n) { return Read(n).Select(double.Parse); }
    public static IEnumerable<decimal> ReadDecimal(long n) { return Read(n).Select(decimal.Parse); }
}

Measured memory_bytes: 34908
program traveling_salesman_around_lake
  implicit none
  integer :: k, n, a(200000) = 0
  read(*,*) k, n
  read(*,*) a(1:n)
  write(*,'(i0)') k-max(a(1)+k-a(n),maxval(a(2:n)-a(1:n-1)))
end program traveling_salesman_around_lake

Measured memory_bytes: 1920
#include <iostream>

int main()
{
	int A = 0, B = 0, ans = 0;

	std::cin >> A >> B;

	if (A >= 2 * B){
		ans = A - 2 * B;
	}
	else{
		ans = 0;
	}

	std::cout << ans << std::endl;
	return 0;
}

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

int A,B,K;

int solve(){
	bool turn_A = true;
	for(int i=0;i<K;i++){
		if(turn_A){
			if(A%2==1){
				A -= 1;
				A /= 2;
				B += A;
			}else{
				A /= 2;
				B += A;
			}
		}else{
			if(B%2==1){
				B -= 1;
				B /= 2;
				A += B;
			}else{
				B /= 2;
				A += B;
			}
		}
		turn_A ^= true;
	}
	cout << A << " " << B << endl;
	return 0;
}

int main(){
	cin >> A >> B >> K;
	solve();
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
using namespace std;
int main(void) {
  long long N;
  cin >> N;
  long long Amax = sqrt(N);
  for (long long A = Amax; A > 0; A--) {
    if (N%A==0) {
      long long B = N/A;
      // 必ず、B>=Aなので、Bの桁数を数える
      int ans = 1;
      long long div = 10;
      for (;;) {
        if (B/div==0) {
          cout << ans << endl;
          return 0;
        }
        div *= 10;
        ans++;
      }
    }
  }
  return 0; // ここには来ない
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int N; cin >> N; N--;
int B[N];
for(int i=0; i<N; i++){ cin >> B[i]; }
unsigned long ans=B[0];
for(int i=1; i<N; i++){ if(B[i]>B[i-1]){ans+=B[i-1];}else{ans+=B[i];} }
ans+=B[N-1];
cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};
#define MAX 100000
int main(){
    int n,m,p;
    vector<int> x;
    while(cin >> n >> m >> p,n|m|p){
        x.resize(n);
        int sum = 0;
        m--;
        int tmp;
        rep(i,n) {
            cin >> x[i];
            sum += x[i];
            if(i == m) tmp = x[i];
        }
        if(tmp == 0) cout << 0 << endl;
        else cout << sum*(100-p)/tmp << endl;
    }
    return 0;
}


Measured memory_bytes: 3152
using System;
using System.Collections.Generic;
class some
{
	public static void Main()
	{
		string[]kk=Console.ReadLine().Split();
		long a=long.Parse(kk[0]);
		long b=long.Parse(kk[1]);
		int ret=1;
		while(true)
		{
			a*=2;
			
			if(a>b)
			break;
			ret++;
		}
		Console.WriteLine(ret);
							
	}
}

Measured memory_bytes: 13140
//*-- ILSH --*//
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define viii vector < vii >
#define vlll vector < vll >
#define fi first
#define sz size 
#define len length 
#define se second 
//const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=200000+6;
const ll inf=1e17;
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}
ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
bool arr[101][100001];
ll crr[101][100001];
void solve() {
	int n;
	cin>>n;
	int w;
	cin>>w;
	ll brr[n+1][2];
	memset( crr,0,sizeof( crr));
	for (int i=1;i<=n;i++)
		cin>>brr[i][0]>>brr[i][1];
	for ( int i=0;i<=n;i++)
		for ( int j=0;j<=100000;j++)
			crr[i][j]=inf;
	for ( int i=0;i<101;i++){
		arr[i][0]=1;
		crr[i][0]=0;
	}
	for ( int i=1;i<=n;i++) {
		for ( int j=0;j<=100000;j++){
			if ( j-brr[i][1]>=0&&arr[i-1][j-brr[i][1]]){
				crr[i][j]=min( crr[i][j],brr[i][0]+crr[i-1][j-brr[i][1]]);
				arr[i][j]=true;
			}
			if ( arr[i-1][j]){
				arr[i][j]=true;
				crr[i][j]=min( crr[i][j],crr[i-1][j]);
			}
		}
	}

	ll ma=inf;
	for ( int i=0;i<=100000;i++)
		if ( crr[n][i]<=w)
			ma=i;
	cout<<ma<<'\n';



}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while ( t-- )
    	solve();    
}

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

void print(vector<int > v)
{
    cout<<v[0];
    for(int i=1;i<v.size();i++)
    {
        cout<<" "<<v[i];
    }
    cout<<endl;
}

int main()
{
    int n;
    cin>>n;
    vector<int> v;
    for(int i=0;i<n;i++)
    {
        int t;
        cin>>t;
        v.push_back(t);
    }
    if(prev_permutation(v.begin(),v.end()))
    {
        print(v);
    }
    next_permutation(v.begin(),v.end());
    print(v);
    if(next_permutation(v.begin(),v.end()))
     print(v);
}


Measured memory_bytes: 3160
using System;

public class my
{
	public static void Main()
	{
		var n = my.GetLong();
		
		Card[] A = new Card[n];
		
		int i = 0;
		foreach(var s in Console.ReadLine().Split(' ')) {
			A[i++] = new Card(s);
		}
		
		Card[] B = new Card[n];
		A.CopyTo(B, 0);
		
		my.SelectionSort(A);
		my.BubbleSort(B);
		
		//stablity check
		bool isStable = true;
		for(i = 0; i < A.Length; i++) {
			if(B[i].ToString() != A[i].ToString()){
				isStable = false;
				break;
			}
		}
		
		Console.WriteLine(string.Join(" ", Array.ConvertAll( B, x=>x.ToString() ) ) );
		Console.WriteLine("Stable");
		Console.WriteLine(string.Join(" ", Array.ConvertAll( A, x=>x.ToString() ) ) );
		Console.WriteLine(isStable? "Stable" : "Not stable");
	}
	
	public static void SelectionSort(Card[] A)
	{	
		for(int i = 0; i < A.Length; i++ ) {
			int minj = i;
			
			for(int j = i; j < A.Length; j++) {
				if(A[minj].CompareTo(A[j]) > 0)	minj = j;
			}
			
			if(minj != i) {
				Card.Swap(ref A[i], ref A[minj]);
			}
		}
	}
	
	public static void BubbleSort(Card[] A)
	{
		bool flag = true;
		
		while(flag) {
			flag = false;
			
			for(int i = A.Length -1; i > 0; i--) {
				if(A[i-1].CompareTo(A[i]) > 0) { 
					Card.Swap(ref A[i], ref A[i-1]);
					flag = true;
				}
			}
		}
	}
	
	private static void Swap(ref string a, ref string b) 
	{
		string tmp = a;
		a = b;
		b = tmp;
	}
	
	private static void Swap(ref int a, ref int b) 
	{
		int tmp = a;
		a = b;
		b = tmp;
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static long GetLong()
	{
		return long.Parse(Console.ReadLine());
	}
}

public class Card
{
	public int Number { get; private set; }
	public char Suit { get; private set; }
	
	public Card(string s)
	{
		this.Suit = s[0];
		this.Number = int.Parse(s.Substring(1));
	}
	
	public int CompareTo(Card c)
	{
		return this.Number - c.Number;
	}
	
	public override string ToString()
	{
		return Suit.ToString() + Number.ToString();
	}
	
	public static void Swap(ref Card a, ref Card b)
	{
		Card tmp;
		tmp = a;
		a = b;
		b = tmp;
	}
}

Measured memory_bytes: 9216
#include <stdio.h>

#include <iostream>
#include <string>
#include <vector>
using namespace std;

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

    int min_P;
    int counter = 0;

    vector<int> P(N);

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

    for (int i = 0; i < N; i++) {
        if (i == 0) {
            min_P = P[0];
            counter++;
        } else {
            if (min_P > P[i]) {
                min_P = P[i];
                counter++;
            }
        }
    }

    cout << counter << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;

int main() {
  int N; cin >> N;
  int A[N]; rep(i,N) cin >> A[i];

  ll result = A[0]-1, num = 2;
  for (int i=1; i<N; i++) {
    if (A[i]==num) num++;
    else result += (A[i]-1)/num;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
int main(void){
    int num,i,line[1000];
    double sum,sum1;
    for(;sum=0.0,sum1=0.0,scanf("%d",&num),num;){
        for(i=0;i<num;sum+=line[i],i++)
            scanf("%d",&line[i]);
        sum/=num;
        for(i=0;i<num;i++)
            sum1+=pow((line[i]-sum),2);
        sum1/=num;
        printf("%f\n",sqrt(sum1));
    }
    return 0;
}

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

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

    for (int i = 1; i <= 1250; ++i) {
        if (int(i * 8 / 100.0) == a && int(i / 10.0) == b) {
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}



Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    int n;
    cin >> n;
    vector<long> l(n), ll(n);
    for(int i = 0; i < n; i++){
        cin >> l[i];
        if(i == 0) ll[i] = l[i];
        else ll[i] = ll[i-1] + l[i];
    }
    long min = 99999999999999;
    for(int i = 0; i < n; i++){
        long left = ll[i];
        long right = ll[n-1] - ll[i];
        min = std::min(min, abs(left-right));
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 3328
N = int(input())
A = list(map(int, input().split()))
 
INF = 10**9
dp = [INF]*N

for i in range(len(A)):
    if i == 0:
        dp[0] = 0
    elif i == 1:
        dp[1] = abs(A[1]-A[0])
    else:
        dp[i] = min(dp[i-1]+abs(A[i]-A[i-1]), dp[i-2]+abs(A[i]-A[i-2]))
 
print(dp[N-1])

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

int main(void)
{
  int a, b;
  cin >> a >> b;
  for(int i = 0; i < 10000; i++)
  {
    if(a == i * 8 / 100 && b == i * 10 / 100)
    {
      cout << i << endl;
      return (0);
    }
  }
  cout << "-1" << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

ll n, a, ans;

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	while(n--) {
		cin >> a;
		while((a & 1) == 0) {
			a >>= 1;
			ans++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=acos(-1);
const ll INF=1e18;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  string s;
  cin >> s;
  ll k=s.size();
  vl a(26,0);
  rep(i,k){
    a[s[i]-'a']++;
  }
  ll cnt=0;
  if(k%2==1){
    rep(i,26){
      if(a[i]%2==1){
        cnt++;
      }
    }
    cout << cnt/2 << endl;
  }
  if(k%2==0){
    rep(i,26){
      if(a[i]%2==1){
        cnt++;
      }
    }
    cout << (cnt+1)/2 << endl;
  }
}


Measured memory_bytes: 3216
#include <stdio.h>
#include <stdlib.h>

#define INF 1 << 29

int n,a,b,c;
int l[8];

int min(int x,int y){return (x<y)?x:y;}

int dfs(int cur,int _a,int _b,int _c){
    if(cur == n){
        if(min(_a,min(_b,_c))>0){
            return abs(_a-a)+abs(_b-b)+abs(_c-c)-30;
        }else{
            return INF;
        }
    }
    int ch0 = dfs(cur+1,_a,_b,_c);
    int ch1 = dfs(cur+1,_a+l[cur],_b,_c)+10;
    int ch2 = dfs(cur+1,_a,_b+l[cur],_c)+10;
    int ch3 = dfs(cur+1,_a,_b,_c+l[cur])+10;
    
    return min(min(ch0,ch1),min(ch2,ch3));
}

int main(){
    int i;
    scanf("%d%d%d%d",&n,&a,&b,&c);
    for(i=0;i<n;i++)scanf("%d",&l[i]);
    printf("%d\n",dfs(0,0,0,0));
    return 0;
}

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

using namespace std;
const int mx = 1000007;
int repeatfactor[mx];
const long long mod = 1e9 + 7;

int main() {
    int n;
    cin >> n;

    for (int i = 2; i <= n; i++) {
        int m = i;
        for (int j = 2; j * j <= m ; j++) {
            while(m % j == 0) {
                repeatfactor[j]++;
                m = m / j;
            }
        }
        repeatfactor[m]++;
    }

    long long divisor = 1;

    for(int i = 2; i <= n; i++) {
        if(repeatfactor[i]== 0)
            continue;

        divisor = divisor * (repeatfactor[i] + 1);
        divisor = divisor % mod;
    }
    cout << divisor << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int solve(vector<int> *edges,int n,int i,int *dp){
    int leaf=1;
    int ans=0;
    for(auto x:edges[i]){
        leaf=0;
        int t;
        if(dp[x]==-1){
             t=solve(edges,n,x,dp);
        }
        else{
             t=dp[x];
        }
        ans=max(ans,t);
    }
    if(leaf==1){
        return dp[i]=0;
    }
    return dp[i]=1+ans;
}
int main() {
    int n,m;
    cin>>n>>m;
    vector<int> edges[n+1];
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        edges[u].push_back(v);
    }
    int ans=INT_MIN;
    int dp[n+1];
    memset(dp,-1,sizeof dp);
    for(int i=1;i<=n;i++){
        if(dp[i]!=-1){
            ans=max(ans,dp[i]);
        }
        else{
            ans=max(ans,solve(edges,n,i,dp));
        }
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 12576
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define flash ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define rep(n) for(ll j=1;j<=n;j++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define loopne(i,a,b) for(ll i=a;i<b;i++)
ll a[303]={0};
 ll n=0;
 double dp[303][303][303];
 ll visited[303][303][303]={0};
double ex(ll a,ll b,ll c)
{
       if(a+b+c==0||a<0||b<0||c<0)
    {
    return(0);
    }
    
    if(visited[a][b][c]==1)
    return(dp[a][b][c]);
    else
    {
    dp[a][b][c]=((a*ex(a-1,b,c))+(b*ex(a+1,b-1,c))+(c*ex(a,b+1,c-1))+n)/(a+b+c);
    visited[a][b][c]=1;
    return(dp[a][b][c]);
    }

}
int main()
{
    ll c1=0,c2=0,c3=0;
    flash
    cin>>n;
    rep(n)
    {
        ll x;
        cin>>x;
        a[j]=x;
        if(x==1)
        c1++;
        if(x==2)
        c2++;
        if(x==3)
        c3++;
    }
  
    cout<<fixed<<setprecision(9)<<ex(c1,c2,c3);
    
}

Measured memory_bytes: 434432
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, v, b, w, t int
	fmt.Scan(&a, &v, &b, &w, &t)

	dl := int(math.Abs(float64(a - b)))
	dv := int(math.Abs(float64(v - w)))

	if dv == 0 {
		fmt.Println("NO")
		return
	}

	if w > v {
		fmt.Println("NO")
		return
	}

	if dl < dv {
		fmt.Println("NO")
		return
	}

	if dv*t >= dl {
		fmt.Println("YES")
		return
	}

	fmt.Println("NO")
}


Measured memory_bytes: 1816
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5+5;

int main(){
	int N;
	cin>>N;
	lli A[MAX],B[MAX];
	rep(i,N)cin>>A[i]>>B[i];
	lli d[MAX];
	rep(i,N)d[i]=A[i]+B[i];
	sort(d,d+N,greater<lli>());
	
	lli s=0;
	rep(i,N){
		s+=B[i];
	}
	
	lli sum=0;
	rep(i,N){
		if(i%2==0)sum+=d[i];
	}
	cout<<sum-s;
}

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

template <class T> using V = vector<T>;

using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;


#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;



int main() {
  ll a,b;
  ci(a>>b);
  if(a>=13){
    co(b)
  }
  else if(6<=a&&a<=12){
    co(b/2)
  }
  else{
    co(0)
  }
}


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

int main() {
    string sa,sb,sc;
    cin >> sa >> sb >> sc;
    int a=0,b=0,c=0;
    char k=' ',n='a';
    while(k=' '){
        if(n=='a'){
            a++;
            if(a>sa.size()){
                k='A';
                break;
            }
            n=sa.at(a-1);
        }
        else if(n=='b'){
            b++;
            if(b>sb.size()){
                k='B';
                break;
            }
            n=sb.at(b-1);
        }
        else if(n=='c'){
            c++;
            if(c>sc.size()){
                k='C';
                break;
            }
            n=sc.at(c-1);
        }
    }
    cout << k << endl;
}

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

int main()
{
	int h,w;
	cin >> h >> w;
	vector<string> g(h);
	for(int i = 0;i<h;i++)cin >> g[i];
	int cnt = 0;
	for(int i = 0;i<h;i++)
	{
		for(int j = 0;j<w;j++)
		{
			if(g[i][j]=='#')
			{
				cnt ++ ;
			}
		}
	}
	if(cnt==h+w-1)
	{
		cout<<"Possible"<<endl;
	}
	else
	{
		cout<<"Impossible"<<endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 256