akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <vector>
#include <stack>
#define Clear( x , y ) memset( x , y , sizeof(x) );
#define Qcin() std::ios::sync_with_stdio(false);
using namespace std;
typedef long long LL;
const int Maxn = 1e6 + 7;
const int Inf = 1e9 + 7;
int N , M;
char A[Maxn];
int main()
{
	while( ~scanf(" %s",A) ){
		int len = strlen(A);
		int flag = 1 , num = 0 , dum = 0;
		for( int i = 2 ; i < len-1 ; i++ ){
			if( A[i] == 'C' )	num++;
		}
		for( int i = 1 ; i < len ; i++ ){
			if( A[i] >= 'A' && A[i] <= 'Z' )	dum++;
		}
		if( A[0] != 'A'	)	flag = 0;
		if( dum == 1 && num == 1 && flag )
			printf("AC\n");
		else	printf("WA\n");
	}
}

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

using namespace std;
const int Mod = 998244353;
int main() {
    string s;
    int K;
    cin >> s >> K;
    vector<int> groups(1);
    int n_ones = 0;
    for (char c: s) {
        if (c == '1') {
            ++groups.back();
            ++n_ones;
        }
        else {
            groups.push_back(0);
        }
    }
    vector<vector<vector<int>>> dp(groups.size() + 1,
                vector<vector<int>>(n_ones + 1, vector<int>(n_ones + 1)));
    dp[0][0][0] = 1;
    int sum = 0;
    for (int k = 1; k <= (int) groups.size(); ++k) {
        sum += groups[k - 1];
        for (int g = 0; g <= n_ones; ++g) {
            for (int si = sum; si <= n_ones; ++si) {
                for (int sp = 0; sp <= n_ones; ++sp) {
                    int psi = si - g;
                    int psp = sp - max(g - groups[k - 1], 0);
                    if (psi < 0 || psp < 0)
                        continue;
                    dp[k][si][sp] = (dp[k][si][sp] + dp[k - 1][psi][psp]) % Mod;
                }
            }
        }
    }
    int res = 0;
    for (int i = 0; i <= n_ones; ++i) {
        for (int k = 0; k <= min(K, n_ones); ++k)
            res = (res + dp.back()[i][k]) % Mod;
    }
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 19848
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

using namespace std;

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

signed main()
{
    int n, k;
    cin >> n >> k;
    
    vi a(11);
    rep(i, 11) reps(j, 1, 6){
        a[i] += (9*(7*i + j + 1)) % 11 == k;
    }
    
    ll ans = 0;
    
    rep(i, 11){
        ans += a[i] * (ll((n+9-i)/11) + (i==0 ? -1 : 0));
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
package main

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

var checked []bool

func dfs(edge [][]int, l int, count int) int {
	if count == len(edge)-1 {
		return 1
	}
	total := 0
	for _, v := range edge[l] {
		if checked[v] {
			continue
		}
		checked[v] = true
		total += dfs(edge, v, count+1)
		checked[v] = false
	}
	return total
}
func main() {
	sc := NewScanner()
	N := sc.NextInt()
	M := sc.NextInt()
	edge := make([][]int, N+1)
	for i := 0; i < M; i++ {
		A := sc.NextInt()
		B := sc.NextInt()
		if edge[A] == nil {
			edge[A] = make([]int, 0)
		}
		if edge[B] == nil {
			edge[B] = make([]int, 0)
		}

		edge[A] = append(edge[A], B)
		edge[B] = append(edge[B], A)

	}

	checked = make([]bool, N+1)
	checked[1] = true
	fmt.Println(dfs(edge, 1, 1))

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
import fractions
n = int(input())
A = list(map(int, input().split()))
min_A = min(A)
B = []
for i in range(n):
  B.append(A[i]%min_A)
if all(B[i] == 0 for i in range(n)):
  print(min_A)
else:
  m = A[0]
  for i in range(1,n):
    m = fractions.gcd(m, A[i])
  print(m)

Measured memory_bytes: 16272
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
	cout << fixed << setprecision(10);
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i,n) cin >> v[i];
	int sum = 0;
	int right = 0;
	ll ans = 0;
	for(int left = 0; left < n; left++){
		while(right < n && ((sum + v[right]) == (sum ^ v[right])) ){
			sum += v[right];
			right ++ ;
		}
 		ans += right - left;
		sum -= v[left];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
N,W=map(int,input().split())

v=[0]*N
w=[0]*N

for i in range(N):
  a,b=map(int,input().split())
  v[i]=a
  w[i]=b

nap=[[0]*(W+1) for i in range(N+1)]

for i in range(1,N+1):
  for j in range(1,W+1):

    if j<w[i-1]:
      nap[i][j]=nap[i-1][j]
    else:
      nap[i][j]=max(nap[i-1][j],nap[i-1][j-w[i-1]]+v[i-1])

#print(nap)
print(nap[N][W])



Measured memory_bytes: 25496
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n,T;
	cin>>n>>T;
	int x=1001;
	for(int i=0; i<n; i++){
		int c,t;
		cin>>c>>t;
		if(t<=T){x=min(x,c);}
	}
	if(x==1001){cout<<"TLE"<<endl;}
	else cout<<x<<endl;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

long long  N, K;
vector<long long> x;

long long calcTime(int i, int k){
	if(k <= 1) return 0;

	long long rt = (1L<<61), lt = (1L<<61);

	int Rk = N - i - 1; //x[i]より右にある本数
	int Lk = i;         //x[i]より左にある本数

	//右に行ってから左へ
	for(int j = K - i - 1; j <= Rk; j++){
		if(i + j >= N || j < 0) continue;
		long long t = x[i + j] - x[i]; //右の端までの時間
		t *= 2; //x[i]まで戻ってくる
		t += x[i] - x[i - (K - j - 1)];//左の端まで
		if(t < rt) rt = t;
	}

	//左に行ってから右へ
	for(int j = K- N + i; j <= Lk; j++){
		if(i < j || j < 0) continue;;
		long long t = x[i] - x[i - j]; //左の端までの時間
		t *= 2; //x[i]まで戻ってくる
		t += x[i + (K - j - 1)] - x[i];//右の端まで
		if(t < lt) lt = t;
	}
	return (long long) min(rt, lt);
}

int main(int argc, char* argv[]){
	cin >> N >> K;
	for(int i=1; i<=N; i++){
		long long u;
		cin >> u;
		x.push_back(u);
	}
	//入力はソート済だが念のためソートする
	sort(x.begin(), x.end());

	long long ans = 0;
	if(x[0] >= 0){
		ans = (long long)abs(x[K-1]);
		printf("%lld\n", ans);
		return 0;
	}
	else if(x[N-1] <= 0){
		ans = (long long)abs(x[N-K]);
		printf("%lld\n", ans);
		return 0;
	}
	int a, b;
	for(int i=0; i<N; i++){
		if(x[i] > 0){ break; }
		a = i;
	}
	for(int i=N-1; i>=0; i--){
		if(x[i] < 0){ break; }
		b = i;
	}
	long long ans_a = abs(x[a]) + calcTime(a, K);
	long long ans_b = abs(x[b]) + calcTime(b, K);
	ans = min( ans_a, ans_b);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1400
h1, m1, h2, m2, k = map(int, input().split())

needHour = k//60
needMin = k%60

remitHour = 0
remitMin = 0
if m2 > m1:
    remitHour = h2 - h1 -1
    remitMin = m2+60 - m1
else:
    remitHour = h2 - h1
    remitMin = m2 - m1

if remitHour - needHour <= 0 and remitMin - needMin <= 0:
    print(0)
else:
    ansHour = 0
    ansMin = 0
    if remitMin >= needMin:
        ansHour = remitHour - needHour
        ansMin = remitMin - needMin
    else:
        ansHour = remitHour - needHour -1
        ansMin = remitMin+60 - needMin
    print(ansHour*60 + ansMin)


Measured memory_bytes: 9196
#include <iostream>
#include <set>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    multiset<int> st;
    while(N--) {
        int A;
        cin >> A;
        st.insert(A);
        auto itr = st.find(A);
        if(itr != st.begin()) {
            st.erase(--itr);
        }
    }
    cout << st.size() << endl;
    return 0;
}


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

using namespace std;

#define FOR(i,f,t) for(int i=(int)f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=(int)f; i>(int)t; i--)
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define pb push_back
#define SYNC ios_base::sync_with_stdio(false)
#define st(v) sort(v.begin(),v.end());
#define F first
#define S second
#define ri(x) scanf("%d",&x)
#define rii(x,y) scanf("%d %d",&x,&y)
#define riii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define lri(x) scanf("%lld",&x)
#define lrii(x,y) scanf("%lld %lld",&x,&y)
#define lriii(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 5e5; //AREGLAAAAAAAAR!!!!
int a[123];
int main(){
	int n,x;
	rii(n,x);
	FOR(i,0,n) ri(a[i]);
	sort(a,a+n);
	int ans = 0;
	FOR(i,0,n-1){
		if(x-a[i]>=0){
			ans++;
			x-=a[i];
		}
	}
	if(n-1>=0 && x==a[n-1]) ans++;
	printf("%d\n",ans);
}


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

int main() {
  std::cin.tie(0);

  int n;
  std::cin >> n;
  std::vector<int> s(n, 0);
  for (int i = 0; i < n; i++) {
    std::cin >> s[i];
  }
  int q;
  std::cin >> q;
  std::vector<int> t(q, 0);
  for (int i = 0; i < q; i++) {
    std::cin >> t[i];
  }

  int count = 0;
  for (auto i : t) {
    for (auto j : s) {
      if (i == j) {
        count++;
        break;
      }
    }
  }

  std::cout << count << std::endl;
}



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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define int ll
//#define endl '\n'

int a[57];
int n;

int32_t main()
{
    IOS
    cin>>n;
    for (int i=1;i<=n;i++) cin>>a[i];
    int ok=1;
        for (int k=1;k<=n;k++) if (a[k]!=k) ok=0;
        if (ok) return cout<<"YES"<<endl,0;
    for (int i=1;i<=n;i++)
        for (int j=1;j<i;j++)
    {
        swap(a[i],a[j]);
        ok=1;
        for (int k=1;k<=n;k++) if (a[k]!=k) ok=0;
        if (ok) return cout<<"YES"<<endl,0;
        swap(a[i],a[j]);
    }
    cout<<"NO"<<endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>

const int MAXN=60;

int n;
int k;
int x[MAXN];
int y[MAXN];
int sx[MAXN];
int sy[MAXN];
int px[MAXN];
int py[MAXN];
int sum[MAXN][MAXN];
long long ans=0x7FFFFFFFFFFFFFFF;

int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		scanf("%d%d",x+i,y+i);
		sx[i]=x[i];
		sy[i]=y[i];
	}
	std::sort(sx+1,sx+n+1);
	std::sort(sy+1,sy+n+1);
	for(int i=1;i<=n;i++){
		int tx=std::lower_bound(sx+1,sx+n+1,x[i])-sx;
		int ty=std::lower_bound(sy+1,sy+n+1,y[i])-sy;
		px[tx]=x[i];
		py[ty]=y[i];
		// printf("%d %d\n",tx,ty);
		for(int a=tx;a<=n;a++){
			for(int b=ty;b<=n;b++){
				sum[a][b]++;
			}
		}
	}
	for(int x1=1;x1<=n;x1++){
		for(int y1=1;y1<=n;y1++){
			for(int x2=x1;x2<=n;x2++){
				for(int y2=y1;y2<=n;y2++){
					if(sum[x2][y2]+sum[x1-1][y1-1]-sum[x1-1][y2]-sum[x2][y1-1]==k){
						// printf("%d %d %d %d\n",px[x1],py[y1],px[x2],py[y2]);
						ans=std::min(1ll*(px[x2]-px[x1])*(py[y2]-py[y1]),ans);
					}
				}
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}


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

int main()
{
    size_t N; cin >> N;
    vector<int> P(N), Q(N), V(N);

    for (size_t i=0; i<N; ++i)
        cin >> P[i];
    for (size_t i=0; i<N; ++i) {
        cin >> Q[i];
        V[i] = i+1;
    }

    if (P == Q) {
        cout << 0 << endl;
        return 0;
    }

    int noP = -1, noQ = -1, cnt = 0;
    do {
        if (P == V) {
            noP = cnt;
            if (noQ > 0) break;
        }
        if (Q == V) {
            noQ = cnt;
            if (noP > 0) break;
        }
        cnt++;
//        for (size_t i=0; i<N; ++i)
//            cout << V[i] << ' ';
//        cout << endl;
    } while (next_permutation(V.begin(), V.end()));

    int diff = noP - noQ;
    if (diff < 0) diff = -diff;
    cout << diff << endl;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int, input().split()))
b=[]
c=[0]+a+[0]
for i in range(len(c)-1):
    b.append(c[i+1]-c[i])
sumb=sum([abs(i) for i in b])
 
for i in range(n):
    print(sumb-abs(b[i])-abs(b[i+1])+abs(b[i]+b[i+1]))

Measured memory_bytes: 15056
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- readInt
	h <- readInt
	w <- readInt
	print $ ( n - h + 1 ) * ( n - w + 1 )

Measured memory_bytes: 508
#include<stdio.h>
int main()
{
	int s(int p);
	int a,b,c,i,t=0;
	scanf("%d%d%d",&a,&b,&c);
	for(i=1;i<=a;i++)if(s(i)>=b&&s(i)<=c)t+=i;
	printf("%d\n",t);
	return 0;
}
int s(int p)
{
	int t=0;
	while(p>0)
	{
		t+=p%10;
		p/=10;
	}
	return t;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>
 
#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif
 
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define FOR(i, A, N) for(int (i) = (A); (i) < (N); (i)++)
#define REP(i, N) for(int (i) = 0; (i) < (N); (i)++)
 
using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
 
int A[55];
int B[55];
int n,m;
int solve_fast() {
	vector<pair<int,int>> cards;
	REP(i, n) {
		cards.pb(mp(A[i],B[i]));
	}
	int sudych = (n+1)/2;
	int bans = 1<<25;
	REP(i, 1<<n) {
		int cnt = 0;
		vector<pair<int,int>> sude, liche;
		REP(j, n) if(i&(1<<j)) {
			// lisi se j1%2 od j2%2
			cnt++;
			if(j % 2 == 0)
				liche.pb(mp(cards[j].Y, j));
			else
				sude.pb(mp(cards[j].Y, j));
		} else {
			if(j % 2 == 0)
				sude.pb(mp(cards[j].X, j));
			else
				liche.pb(mp(cards[j].X, j));
		}
		if(sude.size() != sudych)
			continue;
		bool good = true;
		int ans = 0;
		sort(sude.begin(), sude.end());
		sort(liche.begin(), liche.end());
		vector<int> arr(n);
		REP(j, sude.size()) arr[2*j] = sude[j].Y;
		REP(j, liche.size()) arr[2*j+1] = liche[j].Y;
		REP(k, n) for(int j = 0; j < k; j++) if(arr[j] > arr[k]) ans++;
		REP(j, sude.size()) {
			if(j < liche.size() && sude[j].X > liche[j].X) {
				good = false;
			}
			if(j > 0 && liche[j-1].X > sude[j].X)
				good = false;
		}
		if(good) {
			bans = min(bans, ans);
		}
	}
	if(bans == 1<<25)
		return -1;
	else
		return bans;
	
}
int perm[55];

int solve_slow() {
	int ans = 1<<25;
	do {
		int dist = 0;
		vector<int> arr(n);
		REP(i, n) {
			int dest = perm[i];
			if(dest%2 == i%2)
				arr[dest] = A[i];
			else
				arr[dest] = B[i];
			dist += abs(dest-i);
		}
		bool good = true;
		REP(i, n-1) if(arr[i+1] < arr[i]) {
			good = false;
		}
		if(good) {
			ans = min(ans, dist/2);
		}
	} while(next_permutation(perm, perm+n));
	if(ans == 1<<25) return -1;
	return ans;
}

int main() {
	
	scanf("%d", &n);
	REP(i, n) {
		scanf("%d", A+i);
		perm[i] = i;
	}
	REP(i, n) scanf("%d", B+i);
	printf("%d\n", solve_fast());/*


	srand(time(NULL));
	while(true) {
		n = rand()%10+1;
		REP(i, n) A[i] = rand()%(2*n)+1;
		REP(i, n) B[i] = rand()%(2*n)+1;
		REP(i, n) perm[i] = i;
		int Aa = solve_slow();
		int Bb = solve_fast();
		if(Aa != Bb) {
			printf("%d\n", n);
			REP(i, n) printf("%d ", A[i]);
			REP(i, n) printf("%d ", B[i]);
			printf("\n");
		} else {
			printf("n=%d, A=%d, B=%d\n", n, Aa, Bb);
		}
	}*/

 
	return 0;
}


Measured memory_bytes: 256
N = 6
ARR = [
    "AC",
    "TLE",
    "AC",
    "AC",
    "WA",
    "TLE"
]
N = int(input())
ARR = []

for i in range(N):
    ARR.append(input())

acNum = 0
tleNum = 0
waNum = 0
reNum = 0
for i in range(N):
    if ARR[i] == "AC":
        acNum +=1

    if ARR[i] == "TLE":
        tleNum += 1

    if ARR[i] == "WA":
        waNum += 1

    if ARR[i] == "RE":
        reNum += 1



print("AC x {}".format(acNum))
print("WA x {}".format(waNum))
print("TLE x {}".format(tleNum))
print("RE x {}".format(reNum))

Measured memory_bytes: 16328
import collections
a = input().split()
N = int(a[0])
b = int(a[1])
c = [int(s) for s in input().split()]
d = collections.Counter(c)
e = len(d)
f = []
for myvalue in d.values():
    f.append(myvalue)
g = sorted(f)
h = int(0)
if b >= int(e):
    print("0")
else:
    for i in range(int(e) - b):
        h = h + g[i]
    print(h)


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

using namespace std;
typedef long long ll;

int main()
{
  int N, M; cin >> N >> M;
  vector<pair<ll, ll>> a(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i].first >> a[i].second;
  }

  sort(a.begin(), a.end());

  ll result = 0;
  int counter = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = 1; j <= a[i].second; ++j) {
      counter++;
      result += a[i].first;

      if (counter >= M) {
        cout << result << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 1792
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  int64_t N,K;
  cin >> N >> K;
  
  int64_t min = 0;
  int64_t max = N;
  int64_t res = 0;
  if (K == 1) res += (N+1);
  for (int i = 2; i <= N + 1; i++) {
    min += i - 1;
    max += (N - i + 1);
    if (K <= i) {
      res += (max - min + 1);
      res %= MOD;
    }
  }
  cout << res << endl;
  return 0;
}



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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); 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; }

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    string s;
    cin >> s;
    bool flag = true;
    int n = s.size();

    rep(i, n)
    {
        if( s[i] != s[n-i-1] )flag = false;
    }
    
    rep(i, (n-1)/2)
    {
        //cout << i << " " << (n-1)/2-1-i << endl;
        if( s[i] != s[(n-1)/2-1-i] ) flag = false;
    }
    //cout << endl;
    REP(i, (n+3)/2-1, n)
    {
        //cout << i << " " << n - i -2 + (n+3)/2 << endl;
        if( s[i] != s[n - i -2 + (n+3)/2] ) flag = false;
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
N = int(input())
S = [input() for i in range(N)]

S.sort()
S.append("!")

c = []
tmp = ""
cnt = 0
mx = 0

for i in S:
    if i != tmp:
        c.append([cnt, tmp])
        tmp = i
        cnt = 1
    else:
        cnt += 1
    mx = max(mx, cnt)

c.sort()

for i, j in c:
    if i == mx:
        print(j)


Measured memory_bytes: 39108
import java.util.Scanner;

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

		while (true) {
			// ??????????????°?????\??????
			// val:??\??????????????°?????????
			int val = sc.nextInt();

			if (val == 0) {
				break;
			}
			int[] score = new int[val];
			int sum = 0;
			int max = 0; 
			int min = 1001; 

			for (int i = 0; i < val; i++) {
				score[i] = sc.nextInt();

				// ??\???????????????????????§???????±??????????
				if (max < score[i]) {
					max = score[i];
				}
				// ??\??????????????????????°????????±??????????
				if (min > score[i]) {
					min = score[i];
				}
			}
			for (int j = 0; j < val; j++) {
				sum = sum + score[j];
			}
			int ave = (sum - max - min) / (val - 2);
			System.out.println(ave);

		}
	}
}

Measured memory_bytes: 28756
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
int main()
{
	int n,i,p,a,b,c,d,e,f,m,s;
	char l[32];
	pair<double,string>A[50];
	while(scanf("%d",&n),n)
	{
		for(i=0;i<n;++i)
		{
			scanf("%s%d%d%d%d%d%d%d%d%d",l,&p,&a,&b,&c,&d,&e,&f,&s,&m);
			A[i].second=l;
			A[i].first=-(f*s*m-p)/double(a+b+c+m*(d+e));
		}
		sort(A,A+n);
		for(i=0;i<n;++i)puts(A[i].second.c_str());
		puts("#");
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
cout<<"square1001"<<endl;

  return 0;
}


Measured memory_bytes: 3012
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
ll a[100005];
ll b[100005];

ll labs(ll v){
	if(v<0LL)return -v;
	return v;
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	sort(a,a+n);
	vector<ll> v1;
	vector<ll> v2;
	for(int i=0;i<(n+1)/2;i++){
		v1.push_back(a[i]);
	}
	for(int i=(n+1)/2;i<n;i++){
		v2.push_back(a[i]);
	}
	int j;
	if(n%2==0){
		j=n-2;
		for(int i=0;i<v1.size();i++){
			b[j]=v1[i];
			j-=2;
		}
		j=n-1;
		for(int i=0;i<v2.size();i++){
			b[j]=v2[i];
			j-=2;
		}
	}else{
		j=n-1;
		swap(v1[0],v1[v1.size()-2]);
		for(int i=0;i<v1.size();i++){
			b[j]=v1[i];
			j-=2;
		}
		j=n-2;
		for(int i=0;i<v2.size();i++){
			b[j]=v2[i];
			j-=2;
		}
	}
	ll ans=0;
	for(int i=0;i<n-1;i++){
		ans+=labs(b[i]-b[i+1]);
	}
	reverse(a,a+n);
	v1.clear();
	v2.clear();
	for(int i=0;i<(n+1)/2;i++){
		v1.push_back(a[i]);
	}
	for(int i=(n+1)/2;i<n;i++){
		v2.push_back(a[i]);
	}
	if(n%2==0){
		j=n-2;
		for(int i=0;i<v1.size();i++){
			b[j]=v1[i];
			j-=2;
		}
		j=n-1;
		for(int i=0;i<v2.size();i++){
			b[j]=v2[i];
			j-=2;
		}
	}else{
		j=n-1;
		swap(v1[0],v1[v1.size()-2]);
		for(int i=0;i<v1.size();i++){
			b[j]=v1[i];
			j-=2;
		}
		j=n-2;
		for(int i=0;i<v2.size();i++){
			b[j]=v2[i];
			j-=2;
		}
	}
	ll ans2=0;
	for(int i=0;i<n-1;i++){
		ans2+=labs(b[i]-b[i+1]);
	}
	printf("%lld\n",max(ans,ans2));
	return 0;
}

Measured memory_bytes: 2680
a = int(input())
b = int(input())

flag1 = True
flag2 = True
flag3 = True

if a == 1:
    flag1 = False
elif a == 2:
    flag2 = False
elif a == 3:
    flag3 = False
    
if b == 1:
    flag1 = False
elif b == 2:
    flag2 = False
elif b == 3:
    flag3 = False
    
if flag1:
    print(1)
elif flag2:
    print(2)
else:
    print(3)


Measured memory_bytes: 9068
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
 
## input
 
# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
 
X,Y=map(int, input().split())

if Y < 2*X:
    print("No")
    sys.exit()
if 4*X < Y:
    print("No")
    sys.exit()
if Y%2 == 1:
    print("No")
    sys.exit()

print("Yes")

Measured memory_bytes: 72932
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val (n, m, x, y) = (sc.nextInt, sc.nextInt, sc.nextInt, sc.nextInt)
  val xs = (x +: Vector.fill(n)(sc.nextInt)).sorted
  val ys = (y +: Vector.fill(m)(sc.nextInt)).sorted
  println(if (xs.last < ys.head) "No War" else "War")
}


Measured memory_bytes: 25904
#include <bits/stdc++.h>
using namespace std;
const double PI  = acos(-1.0);
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 
int main()
{
    string S, T;
    cin >> S >> T;
    
    rep(i, S.length()){
        if (S[i] != T[i]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}



Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)
#define int ll

signed main(){
	int n;
	cin>>n;
	vector<int> v(n);
	rep(i,n)cin>>v[i];
	
	int ans=0;
	rep(i,n){
		ans+=v[i]/2;
		v[i]%=2;
		if(i!=n-1&&v[i]==1&&v[i+1]!=0){
			v[i+1]--;
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
#include <atcoder/all>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t; cin >> t;
    while (t-->0) {
        ll n, m, a, b; cin >> n >> m >> a >> b;
        cout << atcoder::floor_sum(n, m, a, b) << '\n';
    }
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define endl "\n"
typedef long long ll;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl

const int MOD = 1000000007;

ll func(ll x, ll y) {
  return x/y;
}

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

  ll a,b,x; cin >>a >> b >> x;
  ll res;
  if(a==0) res = func(b,x)+1;
  else res = func(b, x) - func(a-1, x);
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = int(input())
ans = 0
if n == 1:
    ans = a // 2
else:
    for i in range(1, n):
        b = int(input())
        ans += (a + b) // 2
        if b == 0:
            a = 0
        else:
            a = (a + b) % 2

print(ans)


Measured memory_bytes: 3188
#include <stdio.h>

int main(void)
{
    int a,b,i,j;
    double c,k=0;

scanf("%d %d",&a,&b);
for(i=1;i<=a;i++){
    c=1.0/a;
    j=i;
    while(j<b){
        j*=2;
        c/=2;
    }
    k+=c;
}
printf("%.12f",k);
return 0;
}


Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20

class Counting():
    def __init__(self,maxim,mod):
        maxim += 1

        self.mod = mod
        self.fact = [0]*maxim
        self.fact[0] = 1
        for i in range(1,maxim):
            self.fact[i] = self.fact[i-1] * i % mod

        self.invfact = [0]*maxim
        self.invfact[maxim-1] = pow(self.fact[maxim-1],mod-2,mod)
        for i in reversed(range(maxim-1)):
            self.invfact[i] = self.invfact[i+1] * (i+1) % mod


    def nCk(self,n,r):
        if n < 0 or n < r: return 0
        return self.fact[n] * self.invfact[r] * self.invfact[n-r] % self.mod

    def nPk(self,n,r):
        if n < 0 or n < r: return 0
        return self.fact[n] * self.invfact[n-r] % self.mod




def main():
    K=ii()
    S=list(input())
    N=len(S)
    MOD = 10**9+7

    comb = Counting(N+K+10,MOD)
    ans = 0
    for x in range(K+1):
        ans += comb.nCk(N+K-(x+1),N-1) * pow(25,K-x,MOD) * pow(26,x,MOD) % MOD
        ans %= MOD

    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 153128
#include <math.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 
//ABC164C-2
int main(void) {
  int n, k, i, cou=1, tmp;
  scanf("%d", &n);
  char s[n][11];
  for(i=0; i < n; i++) scanf("%s", s[i]);
  qsort(s, n, sizeof(char[11]), strcmp);//文字列ソート
  for(i=0; i < n-1; i++) if(strcmp(s[i],s[i+1])!=0)cou++;
  printf("%d",cou);
}

Measured memory_bytes: 5744
/*Author- Soumak Poddar*/

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

#define ll long long int
#define sll signed long long int
#define ull unsigned long long int
#define um unordered_map
#define mp make_pair
#define pb push_back
#define M 1000000007
#define mm multimap

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

   #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("error.txt", "w", stderr);
      freopen("output.txt", "w", stdout);
   #endif
   
   int t=1;
   //cin>>t;
   while(t--)
   {
      solve();
      cout<<"\n";
   }
   cerr<<"Time Taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
   return 0;
}
void solve()
{
   int n;
   cin>>n;
   map<string,int> m;
   m["AC"]=0;
   m["WA"]=0;
   m["TLE"]=0;
   m["RE"]=0;
   while(n--)
   {
      string s;
      cin>>s;
      m[s]++;
   }
   for(auto i:m)
   {
      if(i.first=="AC")
      {
         cout<<i.first<<" x "<<i.second<<"\n";
         break;
      }
   }
   for(auto i:m)
   {
      if(i.first=="WA")
      {
         cout<<i.first<<" x "<<i.second<<"\n";
         break;
      }
   }
   for(auto i:m)
   {
      if(i.first=="TLE")
      {
         cout<<i.first<<" x "<<i.second<<"\n";
         break;
      }
   }
   for(auto i:m)
   {
      if(i.first=="RE")
      {
         cout<<i.first<<" x "<<i.second<<"\n";
         break;
      }
   }
}

Measured memory_bytes: 3800
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>

using namespace std;
int main() {
	bool af = false, bf = false;
	int ans = 0;
	int a, b, c, d;
	cin >>a >> b >> c >>d;
	for (int i = 0; i <= 100;i++) {
		if (i == a) {
			af = true;
		}
		if (i == c) {
			bf = true;
		}
		if (i == b) {
			af = false;
		}
		if (i == d) {
			bf = false;
		}
		if (af && bf) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}



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

public class Hello {
    public static void Main() {
        var n = int.Parse(Console.ReadLine());
        var ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var p = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        int[] t = new int[3];
        for (int i = 0; i < n; i++) {
            if (p[i] <= ab[0]) {
                t[0]++;
            } else if (ab[1] < p[i]) {
                t[2]++;
            } else {
                t[1]++;
            }
        }
        
        Console.WriteLine(t.Min());
    }
}

Measured memory_bytes: 13396
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	ll N;
	cin>>N;
	char S[100010];
	cin>>S;
	ll ans=0;
	char now=0;
	rep(i,N){
		if(S[i]!=now){
			ans++;
			now=S[i];
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 384
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;
int main() {
    // freopen("in.txt", "r", stdin);
    int N, M, X;
    cin >> N >> M >> X;
    vector<vector<int>> a(N, vector<int>(M));
    vector<int> c(N);
    for (int i = 0; i < N; i++) {
        cin >> c[i];
        for (int j = 0; j < M; j++) {
            cin >> a[i][j];
        }
    }
    int up = 1 << N;
    int cost, ans = INT_MAX;
    vector<int> v(M);
    for (int i = 0; i < up; i++) {
        cost = 0;
        v.assign(M, 0);
        for (int j = 0; j < N; j++) {
            if (((1 << j) & i) ) {
                cost += c[j];
                for (int k = 0; k < M; k++) {
                    v[k] += a[j][k];
                }
            }
        }
        bool flag = true;
        for (int k = 0; k < M; k++) {
            if (v[k] < X) {
                flag = false;
                break;
            }
        }
        if(flag) 
            ans = min(ans, cost);
    }
    cout << (ans==INT_MAX?-1:ans) << endl;
}

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

int main(){
  int h,w;
  cin>>h>>w;
  string s[h];
  REP(i,h){
    cin>>s[i];
  }
  REP(i,w+2){
    cout<<'#';
  }
  cout<<endl;
  REP(i,h){
    cout<<'#'<<s[i]<<'#'<<endl;
  }
  REP(i,w+2){
    cout<<'#';
  }
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
 int n; cin >> n;
  vector<int>v(n);
  for(int i=0; i<n; ++i) cin >> v[i];
  long long count = 0;
  int mx = 0;
  for(int i=0; i<n; ++i){
		mx = max(mx,v[i]);
        int f = mx;
        count += f - v[i];
    } 
  cout << count << "\n";
  return 0;
}

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

namespace abc169_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = CIn.ReadLong();
            var B = CIn.ReadDecimal();
            var C = A * B;
            var ans = Math.Floor(C);
            Console.WriteLine(ans);
            
        }
    }

    class CIn
    {
        private static readonly Queue<string> fieldBuffer = new Queue<string>();

        public static string Read()
        {
            if (fieldBuffer.Count == 0)
            {
                foreach (var field in Console.ReadLine().Split())
                {
                    fieldBuffer.Enqueue(field);
                }
            }

            return fieldBuffer.Dequeue();
        }

        public static int ReadInt() => int.Parse(Read());
        public static long ReadLong() => long.Parse(Read());
        public static double ReadDouble() => double.Parse(Read());

        public static decimal ReadDecimal() => decimal.Parse(Read());

        public static string[] ReadStringArray(long n)
        {
            var array = new string[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = Read();
            }

            return array;
        }

        public static int[] ReadIntArray(long n)
        {
            var array = new int[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadInt();
            }

            return array;
        }

        public static long[] ReadLongArray(long n)
        {
            var array = new long[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadLong();
            }

            return array;
        }
        public static double[] ReadDoubleArray(long n)
        {
            var array = new double[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadDouble();
            }

            return array;
        }
    }

}


Measured memory_bytes: 27984
max = gets.to_i
str = gets

count = str.count('R')*str.count('G')*str.count('B')

for distance in 1..max/2
    for i in 0..(max -2*distance-1)
        if(str[i] != str[i + distance] && str[i + distance] != str[i + 2* distance] && str[i + 2 * distance] != str[i])
            count = count - 1
        end
    end
end

puts(count)

Measured memory_bytes: 14392
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define pb push_back
#define MOD 1000000007
#define INF 1000000000000
#define EPS 0.00000000001
typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //---------------------------------------------

    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    sort(rall(a));
    int c = 0;
    ll memo;
    rep(i, m)
    {
        if (c == 0)
        {
            a[0] /= 2;
            memo = a[0];
            c++;
        }
        else
        {
            if (a[c] >= memo)
            {
                a[c] /= 2;
                c++;
            }
            else
            {
                sort(rall(a));
                c = 1;
                a[0] /= 2;
                memo = a[0];
            }
        }

        if (c == n)
        {
            c--;
        }
    }

    ll ans = 0;
    rep(i, n)
    {
        ans += a[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
N=int(input())
ls=[i for i in range(N+1)]
cand=[1]
x=6
while (x<=N):
  cand.append(x)
  x*=6
x=9
while (x<=N):
  cand.append(x)
  x*=9
cand.sort()
for i in range(1,N+1):
  y=N
  for e in cand:
    if e>i: break
    if ls[i-e]<y:y=ls[i-e]
  ls[i]=y+1
print(ls[N])
      
      
  



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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, VL, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N;
vector<bool> dp(10001, 0);

signed main() {
    cin >> N;
    dp[0] = 1;
    REP(i, N) {
        LCIN(s);
        REPR(j, 10000 - s) { dp[j + s] = dp[j + s] | dp[j]; }
    }
    REPR(i, 10000) if((i % 10 && dp[i]) || i == 0) {
        cout << i << "\n";
        return 0;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	int ans = 0;
	for (int i = 1; i*i <= m; i++) {
		if (m % i != 0) continue;
		if (m / i >= n) ans = max(ans, i);
		else break;
		if (m / (m/i) >= n) ans = max(ans, m/i);
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

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


void Main(){
    string S, T;
    cin >> S >> T;
    cout << T << S << el;
}



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

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

    int n;
    cin >> n;

    vector<int> r(n), c(n);
    rep(i, n) cin >> r[i] >> c[i];

    const int INF = 1001001001;
    vector<vector<int>> dp(n, vector<int>(n, INF));
    rep(i, n) dp[i][i] = 0;
    for(int w = 1; w < n; ++w) for(int i = 0; i < n-w; ++i){
        int j = i + w;
        for(int k = i; k < j; ++k){
            dp[i][i+w] = min(dp[i][i+w], dp[i][k] + dp[k+1][i+w] + r[i]*c[k]*c[j]);
        }
    }

    // rep(i, n){
    //     rep(j, n) cout << dp[i][j] << " ";
    //     cout << endl;
    // }

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

    return 0;
}


Measured memory_bytes: 3260
fn main() {
    let (n, s): (usize, usize) = readln();
    let mut left = VecDeque::new();
    let mut right = VecDeque::new();
    for i in 0..n {
        let (x, p): (usize, usize) = readln();
        if x < s {
            left.push_back((x, p));
        } else {
            right.push_front((x, p));
        }
    }

    let mut used: usize = 0;
    let mut result = Vec::new();
    let mut last = 'l';
    for _ in 0..n {
        if left.is_empty() {
            let (x, p) = right.pop_front().unwrap();
            result.push((x, p));
        } else if right.is_empty() {
            let (x, p) = left.pop_front().unwrap();
            result.push((x, p));
        } else {
            let &(lx, lp) = left.front().unwrap();
            let &(rx, rp) = right.front().unwrap();
            let right_power = if last == 'l' { rp + used } else { rp };
            let left_power = if last == 'r' { lp + used } else { lp };
            if right_power <= left_power {
                // choose right
                right.pop_front();
                result.push((rx, rp));
                used += rp;
                last = 'r';
            } else {
                left.pop_front();
                result.push((lx, lp));
                used += lp;
                last = 'l';
            }
        }
    }
    result.reverse();
    let mut cur = s;
    let mut answer: usize = 0;
    for (x, p) in result {
        answer += (cur as i64 - x as i64).abs() as usize;
        cur = x;
    }
    println!("{}", answer);
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n {
        vs.push(readln());
    }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(
    String,
    bool,
    f32,
    f64,
    isize,
    i8,
    i16,
    i32,
    i64,
    usize,
    u8,
    u16,
    u32,
    u64
);
impl<T> FromLn for Vec<T>
where
    T: FromLn,
{
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);

Measured memory_bytes: 10492