akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int h,w,k;
    string c[6];
    cin>>h>>w>>k;
    for(int i=0;i<h;i++)
        cin>>c[i];
    int ans=0;
    for(int Sh=0;Sh<(1<<h);Sh++){
        for(int Sw=0;Sw<(1<<w);Sw++){
            int cnt=0;
            for(int i=0;i<h;i++)
                for(int j=0;j<w;j++)
                    if((Sh&(1<<i))&&(Sw&(1<<j))&&(c[i][j]=='#'))
                        cnt++;
            if(cnt==k)
                ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3624
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	long x, y;
	scanf("%ld%ld", &x, &y);
	int ans=0;
	while(x<=y){
		ans++;
		x<<=1;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 128
my ($N, $K) = split " ", <>;

if ($K == 10) {
    print length $N;
    exit;
}
my $length;
my $quotient = $N;
while ($quotient) {
    $quotient = int($quotient / $K);
    my $remainder = $N % $K;
    $length++;
}
print $length;


Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var S = Console.ReadLine();
            var isOk = true;
            var number = 0;
            for (var i = 0; i < S.Length; i++)
            {
                if (i == AB[0])
                {
                    if (S[AB[0]] != '-') isOk = false;
                }
                else
                {
                    if (!int.TryParse(S[i].ToString(), out number)) isOk = false;
                }
            }
            Console.WriteLine(isOk ? "Yes":"No");
        }
    }
}


Measured memory_bytes: 13396
import itertools
H,W,K = map(int,input().split())
C = list()
HL = list(itertools.product(range(2), repeat=H))
WL = list(itertools.product(range(2), repeat=W))
for i in range(H):
    tmp = input()
    C.append(tmp)

ret = 0
for h in HL:
    for w in WL:
        count = 0
        for i in range(H):
            if h[i] == 1:
                for j in range(W):
                    if w[j] == 1 and C[i][j] == '#':
                        count += 1
        if count == K:
            ret += 1
print(ret)

Measured memory_bytes: 9168
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n, m;
    cin >> n >> m;
    vector<int> ans(n), cnt(n, 1);
    ans[0] = 1;

    rep(i, m) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        if (ans[x]) ans[y] = 1;
        cnt[x]--; cnt[y]++;
        if (!cnt[x]) ans[x] = 0;
    }

    cout << accumulate(all(ans), 0) << endl;
}


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

N=int(input())
mod=10**9+7
DP=dict()
DP[(0,0)]=1#a+b,a^b
DP[(1,0)]=1
DP[(1,1)]=2

def ans(S,X):
    #print(S,X)
    if DP.get((S,X))!=None:
        return DP[(S,X)]
    if S==0:
        return 1
    #if X>S:
    #    return ans(S,S)
    

    DP[(S,X)]=(ans(S//2,X//2)+ans((S-1)//2,(X-1)//2)+ans((S-2)//2,(X-2)//2))%mod
    #一番下の桁をみて、bitが0,0の場合,1,0の場合,1,1の場合.
    #三つ目の場合は本来ans((S-2)//2,X//2)だが,今回扱うのはS=Xのときで,X>Sのときは0になるので,ans((S-2)//2,(X-2)//2)で良いはず.
    return DP[(S,X)]

print(ans(N,N))


Measured memory_bytes: 3064
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
# N = list(map(int, input()))[::-1]
# N = int(input())
N, M, Q = map(int, input().split())
big = 0
s = 2**N
l = []

moto = list(range(1, Q+1))

for i in range(Q):
    l.append(list(map(int, input().split())))

A = []
for i in range(N):
    AA = []
    if A:
        for k in A:
            for j in range(1, M+1):
                if k[-1] <= j:
                    AA.append(k+[j])
        A = AA
    else:
        for j in range(1, M+1):
            A.append([j])

for i in A:
    wa = 0
    for j in l:
        if (i[j[1]-1]-i[j[0]-1]) == j[2]:
            wa += j[3]

    if big < wa:
        big = wa
print(big)


Measured memory_bytes: 30516
#include <bits/stdc++.h>
#define LL long long
#define FOR(i,c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define F first
#define S second
using namespace std;

const LL mod = 1e9 + 7;

template<typename T> T gcd(T a, T b) { return b == 0?a: gcd(b, a % b); }
template<typename T> T LCM(T a, T b) { return a*(b/gcd(a, b)); }
template<typename T> T expo(T base, T e, T mod) { T res = 1;
  while(e > 0) { if(e&1) res = res * base % mod; base = base * base % mod; e >>= 1; }
  return res;
}
template<typename T, typename S> T expo(T b, S e){if(e <= 1)return e == 0?1: b;\
	return (e&1) == 0?expo((b*b), e>>1): (b*expo((b*b), e>>1));}
template<typename T, typename S> T modinv(T a, S mod) { return expo(a, mod-2, mod); }
template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<class T> std::ostream& operator<<(std::ostream &os, const std::vector<T> &t) {
	os<<"["; FOR(it,t) { if(it != t.begin()) os<<", "; os<<*it; } os<<"]";
	return os;
}

const int MAXN = 2e5 + 100;
int n;
LL arr[MAXN];
LL pre[MAXN], suff[MAXN];

int main() {
  ios_base::sync_with_stdio(false);
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> arr[i];
		pre[i] = pre[i-1] + arr[i];
	}
	suff[n] = arr[n];
	for(int i = n - 1; i > 0; i--) {
		suff[i] = suff[i + 1] + arr[i];
	}
	LL res = 1e18;
	for(int i = 2; i <= n; i++) {
		res = min(res, abs(suff[i] - pre[i-1]));
	}
	cout << res << '\n';
  return 0;
}


Measured memory_bytes: 4992
#include<stdio.h>
#include<math.h>
typedef struct{
  double x;
  double y;
} P;
void kock(int,P,P);

int main()
{
  int n;
  P p1={0.0,0.0}, p2={100.0,0.0};

  scanf("%d",&n);
  
  printf("%.8f %.8f\n",p1.x,p1.y);
  kock(n,p1,p2);
  printf("%.8f %.8f\n",p2.x,p2.y);

  return 0;
}

void kock(int n, P p1, P p2) 
{
  P s,t,u;
  double r=M_PI/3.0;

  if(n==0) return;

  s.x = (2.0*p1.x+p2.x)/3.0;
  s.y = (2.0*p1.y+p2.y)/3.0;
  t.x = (p1.x+2.0*p2.x)/3.0;
  t.y = (p1.y+2.0*p2.y)/3.0;
  u.x = (t.x-s.x)*cos(r)-(t.y-s.y)*sin(r)+s.x;
  u.y = (t.x-s.x)*sin(r)+(t.y-s.y)*cos(r)+s.y;

  kock(n-1,p1,s);
  printf("%.8f %.8f\n",s.x,s.y);
  kock(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  kock(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  kock(n-1,t,p2);
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<cstdio>
#define ll long long int

using namespace std;

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

    int count;
    int i;
    int ans=0;

    for(i=n;i>=1;i--){
        count=0;
        int ci=i;
        while(ci>0){
            ci/=10;
            count++;
        }//printf("%d\n",count);
        if(count%2==1){
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
#define mod 1000000007
ll f[100010];
int main(){
  ll n,m; cin>>n>>m;
  f[0]=1;
  ll rui=1;
  for(int i=1;i<=n+1;i++){
      f[i]=rui;
      rui+=f[i];
      if(i-m>=0){
	  rui-=f[i-m];
      }
      rui%=mod;
  }
  ll ans=1;
  for(int i=0;i<n;i++)ans=ans*2%mod;
  ans-=f[n+1];
  ans%=mod;
  if(ans<0)ans+=mod;
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3880
#include <iostream>

using namespace std;

int main(){
    int N, tempN, fN;
    fN = 0;

    cin >> tempN;
    N = tempN;

    while(tempN > 0){
       fN += tempN % 10;
       tempN /= 10;
    }

    //cout << "N = " << N << ", fN = " << fN << endl;

    if(N % fN == 0)
        cout << "Yes";
    else
        cout << "No";
}



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

int main()
{
	int n;
	cin >> n;
	vector<int> p;
	p.resize(n);
	for (int i = 0; i < n; ++i) {
		cin >> p[i];
	}

	vector<int> sortP;
	sortP = p;
	
	sort(sortP.begin(), sortP.end());

	int count = 0;
	for (int i = 0; i < n; ++i) {
		if (sortP[i] != p[i]) {
			++count;
		}
	}

	if (count <= 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int k = sc.nextInt();
		List<String> a = new ArrayList<>();
		for (int i = 1 ; i <= k ; i++) {
			for (int j = 0 ; j <= s.length() - i ; j++) {
				if (!a.contains(s.substring(j, j+i))) {
					a.add(s.substring(j,j+i));
				}
			}
		}
		Collections.sort(a);
		System.out.println(a.get(k-1));
	}
}

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


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

    int i=0;
    bool flag = false;
    long long int x = 7;
    for (i=1; i <= k; i++) {
        x %= k;
        if (x == 0) {
            flag = true;
            break;
        }
        x = x*10+7;    
    }

    if (flag) cout << i << endl;
    else cout << -1 << endl;
    return 0;
}

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

#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <ull> vu;
typedef vector <vector <int>> vvi;
typedef pair <int, int> pi;
typedef vector <pair <int, int>> vpi;

int n;
map <string, int> mp;

void read() {
  cin >> n;
}

void solve() {
  for(int i = 0; i < n; ++i) {
    char s[11];
    cin >> s;
    sort(s, s + strlen(s));
    ++mp[s];
  }
  ll sol = 0;
  for(auto x : mp)
    if (x.se > 1)
      sol += 1ll * x.se * (x.se - 1) / 2;
  cout << sol << "\n";
}

int main() {
  ios :: sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  //cin >> t;           // PLEASE REMOVE IT IF NEEDED
  while(t) {
    --t;
    read();
    solve();
  }
  return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
//#define MOD (998244353)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");


signed main(){
    FASTER;
    int n;cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++){
        if(i%15==0){
            
        }else if(i%3==0){
        
        }else if(i%5==0){
        
        }else{
            ans+=i;
        }
    }
    cout<<ans;
}






Measured memory_bytes: 3648
import java.util.Scanner;
public class Main {
	public static void  main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int a = s.nextInt();
		int b = s.nextInt();
		System.out.println(n *a < b ? n*a : b);
		s.close();


	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int h, w;
    cin >> h >> w;

    map<int, int> mp;
    for(int i=0; i<26; i++){
        mp[i] = 0;
    }
    for(int i=0; i<h*w; i++){
        char a;
        cin >> a;
        mp[a-'a']++;
    }

    int one = (h%2) * (w%2);
    int two = h * (w%2) + w * (h%2) - 2*one;
    int four = h*w - two - one;

    for(int i=0; i<26; i++){
        four -= mp[i] / 4 * 4;
        if(mp[i] % 4 != 0){
            if(mp[i] % 2 == 0) two -= 2;
            else if(mp[i] % 4 == 1) one--;
            else{
                two -= 2;
                one--;
            }
        }
    }
    if(four == 0 && two == 0 && one == 0) cout << "Yes" << endl;
    else if(two > 0 && four + two == 0 && one == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int main(){
    int N;cin>>N;
    int info[N];
    rep(i,N)cin>>info[i];
    sort(info,info+N);
    int sum=0;
    rep(i,N-1)sum+=info[i];
    if(sum>info[N-1])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int main (void){  
    int a, b, c , d, e;
    cin >> a >> b >> c >> d >> e;
    if (a == 0) {
        cout << 1 << endl;
    } else if(b == 0) {
        cout << 2 << endl;
    } else if(c == 0) {
        cout << 3 << endl;
    } else if(d == 0) {
        cout << 4 << endl;
    } else{
        cout << 5 << endl;
    }
    return 0;
}

Measured memory_bytes: 3528
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_i64_asc(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_c_asc(const void* a, const void* b) {
    return *((char*)a) < *((char*)b) ? -1 : 1;
}

int compare_c_desc(const void* a, const void* b) {
    return *((char*)a) > * ((char*)b) ? -1 : 1;
}

int compare_f(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_f2(const void* a, const void* b) {
    return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static char S[100001];

int main(void) {
    size_t N, A, B;

    scanf("%zu %zu %zu\n%s", &N, &A, &B, S);

    size_t aCount = 0;
    size_t bCount = 0;
    for (size_t i = 0; i < N; i++) {
        if (S[i] == 'a') {
            if (aCount + bCount < A + B) {
                puts("Yes");

                aCount++;
            }
            else {
                puts("No");
            }
        }
        else if (S[i] == 'b') {
            if (aCount + bCount < A + B && bCount < B) {
                puts("Yes");

                bCount++;
            }
            else {
                puts("No");
            }
        }
        else {
            puts("No");
        }
    }

    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  while(true){
    int n,x;
    cin>>n>>x;
    if(n==0&&x==0)break;
    int ans=0;
    for(int i=1;i<=n;i++){
      for(int j=i;j<=n;j++){
        for(int k=j;k<=n;k++){
          if(i==j||j==k||k==i)continue;
          if(i+j+k==x)ans++;
        }
      }
    }
    cout<<ans<<endl;
  }
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long int li;
typedef long long ll;
typedef long double ld;

void solve()
{
	int l, r, d, k = 0;
	cin >> l >> r >> d;
	for (int i = l; i <= r; i++)
		if (i % d == 0)
			k++;
	cout << k << "\n";
}

int main()
{
	int n = 1;
	// cin >> n;
	while (n-- > 0)
		solve();
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
ll trakm[200010], a[200010];
map<ll, ll> mp;
int main(){
    ll k, n;
    while(cin>>n>>k){
        ll ans=0, sm=0, cnt=0, tmp;
        trakm[0]=0;
        ++mp[0];
        for(int i=1; i<=n; ++i){
            scanf("%lld",a+i);
            sm+=a[i];
            ++cnt;
            trakm[i]=sm-cnt;
            tmp=trakm[i]%k;
//            tmp=k-tmp;
//            tmp%=k;
            if(i-k>=0){
                --mp[trakm[i-k]%k];
            }
            ans+=mp[tmp];
            ++mp[trakm[i]%k];
        }
        cout<<ans<<endl;
    }
  return 0;
}




Measured memory_bytes: 15904
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vi a,b;

int main(){
	cin>>n;
	a=b=vi(n);
	for(int i=0;i<n;i++) cin>>a[i]>>b[i];
	int res=n;
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(i!=j){
		int p=a[j]-a[i],q=b[j]-b[i],tmp=0;
		for(int k=0;k<n;k++){
			int x=a[k]-p,y=b[k]-q,B=1;
			for(int l=0;l<n;l++) if(a[l]==x&&b[l]==y) B=0;
			tmp+=B;
		}
		res=min(res,tmp);
	}
	cout<<res<<endl;
}

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

int main(void){
    ll A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    if (V-W == 0)
        cout << "NO";
    else if (W < V && (double)abs(B-A)/abs(V-W) <= T)
        cout << "YES";
    else
        cout << "NO";
}


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

int main(){
  long long n, d[500],ans = 0,top;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> d[i];
  }
  sort(d,d+n,greater<int>());
  top = d[0];
  ans++;
  for(int i = 1;i < n;++i){
    if(top > d[i]){
      ans++;
      top = d[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

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

		int N = Integer.parseInt(scan.next());
		int M = Integer.parseInt(scan.next());

        Queue<Integer> q = new PriorityQueue<Integer>(Collections.reverseOrder());
        
        for (int i = 0; i < N; ++i) {
            q.add(Integer.parseInt(scan.next()));
        }

        for (int j = 0; j < M; ++j) {
            q.add(q.poll() / 2);
        }

        long result = 0;
        
        for (int x : q) {
            result += x;
        }

        System.out.println(result);
		
		scan.close();
	}

}


Measured memory_bytes: 48208
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int n;
  scanf("%d", &n);
  vector<int> cnt(n + 1), a(n);
  int ret = 1;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    if (a[i] > 0) {
      // trace(cnt[a[i] - 1], cnt[a[i]]);
      ret = (int64)ret * (cnt[a[i] - 1] - cnt[a[i]]) % MOD;
    } else {
      // trace(cnt[0]);
      ret = (int64)ret * (3 - cnt[0]) % MOD;
    }
    cnt[a[i]]++;
  }

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


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    vector<int> arr(n);
    for( auto& x: arr)
    {
        cin>>x;
    }
    vector<bool> dp(k+1);
    for(int stones=0;stones<=k;stones++)
    {
        for(auto x: arr)
        {
            if(stones>=x && !dp[stones-x])
                dp[stones]=true;
        }
    }
    if(dp[k])
        cout<<"First"<<endl;
    else
        cout<<"Second"<<endl;
}

Measured memory_bytes: 3640
def main(input):
  a, b = [int(i) for i in input.split()]
  print(a if a <= b else a-1)

# tests = [
#   '5 5',  # 5
#   '2 1',  # 1
#   '11 30',  # 11
# ]

# for test in tests:
#   main(test)

main(input())


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

int main(){
    int N;
    cin >> N;
    int M = N*(N-1)/2 - N/2;
    cout << M << "\n";
    if(N % 2 == 1){
        for (int i = 1; i < N; ++i) {
            cout << i << " " << N << "\n";
        }
        N--;
    }
    for (int i = 1; i < N; ++i) {
        for (int j = i+1; j <= N; ++j) {
            if(i+j != N+1){
                cout << i << " " << j << "\n";
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int main(){
	int N,K;
	cin>>N;
	cin>>K;
	long long ans=K;
	REP(i,N-1){
	    ans*=K-1;
	}
        cout<<ans<<endl;
	return(0);
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int X ;
    cin >> X;
    if (X <= 9 && X >= 1 && X%2 == 1 && X !=9 && X != 1) {
        cout << "YES";
    }
    else{
        cout << "NO";
    }
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	ll N;
	cin >> N;

	for(ll h = 1; h <= 3500; h++){
		for(ll n = 1; n <= 3500; n++){
			ll num = N * h * n;
			ll den = 4 * h * n - N * n - N * h;
			if(den > 0 && num % den == 0){
				cout << h << " " << n << " " << num / den;
				return 0;
			}
		}
	}

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int a,b,item,c=0;
   cin>>a>>b;
   for(int i=1;i<=a;i++)
   {
       cin>>item;
   }
   for(int i=1;i<a;i=i+b-1)
   {
       c++;
   }
   cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
# AtCoder Hitachi B
A, B, M = map(int, input().split())
Ma = [int(_) for _ in input().split()]
Mb = [int(_) for _ in input().split()]
Mm = [[int(_) for _ in input().split()] for __ in range(M)]
# unuse vaucher
r0 = min(Ma) + min(Mb)
# use vaucher
r1 = min([Ma[x-1]+Mb[y-1]-c for x,y,c in Mm])
print(min(r0,r1))

Measured memory_bytes: 36464
#include<bits/stdc++.h>
#define itn int
#define REP(i,n) for(int i=0;i<n;i++)
#define IREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=k;i<n;i++)
#define REPEACH(itr,k) for(auto itr : k)
#define MOD 1000000007

using namespace std;
typedef long long ll;

const ll INF = 1LL<<60;
typedef pair<double,int> P;


int main(){
  int n,m;
  cin >> n >> m;
  int broken;
  int now=0;
  vector<ll> v(n+1);
  v[0]=1;
  v[1]=1;
  v[2]=2;
  for(int i=3;i<n+1;i++){
    v[i]=(v[i-1]%MOD)+(v[i-2]%MOD);
  }
  ll ans=1;
  REP(i,m){
    cin >> broken;
    if(now==broken){
      cout << 0 << endl;
      return 0;
    }
    ans*=v[broken-1-now];
    ans%=MOD;
    now=broken+1;
  }
  ans*=v[n-now];
  cout << ans%MOD << endl;
}


Measured memory_bytes: 1024
N=int(input())
for h in range(1,3501):
  for n in range(1,3501):
    if (4*h*n-N*n-N*h)>0:
      w=(N*h*n)/(4*h*n-N*n-N*h)
      if w==int(w) and w>0:
        print(h,n,int(w))
        exit()

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
int main() 
{
    int n;
    cin >> n;
    string blue[n];
    for (int i = 0; i < n; i++) 
        cin >> blue[i];
	int m;
    cin >> m;
    string red[m];
    for (int i = 0; i < m; i++)
        cin >> red[i];
    int ans = 0;
    for (int i=0; i<n; i++)
	{
		string word=blue[i];
		int count=0;
		for (int j=0; j<n; j++)
			if (blue[j]==word) count++;
		for (int j=0; j<m; j++)
			if (red[j]==word) count--;
		ans = max(ans, count);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
  int A, B, ans;
  scanf("%d %d", &A, &B);
  ans = A + B;
  if (ans % 2 == 0) {
    printf("%d", ans / 2);
  }
  else {
    printf("IMPOSSIBLE");
  }
  return 0;
}

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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()

const long long mod = 998244353;

struct Combination
{
  int mod;
  vector< int64_t > mfact, rfact;

  Combination(int sz, int mod) : mfact(sz + 1), rfact(sz + 1), mod(mod)
  {
    mfact[0] = 1;
    for(int i = 1; i < mfact.size(); i++) {
      mfact[i] = mfact[i - 1] * i % mod;
    }
    rfact[sz] = inv(mfact[sz]);
    for(int i = sz - 1; i >= 0; i--) {
      rfact[i] = rfact[i + 1] * (i + 1) % mod;
    }
  }

  int64_t fact(int k) const
  {
    return (mfact[k]);
  }

  int64_t pow(int64_t x, int64_t n) const
  {
    int64_t ret = 1;
    while(n > 0) {
      if(n & 1) (ret *= x) %= mod;
      (x *= x) %= mod;
      n >>= 1;
    }
    return (ret);
  }

  int64_t inv(int64_t x) const
  {
    return (pow(x, mod - 2));
  }
  
  int64_t P(int n, int r) const
  {
    if(r < 0 || n < r) return (0);
    return (mfact[n] * rfact[n - r] % mod);
  }

  int64_t C(int p, int q) const
  {
    if(q < 0 || p < q) return (0);
    return (mfact[p] * rfact[q] % mod * rfact[p - q] % mod);
  }

  int64_t H(int n, int r) const
  {
    if(n < 0 || r < 0) return (0);
    return (r == 0 ? 1 : C(n + r - 1, r));
  }
};

using int64 = long long;

int64 mod_pow(int64 x, int64 n, int64 mod)
{
  int64 ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}


void solve(long long N, long long M, long long K){
    // r 組そんざい (n - 1)Cr * M * (M - 1) ^ (n - r) 
    i64 ans = 0;
    Combination comb(N, mod);
    rep(i, K + 1){
        ans = (ans + (comb.C(N - 1, i) * mod_pow(M - 1,N - (i + 1), mod) % mod) * M % mod) % mod;
    }
    cout << ans << endl;
}

struct IoSetup {
    IoSetup() {
        // cin.tie(nullptr);
        // ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long K;
    scanf("%lld",&K);
    solve(N, M, K);
    return 0;
}


Measured memory_bytes: 6432
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
   int n;cin>>n;
   map<int, int> count[2];
   for(int i=0;i<n;i++){
     int a;cin>>a;count[i&1][a]++;
   }
   vector<P> vec[2];
   for(int i=0;i<2;i++){
     for(auto itr=count[i].begin();itr!=count[i].end();itr++){
       vec[i].push_back(P(itr->second, itr->first));
     }
     sort(vec[i].begin(), vec[i].end(), greater<P>());
     // for(P x: vec[i])cout<<x.second<<" "<<x.first<<endl;
   }
   if(vec[0][0].second!=vec[1][0].second){
     cout<<n-(vec[0][0].first+vec[1][0].first)<<endl;
   }else if(max(vec[0].size(), vec[1].size())==1){
     cout<<n/2<<endl;
   }else{
     int t=-1;
     if(vec[0].size()>1)t=max(t, vec[0][1].first+vec[1][0].first);
     if(vec[1].size()>1)t=max(t, vec[0][0].first+vec[1][1].first);
     cout<<n-t<<endl;;
   }

}


Measured memory_bytes: 6136
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return (kai(n - 1)*n) % INF;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}

signed main() {
	int n, m;
	cin >> n >> m;
	if (abs(n - m) > 1)cout << 0 << endl;
	else if ((n + m) % 2) {
		cout << (kai(n)*kai(m)) % INF << endl;
	}
	else {
		cout << (kai(n)*kai(m) * 2) % INF << endl;
	}
	endre;
}


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

typedef long long ll;

const int MOD = (int)(1e+9) + 7;
int N, K;
vector<int> A;
vector<ll> fac, finv, inv;

void input_init(void) {
	cin >> N >> K;
	A.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> A[i];
	fac.resize(N + 1);
	finv.resize(N + 1);
	inv.resize(N + 1);
}

void comb_init(void) {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i <= N; ++i){
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

long long comb(int n, int k){
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll solve(void) {
	ll sum = 0;
	if (K <= 1)
		return sum;
	sort(A.begin(), A.end());
	comb_init();
	for (int i = N - 1; i >= K - 1; --i) {
		sum += (comb(i, K - 1) * A[i]) % MOD;
		sum %= MOD;
	}
	for (int i = 0; i <= N - K; ++i) {
		sum -= (comb(N - i - 1, K - 1) * A[i]) % MOD;
		sum = (sum + MOD) % MOD;
	}
	return sum;
}

int main(void) {
	input_init();
	ll ans = solve();
	cout << ans << '\n';
	return 0;
}


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

using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;

int main(){
    bool ans_is_no = false;
    int N, M;
    cin >> N >> M;
    Graph G(N+1);

    for (int i = 0; i < M; i++)
    {
        int A, B;
        cin >> A >> B;
        G[A].push_back(B);
        G[B].push_back(A);
    }
    
    // for (int i = 0; i < N+1; i++)
    // {
    //     for (int v : G[i]) cout << "i " << i << ", G " << v << endl;
    // }

    vector<int> ans(N+1);
    vector<int> dist(N+1, -1);
    queue<int> que;

    dist[1] = 0;
    que.push(1);

    while (!que.empty())
    {
        int v = que.front();
        que.pop();

        for (int nv : G[v])
        {
            if (dist[nv] != -1) continue;
            
            que.push(nv);
            dist[nv] = dist[v] + 1;
            ans[nv] = v;
        }
    }
    
    // for (int v = 0; v < N+1; ++v) cout << v << ": " << dist[v] << endl;

    for (int i = 1; i < N+1; i++)
    {
        if (dist[i] == -1) ans_is_no = true;
    }
    
    if (ans_is_no) cout << "No" << endl;
    else
    {
        cout << "Yes" << endl;
        for (int i = 2; i < N+1; i++) cout << ans[i] << endl;
    }
    
}

Measured memory_bytes: 10532
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main //implements Runnable
{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int a[]=sc.nextIntArray(n);
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < a.length; i++) {
			map.put(a[i], i+1);
		}

        TreeMap<Integer, Integer> tm = new TreeMap<>();
        tm.put(0, 0);
        tm.put(n+1, 0);
        tm.put(map.get(n), 0);
        long s=0;
        for (int i = n-1; 0 < i; i--) {
			int l=i,r=i,x=map.get(i),ll,rr;
			tm.put(x, 0);
			l=ll=tm.lowerKey(x);
			r=rr=tm.higherKey(x);
			if(0<l) {
				ll=tm.lowerKey(ll);
				s+=(long)i*(l-ll)*(r-x);
//				db(i,x,ll,l,r,rr);
//				db(s);
			}
			if(r<n+1) {
				rr=tm.higherKey(rr);
				s+=(long)i*(rr-r)*(x-l);
//				db(i,x,ll,l,r,rr);
//				db(s);
			}
		}
        
        out.println(s);
     	out.flush();
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

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

//class P {
//	int x, y;
//	P(int  x, int y) {
//	  this.x=x;
//	  this.y=y;
//	}
//}

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    }
//
//    public int compareTo(P p){
//    	if(a==p.a) return b-p.b;
//        return -p.a+a;
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 58916
import java.util.Scanner;

public class Main {

	static long bignum = 1000000000+7;

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		long[] a = new long[n+1];

		for(int i=1;i<n+1;i++) {
			a[i] = sc.nextLong();
		}

		int[] upper = new int[300000];
		int[] lower = new int[300000];

		for(int i =0;i<300000;i++) {
			upper[i]= 0;
			lower[i]= 0;
		}
		for(int i = 1;i<=n;i++) {
			int plus = (int) (a[i]+i);
			int minus = (int) (i-a[i]);
			if(0<plus&&plus<300000)upper[plus]++;
			if(0<minus&&minus<300000)lower[minus]++;
		}
		long counter =0;
		for(int i=1;i<300000;i++) {
			counter = counter + (long)upper[i]*lower[i];
		}

		System.out.println(counter);
	}

	static long divn(int target, int times) {//10_9+7のあまり累乗版
		int sqtimes = (int)Math.sqrt(times);
		long ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans * target)%(1000000000+7);
		}
		long holder = ans;
		ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans*holder)%(1000000000+7);
		}
		for(int i=0;i<times - sqtimes*sqtimes;i++) {
			ans = (ans * target)%(1000000000+7);
		}
		return ans;
	}

	static long div(long a) {//10_9+7のあまり
		if(a<0)a+=1000000000+7;
		return a%(1000000000+7);
	}

}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/


Measured memory_bytes: 61016
#include<iostream>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,a=0,b=0,da,db;
  while(1){
  cin>>n;
  if(n==0) break;
  for(int i=0;i<n;i++){
    cin>>da>>db;
    if(da>db) a+=da+db;
    if(da<db) b+=db+da;
    if(da==db){
      a+=da;
      b+=db;
    }
  }
  cout<<a<<" "<<b<<endl;
  a=0;
  b=0;
  }
  return 0;
}

Measured memory_bytes: 3104
n, q = map(int, input().split())
s = input()
lr = []
for i in range(q):
    lr.append(list(map(int, input().split())))

at =[0]
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        at.append(at[-1] + 1)
    else:
        at.append(at[-1])
for i in range(q):
    print(at[lr[i][1]-1] - at[lr[i][0]-1])

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

using namespace std;

typedef long long ll;

const int N = 2e5 + 5;
int arr[N];
int n;
ll calc(int b)
{
  ll ret = 0;
  for(int i = 1; i <= n; i++)
    ret += abs((ll)arr[i] - b);
  return ret;
}

int main()
{
 ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
 cin >> n;
 for(int i = 1; i <= n; i++)
 {
   cin >> arr[i];
   arr[i] -= i;
 }
 ll left = -2e9, right = 2e9;
 while (right - left >= 3)
 {
   ll l = left + ((right - left) / 3), r = left + ((2 * (right - left)) / 3);
   if(calc(l) < calc(r))
    right = r;
   else
    left = l;
 }
 std::vector<ll> val;
 for(int i = left; i <= right; i++)
  val.push_back(calc(i));
 sort(val.begin(), val.end());
 cout << val[0];
 return 0;
}


Measured memory_bytes: 1024
n=int(input())
ans=[[] for i in range(n)]
a=list(map(int,input().split()))
for i in range(n):
    ans[i].append(a[i])
    ans[i].append(i+1)
ans=sorted(ans)
x=[]
for i in range(n):
    x.append(str(ans[i][1]))

print(" ".join(x))


Measured memory_bytes: 100036
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String[] coins = br.readLine().split(" ");
            int pocketMoney = Integer.parseInt(coins[0]) + Integer.parseInt(coins[1]);
            int toyPrice = Integer.parseInt(coins[2]);
            
            String heCanBuyToy = "No";
            if (pocketMoney >= toyPrice) {
                heCanBuyToy = "Yes";
            }

            System.out.println(heCanBuyToy);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

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

int main(){

	vector<int> S(3);
	for(int i = 0; i < 3; i++)
	{
		char c;
		cin >> c;
		S[i] = c - 'a';

	}
	sort(S.begin(), S.end());
	if(S[0] == 0 && S[1] == 1 && S[2] == 2) cout << "Yes" << endl;
	else cout << "No" << endl;	

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const int MAXN=1e5+10;
    const ll MOD=1e9+7;
    int N,M,S,T;
    ll d1[MAXN],d2[MAXN];
    ll dp1[MAXN],dp2[MAXN];
    int vis[MAXN];
    vector<pair<int,ll>>G[MAXN];
    struct Node
    {
        int k;
        ll v;
        Node(int _k,ll _v){
            k=_k;
            v=_v;
        }
        bool operator<(const Node &n)const{
            return v>n.v;
        }
    };
    void dijstra(int start,int end,ll d[],ll dp[]){
        memset(d,0x3f,MAXN*8);
        priority_queue<Node>pq;
        d[start]=0;
        dp[start]=1;
        pq.push(Node(start,0));
        while(!pq.empty()){
            auto p=pq.top();
            pq.pop();
            if(vis[p.k])continue;
            vis[p.k]=true;
            for(auto e:G[p.k]){
                if(d[p.k]+e.second<d[e.first]){
                    d[e.first]=d[p.k]+e.second;
                    dp[e.first]=dp[p.k];
                    pq.push(Node(e.first,d[e.first]));
                }
                else if(d[p.k]+e.second==d[e.first]){
                    dp[e.first]=(dp[e.first]+dp[p.k])%MOD;
                }
            }
        }
    }

    void solve(){
        ios::sync_with_stdio(false);
        cin.tie(0);
        cin>>N>>M>>S>>T;
        for(int k=0;k<M;k++){
            int u,v;
            ll d;
            cin>>u>>v>>d;
            G[u].push_back({v,d});
            G[v].push_back({u,d});
        }
        dijstra(S,T,d1,dp1);
        memset(vis,0,sizeof(vis));
        dijstra(T,S,d2,dp2);
        ll ans=(dp1[T]*dp1[T])%MOD;
        ll pL=d1[T];
        for(int v=1;v<=N;v++){
            if(d1[v]*2==pL&&d2[v]*2==pL){
                ans=(ans-dp1[v]*dp2[v]%MOD*dp1[v]%MOD*dp2[v]%MOD+MOD)%MOD;
            }
        }
        for(int u=1;u<=N;u++){
            for(auto e:G[u]){
                int v=e.first;
                ll d=e.second;
                if(d1[u]*2<pL&&d2[v]*2<pL
                &&d1[u]+d2[v]+d==pL){
                    ans=(ans-dp1[u]*dp2[v]%MOD*dp1[u]%MOD*dp2[v]%MOD+MOD)%MOD;
                }
            }
        }
        cout<<ans;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}


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


struct unionFind {
    vector<int> parent;
    unionFind(int n): parent(n) {
        for (int i = 0; i < n; i++) parent[i] = i;
    };

    int root(int x) {
        if (parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x != y) parent[y] = x;
    }

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

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

    string s;
    cin >> s;

    if (s == "AAA" or s == "BBB") {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }





    return 0;
}



Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip() 
s=input()
count=0
s1=str()
s2=str()
for _ in range(int(input())):
  l=list(map(str,input().split()))
  
  if l[0]=='1':
    count+=1
  elif count%2==0:
    if l[1]=='1':
      s1=l[2]+s1
    else:
      s2=s2+l[2]
  else:
    if l[1]=='2':
      s1=l[2]+s1
    else:
      s2=s2+l[2]
s=s1+s+s2
if count%2!=0:
  s=s[::-1]
print(s)

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

using ll=long long;
const ll z=0;

int main() {
  int L,N;
  cin >> N >> L;
  vector<string> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec[i];
  }
  sort(vec.begin(),vec.end());
  string str=vec[0];
  for(int i=1;i<N;i++){
    str +=vec[i];
  }
  cout << str << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 1e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
// #define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
 
 
ll mod = 998244353;
// ll mod = 1000000007;
  
ll mypow(ll number1,ll number2, ll mod){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = rui(fact[fact_table],mod - 2);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
bool multicase = false;

ll n,m,num,sum,a,b,c,d,e,h,q,p;
ll w, ans;
ll k;
ll dp[2005][6005];

void solve(){
    long double l;
    cin >> l;
    ps((l/3)*(l/3)*(l/3));
    return;
}

int main(){
    // init();
    // ios::sync_with_stdio(false);
    // cin.tie(nullptr);
    ll q;
    if(multicase){
        cin >> q;
    }else{
        q = 1;
    }
    while(q--){
        solve();
    }
    return 0;

}


















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

main() {
 int N;
 cin >> N;
 vector<int> vec(N);  
  for (int i=0; i<N-1; i++){
   int x;
   cin >> x;
    vec.at(x-1) += 1;
  }
  
  for (int i=0; i<N; i++)
    cout << vec.at(i) << endl;
}


Measured memory_bytes: 4056