akhauriyash/Code-Regression huggingface dataset:
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int n;
    cin >> n;
    int a[n];
    fff(i,n)
    cin >> a[i];
    
    int an=0;
    fff(i,n) {
        if(an<=a[i])
        an=max(an,a[i]-1);
        else {
            cout << "No";return 0;
        }
    }
    
    cout << "Yes" ;
	return 0;
    
}

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

int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int sum=0;
  for(int i=0;i<n;i++){
    sum+=a[i];
  }
  int ans;
  if(sum%10!=0){
    ans=sum;
  }
  else{
    sort(a,a+n);
    int min=0;
    for(int i=0;i<n;i++){
      if(a[i]%10!=0){
        min=a[i];
        break;
      }
    }
    if(min!=0){
      ans=sum-min;
    }
    else{
      ans=0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define SIZE 2005
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define mp make_pair
#define ll long long
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
ll n, m, k, a, b, ans;
string s;
map<char, int> MP;
int main() {
	io(); ll A, B;
	cin >> A >> B;
	int ans = B * 10;
	while (floor(ans * 0.08) != A && floor(ans * 0.1) == B) ans++;
	if (floor(ans * 0.08) == A && floor(ans * 0.1) == B) cout << ans;
	else cout << "-1";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec(x) vector<x>
#define pb push_back
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii vector<pair<ll,ll>>
#define matrix(x) vector<vector<x>>
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a, b, sizeof a)
#define ff first
#define ss second
#define mp make_pair
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main()
{
ll t;
cin>>t;
ll res=t/1000;
res=res+1;
ll ans=res*1000-t;
if(ans<1000)
cout<<ans<<endl;
else
    cout<<0<<endl;


}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	std::string a,b,c;
	cin>>a>>b>>c;
	std::string p(a),q(b),r(c);
	if(p.back()==q.front()&&q.back()==r.front())
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) fo(i, n){fo(j, m)cout<<dp[i][j]<<" ";cout<<"\n";}
ll nxt(){ll x; cin >> x; return x;}
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}

void solve(){
    ll n, x ,t;
    cin >> n >> x >> t;
    cout << ((n + x - 1)/x)*t << nl;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll TC = 1;
    //cin>>TC;
    while(TC--){
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3832
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int zs[55666];
int ys1[5][55666];
int len1[5];
int main()
{
    for(int i=2;i<=55555;i++)
    {
        int f=0;
        for(int k=2;k*k<=i;k++)
            if(i%k==0)
                f=1;
        if(!f )
            ys1[i%5][len1[i%5]++]=i;
    }
    int n;
    scanf("%d",&n);
    int n1,n2;
    n1=n2=0;
    for(int i=0;i<n;i++)
    {
        if(i!=0)
            printf(" ");
        printf("%d",ys1[1][i]);
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<limits.h>
int main(void){
  int i,l=0,fz=0,sz=0,ans;
  char a[100000];
  scanf("%s",a);
  while(1){
    if(a[l]=='\0') break;
    l++;
  }
  for(i=0;i<l;i++){
    if(i%2==0){
    	if(a[i]=='0')fz++;
    }else{
      if(a[i]=='1')fz++;
    }
  }
  for(i=0;i<l;i++){
    if(i%2==0){
    	if(a[i]=='1')sz++;
    }else{
      if(a[i]=='0')sz++;
    }
  }
  if(fz>sz)ans=sz;
  else ans=fz;
  printf("%d\n",ans);
  return 0;
}

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

#define ll long long

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

    ll x, y, z;
    cin >> x >> y >> z;
    
    swap(x,y);
    swap(x,z);
    
    cout << x << ' ' << y << ' ' << z << endl;

    return 0;
}


Measured memory_bytes: 256
def main():


    N, K ,Q = map(int,input().split())
    base = K -Q
    baseList = [base] * N

    ansList = [ int(input()) for _ in range(Q)]
    for i in ansList:
        baseList[i-1] +=1
    
    for i in baseList:
        if i >= 1:
            print('Yes')
        else:
            print('No')









if __name__ == "__main__":
    main()



Measured memory_bytes: 56536
#!/usr/bin/python

import sys

def main(argv):
    line = sys.stdin.readline().rstrip("\n")

    while line:
        n, m = line.split()
        n = int(n)
        m = int(m)

        edges = []
        path = [[-1 for i in xrange(n)] for i in xrange(n)]
        distance = [[1001 for i in xrange(n)] for i in xrange(n)]
        for i in xrange(m):
            a, b, c = raw_input().split()
            a = int(a) - 1
            b = int(b) - 1
            c = int(c)
            distance[a][b] = c
            distance[b][a] = c
            edges.append((a,b))

        for i in xrange(n):
            distance[i][i] = 0

        for k in xrange(n):
            for i in xrange(n):
                for j in xrange(n):
                    candidate = distance[i][k] + distance[k][j]
                    if candidate < distance[i][j]:
                        distance[i][j] = candidate
                        path[i][j] = k

        counter = 0
        for (x, y) in edges:
            if path[x][y] != -1:
                counter += 1
        print counter

        line = sys.stdin.readline().rstrip("\n")

if __name__ == "__main__":
    main(sys.argv)

Measured memory_bytes: 3076
#include <iostream>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<ll> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }

    vector<ll> s(n+1, 0);
    map<ll, ll> M;
    for (int i = 0; i < n; i++) {
        s[i+1] = s[i] + v[i];
    }
    for (int i = 0; i < n+1; i++) {
        M[s[i]]++;
    }

    ll ans = 0;
    for (auto val : M) {
        ll num = val.second;
        ans += num * (num - 1) / 2;
    }
    cout << ans << endl;
} 

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

int TwoIntegers( const int K, const int S )
{
	if( K < 0 || S < 0 ) return 0;

	if( K >= S )
		return S + 1;
	if( 2 * K >= S )
		return 2 * K - S + 1;
	else
		return 0;
}

int ThreeIntegers( const int K, const int S )
{
int i;
int iSum;
int iMin;
int iMax;

	if( K < 0 || S < 0 ) return 0;

	if( K > S )
		iMax = S;
	else
		iMax = K;

	if( 2 * K < S )
		iMin = S - 2 * K;
	else
		iMin = 0;

	iSum = 0;
	for( i = iMin; i <= iMax; i++ )
		iSum += TwoIntegers( K, S - i );

	return iSum;
}

int main( int argc, char *argv[] )
{
int K;
int S;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> K;
	cin >> S;
	cout << ThreeIntegers( K, S ) << endl;

	return 0;
}




Measured memory_bytes: 256
s = input()
t = input()

def check(a, b):
    if len(a) != len(b):
        return 0
    else:
        ans = 0
        for i in range(len(a)):
            if a[i] == b[i]:
                ans += 1
        return ans

ans = 0
for i in range(len(s)):
    x = check(s[i:i + len(t)], t)
    if ans  < x:
        ans = x

print(len(t) - ans)

Measured memory_bytes: 9020
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  int n;
  int a[101];
  cin >> n;
  for (int i=0; i<n; i++){
    cin >> a[i];
  }
  sort(a, a+n, greater<int>());
  int alice = 0;
  int bob = 0;
  for (int i=0; i<n; i++){
    if (i%2 == 0){
      alice += a[i];
    }else{
      bob += a[i];
    }
  }
  cout << alice - bob << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int K = scanner.nextInt();
    int[] e = new int[N];
    for (int i = 0; i < N; i++) {
      int p = scanner.nextInt();
      e[i] = p + 1;
    }

    long sum = 0;
    for (int i = 0; i < K; i++) sum += e[i];
    long max = sum;
    for (int i = K; i < N; i++) {
      sum += e[i];
      sum -= e[i - K];
      max = Math.max(max, sum);
    }
    System.out.println(max * 0.5d);
  }
}


Measured memory_bytes: 79652
#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--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

vector<ll> h;

int main(){
    int n, k;
    cin >> n >> k;
    rep(i, n){
        ll t;
        cin >> t;
        h.push_back(t);
    }
    sort(h.begin(), h.end());

    ll ans = LINF;

    rep(i, n-k+1){
        ans = min(ans, h[k+i-1]-h[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1400
#include <stdio.h>
int main(){
    int a1,b1,a,b,c;
    while(scanf("%d%d",&a1,&b1)!=EOF){
		a=a1;
		b=b1;
		while (a!=0) {
			if (a<b) {
				c=b;
				b=a;
				a=c;
			}
			a=a%b;
		}
        a=b1/b*a1;
		printf("%d %d\n",b,a);
    }
}

Measured memory_bytes: 0
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

fn main() {
    input! {
        c1: [i32; 3],
        c2: [i32; 3],
        c3: [i32; 3],
    }
    let c = vec![c1, c2, c3];

    let a: Vec<i32> = (0..3).map(|i| (0..3).map(|j| c[i][j]).sum()).collect();
    let b: Vec<i32> = (0..3).map(|j| (0..3).map(|i| c[i][j]).sum()).collect();
    let offset = a[0] + b[0] - 3 * c[0][0];
    let mut ret = "Yes";
    for i in 0..3 {
        for j in 0..3 {
            if (a[i] + b[j] - offset) / 3 != c[i][j] {
                ret = "No";
                break;
            }
        }
    }
    println!("{}", ret);
}


Measured memory_bytes: 2104
sx, sy, tx, ty = gets.split.map(&:to_i)
h = ty - sy
w = tx - sx

answer = ""

# (sx, sy)から(tx, ty)へ移動
answer += "U" * h
answer += "R" * w

# (tx, ty)から(sx, sy)へ移動
answer += "D" * h
answer += "L" * w

# (sx, sy)から(tx, ty)へ、若干遠回りして移動
answer += "L"
answer += "U" * (h + 1)
answer += "R" * (w + 1)
answer += "D"

# (tx, ty)から(sx, sy)へ、若干遠回りして移動
answer += "R"
answer += "D" * (h + 1)
answer += "L" * (w + 1)
answer += "U"

puts answer


Measured memory_bytes: 1916
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
#define MAX 510000
#define MOD 1000000007
//#define MOD 998244353
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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 COM(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;
}
void initialize(){
    COMinit();
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0,tmp;
  int a[LIMIT2]={0};
  char s[LIMIT1];
  
  scanf("%lld %lld",&n,&k);
  rep(i,n) scanf("%d",&a[i]);
  
  qsort(a,n,sizeof(int),upint);
  per(i,n){
	tmp = COM(i,k-1);
    tmp = (tmp * (ll)a[i]) % MOD;
    result += tmp;
    result %= MOD;
  }
  rep(i,n){
    tmp = COM(n-1-i,k-1);
    tmp = (tmp * (ll)a[i]) % MOD;
    result -= tmp;
    if(result<0) result+=MOD;
    result %= MOD;
  }
  printf("%lld",result);
  return 0;
}

Measured memory_bytes: 14460
#include <stdio.h>
int main(){
int a,b[100],c[100],i,s=0;
	scanf("%d",&a);
	for (i=0;i<a;i++){
		scanf ("%d",&b[i]);
		}
		for (i=0;i<a;i++){
		scanf ("%d",&c[i]);
		}
	for (i=0;i<a;i++){
	if (b[i]>c[i]){
		s=s+b[i]-c[i];
		}
		}
		printf ("%d",s);
	return 0;
	}

Measured memory_bytes: 128
#include<bits/stdc++.h>
            using namespace std;
            #define rep(i,b) for(i=0;i<b;++i)
            #define repp(i,a,b) for(i=a;i<b;++i)
            #define endl "\n"
            //#define LLONG_MAX 99999999999999
            typedef long long int lli;
            int main(){
                lli t,n,i,j,k,m,wt;
                cin>>n>>wt;
                vector<lli> w(n);
                vector<lli> v(n);
                rep(i,n)cin>>w[i]>>v[i];
                vector<lli> ans(wt+1,0);
                vector<lli> ans2(wt+1,0);
                rep(i,n){
                    repp(j,w[i],wt+1){
                        ans[j]=max(ans2[j],ans2[j-w[i]]+v[i]);
                    }
                    rep(j,wt+1)ans2[j]=ans[j];
                }
                cout<<ans[wt]<<endl;



                return 0;



            }


Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


vector<pair<int,int>> vectorCnt(vector<int> a) {
    sort(a.begin(),a.end());
    int n=a.size();
    vector<pair<int,int>> b;
    int cnt=1;
    rep(i,n-1) {
            if (a[i+1]!=a[i]) {
                b.push_back(make_pair(cnt,a[i]));
                cnt=1;
            } else {
                ++cnt;
            }
    }
    b.push_back(make_pair(cnt,a[n-1]));
    return b;
}

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

    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<pair<int,int>> b=vectorCnt(a);
    sort(b.begin(),b.end());
    int bs=b.size();
    int itr=max(0,bs-k);
    int ans=0;
    rep(i,itr) ans+=b[i].first;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3956
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)
typedef long long ll;

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}


int main() {

	string S, T;
	cin >> S >> T;

	int ans = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] != T[i]) ans++;
	}

	cout << ans << endl;

	return 0;

}


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

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

  vector<char> C(N);
  for (int i = 0; i < N; i++) {
    cin >> C.at(i);
  }

  bool check = false;
  for (int j= 0; j < N; j++) {
    if (C.at(j) == 'Y') {
      check = true;
      break;
    } 
  }

  if (check)
  {
    cout << "Four" << endl; 
  }
  else {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 5)

n, m = map(int, input().split())

l, r = map(int, input().split())


def check(i, l, r):
    if i == m:
        return max(r - l + 1, 0)
    l_, r_ = map(int, input().split())
    nl = max(l, l_)
    nr = min(r, r_)
    i += 1
    return check(i, nl, nr)


print(check(1, l, r))

Measured memory_bytes: 95292
#include<bits/stdc++.h>
#define N 200005
#define ll  long long
using namespace std;
int n;
ll a[N], h = 0, xans = 0, sans = 0, ans = 0;

inline ll read()
{
	ll red = 0, f_f = 1; char ch = getchar();
	while(ch>'9'||ch<'0') {if(ch == '-') f_f = -1; ch = getchar();}
	while(ch>='0'&&ch<='9') red = red * 10+ch-'0', ch = getchar();
	return red * f_f;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) a[i] = read();
	for(int i = 1; i <= n; i++) {
		xans ^= a[i],  sans += a[i];
		while(xans != sans)
			ans += i-1-h, xans ^= a[++h], sans -= a[h];
		
	}
	ans += (n-h) * (n-h+1)/2;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  int n, k; cin >> n >> k;
  double ans = 0;
  for(int i = 1; i <= n; i++){
    int cur = i;
    int sum = n;
    while(cur < k){
      cur *= 2;
      sum *= 2;
    }
    double temp = (double)1/sum;
    ans += temp;
  }
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

main(){

  int n,q,i,left,right,mid,c=0;
  int S[100000];
  int T[50000];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }
  
  for(i=0;i<q;i++){
    left=0;
    right=n;
    while(left<right){
      mid=(left+right)/2;
      if(S[mid]==T[i]){
	c++;
	break;
      }
      else if(S[mid]<T[i]){
	left=mid+1;
      }
      else{
	right=mid;
      }
    }
  }
  printf("%d\n",c);
  return 0;
}

Measured memory_bytes: 1184
mod = 10**9 + 7
n,k = map(int,input().split())
A = list(map(int,input().split()))
# その数より右にあるもの
ans = 0
for i in range(n):
    migi = 0
    a = A[i]
    for j in range(i+1,n):
        if a > A[j]:
            migi += 1
    ans += migi * k
    ans %= mod
# 全体で、その数よりも小さいもの(ループするので)
for i in range(n):
    zen = 0
    a = A[i]
    for j in range(n):
        if a > A[j]:
            zen += 1
    # 等差数列のやつ 初項は0, 項数はk,末項はzen * (k-1)
    ans += ((zen*(k-1) * k //2)%mod)
    ans %= mod
print(ans)


Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
using namespace std;
int n,tot,cnt,suml[600000],sumr[600000],f[600000][3];
char c;
int main() {
	scanf("%d\n",&n);
	cnt=0;
	for (int i=1;i<=n;i++) {
		c=getchar();
		if (c=='0') {
			if (suml[tot]||cnt) tot++;
			suml[tot]=sumr[tot-1]=cnt;
			cnt=0;
		} else cnt++;
	}
	sumr[tot]=cnt;
	for (int i=1;i<=tot;i++) {
		f[i][0]=max(max(f[i-1][0],f[i-1][1]),f[i-1][2]);
		if (suml[i]>0&&sumr[i]>0) f[i][1]=max(f[i-1][0],f[i-1][1]-1)+suml[i];
		if (suml[i]>0&&sumr[i]>0) f[i][2]=f[i-1][0]+sumr[i];
		if (suml[i]>1) f[i][2]=max(f[i][2],max(f[i-1][1],f[i-1][2]-1)+sumr[i]);
	}
	printf("%d\n",max(max(f[tot][0],f[tot][1]),f[tot][2]));
	return 0;
}

Measured memory_bytes: 8448
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int A = sc.nextInt();
    if (H % A ==0) {
      System.out.println(H/A);
    } else {
      System.out.println(H/A + 1);
    }
  }
}
    

Measured memory_bytes: 22740
import java.util.ArrayList;
import java.util.Scanner;
class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力



		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[m];
		int mod = 1000000007;
		for(int i = 0;i < m;i++){
			a[i] = sc.nextInt();
		}
		int[] dp = new int[n+1];
		dp[0] = 1;
		for(int i = 0;i < m;i++){
			dp[a[i]] = -1;
		}
		for(int i = 0;i <= n;i++){
			if(dp[i] >= 0){
				if(i + 1 <= n && dp[i + 1] >= 0){
					dp[i + 1] += dp[i]%mod;
				}
				if(i + 2 <= n && dp[i + 2] >= 0){
					dp[i + 2] += dp[i]%mod;
				}
			}
		}
		System.out.print(dp[n]%mod);




	}


	static boolean checkswitch(int bit,int[] k,ArrayList<ArrayList<Integer>> list,int[] p,int m){

		//		System.out.println("bit " + bit);

		for(int i = 0;i < m;i++){

			ArrayList<Integer> sub = list.get(i);
			int onnum = 0;						//onの数
			for(int j = 0;j < sub.size();j++){
				//				System.out.println("sub "+ sub.get(j));
				if((bit & (1 << sub.get(j))) != 0){				//目的のスイッチがついているか
					onnum++;
					//					System.out.println("on  ");
				}

			}
			if(onnum % 2 != p[i]){				//一個でも電球がつかなかったらout
				return false;
			}

		}


		return true;

	}

	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}





}



class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return  otherpair.end - end;
	}
}




Measured memory_bytes: 48492
/************************************************
 * Au: Hany01
 * Prob: agc002c
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
#define Rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define X first
#define Y second
#define PB(a) push_back(a)
#define MP(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define ALL(a) a.begin(), a.end()
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 wozenmezhemecaia

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }

template <typename T> inline T read() {
	static T _, __; static char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}
//EOT


int n, L, a[100005];

int main()
{
#ifdef hany01
	freopen("agc002c.in", "r", stdin);
	freopen("agc002c.out", "w", stdout);
#endif

	n = read<int>(), L = read<int>();
	For(i, 1, n) a[i] = read<int>();

	For(i, 1, n - 1) {
		if (a[i] + a[i + 1] >= L) {
			puts("Possible");
			For(j, 1, i - 1) printf("%d\n", j);
			Fordown(j, n - 1, i + 1) printf("%d\n", j);
			printf("%d\n", i);
			return 0;
		}
	}
	puts("Impossible");

	return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
struct edge { int to, cost; };
int a, b, k;
signed main() {
	cin >> a >> b >> k;
	if (k <= a)cout << a - k << " " << b << endl;
	else cout << 0 << " " << max((int)0, b - (k - a)) << endl;
	ggr
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;

int main() {
	int N,A;
	cin >> N >> A;
	cout << N*N - A << endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.cstream;
import std.string;

void main(string[] args){
int[1000010] dp,dp1;
int [2002] dp4;
for(int i=1;i<=1000000;i++){
/+
dp3[i]=cast(int)(0.5*i*(i+1));/++/
dp4[i]+=dp3[i]+dp4[i-1];/++/
+/
dp1[i]=0;
dp[i]=0;
//dp2[i]=0;
if(i<2000)dp4[i]+=cast(int)(0.5*i*(i+1)) + dp4[i-1];
}
dp1[1]=0;//ord
dp[1]=0;//odd
for(int i=1;i<=1000000;i++){
int minn=2000000,minnn=2000000;
  for(int j=1;dp4[j]<=i;j++){
       if(minn>dp1[i-dp4[j]]+1)minn=dp1[i-dp4[j]]+1;
       if(dp4[j]%2 != 0){
       if(minnn>dp[i-dp4[j]]+1)minnn=dp[i-dp4[j]]+1;
       }
   
  }
dp1[i]=minn;
dp[i]=minnn;

}



int n,index=0;
while(true){
scanf("%d",&n);
if(n == 0)break;

printf("%d %d\n",dp1[n],dp[n]);
/+
index = 0;
for(int i=1;i<=1000000;i++){
if(dp4[index]<=n)index=i;
else break;
}
+/
/+
for(int i;i<20;i++)writeln(dp4[i]);
printf("\n\n %d\n",index);
+/


}



}

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vll vector<long long>
#define inf 1000000100
#define infll 1LL << 50
vi adj[100001];

void bfs(int start, vi &dist)
{
    bool visited[100001] = {0};
    queue<pair<int, int>> q;
    q.push({start, start});
    visited[start] = 1;
    dist[start] = 0;
    while(!q.empty())
    {
        int node = q.front().first;
        int parent = q.front().second;
        q.pop();
        for(auto u: adj[node])
        {
            if(!visited[u] && u != parent)
            {
                visited[u] = 1;
                dist[u] = dist[node] + 1;
                q.push({u, node});
            }
        }
    }

}
int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n-1; ++i)
    {
        int a, b;
        cin >> a >> b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    vi bdist(100001, -1);
    vi wdist(100001, -1);
    bfs(1, bdist);
    bfs(n, wdist);
    int black = 0, white = 0;

    for(int i = 1; i <= n; ++i)
    {
        if(bdist[i] <= wdist[i])
        {
            ++black;
        }
        else if (wdist[i] < bdist[i])
        {
            ++white;
        }
    }

    if(black > white)
    {
        cout << "Fennec" << endl;
    }
    else
    {
        cout << "Snuke" << endl;
    }



}


Measured memory_bytes: 6912
import sys
import math
import bisect
from heapq import heappush
from collections import defaultdict

S = input()
T = input()
lenS = len(S)
lenT = len(T)
F1 = [False]*26
F2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(lenS):
    F1[alpha.index(S[i])] = True
for i in range(lenT):
    F2[alpha.index(T[i])] = True
for i in range(26):
    if not F1[i] and F2[i]:
        print(-1)
        sys.exit()

ind = S.index(T[0])
ans = ind+1
for i in range(1,lenT):
    S = S[ind+1:] + S[:ind+1]
    ind = S.index(T[i])
    ans += ind+1

print(ans)

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N, M; cin >> N >> M;
    int l = 1, r = N;
    REP(i, M)
    {
        int L, R; cin >> L >> R;
        l = max(l, L);
        r = min(r, R);
    }
    cout << max(r-l+1, 0) << endl;
} 
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

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

struct Node{
  int key;
  struct Node *right,*left,*parent;
};

struct Node *root,*nil;

struct Node * find(struct Node *u,int k){
  while(u != nil && k != u->key){
    if(k<u->key)u = u->left;
    else u = u->right;
  }
  return u;
}

void insert(int k){
  struct Node *y = nil;
  struct Node *x = root;
  struct Node *z;

  z = (struct Node *)malloc(sizeof(struct Node));
  z->key = k;
  z->left = nil;
  z->right = nil;

  while(x != nil){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }else {
      x = x->right;
    }
  }
  z->parent =y;
  if(y == nil){
    root = z;
  }else{
    if(z->key <y->key){
      y->left = z;
    }else{
      y->right =z;
    }
  }
}

void inorder(struct Node *u){

  if(u == nil)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(struct Node *u){

  if(u == nil)return;
  printf(" %d",u->key );
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  char com[100];

  scanf("%d",&n);

  for(i= 0;i<n;i++){
    scanf("%s",com);
    if('f'==com[0]){
      scanf("%d",&x);
      struct Node *t = find(root,x);
      if(t != nil)printf("yes\n" );
      else printf("no\n");
    }else if(strcmp(com,"insert")==0){
      scanf("%d",&x);
      insert(x);
    }else if(strcmp(com,"print")==0){
      inorder(root);
      printf("\n" );
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 20448
S = input()
K = int(input())
X = 0
i = 1
while i < len(S):
  if S[i] == S[i - 1]:
    X += 1
    i += 1
  i += 1
X *= K
if S == S[0] * len(S) and len(S) % 2 == 1:
  X += K // 2
elif i == len(S) and S[0] == S[-1]:
  x = 1
  i = 2
  while i < len(S):
    if S[i] == S[i - 1]:
      x += 1
      i += 1
    i += 1
  X += (K - 1) * (x - X // K)
print(X)


Measured memory_bytes: 9212
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}




int main() {

	ll N;
	cin >> N;
	
	ll k = 0;
	for (ll A = 1; A <= N; A++) {
		k += N / A;
		if (N % A == 0)k--;
	}
	cout << k << endl;

}

Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

vector<vector<int> > graph(100001);
int color[100001][11] = {};
int ans[100001] = {};

void solve(int v, int d, int c)
{
	if(color[v][d] > 0 || d < 0) return;
	if(ans[v] == 0) ans[v] = c;
	color[v][d] = c;
	for(int i = 0; i < graph[v].size(); i++){
		solve(graph[v][i], d - 1, c);
	}
	return;
}

int main()
{
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	int q;
	cin >> q;
	int v[100001], d[100001], c[100001];
	for(int i = 0; i < q; i++){
		cin >> v[i] >> d[i] >> c[i];
		v[i]--;
	}
	for(int i = q - 1; i >= 0; i--){
		solve(v[i], d[i], c[i]);
	}
	for(int i = 0; i < n; i++){
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 12408
//gauravsinghh
#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;
#define ll long long int
#define ld long double
#define db double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int> 
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define os cout<<" "
#define bitcount __builtin_popcount
#define gcd __gcd
#define endl "\n"
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define ford(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fors(container, it, a, b) for(__typeof(container.begin()) it = a; it != b; it++) 
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 999999999999999999
#define siz 100005
#define fbo find_by_order
#define ook order_of_key
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(int i = a; i <= b; i++)
#define ffo(i, a, b) for(int i = a; i >= b; i--)
#define MAX 100005
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")

void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

bool comp(const pair < ll, ll >&a, const pair < ll, ll >&b){
    return ((a.ss < b.ss) || (a.ss == b.ss && a.ff < b.ff));
}

signed main(){ 
    IOS
    //io_set();
    ll n, m, o;
    cin >> n >> m >> o;
    cout << min(n+m , min(m+o, n+o)) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
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; }

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//



int main() {
  int n;
  cin >> n;
  vi a, b;
  rep(i, n) {
    int x, y;
    cin >> x >> y;
    a.push_back(x-y);
    b.push_back(x+y);
  }
  sort(ALL(a));
  sort(ALL(b));
  int ans = max(a[n-1] - a[0], b[n-1] - b[0]);
  cout << ans << endl;
}

Measured memory_bytes: 5064
n, k = map(int, input().split())
ll = n // k
if ll % 2 == 0:
    l_odd = ll // 2
    l_even = ll // 2
else:
    l_odd = ll // 2 + 1
    l_even = ll // 2
if k % 2 == 0:
    ans = ll ** 3
    if n >= ll*k + k/2:
        ans += (ll+1)**3
    else:
        ans += ll**3
    print(ans)
else:
    print(ll ** 3)


Measured memory_bytes: 3060
import java.io.*
import java.util.*

object Input {
    private var i = 0
    private var line = listOf<String>()

    fun next(): String = if (i < line.size) {
        line[i++]
    } else {
        line = readLine()?.split(" ") ?: throw Exception("EOF")
        i = 0
        next()
    }

    fun int() = next().toInt()

    fun long() = next().toLong()

    fun double() = next().toDouble()
}

object Out {
    private val buffer = mutableListOf<Any>()

    fun writeln(obj: Any) = writeSep(obj, "\n")

    fun writeSep(obj: Any, sep: String = " ") = write("$obj$sep")

    fun write(obj: Any) = buffer.add(obj)

    fun flush() {
        print(buffer.joinToString(""))
        buffer.clear()
    }
}

fun main(args: Array<String>) {
    Input.int()
    val a = Input.int()
    val b = Input.int()
    val s = Input.next()

    var c1 = 0
    var c2 = 0

    for (c in s) {
        if ((c == 'a') && (c1 < a+b)) {
            Out.writeln("Yes")
            c1++
        } else if ((c == 'b') && (c1 < a+b) && (c2 < b)) {
            Out.writeln("Yes")
            c1++
            c2++
        } else {
            Out.writeln("No")
        }
    }

    Out.flush()
}

Measured memory_bytes: 47840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979323846
#define fi first
#define se second

ll mod = 1e9+7;
		
ll max(ll a, ll b ) {
	if(a>b)
		return a;
	else return b;
}
ll min(ll a, ll b ) {
	if(a<b)
		return a;
	else return b;
}

ll gcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = gcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}
vector<ll> factorial;
ll inv(ll a) {
	ll x, y;
	ll g = gcd(a, mod, x, y);
	x = (x % mod + mod) % mod;
	return x;
}
ll binpow(ll a, ll b) {
    a %= mod;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a%mod;
        a = a * a%mod;
        b >>= 1;
    }
    return res;
}

ll CC(ll n, ll k) {
    return factorial[n] * inv(factorial[k]) % mod * inv(factorial[n - k]) % mod;
}


void fill_factorial(ll n) {
    factorial.resize(n+1);
    factorial[0] = 1;
    for(ll i=1; i<=n; i++) factorial[i] = (factorial[i-1]*i)%mod;
}

int main() {
	ll tttt; 
	//cin>>tttt;
	tttt = 1;
    while(tttt--) { 	
		ll s; cin>>s;
		//ll dp[s+1][s+1];
		//memset(dp,0,sizeof(dp));
		vector<vector<ll>> dp(s+1,vector<ll> (s+1,0));
		//dp[3][3] = 1;
		 //dp[0][0] = 1;
		ll arr[s+1]; memset(arr,0,sizeof(arr));
		arr[0] = 1;
		for(int i=3; i<=s; i++) {
			for(int j=3; j<=s; j++) {
				if(i<j) continue;
				dp[i][j] = (dp[i][j] + arr[i-j])%mod; 
			}
			for(int j=1; j<=s; j++) arr[i] = (arr[i] + dp[i][j])%mod;
		}
		ll ans = 0;
		for(int i=3; i<=s; i++) ans = (ans + dp[s][i])%mod;
		cout<<ans;
    } 
    return 0; 
}

Measured memory_bytes: 34672
#include<iostream>
int R,C,s[10000][10],f[10],N,i,j,n,m;void rec(int k){if(k==R){for(n=i=0;i<C;i++,n+=m>R-m?m:R-m)for(m=j=0;j<R;j++)m+=s[i][j]^f[j];N=N>n?N:n;return;}f[k]=0;rec(k+1);f[k]=1;rec(k+1);}main(){for(;std::cin>>R>>C,R;rec(0),std::cout<<N<<"\n")for(j=R;j-->0;)for(i=C;i-->0;)std::cin>>s[i][j];}

Measured memory_bytes: 1252
<?php
	$w = trim( strtolower( fgets( STDIN ) ) );
	$cnt = 0;
	while( FALSE != ($inputs = fgets( STDIN )) ) {
		$strs = explode( " ", trim( strtolower( $inputs ) ) );
		$size = count( $strs );
		for( $i=0; $i<$size; $i++ ) {
			$t = $strs[$i];
			if( $w == $t ) {
				$cnt++;
			}
		}
	}
	print $cnt;
?>

Measured memory_bytes: 15316
// https://atcoder.jp/contests/abc153/tasks/abc153_b

#include <bits/stdc++.h>
using namespace std;
int main() {
    #define int long long
    int H, N;
    cin >> H >> N;

    int sum = 0;
    for(int i = 0; i < N; i++) {
        int a;
        cin >> a;

        sum += a;
    }

    if(sum >= H) {
        cout << "Yes" << endl; 
    } else {
        cout << "No" << endl;
    }
}

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

int main() {
    int n;
    cin >> n;
    
    deque<int> q;
    for (int i = 1; i <= n; ++i) {
        int x;
        cin >> x;
        if (i & 1) q.push_back(x);
        else q.push_front(x);
    }
    
    if (n & 1) reverse(q.begin(), q.end());
    
    for (int x : q) cout << x << ' ';
    cout << endl;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
#include<iostream>
#define ll long long
#define regi register int
using namespace std;
ll m,k;
void spj_m1()
{
    if (k==0) cout<<"0 0 1 1"<<endl;
        else cout<<"-1"<<endl;
    exit(EXIT_SUCCESS);
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>m>>k;
    if (m==1) spj_m1();
    if (k>((1<<m)-1))
    {
        cout<<"-1"<<endl;
        return 0;
    }
    cout<<k;
    for (regi i=0;i<=((1<<m)-1);i++)
    {
        if (i==k) continue;
        cout<<" "<<i;
    }
    cout<<" "<<k;
    for (regi i=((1<<m)-1);i>=0;i--)
    {
        if (i==k) continue;
        cout<<" "<<i;
    }
    return 0;
}

Measured memory_bytes: 1792