akhauriyash/Code-Regression huggingface dataset:
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll N, D, X;
    cin >> N >> D >> X;
    ll sum = 0;
    rep(i, N) {
        ll A;
        cin >> A;
        ll cnt = 1;
        sum++;
        cnt+=A;
        while(cnt <= D) {
            cnt += A;
            sum++;
        }
    }
    print(sum+X);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

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

  cout << (a-2)*180 <<endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,m;
  cin>>n;
  int d,t;
  map<int,int> dmp,tmp;
  REP(i,n){
    cin>>d;
    dmp[d]++;
  }
  cin>>m;
  REP(i,m){
    cin>>t;
    tmp[t]++;
  }
  bool flag = true;
  for(auto p:tmp){
    if(p.second>dmp[p.first]){
      flag = false;
      break;
    }
  }
  if(flag){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}


Measured memory_bytes: 18944
import java.util.*;
import java.io.*;
public class Main
{
	
	
	/************************ SOLUTION STARTS HERE ***********************/
	
	
	
	private static void solve(FastScanner s1, PrintWriter out){
		
		int N = s1.nextInt();
		int M = s1.nextInt();
		int arr[] = s1.nextIntArray(N);
		long sum = 0;
		for(int i=0;i<N-1;i++) {
			if(arr[i] + arr[i + 1] > M) {
				int toRemove = arr[i] + arr[i + 1] - M;
				sum += toRemove;
				int removed = Math.min(arr[i + 1],toRemove);
				arr[i + 1] -= removed;
				toRemove -= removed;
				arr[i] -= toRemove;
			}
		}
		
		out.println(sum);
		// System.out.println(Arrays.toString(arr));
	}
	
	
	
	/************************ SOLUTION ENDS HERE ************************/
	
	
	
	
	
	/************************ TEMPLATE STARTS HERE *********************/
	
	public static void main(String []args) throws IOException {
		FastScanner in  = new FastScanner(System.in);
		PrintWriter out = 
				new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false); 
		solve(in, out);
		in.close();
		out.close();
	}    
	
	static class FastScanner{
		BufferedReader reader;
		StringTokenizer st;
		FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}	
		String next()
		{while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}		    
		st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
		String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}	    	  	
		int    nextInt()   {return Integer.parseInt(next());}
		long   nextLong()  {return Long.parseLong(next());}		
		double nextDouble(){return Double.parseDouble(next());}
		char   nextChar()  {return next().charAt(0);}
		int[]  nextIntArray(int n)         {int[] a= new int[n];   int i=0;while(i<n){a[i++]=nextInt();}  return a;}
		long[] nextLongArray(int n)        {long[]a= new long[n];  int i=0;while(i<n){a[i++]=nextLong();} return a;}	
		int[]  nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}	    	
		long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}	    	
		void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}				
	}
	
	/************************ TEMPLATE ENDS HERE ************************/
}

Measured memory_bytes: 28564
#include <stdio.h>

int main()
{
	char square[100][100] = { 0 };
	int w, h, n, x, y, a, num;
	int i, j, k;
	int count = 0;

	scanf("%d %d %d", &w, &h, &n);

	for(i = 0; i < n; i++) {
		scanf("%d %d %d", &x, &y, &a);
		if (a == 1) {
			for (j = 0; j < x; j++) {
				for (k = 0; k < h; k++) {
					if (square[j][k] == 0 ) {
						square[j][k] = 1;
						count++;
					}
				}
			}
		} else if (a == 2) {
			for (j = x; j < w; j++) {
				for (k = 0; k < h; k++) {
					if (square[j][k] == 0) {
						square[j][k] = 1;
						count++;
					}
				}
			}

		} else if (a == 3) {
			for (j = 0; j < w; j++) {
				for (k = 0; k < y; k++) {
					if (square[j][k] == 0) {
						square[j][k] = 1;
						count++;			
					}
				}
			}
		} else if (a == 4) {
			for (j = 0; j < w; j++) {
				for (k = y; k < h; k++) {
					if (square[j][k] == 0) {
						square[j][k] = 1;
						count++;		
					}
				}
			}
		}
	}

	printf("%d\n", w * h - count);

	return 0;
}



Measured memory_bytes: 128
/*--------------------------"SABUJ-JANA"------"JADAVPUR UNIVERSITY"--------*/
/*-------------------------------@greenindia-----------------------------------*/
//
//		  _____       _           _        _
//		 / ____|     | |         (_)      | |
//		| (___   __ _| |__  _   _ _       | | __ _ _ __   __ _
//		 \___ \ / _` | '_ \| | | | |  _   | |/ _` | '_ \ / _` |
//		 ____) | (_| | |_) | |_| | | | |__| | (_| | | | | (_| |
//		|_____/ \__,_|_.__/ \__,_| |  \____/ \__,_|_| |_|\__,_|
//		                        _/ |
//		                       |__/
/*---------------------- Magic. Do not touch.-----------------------------*/
/*------------------------------God is Great/\---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//cout<<fixed<<showpoint<<setprecision(12)<<ans<<endl;
#define int long long int
#define double long double
#define PI acos(-1)

void print1d(const vector<int>& vec) {for (auto val : vec) {cout << val << " ";} cout << endl;}

void print2d(const vector<vector<int>>& vec) {for (auto row : vec) {for (auto val : row) {cout << val << " ";} cout << endl;}}

signed main() {
 
	crap;

	string s, t;
	cin >> s >> t;

	int n = s.length();
	int m = t.length();

	int dp[n + 1][m + 1];
	for (int i = 0; i < n + 1; ++i) {
		for (int j = 0; j < m + 1; ++j) {
			if (i == 0 or j == 0)
				dp[i][j] = 0;
			else if (s[i - 1] == t[j - 1])
				dp[i][j] = 1 + dp[i - 1][j - 1];
			else
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
		}
	}

	int i = n, j = m;
	string ans = "";

	while (i > 0 and j > 0) {
		if (s[i - 1] == t[j - 1]) {
			ans += s[i - 1];
			i--;
			j--;
		} else {
			if (dp[i - 1][j] > dp[i][j - 1]) {
				i--;
			} else
				j--;
		}
	}

	reverse(ans.begin(), ans.end());
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define MOD 1000000007
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
ll int power(ll int x, ll int y, ll int p)  
{  
   ll int res = 1;     // Initialize result  
 
    x = x % p; // Update x if it is more than or  
                // equal to p
   
    if (x == 0) return 0; // In case x is divisible by p;
 
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
 
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  

int main()
{
   ll int T;
T=1;


    while(T--)
    {
      ll int x;
      cin>>x;
      x=1-x;
      cout<<x<<endl;
    }

    return 0;
       }

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

int main() {
  int N;
  int ans=1;
  cin >> N;
  vector<int> p(N);
  cin >> p.at(0);
  for (int i=1; i<N; i++){
    cin >> p.at(i);
    if (p.at(i) <= p.at(0)) {
     ans=ans+1;
     p.at(0) = p.at(i);
    }
  }
  cout << ans << endl;
}

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

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int GCD(int a,int b) {return b ? GCD(b,a%b):a;}

int main(){
    int N; cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;++i)cin>>a[i];

    vector<int> left(N+1,0),right(N+1,0);
    for(int i=0;i<N;i++) left[i+1]=GCD(left[i],a[i]);
    for(int i=N-1;i>=0;--i) right[i]=GCD(right[i+1],a[i]);
    int ans=0;
 for(int i=0;i<N;i++){
     int c=left.at(i);
     int d=right.at(i+1);
     chmax(ans,GCD(c,d));
 }
 cout<<ans<<endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001; // > 10^9
const int MOD = (int)1e9 + 7;
const ll INFLL = 1001001001001001001;  // > 10^18
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    int n; cin >>n;
    vector<int> a(n); rep(i,n) cin >> a[i];

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == ans + 1) {
            ans += 1;
        } 
    }

    if (ans > 0) {
        cout << n - ans << endl;
    } else {
        cout <<  -1 << endl;
    }
    
    

    return 0;
}




Measured memory_bytes: 1152
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mem(a,x) memset(a,x,sizeof(a))
#define nl "\n"
#define fout(x) fixed<<setprecision(x)
#define one(x) __builtin_popcount(x)
#define F first
#define S second

const int MOD=1e9+7;
const double EPS=1e-9;
const double PI=acos(-1.0);

ll qpow(ll n,ll k){ll ans=1;assert(k>=0);n%=MOD;while(k>0){if(k&1)ans=(ans*n)%MOD;n=(n*n)%MOD;k>>=1;}return ans%MOD;}

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << fout(10)<<x;}
void __print(double x) {cerr << fout(10)<<x;}
void __print(long double x) {cerr << fout(10)<<x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

// ****************************************************



int main()
{
    int n,m;
    cin>>n>>m;
    int ans=max(0, n-(2*m));
    cout<<ans<<nl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;


int main() {
  int a,min,k,ans=0;
  cin >> a;
  min = floor(a/100);
  k = a-min*100;
  if(0<=k && k<=5*min){ cout << 1 << endl; } else { cout << 0 << endl; }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back







int main()
{


	ll n;
	cin >> n;

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

	ll dp[n];

	dp[0] = 0;
	dp[1] = abs(arr[1] - arr[0]);

	for (int i = 2; i < n; i++)
	{
		dp[i] = min(abs(arr[i] - arr[i - 1]) + dp[i - 1], abs(arr[i] - arr[i - 2]) + dp[i - 2]);
	}

	cout << dp[n - 1] << endl;
}





Measured memory_bytes: 1792
import java.util.Scanner;


public class Main{
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int[] cin =new int[10];
		int temp;
		int i=0;
		while(scan.hasNext()){
			temp=scan.nextInt();
			if(temp!=0){
				cin[i]=temp;
				i++;
			}
			else{
				i--;
				System.out.println(cin[i]);
			}
		}
	}

}

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

using namespace std;

const int N=1e5+5;

bool check(const string &s)
{
    int n=s.size();
    for(int i=0;i<n;i++) if(s[i]!=s[n-1-i]) return false;
    return true;
}

int main()
{
    string s;
    cin>>s;
    int n=s.size();
    string t1=s.substr(0,n/2);
    string t2=s.substr(n/2+1);
    if(check(s)&&check(t1)&&check(t2)) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int c=0;

int* Bubble(int N, int *A){
  int flag=1, j, num;
  while(flag){
    flag=0;
    for(j=N-1 ; j>0 ; j--){
      if(A[j]<A[j-1]){
        num=A[j];
        A[j]=A[j-1];
        A[j-1]=num;
        flag=1;
        c++;
      }
    }
  }
  return A;
}

int main(void){
  int N,i;
  int *A;
  while(1){
  scanf("%d",&N);
  if(N>=1 && N<=100)break;
}
  A = (int*)malloc(sizeof(int)*N);
  for(i=0 ; i<N ; i++){
    while(1){
    scanf("%d",&A[i]);
    if(0<=A[i] && A[i]<=100)break;
  }
  }
  A=Bubble(N,A);
  printf("%d",A[0]);
  for(i=1 ; i<N ; i++){
    printf(" %d",A[i]);
  }
  printf("\n%d\n",c);
  return 0;
}


Measured memory_bytes: 2072
h, w, a, b = map(int, input().split())

ans = [[0] * w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if (i < b and j >= a) or (i >= b and j < a):
            print(1, end = "")
        else:
            print(0, end = "")
    
    print()


Measured memory_bytes: 17708
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n, m, s, t; cin >> n >> m >> s >> t;
	--s, --t;
	vector<int> a(m), b(m);
	vector<vector<pair<int,int>>> yen(n), snuke(n);
	rep(i, m)
	{
		int u, x, y, z; cin >> u >> x >> y >> z;
		--u, --x;
		yen[u].push_back(make_pair(x, y));
		yen[x].push_back(make_pair(u, y));
		snuke[u].push_back(make_pair(x, z));
		snuke[x].push_back(make_pair(u, z));
	}
	ll INF = 1e18;
	vector<ll> fromS(n, INF), fromT(n, INF);
	fromS[s] = fromT[t] = 0;
	queue<int> q;
	q.push(s);
	while (!q.empty())
	{
		int now = q.front();
		q.pop();
		for (auto p : yen[now])
		{
			int next, fee;
			tie(next, fee) = p;
			if (chmin(fromS[next], fromS[now] + fee))q.push(next);
		}
	}
	q.push(t);
	while (!q.empty())
	{
		int now = q.front();
		q.pop();
		for (auto p : snuke[now])
		{
			int next, fee;
			tie(next, fee) = p;
			if (chmin(fromT[next], fromT[now] + fee))q.push(next);
		}
	}
	vector<ll> res(n);
	priority_queue<ll, vector<ll>, greater<ll>> pq;
	rrep(i, n)
	{
		pq.push(fromS[i] + fromT[i]);
		res[i] = 1e15 - pq.top();
	}
	rep(i, n)cout << res[i] << endl;
}

Measured memory_bytes: 19328
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repd(a,b,c) for(int a=c;a>=b;a--)
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define pb push_back
#define pbb pop_back
const int N = 5e5+100;
const int mod=1e9+7;
const int inf=1e18;
int power(int a,int b)
{
  int ans=1;
  while(b)
  {
    if(b&1)ans*=a;
    a*=a;
    b/=2;
  }
  return ans;
}
struct node
{
  int p,z,n;
};
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
signed main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int T=1;
    //cin>>T;
   
    while(T--)
    {
      
                int n,t;
                cin>>n>>t;
                int a[n];
                rep(i,0,n)cin>>a[i];
                int ans=t;
                rep(i,1,n)
                {
                  ans+=(min((a[i]-a[i-1]),t));
                }
                cout<<ans<<"\n";
               

                

     

        
        
      
      
      
    }

    
    
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
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=(a);i>(ll)(b);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 co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  st a,b,c;
  	ci(a>>b>>c);
  ch A=a[0]-32,B=b[0]-32,C=c[0]-32;
  co(A<<B<<C)
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PL = pair<ll, ll>;
// Welcome to my source code!

int main() {
    int n, m;
    cin >> n >> m;
    int a[n], b[m], c[n] = {};
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        for (int j = 0; j < n; j++) {
            if (b[i] >= a[j]) {
                c[j]++;
                break;
            }
        }
    }
    int ans = 0, maxj = 0;
    for (int i = 0; i < n; i++) {
        int t = maxj;
        maxj = max(maxj, c[i]);
        if (t != maxj) ans = i + 1;
    }
    cout << ans << endl;
}


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

class solver{
    public:
    int n,ans=0;
    vector<int> memo,x,y,r,c;

    int toInt(vector<bool>& v){
        int res = 0;
        for(int i = 0;i < v.size();i++){
            res <<= 1;
            res += v[i];
        }
        return res;
    }

    int count(vector<bool>& v){
        int res = 0;
        for(int i = 0;i < v.size();i++){
            res += v[i];
        }
        return res;
    }
    
    void dfs(vector<bool>& v){
        int toi = toInt(v);
        if(memo[toi])return;
        memo[toi] = 1;
        ans = max(ans,n-count(v));
        bool top[n];
        for(int i = 0;i < n;i++)top[i] = v[i];
        for(int i = 0;i < n;i++){
            for(int j = i+1;j < n;j++){
                if(!v[j])continue;
                if((r[i]+r[j])*(r[i]+r[j]) > (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])){
                    top[i] = false;
                }
            }
        }
        for(int i = 0;i < n;i++){
            for(int j = i+1;j < n;j++){
                if(c[i] == c[j] && top[i] && top[j]){
                    v[i] = false;
                    v[j] = false;
                    dfs(v);
                    v[i] = true;
                    v[j] = true;
                }
            }
        }
    }

    int solve(int arg){
        n = arg;
        memo.resize(1<<n);
        fill(memo.begin(),memo.end(),0);
        x.resize(n);
        y.resize(n);
        r.resize(n);
        c.resize(n);
        for(int i = 0;i < n;i++){
            cin >> x[i] >> y[i] >> r[i] >> c[i];
        }
        reverse(x.begin(),x.end());
        reverse(y.begin(),y.end());
        reverse(r.begin(),r.end());
        reverse(c.begin(),c.end());
        vector<bool> v(n,true);
        dfs(v);
        return ans;
    }
    
};

int main(){
    int n;
    while(true){
        cin >> n;
        if(!n)return 0;
        solver s;
        cout << s.solve(n) << endl;
    }
}


Measured memory_bytes: 68440
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
typedef long double ld;
typedef unsigned long long ull;
#define X first
#define Y second
#define mp make_pair
template<class T> using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T, class X> using indexed_map = tree<T, X, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const long long M = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

long long modpow(long long n, long long k, long long MOD);

/**************** code starts here ****************/

void poppingfever() {
	int n, k; cin >> n >> k;
	long double ans = 0;

	for (int i = 1; i <= n; i++) {
		// initial score: i
		int in = i;
		// need how many coin flips?
		double odds = 1;

		while (in < k) {
			in *= 2;
			odds /= 2;
		}

		ans += odds;
	}

	cout << ans/n;
}

/**************************************************/

signed main() {
	#ifdef fastfurioustransform
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	#endif

	ios::sync_with_stdio(0); cin.tie(0);
	cout << fixed << setprecision(12);

	poppingfever();

	return 0;
}

long long modpow(long long n, long long k, long long MOD) {
	long long ans = 1; n %= MOD;
	while (k > 0) {
		if (k & 1) ans = (ans*n) % MOD;
		k >>= 1; n = (n*n) % MOD;
	}
	return ans; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,f,t) for (int i=(f);i<=(t);++i)
#define per(i,f,t) for (int i=(f);i>=(t);--i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fr first
#define sc second
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef vector<int> vi;

const int W = (int)1e5+10;
const int N = 111;
int w[N], v[N];
ll dp[N][W];
int n;
int m;

int main() {
    scanf("%d %d", &n, &m);
    rep(i,1,n){
        scanf("%d%d",&w[i],&v[i]);
    }
    rep(i,0,m){
        dp[0][i]=0;
    }
    rep(i,1,n){
        rep(j,0,m){
            dp[i][j]=dp[i-1][j];
            if(j>=w[i]&&(dp[i-1][j-w[i]]+v[i])>dp[i][j])
                dp[i][j]=dp[i-1][j-w[i]]+v[i];
        }
    }
    printf("%lld\n",dp[n][m]);
}



Measured memory_bytes: 80128
ab = [0, 0, 0, 0]
for _ in range(3):
  a, b = map(int, input().strip().split())
  ab[a-1] += 1
  ab[b-1] += 1
  
if ab.count(2) == 2 and ab.count(1) == 2:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3060
#include<stdio.h>

int main(void){
  int n;
  scanf("%d",&n);
  
  int h[n];
  for(int i = 0;i < n;i ++){
    scanf("%d",&h[i]);
  }
  
  int min = 100 , count = 0;
  
  for(int i = 0;i < n;i ++){
    if(h[i] != 0){
      h[i] --;
      i ++;
      while(h[i] != 0 && i < n){
        h[i] --;
        i ++;
      }
      count ++;
      i = -1;
    }
  }
  
  printf("%d\n",count);
  
  return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
s = input()
N = len(s)

for i in range(1, N):
    if i % 2 == 1:
        continue
    a = s[:((N-i)//2)]
    b = s[((N-i)//2):(N-i)]
    if a == b:
        print(N-i)
        break


Measured memory_bytes: 2940
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=200000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 1000000007
#define eps 1e-8
int n,m,x,y;
ll fac[N+10],invfac[N+10];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

ll qpow(ll x,int y)
{
	ll ans=1;
	while (y)
	{
		if (y&1) ans=ans*x%maxd;
		x=x*x%maxd;y>>=1;
	}
	return ans;
}

ll C(int n,int m)
{
	if ((n<m) || (n<0) || (m<0)) return 0;
	return fac[n]*invfac[m]%maxd*invfac[n-m]%maxd;
}

ll calc(int xa,int ya,int xb,int yb)
{
	//printf("calc %d %d %d %d\n",xa,ya,xb,yb);
	int n=xb-xa,m=yb-ya;
	return C(n+m,n);
}

int main()
{
	n=read();m=read();x=read();y=read();
	fac[0]=invfac[0]=1;
	rep(i,1,N) fac[i]=fac[i-1]*i%maxd;
	invfac[N]=qpow(fac[N],maxd-2);
	per(i,N-1,1) invfac[i]=invfac[i+1]*(i+1)%maxd;
	ll ans=0;
	rep(i,1,n-x)
		ans=(ans+calc(1,1,i,y)*calc(i,y+1,n,m)%maxd)%maxd;
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e5 + 5;
int fa[maxn], vis[maxn];
int X[maxn], Y[maxn], Z[maxn];
int Find(int x) {
	if (x != fa[x])
		fa[x] = Find(fa[x]);
	return fa[x];
}
void getF(int x, int y) {
	int xx = Find(x), yy = Find(y);
	if (xx != yy)
		fa[xx] = yy;
}
int main() {
	int n, m;
	while (cin >> n >> m) {
		for (int i = 1; i <= n; i++)
			fa[i] = i, vis[i] = 0;
		for (int i = 1; i <= m; i++)
			scanf("%d%d%d", &X[i], &Y[i], &Z[i]);
		for (int i = 1; i <= m; i++)
			getF(X[i], Y[i]);
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int t = Find(i);
			if (!vis[t])
				ans++, vis[t] = 1;
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;

int main(){
	int A,B;
	cin>>A>>B;
	if(B%A==0){
		cout<<B+A<<endl;
	}else{
		cout<<B-A<<endl;
	}
}

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

using namespace std;

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

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

#endif

void Main() {
    ll n; cin >> n;
    vector<vector<ll>> cnt(26, vector<ll>(n, 0));
    rep(i, n){
        string s;
        cin >> s;
        rep(j, s.size()){cnt[s[j] - 'a'][i] += 1;}
    }
    // rep(i, n){
    //     rep(j, 26){cout << cnt[j][i] << " ";}
    //     cout << endl;
    // }
    rep(j, 26){
        ll tmp = *min_element(cnt[j].begin(), cnt[j].end());
        rep(i, tmp){
            char c = 'a' + j;
            cout << c;
        }
    }
    cout << endl;
}

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


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

int main(){
    int M[100][100];
    int n, u, k, v;
    cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            M[i][j] = 0;
        }
    }
    for(int i = 0; i < n; i++){
        cin >> u >> k;
        u--;
        for(int j =0; j < k; j++){
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(j) cout << " ";
            cout << M[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include <cstdio>
using namespace std;
inline int rd()
{
	int x=0,p=1;
	char a=getchar();
	while((a<48||a>57)&&a!='-')a=getchar();
	if(a=='-')p=-p,a=getchar();
	while(a>47&&a<58)
	{
		x=(x<<1)+(x<<3)+(a&15);
		a=getchar();
	}
	return x*p;
}
int n,a,k,ans;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)scanf("%d",&a),ans+=(a>=k);
	printf("%d\n",ans);
	return 0;
}

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

int main() {
	
  int N;
  char S;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> S;
    if(S == 'Y'){
      cout << "Four" << endl;
      break;
    }
    else if(i+1 == N){
      cout << "Three" << endl;
    }
  }



}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<numeric>
#include<math.h>
#include<deque>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    vector<ll> asum(n);
    rep(i, n) {
        ll tmp_a;
        cin >> tmp_a;
        if ( i == 0 ) asum[0] = tmp_a;
        else          asum[i] = asum[i-1] + tmp_a;
    }
    ll ans = 1e18;
    rep(i, n-1) {
        ans = min(ans, abs(asum[i] - ( asum[n-1] - asum[i]) ) );
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
vector<int> child[100010];
int p[100010];
int vis[100010];
typedef pair<int,int> P;
queue<P>Q;
priority_queue<P>PQ;
void Kill(int x){
	if(vis[x]==0)return;
	vis[x]=0;
	int siz=child[x].size();
	lol(i,siz){
		Kill(child[x][i]);
	}
}
int Ancestor(int x,int len){
	if(len==0)return x;
	return Ancestor(p[x],len-1);
}
int main(){
	int n,k,ans=0;
	cin>>n>>k;
	lol(i,n){
		int a;cin>>a;a--;
		if(i==0&&a>0)ans++;
		p[i]=a;
		child[a].push_back(i);
		vis[i]=mod;
	}
	Q.push(make_pair(0,0));
	while(!Q.empty()){
		int x=Q.front().first;
		int len=Q.front().second;
		Q.pop();
		if(vis[x]!=mod)continue;
		vis[x]=len;
		int siz=child[x].size();
		lol(i,siz){
			int to=child[x][i];
			Q.push(make_pair(to,len+1));
		}
	}
	lol(i,n)PQ.push(make_pair(vis[i],i));
	while(!PQ.empty()){
		int len=PQ.top().first;
		int x=PQ.top().second;
		PQ.pop();
		if(len<=k)break;
		if(vis[x]!=len)continue;
		x=Ancestor(x,k-1);
		Kill(x);
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(void)
{
    string s;
    cin >> s;
    map<char,int> mp;
    rep(i, 4) mp[s[i]]++;
    int answer = 1;
    for(auto m : mp) if (m.second != 2) answer = 0;
    if (answer) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <cstring>
#include <map>
#include <climits>
#include <bitset>

#define ll long long
const ll MOD = 1e9 + 7;
const ll INF = 1 << 29;

ll Add(ll a, ll b)
{
    ll result = a + b;
    return result % MOD;
}

int main()
{
    int H, W;
    std::cin >> H >> W;

    std::vector<std::string> tiles(H);
    for (auto i=0; i<H; ++i)
        std::cin >> tiles[i];

    ll dp[H][W];
    memset(dp, 0, sizeof(dp));

    dp[0][0] = 1;
    for (auto i=0; i<H; ++i)
    {
        for (auto j=0; j<W; ++j)
        {
            // 下
            if (i+1 < H && tiles[i+1][j] == '.')
                dp[i+1][j] = Add(dp[i+1][j], dp[i][j]);

            // 右
            if (j+1 < W && tiles[i][j+1] == '.')
                dp[i][j+1] = Add(dp[i][j+1], dp[i][j]);
        }
    }

    std::cout << dp[H-1][W-1] << std::endl;
}


Measured memory_bytes: 13312
#include <iostream>
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include <algorithm>
#include <cstring>
#include<queue>
#include <stack>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[200005];
    int check = 1;
    int sum = 0;
    for(int i = 0;i<n;i++){
        cin >> a[i];
        if(a[i] == check){
            check++;
        }else{
            sum++;
        }
        
    }
    if(check == 1){
        cout << -1 << endl;
    }else{
        cout << sum << endl;
    }
    return 0;
}

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

 using namespace std;

 int main() {
   int N, i, j, k, max_common;
   string S, X, Y;

   cin >> N >> S;
   max_common = 0;

   for (i = 1; i < N; i++) {
     X = S.substr(0, i);
     Y = S.substr(i, N - i);
     vector<int> countX(26);
     vector<int> countY(26);
     int sum = 0;
     for (j = 0; j < i; j++) {
       countX.at((int)(X.at(j) - 'a'))++;
     }
     for (j = 0; j < N - i; j++) {
       countY.at((int)(Y.at(j) - 'a'))++;
     }
     for (j = 0; j < 26; j++) {
       if (countX.at(j) != 0 && countY.at(j) != 0) sum++;
     }
     max_common = max(max_common, sum);
   }
   
   cout << max_common << endl;

}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split(' ');
            int N = int.Parse(ss[0]);
            int A = int.Parse(ss[1]);
            int B = int.Parse(ss[2]);
            string s = Console.ReadLine();
            int ta, tb;
            ta = 0; tb = 0;
            for (int i = 0; i < s.Length; i++)
            {
                string yn = "No";                
                if ((ta + tb == A + B) ||(s[i] == 'c' ))
                {
                    yn = "No";
                }
                else if( (s[i] == 'b') && tb < B  ) 
                {
                    yn = "Yes";
                    tb++;
                }
                else if ((s[i] == 'a' ) &&( ta + tb < A + B))
                {
                    yn = "Yes";
                    ta++;
                }
                Console.WriteLine(yn);
            }

            Console.ReadLine();

        }
    }
}


Measured memory_bytes: 7384
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define ifYN(x) cout<<(x?"Yes":"No")<<"\n" 
#define dcml(n) fixed<<setprecision(n)

 
ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; } 
ll LCM(ll a,ll b) { return a/GCD(a,b)*b; } 
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; } 
ll modPow(ll x,ll n,ll mod=MOD){ 
    return (!n?1:!n%2?modPow(x*x,n/2,mod)%mod:x%mod*modPow(x,n-1,mod)%mod); 
} 



using namespace std;
//-------------------------------------------
typedef pair<ll,ll> P;
int main(void){
    ll N,M;cin>>N>>M;
    priority_queue<ll,vector<ll>> que;
    ll a;
    REP(i,N){
        cin>>a;
        que.push(a);
    }
    REP(i,M){
        ll q=que.top();que.pop();
        que.push(q/2);
    }
    ll s=0;
    REP(i,N){
        ll q=que.top();que.pop();
        s+=q;
    }
    cout<<s<<"\n";
    
}

Measured memory_bytes: 1400
#include<iostream>
#include<stdio.h>
#include<stdlib.h>

int main()
{
  char s[3];
  scanf("%c %c %c",&s[0],&s[1],&s[2]);
  
  if((s[0] == 'R')&&(s[1] == 'R')&&(s[2] == 'R'))
  {
    printf("3\n"); 
  }
  else if((s[0] == 'R')&&(s[1] == 'R')&&(s[2] == 'S'))
  {
    printf("2\n");
  }
  else if((s[0] == 'S')&&(s[1] == 'R')&&(s[2] == 'R'))
  {
    printf("2\n");
  }
  else if((s[0] == 'S')&&(s[1] == 'S')&&(s[2] == 'S'))
  {
    printf("0\n");
  }
  else
  {
    printf("1\n"); 
  }
  return 0; 
}

Measured memory_bytes: 3120
#include<stdio.h>

int main(){
	int i, len = 0;
	int k;
	int limit;
	char s[128];
	
	scanf("%d%s", &k, s);
	
	while(s[len]){
		len++;
	}
	
	if(k < len) limit = k;
	else limit = len;
	
	for(i = 0;i < limit;i++){
		putchar(s[i]);
	}
	
	if(k < len){
		printf("...");
	}
	
	return 0;
}


Measured memory_bytes: 1732
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/agc023/tasks/agc023_b

//参考：
//https://www.youtube.com/watch?v=8BHBFMrZ8VM

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;
vector<vector<char>> S;

LL ans = 0;

void solve(){
	//slide:横に何マス分ずらすか
	for(int slide=0;slide<N;slide++){

		// for(int h=0;h<N;h++){
		// 	for(int w=0;w<N;w++){
		// 		cout << S[h][(w+slide)%N];
		// 	}
		// 	cout << endl;
		// }
		// cout << endl;

		auto symmetric = [&](){
			for(int h=0;h<N;h++){
				for(int w=h+1;w<N;w++){
					if(S[h][(w+slide)%N]!=S[w][(h+slide)%N]) return;
				}
			}
			ans += N;
			return;
		};
		symmetric();
	}
}

int main(){
    cin >> N;
    S = vector<vector<char>>(N,vector<char>(N,0));
    for(int h=0;h<N;h++){
    	for(int w=0;w<N;w++) cin >> S[h][w];
    }

    solve();

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

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if((a * b % 2) == 0) System.out.println("Even"); else System.out.println("Odd");
	}
}


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

#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
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

const int INF = 1e9;
using S = int;
int op(int a, int b){ return max(a, b); }
int e(){ return 0; }

void Main(){
  int n, k; cin >> n >> k;
  vi a(n); rep(i, n) cin >> a[i];
  segtree<S, op, e> seg(300005);
  rep(i, n){
    int l = max(a[i]-k, 0);
    int r = min(a[i]+k, 300000);
    int tmp = seg.prod(l, r+1) + 1;
    seg.set(a[i], tmp);
  }
  cout << seg.all_prod() << endl;
  return;
}

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

Measured memory_bytes: 9832
// inputに入力データ全体が入る
function Main(input) {
    input = input.split("\n");
    var line = input[0].split(" ");
    var aa = parseInt(line[0]);
    var bb = parseInt(line[1]);
    var cc = parseInt(line[2]);

    if(cc>=aa && cc<=bb){
        console.log("Yes");
    } else {
        console.log("No");
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 21064
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

int main() {
  int N,K;
  std::cin >> N >> K;
  std::vector<long long> V;
  for(int i=0;i<N;i++){
    long long v;
    std::cin >> v;
    V.push_back(v);
  }
  long long max_value=0;
  for(int l=0;l<=std::min(K,N);l++){
    for(int r=0;r<=std::min(K-l,N-l);r++){
      if(l+r==0)
        continue;
      for(int b=0;b<=std::min(K-l-r,l+r);b++){
        std::vector<long long> VLR(l+r);
        if(l>0)
          std::copy(V.begin(),V.begin()+l,VLR.begin());
        if(r>0)
          std::copy(V.end()-r,V.end(),VLR.begin()+l);
        std::sort(VLR.begin(),VLR.end());
        long long sum = std::accumulate(VLR.begin()+b,VLR.end(),0);
        if(sum > max_value)
          max_value = sum;
      }
    }
  }  
  std::cout << max_value << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s; cin >> s;
    while (s[0] != 'A') s.erase(s.begin());
    while (s.back() != 'Z') s.erase(s.end() - 1);
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;

typedef short int i16;
typedef unsigned short int u16;

const int MAXN = 100 + 5;

int answer;
int N, M;
i16 ex, ey;
i16 row[MAXN][MAXN], col[MAXN][MAXN];
i16 dp[MAXN][MAXN][MAXN][MAXN];

char mp[MAXN][MAXN];

int main()
{
	scanf("%d%d", &N, &M);
	for (int i = 1; i <= N; i++)
		scanf("%s", mp[i] + 1);

	for (i16 i = 1; i <= N; i++)
		for (i16 j = 1; j <= M; j++)
		{
			row[i][j] = row[i][j - 1] + (mp[i][j] == 'o'), col[i][j] =
					col[i - 1][j] + (mp[i][j] == 'o');
			if (mp[i][j] == 'E')
				ex = i, ey = j;
		}

	for (i16 i = ex; i >= 1; i--)
		for (i16 j = ey; j >= 1; j--)
			for (i16 k = ex; k <= N; k++)
				for (i16 l = ey; l <= M; l++)
				{
					i16 bl, bh;

					bl = max((int)j - 1, l - ey), bh = min((int)l, M - ey + j);

					if (i > 1 && k - ex < i - 1)
						dp[i - 1][j][k][l] = max((int)dp[i - 1][j][k][l],
								dp[i][j][k][l] + row[i - 1][bh]
										- row[i - 1][bl]);

					if (k < N && ex + k < N + i)
						dp[i][j][k + 1][l] = max((int)dp[i][j][k + 1][l],
								dp[i][j][k][l] + row[k + 1][bh]
										- row[k + 1][bl]);


					bl = max((int)i - 1, k - ex), bh = min((int)k, N - ex + i);

					if (j > 1 && l - ey < j - 1)
						dp[i][j - 1][k][l] = max((int)dp[i][j - 1][k][l],
								dp[i][j][k][l] + col[bh][j - 1]
										- col[bl][j - 1]);

					if (l < M && ey + l < M + j)
						dp[i][j][k][l + 1] = max((int)dp[i][j][k][l + 1],
								dp[i][j][k][l] + col[bh][l + 1]
										- col[bl][l + 1]);
					answer = max(answer, (int) max(
					{ dp[i - 1][j][k][l], dp[i][j - 1][k][l],
							dp[i][j][k + 1][l], dp[i][j][k][l + 1] }));
				}
	printf("%d\n", answer);
	return 0;
}


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

int main() {
    long long N,M,K,j=1;
    long long cnt=0,buf,sum=0;
    unsigned long long max_a=0,max_b=0;
    bool f_a=true,f_b=true;
    cin >> N >> M >> K;
    vector<long long> A(N+1);
    vector<long long> B(M+1);
    for(long long i=1;i<=N;i++){
        cin >> buf;
        sum += buf;
        A.at(i) = sum;
    }
    sum = 0;
    for(long long i=1;i<=M;i++){
        cin >> buf;
        sum += buf;
        B.at(i) = sum;
    }
    max_b = B.size()-1;
    for(int i=0;i<A.size();i++){
        for(int j=max_b;j>=0;j--){
            if(A.at(i)+B.at(j)<=K){
                max_b = j;
                if(i+j>=cnt){
                    cnt = i+j;
                }
                break;
            }
        }
        if(A.at(i)>K){
            break;
        }
    }
    cout << cnt << endl;
}

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

#define N 100

char grid[N][N];

void print(){
    for(long i=0; i<N; i++){
        for(long j=0; j<N; j++){
            cout << grid[i][j];
        }
        cout << endl;
    }
}

int main(void){
    for(long i=0; i<N/2; i++){
        memset(grid[i    ], '.', N);
    }
    for(long i=0; i<N/2; i++){
        memset(grid[i+N/2], '#', N);
    }
    long a, b;
    cin >> a >> b;
    for(long i=0; i<b-1; i++){
        long r=i/50*2;
        long c=i%50*2;
        grid[r][c]='#';
    }
    for(long i=0; i<a-1; i++){
        long r=i/50*2;
        long c=i%50*2;
        grid[N-1-r][N-1-c]='.';
    }
    cout << N << " " << N << endl;
    print();
    return 0;
}


Measured memory_bytes: 256