akhauriyash/Code-Regression huggingface dataset:
/* winners never quit and quitters never win.
      #swap                                 */
      
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;
const ld PI = 3.141592653589793;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

template <typename T>
void make_unique(vector<T>& vec) {
  sort(all(vec));
  vec.erase(unique(all(vec)), vec.end());
}

#define endl '\n'
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


ll nxt() {
    ll TemporaryVariable;
    cin >> TemporaryVariable;
    return TemporaryVariable;
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    /*rlimit rlim;
    if (getrlimit(RLIMIT_STACK, &rlim)) return 1;
    rlim.rlim_cur = rlim.rlim_max;
    if (setrlimit(RLIMIT_STACK, &rlim)) return 2;*/
    ll n=nxt(),d=nxt();
    ll ans=0;
    rep(a,0,n)
    {
        ll p=nxt(),q=nxt();
        if(p*p+q*q<=d*d)
            ans++;
    }
    cout<<ans<<endl;
	printclock;
	return 0;
}

Measured memory_bytes: 3812
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

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

	vector<bool> infection(n,0);
	infection[0] = true;
	vector<int> ball(n,1);

	rep(i,m){
		int a, b;
		cin >> a >> b;
		a--; b--;

		ball[a]--;
		ball[b]++;
		infection[b] = infection[b] or infection[a];

		if(ball[a] == 0) infection[a] = false;
	}

	int sum = 0;
	for_each(all(infection), [&](const bool f){ if(f) sum++; });
	cout << sum << endl;
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  out(n * n * n);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;
long long gcd(long long a,long long b){
   if(b==0)return a;
   return gcd(b,a%b);
}
long long lcm(long long a,long long b){
   return a*b/gcd(a,b);
}

int main(){
   long long n;
   cin>>n;
   vector<long long> a(n),b(n);
   vector<pair<long long,long long>> p(n);
   for(int i=0;i<n;i++){
       cin>>a[i]>>b[i];
       p[i]=make_pair(b[i],a[i]);
   }
   sort(p.begin(),p.end());
   long long pos=0;
   for(int i=0;i<n;i++){
       pos+=p[i].second;
       if(pos>p[i].first){
           cout<<"No"<<endl;
           return 0;
       }
   }
   cout<<"Yes"<<endl;
}

   


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

using namespace std;

const int INF = 1e8;


void debug(vector<int> c, vector<int> x){
	for(int i=0;i<c.size();i++) cout<< " "<< c[i]; cout<< endl;
	for(int i=0;i<x.size();i++) cout<< " "<< x[i]; cout<< endl;
}

void debug(vector<vector<int>>& dp){
	cerr<< " -- debug -- "<< endl;
	for(int i=0;i<dp.size();i++){
		for(int j=0;j<dp[i].size();j++){
			if(dp[i][j] != INF) cerr<< "("<< i<< ","<< j<< ")"<< dp[i][j]<< " ";
		}
		cerr<< endl;
	}
}

int norm(int a, int b){
	return (a - b) * (a - b);
}

bool solve(){
	int n, m;
	cin>> n>> m;
	if(!n && !m) return false;

	vector<int> c(m), x(n+1);
	for(int i=0;i<m;i++) cin>> c[i];
	x[0] = 128;
	for(int i=0;i<n;i++) cin>> x[i+1];
	//debug(c, x);

	vector<vector<int>> dp(n+1, vector<int>(256, INF));
	dp[0][128] = 0;
	for(int i=0;i<dp.size()-1;i++){
		for(int j=0;j<dp[i].size();j++){
			if(dp[i][j] == INF) continue;
			for(int k=0;k<c.size();k++){
				int jj = j + c[k];
				jj = min(jj, 255); jj = max(jj, 0);
				dp[i+1][jj] = min(dp[i+1][jj], dp[i][j] + norm(x[i+1], jj));
			}
		}
	}
	//debug(dp);

	int ans = INF;
	for(int i=0;i<dp[n].size();i++) ans = min(ans, dp[n][i]);
	cout<< ans<< endl;
	return true;
}

int main(){
	cout.setf(ios::fixed); cout.precision(10);
	while(solve());
	return 0;
}

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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define MOD1 998244353
#define MOD2 469762049
#define A_MAX 100000

ll pow(ll n, ll k, ll mod)
{
  ll num=n;
  ll ans=1;
  while(k!=0)
  {
    if(k%2==1)ans=(ans*num)%mod;
    k/=2;
    num=(num*num)%mod;
  }
  return ans;
}

ll mod_inv(ll n, ll mod)
{
  return pow(n, mod-2, mod);
}

vector<ll> ntt(vector<ll> f, ll n, ll mod)
{
  if(n==1)return f;
  else
  {
    vector<ll> f0(n/2);
    vector<ll> f1(n/2);
    int i;
    rep(i,n/2)
    {
      f0[i]=f[2*i];
      f1[i]=f[2*i+1];
    }
    f0 = ntt(f0, n/2, mod);
    f1 = ntt(f1, n/2, mod);
    ll zeta = pow((ll)3, (mod-1)/n, mod);//prepare num;
    ll pow_zeta = 1;
    rep(i,n)
    {
      f[i] = (f0[i%(n/2)] + pow_zeta * f1[i%(n/2)])%mod;
      pow_zeta = (pow_zeta*zeta)%mod;
    }
    return f;
  }
}

vector<ll> inv_ntt(vector<ll> f, ll n, ll mod, ll nf)
{
  if(n==1)return f;
  else
  {
    vector<ll> f0(n/2);
    vector<ll> f1(n/2);
    int i;
    rep(i,n/2)
    {
      f0[i]=f[2*i];
      f1[i]=f[2*i+1];
    }
    f0 = inv_ntt(f0, n/2, mod, nf);
    f1 = inv_ntt(f1, n/2, mod, nf);
    ll zeta = mod_inv(pow((ll)3, (mod-1)/n, mod), mod);
    ll pow_zeta = 1;
    rep(i,n)
    {
      f[i] = (f0[i%(n/2)] + pow_zeta * f1[i%(n/2)])%mod;
      pow_zeta = (pow_zeta*zeta)%mod;
    }
    if(n==nf)
    {
      rep(i,n)f[i]=(f[i]*mod_inv(n,mod))%mod;
    }
    return f;
  }
}

int main()
{
  ll n,m;cin>>n>>m;
  vector<int> a(n);
  int i;
  rep(i,n)cin>>a[i];
  vector<ll> num(A_MAX+1,0);
  rep(i,n)num[a[i]]++;
  ll n2 = 1;
  while(n2<=2*A_MAX)n2*=2;
  vector<ll> gt(n2,0);
  rep(i,A_MAX+1)gt[i]=num[i];
  gt = ntt(gt, n2, MOD1);
  vector<ll> ggt(n2);
  rep(i,n2)ggt[i]=(gt[i]*gt[i])%MOD1;

  vector<ll> ht(n2,0);
  rep(i,A_MAX+1)ht[i]=num[i];
  ht = ntt(ht, n2, MOD2);
  vector<ll> hht(n2);
  rep(i,n2)hht[i]=(ht[i]*ht[i])%MOD2;

  vector<ll> ans1(n2,0);
  ans1 = inv_ntt(ggt,n2,MOD1,n2);
  vector<ll> ans2(n2,0);
  ans2 = inv_ntt(hht,n2,MOD2,n2);
  
  vector<ll> pats(A_MAX*2+1);
  rep(i,A_MAX*2+1)
  {
    pats[i]=ans1[i];
    while(pats[i]%MOD2!=ans2[i])
    {
      pats[i]+=MOD1;
    }
  }
  ll count=0;
  ll total=0;
  ll now=A_MAX*2;
  while(count<m)
  {
    ll take=min(m-count,pats[now]);
    count+=take;
    total+=now*take;
    now--;
  }
  cout<<total<<endl;
}


Measured memory_bytes: 23888
def two_abbreviations(arr,s,t)
  len = arr[0].lcm(arr[1])
  arr[0].gcd(arr[1]).times do |i|
    return -1 if t[i * len / arr[0]] != s[i * len / arr[1]]
  end
  return len
end

if __FILE__ == $0
  arr = gets.chomp!.split(' ').map(&:to_i)
  s = gets.chomp!
  t = gets.chomp!
  print two_abbreviations(arr,s,t)
end

Measured memory_bytes: 1916
#include<stdio.h>
int main()
{
	int x1, x2, x3, x4, y1, y2, y3, y4;
	while(~scanf("%d %d %d %d", &x1, &y1, &x2, &y2))
		printf("%d %d %d %d\n", y1-y2+x2, x2-x1+y2, y1-y2+x1, x2-x1+y1);
	return 0;
}

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

using namespace std;
using ll = long long;
const int INF = 1e9;

int main()
{
    int n, m; cin >> n >> m;
    vector<int> a(m),dp(n + 1, INF);
    for(int i = 0; i < m; i++)cin >> a[i];
    dp[0] = 0;

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            if(i + a[j] > n)continue;
            dp[i + a[j]] = min(dp[i + a[j]], dp[i] + 1);
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 3180
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
using namespace std;
int x,y,z;
int main(){
	#ifdef FILIN
		#ifndef LOCAL
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>x>>y>>z;
	swap(x,y);
	swap(x,z);
	cout<<x<<' '<<y<<' '<<z<<endl;
	return 0;
}


Measured memory_bytes: 256
n,a,b = map(int, input().split())
v = list(map(int, input().split()))

v.sort(reverse=True)

mx=-1
for i in range(a,b+1):
    mx = max(mx,sum(v[:i])/i)
print(mx)

def modinv(a, mod=10**24+7):
    return pow(a, mod-2, mod)

def comb(n, r, mod=10**24+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

import collections
c = collections.Counter(v)
ans=0
for i in range(a,b+1):
    if sum(v[:i])/i == mx:
        cnt=1

        c2 = collections.Counter(v[:i])

        for itm in c2.items():
            base_cnt = c[itm[0]]
            cnt*=comb(base_cnt,itm[1])
        ans+=cnt

print(ans)

Measured memory_bytes: 38768
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int h,w;
vector<vector<int>> c(51,vector<int>(51));
int di[] = {-1,0,1,0,-1,-1,1,1};
int dj[] = {0,-1,0,1,-1,1,-1,1};

bool dfs(int i,int j){
    if(0 == c[i][j])return false;
    c[i][j] = 0;
    for(int s=0; s<8; s++){
        int ni = i+di[s];
        int nj = j+dj[s];
        if(ni < 0 || nj < 0 || ni >= h || nj >= w)continue;
        if(0 == c[ni][nj])continue;
        dfs(ni,nj);
    }
    return true;
}

int main()
{
    bool flag = true;
    vint ans;
    while(flag){
        cin >> w >> h;
        if(0 == w && 0 == h){
            flag = false;
            break;
        }
        REP(i,h){
            REP(j,w){
                cin >> c[i][j];
            }
        }
        int cnt=0;
        REP(i,h){
            REP(j,w){
                if(dfs(i,j)){
                    cnt++;
                }
            }
        }
        ans.pb(cnt);
    }
    for(auto a:ans){
        cout << a << endl;
    }
}


Measured memory_bytes: 3200
using System;

namespace abc133A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int C = int.Parse(str[2]);
            int d;
            d = A * B;
            if (d <= C)
                Console.WriteLine(d.ToString());
            else
                Console.WriteLine(C.ToString());
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
          

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a , x = 0 , y = 0;
    string b;
    cin >> a >> b;
    for ( int i = 0 ; i < a ; i++ ) {
        if ( b[i] == 'I' ) x++;
        else x--;
        if ( x > y ) y = x;
    }
    cout << y;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
vector<int> vec ;
ll f(ll n){
  if(n==1) return 0 ;
  else if( n==2) return 0 ;
  else if(n==3) return 1 ;
  else return (f(n-1)+f(n-2)+f(n-3))%(10007ll) ;
 }

int main(){
 ll x ;cin>> x ;
 ll syo= x/100ll ; ll amari= x%100ll ;
if(syo*5ll<amari) cout<<0<<endl ;
else cout<<1<<endl ;
  return 0;
  }

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

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

	if(500 * sc.nextInt() >= sc.nextInt() ) {
		System.out.print("Yes");
	}
	else {
		System.out.print("No");
	}
	sc.close();
  }
}


Measured memory_bytes: 21844
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
a = list(map(int, input().split()))
q = int(input())
op = [0] * q
for i in range(q):
    op[i] = map(int, input().split())

from collections import Counter

counter = Counter(a)

_sum = [sum(k * counter[k] for k in counter)] + [0] * q
index = 1
for b, c in op:
    inc = 0
    if b in counter:
        inc = (c-b) * counter[b]
        if c in counter:
            counter[c] = counter[c] + counter[b]
        else:
            counter[c] = counter[b]
        del counter[b]
    _sum[index] = _sum[index-1] + inc
    print(_sum[index])
    index += 1


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

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

    map<char, int> bucket;
    for (int i = 0; i < w.length(); ++i) {
        if (bucket.find(w[i]) == bucket.end()) {
            bucket.insert(make_pair(w[i], 1));
        } else {
            bucket[w[i]] = bucket[w[i]] + 1;
        }
    }

    string ans = "Yes";
    for (auto itr = bucket.begin(); itr != bucket.end(); ++itr) {
        int t = itr->second;
        if (t % 2 != 0) ans = "No";
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int  k, s, a=0, i, x, y, z;

  scanf("%d %d", &k, &s);

if(k > s) k=s;
while(k >= 0 ){
  x = k; if(x > s) x = s;
  y = x; if(x+y > s) y = s-x;
  z = y; if(x+y+z>s) z = s-x-y;

  if(x+y+z<s)break;
  while(1){
    if( x == y) if(y == z) a+=1; else a+=3;
    else if(y == z) a+=3; else a+=6;

    if(z+1 <= y-1){z++;y--;}else{break;}
  }
  k--;
}

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

Measured memory_bytes: 128
def minChange(S, T):
    m, n = len(S), len(T)
    
    min_change = n
    
    # check each character in the larger string
    for i in range(0, m - n + 1):
        total_diff = 0
        # with this substring
        for j in range(0, n):
            # count the differences
            if T[j] != S[i+j]:
                total_diff += 1
        # update the global minimum value
        min_change = min(min_change, total_diff)
    
    return min_change    

S = str(input())
T = str(input())
print(minChange(S, T))

Measured memory_bytes: 67512
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    int n, c;
    cin >> n >> c;
 
    int disc[30][30];
    rep(i, c)rep(j, c)cin >> disc[i][j];
 
    int grid[3][30] = {0};
    rep(i, n)rep(j, n){
        int g;
        cin >> g;
        grid[(i+j)%3][g-1]++;
    }
 
    ll ans = 1<<30;
    rep(i, c){
        rep(j, c){
            if(j == i)continue;
            rep(k, c){
                if(k == i || k == j)continue;
                ll score = 0;
                rep(l, c)score += disc[l][i]*grid[0][l];
                rep(l, c)score += disc[l][j]*grid[1][l];
                rep(l, c)score += disc[l][k]*grid[2][l];
                ans = min(ans, score);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N,K,S;
    cin >> N >> K >> S;
    if(S!=1000000000){
        rep(i,N){
            if(K>0){
                cout << S << ' ';
                K--;
            }else{
                cout << 1000000000 << ' ';
            }
        }
    }else{
        rep(i,N){
            if(K>0){
                cout << S << ' ';
                K--;
            }else{
                cout << S-1 << ' ';
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1280
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
	char a,b,c,d,e,f;
	scanf("%c%c%c\n%c%c%c",&a,&b,&c,&d,&e,&f);
	if(a==f&&b==e&&c==d)
		printf("YES");
	else
		printf("NO");
}


Measured memory_bytes: 256
main :: IO ()
main = do
  [n, y] <- map read . words <$> getLine :: IO [Int]
  let ans = filter (not . null) $ solve n (y `div` 1000)
  if null ans
    then putStrLn "-1 -1 -1"
    else putStrLn $ unwords $ map show $ head ans

solve n y = let max' = head $ filter ((<= y) . (* 10))
                       [n, n-1 .. 0]
            in do
  i <- [0 .. max']
  j <- [0 .. n - i]
  if y == (10 * i) + 5 * j + (n - i - j)
    then return [i, j, n-i-j]
    else return []


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

using namespace std;

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

    int n,l;
    cin>>n>>l;

    vector<string> words;
    string s;

    for(int i=0;i<n;i++){
        cin>>s;

        words.push_back(s);
    }

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

    for(int i=0;i<n;i++){
        cout<<words[i];
    }
    cout<<"\n";

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
a3,b3=map(int,input().split())
a4,b4=map(int,input().split())
a5,b5=map(int,input().split())
a6,b6=map(int,input().split())
a7,b7=map(int,input().split())

print(a1-b1)
print(a2-b2)
print(a3-b3)
print(a4-b4)
print(a5-b5)
print(a6-b6)
print(a7-b7)



Measured memory_bytes: 5596
#include <stdio.h>

#define NUM 100

int main() {
    int n, i, data[NUM];
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        scanf("%d", &data[i]);
    }
    
    for (i = 0; i < n; i++) {
        printf("%d", data[n-1-i]);
        
        if (i != n-1) printf(" ");
    }
    printf("\n");
    
    return 0;
}


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

#define cinf(n, x)                \
    for (int i = 0; i < (n); i++) \
        cin >> x[i];

using namespace std;

int main()
{
    string S;
    cin >> S;
    string before = S.substr(0, 2);
    string after = S.substr(2, 4);
    int a = stoi(before);
    int b = stoi(after);
    if (a >= 1 && a <= 12 && b >= 1 && b <= 12)
        cout << "AMBIGUOUS" << endl;
    else if (a >= 1 && a <= 12 && b >= 0 && b <= 99)
        cout << "MMYY" << endl;
    else if (a >= 0 && a <= 99 && b >= 1 && b <= 12)
        cout << "YYMM" << endl;
    else
        cout << "NA" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
long int n,x,y,a[2000001];
int main(void)
{
	using namespace std;
	
	int i,j;
	
	scanf("%ld",&n);
	for(i=0;i<n;i++){
		scanf("%ld",&a[i]);
	}
	
	sort(a,a+n+1,greater<int>());
	//for(i=0;i<n;i++)printf("%d\n",a[i]);
	
	for(i=0;i<n;i++){
		if(a[i]==a[i+1]){
			x=a[i];
			break;
		}
	}
	for(j=i+2;j<n;j++){
		if(a[j]==a[j+1]){
			y=a[j];
			break;
		}
	}	
	
	printf("%ld\n",x*y);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <queue>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;
typedef pair<int, double> P;
const vector<int> di = {-1, 0, 1, 0};
const vector<int> dj = { 0, 1, 0, -1 };

int main() {

	ll n, k;
	cin >> n >> k;

	ll ans = 0;
	rep(i, n) {
		if (i == 0) ans += k;
		else {
			ans = ans * (k - 1);
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
# 2020/01/19
# AtCoder Beginner Contest 152 - C

# Input
n = int(input())
p = list(map(int,input().split()))

min = 10 ** 6
ans = 0

# Calc
for i in range(n):
    if p[i] < min:
        min = p[i]
        ans = ans + 1

# Output
print(ans)


Measured memory_bytes: 24744
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <set>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int H, W;
    cin >> H >> W;
    int count[26];
    fill(count, count+26, 0);
    for (int i = 0; i < H; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < W; j++) {
            count[(int)(s[j] - 'a')]++;
        }
    }

    int one=0, two=0;
    for (int i = 0; i < 26; i++) {
        int d = count[i] % 4;
        if (d == 1 || d == 3) one++;
        if (d == 2 || d == 3) two++;
    }

    string ans = "No";
    if (one == (H%2) * (W%2)) {
        if (two <= (W/2)*(H%2) + (H/2)*(W%2)) {
            ans = "Yes";
        }
    }

    cout << ans << "\n";
    return 0;
}


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

class D {
public:
	unsigned w,l,r;
	D(unsigned w, unsigned l=0, unsigned r=(1<<31)-1) : w(w), l(l), r(r) {}
};

int n;
void solve()
{
	vector<D> d(1,D(0));
	while (n--)
	{
		int m, a, b;
		cin >> m >> a >> b;
		b--;
		int i=0;
		while (d[i].r < a) { i++; }

		do
		{
			if (d[i].l < a)
			{
				d.insert(d.begin()+i+1, D(d[i].w, a, d[i].r));
				d[i++].r = a-1;
			}

			if (d[i].r > b)
			{
				d.insert(d.begin()+i+1, D(d[i].w, b+1, d[i].r));
				d[i].r = b;
			}

			d[i].w += m;
		} while (d[i++].r < b);
	}

	for (int i=0; i<d.size(); i++)
		if (d[i].w > 150)
		{
			cout << "NG" << endl;
			return;
		}
	cout << "OK" << endl;
}

int main()
{
	while (cin >> n, n)
	{
		solve();
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
int show(int n){
    int sw = 0;
    while(n > 0){
        sw += n % 10;
        n /= 10;
    }
    return sw;
}
int main(){
    int A, B, N;
    cin >> N >> A >> B;
    int sum = 0;
    for(int i = 1; i <= N; i++){
        int sw = show(i);
        if(sw >= A && sw <= B)
            //cout << sw << " ";
            sum += i;
            //cout << sum << " ";
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
 
using namespace std;
//using namespace __gnu_pbds;

//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;                         

const int N = (int)5e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
int n, a[N];
void solve () {
	cin >> n;
	n *= 2;
	for (int i = 1; i <= n; i ++) cin >> a[i];
	sort (a + 1, a + n + 1);
	ll sum = 0;
	for (int i = 1; i <= n; i += 2) sum += a[i];
	cout << sum;
}   	
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//    cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

Measured memory_bytes: 3612
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    a -= 2
    b -= 2
    a %= 13
    b %= 13
    if a > b:
        print("Alice")
    elif a < b:
        print("Bob")
    else:
        print("Draw")
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 41200
#C
N, M = map(int, input().split())
ShopAB = []
sapp = ShopAB.append
for _ in range(N):
    sapp(list(map(int, input().split())))
ShopAB.sort()
cost = 0
i = 0
while M > 0: # and i < N:
    price, maxquant = ShopAB[i][0], ShopAB[i][1]
    if M >= maxquant:
        cost += price * maxquant
        M -= maxquant
    else:
        cost += price * M
        M -= M
    i += 1
print(cost)

Measured memory_bytes: 27756
#include<iostream>
using namespace std;
int main(){
	int a,b,n[1000];
	int k=1;
	int p=0;
	cin>>a>>b;
	for(int i=1;i<1000;i++){
		p+=i;
		n[i]=p;
	}
	for(int i=1;i<999;i++){
		if(n[i]-a==n[i+1]-b){
			cout<<n[i]-a;
			break;
		}
	}
} 

Measured memory_bytes: 256
def check(ssum, tsum, a, b, c, d):
    return ((ssum[b] - ssum[a - 1]) - (tsum[d] - tsum[c - 1])) % 3 == 0

s = input()
t = input()
q = int(input())
a = [[int(i) for i in input().split()] for j in range(q)]

ssum = [0]
tsum = [0]
for i in range(len(s)):
    if s[i] == 'A':
        temp = 1
    else:
        temp = 2
    ssum.append(ssum[i] + temp)
for i in range(len(t)):
    if t[i] == 'A':
        temp = 1
    else:
        temp = 2
    tsum.append(tsum[i] + temp)

for i in range(q):
    if check(ssum, tsum, a[i][0], a[i][1], a[i][2], a[i][3]):
        print('YES')
    else:
        print('NO')


Measured memory_bytes: 37768
# -*- coding: utf-8 -*-
from sys import stdin
input = stdin.readline
import numpy as np

N = int(input())
W = list(map(int,input().split()))


temp = 1e+9
for i in range(N):
    res = np.array(W[:i]).sum()
    pos = np.array(W[i:]).sum()

    if(abs(res - pos) < temp):
        temp = abs(res - pos)

print(temp)

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

using namespace std;
int n , h[100000] , dp[100000];
int main()
{
cin >> n ;
for(int i = 0 ; i < n ; i++){
    cin >> h[i] ;
}
dp[0] = 0 ;
dp[1] = abs(h[1]-h[0]) ;
for(int i =2 ; i < n ; i++){
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]) , dp[i-2]+abs(h[i]-h[i-2])) ;
}
cout << dp[n-1] ;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a[200005];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    int x;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        a[i]=a[i-1]+x;
    }
    int Max=0;
    for(int i=k;i<=n;i++)
    {
        Max=max(Max,a[i]-a[i-k]);
    }
    printf("%.12f\n",(1.0*Max+k)/2);
}


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

#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
using namespace std;

int main(){
	int n;	cin >> n;
	int a[n];
	for( int i = 0; i < n; i++ ){
		cin >> a[i];
	}
	int base = 0;

	for( int i = 0; i < n; i++ ){
		base ^= a[i];
	}

	for( int i = 0; i < n; i++ ){
		cout << (base ^ a[i]);

		if( i != n - 1 )	cout << " ";
	}
	cout << endl;

	return 0;
}


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

int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    vector<bool> dp(1000000+10,true);
    map<int,int> cnt;
    set<int> dic;

    for(int i=0; i<N; i++){
        cin>>A[i];
        cnt[A[i]]++;
        dic.insert(A[i]);
    }
    sort(A.begin(),A.end());

    for(int i=1; i<1000000+10; i++){
        if(dic.count(i)){
            if(dp[i]){
                for(int j=2*i; j<=1000000+10; j += i){
                    dp[j] = false;
                }
            }
        }
    }

    int ans = 0;

    for(int i=0; i<N; i++){
        if(cnt[A[i]] >= 2) continue;
        if(dp[A[i]]) ans++;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 22616
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int N, H, a[100009], b[100009], p[200009];
int main() {
	cin >> N >> H;
	for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
	for (int i = 0; i < 2 * N; i++) p[i] = i;
	sort(p, p + 2 * N, [](int i, int j) {
		int vala = (i < N ? a[i] : b[i - N]);
		int valb = (j < N ? a[j] : b[j - N]);
		if (vala != valb) return vala > valb;
		return i < j;
	});
	int cnt = 0;
	for (int i = 0; i < 2 * N && H > 0; i++) {
		if (p[i] >= N) cnt++, H -= b[p[i] - N];
		else {
			cnt += (H + a[p[i]] - 1) / a[p[i]];
			H = 0;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#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 ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    int n; ll d; cin >> n >> d;
    vector<ll> x(n), y(n);
    rep(i,n) cin >> x[i] >> y[i];
    int ans = 0;
    rep(i,n){
        if(x[i]*x[i] + y[i]*y[i] <= d*d) ans++;

    }
    cout << ans << endl;
}


Measured memory_bytes: 6356
import Data.List

main = interact $ unlines . map (show . icpc_score) . read' . lines
 where
  read' ("0":_) = []
  read' (n:xs) = let (xs1,xs2) = splitAt (read n) xs in map read xs1 : read' xs2

icpc_score ns = ((`div` (length ns - 2)) . sum . init . tail . sort) ns

Measured memory_bytes: 4228
N=parse(Int,readline())
S=chomp(readline())
x=d=0
for c=S
  if c=='('
    d+=1
  else
    d-=1
  end
  x=min(x,d)
end
for i=1:-x
  print('(')
end
print(S)
for i=1:d-x
  print(')')
end
println()

Measured memory_bytes: 110088
import java.util.*;
public class Main {

	public void doIt(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int sum = a + b;
			int digit = Integer.toString(sum).length();
			System.out.println(digit);
		}

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

	}

}

Measured memory_bytes: 12000
import math
import numpy
a,b,h,m = map(int,input().split())
h = (h*60+m)/2
m = m * 6
hour = numpy.array([math.sin(math.radians(h))*a, math.cos(math.radians(h))*a])
# print([math.sin(math.radians(h))*a, math.cos(math.radians(h))*a])
# print([math.sin(math.radians(m))*b, math.cos(math.radians(m))*b])
minute = numpy.array([math.sin(math.radians(m))*b, math.cos(math.radians(m))*b])
# print(hour, minute)
ans = (hour - minute)
print(numpy.linalg.norm(ans))



Measured memory_bytes: 27124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define _GLIBCXX_DEBUG
static const int MAX = 200000;

int main(){
  int N, A[MAX], B[MAX];
  cin >> N;
  rep(i, N){
    cin >> A[i];
    B[i] = A[i];
  }
  sort(B, B+N, greater<>());
  rep(i, N){
    if(A[i] == B[0]) cout << B[1] << endl;
    else cout << B[0] << endl;
  }
}

Measured memory_bytes: 3200
#include<stdio.h>

int main(){
    int m,f,b;
    scanf("%d %d %d",&m,&f,&b);
    if(m>=b){
        printf("0\n");
    }else if(b-m<=f){
        printf("%d\n",b-m);
    }else{
        printf("NA\n");
    }
    return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define ll long long
#define all(x) begin(x), end(x)
#define range(x) begin(x), begin(x)
#define what(x) cout << #x << ": " << x << '\n'
#define print(x) for (auto &el: x) cout << el << ' '; cout << '\n'
using namespace std;
 
template<typename S, typename T>
ostream& operator <<(ostream &os, pair<S, T> &m) { 
    os << '[' << m.first << " " << m.second << ']'; 
    return os; 
}

const int maxn = 1e5+10;

bool vis[maxn];
int dis[maxn], par[maxn];
vector<int> edges[maxn];

void bfs(int node) {
    queue<int> q; q.push(node);
    vis[node] = 1, dis[node] = 0, par[node] = -1;
    while(q.size() > 0) {
        int p = q.front();
        q.pop();
        for (auto el: edges[p]) {
            if (vis[el]) continue;
            dis[el] = dis[p] + 1, par[el] = p;
            vis[el] = 1;
            q.push(el);
        }
    }
}

void solve() {
    for (int i = 1; i <= 5; ++i) {
        int x;
        cin >> x;
        if (x == 0) {
            cout << i << endl;
            return;
        }
    }
}

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

    int t = 1;
    while(t--) solve();

    return 0;
}



Measured memory_bytes: 5988
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long intS
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    
    char n[10]={};
    
    cin >> n;
    
    for (int i=0;i < 3;i++){
    
    if (n[i]=='1'){
    
    cout << '9' ;

    
    }else {
    
    cout << '1' ;
    
     }
    }
    
    cout << endl;
    
    
    
    
//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
n, k = map(int, input().split())
li = [0] * n
counter = 0

for i in range(k):
    d = input()
    a = list(map(int, input().split()))
    for j in a:
        li[j-1] += 1
for j in li:
    if j == 0:
        counter += 1

print(counter)


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

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 
		int[][] k_1 = new int[3][10];
		int[][] k_2 = new int[3][10];
		int[][] k_3 = new int[3][10];
		int[][] k_4 = new int[3][10];
		int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			String[] strAry = br.readLine().split(" ");
			switch (strAry[0]) {
			case "1":
				k_1[Integer.parseInt(strAry[1]) - 1][Integer.parseInt(strAry[2]) - 1] += Integer.parseInt(strAry[3]);
				break;
			case "2":
				k_2[Integer.parseInt(strAry[1]) - 1][Integer.parseInt(strAry[2]) - 1] += Integer.parseInt(strAry[3]);
				break;
			case "3":
				k_3[Integer.parseInt(strAry[1]) - 1][Integer.parseInt(strAry[2]) - 1] += Integer.parseInt(strAry[3]);
				break;
			case "4":
				k_4[Integer.parseInt(strAry[1]) - 1][Integer.parseInt(strAry[2]) - 1] += Integer.parseInt(strAry[3]);
				break;
			}
		}
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 10; j++) {
				if (j == 9) System.out.println(" " + k_1[i][j]);
				else System.out.print(" " + k_1[i][j]);
			}
		}
		System.out.println("####################");
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 10; j++) {
				if (j == 9) System.out.println(" " + k_2[i][j]);
				else System.out.print(" " + k_2[i][j]);
			}
		}
		System.out.println("####################");
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 10; j++) {
				if (j == 9) System.out.println(" " + k_3[i][j]);
				else System.out.print(" " + k_3[i][j]);
			}
		}
		System.out.println("####################");
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 10; j++) {
				if (i == 3 && j == 9)  System.out.print(" " + k_4[i][j]);
				else if (j == 9) System.out.println(" " + k_4[i][j]);
				else System.out.print(" " + k_4[i][j]);
			}
		}
	}
}

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

int main() {
    int N,K;
    cin >> N >> K;
    int A[N];
    for(int i=0;i<N;i++){
        cin >> A[i];
    }

    int num[200001]={};
    for(int i=0;i<N;i++) num[A[i]]++;

    sort(num,num+N,greater<int>());
    int ans=N;
    for(int i=0;i<K;i++){
        ans -= num[i];
    }

    cout << ans << endl;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << ", ";
#define endln cerr << "\n";
#define chkpt cerr << "-----\n";

const int maxn = 2e5 + 5;
int n, t;
int a[maxn];

void solve() {
	cin >> n >> t;
	FOR(i, 0, n) cin >> a[i];
	long long ans = 0;
	int st = a[0];
	FOR(i, 1, n) {
		if (a[i] > a[i - 1] + t) {
			ans += a[i - 1] + t - st;
			st = a[i];
		}
	}
	ans += a[n - 1] + t - st;
	cout << ans << "\n";
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        freopen("in.txt", "r", stdin);
        JUDGE_ONLINE = 0;
    }
    ios_base::sync_with_stdio(0); cin.tie(0);
    solve();
    if (!JUDGE_ONLINE) {
    	//freopen("out.txt", "w", stdout);
    	//cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
int main() {
  string s;
  cin >> s;
  if(s[2] == s[3]&&s[4] == s[5]) dunk("Yes");
  else dunk("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> vec(N);
	rep(i, N) cin >> vec[i];
	int ans = 0;
	rep(i, N)
	{
		rep2(j, i+1, N)
		{
			// cout << "i: " << vec[i] << " j: " << vec[j] << endl;
			ans += vec[i]*vec[j];
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	int N = 0;
	cin >> N;
	char c;
	REP(i, N) {
		cin >> c;
		if (c == 'Y') {
			cout << "Four";
			break;
		}
		if (i == N - 1) {
			cout << "Three";
		}
	}
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<stdio.h>
#define MAX 1000000

int prime[MAX]={};      //?´???°?????´??????0???????????§????????´??????1

void calculate(void)
{
    int i,j,k;

    for(i=2;i<MAX;i++)
    {
        if(prime[i]==0)
        {
            k=i*2;
            for(j=k;j<MAX;j+=i)
            {
                prime[j]=1;
            }
        }
    }
    return;
}

int main(void)
{
    int count=0,a=0,d=0,n=0;
    calculate();

    while(1)
    {
        count=0;
        prime[1]=1;
        scanf("%d %d %d",&a,&d,&n);

        if(a==0 && d==0 && n==0)
        {
            break;
        }

        while(count!=n)
        {
            if(prime[a]==0)
            {
                count++;
            }
            a+=d;
        }
        printf("%d\n",a-d);
    }
    return 0;
}

Measured memory_bytes: 4504
N = int(input())

if len(str(N)) <= 1:
    answer = N
elif len(str(N)) <=2:
    answer = 9
elif len(str(N)) <=3:
    answer = 9 + N - 10**2 + 1
elif len(str(N)) <=4:
    answer = 9 + 9*10**2
elif len(str(N)) <= 5:
    answer = 9 + 9*10**2 + N - 10**4 + 1
else:
    answer = 9 + 9*10**2 + 9*10**4

print(answer)
    

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline

n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

bin_k = format(k, 'b').zfill(50)

b = [0] * 50 # ビットごとの1の個数

for i in a:
    bin_i = format(i, 'b').zfill(50)
    for j in range(len(bin_i)):
        if bin_i[j] == "1":
            b[j] += 1

dp = [[0, 0] for _ in range(len(bin_k))]

if bin_k[0] == "0":
    dp[0][0] = b[0] * 2**(len(bin_k) - 1) # 0
else:
    dp[0][0] = (n - b[0]) * 2**(len(bin_k) - 1) # 1
    dp[0][1] = b[0] * 2**(len(bin_k) - 1) # 0

for i in range(1, len(bin_k)):
    if bin_k[i] == "0":
        dp[i][0] = dp[i - 1][0] + b[i] * 2**(len(bin_k) - (i + 1))
        if dp[i - 1][1] > 0:
            dp[i][1] = max(dp[i - 1][1] + b[i] * 2**(len(bin_k) - (i + 1)), dp[i - 1][1] + (n - b[i]) * 2**(len(bin_k) - (i + 1)))
    else:
        dp[i][0] = dp[i - 1][0] + (n - b[i]) * 2**(len(bin_i) - (i + 1))
        dp[i][1] = dp[i - 1][0] + b[i] * 2**(len(bin_k) - (i + 1))
        if dp[i - 1][1] > 0:
            dp[i][1] = max(dp[i][1], dp[i - 1][1] + (n - b[i]) * 2**(len(bin_i) - (i + 1)), dp[i - 1][1] + b[i] * 2**(len(bin_k) - (i + 1))) 

print(max(dp[-1][0], dp[-1][1]))

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

int main(){
	
	priority_queue<int> q;
	rep(i,3){
		int tmp;
		cin >> tmp;
		q.push(tmp);
	}
	
	q.pop();
	
	int cnt = 0;
	
	rep(i,2){
		cnt += q.top();
		q.pop();
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
h,w = map(int, input().split())
flg = 0
a = []
for i in range(h):
  s = input()
  if '#' in s:
    a.append(s)
  else:
    flg += 1
h -= flg
res = ['']*h
for i in range(w):
  flg = 0
  for j in range(h):
    if a[j][i] == '#':
      flg = 1
  if flg == 1:
    for j in range(h):
      res[j] += a[j][i]
for i in range(h):
  print(res[i])

Measured memory_bytes: 3064