akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>

struct tree {
	int id, left, right, parent, sibling, degree, depth, height;
	std::string type;
};

int make_height(tree trees[], int num) {
	if (trees[num].left == -1 && trees[num].right == -1) { // ???
		trees[num].height = 0;
		return 0;
	}
	if (trees[num].left == -1) {
		if (trees[num].right != -1) {
			trees[num].height = make_height(trees, trees[num].right) + 1;
		}
	} else if (trees[num].right == -1) {
		if (trees[num].left != -1) {
			trees[num].height = make_height(trees, trees[num].left) + 1;
		}
	} else {
		trees[num].height = std::max(make_height(trees, trees[num].left),
			make_height(trees, trees[num].right)) + 1;
	}
	return trees[num].height;
}

void make_node(tree trees[], int num, int depth) {
	if (trees[num].left != -1) {
		trees[num].type = "internal node";
		trees[num].depth = depth;
		make_node(trees, trees[num].left, depth + 1);
	}
	if (trees[num].right != -1) {
		trees[num].type = "internal node";
		trees[num].depth = depth;
		make_node(trees, trees[num].right, depth + 1);
	}
	if (trees[num].right == trees[num].left) {
		trees[num].type = "leaf";
		trees[num].depth = depth;
	}
}

void make_parent_sibling(tree trees[], int n) {
	for (int i = 0; i < n; i++) {
		trees[trees[i].left].parent = trees[i].id; //???????¨????
		trees[trees[i].right].parent = trees[i].id; //???????¨????
		trees[trees[i].left].sibling = trees[i].right; // ??????????¨????
		trees[trees[i].right].sibling = trees[i].left; // ??????????¨????
	}
}

void sort(tree trees[], int n) {
	tree temp;
	for (int i = 0; i < n; i++) {
		for (int j = 1; j < n - i; j++) {
			if (trees[j - 1].id > trees[j].id) {
				temp = trees[j - 1];
				trees[j - 1] = trees[j];
				trees[j] = temp;
			}
		}
	}
}

int main() {
	int n, id, left, right;
	tree trees[25];

	std::cin >> n;

	for (int i = 0; i < n; i++) {
		trees[i].parent = -1;
		trees[i].sibling = -1;
		trees[i].height = 0;
		trees[i].degree = 0;
		trees[i].depth = 0;
	}

	for (int i = 0; i < n; i++) {
		std::cin >> id >> left >> right;
		trees[i].id = id;
		trees[i].left = left;
		trees[i].right = right;
		if (right != -1 && left != -1) {
			trees[i].degree = 2; //????????°
		} else if (left == -1 && right == -1) {
			trees[i].degree = 0;
		}else{
			trees[i].degree = 1;
		}
	}

	sort(trees, n); 
	make_parent_sibling(trees, n);

	for (int i = 0; i < n; i++) {
		if (trees[i].parent == -1) {
			make_height(trees, i);
			make_node(trees, i, 0);
			trees[i].type = "root";
			trees[i].depth = 0;
			break;
		}
	}
	
	for (int i = 0; i < n; i++) {
		std::cout << "node " << trees[i].id << ": ";
		std::cout << "parent = " << trees[i].parent << ", ";
		std::cout << "sibling = " << trees[i].sibling << ", ";
		std::cout << "degree = " << trees[i].degree << ", ";
		std::cout << "depth = " << trees[i].depth << ", ";
		std::cout << "height = " << trees[i].height << ", ";
		std::cout << trees[i].type;
		std::cout << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1208
from collections import Counter

P = 998244353
N = int(input())
D = [int(x) for x in input().split()]

def solve():
  if D[0] != 0:
    return 0
  total = 1
  max_d = max(D)
  counter = Counter(D)
  if counter[0] != 1:
    return 0
  for i in range(max_d + 1):
    if i not in counter:
      return 0
    if i > 1:
      total *= (counter[i - 1] ** counter[i] % P)
      total %= P
  return total

print(solve())    

Measured memory_bytes: 19936
sx,sy,tx,ty=map(int,input().split())
ans_1='U'*(ty-sy)+'R'*(tx-sx)+'D'*(ty-sy)+'L'*(tx-sx)
ans_2='L'+'U'*(ty-sy+1)+'R'*(tx-sx+1)+'D'+'R'+'D'*(ty-sy+1)+'L'*(tx-sx+1)+'U'
print(ans_1+ans_2)

Measured memory_bytes: 3060
import fractions

a,b,c,d = map(int, input().split())

#lis = list(range(a,b+1))

tmp = fractions.gcd(c,d)
lcm = int(c*d/tmp)

if a % c == 0:
    csyou = (b//c) - (a//c) +1
else:
    csyou = (b//c) - (a//c)
    
if a % d == 0:
    dsyou = (b//d) - (a//d) +1
else:
    dsyou = (b//d) - (a//d)
    
if a % lcm == 0:
    lcmsyou = (b//lcm) - (a//lcm)+1
else:
    lcmsyou = (b//lcm) - (a//lcm)

print((b-a+1)-(csyou+dsyou-lcmsyou))




Measured memory_bytes: 5048
n,m=map(int,input().split())
H=list(map(int,input().split()))
L=[[h,[]] for h in H]
for i in range(m):
    a,b=map(int,input().split())
    L[a-1][1].append(b-1)
    L[b-1][1].append(a-1)
c=0
for l in L:
    h=l[0]
    if all([h>L[i][0] for i in l[1]]):c+=1
print(c)

Measured memory_bytes: 37848
using System;
using System.Linq;

namespace DPL1_H
{
    class Program
    {
        static long W;
        static int n;
        static long[] w = new long[200];
        static long[] v = new long[200];

        static void Main(string[] args)
        {
            solve();
        }
        static void solve()
        {
            var t = scan;
            n = (int)t[0];
            W = t[1];
            for (long i = 0; i < n; i++)
            {
                var j = scan;
                w[i] = j[1];
                v[i] = j[0];
            }
            data1();
        }
        static void data1()
        {
            int n1 = n / 2;
            var ps = new pair<long, long>[1 << n1];
            for (int i = 0; i < 1 << n1; i++)
            {
                long sw = 0, sv = 0;
                for (int j = 0; j < n1; j++)
                {
                    if ((i >> j & 1) == 1)
                    {
                        sw += w[j];
                        sv += v[j];
                    }
                }
                ps[i] = new pair<long, long>(sw, sv);
            }
            Array.Sort(ps);
            int m = 1;
            for (int i = 0; i < 1 << n1; i++)
            {
                if (ps[m - 1].Second < ps[i].Second) ps[m++] = ps[i];
            }
            ps = ps.Take(m).ToArray();

            long res = 0;
            int n2 = n - n1;

            for (int i = 0; i < 1 << n2; i++)
            {
                long sw = 0, sv = 0;
                for (int j = 0; j < n2; j++)
                {
                    if ((i >> j & 1) == 1)
                    {
                        sw += w[n1 + j];
                        sv += v[n1 + j];
                    }
                }
                if (sw <= W)
                {
                    long tv = ps[UpperBound1(ps, W - (long)sw) - 1].Second;
                    res = Math.Max(res, sv + tv);
                }
            }
            Console.WriteLine(res);
        }
   

        static long UpperBound1(pair<long, long>[] arr, long val)
        {
            long low = 0, high = arr.Count();
            long mid;

            while (low < high)
            {
                mid = ((high - low) >> 1) + low;
                if (arr[mid].First <= val) low = mid + 1;
                else high = mid;
            }
            return low;
        }
        static long[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), long.Parse); } }
    }

    public class pair<T, U> : IComparable where T : IComparable<T>
    {
        public pair()
        {
        }

        public pair(T first, U second)
        {
            this.First = first;
            this.Second = second;
        }

        public int CompareTo(Object obj)
        {
            pair<T, U> cast = (pair<T, U>)obj;
            return First.CompareTo(cast.First);
        }

        public T First { get; set; }

        public U Second { get; set; }

        public override string ToString()
        {
            return string.Format("{0} {1}?\n", First, Second);
        }

    }
}

Measured memory_bytes: 51656
//#include "pch.h"
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <math.h>
#define OO INT_MAX
#define mp(x,y) make_pair(x,y)
#define x first
#define y second
#define ll unsigned long long int
#define pp pair<int,int>
#define heap priority_queue<pp, vector<pp>, greater<pp>>
using namespace std;

int main()
{
	//freopen("test.txt", "r", stdin);
	
	string s;
	int n;
	string newS;
	cin >> s;
	newS.resize(s.size(), 'x');
	cout << newS;
	return 0;
}



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

#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i = (int)(begin), i##_end = (int)(end); i < i##_end; ++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x

int main(void){
	char S[201];
	cin >> S;

	for(int i = strlen(S) - 2; i; i -= 2){
		if(strncmp(S, S + i / 2, i / 2) == 0){
			printf("%d\n", i);
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
}

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

int main() {
    int n, m, l; cin >> n >> m >> l;
    vector<pair<int, int> > adj[n];
    for (int i = 0; i < m; i++) {
        int a, b, c; cin >> a >> b >> c;
        if (c > l) continue;
        a--; b--;
        adj[a].push_back({b, c});
        adj[b].push_back({a, c});
    }
    const int INF = 1<<30;
    pair<int, int> dist[n][n];
    for (int i = 0; i < n; i++) {
        fill(dist[i], dist[i]+n, make_pair(INF, INF));
        using T = pair<pair<int, int>, int>;
        priority_queue<T, vector<T>, greater<T> > pq;
        dist[i][i] = {0, -l};
        pq.push({{0, -l}, i});
        while (!pq.empty()) {
            int a = pq.top().first.first, b = -pq.top().first.second,
                j = pq.top().second;
            pq.pop();
            if (dist[i][j] < make_pair(a, -b)) continue;
            for (auto e : adj[j]) {
                int cost = e.second, k = e.first;
                int a1, b1;
                if (cost > b) a1 = a + 1, b1 = l - cost;
                else a1 = a, b1 = b - cost;
                if (dist[i][k] > make_pair(a1, -b1)) {
                    dist[i][k] = {a1, -b1};
                    pq.push({{a1, -b1}, k});
                }
            }
        }
    }

    int q; cin >> q;
    while (q--) {
        int s, t; cin >> s >> t;
        auto ans = dist[s-1][t-1].first;
        cout << (ans == INF ? -1 : ans) << endl;
    }
}


Measured memory_bytes: 2984
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char s[5];
	cin>>s;
	for(int i=3;i>=1;i--)
	{
		if(s[i]==s[i-1])
		{
			cout<<"Bad";
			return 0;
		}
	}
	cout<<"Good";
	return 0;
} 

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

ll n, k;
string s;

//count how long moving t frames takes
ll comp(ll t) {
	ll ct = 0;
	for (ll i = 0; i < min(t, 1LL*n); ++i) {
		if (i%2 == 0)
			ct += (s[i] == 'A')+1;
		else
			ct += (s[i] == 'B')+1;
	}
	
	if (t <= n)
		return ct;
    if (n%2 == 1)
	    return ct+2*(t-n);
	else
	    return ct+(t-n);
}

string trans(string g) {
	if (g[0] == 'A')
		g[0] = 'B';
	else {
		string h = "";
		for (ll i = 1; i < g.length(); ++i) {
			if (g[i] == 'A')
				h += 'B';
			else
				h += 'A';
		}
		h += 'A';
		g = h;
	}
	
	return g;
}

string move(ll t) {
	string h = "";
	for (ll i = t; i <= t+n-1; ++i) {
		if (i < n) {
			ll y = (int)'A'+(int)'B';
			if (t%2 == 0)
				h += s[i];
			else
				h += (char)(y-s[i]);
		} else {
			if ((t+n-1-i)%2 == 0)
				h += 'A';
			else
				h += 'B';
		}
	}
    
	return h;
}

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

	cin >> n >> k >> s;
	ll lo = 0, hi = 1e9;

	while (lo != hi) {
		ll mid = (lo+hi+1)/2;
		if (comp(mid) > k)
			hi = mid-1;
		else
			lo = mid;
	}
	
    int j = comp(lo);
	s = move(lo);
	
	if (j == k-1)
		cout << trans(s) << endl;
	else
		cout << s << endl;
}

Measured memory_bytes: 920
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<int,pair<int,int>>;
#define MAX 200003
#define MOD 1000000007
#define INF 1000000000000000000

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

ll score(vector<int> t){
  vector<ll> last(26,0);
  ll ans=0;
  for(ll i=0;i<D;i++){
    ans+=s.at(i).at(t.at(i));
    last.at(t.at(i))=i+1;
    for(ll j=0;j<26;j++){
      ans-=c.at(j)*((i+1)-last.at(j));
    }
  }
  return ans;
}


int main(){
  cin>>D;
  for(int i=0;i<26;i++){
    cin>>c.at(i);
  }
  s.resize(D);
  for(int i=0;i<D;i++){
    s.at(i).resize(26);
    for(int j=0;j<26;j++){
      cin>>s.at(i).at(j);
    }
  }

  vector<ll> last(26,0);
  vector<int> t(D);
  for(ll i=0;i<D;i++){
    int k=0;
    for(int j=0;j<26;j++){
      if(10000*c.at(j)*((i+1)-last.at(j))-s.at(i).at(j)>10000*c.at(k)*((i+1)-last.at(k))-s.at(i).at(k)){
        k=j;
      }
    }
    t.at(i)=k;
    last.at(k)=i+1;
    cout<<t.at(i)+1<<endl;
  }
}


Measured memory_bytes: 3720
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

typedef long long ll;

int main(){
    int n = 0;
    cin >> n;
    int ans;
    ans = 1000*(n/1000+1) - n;
    if(ans %1000 == 0)ans = 0;
    cout << ans << endl;

    return 0;
}

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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define loop(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}

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 gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }

int main(){
  int a,b,c;cin >> a >> b >> c;
  if(a>=c&&c>=b||a<=c&&c<=b) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
#define mp make_pair
#define pb push_back
#define f first
#define s second


//var 
string s;
map<string, int> fq;
int n;

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

	cin >> n;
	while(n--){
		cin >> s;
		fq[s]++;
	}

	cout << "AC x " << fq["AC"] << endl;
	cout << "WA x " << fq["WA"] << endl;
	cout << "TLE x " << fq["TLE"] << endl;
	cout << "RE x " << fq["RE"] << endl;

	cout.flush();
	return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>
#define ll long long
#define INF 1000000000000000001
#define MOD 998244353
using namespace std;


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

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

    ll ans = 1;
    if(D[0]!=0){
        ans=0;
        cout<<ans<<endl;
        return 0;
    }
    
    if(num[0]!=1){
        ans=0;
        cout<<ans<<endl;
        return 0;
    }
    
    for(int i=1; i<N; i++){
        ans *= num[D[i]-1];
        ans %= MOD;
    }
    cout<<ans<<endl;
    return 0;
    
}


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

int main() {
 int X;
 cin >> X;
   for(int i = 1; i < X+1; i++){
     if(X >= 100*i && X <= 105*i){
       cout << 1 << endl;
       return 0;
     }
   }
  cout << 0 << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
N_ = N
num = 1
while N > K:
    N = N//K
    num +=1

list = []

for i in range(num, -1, -1):
    n = str(N_//(K**i))
    N_ = N_ % (K**i)
    # print(N_, n)
    list.append(n)


while list[0] == "0":
    list.remove("0")

print(len(list))



Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
double EPS=1e-10;
double EQ(double a,double b){
    return abs(a-b)<EPS;
}
void fast_stream(){
  std::ios_base::sync_with_stdio(0);
}
template<class T>
string IntToString(T num){
  string res;stringstream ss;ss<<num;
  return ss.str();
}
ll StringToInt(string &str){
  ll res;
  for(int i=0;i<(int)str.size();i++)
    res=(res*10+str[i]-'0');
  return res;
}

int N,M;
int as[101];
int bs[101];
int cs[101];
const int INF=1<<29;
int dp[51][51][51][51];

int dfs(int pos,int t,int o,int m){
  if(dp[pos][t][o][m]!=INF)return dp[pos][t][o][m];
  if(pos==N)return 0;
  int res=-INF;
  if(m-1>=0)res=max(res,dfs(pos,t+1,o,m-1));
  res=max(res,dfs(pos+1,0,t,m)+cs[pos]);
  if(!(t==0&&o==0)){
    for(int i=0;i<=o;i++){
      for(int j=0;j<=t;j++){
	if((i==0&&j==0)||(i+j>8))continue;
	int add=j*as[pos]+i*bs[pos];
	res=max(res,dfs(pos+1,0,t,m)+add);
      }
    }
  }
  return dp[pos][t][o][m]=res;
}

int main(){
  cin>>N>>M;
  for(int i=0;i<N;i++)cin>>as[i]>>bs[i]>>cs[i];
  for(int i=0;i<51;i++)
    for(int j=0;j<51;j++)
      for(int k=0;k<51;k++)
	for(int l=0;l<51;l++)
	  dp[i][j][k][l]=INF;
  cout<<dfs(0,0,0,M)<<endl;
  return 0;
}

Measured memory_bytes: 27596
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int m,n,mx,mxi;
	int hiyo[1001],kazu[1001];
	int i,j,x;
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++)	{
		scanf("%d",&hiyo[i]);
		kazu[i]=0;
	}
	for(i=0;i<m;i++)	{
		scanf("%d",&x);
		for(j=1;j<=n;j++)	{
			if(hiyo[j]<=x)	{
				kazu[j]++;
				break;
			}
		}
	}
	mx=-1;
	for(i=1;i<=n;i++)	{
		if(mx<kazu[i])	{
			mx=kazu[i];
			mxi=i;
		}
	}
	printf("%d\n",mxi);
	return 0;
}


Measured memory_bytes: 1032
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

//#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int K, S;

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

	cin >> K >> S;

	int ans = 0;
	rep(i, 0, K + 1)rep(j, 0, K + 1)
	{
		if (i + j <= S && S - (i + j) <= K)
		{
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
/*    特徴    */

/*    教訓    */

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld  = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x) == 1) return x; }
long long il() { long long x; if (scanf("%lld", &x) == 1) return x; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

#define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

// -------- template end - //


// - library ------------- //


// --------- library end - //



// - main() -------------- //

int main(){

  ll N = il();
  ll M = il();
  priority_queue<ll> prices;
  rep(i, N){
    prices.push(il());
  }

  rep(i, M){
    ll tmp = prices.top();
    prices.pop();
    tmp /= 2;
    prices.push(tmp);
  }

  ll ans = 0;
  while (!prices.empty()){
    ans += prices.top();
    prices.pop();
  }

  cout << ans << endl;





// ---------- main() end - //
}

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

int main () {
  int i, j, k, N, A, B, x, y, count=0, min=INT_MAX, sum;
  
  cin >> N;
  
  
  rep(i,N/2+1){
    x=y=0;
    A=i+1;
    B=N-i-1;

    for(;A!=0;){
        
      x+=A%10;
      A/=10;
    }
    for(;B!=0;){
      y+=B%10;
      B/=10;
    }
      
    if(x+y<min) min=x+y;
  }
    
    cout << min;
}
  






Measured memory_bytes: 3568
a = int(input())

L = int(a/100)
R = int(a%100)

if 1<=L and L<=12:
	if 1<=R and R<=12:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if 1<=R and R<=12:
		print("YYMM")
	else:
		print("NA")


Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcd(long long a,long long b){return a*b / gcd(a,b) / gcd(a,b);}
int main()
{
	string S,T;
	cin>>S>>T;
	int N = S.size();
	int count = 0;
	for(int i=0; i<N; i++)
	{
		if(S[i] != T[i])
		{
			count++;
		}
	}
	cout<<count<<endl;
}

Measured memory_bytes: 3860
#include<iostream>

using namespace std;

int main(){
  char S[6];
  
  cin >> S;
  
  if(S[2] == S[3] && S[4] == S[5]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}

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

int main(){
  string s;
  cin>>s;
  string A="Yes";
  int x=0,n=s.size();
  if(s.size()!=4){
    x=1;
  }
  else{
  for(int i=0;i<n;i++){
    int c;
    c=0;
    for(int j=0;j<n;j++){
      if(s[i]==s[j]){
        c++;
      }
    }
    if(c!=2){
      x=1;
      break;
    }
  }
  }
  if(x!=0){
    A="No";
  }
  cout<<A<<endl;
}

Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))
d = []
for x1, x2 in zip(x, x[1:]):
    d.append(x2 - x1)
mod = 10 ** 9 + 7
base = 1

P = 10**9 + 7
N = n+2
inv_t = [0]+[1]
for i in range(2,N):
  inv_t += [inv_t[P % i] * (P - int(P / i)) % P]

for i in range(1, n):
    base *= i
    base %= mod
ans = 0
b = base
for i, di in enumerate(d):
    ans += (base * di)  % mod
    ans %= mod
    base += b * inv_t[i+2]
    base % mod
print(ans)


Measured memory_bytes: 65944
fun main(args: Array<String>) {
    val (n, k) = readInputLine().split(" ").map { it.toInt() }
    val aList = readInputLine().split(" ").map { it.toInt() }
    
    val countMap = mutableMapOf<Int, Int>()
    
    for (a in aList) {
        val countNum = countMap.get(a) ?: 0
        countMap.put(a, countNum + 1)
    }
    
    val countList = countMap.values.toList().sortedDescending()

    if (countList.size <= k) {
        println(0)
    } else {
        println(countList.takeLast(countList.size - k).sum())
    }
}
 
fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 82020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;

string cmp(string a,string b){
    a=regex_replace(a,regex("^0*"),"");
    b=regex_replace(b,regex("^0*"),"");
    int p=a.size();int q=b.size();
    if(p>q)return a;
    if(p<q)return b;
    rep(i,p){
        if((int)a[i]>b[i])return a;
        if((int)a[i]<b[i])return b;
    }
    return a;
}

int main(){
    while(true){
    int w,h;cin>>w>>h;if(!w)break;
    string s[h];
    rep(i,h) cin>>s[i];
    string dp[h+1][w+1];
    rep(i,h) rep(j,w){
        if((int)s[i][j]-'0'<0||(int)s[i][j]-'0'>9)continue;
        dp[i+1][j+1]=cmp(dp[i][j+1],dp[i+1][j])+s[i][j];
    }
    string ans;
    rep(i,h) rep(j,w){
        ans=cmp(ans,dp[i+1][j+1]);
    }
    cout<<ans<<endl;
    }
}



Measured memory_bytes: 3352
#include<iostream>
#include<sstream>
#include<map>
using namespace std;
int main(){
  string b;
  map<string,int> m;
  m["A"]=0;
  m["B"]=0;
  m["AB"]=0;
  m["O"]=0;
  while(cin >> b){
    for(int i=0;i<b.size();i++) if(b[i]==',') b[i]=' ';
    stringstream ss(b);
    int n;
    ss >> n >> b;
    m[b]++;
  }
  cout << m["A"] << endl;
  cout << m["B"] << endl;
  cout << m["AB"] << endl;
  cout << m["O"] << endl;
  
}

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

#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
#define pb push_back
#define sz(s) (int)s.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define for1(i,n) for(int i=1;i<=(int)n;i++)
#define ford(i, b, a) for (int i = (int)(b); i >= a; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
const ll N = (ll)1e5+77;
const ll inf = (ll) 1e16+7;
const ll mod = (ll) 998244353;
const ld pi = acos(-1);

int main() {
    fast;
    int n, k;
    cin >> n >> k;
    if ((n + 1) / 2 >= k) cout << "YES\n";
    else cout << "NO\n";
    return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    ll a, b, c, k;
    cin >> a >> b >> c >> k;

    if(k<=a) cout << k << endl;
    else{
        k = k-a-b;
        if(k<0) cout << a << endl;
        else cout << a - k << endl;
    }
}

Measured memory_bytes: 3608
#include <iostream>

int main()
{
	while (true) {
		int x, y;

		std::cin >> x >> y;

		if (x == 0 && y == 0) {
			break;
		}

		if (x < y) {
			std::cout << x << " " << y << std::endl;
		}
		else {
			std::cout << y << " " << x << std::endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3072
using System;
using System.Collections.Generic;
using static Assistant.Input;
using System.Linq;
using Assistant;

namespace Temp20200521
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = ReadInt;
            int M = ReadInt;

            int[] a = new int[M];
            int[] b = new int[M];
            int[][] c = new int[M][];
            for (int i = 0; i < M; i++)
            {
                a[i] = ReadInt;
                b[i] = ReadInt;
                c[i] = ReadInts.Select(x => x - 1).ToArray();
            }

            //bitDP
            int[] dp = new int[1 << N];//頂点
            for (int i = 0; i < 1 << N; i++)
            {
                    dp[i] = int.MaxValue / 2;
            }
            dp[(1 << N) - 1] = 0;

            for (int i = (1 << N) - 1; i >= 0; i--)
            {
                for (int j = 0; j < M - 1; j++)
                {
                    int next = i;
                    for (int k = 0; k < c[j].Length; k++)
                    {
                        next = next | (1 << c[j][k]);
                    }

                    dp[i] = Math.Min(dp[i], dp[next] + a[j]);
                }
            }

            int ans = dp[0];
            if (ans == int.MaxValue / 2) ans = -1;
            Console.WriteLine(ans);
        }
    }
}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
}


Measured memory_bytes: 13524
#include<iostream>
#include<algorithm>
#include<cmath>

#include<vector>
using namespace std;
#define INF 1e8

int n;
double r, theta;
double x[21], y[21];
double dist[2][400];
int cnt[400];
vector<int> edge[10800];
double d(int a, int b){
	return sqrt((x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]));
}
bool ok(int a, int b, int c, double theta){
	double dot = (x[b]-x[a]) * (x[c]-x[b]) + (y[b]-y[a]) * (y[c] - y[b]);
	double dist1 = d(a, b);
	double dist2 = d(b, c);
	return cos(theta)*dist1*dist2 <= dot;
}


int solve(double r){
	bool cont = true;
	bool ok = false;
	for(int i = 0;i < 400;i++)dist[1][i] = INF;
	for(int i = 1;i < n;i++){
		if(d(0, i) < r)ok = true;
		dist[1][i] = d(0,i);
	}
	if(!ok)return 0;
	int cnt = 0;
	while(cont){
		cnt++;
		cont = false;
		for(int i = 0;i < 400;i++)dist[!(cnt%2)][i] = INF;
		for(int i = 0;i < 400;i++){
			for(int j = 0;j < edge[i].size();j++){
				int to = edge[i][j];
				double dd = d(to / n, to % n);
				dist[!(cnt%2)][to] = min(dist[!(cnt%2)][to], dist[(cnt%2)][i] + dd);
				if(dist[!(cnt%2)][to] < r){
					cont = true;
				}
			}
		}
	}
	return cnt;
}

int main(){
	cin >> n;
	cin >> r >> theta;
	theta = theta / 180 * 3.1415926535897932384626433;
	for(int i = 0;i < n;i++){
		cin >> x[i] >> y[i];
	}

	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			for(int k = 0;k < n;k++){
				if(i == j || j == k)continue;
				if(ok(i, j, k, theta)){
					int u = i * n + j;
					int v = j * n + k;
					edge[u].push_back(v);
				}
			}
		}
	}
	cout << solve(r) << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;

const double eps = 0.00001;
const int MOD = 1000000007;
const int INF = 2147480555;
const ll LINF = 9223372000000000555;
const int N = 1550555;
const int M = 525;

int a[N];
void solve() {
    int n;
    cin >> n;

    ll sum = 0;
    int best = 0;

    for (int i = 1; i <= n; i++){
        cin >> a[i];
        sum += max(0, best - a[i]);
        best = max(best, a[i]);
    }

    cout << sum;

}


int main() {
    ios_base::sync_with_stdio(false);
#ifdef dddxxz
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 4380
#include<cstdio>
#include<cstring>
using namespace std;
int n,L,a[100010];
int main()
{
    while(~scanf("%d%d",&n,&L))
    {
        for(int i=1;i<=n;i++)
            scanf("%d",a+i);
        int ch=-1;
        for(int i=1;i<n;i++)
            if(a[i]+a[i+1]>=L)
        {
            ch=i;break;
        }
        if(ch==-1)
        {
            puts("Impossible");continue;
        }
        else puts("Possible");
        for(int i=1;i<ch;i++)printf("%d\n",i);
        for(int i=n-1;i>ch;i--)printf("%d\n",i);
        printf("%d\n",ch);
    }
}


Measured memory_bytes: 1152
// B.

#include <iostream>
#include <algorithm>
#include <numeric>

using namespace std;

int main(int argc, char *argv[])
{
	long long a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	int k;
	cin >> k;
	for (int i = 0; i < k; ++i) {
		a[2] *= 2;
	}
	long long ans = accumulate(a, a + 3, 0LL);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
//
//  sublime text 3,
//  emre yazicioglu
//

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
#define pb push_back
#define fi first
#define se second
#define INF (ll) (1e18 + 7)
#define MOD (ll) (1e9 + 7)

const int N = 2e6 + 7;
ll mn = INF, mx = -INF;
ll n, m, k, s, q, t;
ll a, b, c, d, e;
ll ans, cur, sum, cnt;
ll ar[N], p[N], dp[N];
string str; bool h[N];
pll pp[N]; vll v;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);

  // freopen("../in.txt","r",stdin);
  // freopen("../out.txt","w",stdout);

  cin >> n;
  n--;
  cout << n * (n + 1) / 2;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
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; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    int n;
    cin >> n;
    vector<int> v(1e6+1);
    rep(i, n){
        int a; cin >> a;
        v[a]++;
    }

    for(int i=1; i<=1e6; i++){
        if(v[i] == 0) continue;
        for(int j=i+i; j<=1e6; j+=i){
            v[j] = 0;
        }
        if(v[i] > 1) v[i] = 0;
    }

    int ans = 0;
    rep(i, v.size()) ans += v[i];
    cout << ans << endl;
}

Measured memory_bytes: 7164
function Main(input) {
  input = input.split("\n");
  tmp = input[0].split(" ");
  var h = parseInt(tmp[0]);
  var w = parseInt(tmp[1]);
  c=new Array(10).fill(0);
  for(i=0;i<10;i++){
    cpre=input[i+1].split(" ");
    c[i]= [parseInt(cpre[0]),
    parseInt(cpre[1]),
    parseInt(cpre[2]),
    parseInt(cpre[3]),
    parseInt(cpre[4]),
    parseInt(cpre[5]),
    parseInt(cpre[6]),
    parseInt(cpre[7]),
    parseInt(cpre[8]),
    parseInt(cpre[9]),]
  }
  a = new Array(10).fill(0);
  for(i=0;i<h;i++){
    apre=input[i+11].split(" ");
    for(j=0;j<w;j++){
      if(apre[j]>=0){
        a[apre[j]]++;
      }
    }
  }
  b = new Array(10).fill();
  for(i=0;i<10;i++){
    b[i]=c[i][1];
  }
  var ans =0;
  for(i=0;i<10;i++){
    anspre = new Array(10).fill(0);
    for(j=0;j<10;j++){
      anspre[j]=[j,10000];
    }
    anspre[i][1]=0;
    d=new Array(0,1,2,3,4,5,6,7,8,9);
    if(a[i]!=0&&i!=1){
      var x=i;
      while(d.length>0){
        var n=10000;
        for(j=0;j<d.length;j++){
          if(anspre[x][1]+c[x][d[j]]<anspre[d[j]][1]){
            anspre[d[j]][1]=anspre[x][1]+c[x][d[j]];
          }
          if(anspre[d[j]][1]<n && anspre[d[j]][1]!=0 && d.indexOf(x)!=j){
            n=anspre[d[j]][1];
            var y =d[j];
          }
        }
        d.splice(d.indexOf(x),1);
        x=y;
      }

      ans=ans+anspre[1][1]*a[i];
    }
  }

  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21576
#include <bits/stdc++.h>
#define re runtime_error
using namespace std;

int cal(int a, char op, int b) {
	switch (op) {
		case '+': return a + b;
		case '-': return a - b;
		case '*': return a * b;
		case '/': {
			if (b == 0) throw re("You can't divide by 0");
			else return a / b;
		}
		default: throw re("No such operator");
	}
}

int main() {
	int a, b; char op;
	cin >> a >> op >> b;
	cout << cal(a, op, b) << '\n';
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
string s;
 
int getarea(int a,int b){
  int res=0,h=0;
  stack<P> st;
  for(int i=a;i<=b;i++){
    if(s[i]=='\\')st.push(P(h,i)),h--;
    if(s[i]=='/'){
      h++;
      if(!st.size())continue;
      P t=st.top();
      if(t.first==h)res+=i-t.second,st.pop();
    }
  }
  return res;
}
 
int check(int x){
  int h=0;
  for(int i=x;i<s.size();i++){
    if(s[i]=='\\')h--;
    if(s[i]=='/'){
      h++;
      if(!h)return i;
    }
  }
  return -1;
}
 
int main(){
  int h=0,ans=0;
  vector<int> v;
  cin>>s;
  for(int i=0;i<s.size();i++)
    if(s[i]=='\\'){
      int r=check(i);
      if(r>=0){
    int area=getarea(i,r);
    v.push_back(area);
    ans+=area,i=r-1;
      }
    }
  cout<<ans<<endl;
  cout<<v.size();
  if(v.size())cout<<' ';
  for(int i=0;i<v.size();i++){
    if(i)cout<<' ';
    cout<<v[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3236
//ｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｹｯｺｯｯｺｰｰｰｰ!!!!!!wwwwwwwwwww
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(b - a == c - b){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 35672
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
	int n;cin >>n;
  	set<string>p;
  	string s;
  	while(n--)
   	{
    	cin >> s;
      	p.insert(s);
    }
  	cout << p.size() <<endl;
  	return 0;
}

Measured memory_bytes: 19248
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
const int    dx[]={-1,0,0,1};
const int    dy[]={0,-1,1,0};
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

//幾何学テンプレート

#define equals(a,b) (fabs((a)-(b))<EPS)

//点
class Point{
public:
  double x,y;

  Point(double x = 0,double y = 0):x(x), y(y){};

  Point operator + (Point p) {return Point (x+p.x, y+p.y);}
  Point operator - (Point p) {return Point (x-p.x, y-p.y);}
  Point operator * (double a) {return Point(a*x, a*y);}
  Point operator / (double a) {return Point(x/a,y/a);}

  double abs(){return sqrt(norm());}
  double norm(){return x*x+y*y;}

  bool operator < (const Point &p)const{
    return x!=p.x ? x<p.x:y<p.y;
  }
  bool operator > (const Point &p)const{
    return x!=p.x ? x>p.x:y>p.y;
  }
  bool operator == (const Point &p)const{
    return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
  }
};

//ベクトル
typedef Point Vector;

//内積
double dot(Vector a,Vector b){
  return a.x*b.x+a.y*b.y;
}

//外積
double cross(Vector a,Vector b){
  return a.x*b.y-a.y*b.x;
}

//線分
struct Segment{Point p1,p2;};

//直線
typedef Segment Line;

//円
class Circle{
public:
  Point c;   //中心
  double r;  //半径
  Circle(Point c=Point(),double r=0.0):c(c),r(r){}
};

//多角形
typedef vector<Point> Polygon;

//線分s1と線分s2の交点を求める。

Point getCrossPoint(Segment s1,Segment s2){
  Vector base=s2.p2-s2.p1;
  double d1=abs(cross(base,s1.p1-s2.p1));
  double d2=abs(cross(base,s1.p2-s2.p1));
  double t =d1/(d1+d2);
  return s1.p1+(s1.p2-s1.p1)*t;
}


signed main(){
  int q;cin>>q;
  for(int i=0;i<q;i++){
    double x0,y0,x1,y1,x2,y2,x3,y3;cin>>x0>>y0>>x1>>y1>>x2>>y2>>x3>>y3;
    Point p0={x0,y0},p1={x1,y1},p2={x2,y2},p3={x3,y3};
    Point ans=getCrossPoint(Segment{p0,p1},Segment{p2,p3});
    cout<<fixed<<setprecision(15)<<ans.x<<" "<<ans.y<<endl;
  }

  return 0;
}



Measured memory_bytes: 3300
#ABC131-A

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  s=S()
  for i in range(len(s)-1):
    if s[i]==s[i+1]:
      return 'Bad'

  return 'Good'

print(main())


Measured memory_bytes: 6288
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}



int main(void) {
  ll N, C;
  cin >> N >> C;
  ll i;
  ll x[MAX], v[MAX];
  ll s[MAX]={}, r[MAX]={};
  ll si[MAX], ssi[MAX];
  
  x[0]=0; v[0]=0; x[N+1]=C; v[N+1]=0;
  for(i=1; i<=N; i++) cin >> x[i] >> v[i];
  
  for(i=1; i<=N; i++) s[i]=s[i-1]+v[i];
  for(i=N; i>=1; i--) r[i]=r[i+1]+v[i];
  
  ll mx=0, id=0;
  for(i=1; i<=N; i++) {
    if(mx<s[i]-x[i]) {
      mx=s[i]-x[i];
      id=i;
    }
    si[i]=id;
  }
  
  mx=0; id=0;
  for(i=1; i<=N; i++) {
    if(mx<s[i]-x[i]*2) {
      mx=s[i]-x[i]*2;
      id=i;
    }
    ssi[i]=id;
  }
  
  ll ans=0;
  for(i=1; i<=N+1; i++) {
    chmax(ans, s[si[i-1]]-x[si[i-1]]+r[i]-(C-x[i])*2);
    chmax(ans, s[ssi[i-1]]-x[ssi[i-1]]*2+r[i]-(C-x[i]));
  }
  
  pt(ans);
}











Measured memory_bytes: 4992
import java.util.PriorityQueue

fun main(args: Array<String>) {
    val (N, M) = readInputLine().split(" ").map { it.toInt() }
    val Alist = readInputLine().split(" ").map { it.toLong() }
    
    val queue = PriorityQueue<Long>(N, {x, y -> if (x > y) -1 else if (x == y) 0 else 1})
    
    for (a in Alist) {
        queue.add(a)
    }
    
    for (i in 1..M) {
        val tmp = queue.poll() / 2L
        queue.add(tmp)
    }
    
    var ans = 0L
    
    for (i in 1..N) {
        ans += queue.poll()
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 72120
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <math.h>
#include <iomanip>
#include <queue>
#include <map>
#include <list>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define MAX 50
#define LARGENUM 1000000007
#define INF 9223372036854775807
#define ull unsigned long long 
typedef pair <int, int> P;

int main(){
    int x;
    rep(i, 5){
        cin >> x;
        if (x == 0) cout << i + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3056
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define gc getchar
#define pc putchar
#define cs const

inline
ll getint(){
    re ll num=0;
    re char c;
    while(!isdigit(c=gc()));
    while(isdigit(c))num=(num<<1)+(num<<3)+(c^48),c=gc();
    return num;
}

inline
void outint(ll a){
    static char ch[23];
    if(a==0)pc('0');
    while(a)ch[++ch[0]]=(a-a/10*10)^48,a/=10;
    while(ch[0])pc(ch[ch[0]--]);
}

ll a[101];
int n;
ll x;

signed main(){
	n=getint();x=getint();
	for(int re i=1;i<=n;++i)a[i]=getint();
	sort(a+1,a+n+1);
	int i=1;
	for(;i<n;++i){
		if(x<a[i])break;
		x-=a[i];
	}
	if(i==n){
		if(x==a[n])outint(n);
		else outint(i-1);
	}
	else outint(i-1);
	return 0;
} 

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

int main() {
	int N, A[100000], ans = 1, check = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N - 1; i++) {
		if (A[i] < A[i + 1] && check == -1) {
			ans++;
			check = 0;
		}
		else if (A[i] > A[i + 1] && check == 1) {
			ans++;
			check = 0;
		}
		else if (A[i] < A[i + 1] && check == 0) check = 1;
		else if (A[i] > A[i + 1] && check == 0) check = -1;
	}
	cout << ans;
}

Measured memory_bytes: 640
def main():
    s = list(input())

    ans = 0
    for i in range(len(s)):
        if i % 2 == 0:
            if s[i] == "0":
                ans += 1
        else:
            if s[i] == "1":
                ans += 1
    t = 0
    for i in range(len(s)):
        if i % 2 == 0:
            if s[i] == "1":
                t += 1
        else:
            if s[i] == "0":
                t += 1
    print(min(ans , t))



if __name__ == '__main__':
    main()

Measured memory_bytes: 49392