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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        long[] a = new long[l];
        for(int i=0; i<l; i++) a[i] = sc.nextLong();

        long[][] dp = new long[l+1][5];
        Arrays.fill(dp[0], 0);

        for(int i=0; i<l; i++){
            long min1 = Math.min(dp[i][0], dp[i][1]);
            long min2 = Math.min(dp[i][2], min1);
            long min3 = Math.min(dp[i][3], min2);
            long min4 = Math.min(dp[i][4], min3);
            dp[i+1][0] = dp[i][0] + a[i];
            if(a[i] == 0){
                dp[i+1][1] = min1 + 2;
            }else{
                dp[i+1][1] = min1 + a[i]%2;
            }
            dp[i+1][2] = min2 + (a[i]+1)%2;
            if(a[i] == 0){
                dp[i+1][3] = min3 + 2;
            }else{
                dp[i+1][3] = min3 + a[i]%2;
            }
            dp[i+1][4] = min4 + a[i];
        }

        System.out.println(Arrays.stream(dp[l]).min().getAsLong());
    }
}

Measured memory_bytes: 98704
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
using namespace std;

signed main() {
	string s;
	cin >> s;
	
	int i;
	int cnt = 0;
	for (i = 0; i < s.length(); i++) {
		if (s[i] == 'o') cnt++;
	}
	cnt += 15 - s.length();
	if (cnt >= 8) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>




typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)
#define sz(x) int(x.size())


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

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;

int inf=1001001001;



int main(){
    int n,m;
    cin>>n>>m;
    vector<pair<int,int>> v;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        int ans=0;
        rep(j,b){
            int c;
            cin>>c; c--;
            ans|=(1<<c);
        }
        //cout<<ans<<endl;
        v.emplace_back(a,ans);
    }
    
    vector<int> dp(1<<n,inf);
    dp[0]=0;
    //配るDP
    rep(s,1<<n){
        rep(j,m){
            int t=s|v[j].second;
            dp[t]=min(dp[t],dp[s]+v[j].first);
        }
    }
    
    if (dp[(1<<n)-1]==inf) {
        cout<<-1<<endl;
      return 0;
    }
    cout<<dp[(1<<n)-1];
    
    return 0;
    
   
}


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

using namespace std;

#define int long long

const int N = (int)1e5, MOD = (int)1e9 + 7, INF = (int)3e18;

int pref[N][5];

main() {
    ios :: sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    pref[0][0] = (s[0] == 'R');
    pref[0][1] = (s[0] == 'B');
    pref[0][2] = (s[0] == 'G');
    for (int i = 1; i < n; ++i) {
        pref[i][0] = pref[i - 1][0] + (s[i] == 'R');
        pref[i][1] = pref[i - 1][1] + (s[i] == 'B');
        pref[i][2] = pref[i - 1][2] + (s[i] == 'G');
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n - 1; ++j) {
            int k = -1;
            if (s[i] == 'R' && s[j] == 'B') k = 2;
            if (s[i] == 'B' && s[j] == 'R') k = 2;
            if (s[i] == 'R' && s[j] == 'G') k = 1;
            if (s[i] == 'G' && s[j] == 'R') k = 1;
            if (s[i] == 'G' && s[j] == 'B') k = 0;
            if (s[i] == 'B' && s[j] == 'G') k = 0;
            if (k == -1) 
                continue;
            int l = j + (j - i);
            if (l < n) {
                ans += pref[n - 1][k] - pref[l][k];
                ans += pref[l - 1][k] - pref[j][k];
            }      
            else {
                ans += pref[n - 1][k] - pref[j][k];
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll=long long;
using namespace std;
int main(){
    int n;
    cin>>n;
    ll ans=0;
    for(int a=1;a<=n;a++){
        ans+=(n-1)/a;
    }
    cout<<ans<<endl;
 }



Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main()
{
	int N;
	cin >> N;
	int pv=0,v=0;
	int result = 0;
	for(int i=0;i<N;i++)
	{
		pv 	=  v;
		cin >> v;
		if(pv==v)
		{
			result++;
			v=0;
		}
	}
	cout << result << std::endl;
	return 0;
}

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

typedef long long ll;
typedef long long ll; 
typedef vector<ll> vi; 
typedef pair<int, int> ii; 
typedef vector<ii> vii; 
typedef vector<vi> vvi;
#define sz(a) int((a).size())
#define F first
#define S second
#define pb emplace_back
#define int long long
#define M 1000000007
#define watch(x) cout << (#x) << " is " << (x) << endl
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr(i,a,b) for(int i = a; i<= b; i++)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())

main() {
    IOS;
    
    int n, k;
    cin >> n >> k;
    int ar[n+1];
    vi dp(n+1, 1e9);

    fr(i,1,n)
    	cin >> ar[i];
    dp[1] = 0;

    for (int i = 2; i <= n; i++) {
    	for (int j = 1; j <= k; j++) {
    		if (i-j > 0)
    			dp[i] = min(dp[i], dp[i-j] + abs(ar[i] - ar[i-j]));
    	}
    }

    cout << dp[n];
}

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

int main(){
    int a;
    int b;
    int d;
    int r;
    
    cin >> a >>b;
    
    double f;
    
    d = a / b;
    r = a % b;
    f = 1.0 * a / b;
    
    printf("%d %d %.5lf\n",d,r,f);
    
    return 0;
}


Measured memory_bytes: 3212
#include<iostream>
#include<string>

#define ll long long

using namespace std;

int main()
{
    ll n;
    cin>>n;
    cin.ignore();
    string s;
    getline(cin,s);
    ll len = n;
    for(int i=0;i<n;i++)
    {
        if(s[i]==s[i+1])
            len--;
    }
    cout<<len;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    ll n, k; cin >> n >> k;
    ll r = n % k;
    ll ans = min(r, abs(k - r));
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <queue>
#include <set>
#include <cassert>
using namespace std;
using ll = long long;
using plong = pair<ll,ll>;
ll MOD=998244353;

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

bool cmp(ll a,ll b){
    return a>b;
}
int main(){
    ll X,Y,A,B,C;
    cin>>X>>Y>>A>>B>>C;
    vector<ll> red(A),gre(B),whi(C);
    for(ll i=0;i<A;i++){
        ll a;cin>>a;
        red[i]=a;
    }
    for(ll i=0;i<B;i++){
        ll a;cin>>a;
        gre[i]=a;
    }
    for(ll i=0;i<C;i++){
        ll a;cin>>a;
        whi[i]=a;
    }
    sort(red.begin(),red.end(),cmp);
    sort(gre.begin(),gre.end(),cmp);
    sort(whi.begin(),whi.end(),cmp);
    ll r = X-1,g=Y-1;
    for(ll i=0;i<C;){
        if(red[r]>gre[g]){
            if(gre[g]<whi[i]){
                gre[g]=whi[i];
                g=max(g-1,0ll);
                i++;
            }else{
                break;
            }
        }else{
            if(red[r]<whi[i]){
                red[r]=whi[i];
                r = max(r-1,0ll);
                i++;
            }else{
                break;
            }
        }
    }
    ll res=0;
    for(ll i=0;i<X;i++){
        res+=red[i];
        // cout<<"RED:"<<i<<", val:"<<red[i]<<endl;
    }
    for(ll i=0;i<Y;i++){
        res+=gre[i];
        // cout<<"GRE:"<<i<<", val:"<<gre[i]<<endl;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 2560
a, b = map(int, input().split(' '))

ans = 0

addition = a + b
subtraction = a - b
multiplication = a * b

if addition < subtraction:
  if multiplication < subtraction:
    ans = subtraction
  else:
    ans = multiplication
else:
  if multiplication < addition:
    ans = addition
  else:
    ans = multiplication

print(ans)

Measured memory_bytes: 38384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>

#define MAXN 3005

using namespace std;

double p[MAXN], dp[MAXN][MAXN];

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

    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> p[i];
    }
    dp[0][0] = 1.0;
    for(int i = 1; i <= n; i++) {
        for(int j = 0; j <= i; j++) {
            if(j == 0) {
                dp[i][j] = dp[i - 1][j] * (1.0 - p[i]);
            }
            else {
                dp[i][j] = dp[i - 1][j] * (1.0 - p[i]) +
                            dp[i - 1][j - 1] * p[i];
            }
        }
    }
    double ans = 0.0;
    for(int j = (n + 1) >> 1; j <= n; j++) {
        ans += dp[n][j];
    }
    cout << fixed << setprecision(10) << ans << '\n';

    return 0;
}

Measured memory_bytes: 49948
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    init();
	int n;
	cin >> n;
	rep(i, n) {
		set<string> st;
		string in;
		cin >> in;
		for(int i=1; i<in.length(); i++) {
			string a = in.substr( 0, i );
			string b = in.substr( i, in.length()-i );
			st.insert(a+b);
			st.insert(b+a);
			reverse( a.begin(), a.end() );
			st.insert(a+b);
			st.insert(b+a);
			reverse( b.begin(), b.end() );
			st.insert(a+b);
			st.insert(b+a);
			reverse( a.begin(), a.end() );
			st.insert(a+b);
			st.insert(b+a);
		}
		cout << st.size() << endl;
	}
	return 0;
}

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

#define endl '\n'
#define PB push_back
#define PF push_front
#define MP make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

const int INF = 1e9 + 7;
const ll LINF = 1e18 + 14;

int main(){
    ios_base::sync_with_stdio(false); //cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    cout << n * n * n;
    return 0;
} 


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

int a,b,n,m;
int arc[9][9]={};
int flag[9]={};
    
int dfs(int u){
    int ans;
    for(int i=1;i<=n;i++){
        if(flag[i]!=1){
            break;
        }else if(i==n){
            return 1;
        }
    }

    ans=0;

    for(int i=0;i<=n;i++){
        if(arc[u][i]!=1)continue;
        if(flag[i]==1)continue;
        flag[i]=1;
        ans+=dfs(i);
        flag[i]=0;
    }
    return ans;
}

int main()
{
    int ans;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        arc[a][b]=1;
        arc[b][a]=1;
    }
    flag[1]=1;
    ans=dfs(1);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static final long MOD = 1000000007;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        Integer a,b,c,i,j,k,n,m;

        a=sc.nextInt();
        b=sc.nextInt();

        print((a*3+b)/2);

        
        out.flush();
    }

    private static void print(Object o) {
        System.out.println(o.toString());
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 21204
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int n,m,cnt[200000],loc[200000];
vector<P> s[200000];
int main(void){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b,c;
        cin>>a>>b>>c;
        s[a].push_back(P(b,c));
        s[b].push_back(P(a,c*-1));
    }
    for(int i=0;i<n;i++){
        if(!cnt[i]){
            loc[i]=0;
            cnt[i]=1;
            queue<int> que;
            que.push(i);
            while(!que.empty()){
                int q=que.front();
                que.pop();
                for(auto p:s[q]){
                    if(cnt[p.first]){
                        if(loc[q]+p.second!=loc[p.first]){cout<<"No"<<endl;return 0;}
                    }
                    else{
                        loc[p.first]=loc[q]+p.second;
                        cnt[p.first]=1;
                        que.push(p.first);
                    }
                }
            }
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 12800
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] values = line.split(" ");
        int N = Integer.parseInt(values[0]);
        int K = Integer.parseInt(values[1]);
        if (N <= K) {
            System.out.println("0");
            return;
        }
        line = scanner.nextLine();
        values = line.split(" ");
        ArrayList<Long> monsters = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            monsters.add(Long.valueOf(values[i]));
        }
        Collections.sort(monsters);
        Collections.reverse(monsters);
        long atks = 0;
        for (int i = 0; i < monsters.size(); i++) {
            if (i + 1 > K) {
                atks += monsters.get(i);
            }
        }
        System.out.println(atks);
    }
}

Measured memory_bytes: 79296
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (B >= A * C) {
  cout << C << endl;
  }
  else if (B < A * C) {
    cout << B / A << endl;
  }
 
}

Measured memory_bytes: 256
require'set'

n, m = gets.strip.split.map(&:to_i)
abc = readlines.map {|line| line.strip.split.map(&:to_i) }

graph = Array.new(n+1) { [] }
r_graph = Array.new(n+1) { [] }
edges = []
abc.each do |a, b, c|
  graph[a] << b
  r_graph[b] << a

  edges << [a, b, -c]
end

def reachable(s, g)
  result = Set.new([s])
  q = [s]
  until q.empty?
    c = q.shift
    g[c].each do |to|
      next if result.include?(to)
      result.add(to)
      q.push(to)
    end
  end
  result
end

from_1 = reachable(1, graph)
from_n = reachable(n, r_graph)
ava = from_1 & from_n

edges=edges.select {|a, b, c| ava.include?(a) && ava.include?(b) }

updated = false
INF = 10**14
dist=Array.new(n+1, INF)
dist[1]=0

n.times do
  updated=false
  edges.each do |from, to, cost|
    if dist[from]!=INF && dist[to] > dist[from] + cost
      dist[to] = dist[from] + cost
      updated = true
    end
  end
  break unless updated
end

if updated
  puts 'inf'
  exit
end

p -dist[n]

Measured memory_bytes: 2428
from collections import defaultdict

H, W, M = map(int, input().split())

h = defaultdict(int)
w = defaultdict(int)
boms = set()

for _ in range(M):
    x, y = map(int, input().split())
    h[x] += 1
    w[y] += 1
    boms.add((x, y))

h_max = max(h.values())
w_max = max(w.values())

h_idx = [x for x, y in h.items() if y == h_max]
w_idx = [x for x, y in w.items() if y == w_max]

minus = -1
for x in h_idx:
    for y in w_idx:
        if not (x, y) in boms:
            minus = 0
            break

print(h_max + w_max + minus)

Measured memory_bytes: 238780
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <functional>
#include <algorithm>
#include <stack>
#include <list>
#include <queue>
#include <bitset>
//#include <iostream>
//#include <sstream>
using namespace std;
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define test_ fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> in <<<<<<<<<<<<<<<<<<<<")
#define deb(x) cerr << ">>>>>>>>>>>>>>>>>>>> " << #x << " = " << x << " <<<<<<<<<<<<<<<<<<<<\n"
#define debd(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %d <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define debs(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %s <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define debll(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %lld <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define deblf(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %lf <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ln puts("")
#define mems(a) memset(a, 0, sizeof(a))
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())
//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vll;
//bitmask
int onbit(int x, int pos) {x |= (1 << pos); return x;}
int offbit(int x, int pos) {x &= ~(1 << pos); return x;}
int test(int x, int pos) {return x & (1 << pos);}
int flip(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int onbitall(int x, int pos) {x = (1 << pos)-1; return x;}
//constants
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
//moves
const int dx1[] = {0, 1, 0, -1};
const int dy1[] = {1, 0, -1, 0};
const int dx2[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy2[] = {-1, 0, 1, -1, 1, -1, 0, 1};

int n, a[1234];

bool cek() {
  bool ok = true;
  fr(i, 0, n) {
    if(a[i] % 2 != 0) ok = false;
  }
//  fr(i, 0, n) pf("%d ", a[i]); ln;
  if(ok) {
    fr(i, 0, n) a[i] /= 2;
    return true;
  }
  return false;
}

int main() {
//  freopen("input.in", "r", stdin);
//  debll(simul(8));
//  
//  return 322;
  
  sf("%d", &n);
  fr(i, 0, n) sf("%d", a+i);
  
  int res = 0;
  
  
  while(cek()) {
    res++;
  }
  
  pf("%d\n", res);
  return 0;
}


Measured memory_bytes: 128
import math
A, B = map(int,(input().split()))

list1 = []
list2 = []

border1 = math.ceil(A/0.08)
border2 = math.ceil((A+1)/0.08-1)
border3 = math.ceil(B/0.1)
border4 = math.ceil((B+1)/0.1-1)

for i in range(border1,border2+1,1):
    list1.append(i)
for j in range(border3,border4+1,1):
    list2.append(j)
    
list3 = list(set(list1) & set(list2))

if bool(list3)==True:
    print(min(list3))
else:
    print('-1')

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;

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

    if(n==m){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
 

signed main(){
	
	pair<char,char> p[222222],p2[222222];
	string s,t;
	cin>>s>>t;
	rep(i,s.size()){
	    p[i]=make_pair(s[i],t[i]);
	    p2[i]=make_pair(t[i],s[i]);
	}
	sort(p,p+s.size());
	sort(p2,p2+s.size());
	for(int i=0;i<s.size()-1;i++){
	    if(p[i].first==p[i+1].first){
	        if(p[i].second!=p[i+1].second){
	            cout<<"No"<<endl;
	            return 0;
	        }
	    }
	}
	for(int i=0;i<s.size()-1;i++){
	    if(p2[i].first==p2[i+1].first){
	        if(p2[i].second!=p2[i+1].second){
	            cout<<"No"<<endl;
	            return 0;
	        }
	    }
	}
	cout<<"Yes"<<endl;
}

Measured memory_bytes: 1672
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;


int lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

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

int main()
{
    int N, M;
    cin >> N >> M;
    vector<ll> H(N);
    vector<ll> A(M), B(M);
    for (int i = 0; i < N;i++)
    {
        cin >> H[i];
    }
    ll ans = 0;
    vector<bool> most(N, true);
    for (int i = 0; i < M;i++)
    {
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
        if(H[A[i]] < H[B[i]]){
            most[A[i]] = false;
        }
        else if(H[A[i]] > H[B[i]]){
            most[B[i]] = false;
        }
        else{
            most[A[i]] = false;
            most[B[i]] = false;
        }
    }
    for (int i = 0; i < N;i++)
    {
        if(most[i]){
            ans++;

        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 5624
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

int dp[100][77];
int main(){
  int N;
  scanf("%d", &N);
  std::map<int, int> mp;
  for (int i=2; i<=N; i++){
    int n=i;
    for (int j=2; j*j<=n; j++){
      while (n%j==0){
	mp[j]++;
	n=n/j;
      }
    }
    if (n!=1){
      mp[n]++;
    }
  }
  dp[0][1]=1;
  int i=0;
  for (auto &entry: mp){
    int num=entry.second;
    //printf("num=%d\n", num);
    for (int j=0; j<=num; j++){
      for (int k=0; k<77; k++){
	if (k*(j+1)>76) break;
	dp[i+1][k*(j+1)] += dp[i][k];
	//if (dp[i+1][k+j]!=0){
	//  printf("dp[%d][%d]=%d\n", i+1,k+j,dp[i+1][k+j]);
	//}
      }
    }
    i++;
  }
  std::cout << dp[i][75] << std::endl;
  return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main (){
	string s,t; cin >> s >> t;
	vector<int> v;
	rep(i,s.size()){
		bool found = true;
		rep(j,t.size()){
			if (i+j >= s.size()){
				found = false;
				break;
			}
			if (s[i+j] != t[j] && s[i+j] != '?'){
				found = false;
				break;
			}
		}
		if (found){
			v.push_back(i);
		}
	}
	if (v.size()){
		rep(i,s.size()){
			if (*max_element(all(v))==i){
				cout << t;
				i += t.size()-1;
				continue;
			}
			if (s[i]=='?'){
				cout << 'a';
			}else{
				cout << s[i];
			}
		}
		cout << endl;
		return 0;
	}
	cout << "UNRESTORABLE" << endl;
}

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

int main(void)
{
	ios_base::sync_with_stdio(false);    
	cin.tie(NULL);
	cout.tie(NULL);
	
	int h,w;
	cin>>h>>w;
	vector<string> a;

	string str;
	for(int i=0;i<h;i++)
	{
		cin>>str;
		a.push_back(str);
	}

	vector<vector<int> > dp(h,vector<int> (w,0));
	dp[0][0]=1;

	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(i==0&&j==0)
				continue;
			else{
				if(i==0)
				{
					if(a[i][j]=='#')
						dp[i][j]=0;
					else dp[i][j]=dp[i][j-1];
				}
				else if(j==0)
				{
					if(a[i][j]=='#')
						dp[i][j]=0;
					else dp[i][j]=dp[i-1][j];
				}
				else{
					if(a[i][j]=='#')
						dp[i][j]=0;
					else dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;					
				}
			}
		}
	}

	cout<<dp[h-1][w-1]<<"\n";

	return 0;
}

Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <algorithm>
using namespace std ;
using ll = long long ;

int main(){
	ll n ; cin >> n ;
	string ans ;
	if(n==0){
		cout << 0 << endl ;
		return 0 ;
	}
	int i = 0 ;
	while(n!=0){
		if(n&1){
			ans += '1' ;
			if(i%2==0) n -= 1 ;
			else n += 1 ;
		}else{
			ans += '0' ;
		}
		n /= 2 ;
		i++ ;
	}
	reverse(ans.begin(),ans.end()) ;
	cout << ans << endl ;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
A.append(0)
sum=0
for i in range(N+1):
  if i==0:
    sum+=abs(A[0])
  else:
    sum+=abs(A[i-1]-A[i])
for i in range(N):
  if i==0:
    print(sum+(abs(A[1])-abs(A[1]-A[0])-abs(A[0])))
  else:
    print(sum+(abs(A[i+1]-A[i-1])-abs(A[i+1]-A[i])-abs(A[i]-A[i-1])))

Measured memory_bytes: 20516
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;
int main()
{
  cout<<setprecision(2);
  cout<<setiosflags(ios::fixed);
  int n,m,i,j,k;
  long double M;
  while(cin>>n>>m,n|m){
    vector< vector<long double> >manure(n,vector<long double>(n)),dp(m,vector<long double>(n,0.0));
    for(i=0;i<n;i++)for(j=0;j<n;j++)cin>>manure[i][j];
    for(j=0;j<n;j++)dp[0][j]=1.0;
    for(i=1;i<m;i++){
      for(j=0;j<n;j++){
	for(k=0;k<n;k++){
	  dp[i][j]=max(dp[i][j],dp[i-1][k]*manure[k][j]);
	}
      }
    }
    M=0.0;
    for(j=0;j<n;j++)M=max(M,dp[m-1][j]);
    cout<<M<<endl;
  }
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var N = input[0];
            var K = input[1];
            var X = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var minus = new List<int>();
            var plus = new List<int>();
            var ans = 1000000000;

            for (int i = 0; i < X.Length; i++)
            {
                if (X[i] < 0) minus.Add(X[i]);
                else if (X[i] > 0) plus.Add(X[i]);
                else K--;
            }

            minus = minus.OrderByDescending(i => i).ToList();

            if (K == 0)
            {
                Console.WriteLine(0);
                return;
            }
            if (plus.Count >= K) ans = plus[K - 1];
            if (minus.Count >= K && Math.Abs(minus[K - 1]) < ans) ans = Math.Abs(minus[K - 1]);
            
            for (int i = 0; i < minus.Count; i++)
            {
                if (K - i - 1 == 0) break;
                if (plus.Count - 1 >= K - i - 2)
                {
                    var tmp = Math.Abs(minus[i]) * 2 + plus[K - i - 2];
                    if (ans > tmp) ans = tmp;
                }
            }

            for (int i = 0; i < plus.Count; i++)
            {
                if (K - i - 1 == 0) break;
                if (minus.Count - 1 >= K - i - 2)
                {
                    var tmp = Math.Abs(minus[K - i - 2]) + plus[i] * 2;
                    if (ans > tmp) ans = tmp;
                }
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 25952
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
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; }

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

  ll y = N % K;
  cout << min(y, K - y) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll a, p;
    cin >> a >> p;
    cout << ((a * 3 + p) / 2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> ipair;
typedef tuple<int, int, int> ituple;

// const int INF = INT_MAX;
// const ll INF = LLONG_MAX;
// const int MOD = ((int)1e9 + 7);
// const ld EPS = (1e-10);
#define PI acosl(-1)
#define MAX_N (100000 + 2)

void exec(){
  int n, m, u, v;
  int from_num[MAX_N];
  VI to[MAX_N];
  int parent[MAX_N];
  cin >> n >> m;

  for (int i = 0; i < n; i++){
    from_num[i] = 0;
    parent[i] = -1;
  }

  for (int i = 0; i < n - 1 + m; i++){
    scanf("%d %d", &u, &v);
    u--;
    v--;
    to[u].push_back(v);
    from_num[v]++;
  }

  int root = -1;
  for (int i = 0; i < n; i++){
    if (from_num[i] == 0){
      root = i;
      break;
    }
  }

  priority_queue<ituple, vector<ituple>, greater<ituple> > pq;

  pq.push(ituple(0, root, -1));

  while (!pq.empty()){
    ituple e = pq.top();
    pq.pop();
    int depth = get<0>(e);
    int v = get<1>(e);
    int from = get<2>(e);
    from_num[v]--;

    if (from_num[v] > 0){
      continue;
    }

    parent[v] = from + 1;

    for (int i = 0; i < to[v].size(); i++){
      pq.push(ituple(depth + 1, to[v][i], v));
    }
  }

  for (int i = 0; i < n; i++){
    printf("%d\n", parent[i]);
  }

}

void solve(){
  int t = 1;
  // scanf("%d", &t);
  for (int i = 0; i < t; i++){
    exec();
  }
}

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


Measured memory_bytes: 7040
N,K=map(int,input().split())
ans=[]
a=0
for i in range(K):
    a=input()
    ans.append(input().split())
def flatten_2d(data):
    for block in data:
        for elem in block:
            yield elem
d = list(flatten_2d(ans))

anse=set(d)
print(N-len(anse))

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

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


Measured memory_bytes: 1792
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;
#define int long long
const int N = (int) 1e6 + 6, mod = (int) 0;
pair<int, int> sr[N];

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, m, res = 0;
    cin >> n >> m;
    for (int i = 0; i < n; ++i)
        cin >> sr[i].first, sr[i].second = 0;
    for (int i = n; i < n + m; ++i)
        cin >> sr[i].first, sr[i].second = 1;
    int sz = n + m;
    sort(sr, sr + sz); n++, m++;
    for (int i = 0; i < sz; ++i) {
        int val = sr[i].second, x = sr[i].first;
        res += ((val == 0) * m + (val == 1) * n) * x;
        m -= (val == 1);
        n -= (val == 0);
    }
    cout << res << endl;
}

Measured memory_bytes: 3456
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<set>
#include<tuple>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int main(void) {
	int n;
	cin >> n;
	string s;
	cin >> s;
	ll count = 0;
	for (int i = 0; i < 1000; i++) {
		int c[3] = {(i/100)%10,(i/10)%10,i%10};
		int f = 0;
		for (int j = 0; j < s.size(); j++) {
			if (s[j] - '0' == c[f]) {
				f++;
			}
			if (f == 3) {
				break;
			}
		}
		if (f == 3) {
			count++;
		}
		
	}
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 3600
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

ll P[55], N[55];

ll f(int i, ll x){
  	if(i==0) return x;
  	else if(x==0 || x==1) return 0;
  	else if(x==N[i]) return P[i]; 
  	else if(x<=N[i-1]+1) return f(i-1,x-1);
  	else if(x<=N[i]-1) return 1+P[i-1]+f(i-1,x-2-N[i-1]);
}

void Main()
{
	int n; ll x;
  	cin >> n >> x;
  	
  	// P[i] = レベル i バーガーの P の数
  	// N[i] = レベル i バーガーの全体数
  
  	// レベル 0 バーガー P
  	// レベル 1 バーガー B[P]P[P]B  	
  	// レベル 2 バーガー B[BPPPB]P[BPPPB]B
  	// レベル 3 バーガー B[BBPPPBPBPPPBB]P[BBPPPBPBPPPBB]B
  
  	N[0] = 1;
  	P[0] = 1;
  	int i = 0;
  	while(i < n) {
      	N[i+1] = 3+2*N[i];
      	P[i+1] = 1+2*P[i];
      	i++;
    }
  	
	ll ans = f(n, x);  
  	cout << ans << endl;
	return;
}

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

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAntiAdjacency solver = new AAntiAdjacency();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAntiAdjacency {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            List<Integer> list = new ArrayList<>();
            for (int i = 1; i <= n; i += 2) {
                list.add(i);
            }
            out.println(list.size() >= k ? "YES" : "NO");
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define int long long
#define lint long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

int N, M;
int A[100010];

void _main() {
    cin >> N >> M;
    priority_queue<int> q;
    REP(i, N) {
        cin >> A[i];
        q.push(A[i]);
    }
    REP(i, M) if (!q.empty()) {
        int x = q.top();
        q.pop();
        x /= 2;
        if (x) q.push(x);
    }
    int ans = 0;
    while (!q.empty()) {
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 1912
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    
    vector<pair<long long, int> > drinks(N);
    for (int i = 0; i < N; i++) {
        long long val;
        int num;
        cin >> val >> num;
        drinks[i] = make_pair(val, num);
    }
    sort(drinks.begin(), drinks.end());
    
    //for(int i = 0; i < N; i++) {
    //    cout << drinks[i].first << drinks[i].second << endl;
    //}

    long long total_val = 0;
    int total_num = 0;
    for (int i = 0; i < N; i++) {
        if (total_num >= M) break;

        long long tmp_num = 0;
        int tmp = total_num + drinks[i].second;
        if (tmp < M) {
            total_num += drinks[i].second;
            total_val += drinks[i].first * drinks[i].second;
        } else {
            for (int j = 0; j < drinks[i].second; j++) {
                total_val += drinks[i].first;
                total_num++;
                if (total_num >= M) break;
            }
        }
    }
    cout << total_val << endl;
    return 0;
}

Measured memory_bytes: 1920
n = int(input())
H = list(map(int,input().split()))
dp=[10**5 for i in range(n)]
dp[0]=0
dp[1]=abs(H[1]-H[0])
for i in range(n-2):
    dp[i+2]=min(dp[i]+abs(H[i]-H[i+2]),dp[i+1]+abs(H[i+2]-H[i+1]))
print(dp[n-1])

Measured memory_bytes: 20452
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String p = "";
        String q = "";
        for(int i = 0;i<n;i++){
            p += sc.next();
        }
        for(int i = 0;i<n;i++){
            q += sc.next();
        }
        List<String> list = new ArrayList<>();
        permutation(p,"",list);
        Collections.sort(list);
        int a = list.indexOf(p)+1;
        int b = list.indexOf(q)+1;
        System.out.println(Math.abs(a-b));
    }
    public static void permutation(String q, String ans,List<String> list){
        // Base Case
        if(q.length() <= 1) {
            list.add(ans+q);
        }
        // General Case
        else {
            for (int i = 0; i < q.length(); i++) {
                permutation(q.substring(0, i) + q.substring(i + 1),
                        ans + q.charAt(i),list);
            }
        }
    }
}

Measured memory_bytes: 47676
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll N;
string A, B,C;

//解法
void solve() {

	ll ans = 0;

	rep(i, N) {

		if (A[i] == B[i] && B[i] == C[i]) {
			continue;
		}

		if (A[i] != B[i] && B[i] != C[i] && A[i] != C[i]) {
			ans += 2;
			continue;
		}

		ans++;

	}

	cout << ans;

	return;
}

int main() {
	//入力

	cin >> N>>A>>B>>C;

	solve();
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = String.valueOf(n);
        sc.close();
        int ss = s.length();
        int aaa = 0;
        for(int i = 0 ; i < ss ; i++ ){
            aaa += (s.charAt(i) - 48);
        }
        if(n % aaa == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

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

typedef ostringstream OSS;
typedef istringstream ISS;

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<PII> VPII;

#define fst first
#define snd second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x) (x).begin(),(x).end()
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

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

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int n, d, x;
VVI ps;

int solve(int price, int day) {
    VI dp(price + 1);

    for (int i = 0; i < price; i++) {
        for (int j = 0; j < n; j++) {
            int cost = i + ps[day][j];
            int score = max(
                    dp[i] + ps[day + 1][j],
                    dp[i] + ps[day][j]);

            if (cost <= price && dp[cost] < score) {
                dp[cost] = score;
            }
        }
    }

    //

    int ans = 0;

    for (int i = 0; i <= price; i++) {
        ans = max(ans, dp[i] + price - i);
    }

    return ans;
}

int main(void) {
    cin >> n >> d >> x;

    ps.resize(d, VI(n));
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < n; j++) {
            cin >> ps[i][j];
        }
    }

    //

    int price = x;
    for (int i = 0; i < d - 1; i++) {
        price = solve(price, i);
    }

    //

    cout << price << endl;

	return 0;
}

Measured memory_bytes: 1320