akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main()
{
	double a,b;
	while(scanf("%lf%lf",&a,&b)!=EOF){
		if(a<35.5&&b<71.0){
			printf("AAA\n");
		}else if(a<37.5&&b<77.0){
			printf("AA\n");
		}else if(a<40.0&&b<83.0){
			printf("A\n");
		}else if(a<43.0&&b<89.0){
			printf("B\n");
		}else if(a<50.0&&b<105.0){
			printf("C\n");
		}else if(a<55.0&&b<116.0){
			printf("D\n");
		}else if(a<70.0&&b<148.0){
			printf("E\n");
		}else{
			printf("NA\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2644
import java.lang.*;
import java.util.*;
import java.io.*;

public class Main
{
	public static void main (String[] arg)throws IOException
	{
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String line;
		line = input.readLine();
		String[] words = line.split(" ");
		int[] sum= new int[words.length];
		String max=null;
		String max2=null;
		int max3=0;
		for (int i=0 ; i<words.length ; i++){
			for(int j=0; j < words.length; j++){
				if(words[i].equals(words[j])){
					sum[i]++;						
				}
			}
		}
		max=words[0];
		for (int i=0; i < words.length;i++){
			if(max3 < sum[i]){
				max3=sum[i];
				max2=words[i];
			}
			if(max.length() < words[i].length()){
				max=words[i];
			}
		}
		System.out.println(max2+" "+max);
	}
}	

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

using namespace std;

#define MAX_V 100000
#define MAX_LOG_V 100

vector<int> G[MAX_V];
int root;
int deg[MAX_V];

int parent[MAX_LOG_V][MAX_V];  
int depth[MAX_V];

void dfs(int v,int p,int d){
  parent[0][v] = p;
  depth[v] = d;
  for(int i = 0 ; i < (int)G[v].size() ; i++){
    if(G[v][i] != p){
      dfs(G[v][i],v,d+1);
    }
  }
}

int getRoot(int V){
  for(int i = 0 ; i < V ; i++){
    if(deg[i] == 0){
      return i;
    }
  }
  return -1;
}

void init(int V){
  root = getRoot(V);
  dfs(root,-1,0);
  for(int k = 0 ; k + 1 < MAX_LOG_V ; k++){
    for(int v = 0 ; v < V ; v++){
      if(parent[k][v] < 0){
        parent[k+1][v] = -1;
      }else{
        parent[k+1][v] = parent[k][parent[k][v]];
      }
    }
  }
}

int lca(int u,int v){
  if(depth[u] > depth[v]){
    swap(u,v);
  }
  for(int k = 0 ; k < MAX_LOG_V ; k++){
    if((depth[v] - depth[u]) >> k & 1){
      v = parent[k][v];
    }
  }
  if(u == v){ return u; }
  for(int k = MAX_LOG_V-1 ; k >= 0 ; k--){
    if(parent[k][u] != parent[k][v]){
      u = parent[k][u];
      v = parent[k][v];
    }
  }
  return parent[0][u];
}

int main(){
  int N,K,x;
  cin >> N;
  for(int i = 0 ; i < N ; i++){
    cin >> K;
    for(int j = 0 ; j < K ; j++){
      cin >> x;
      G[i].push_back(x);
    }
  }
  init(N);
  int Q,a,b;
  cin >> Q;
  for(int i = 0 ; i < Q ; i++){
    cin >> a >> b;
    cout << lca(a,b) << endl;
  }
  return 0;
}

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

int main(){
  
  int A,B,K;
  cin >> A >> B >> K;
  
  //A,B両方割り切れる数を大きい順から数えた個数
  int cnt = 0;
  
  for(int i = min(A,B) ; i >=1 ; --i){
    if(A % i == 0 && B % i == 0){
        cnt++;
       if(cnt == K){
         cout << i << endl;
       }
    }
  }
  return 0;
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
const double PI=3.14159265358979323846;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
int main(void){
    int n,m;cin>>n>>m;
    int sum=0,tmp;
    rep(i,m){cin>>tmp;sum+=tmp;}
    co(max(n-sum, -1));
}



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

using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<int>x(1+N);
    for(int i=1;i<=N;i++)cin>>x[i];
    int ans=0;
    for(int i=1;i<=N;i++){
        if(i<x[i] && x[x[i]]==i)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
#include <deque>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
typedef map<int,int> mint;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef deque<pair<ll,ll>> dep;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=1e9+1000;
ll infi=1e18+100;

//x=10111;
//x<<2 = 1011100 (右シフト),x>>2 = 101 (左シフト)
//(x>>2)&1 = 101 & 001 = 1
//iビット目は、(x>>i) & 1 でわかる(x>>i)%2 でもよい

int H,W;
int c[15][15];
int A[230][230];

void wf(){
	Rep(k,10){
		Rep(i,10){
			Rep(j,10){
				c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
			}
		}
	}
}


int main(){
	cin>>H>>W;
	Rep(i,10) Rep(j,10) cin>>c[i][j];
	Rep(i,H) Rep(j,W) cin>>A[i][j];
	int ans=0;
	wf();
	Rep(i,H){
		Rep(j,W){
			if(A[i][j]!=-1){
				ans+=c[A[i][j]][1];
			}
		}
	}
	cout<<ans<<endl;
	  return 0;
  }


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  ll a[N];
  for(int i=0;i<N;i++) cin >> a[i];
  sort(a, a+N);

  ll sum[N+1];
  sum[0] = 0LL;
  for(int i=1;i<=N;i++) sum[i] = sum[i-1] + a[i-1];

  ll ans = 1LL;
  for(int i=N-1; i>=0; i--){
    if(sum[i] * 2 >= a[i]) ans++;
    else break;
  }

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

Measured memory_bytes: 1792
def solve(yy, mm):
    if 1 <= yy <= 12:
        if 1 <= mm <= 12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1 <= mm <= 12:
            return 'YYMM'
        else:
            return 'NA'


s = input()
yy = int(s[:2])
mm = int(s[2:])
print(solve(yy, mm))


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

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

typedef pair<int, int> pint;

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front

#define MOD (1000 * 1000 * 1000 + 7)

bool is_ok(int n, int W) {
    REP(i, W) {
        int b = 0b11 << i;
        if ((n & b) == b) {
            return false;
        }
    }

    return true;
}

signed main() {
    int H, W, K;
    cin >> H >> W >> K;

    vector< vector < int >> dp;
    dp.assign(H+1, vector<int>(W, 0));

    if (W == 1) {
        cout << 1 << endl;
        return 0;
    }

    dp[0][0] = 1;

    int N = 1 << (W - 1);
    REPS(h, H) {
        REP(n, N) {
            if (is_ok(n, W) == false) continue;

            REP(i, W) {
                if ((n >> i) & 1) {
                    dp[h][i] += dp[h-1][i+1];
                } else if (i > 0 && (n >> (i - 1)) & 1) {
                    dp[h][i] += dp[h-1][i-1];
                } else {
                    dp[h][i] += dp[h-1][i];
                }
                dp[h][i] %= MOD;
            }
        }
    }

    cout << dp[H][K-1] << endl;

    return 0;
}

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

using namespace std;

int n;
string s;

int imosr[4001];
int imosg[4001];
int imosb[4001];

int ctob(char c) {
    switch (c) {
    case 'R':
        return 1;
    case 'G':
        return 2;
    case 'B':
        return 4;
    }
}

int main() {
    cin >> n;
    cin >> s;
    for (int i = 0; i < n; i++) {
        imosr[i + 1] = s[i] == 'R' ? imosr[i] + 1 : imosr[i];
        imosg[i + 1] = s[i] == 'G' ? imosg[i] + 1 : imosg[i];
        imosb[i + 1] = s[i] == 'B' ? imosb[i] + 1 : imosb[i];
    }

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        int bit = 0;
        bit |= ctob(s[i]);
        for (int j = i + 1; j < n; j++) {
            if (bit & ctob(s[j])) continue;
            bit |= ctob(s[j]);
            int excluded_idx = j + (j - i);
            switch (bit) {
            case 6:
                ans += imosr[n] - imosr[j + 1];
                if (excluded_idx < n && s[excluded_idx] == 'R') ans--;
                break;
            case 5:
                ans += imosg[n] - imosg[j + 1];
                if (excluded_idx < n && s[excluded_idx] == 'G') ans--;
                break;
            case 3:
                ans += imosb[n] - imosb[j + 1];
                if (excluded_idx < n && s[excluded_idx] == 'B') ans--;
                break;
            default:
                cerr << "ERROR" << endl;
                return 1;
            }
            bit ^= ctob(s[j]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <string.h>
int main(void){
	int rep=0;
	char arr[100000+1];
	scanf("%s", &arr);
	int tam =strlen(arr);
	for(int p=0;p<tam;p++){
		if (arr[p]==arr[p+1])
			rep++;
			if(arr[p]=='0')arr[p+1]='1';
			else arr[p+1]='0';
	}
	printf("%d\n", rep);
	return 0;
} 

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

const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

long double a, b, x;

void input() {
    cin >> a >> b >> x;
}

long double f(long double a, long double b, long double x) {
    long double ans;
    if(a * a * b / 2.0 <= x) {
        ans = atan(2 * (a * a * b - x) / (a * a * a));
    } else {
        ans = PI / 2 - atan(2 * x / (a * b * b));
    }
    return ans;
}

void solve() {
    input();
    cout << fixed << setprecision(10) << f(a, b, x) * 180.0 / PI << endl;
    return;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>                                                                                               
 
using namespace std;
 
 
long long a[100000050];
int main()
{
    long long s;
    cin >> s;
    long long cnt = 1;
    while(true)
    {
        cnt++;
        a[s] = 1;
        if(s % 2 == 1) 
            s = s * 3 + 1;
        else
            s = s/2;
        
        if(a[s] == 1)
        { 
            cout << cnt << '\n';
            break;
        }
    }   
    return 0;
}


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

int a[7][7];
bool vis[7][7];
int ans[7];

int r[4][7] = {
	{0, 3, 2, 6, 4, 1, 5},
	{0, 4, 1, 3, 6, 5, 2},
	{0, 5, 2, 1, 4, 6, 3},
	{0, 2, 6, 3, 1, 5, 4}
};

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};

void dfs(int i, int j, vector <int> v) {
	vis[i][j] = 1;
	ans[v[1]] = a[i][j];
	/*
	cout << "------\n";
	cout << i << ' ' << j << '\n';
	for(int i = 1; i <= 6; i ++)
		cout << v[i] << ' ';
	cout << '\n';
	*/
	for(int k = 0; k < 4; k ++) {
		int ni = i + di[k];
		int nj = j + dj[k];
		vector <int> u(7);
		for(int t = 0; t < 7; t ++)
			u[t] = v[r[k][t]];
		if(!vis[ni][nj] && a[ni][nj])
			dfs(ni, nj, u);
	}
}

int main() {
	ios :: sync_with_stdio(false);
	int t; cin >> t;
	while(t --) {
		for(int i = 1; i <= 5; i ++)
			for(int j = 1; j <= 5; j ++)
				cin >> a[i][j];
		bool f = 1;
		for(int k = 1; k <= 6; k ++) {
			int c = 0;
			for(int i = 1; i <= 5; i ++)
				for(int j = 1; j <= 5; j ++)
					c += a[i][j] == k;
			f &= c == 1;
		}
		if(!f) {
			cout << "false\n";
			continue;
		}
		fill(ans, ans + 6, 0);
		memset(vis, 0, sizeof vis);
		for(int i = 1; i <= 5; i ++)
			for(int j = 1; j <= 5; j ++)
				if(a[i][j] == 1) {
					dfs(i, j, {0, 1, 2, 3, 4, 5, 6});
				}
		if(ans[1] + ans[6] == 7 && ans[2] + ans[4] == 7 && ans[3] + ans[5] == 7)
			cout << "true\n";
		else
			cout << "false\n";
	}
	return 0;
}

Measured memory_bytes: 3128
def divisors(n):
    i = 1
    table = set()
    while i * i <= n:
        if not n % i:
            table.add(i)
            table.add(n//i)
        i += 1
    table = list(table)
    return table
from bisect import *
N, M = map(int, input().split())
A = divisors(M)
A.sort()
print(M//A[bisect_left(A,N)])

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


int main() {
    int a,b;
    cin >> a >> b;
    if (a < b) {
         cout << "a < b" << endl;
    } else if (a > b) {
         cout << "a > b" << endl;
    } else {
         cout << "a == b" << endl;}
    return 0;
}



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

#define F 26

typedef struct trieNode{
  int cnt;
  struct trieNode *next[F];
} trie;

trie* newNode(void){
  trie *res=(trie *)malloc(sizeof(trie));
  res->cnt=0;
  int i;
  for(i=0;i<F;i++) res->next[i]=NULL;
  return res;
}

trie* add(trie *r,char *s){
  if(r==NULL) r=newNode();
  r->cnt++;
  if(*s!='\0') r->next[*s-'a']=add(r->next[*s-'a'],s+1);
  return r;
}

int count(trie *r){
  return r==NULL?0:r->cnt;
}

void calc(trie *r,char *s,int *cnt,int *before){
  if(*s=='\0') return;
  int local=r->cnt;
  int i;
  for(i=0;i<F;i++){
    int c=count(r->next[i]);
    local-=c;
    if(*s!='a'+i) cnt[(*s-'a')*F+i]+=c;
  }
  *before+=local;
  calc(r->next[*s-'a'],s+1,cnt,before);
  return;
}

void run(void){
  int n;
  scanf("%d",&n);
  char **sp=(char **)malloc(sizeof(char *)*n);
  char *s=(char *)malloc(sizeof(char)*(400000+n));
  trie *root=NULL;
  char *p=s;
  int i;
  for(i=0;i<n;i++){
    scanf("%s",p);
    root=add(root,p);
    sp[i]=p;
    while(*p!='\0') p++;
    p++;
  }
  int *before=(int *)calloc(n,sizeof(int));
  int *cnt=(int *)calloc(F*F*n,sizeof(int));
  for(i=0;i<n;i++) calc(root,sp[i],cnt+F*F*i,before+i);
  int q;
  scanf("%d",&q);
  while(q--){
    int k;
    char pe[27];
    scanf("%d%s",&k,pe);
    k--;
    int ans=before[k];
    int j;
    for(i=F-1;i>=0;i--){
      for(j=i-1;j>=0;j--){
	ans+=cnt[(k*F+pe[i]-'a')*F+pe[j]-'a'];
      }
    }
    printf("%d\n",ans+1);
  }
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 292352
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    string s;
    cin >> s;
    if(s == "Sunny")cout << "Cloudy" << endl;
    if(s == "Rainy")cout << "Sunny" << endl;
    if(s == "Cloudy")cout << "Rainy" << endl;
    

    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

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

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

func main() {
	var n int
	fmt.Scan(&n)
	sArr := make([]string, n)
	for i := range sArr {
		fmt.Scan(&sArr[i])
	}

	cntBtoA, cntToA, cntBto, cntAB := 0, 0, 0, 0
	for _, s := range sArr {
		switch {
		case s[0:1] == "B" && s[len(s)-1:len(s)] == "A":
			cntBtoA++
		case s[0:1] == "B":
			cntBto++
		case s[len(s)-1:len(s)] == "A":
			cntToA++
		}
		for i := 0; i < len(s)-1; i++ {
			if s[i:i+2] == "AB" {
				cntAB++
			}
		}
	}

	var ans int
	switch {
	case cntToA+cntBto == 0:
		ans = cntAB + maxInt(0, cntBtoA-1)
	default:
		ans = cntAB + cntBtoA + minInt(cntToA, cntBto)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1280
//*******Abhijit Burman***********//
//Jalpaiguri Government Engineering College//

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define MAXX (1000000000000000000+7)
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
ll dx1[] = {1, 1, 0, -1, -1, -1, 0, 1};
ll dy1[] = {0, 1, 1, 1, 0, -1, -1, -1};

ll dx2[] = {1, 0, -1, 0};
ll dy2[] = {0, 1, 0, -1};
ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;
    x = x % p;
    while (y > 0) 
    {
        if (y & 1) 
            res = (res*x) % p;
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n,ll p) 
{ 
    return power(n, p-2, p); 
} 
ll ncrMod(ll n,ll r,ll p) 
{
   if (r==0) 
      return 1;
    ll fac[n+1]; 
    fac[0] = 1; 
    for (ll i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}
// a+b=xor(a,b)+2*(a&b)//

bool isPrime(ll n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
void solve()
{
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll cnt=0;
    for(int i=0;i<n;i++){
        if((i+1)%2==1 && a[i]%2==1){
            cnt++;
        }
    }
    cout<<cnt<<endl;
}


int main()
{
	fio;
// 	#ifndef ONLINE_JUDGE
//     // for getting input from input.txt
//     freopen("input.txt", "r", stdin);
//     // for writing output to output.txt
//     freopen("output.txt", "w", stdout);
// 	#endif
 

	ll t=1;
// 	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <math.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++)
using ll = long long;
using vec = vector<int>;
using vec2 = vector<vector<int>>;

int main(){
    int x, n;
    int f, g;
    cin >> x >> n;
    map<int, int> a;
    rep(i, n){
        int y;
        cin >> y;
        a[y] = i;
    }
    for(int i = x;i <= x+n+3;i++){
        if(a.count(i)){
            continue;
        }else{
            f = i;
            break;
        }
    }
    for(int i = x;i >= x-n-3;i--){
        if(a.count(i)){
            continue;
        }else{
            g = i;
            break;
        }
    }
    if(x-g < f-x){
        cout << g << endl;
    }
    if(x-g > f-x){
        cout << f << endl;
    }
    if(x-g == f-x){
        cout << g << endl;
    }
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", "; a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}

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

    int L, K; cin >> L >> K;
    vvll dp(2, vll(L+1));
    dp[0][0] = 1;
    REP(l, L) {
        dp[0][l+1] += dp[1][l];
        dp[1][l+1] += dp[0][l];
        if (l+K <= L) dp[1][l+K] += dp[0][l];
    }
    ll sum = 0;
    REP(l, L) {
        sum += dp[1][l+1];
    }
    cout << sum << endl;

    return 0;

}



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

#define BR "\n"
#define SP " "

class Euc {
public:
  int a, b, q, x, y;
};
Euc calc(Euc e) {
  if (e.b == 0) {
    e.x = 1;
    e.y = 0;
    return e;
  }

  Euc e2;
  e2.a = e.b;
  e2.b = e.a % e.b;
  e2.q = e.a / e.b;
  e2 = calc(e2);
  e.x = e2.y;
  e.y = e2.x - e2.q * e2.y;
  return e;
}

int main() {
  Euc e;
  cin >> e.a >> e.b;
  e.q = e.a / e.b;
  e = calc(e);
  cout << e.x << SP << e.y << BR;
  return 0;
}


Measured memory_bytes: 3096
a = Array.new(4) { |i| Array.new(13) { |j| false } }
c = [ "S", "H", "C", "D" ]
n = gets.to_i
n.times do
  s, i = gets.split
  case s
  when "S"
    a[0][i.to_i-1] = true
  when "H"
    a[1][i.to_i-1] = true
  when "C"
    a[2][i.to_i-1] = true
  else
    a[3][i.to_i-1] = true
  end
end 

4.times do |i|
  13.times do |j|
    puts "#{c[i]} #{j+1}" unless a[i][j]
  end
end

Measured memory_bytes: 8576
class Main{
    public static void main(String[] a){
       for (int i = 1; i <= 9; i++ ) {
           for (int j = 1; j <= 9; j++ ) {
               int result = i * j;
               System.out.println(String.valueOf(i)+"x"+String.valueOf(j)+"="+String.valueOf(result));
           };
       };
    }
}

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

#define endl "\n"
#define long long long

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

    long int n;
    cin>>n;

    vector<long int> v(n);
    for(long int i = 0; i < n; i++)
        cin>>v[i];

    long int maxEle = *max_element(v.begin(),v.end());
    long int c = count(v.begin(),v.end(),maxEle);

    if(c > 1){
        for(long int i = 0; i < n; i++)
            cout<<maxEle<<endl;
        return 0;
    }
    long int pos = max_element(v.begin(),v.end()) - v.begin();
    v[pos] = -1 * v[pos];

    long int maxEle2 = *max_element(v.begin(),v.end());
    v[pos] = -1 * v[pos];

    for(long int i = 0; i < n; i++)
        if(v[i] == maxEle)
            cout<<maxEle2<<endl;
        else
            cout<<maxEle<<endl;
    return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,t;
  cin>>s>>t;
  int max=s.size();
  int flag=0,i=0;
  for(i=0;i<max;i++){
    if(s.at(i)!=t.at(i)){flag=1;}
  }
  if(flag==0){cout<<"Yes";}
  else{cout<<"No";}
  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, m;
string s;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n;
	rep(i, 1, 9){
		rep(j, 1, 9){
			if(i*j == n){
				print("Yes")
				return 0;
			}
		}
	}
	print("No")
	return 0;
}

Measured memory_bytes: 256
def main():
    H, W = (int(i) for i in input().split())
    A = [input() for i in range(H)]
    L = [[[0]*W for _ in range(H)] for _ in range(4)]
    for di in range(4):
        if di == 0 or di == 1:
            rangeH = range(H)
            rangeW = range(W)
        else:
            rangeH = range(H)[::-1]
            rangeW = range(W)[::-1]

        for h in rangeH:
            for w in rangeW:
                if A[h][w] == "#":
                    continue
                if di == 0:
                    if h-1 < 0 or A[h-1][w] == "#":
                        L[di][h][w] = 1
                    else:
                        L[di][h][w] = L[di][h-1][w] + 1
                elif di == 1:
                    if w-1 < 0 or A[h][w-1] == "#":
                        L[di][h][w] = 1
                    else:
                        L[di][h][w] = L[di][h][w-1] + 1
                elif di == 2:
                    if h+1 > H-1 or A[h+1][w] == "#":
                        L[di][h][w] = 1
                    else:
                        L[di][h][w] = L[di][h+1][w] + 1
                elif di == 3:
                    if w+1 > W-1 or A[h][w+1] == "#":
                        L[di][h][w] = 1
                    else:
                        L[di][h][w] = L[di][h][w+1] + 1
    ans = 0
    for h in range(H):
        for w in range(W):
            v = sum(L[i][h][w] for i in range(4)) - 3
            ans = max(ans, v)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 183128
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <sstream>

using namespace std;

string expr(int x, int y) {
    stringstream ss;
    ss << x << "x" << y << "=" << x*y;
    return ss.str();
}

int main() {
    set<string> c;
    int n = 1e3;
    while (n--) {
        int x = rand() % 9 + 1;
        int y = rand() % 9 + 1;
        c.insert(expr(x, y));
    }
    for (set<string>::iterator it=c.begin(); it!=c.end(); ++it) {
        cout << *it << endl;
    }
    return 0;
}

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

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

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

using namespace std;

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

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

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

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

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

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

int solve()
{
    int a, b, c;

    std::cin >> a >> b >> c;

    swap(a, b);
    swap(a, c);

    cout << a << " " << b << " " << c;

    return 0;
}

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

    return 0;
}

Measured memory_bytes: 256
// AOJ ALDS1_8_A: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_8_A

package main

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

type node struct {
	key                 int
	parent, left, right *node
}

var root *node
var sc = bufio.NewScanner(os.Stdin)

func insert(key int) {
	var y *node
	x := root

	z := &node{key, nil, nil, nil}

	for 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
		}
	}
}

func find(key int) bool {
	// start root node
	x := root
	for x != nil {
		// find key
		if x.key == key {
			return true
		}

		// move node
		if x.key > key {
			x = x.left
		} else {
			x = x.right
		}
	}
	return false
}

func inorder(u *node, list []int) []int {
	if u != nil {
		list = inorder(u.left, list)
		// fmt.Printf(" %v", u.key)
		list = append(list, u.key)
		list = inorder(u.right, list)
	}
	return list
}

func preorder(u *node, list []int) []int {
	if u != nil {
		// fmt.Printf(" %v", u.key)
		list = append(list, u.key)
		list = preorder(u.left, list)
		list = preorder(u.right, list)
	}
	return list
}

func printList(list []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

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

func nextInt() int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func main() {
	var command string
	var n, key int

	fmt.Scanf("%d", &n)

	sc.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		command = nextString()
		switch command {
		case "insert":
			key = nextInt()
			insert(key)
		case "find":
			key = nextInt()
			if exist := find(key); exist {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		case "print":
			printList(inorder(root, []int{}))
			printList(preorder(root, []int{}))
		}
	}
}


Measured memory_bytes: 44992
import java.util.*;

class Queue{
    private int[] que  = new int[10000];
    private int head, tail;

    public void enqueue(int x){
	que[head++]=x;
    }

    public int dequeue(){
	return que[tail++];
    }

    public int getSize(){
	return head-tail;
    }
}

class Main{
    final static int LEN=150;
    final static int NOT_VISIT=-1;

    static int[][] graph = new int[LEN][LEN];
    static int[] d = new int[LEN];

    static Queue que = new Queue();
    static int n, u, k;

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

	//initialize
	for(int i=0; i<d.length; i++)d[i]=NOT_VISIT;

	n=in.nextInt();
	for(int i=0; i<n; i++){
	    u=in.nextInt();
	    k=in.nextInt();
	    //read vartex informetion
	    for(int j=0; j<k; j++){
		graph[u-1][in.nextInt()-1]=1;
	    }
	}

	//bfs
	d[0]=0;
	bfs(0);
	while(que.getSize()!=0){
	    bfs(que.dequeue());
	}

	//print
	for(int i=0; i<n; i++)System.out.println(i+1+" "+d[i]);
    }

    static void bfs(int i){
	for(int j=0; j<n; j++){
	    if(graph[i][j]==1 && d[j]==NOT_VISIT){
		d[j]=d[i]+1;
		que.enqueue(j);
	    }
	}
    }
}

Measured memory_bytes: 13000
void main()
{
    int[] tmp = readln.split.to!(int[]);
    int n = tmp[0], k = tmp[1];
    int[] a = readln.split.to!(int[]);

    int m = a.countUntil(1).to!int;

    int l = (m + k - 2) / (k - 1);
    m = max(m, (k-1)*l);
    int r = (n - m + k - 3) / (k - 1);

    writeln(l + r);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 3972
#define REP(i, t, n)  for (int i = t; i < n; i++)
#define REPI(i, t, n)  for (int i = t; i >= n; i--)
#define ALL(n)        (n).begin(),(n).end()
#include <limits.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <functional>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <numeric>

using namespace std;

typedef bool               BOOL;
typedef short              WORD;
typedef unsigned short     U_WORD;
typedef long               DWORD;
typedef unsigned long      U_DWORD;
typedef long long          QWORD;
typedef unsigned long long U_QWORD;

#define N_MAX (100000)

QWORD N;
QWORD aqwStairs[N_MAX + 1];

void solve_main()
{
	BOOL bYes = true;
	cin >> N;

	REP (i, 1, N + 1) {
		cin >> aqwStairs[i];
	}

	REPI (i, (N - 1), 1) {
		QWORD dwJudge = aqwStairs[i] - aqwStairs[i + 1];
		if (dwJudge <= 1) {
			if (dwJudge == 1) {
				aqwStairs[i]--;
			}
		} else {
			bYes = false;
		}
	}
	if (bYes) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

int main()
{
#ifdef FOR_IDE
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
#endif

	solve_main();
	return 0;
}


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

int main(int argc, const char * argv[]) {
    // insert code here...
    int N, A;
    cin >> N >> A;
    int a = N % 500;
    if (A >= a) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
N,Q = map(int,input().split())
# 親の番号 < 子の番号
edge = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
vertices = [0] * N
for _ in range(Q):
    p,x = map(int,input().split())
    vertices[p-1] += x

from collections import deque

que = deque([(-1,0)])
while que:
    pre,now = que.popleft()
    cost = vertices[now]
    for e in edge[now]:
        if e == pre:
            continue
        vertices[e] += cost
        que.append((now,e))

print(*vertices, sep=" ")

Measured memory_bytes: 62156
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>

template <typename QvQ> inline QvQ Min(QvQ a,QvQ b){if(a<b) return a;return b;}
template <typename QvQ> inline QvQ Max(QvQ a,QvQ b){if(a>b) return a;return b;}

#define inf 2147483647
#define dinf 0x3f3f3f3f
#define llinf 0x3f3f3f3f3f3f3f3f

#define ll long long
#define rei register int
#define inv inline void
#define ull unsigned long long
#define il inline

#define bl putchar(' ')
#define ed putchar('\n')
#define test cout<<"this:" 

#define read2(a,b) read(a),read(b)
#define write2(a,b) write(a),bl,write(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define write3(a,b,c) write(a),bl,write(b),bl,write(c)

template <typename QvQ>inv read(QvQ &x){
	x=0;int f=1;
	char c=getchar();
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	x=x*f;
}
template <typename QvQ>inv write(QvQ x){
	if(x<0) x=-x,putchar('-');
	if(x>9) write(x/10);
	putchar(x%10+48);
}
using namespace std;
#define int long long
const int maxn=1e6+5;
const int mod=998244353;
int n,m;
struct node{
	int l,r,val;
	friend bool operator <(node a,node b){
		if(a.l==b.l) return a.r<b.r;
		return a.l<b.l;
	}
}a[maxn];
int tree[maxn<<2],tag[maxn<<2];
#define ls(u) (u<<1)
#define rs(u) (u<<1|1)
#define mid ((l+r)>>1)
void ps_up(int u)
{
    tree[u]=Min(tree[ls(u)],tree[rs(u)]);
}
void build(int pos,int l,int r){
	tree[pos]=llinf;
	tag[pos]=llinf;
	if(l==r) return;
	build(ls(pos),l,mid);
	build(rs(pos),mid+1,r);
	ps_up(pos); 
}
void ps_dw(int u)
{
    if(tag[u]<tag[ls(u)])
    {
        tree[ls(u)]=Min(tree[ls(u)],tag[u]);
        tag[ls(u)]=tag[u];
    }
    if(tag[u]<tag[rs(u)])
    {
        tree[rs(u)]=Min(tree[rs(u)],tag[u]);
        tag[rs(u)]=tag[u];
    }
    tag[u]=llinf;
}
void asv(int pos,int l,int r,int L,int R,int val)
{
    if(L<=l&&r<=R)
    {
        tag[pos]=Min(tag[pos],val);
        tree[pos]=Min(tree[pos],val);
        return;
    }
    if(tag[pos]!=llinf) ps_dw(pos);
    if(L<=mid) asv(ls(pos),l,mid,L,R,val);
    if(R>mid) asv(rs(pos),mid+1,r,L,R,val);
    ps_up(pos);
}
int query(int pos,int l,int r,int L,int R)
{
    if(L<=l&&r<=R)
    {
        return tree[pos];
    }
    int ret=llinf;
    if(tag[pos]!=llinf) ps_dw(pos);
    if(L<=mid) ret=Min(ret,query(ls(pos),l,mid,L,R));
    if(R>mid) ret=Min(ret,query(rs(pos),mid+1,r,L,R));
    return ret;
}
signed main()
{
	read2(n,m);
	for(rei i=1;i<=m;++i) read3(a[i].l,a[i].r,a[i].val);
	sort(a+1,a+m+1); int pos=0; build(1,1,n); asv(1,1,n,1,1,0);
	for(rei i=1;i<=n;++i){
//		cout<<"dq:",write(i),ed;
		int frm=query(1,1,n,i,i);
//		cout<<"val:",write(frm),ed;
		while(pos<m&&a[pos+1].l<=i){
			++pos;
//			test,write3(a[pos].l,a[pos].r,a[pos].val),ed;
			if(i>=a[pos].l&&i<a[pos].r){
//				cout<<"ggg:",write3(i+1,a[pos].r,frm+a[pos].val),ed;
				asv(1,1,n,i+1,a[pos].r,frm+a[pos].val);
			}
		}
	}
	int temp=query(1,1,n,n,n);
	if(temp==llinf) puts("-1");
	else write(temp);
	return 0;
}

Measured memory_bytes: 12544
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

const ld eps = 1e-10;
int main()
{
	boost;
	ld a, b;
	cin >> a >> b;
	a *= b;
	ll x = a;
	if(x - a > 0) cout << x - 1;
	else cout << x; 
}


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

const int maxn = 100100;
const int inf = 0x3f3f3f3f;

inline int read() {
    register int g = 1; register char ch;
    while(!isdigit(ch = getchar())) if(ch == '-') g = -1;
    register int x = ch ^ '0';
    while(isdigit(ch = getchar())) x = (((x << 2) + x) << 1) + (ch ^ '0');
    return x * g;
}

inline void print(int x) {
    if(x < 0) putchar('-'), x = -x;
    if(x > 9) print(x / 10);
    putchar(x % 10 + '0');
}

int n, T, A, h[maxn];
double a[maxn], b[maxn];

signed main() {
	n = read();
	T = read(), A = read();
	for(int i = 1 ;i <= n; ++i) {
		h[i] = read();
		a[i] = (double)T - (double)h[i] * 0.006;
	}
	for(int i = 1; i <= n; ++i) {
		b[i] = fabs((double)A - a[i]); 
	}
	double minn = 1e10;
	int pos = 0;
	for(int i = 1; i <= n; ++i) {
		if(b[i] < minn) {
			minn = b[i];
			pos = i;
		}
	}
	print(pos);
	return 0;	
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    a = [int(readline()) for _ in range(n)]

    ans = -1
    prev = -1

    for x in a:
        if prev >= x:
            ans += x
            prev = x
        elif prev + 1 == x:
            ans += 1
            prev = x
        else:
            return print(-1)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 80652
import java.util.*

fun main(arr:Array<String>) {
    val (x,y,z,k) = readLine()!!.split(" ").map { it.toInt() }
    val cake1 = readLine()!!.split(" ").map { it.toLong() }.sorted()
    val cake2 = readLine()!!.split(" ").map { it.toLong() }.sorted()
    val cake3 = readLine()!!.split(" ").map { it.toLong() }.sorted()

    val cake12 = PriorityQueue<Long>()
    for(i in cake1) {
        for(j in cake2) {
            cake12.add((i+j)*-1)
        }
    }
    val cake123 = PriorityQueue<Long>()
    for(i in (0 until k)) {
        val tmp = cake12.poll()
        for(j in cake3){
            cake123.add(tmp - j)
        }
        if(cake12.isEmpty()) {
            break
        }
    }
    for(i in (0 until k)) {
        println(cake123.poll()*-1)
    }
}

Measured memory_bytes: 230812
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = 1
count = 0

a,b=map(int,input().split())
if a>b:
    print(a-1)
else:
    print(a)

Measured memory_bytes: 38256
#include<stdio.h>
int main(void) {
	int a, b, c;

	scanf("%d %d %d", &a, &b, &c);

	if (a == 7 || b == 7 || c == 7) {
		if ((a == 5 && b == 5) || (b == 5 && c == 5) || (c == 5 && a == 5)) {
			puts("YES");
			return 0;
		}
	}
	puts("NO");

	return 0;
}

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

class A
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split(' ');
        long N = long.Parse(s[0]);
        long K = long.Parse(s[1]);

        List<long> A = new List<long>();
        string[] ss = Console.ReadLine().Split(' ');

        for (int i = 0; i < N; i++)
        {
            A.Add(long.Parse(ss[i]));
        }

        A.Sort();

        if (N <= K)
        {
            Console.WriteLine("0");
            return;
        }

        long count = 0;

        for (long i = (N - K - 1); i >= 0; i--)
        {
            count += A[(int)i];
        }

        Console.WriteLine(count);
    }
}

Measured memory_bytes: 33792
def solve(string):
    n = int(string)
    d = [0] * (n + 1)
    for i in range(2, n + 1):
        t = i
        for j in range(2, i + 1):
            while t % j == 0:
                d[j] += 1
                t //= j

    def f(n):
        return len(list(filter(lambda x: x >= n - 1, d)))

    f3, f5 = f(3), f(5)
    return str(f(75) + f(25) * (f3 - 1) + f(15) * (f5 - 1) + f5 * (f5 - 1) // 2 * (f3 - 2))


if __name__ == '__main__':
    print(solve(input()))


Measured memory_bytes: 3064
using System;

namespace abc096a
{
    class Abc096a
    {
        static void Main(string[] args)
        {
            var buffer = Console.ReadLine().Split();
            var a = uint.Parse(buffer[0]);
            var b = uint.Parse(buffer[1]);
            Console.WriteLine(a>b?a-1:a);
        }
    }
}


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

int main() {
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    set<int> sugarS;
    set<int> waterS;
    int i, j;
    for(i = 0; i < 31; i++) {
        for(j = 0; j < 16; j++) {
            int water = i*a*100 + j*b*100;
            if (water <= f) {
                waterS.insert(water);
            }
        }
    }
    for(i = 0; i < 3001; i++) {
        for(j = 0; j < 1501; j++) {
            int sugar = i*c + j*d;
            if (sugar <= f) {
                sugarS.insert(sugar);
            }
        }
    }

    const double lim = (double)e / (100+e);
    double per = -1;
    int ans1 = 0,
        ans2 = 0;
    for(auto sugar : sugarS) {
        for(auto water : waterS) {
            int sum = water + sugar;
            if (sum == 0) {
                continue;
            }
            double x = (double)sugar / sum;
            if (sum <= f && x <= lim && x > per) {
                    per = x;
                    ans1 = sum;
                    ans2 = sugar;
            }
        }
    }
    cout << ans1 << " " << ans2 << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    int n = s.size();
    rep(i, n) {
        if (i==0) continue;
        if (s[i]==s[i-1]) {
            cout << i << " " << i+1 << endl;
            return 0;
        }
    }
    rep(i, n) {
        if (i<=1) continue;
        if (s[i]==s[i-2]) {
            cout << i-1 << " " << i+1 << endl;
            return 0;
        }
    }
    cout << "-1 -1" << endl;

    return 0;
}


Measured memory_bytes: 3712
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int N = 1000;

int max(int s,int t){
if (s>=t) return s;
return t;
}

int lcs(char X[], char Y[], int m ,int n) {
  int c[N + 1][N +1];
  int maxl = 0,i,j;
  strcmp(&X[0], " ");
  strcmp(&Y[0], " ");
  for(i=0;i<=m;i++) c[i][0]=0;
  for(j=0;j<=n;j++) c[0][j]=0;
  for(i = 1;i <=m; i++) {
    for(j = 1;j <=n; j++) {
    if(X[i] == Y[j]) {
      c[i][j] = c[i-1][j-1] + 1;
    }
    else {
      c[i][j] = max(c[i-1][j] , c[i][j-1]);
    }
    maxl = max(maxl,c[i][j]);
  }
}
return maxl;
}

int main() {
  char s1[1001],s2[1001];
  int i,n;
  scanf("%d\n", &n);
  for (i=0;i<n;i++) {
    scanf("%s", &s1[1]);
    scanf("%s", &s2[1]);
    printf("%d\n", lcs(s1,s2,(int)strlen(&s1[1]),(int)strlen(&s2[1])));
  }
  return 0;
}

Measured memory_bytes: 4520
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define endl '\n'
#define pii pair<int,int>
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(x) x.begin(),x.end()
#define fill(a,b) memset(a,b,sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n,m; cin>>n>>m;
    n=(n*(n-1))/2;
    m=(m*(m-1))/2;
    cout<<n+m<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
long long a,b;
long long d,r;
double f;
scanf("%lli %lli",&a,&b);
d = a/b;
r = a%b;
f= (double)a/b;
printf("%lli %lli %.5lf\n",d,r,f);
return 0;
}



Measured memory_bytes: 2116
n = int(input())
l = [[0, 0, 0]] + list(list(map(int, input().split())) for i in range(n))

for i in range(1, n+1):
    dt = l[i][0] - l[i-1][0]
    dx = abs(l[i][1] - l[i-1][1])
    dy = abs(l[i][2] - l[i-1][2])
    
    tmp = dt - dx - dy
    if tmp < 0 or tmp % 2 == 1:
        print('No')
        break
else:
    print('Yes')


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

string s;

int main(void){
	cin >> s;
	vector<int> c(30);
	rep(i, s.size()) c[s[i]-'a']++;
	char ans = '#';
	rep(i, 26) if(c[i] == 0){
		ans = 'a'+i;
		break;
	}
	if(ans == '#') cout << "None" << endl;
	else cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
n = gets.to_i
goal = gets.split.map(&:to_i)
now  = Array.new(n, 0)
count = 0

for left in 0 .. n - 1
  while now[left] < goal[left]
    x = left
    while now[x] < goal[x]
      now[x] += 1
      if x < n - 1
        x += 1
      else
        break
      end
    end
    count  += 1
  end
end

puts count


Measured memory_bytes: 1788
from math import gcd 
n=int(input())
mod = 10**9+7
count = {}

num=0
for _ in range(n):
    a,b = map(int,input().split())
    if a==0 and b==0:
        num+=1
        continue
    if a*b != 0:
        g=gcd(a,b)*(b//abs(b))
    elif a != 0:
        g=a
    else:
        g=b
        
    l=a//g,b//g
    count[l]=count.get(l,0)+1
        
mem=set()
ans=1
for (x,y),z in count.items():
    if x*y==0:
        k=(y,x)
    else:
        k=(-1*x//abs(x)*y,abs(x))
    if k in mem:
        continue
    mem.add((x,y))
    ans*=(pow(2,z)+pow(2,count.get(k,0))-1)
    ans%=mod

print((ans+num-1)%mod)

Measured memory_bytes: 72080