akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace my_originalprogram
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = x[0];
            int b = x[1];
            int c = x[2];
            int d = x[3];
            int e = x[4];
            if (a <  c + e || b < d + e || c - e  < 0 || d - e < 0)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
           
        }
    }
}


Measured memory_bytes: 18424
#include <stdio.h>

#include <stddef.h>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <pwd.h>
#include <functional>
int main(void)
{
    int height[10];
    for(int i=0;i<10;i++)
    {
        scanf("%d",height+i);
    }
    std::vector<int> h(height,height+10);
    int max[3]={height[0],height[1],height[2]};
    std::sort(h.begin(),h.end(),std::greater<int>());
    for(int i=0;i<3;i++)printf("%d\n",h[i]);
    return 0;
}

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

const int mod = 1000000007;

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

   /* 1 2 3 4 5 6
    1 1 1 1 * 0 0
    2 1 * 1 * 0 0
    3 1 * 1 * 0 0
    4 1 * 1 1 1 1
    5 1 1 2 2 2 2
   */

   //dp[i][j] 繋がっていたら dp[i-1][j]とdp[i][j-1]を足す
   vvi dp(h,vector<int>(w,0));
   dp[0][0] = 1;

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

   cout << dp[h-1][w-1] << endl;
}


Measured memory_bytes: 5248
from math import sqrt
def sieve(n):
    if n <= 4:
        return list(range(2, n))
    def _sieve_of_eratosthenes(n):
        limit = int(sqrt(n))+1
        table = [1] * n
        table[0] = table[1] = 0
        for i in range(2, limit):
            if table[i]:
                for j in range(i**2, n, i):
                    table[j] = 0
        return [i for i in range(2, n) if table[i]]
    return _sieve_of_eratosthenes(n)
print(*[x for x in sieve(55555) if x % 10 == 7][:int(input())])

Measured memory_bytes: 9496
#include <stdio.h>
#include<iostream>
#include <algorithm>
#include <cstring>
#include<set>
#include<queue>
#define Long long long int
#define For(i,a,b) for(int i=a;i<=b;i++)
#define ForR(i,a,b) for(int i=a;i>=b;i--)
#define maxN 100009
#define mp make_pair
using namespace std;
int N;
int a[3*maxN];
Long SumMaxLeft[3*maxN];
Long SumMinRigt[3*maxN];

class mycomparison
{
  bool reverse;
public:
  mycomparison(const bool& revparam=false)
    {reverse=revparam;}
  bool operator() (const int& lhs, const int&rhs) const
  {
    if (reverse) return (lhs>rhs);
    else return (lhs<rhs);
  }
};

typedef std::priority_queue<int,std::vector<int>,mycomparison> mypq_type;
mypq_type leftPQ(mycomparison(true)),rightPQ;
main(){
	cin >> N;
	For(i,1,3*N){
		scanf("%d",a+i);
	}
	For(i,1,N){
		leftPQ.push(a[i]);
		SumMaxLeft[N] += a[i];
	}
	For(i,N+1,2*N){
		if(leftPQ.top() <a[i]){
			int temp = leftPQ.top();
			SumMaxLeft[i] = SumMaxLeft[i-1] + a[i] - temp;
			leftPQ.pop();
			leftPQ.push(a[i]);
		}	else	{
			SumMaxLeft[i] = SumMaxLeft[i-1];
		}
//		cout << "\n summaxleft "<< i << " : "  << SumMaxLeft[i];
	}
	
	ForR(i,3*N,2*N+1){
		rightPQ.push(a[i]);
		SumMinRigt[2*N+1] += a[i];
	}
	ForR(i,2*N,N){
		if(rightPQ.top() > a[i]){
			int temp = rightPQ.top();
			SumMinRigt[i] = SumMinRigt[i+1] + a[i] - temp;
			rightPQ.pop();
			rightPQ.push(a[i]);
		}	else	{
			SumMinRigt[i] = SumMinRigt[i+1];
		}
//		cout << "\n sum min right " << i << " : " <<  SumMinRigt[i];
	}
	Long ans = -1e15;
	For(i,N,2*N){
		ans = max(ans,SumMaxLeft[i]-SumMinRigt[i+1]);
	}
	cout <<ans;
}


Measured memory_bytes: 5112
#include <stdio.h>

int main(int argc, char *argv[]){
  int p,q,r,a;
  scanf("%d %d %d",&p,&q,&r);
  if(p<q){
    if(r<q){
      a=p+r;
    }
    else{
      a=p+q;
    }
  }
  else{
    if(r<p){
      a=q+r;
    }
    else{
      a=p+q;
    }
  }
  printf("%d",a);
  return 0;
}

Measured memory_bytes: 128
N,K = map(int, input().split())
D_list = set(list(map(int, input().split())))

bn = sorted(list((set([0,1,2,3,4,5,6,7,8,9]) - D_list)))
res = 0
for v4 in bn:
    money = v4
    if money >= N:
        print(money)
        exit()

for i3 in bn:
    v3 = i3 * 10
    for v4 in bn:
        money = v3+v4
        if money >= N:
            print(money)
            exit()

for i2 in bn:
    v2 = i2 * 100
    for i3 in bn:
        v3 = i3 * 10
        for v4 in bn:
            money = v2+v3+v4
            if money >= N:
                print(money)
                exit()

for i1 in bn:
    v1 = i1 * 1000
    for i2 in bn:
        v2 = i2 * 100
        for i3 in bn:
            v3 = i3 * 10
            for v4 in bn:
                money = v1+v2+v3+v4
                if money >= N:
                    print(money)
                    exit()

for i0 in bn:
    v0 = i0 * 10000
    for i1 in bn:
        v1 = i1 * 1000
        for i2 in bn:
            v2 = i2 * 100
            for i3 in bn:
                v3 = i3 * 10
                for v4 in bn:
                    money = v0+v1+v2+v3+v4
                    if money >= N:
                        print(money)
                        exit()

Measured memory_bytes: 3192
import collections

def main():
    N = int(input())
    D = list(map(int, input().split()))
    M = int(input())
    T = list(map(int, input().split()))
    Dcounter = collections.Counter(D)
    Tcounter = collections.Counter(T)
    for t in T:
        if Dcounter[t] - Tcounter[t] < 0:
            print('NO')
            return
    print('YES')

if __name__ == "__main__":
    main()


Measured memory_bytes: 57056
#include<bits/stdc++.h>
using namespace std;
//datatypes
	#define int long long
	#define vi vector<int>
	#define si set<int>
	#define vii vector<ii>
	#define ii pair<int,int>
	#define mii map<int,int>
	#define M 1000000007
	#define pi 3.141592653589793
	#define in(x) int x; cin>>x;
	#define sz(x) (int)x.size()
	#define fr first
	#define sc second
	#define pb push_back
	#define mkp make_pair
	#define inputFile \
	    freopen("input.txt", "r", stdin); 
	#define outputFile \
	    freopen("output.txt", "w", stdout)
	#define rep(i,a,b) for(int i=a; i<b; i++)
	#define trav(a) for(auto &x:a)
	#define test cout<<"hello\n";
	#define all(x) (x).begin(),(x).end()
	#define mem0(x) memset(x, 0, sizeof(x))
	#define mem1(x) memset(x, -1, sizeof(x))
	#define sa(x) std::sort(all(x))
	#define sd(x) std::sort(all(x),greater<int>())
	int n,m;
	string s="", a;
vector<int> dp;
int ans(int i)
{
	if(s[i]=='#')
		return 0;
	else if(dp[i]!=-1)
		return dp[i];
	else 
	{
		//cout<<i<<" "<<i+1<<" "<<i+m<<endl;
		int k=0;
		if(i%m<m-1)
			k+=(ans(i+1));
		if(i/m<n-1)
			k+=(ans(i+m));
		dp[i]=k%M;
		return dp[i];
	}
}
signed solve()
{

	cin>>n>>m;

	rep(i,0,n)
	{
		cin>>a;
		s+=a;
	}
	dp.resize(n*m, -1);
	dp[n*m-1]=1;

	cout<<ans(0);
	/*cout<<"================"<<endl;
	rep(i,0,n)
	{
		rep(j,0,m)
		cout<<dp[i*m + j]<<" ";
		cout<<endl;
	}*/
	//dp[i][j]=-1;

	return 0;
}

signed main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--) solve();
	//cout << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 9220
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define all(V) V.begin(),V.end()
typedef long long lint;
typedef std::pair<lint, lint> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = 1e-9;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
lint mypow(lint a, lint b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	lint memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
std::string to_string(std::vector<int>& vec) {
	std::string res = "[";
	rep(i, vec.size() - 1)res += std::to_string(vec[i]) + ", ";
	res += std::to_string(vec.back()) + "]";
	return res;
}
int v,e,s,t,d;
lint dist[110][110];
int main() {
	std::cin>>v>>e;
	rep(i,v)rep(j,v)dist[i][j]=LINF;
	rep(i,v)dist[i][i]=0;
	rep(i,e){
		std::cin>>s>>t>>d;
		dist[s][t]=d;
	}
	rep(k,v){
		rep(i,v){
			rep(j,v)chmin(dist[i][j],dist[i][k]+dist[k][j]);
		}
	}
	rep(i,v){
		rep(j,v){
			rep(k,v){
				if(dist[i][j]>dist[i][k]+dist[k][j]){
					puts("NEGATIVE CYCLE");
					return 0;
				}
			}
		}
	}
	rep(i,v){
		rep(j,v-1){
			if(dist[i][j]<=1e10)std::cout<<dist[i][j]<<" ";
			else std::cout<<"INF ";
		}
		if(dist[i][v-1]<=1e10)std::cout<<dist[i][v-1]<<std::endl;
		else puts("INF");
	}
	return 0;
}


Measured memory_bytes: 3180
#include<cstdio>
#include<algorithm>
#include<vector>
#define N_ 201000
using namespace std;
int n, m, w[N_], v[N_], head, tail, Deg[N_][2];
char p[201000];
vector<int>E[N_][2];
int Q[N_*2];
void Add(int a, int b) {
	if (p[b] == 'A')E[a][0].push_back(b);
	else E[a][1].push_back(b);
}
int main() {
	int i, a, b, j;
	scanf("%d%d", &n, &m);
	scanf("%s", p + 1);
	for (i = 0; i < m; i++) {
		scanf("%d%d", &a, &b);
		Add(a, b);
		Add(b, a);
	}
	for (i = 1; i <= n; i++) {
		for (j = 0; j < 2; j++) {
			Deg[i][j] = E[i][j].size();
			if (E[i][j].size() == 0 && !v[i]) {
				Q[++tail] = i;
				v[i] = 1;
			}
		}
	}
	while (head < tail) {
		int x = Q[++head];
		int ck = p[x] - 'A';
		for (auto &y : E[x][0]) {
			Deg[y][ck]--;
			if (!Deg[y][ck] && !v[y]) {
				Q[++tail] = y;
				v[y] = 1;
			}
		}
		for (auto &y : E[x][1]) {
			Deg[y][ck]--;
			if (!Deg[y][ck] && !v[y]) {
				Q[++tail] = y;
				v[y] = 1;
			}
		}
	}
	if (tail == n)puts("No");
	else puts("Yes");
}

Measured memory_bytes: 22912
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
n = a[0]
k = a[1]
dp = [0] + [float("inf")]*(n - 1)
for x in range(n):
    y = x + 1
    while y - x <= k:
        if y < n:
            dp[y] = min(dp[y], dp[x] + abs(b[x] - b[y]))
        y += 1
print(dp[-1])

Measured memory_bytes: 86436
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,m,q;
	while(cin>>n>>m>>q,n+m+q){
		vi h(n),w(m);
		int coh=0,cow=0;
		vvi in(q,vi(3));
		rep(i,q)rep(j,3)cin>>in[q-1-i][j];
		int out=0;
		rep(i,q){
			if(in[i][0]&&w[in[i][1]]==0){
				if(in[i][2])out+=n-coh;
				cow++;
				w[in[i][1]]=true;
			}else if(in[i][0]==0&&h[in[i][1]]==0){
				if(in[i][2])out+=m-cow;
				coh++;
				h[in[i][1]]=true;
			}
		}
		cout<<out<<endl;
	}
}

Measured memory_bytes: 5936
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


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

    Int n;
    Int p[20];
    cin >> n;
    for(Int i=0; i<n; i++){
        cin >> p[i];
    }

    Int cnt = 0;
    for(Int i=1; i<n-1; i++){
        vector<Int> buf;
        buf.push_back(p[i-1]);
        buf.push_back(p[i]);
        buf.push_back(p[i+1]);
        sort(buf.begin(), buf.end());
        if(buf[1] == p[i]){
            cnt++;
        }    
    }
    cout << cnt << endl;

    return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

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

  vector<ll>s(n);
  rep(i, n)cin>>s[i];

  ll q;cin>>q;

  vector<ll>t(q);
  rep(i, q)cin>>t[i];

  ll result = 0;
  for(auto p: t){
    auto c = *lower_bound(s.begin(), s.end(), p);
    if(c==p)result++;
    // cout<<c<<' '<<p<<endl;
  }

  cout<<result<<endl;

  return 0;
}



Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=400005,INF=1e9;
int a[N],g[N],Max,Min,f[N],ans,n;
void solve2(){
	int Max1=a[Max],Min1=a[Max],Max2=a[Min],Min2=a[Min];
	int flag1=(Max+1)/2,flag2=(Min+1)/2;
	for (int i=1;i<=n;i++){
		if (i!=flag1&&i!=flag2){
			Min1=min(Min1,a[i*2-1]);
			Max2=max(Max2,a[i*2]);
		}
		if (i==flag1&&i!=flag2)Max2=max(Max2,a[i*2]);
		if (i!=flag1&&i==flag2)Min1=min(Min1,a[i*2-1]);
	}
	ans=min(ans,(Max1-Min1)*(Max2-Min2));
}
int cmp(int x,int y){
	return a[x*2]<a[y*2];
}
void solve1(){
	int p1=-1e9,p2=1e9,val=a[Max]-a[Min];
	int tot=0,flag1=(Max+1)/2,flag2=(Min+1)/2;
	for (int i=1;i<=n;i++){
		if (i==flag1)p1=max(p1,a[i*2]),p2=min(p2,a[i*2]);
		else if (i==flag2)p2=min(p2,a[i*2-1]),p1=max(p1,a[i*2-1]);
		else f[++tot]=i;
	}
	sort(f+1,f+tot+1,cmp);
	g[tot+1]=1e9;
	int now=-1e9,now2=1e9;
	for (int i=1;i<=tot+1;i++){
		ans=min(ans,val*(max(p1,max(i==tot+1?0:a[f[tot]*2],now))-min(p2,min(i==tot+1?1000000000:a[f[i]*2],now2))));
		if (i!=tot+1)now=max(now,a[f[i]*2-1]),now2=min(now2,a[f[i]*2-1]);
	}
}
signed main(){
	scanf("%lld",&n);
	for (int i=1;i<=n;i++){
		scanf("%lld%lld",&a[i*2-1],&a[i*2]);
		if (a[i*2-1]<a[i*2])swap(a[i*2-1],a[i*2]);
	}
	Max=1,Min=2;
	for (int i=3;i<=n*2;i++){
		if (a[i]>a[Max])Max=i;
		if (a[i]<a[Min])Min=i;
	}
	ans=1e18;
	if ((Max-1)/2!=(Min-1)/2)solve1();
	solve2();
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 9088
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
int n,st[10005],top,k;
long double X=1e18,Y=1e18,xa,ya,ans[10005],kd[10005];
struct sd{long double x,y;int num;bool operator < (const sd &fu) const {return atan2(y-ya,x-xa)<atan2(fu.y-ya,fu.x-xa)||(atan2(y-ya,x-xa)==atan2(fu.y-ya,fu.x-xa)&&x<fu.x);}}p[10005];
inline long double check(sd v,sd r,sd e) {return (r.x-v.x)*(e.y-v.y)-(r.y-v.y)*(e.x-v.x);}
int main()
{
	scanf("%d",&n);for(int i=1;i<=n;++i) {cin>>p[i].x>>p[i].y;p[i].num=i;if(X>p[i].x||(X==p[i].x&&Y>p[i].y)) {X=p[i].x;Y=p[i].y;k=i;}}
	if(k!=1) swap(p[1],p[k]);xa=p[1].x;ya=p[1].y;
	sort(p+2,p+1+n);
	st[++top]=1;st[++top]=2;
	for(int i=3;i<=n;++i) {
		while(top>1&&check(p[st[top-1]],p[st[top]],p[i])<=0) --top;
		st[++top]=i;
	}
	for(int i=1;i<top;++i) kd[i]=atan2(p[st[i]].x-p[st[i+1]].x,p[st[i]].y-p[st[i+1]].y);
	kd[top]=atan2(p[st[top]].x-p[st[1]].x,p[st[top]].y-p[st[1]].y);
	kd[0]=kd[top];
	for(int i=1;i<=top;++i) ans[p[st[i]].num]=(abs(kd[i]-kd[i-1])>M_PI?(M_PI*2.0-abs(kd[i]-kd[i-1])):abs(kd[i]-kd[i-1]))/(M_PI*2.0);
	for(int i=1;i<=n;++i) cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
 * a.c
 *
 *  Created on: 2017/06/13
 *      Author: AWV060608
 */

#include	<stdio.h>

int		main(void)
{
	int		SE;
	int		h, m, s;

	scanf("%d",&SE);

	h = SE/(60*60);
	m = (SE-h*(60*60))/60;
	s = (SE-h*(60*60))%60;
	printf("%d:%d:%d\n",h,m,s);

	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

#define rep(i, o) for (ll i = 0; i < (o);i++)
#define rep_s(i, o) for (int i = 1; i <= (o);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

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


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

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

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

    int n = s.size(); string ans = "";
    rep(i, n) { 
        if (s[i] == '0' || s[i] == '1') ans += s[i];
        if (s[i] == 'B')
        {
            if (ans == "") continue;
            else ans.pop_back();
        }
        // cout << s << " " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i,a,n) for (int i = a; i <= n; i++)

#define ll long long int

//const int mod=1000000007;
using namespace std;
 
/*int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};
*/

double   p[3100];
double dp[3100][3100];

int main()
{

    int a;
    cin>>a;
    
    for(int i=0;i<a;i++)
        cin>>p[i];
    
    dp[0][0]=1;
    
    for(int i=1;i<=a;i++)
    {
        for(int j=0;j<=i;j++)
        {
            
            if(j) dp[i][j]+=dp[i-1][j-1]*p[i-1];
            dp[i][j]+=dp[i-1][j]*(1-p[i-1]);
            
            
        }
        
    }
    double ret=0;
    
    for(int i=0;i<=a;i++)
    {
        if(i>a-i)
            ret+=dp[a][i];
        
    }

    cout<<setprecision(10);
    cout<<ret<<endl;
}


Measured memory_bytes: 50184
import java.util.*;
import java.lang.*;

// Working program with FastReader 
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
class Main{
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }

     

   public static void main(String[] args){

      
      FastReader sc=new FastReader();

      int n=sc.nextInt();
      int arr[]=new int[n];
      for(int i=0;i<n;i++){
        arr[i]=sc.nextInt();
      }

      int dp[]=new int[n];
      dp[0]=0;
      for(int i=1;i<n;i++){

           if(i-2>=0){ 
           dp[i]=Math.min(dp[i-1]+Math.abs(arr[i-1]-arr[i]),dp[i-2]+Math.abs(arr[i-2]-arr[i]));
           }
           else dp[i]=dp[i-1]+Math.abs(arr[i-1]-arr[i]);
      }

      System.out.println(dp[n-1]);



     
   }


}

Measured memory_bytes: 33372
#include<bits/stdc++.h>
using namespace std;
string a;   
int sum;
int main(){
    cin>>a;
    for(int i=0;i<a.length();i++){
        if(a[i]=='C') sum=1;
        if(a[i]=='F'&&sum==1){cout<<"Yes";return 0;}
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long k,x,d;
int main()
{
	cin>>k>>x>>d;
	k=abs(k);
	if(x*d>0&&x*d<=k)
	{
		cout<<k-x*d;
		return 0;
	}
	if((x-k/d)%2==0)
		cout<<k%d;
	else
		cout<<d-k%d;

	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.14159265359

int main() {
    int n;
    int a[300000]={0},hoge;
    cin >> n;
    for(int i=0;i<n-1;i++){
        cin >> hoge;
        a[hoge-1]++;
    }
    for(int i=0;i<n;i++){
        cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4768
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    vector<int>in(n);
    for(int i=0;i<n;i++)cin>>in[i];
    sort(in.begin(),in.end());
    int sum=0;
    for(int i=1;i<n-1;i++)sum+=in[i];
    cout<<sum/(n-2)<<endl;
  }
}

Measured memory_bytes: 1216
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
using namespace std;


#define ll long long int
#define all(v) begin(v), end(v)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
//typedef vector<int> V;
//typedef vector<VV> VVV;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}


int main() {
	int a, b,sum=0;
	cin >> a >> b;
	if (a < b) {
		sum += b;
		b -= 1;
	}
	else {
		sum += a;
		a -= 1;
	}
	cout << max(a, b) + sum << endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(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 Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  string s;
  cin>>s;
  ll q;
  cin>>q;

  deque<char> ans;
  REP(i,s.size())
    ans.push_back(s[i]);

  ll to=1;

  REP(i,q){
    ll t;
    cin>>t;
    if(t==1){
      to*=-1;
    }
    if(t==2){
      ll f;
      char c;
      cin>>f>>c;

      if(to==1){
        if(f==2)
          ans.push_back(c);
        else
          ans.push_front(c);
      }
      else{
        if(f==1)
          ans.push_back(c);
        else
          ans.push_front(c);
      }
    }
  }

  if(to==1){
    while(!ans.empty()){
      char c = ans.front();
      ans.pop_front();
      cout<<c;
    }
    cout<<endl;


  }
  if(to==-1){
    while(!ans.empty()){
      char c = ans.back();
      ans.pop_back();
      cout<<c;
    }
    cout<<endl;
  }
}


Measured memory_bytes: 976
import java.util.*;

public class Main{
        public static void main(String[] args){
                try(Scanner sc = new Scanner(System.in)){
                        int N = sc.nextInt();
                        long T = sc.nextLong();
                        long start=0, goal=0;
                        long sum=0;
                        for(int i = 0; i < N; i++){
                                long t = sc.nextLong();
                                if(goal<t){
                                        sum += goal-start;
                                        start=t;
                                        goal =start+T;
                                }else{
                                        goal=t+T;
                                }
                        }
                        System.out.println(sum+goal-start);
                }
        }
}


Measured memory_bytes: 62992
import java.io.PrintWriter;
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        int MOD = 998244353;

        Combination combi = new Combination(n + 100, MOD);
        int[] facts = new int[n + 1];
        facts[0] = 1;
        for (int i = 0; i < n; i++) {
            facts[i + 1] = (int) (facts[i] * (long) (m - 1) % MOD);
        }
//        debug(facts);
        long ans = 0;
        for (int i = n - 1 - k; i < n; i++) {
//            debug(i, combi.nck(n - 1, i));
            ans = (ans + combi.nck(n - 1, i) * facts[i]) % MOD;
        }
        ans = (ans * m) % MOD;
        System.out.println(ans);

    }

    public class Combination {
        int n;
        long mod;
        int[] facts;

        public Combination(int n, int mod) {
            this.n = n;
            this.mod = mod;
            facts = new int[n];
            facts[0] = 1;
            for (int i = 1; i < n; i++) {
                facts[i] = (int)((long) facts[i - 1] * i % mod);
            }
        }

        long modpow(long a, long b) {
            if (b == 0) return 1;
            else if (b == 1) return a;

            long x = modpow(a, b / 2);
            return b % 2 == 0 ? x * x % mod : x * (x * a % mod) % mod;
        }

        long inv(long n) {
            return modpow(n, mod - 2);
        }

        public long nck(int n, int k) {
            if (n < k) return 0;
            return facts[n] * (inv(facts[n - k]) * inv(facts[k]) % mod) % mod;
        }
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 38160
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
int n,m,q;
struct Int{
  int a;
  int b;
  int c;
  int d;
};
Int g[100];
int calc(vector<int> buf){
  int res=0;
  rep(i,q){
    if(buf[g[i].b]-buf[g[i].a]==g[i].c){
      res+=g[i].d;
    }
  }
  return res;
}
int solve(vector<int> buf,int cur){
  if(cur==n+1){
    return calc(buf);
  }
  int res=0;
  int s=buf[cur-1];
  for(int i=s;i<=m;++i){
    vector<int> nxt(buf);
    nxt.push_back(i);
    res=max(res,solve(nxt,cur+1));
  }
  return res;
}
signed main(){
  cin>>n>>m>>q;
  //vector<Int> g(q);
  rep(i,q){
    cin>>g[i].a>>g[i].b>>g[i].c>>g[i].d;
  }
  vector<int> buf;
  buf.push_back(1);
  int res=solve(buf,1);
  cout<<res<<"\n";
  return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
int H;
  
int left(int x){
  return 2*x;
 }

int right(int x){
  return 2*x+1;
 }

void maxHeapify(int A[], int i){
  int l,r,tmp;
  int largest;
  l = left(i);
  r = right(i);
  if(l <= H && A[l] > A[i]){
    largest = l;
  } else {
    largest = i;
  }
  if(r <= H && A[r] > A[largest]){
    largest = r;
  }
  if(largest !=i){
    tmp = A[i];
    A[i]=A[largest];
    A[largest]= tmp;
    maxHeapify(A,largest);
  }
  
}void buildMaxHeap(int A[]){
  int i;
  for(i = H/2;i > 0;i--){
    maxHeapify(A,i);
  }
}
  
int main(){
  int i;
  int *A;
  scanf("%d",&H);
A = (int *)malloc(sizeof(int)*H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }
  buildMaxHeap(A);
  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }
  puts("");
  
  return 0;
}
  

Measured memory_bytes: 2564
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    TreeMap<Integer,Integer> map = new TreeMap<>();
    for(int i=0;i<n;i++){
      int a = sc.nextInt();
      if(map.containsKey(a))map.put(a,map.get(a)+1);
      else map.put(a,1);
    }
    for(int i=0;i<m;i++){
      int b = sc.nextInt();
      int c = sc.nextInt();
      if(map.containsKey(c))map.put(c,map.get(c)+b);
      else map.put(c,b);
    }
    long result = 0;
    int res = n;
    while(true){
      Map.Entry<Integer,Integer> entry = map.pollLastEntry();
      long key = entry.getKey();
      long value = entry.getValue();
      if(res>value){
        res-=value;
        result+=value*key;
      }else{
        result+=res*key;
        break;
      }
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 111236
#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 dp[5005][5005];

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i, n) rep(j, n) {
        if (s[n-1-i]==s[n-1-j]) dp[n-1-i][n-1-j] = dp[n-i][n-j] + 1;
    }
    int ans = 0;
    rep(i, n) rep(j, n) {
        int tmp = min(dp[i][j], i-j);
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define pb push_back
#define ep emplace_back
#define st first
#define sc second

using namespace std;

const ll mod = 1e9 + 7;
const int e = 1e6 + 69;
const int base = 311;

// dung inverse module de tinh nCk
// 69
// cach tao hoan vi tu n so : n*(n+1)/2;

//vector<ll>adj[e];
ll gt[e], igt[e], a[e];

/*ll Pow(ll n, ll dem)
{
    if(dem == 0) return 1;
    if(dem == 1) return n % mod;
    ll t = Pow(n, dem/2);
    if(dem % 2 == 0) return (t%mod*t%mod)%mod;
    else return ((t%mod * t%mod)%mod * n %mod)%mod;
}

ll C(ll k, ll n)
{
    if(k == 0) return 1;
    if(n < k) return 0;
    return (gt[n]%mod * (igt[k]%mod * igt[n-k]%mod)%mod)%mod;
}
*/
int n, m;
ll k;

int main()
{
   cin >> n ;
   ll minn = 1e18;
   ll maxx = 0;
   ll cur = 1;
   for(int i=1; i<=n; i++)
   {
       ll x;
       cin >> x;
       cur = cur/__gcd(cur, x)*x;
   }
   cout << cur;
}
/*
10 1
306<<>4>04
1 10

3 1 1 2 3 1 1 0 0 0
*/


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

const int maxn=1e5+5;

struct node
{
    int l,r;
    bool operator <(const node &a)const
    {
        if(r==a.r)
            return l<a.l;
        return r<a.r;
    }
}a[maxn];

int main()
{
    int n,u,v;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&u,&v);
        a[i].l=u-v,a[i].r=u+v;
    }
    sort(a+1,a+1+n);
    int ans=1,pre=a[1].r;
    for(int i=2;i<=n;i++)
    {
        if(a[i].l<pre)
            ;
        else
            ++ans,pre=a[i].r;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1024
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n, k;
  cin >> n >> k;
  vll a(n);
  ll s = 0;
  for(ll i = 0; i < n; i++){ cin >> a[i];s+=a[i];}
  sort(all(a), greater<ll>());
  for(ll i = 0; i < min(k, n); i++) s-=a[i];
  cout << s << endl;
  return 0;
} //good night.

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

void solv() {
    string str;
    cin >> str;
    set<char> st;
    rep(i, str.size()) {
        st.insert(str[i]);
    }
    if(st.size() > 1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

string s;
int K;

int main() {
    cin >> s >> K;
    for(size_t i = 0; i < s.size(); i++) {
        int pos = s[i] - 'a';
        if(pos == 0) continue;
        if(26 - pos <= K) {
            K -= 26 - pos;
            s[i] = 'a';
        }
    }
    int last = s.size() - 1;
    K %= 26;
    s[last] = (s[last] - 'a' + K) % 26 + 'a';
    cout << s << endl;

}

Measured memory_bytes: 512
n, time = map(int, input().split())

c = [i for i in range(n)]
t = [i for i in range(n)]

for i in range(n):
    c[i], t[i] = map(int, input().split())


now = 1001
nans = 0

for i in range(n):
    if t[i] <= time:
        if c[i] < now:
            now = c[i]
            nans = i


if now == 1001:
    print("TLE")

else:
    print(now)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

map<long long, int> prime_factor(long long n) {
  map<long long, int> res;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll ans = a[0]-1, d = 2;
  for (int i = 1; i < n; i++) {
    if (a[i] < d)
      continue;
    if (a[i] == d)
      d = a[i]+1;
    else
      ans += (a[i]-1)/d;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3964
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int>a(5);
  int k;
  rep(i,5)cin>>a[i];
  cin>>k;
  bool flag=1;
  rep(i,5)rep(j,5)
  {
    if(i>=j)continue;
    if(a[j]-a[i]>k)flag=0;
  }
  if(!flag)cout<<":(";
  else cout<<"Yay!";

  return 0;

}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
 
class Main {
	public static void main(final String[] args) {
		 Scanner sc = new Scanner(System.in);
		 int N = sc.nextInt();
		 String S[] = new String[N];
		 int ans = 1;

        for(int i=0;i<N;i++) {
        	S[i] = sc.next();
        }
        
		Arrays.sort(S);
		
		for(int i = 1; i < N; i++){
			if(! S[i-1].equals(S[i])){
				ans ++;
			}
		}

        System.out.print(ans);
        

	}
}


Measured memory_bytes: 70144
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES


int func(int b[], int n)
{
	int s = 0;
	for(int i=0;i<n-1;i++)
	{
		s = s+abs(b[i]-b[i+1]);
	}
	return s;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 //   freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
	int x,y;
	cin>>x>>y;
	cout<<(x+y/2);
	return 0 ;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
   int N, K;
   std::cin >> N >> K;
   std::vector<int> h(N);
   for(int i=0; i<N; ++i)
      std::cin >> h[i];

   std::sort(h.begin(),h.end());
   int min = h[N-1];
   for(int i=0; i<N-K+1; ++i){
      if(min>h[i+K-1]-h[i]) min = h[i+K-1] - h[i];
   }
   std::cout << min << std::endl;

   return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int min(int z, int b){
	if(z < b) return z;
	return b;
}

int main (void){

	char  s[100000];
	int i, count = 0;
	int len = 0;
	scanf("%s", s);
	
	for(i = 0; s[i] != '\0'; i++){
		if(s[i] == '1'){
			count++;
		}
		len++;
	}

	printf("%d\n", min(count , len - count) * 2);


}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <unordered_set>
#include <map>           // sorted map so O(logn)
#include <unordered_map> // O(1)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    priority_queue<int> pq;
    ll sum = 0;
    rep(i, n)
    {
        int x;
        cin >> x;
        sum += x;
        pq.push(x);
    }
    rep(i, m)
    {
        int r = pq.top();
        pq.pop();
        int rr = r / 2;

        sum -= r - rr;
        pq.push(rr);
    }
    cout << sum << endl;
}

Measured memory_bytes: 3788
import java.util.Scanner;

/**
 * Created by zzt on 17-1-16.
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int h = scanner.nextInt();
        int w = scanner.nextInt();

        scanner.nextLine();
        String[] s = new String[h];
        for (int i = 0; i < h; i++) {
            s[i] = scanner.nextLine();
        }

        for (int i = 0; i < h * 2; i++) {
            System.out.println(s[i/2]);
        }
    }
}


Measured memory_bytes: 11344
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int n,r,p,c,a[50];

    while(cin >> n >> r,n||r){
        for(int i=0;i<n;i++){
            a[i] = n-i;
        }

        for(int i=0;i<r;i++){
            cin >> p >> c;
            rotate(a,a+p-1,a+p+c-1);
        }
    cout << a[0] << endl;
    }

    return 0;

}


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

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

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

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

int main(){
	LL n,y,f=0;
	cin>>n>>y;
	FORQ(i,0,n){
		int yy=y;
		FORQ(j,0,n-i){
			int k=n-i-j;
			if(i*1000+j*5000+k*10000==y){
				cout<<k<<" "<<j<<" "<<i<<endl;
				return 0;
			}
		}
	}
	cout<<"-1 -1 -1"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);
// priority_queue<ll, vector<ll>, greater<ll>> pq;

int main(){
    ll n; cin >> n;
    cout << 800 * n - (n / 15 * 200) << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define mp make_pair
#define INF 100000000000
#define MOD 1000000007LL
#define MAX 10005
#define NIL -1
#define WHITE 0
#define BLACK 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main(void) {
    ll N;
    cin >> N;
    ll i, j;
    char s[N][N];
    char t[N][N];
    for(i=0; i<N; i++) {
        for(j=0; j<N; j++) {
            cin >> s[i][j];
        }
    }
    ll ans=0;
    ll a=0, b;
    for(b=0; b<N; b++) {
        for(i=0; i<N; i++) {
            for(j=0; j<N; j++) {
                t[i][j]=s[(i+a)%N][(j+b)%N];
            }
        }
        
        bool flag=true;
        for(i=0; i<N; i++) {
            for(j=0; j<N; j++) {
                if(t[i][j]!=t[j][i])
                    flag=false;
            }
        }
        if(flag) ans++;
    }
    
    prin(N*ans);
}

Measured memory_bytes: 384
{-
?????????: Polygon - Area
URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_A&lang=jp
?????°
19:41 ??¢??¨??§?????????
19:44 ??¢??¨??§??????
19:45 WA????????¨?????????????????????????????????e8????????????
19:47 5??????????°???°??????????????§?¶????
19:49 ???????????????????????????abs??????????????????????????§???????????????
-}

import Data.Complex
import Control.Monad
import Control.Applicative
import System.IO

(a:+b) `mul` (c:+d) = (a*c-b*d):+(a*d+b*c)
a `dot` b = realPart $ conjugate a `mul` b
(a:+b) `cross` (c:+d)= (a*d-b*c)

main :: IO ()
main = do
 str <- getContents -- ?????°???????????????????????????????????????????????¨??¨??????
 let cs = map lire $ tail $ lines str -- ??????????????????????§£???
 putStrLn $ format $ show $ (*5) $ abs $ sum $ zipWith cross (last cs:cs) cs -- ???????§£??¬

-- last cs : cs 		= [e,  a,  b,  c,  d,e]
--           cs 		= [a,  b,  c,  d,  e]
-- zipWith cross ?????????	=>[e??a,a??b,b??c,c??d,d??e]
-- ?????????sum?????????abs??????????????£?????¨???????????????????????§????????????????????°?????????

format :: String -> String -- ?°???°??????????????§?¶????
format str = let (b:bs) = reverse str in reverse (b:'.':bs)

-- read?????¨?¨?????????????????????¨?????????????????§?????????????????§???
lire :: String -> Complex Integer
lire str = let[a,b] = map read $ words str in a:+b

Measured memory_bytes: 4092
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        if i % 2 == 0 and a[i] % 2 == 1:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 9088
#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int n, q;
int a[N], key;
int sum;

int binary_search(int key)
{
    int l = 0, r = n;
    int mid;
    while(l < r)
    {
        mid = (l + r) >> 1;
        if(key == a[mid]) return 1;
        if(key < a[mid])
            r = mid;
        else if(key > a[mid])
            l = mid + 1;
    }
    return 0;
}

int main(void)
{
    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);
    scanf("%d", &q);
    while(q--)
    {
        scanf("%d", &key);
        if(binary_search(key)) sum++;
    }

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


Measured memory_bytes: 3596
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	int ans;
	if (x == 0) ans = 1;
	else ans = 0;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define abs(x) ((x)>0?(x):-(x))

int main()
{
	int A, P;

	scanf("%d%d", &A, &P);

	P += A * 3;

	printf("%d", P / 2);
	
}

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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 100010 }, MAXR { 15 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll dp[MAX][MAXR];

ll solve(const string& s)
{
    auto N = s.size();

    dp[0][0] = 1;

    for (size_t i = 0; i < N; ++i)
    {
        int a = 0, b = 9;

        if (s[i] != '?')
        {
            auto d = s[i] - '0';

            a = b = d;
        }

        for (auto d = a; d <= b; ++d)
        {
            for (int r = 0; r < 13; ++r)
            {
                auto t = (10*r + d) % 13;

                dp[i + 1][t] = (dp[i + 1][t] + dp[i][r]) % MOD;
            }
        }
    }

    return dp[N][5];
}

int main()
{
    ios::sync_with_stdio(false);

    string s;
    cin >> s;

    auto ans = solve(s);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 15448