akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{
	int room[4][3][10] = {0};

	int n, b, f, r, v, i, j, k;

	scanf("%d\n", &n);
	for (i = 0; i < n; i++) {
		scanf("%d %d %d %d", &b, &f, &r, &v);
		room[b - 1][f - 1][r - 1] += v;
	}
	for (b = 0; b < 4; b++) {
		for (f = 0; f < 3; f++) {
			for (r = 0; r < 10; r++) {
				printf(" %d", room[b][f][r]);
			}
			printf("\n");
		}
		if (b < 3) printf("####################\n");
	}
	//puts("");
}



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

int main() {
  
  int N, K, Q;
  cin >> N >> K >> Q;
  
  vector<int> vec(N);
  
  for (int i = 0; i < Q; i++) {
    int A; cin >> A;
    vec[A - 1]++;
  }
  
  for (int i = 0; i < N; i++) {
    if (K > Q - vec[i]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  
  
}

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

int n, S[100000];

int LinearSearch(int T) 
{
	int left = 0, right = n, mid;

	while (left < right) {
		mid = (left + right) / 2;
		if (S[mid] == T) {
			return 1;
		}
		else if(T<S[mid]){
			right = mid;
		}
		else if (T > S[mid]) {
			left = mid + 1;
		}
	}
	return 0;
}

int main() {
	
	int q, T, i, count = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d", &S[i]);
	}

	scanf("%d", &q);
	for (i = 0; i < q; i++) {
		scanf("%d", &T);
		if (LinearSearch(T)) count++;
	}

	cout << count << endl;

}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <sstream>
#include <math.h>
#include <functional>

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007

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

int main() {
	string a, b;
	cin >> a >> b;
	int result = 0;
	rep(i, a.size()) {
		if (a[i] == b[i])
			result += 1;
	}
	cout << result << endl;


}



Measured memory_bytes: 256
using System;

public class Hello
{
    static bool[,] map;
    static int[] dx = new int[] { 0, 1, 1, 1, 0, -1, -1, -1 };
    static int[] dy = new int[] { 1, 1, 0, -1, -1, -1, 0, 1 };
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var w = int.Parse(line[0]);
            var h = int.Parse(line[1]);
            if (w == 0 & h == 0) break;
            map = new bool[h, w];
            for (int i = 0; i < h; i++)
            {
                line = Console.ReadLine().Trim().Split(' ');
                for (int j = 0; j < w; j++)
                    if (line[j] == "1") map[i, j] = true;
            }
            var count = 0;
            for (int i = 0; i < h; i++)
                for (int j = 0; j < w; j++)
                    if (map[i, j]) { goDfs(i, j, h, w); count++; }
            Console.WriteLine(count);
        }
    }
    public static void goDfs(int x, int y, int h, int w)
    {
        map[x, y] = false;
        for (int i = 0; i < 8; i++)
        {
            var nx = x + dx[i];
            var ny = y + dy[i];
            if (nx >= 0 && nx < h && ny >= 0 && ny < w && map[nx, ny]) goDfs(nx, ny, h, w);
        }
    }
}



Measured memory_bytes: 9464
import sys
import math
def input():
    return sys.stdin.readline()[:-1]
a,b,q=map(int,input().split())
s=[int(input()) for i in range(a)]
t=[int(input()) for i in range(b)]
x=[int(input()) for i in range(q)]
import bisect

inf=10**11

def tansak(lis,lis2,dis):
    ind=bisect.bisect_left(lis,dis)
    ind2=bisect.bisect_left(lis2,dis)
    return ind,ind2

for i in range(q):
    now = x[i]
    ind,ind2 = tansak(s,t,now)
    if  ind==0:
        one=-inf
    else:
        one=s[ind-1]
    if ind==a:
        two=inf
    else:
        two=s[ind]
    if ind2==0:
        thr=-inf
    else:
        thr=t[ind2-1]
    if ind2==b:
        fo=inf
    else:
        fo=t[ind2]
    tmp1=max(two,fo)-now
    tmp2=2*two-thr-now
    tmp3=2*fo-one-now
    tmp4=now-min(one,thr)
    tmp5=now-thr+two-thr
    tmp6=now-one+fo-one
    print(min(tmp1,tmp2,tmp3,tmp4,tmp5,tmp6))


Measured memory_bytes: 124508
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){

	int n;
	int money[6] = {500,100,50,10,5,1};
	while(cin >> n, n){
		
		int change = 0;
		n = 1000 - n;
		rep(i,6){
			
			change += n / money[i];
			n = n % money[i];
		}
		cout << change << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <functional>
#include <cstring>
#include <queue>
#include <cmath>
#include <deque>
#include <list>
#include <iomanip>
#include <fstream>
#include <string>
#include <iterator>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
#define mp make_pair
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, N) FOR(i, 0, N)
#define SZ(x) ((int)(x).size())

const int MAXN = 100007, MOD = 1000000007;

int main()
{		
	int n, p;
	ll ans = 3;
	string s1, s2;
	cin >> n >> s1 >> s2;
	if (s1[0] == s2[0]) p = 1;
	else{
		ans = 6;
		p = 2;
	}
	while (p < n){
		if (s1[p - 1] == s2[p - 1]){
			ans *= 2;
			ans %= MOD;			
		}
		else{
			if (s1[p] != s2[p]) ans *= 3;
			ans %= MOD;
		}
		if (s1[p] == s2[p]) ++p;
		else p += 2;
	}
	cout << ans;
	//cout << endl; system("pause");//please
	return 0;
}

Measured memory_bytes: 256
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
gi = lambda : list(map(int,input().split()))
n, = gi()
ans = 0
mp = {}
while n:
	s = "".join(sorted(list(input())))
	if s in mp:
		ans += mp[s]
		mp[s] += 1
	else:
		mp[s] = 1
	n -= 1
print(ans)

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

int main(){
int n;
cin>>n;
for(int i=1;i<=9;i++){
  if(n%i==0){
    int b=n/i;
    if(b<=9) {
      cout<<"Yes"<<endl;
      return 0;
    }
  }
}
cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<stack>
//#define ll long long
using namespace std;
const int maxn=100;
const int INF=1000000000;
string str1,str2;

int main()
{
    cin>>str1>>str2;
    cout<<str2<<str1;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))

ball = [0]*N

for i in reversed(range(N)):
    Sum = 0
    x = 2
    while((i+1)*x <= N):
        Sum += ball[(i+1)*x-1]
        x += 1

    ball[i] = (Sum + a[i]) % 2

print(sum(ball))
for i in range(N):
    if ball[i] == 1:
        print(i+1,end=" ")

Measured memory_bytes: 65248
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String line = br.readLine();
    	while(line!=null){
    		String[] lines = line.split(" ");
    		double a = Double.parseDouble(lines[0]);
    		double b = Double.parseDouble(lines[1]);
    		double c = Double.parseDouble(lines[2]);
    		double d = Double.parseDouble(lines[3]);
    		double e = Double.parseDouble(lines[4]);
    		double f = Double.parseDouble(lines[5]);
    		
    		double x = (c*e-f*b)/(a*e - d*b);
    		double y = (c-a*x)/b;
    		BigDecimal xx = new BigDecimal(x);
			xx = xx.setScale(3, BigDecimal.ROUND_HALF_UP);
    		BigDecimal yy = new BigDecimal(y);
			yy = yy.setScale(3, BigDecimal.ROUND_HALF_UP);
    		System.out.printf("%.3f",xx);
    		System.out.print(" ");
    		System.out.printf("%.3f",yy);
    		System.out.println("");
    		line = br.readLine();
    	}
	}
}

Measured memory_bytes: 24920
#include<cstdio>
using namespace std;
int main(){

  int a[11],b,c;
  
  while(scanf("%d,",&a[1]) != EOF){
    
    a[0] = 0;
    for(int i=2;i<=10;i++){
      scanf("%d,",&a[i]);
      a[i] += a[i-1];
    }
    scanf("%d,%d",&b,&c);
    
    double sum = (double)a[10]/(b+c)*b;
    
    for(int i=1;i<=10;i++){
      if(sum<=a[i]){
	printf("%d\n",i);
	break;
      }
    }
    
  }    

  return (0);
}

Measured memory_bytes: 2616
#include<stdio.h>

int min(int a, int b) {
    return a < b ? a : b;
}

int max(int a, int b) {
    return a > b ? a : b;
}

int main(void){
    int A,B,C,D,E,F;
    scanf("%d %d %d %d %d %d", &A, &B, &C, &D, &E, &F);

    int m = 1, s = 0;
    for(int i=0; 100*A*i <= F; i++) {
        for(int j=0; 100*A*i+100*B*j <= F; j++) {
            for(int k=0;100*A*i+100*B*j+C*k <= F;k++){
                for(int l=0;100*A*i+100*B*j+C*k+D*l <= F;l++){
                    if((A*i+B*j)*E >= C*k+D*l && (C*k+D*l)*m >= s*(100*A*i+100*B*j+C*k+D*l)){
                        m = 100*A*i+100*B*j+C*k+D*l;
                        s = C*k+D*l;
                    }
                }
            }
        }
    }

    printf("%d %d\n", m, s);

    return 0;
}

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

int main() {
  int N;
  set<int> S;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int d;
    cin >> d;
    S.insert(d);
  }
  cout << S.size() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair
#define sz(x)       int(x.size())
#define int         long long

using namespace std;

typedef pair<int, int> pii;
const int N = 1e5 + 5;

struct TPoint {
    int x, y, id;
    void modify() {
        x = x + y;
        y = x - 2 * y;
    }
    bool operator<(const TPoint& o)const& {
        return x < o.x || (x == o.x && y < o.y);
    }
    int operator-(const TPoint& o)const& {
        return max(abs(x - o.x), abs(y - o.y));
    }
} p[N];
vector<int> adj[N];
int n, res, a, b, dis, vis[N], cnt[N], lef, rig, open[N];

void addedge(int x, int y) {adj[x].pb(y), adj[y].pb(x);}

void add(int x, int l, int r) {
    if(r < l) return;
    ++open[l + 1]; --open[r + 1];
    addedge(x, p[l].id);
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n >> a >> b;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i].x >> p[i].y;
        p[i].modify(); p[i].id = i;
    }
    dis = p[a] - p[b]; lef = 1, rig = 1;
    sort(p + 1, p + n + 1);
    for(int i = 1; i <= n; ++i) {
        while(p[i].x - p[lef].x > dis && lef < i) ++ lef;
        while(p[i].x == p[lef].x + dis && p[i].y - p[lef].y >= dis) ++lef; /// y - y1 < d
        while(p[i].x - p[rig].x > dis && rig < i) ++ rig;
        while(p[i].x == p[rig].x + dis && p[rig].y - p[i].y < dis) ++rig; /// y1 - y < d
        cnt[p[i].id] += rig - lef;
        add(p[i].id, lef, rig - 1);
    }
    for(int i = 1; i <= n; ++i) {
        open[i] += open[i - 1];
        if(open[i]) addedge(p[i].id, p[i - 1].id);
    }
    fill(open, open + n + 1, 0); lef = rig = 1;
    sort(p + 1, p + n + 1, [&](const TPoint& a, const TPoint& b) {
              return a.y < b.y || (a.y == b.y && a.x < b.x);
         });
    for(int i = 1; i <= n; ++i) {
        while(p[i].y - p[lef].y > dis && lef < i) ++ lef;
        while(p[i].y == p[lef].y + dis && p[i].x - p[lef].x > dis) ++ lef;
        while(p[i].y - p[rig].y > dis && rig < i) ++ rig;
        while(p[i].y == p[rig].y + dis && p[rig].x - p[i].x <= dis) ++ rig;
        cnt[p[i].id] += rig - lef;
        add(p[i].id, lef, rig - 1);
    }
    for(int i = 1; i <= n; ++i) {
        open[i] += open[i - 1];
        if(open[i]) addedge(p[i].id, p[i - 1].id);
    }
    queue<int> q; q.push(a), q.push(b); vis[a] = vis[b] = 1;
    for(; q.size(); q.pop()) {
        a = q.front();
        for(int x: adj[a])
            if(!vis[x]) vis[x] = 1, q.push(x);
    }
    for(int i = 1; i <= n; ++i) res += vis[i] * cnt[i];
    cout << res;
}


Measured memory_bytes: 18304
#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
 size_t strlen(const char *s);
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int N=100010;
const int P=1000000007;
int compare_int(const void *a, const void *b)
{
    return *(long long int*)b - *(long long int*)a;
}
//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ
//	cout<<(n-2)*180<<endl;
//	string s="hoge";
//	cout<<ans<<endl;
//	cin>>n>>a>>b>>c;
/*
	memset(b, '\0', sizeof(b));
初期化*/
/*
	len = strlen(s);
文字列長さ*/
/*
	string s;
	s.size()
*/
/*
	char s[N];
	strlen(s)
/*
	if(  <  )puts("YES");
	else puts("NO");
*/

int main(){
	long long int n, a,b,c, ns=1, ans=0;
	cin>>a>>b>>c;

/*	long long int as[N], bs[N], cnm[N];
	memset(as, '\0', sizeof(as));
	memset(bs, '\0', sizeof(bs));
	memset(cnm, '\0', sizeof(cnm));
	as[0]=1;
	bs[0]=1;
	cnm[0]=1;
	long long int invab=modinv(a+b,P);//inva+b
	long long int inva=mt(invab, a,P);
	long long int invb=mt(invab, b,P);
	rep(i, N){
		if(i>0){
			as[i]=mt(as[i-1],inva,P);
			bs[i]=mt(bs[i-1],invb,P);
			cnm[i]=mt(mt(cnm[i-1],modinv(i,P),P),n+i,P);

		}
	}
	long long int kari;
	rep(i, n){
		kari=cnm[i];
		kari=mt(kari,(mt(as[n],bs[i],P)+mt(as[i],bs[n],P))%P,P);
		kari=mt(kari,n+i,P);
		ans=(ans+kari)%P;
	}
	ans=mt(mt(ans,100,P),modinv(a+b,P),P);
*/
	cout<<a+b+c-max(a,max(b,c))<<endl;


}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define F(i,a,n) for(int i=a; i<n; i++)

long max(long a,long b){
    if(a>b) return a;
    else return b;
}


int main(){
    int n;
    scanf("%d",&n);
    int a[n],b[n],c[n]; 
    long dp[n][3];
    F(i,0,n){
        scanf("%d%d%d",a+i,b+i,c+i);
        F(k,0,3) dp[i][k]=0;
    }
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    F(j,1,n){
        dp[j][0] = a[j]+max(dp[j-1][1],dp[j-1][2]);
        dp[j][1] = b[j]+max(dp[j-1][0],dp[j-1][2]);
        dp[j][2] = c[j]+max(dp[j-1][1],dp[j-1][0]);
    }
    printf("%ld\n",max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])));
    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    vector<int> v(N);
    rep(i, N) cin >> v[i];

    vector<int> v2(N);
    rep(i, N) cin >> v2[i];

    int sum = 0;
    rep(i, N) {
        if(v[i] - v2[i] > 0) {
            sum += (v[i] - v2[i]);
        }
    }

    cout << sum << endl;
}


Measured memory_bytes: 256
///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define int long long
#define sz(x) (int)x.size()
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(n * a , b) << endl;
	return 0;
}


Measured memory_bytes: 256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1) { res = res * a%MOD; }
		a = a * a%MOD;
		b >>= 1;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑




long long mon, ze, it;
int main() {
	string h;
	cin >> h;
	mon = h[0];
	//[0]=0
	if (h[0] != '0') { ++ze; }
	for (int i = 1; i < h.length(); ++i) {
		if (i % 2 == 1 && h[i] != '1') { ++ze; }
		else if (i % 2 == 0 && h[i] != '0') { ++ze; }
	}
	mon = h[0];
	//[0]=1
	if (h[0] != '1') { ++it; }
	for (int i = 1; i < h.length(); ++i) {
		if (i % 2 == 1 && h[i] != '0') { ++it; }
		else if (i % 2 == 0 && h[i] != '1') { ++it; }
	}
	cout << min(ze, it) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

#define PI 3.14159265358979323846264338327950L
const int K_LIM = 500;

int res;

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    for (int q = 0; q < k; q++)
    {
        if (q > K_LIM)
        {
            break;
        }
        vector<int> b(n, 0);
        for (int i = 0; i < n; i++)
        {
            int l = max(0, i - a[i]);
            int r = min(n - 1, i + a[i]);
            b[l]++;
            if (r + 1 < n)
            {
                b[r + 1]--;
            }
        }
        for (int i = 1; i < n; i++)
        {
            b[i] += b[i - 1];
        }
        for (int i = 0; i < n; i++)
        {
            a[i] = b[i];
        }
    }
    for (int i = 0; i < n; i++)
    {
        cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4784
#include <stdio.h>
#include <string.h>

int getNumber(char x){
    switch(x){
        case 'I':
            return 1;
            break;
        case 'V':
            return 5;
            break;
        case 'X':
            return 10;
            break;
        case 'L':
            return 50;
            break;
        case 'C':
            return 100;
            break;
        case 'D':
            return 500;
            break;
        case 'M':
            return 1000;
            break;
        default:
            return -1;
            break;
    }
}
int main(void){
    char x[100+1];
    int sum;
    int i;
    
    while(scanf("%s\n",x)>0){
        sum=0;
        for(i=0;i<strlen(x);i++){
            if(getNumber(x[i])<getNumber(x[i+1]))sum-=getNumber(x[i]);
            else sum+=getNumber(x[i]);
        }
        printf("%d\n",sum);
    }
    
    return 0;
}



Measured memory_bytes: 2032
#include <bits/stdc++.h>
using namespace std;
int s[11];
int main(){
	int n, m, q, tot, maxn=0;
	cin >> n >> m >> q;
	int a[q+1], b[q+1], c[q+1], d[q+1];
	for (int i=1; i<=q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
	while (s[0]!=1){
		tot=0;
		s[n]++;
		int x=n;
		while (x>0&&s[x]>=m){
			s[x-1]++;
			s[x]=s[x-1];
			x--;
			for (int i=x+1; i<=n; i++) s[i]=s[x];
		}
		for (int i=1; i<=q; i++)
			if (s[b[i]]-s[a[i]]==c[i]) tot+=d[i];
		maxn=max(maxn, tot);
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <numeric>
#include <cmath>
#include <queue>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}


int main() {
	ll H, W, K,an=0;
	cin >> H >> W >> K;
	char c[7][7];
	rep(i, 7)rep(j, 7)c[i][j] = '.';
	rep(i, H) {
		string S;
		cin >> S;
		rep(j, W) {
			c[i][j] = S.at(j);
		}
	}
	for (int bith = 0; bith < (1 << H); ++bith) {
		for (int bitw = 0; bitw < (1 << W); ++bitw) {
			ll t = 0;
			for (int h = 0; h < H; ++h) {
				for (int w = 0; w < W; ++w) {
					if ((bith & (1 << h))&& (bitw & (1 << w))&&(c[h][w]=='#')) { // 列挙に i が含まれるか
						t++;
					}
				}
			}
			if (t == K)an++;

		}
	}
	cout << an << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    string s;
    cin>>s;
    int n=s.size();
    ll dp[n+1][13]={};
    dp[0][0]=1;
    rep(i,n){
        if(s[i]!='?'){
            int d=s[i]-'0';
            rep(j,13){
                dp[i+1][(10*j+d)%13]+=dp[i][j];
                dp[i+1][(10*j+d)%13]%=mod;
            }
        }
        else{
            rep(j,13){
                rep(k,10){
                    dp[i+1][(10*j+k)%13]+=dp[i][j];
                    dp[i+1][(10*j+k)%13]%=mod;
                }
            }
        }
    }
    cout<<dp[n][5]<<endl;
}


Measured memory_bytes: 10624
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
int main(){
    int n,max_num = -1000001,min_num = 1000001,tmp;
    long long int sum = 0;
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d",&tmp);
        sum += tmp;
        max_num = max(max_num,tmp);
        min_num = min(min_num,tmp);
    }
    printf("%d %d %lld\n",min_num,max_num,sum);
}


Measured memory_bytes: 2752
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

int getValue(vector<vector<int>> &queries, vector<int> &values) {

    int ans = 0;

    for (auto &q : queries) {
        if (values[q[1]-1] - values[q[0]-1] == q[2])
            ans += q[3];
    }
/*
    for (int i : values)
        cout << i << " ";
    cout << ": " << ans << '\n';
*/
    return ans;
}

void rec(vector<int> &values, int idx, int m, vector<vector<int>> &queries, int &maxValue) {
    if (idx >= values.size()) {
        maxValue = max(maxValue, getValue(queries, values));
        return;
    }

    for (int i = (idx == 0 ? 1 : values[idx-1]); i <= m; ++i) {
        values[idx] = i;
        rec(values, idx + 1, m, queries, maxValue);
    }
}


int solve()
{
    int N, M, Q;

    std::cin >> N >> M >> Q;

    vector<vector<int>> queries;

    for (int i = 0; i < Q; ++i) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;

        queries.push_back({a, b, c, d});
    }

    int maxValue = 0;
    vector<int> values(N);
    rec(values, 0, M, queries, maxValue);

    return maxValue;
}

int main()
{
    std::cout << solve() << std::endl;
    //solve();

    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }

const ll inf = LONG_LONG_MAX / 2 - 1;
ll n;
vector<ll> a;
vector<vector<pair<ll, ll>>> dp;

pair<ll, ll> dfs(ll l, ll r) {
    if (l == r) return dp[l][r] = make_pair(0, a[l]);
    pair<ll, ll> ans = dp[l][r];
    if (ans.first != inf) return ans;
    reps(i, l + 1, r + 1) {
        pair<ll, ll> lp = dfs(l, i - 1);
        pair<ll, ll> rp = dfs(i, r);
        ll val = lp.second + rp.second;
        ll sum = lp.first + rp.first + val;
        chmin(ans, make_pair(sum, val));
    }
    return dp[l][r] = ans;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    cin >> n;
    a.resize(n);
    rep(i, n) cin >> a[i];
    dp.resize(n, vector<pair<ll, ll>>(n, make_pair(inf, inf)));
    cout << dfs(0, n - 1).first << endl;
    return 0;
}


Measured memory_bytes: 5820
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
#include <array>
// ===============================================================
//using系
#pragma region header
using namespace std;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#define INF (lint)10000000000000000;
#define mod (int)1000000007
#pragma region header
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
#pragma endregion
#pragma endregion



int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s; cin >> s;
	if (s[s.size() - 1] == 's') cout << s << "es" << endl;
	else cout << s << 's' << endl;

	return 0;
}

Measured memory_bytes: 3676
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String str = sc.next();

		char[] result = new char[n + 1];

		String[] pre = {"SS","SW","WW","WS"};

		for(int i = 0; i < pre.length; i++){
			for(int j = 0; j < pre[i].length(); j++){
				result[j] = pre[i].charAt(j);
			}

			for(int j = pre[i].length() ; j < n + 1; j++){
				if(str.charAt(j - 1) == 'o'){
					if(result[j - 1] == 'S'){
						result[j] = result[j - 2];
					}
					else {
						result[j] = result[j - 2] == 'S' ? 'W' : 'S';
					}
				}
				else {
					if(result[j - 1] == 'W'){
						result[j] = result[j - 2];
					}
					else {
						result[j] = result[j - 2] == 'S' ? 'W' : 'S';
					}
				}
			}

			if(result[n] != result[0]){
				continue;
			}

			if(str.charAt(0) == 'o' && ((result[0] == 'S' && result[1] == result[n - 1]) ||
					(result[0] == 'W' && result[1] != result[n - 1]))){
				System.out.println(new String(result).substring(0, n));
				return;
			}
			if(str.charAt(0) == 'x' && ((result[0] == 'W' && result[1] == result[n - 1]) ||
					(result[0] == 'S' && result[1] != result[n - 1]))){
				System.out.println(new String(result).substring(0, n));
				return;
			}
		}

		System.out.println(-1);
	}

}


Measured memory_bytes: 31164
x,y,a,b,c=map(int,input().split())
plist=list(map(int,input().split()))
qlist=list(map(int,input().split()))
rlist=list(map(int,input().split()))

plist.sort()
qlist.sort()
rlist.sort(reverse=True)


pgensen=plist[a-x:]
qgensen=qlist[b-y:]

tmplist=pgensen+qgensen
tmplist.sort()

replacesum=0
for i in range(min(x+y,len(rlist))):
    if tmplist[i] >= rlist[i]:
        break
    else:
        replacesum+=rlist[i]-tmplist[i]

print(sum(tmplist)+replacesum)


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

public class Main {
	
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
		int n = in.readInt(); 
		int arr[] = new int[n]; 
		
		for(int i = 0 ; i<n; i++) 
			arr[i] = in.readInt();
		
		int max = 0;
		
		for(int i =0; i<n; i++) {
			boolean ans = true;
			for(int j = 0; j<i; j++) {
				if(arr[i] < arr[j]) {
					ans = false;
					break; 
				}
			}  
			 if(ans) max++;
		}
		System.out.println(max);
	}
}
class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
const int MOD = 1e9+7;


int main(){
 int n; cin>>n;
 
 int a[n+1];
 int b[n];
 ll count=0;
 REP(i,n+1)cin>>a[i];
 REP(i,n)cin>>b[i];
 REP(i,n){
     if(b[i]>=a[i]){
         b[i]-=a[i];
         count+=a[i];
         if(b[i]>=a[i+1]){
             count+=a[i+1];
           a[i+1]=0;
         }else{
             a[i+1]-=b[i];
             count+=b[i];
         }

     }else if(b[i]<a[i]) count+=b[i];
 }
 

 cout<<count<<endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n)cin >> a[i];
    vector<ll>b(n);
    rep(i,n)cin >> b[i];
    ll sum1[n],sum2[n];
    sum1[0]=a[0];
    sum2[n-1]=b[n-1];
    for(int i = 1;i < n;i++){
        sum1[i] = sum1[i-1]+a[i];
        sum2[n-i-1] = sum2[n-i]+b[n-i-1];
    }
    
    ll ans = 0;
    rep(i,n){
        ll sum = 0;
        sum += sum1[i]+sum2[i];
        ans = max(ans,sum);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Maxn 200007
using namespace std;
int n,a[Maxn];
int pos[Maxn];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		pos[a[i]]=i;
	}
	int ans=0,now=1;
	for (int i=1;i<n;i++)
		if (pos[i+1]>pos[i]) ++now;
		else
		{
			ans=max(ans,now);
			now=1;
		}
	ans=max(ans,now);
	printf("%d\n",n-ans);
	return 0;
}


Measured memory_bytes: 1792
A, B, H, M = map(int, input().split())
import math
kakudoA = 30 * H + 30 * (M / 60)
kakudoB = 6 * M
sa = min(abs(kakudoA - kakudoB), 360 - abs(kakudoA - kakudoB))
co = math.cos(math.radians(sa))
C = (A ** 2 + B ** 2 - 2 * A * B * co) ** (1/2)
print(C)


Measured memory_bytes: 9512
struct Read<R: std::io::BufRead> {
    stdin: R,
    v: Vec<String>,
    i: usize,
}
impl<R: std::io::BufRead> Read<R> {
    pub fn new(stdin: R) -> Self {
        Read {
            stdin: stdin,
            v: Vec::new(),
            i: 0,
        }
    }
    #[allow(dead_code)]
    pub fn read_one_line(&mut self) -> String {
        self.i = 0;
        self.v.clear();
        let mut buf = String::new();
        self.stdin.read_line(&mut buf).unwrap();
        buf.trim().to_owned()
    }
    pub fn read_line(&mut self) {
        self.i = 0;
        self.v.clear();
        let mut buf = String::new();
        self.stdin.read_line(&mut buf).unwrap();
        let buf = buf.trim().to_owned();
        let mut ws = buf.split_whitespace();
        loop {
            let x = ws.next();
            if x.is_none() {
                break;
            }
            let x = x.unwrap().to_owned();
            self.v.push(x);
        }
    }
    #[allow(dead_code)]
    pub fn read_a<T: std::str::FromStr>(&mut self) -> T {
        if self.i == self.v.len() {
            self.read_line();
        }
        let elem = &self.v[self.i];
        self.i += 1;
        elem.parse().unwrap_or_else(|_| panic!())
    }
}

use std::cmp;
fn main() {
    let stdin = std::io::stdin();
    let stdin = std::io::BufReader::new(stdin.lock());
    let mut r = Read::new(stdin);

    let h:usize = r.read_a();
    let w:usize = r.read_a();
    let k:i32 = r.read_a();
    let mut c: Vec<Vec<char>> = Vec::new();
    for i in 0..h {
        let buf:String = r.read_a();
        c.push(buf.chars().collect());
    }

    let bit_retu = 0;
    let bit_gyo = 0;

    
    let mut ans = 0;
    for bit_retu in 0..2<<w-1 {
        for bit_gyo in 0..2<<h-1 {
            
            let mut c2 = c.clone();
            let mut cnt = 0;
            let mut bit_retu2 = bit_retu;
            let mut bit_gyo2 = bit_gyo;
            while bit_retu2 > 0 {
                if bit_retu2 % 2 == 1 {
                    for i in 0..h {
                        c2[i][cnt] = '0';
                    }
                }
                bit_retu2 /= 2;
                cnt+=1;
            }
            let mut cnt = 0;
            //dbg!(bit_gyo2);
            while bit_gyo2 > 0 {
                //dbg!(bit_gyo2);
                if bit_gyo2 % 2 == 1 {
                    for i in 0..w {
                        //dbg!(cnt);
                        c2[cnt][i] = '0';
                        
                    }
                }
                bit_gyo2 /= 2;
                cnt+=1;
            }
            let mut sum = 0;
            for i in 0..h {
                for j in 0..w {
                    if c2[i][j] == '#' {
                        sum+=1;
                    }
                }
            }
            if sum == k {
                ans += 1;
            }
        }
    } 

    println!("{}", ans);

}


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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio();
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int x;
    cin>>x;
    if(x>=30)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 3632
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function arrayIn(){
		$buf = explode(" ", fgets(STDIN));
		return $this->killNewLine($buf);
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$s = $this->arrayIn();
		
		$a = $s[0] < $s[1] ? $s[0] : $s[1];
		$b = $s[0] < $s[1] ? $s[1] : $s[0];
		$k = $s[2];

		$ans = array();

		$max = $b;
		while(true){
			if(0 == $a % $max){
				if(0 == $b % $max){
					$ans[] = $max;
					$max--;
				}else{
					$max--;
				}
			}else{
				$max--;
			}
			if(0 == $max){break; };
		}
		rsort($ans);

		echo $ans[($k - 1)] . "\n";
	}
}
?>


Measured memory_bytes: 4604
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	a := make([]int, N+1)
	b := make([]int, N)
	for i := 0; i <= N; i++ {
		a[i] = getInt()
	}
	for i := 0; i < N; i++ {
		b[i] = getInt()
	}
	ans := 0
	for i := 0; i < N; i++ {
		c := min(a[i], b[i])
		ans += c
		b[i] -= c
		a[i] -= c

		d := min(a[i+1], b[i])
		ans += d
		a[i+1] -= d
	}
	out(ans)
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
int main(void){
  
  int A, B, C, K;		cin >> A >> B >> C >> K;
  long long max_num = max(A, max(B , C));
  long long ans = A + B + C - max_num;
  
  for(int i = 0 ; i < K ; i++)
    max_num *= 2;
  
  cout << (max_num + ans) << endl;
  
}

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

using namespace std;

typedef long long int ll;

const ll mod = 1e9 + 7;
const ll MAXN = 2e5 + 5;

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

  ll n, m;
  cin >> n >> m;
  priority_queue < ll > q;
  for(int i = 0; i < n; i++){
    ll a;
    cin >> a;
    q.push(a);
  }

  while(m--){
    ll u = q.top();
    q.pop();
    q.push(u / 2);
  }

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

  cout << ans << '\n';
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int n,m,a;
PPI ps[1111];

int main(){
	cin.sync_with_stdio(false);
	while(1){
		cin>>n>>m>>a;
		a--;
		if(n==0)break;
		rep(i,m){
			int h,p,q;
			cin>>h>>p>>q;
			p--; q--;
			ps[i]=PPI(h,P(p,q));
		}
		sort(ps,ps+m,greater<PPI>());
		rep(i,m){
			if(ps[i].se.fi==a)a=ps[i].se.se;
			else if(ps[i].se.se==a)a=ps[i].se.fi;
		}
		cout<<a+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 3096
#include <iostream>
typedef long long ll;
#include <cmath>

int main() {
  int n,i,ans=0;
  int a[20],b[20],c[20];
  std::cin >> n;
  for (i = 0; i < n; ++i) {std::cin >> a[i];}
  for (i = 0; i < n; ++i) {std::cin >> b[i];}
  for (i = 0; i < n-1; ++i) {std::cin >> c[i];}
  for (i = 0; i < n-1; ++i) {
    ans+=b[a[i]-1];
    if (a[i]+1==a[i+1]){ans+=c[a[i]-1];}
  }
  ans+=b[a[n-1]-1];
  std::cout <<ans << '\n';
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

const int limit = 200010;
int p[limit],idx[limit];

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

	rep(i,n){
		cin >> p[i],p[i]--;
		idx[p[i]]=i;
	}

	int cmax = 0,cnt = 1;

	rep(i,n){
		if(i -1 < 0 or idx[i] < idx[i-1])
			cnt = 1;
		else
			cnt++;
		chmax(cmax,cnt);
		//cerr << i << " " << cnt << endl;
	}

	cout << n - cmax << endl;

	return 0;
}

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

int main() {
  int a, b, c, d, ans;

  cin >> a >> b >> c >> d;
  ans = 0;

  if (a < b) {
    ans += a;
  } else {
    ans += b;
  }

  if (c < d) {
    ans += c;
  } else {
    ans += d;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(ll i=1;i<=n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 1000000007
#define mod 998244353
#define sec setprecision
#define Pair pair<ll,ll>
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
using namespace std;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	x %= mod;
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return (pow((x * x) % mod, n / 2) % mod);
	else
		return (x * pow(x, n - 1)) % mod;
}
int main() {
	int n; cin >> n;
	Rip(i, n) {
		int j = i * 2;
		int count = 0;
		for (int k = 2; k <= sqrt(j);k++) {
			for (int l = 2; l <= sqrt(j); l++) {
				if (k * k + l * l >= j)break;
				else {
					int m = sqrt(j - k * k - l * l);
					int p = k + l + m;
					if (m >= 2 && m * m == j - k * k - l * l && (k + l + m) - 2*max({ k,l,m })>=2 && (k + l + m) % 2 == 0) {
						count++;
					}
				}
			}
		}
		cout << count << endl;
	}
}


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

int main(){
int n=0,N,max;
	int *H;
	int i;
	scanf("%d",&N);
	H = (int *)malloc(N*sizeof(int));
	for(i=0;i<N;i++)scanf("%d",&H[i]);
	max=H[0];
	for(i=0;i<N;i++){
		if(H[i]>=max){
			max = H[i];
			n++;
		}
	}
	printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	int n,q; cin >> n >> q;
	string s; cin >> s;
	vi sum(n,0);
	rep(i,n-1){
		sum[i+1]=sum[i];
		if(s[i]=='A'&&s[i+1]=='C') sum[i+1]++;
	}
	vi ans(q);
	rep(i,q){
		int l,r; cin >> l >> r;
		l--; r--;
		ans[i]=sum[r]-sum[l];
//		if(sum[l]!=sum[l-1]) ans[i]--;
	}
	rep(i,q) cout << ans[i] << endl;
}




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

using namespace std;

typedef long long ll;
const int maxn = 1e5 + 10, MOD = 1e9 + 7;
ll pos[maxn],fac[maxn],facm[maxn];

ll quick_pow(ll a,ll n,ll p)
{
    ll x = a;
    ll res = 1;
    while(n)
    {
        if(n & 1)
        {
            res = ((ll)res * (ll)x) % p;
        }
        n >>= 1;
        x = ((ll)x*(ll)x) % p;
    }
    return res;
}

ll C(ll n,ll k){
    if(k > n) return 0ll;
    ll ans = fac[k]*fac[n-k]%MOD;
    ans = (fac[n]*quick_pow(ans,MOD-2ll,MOD))%MOD;
    return ans;
}

int main()
{
    fac[0] = 1;
    for(int i = 1;i < maxn;i++)
        fac[i] = (fac[i-1]*i)%MOD;
    ll n;
    scanf("%lld", &n);
    n++;
    ll m, x;
    for(int i = 1;i <= n;i++)
    {
        scanf("%lld", &x);
        if (pos[x])
        {
            m = n - (i - pos[x] + 1);
            break;
        }
        pos[x] = i;
    }
    for(int i = 1;i <= n;i++)
        printf("%lld\n", (C(n, i) - C(m, i-1)+MOD) % MOD);
    return 0;
}


Measured memory_bytes: 2816