akhauriyash/Code-Regression huggingface dataset:
/*
    AUTHOR : TANMAY SINHA
    INORMATION TECHNOLOGY
    BIT MESRA ,RANCHI
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ld long double
#define ull unsigned long long int
#define ll long long int
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define mp make_pair
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define rep(j,L,R) for(j=L;j<R;j++)
#define per(i,L,R) for(i=L;i>= R;i--)
#define all(con) (con).begin(),(con).end()
#define fi first
#define se second
#define foreach(iter,con) for(auto iter=(con).begin(); iter!=(con).end(); iter++)
#define DEBUG
#ifdef DEBUG
#define deb2(args...) {dbg,args; cerr<<endl;}
#else
#define deb2(args...)
#endif
struct debb{template<typename T> debb& operator,(const T &v){cerr<<v<<" ";return *this;}}dbg;
#define deb1(args...) do {cerr << #args << " : "; dbg,args; cerr << "\n";} while(0)
#define printa(a,L,R) rep(i,L,R) cout << a[i] <<' ';cout<<"\n";
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<typename T>T gcd(T a,T b){if(b==0)return a;else return gcd(b,a%b);}
template<typename T>T lcm(T a,T b){return a/gcd(a,b)*b;}
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=((res%p)*(x%p))%p;y=y>>1;x=(x*x)%p;}return res;}
ll power1(ll x,ll y){ll res=1;while(y>0){if(y&1)res=(res*x);y=y>>1;x=x*x;}return res;}
const ll INF = 1e18l+10;

int main()
{
   SPEED
   ll i,j,h,w;
   cin>>h>>w;
   string s[h];
   for(i=0;i<h;i++)
    cin>>s[i];
    ll dp[h][w];
    memset(dp,0,sizeof(dp));
    for(i=1;i<w;i++)
    {
        if(s[0][i]=='#')
            break;
        dp[0][i]=1;
    }
    for(i=1;i<h;i++)
    {
        if(s[i][0]=='#')
            break;
        dp[i][0]=1;
    }
    for(i=1;i<h;i++)
    {
        for(j=1;j<w;j++)
        {
            if(s[i][j]!='#')
                dp[i][j]= ((dp[i-1][j]%mod+dp[i][j-1]%mod)%mod+dp[i][j]%mod)%mod;
        }
    }
    cout<<dp[h-1][w-1];
}







Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define loop(i,a,b) for(i=a;i<b;i++)
#define rev(i,a,b)  for(i=a;i>=b;i--)
#define itloop(i,a) for(i=a.begin();i!=a.end();i++)
#define ms(a,c)    memset(a,c,sizeof(a))
#define READ(file)  freopen(file, "r", stdin)
#define WRITE(file) freopen(file, "w", stdout)
#define pb(a)    push_back(a)
#define pf(a)    push_front(a)
#define tup(a,b) make_pair(a,b)
#define popb()   pop_back()
#define popf()   pop_front()
#define X        first
#define Y        second
#define LIM      100
#define INF      1000000010
#define SZ       100010

using namespace std;
typedef long long large;
typedef pair<int,int> ii;
typedef deque<int> di;
typedef deque<ii> dii;
typedef di::iterator dit;
typedef vector<int> vi;
typedef set<int> si;
typedef set<large> sl;

int main(){
	large n,x,res=0,ans=0,ck,i;
	scanf("%lld",&n);
	loop(i,0,n){
		scanf("%lld",&x);
		if(res && x>0){
			x++;
			res=0;
		}
		ans+=x/2;
		res=x%2;
	}
	printf("%lld\n",ans);
  return 0;
}

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

int main()
{
	int n;
	cin >> n;
	double a, sum = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		sum += (1 / a);
	}
	
	cout << setprecision(7) << fixed << 1 / sum;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	ll a, b, x; cin >> a >> b >> x;
	ll ans = b / x - (max(0LL, a - 1)) / x;
	if (a == 0)++ans;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;


int main(){
    int S[100];
    int top=0; int cou=0;
    int a,b;
    char s[10] ;
    while( scanf("%s",s)!= EOF){
        if (strcmp(s,"+")==0){
            top --;
            a =S[top+1];
            top--;
            b =S[top+1];
            top++;
            S[top]=a+b;
        }else if(strcmp(s,"-")==0){
            top --;
            a =S[top+1];
            top--;
            b =S[top+1];
            top++;
            S[top]=b-a;
        }else if (strcmp(s,"*")==0){
            top --;
            a =S[top+1];
            top--;
            b =S[top+1];
            top++; 
            S[top]=a*b;
        }else{
            int t = atoi(s);
            top++;
            S[top] = t;
        }
    }
    int ans =S[top];
    printf("%d\n",ans);
    
    return 0;
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline ll read() {
    ll x=0,f=1; char ch=getchar();
    for(;ch<'0'||ch>'9';ch=getchar())
        if(ch=='-')f=-f;
    for(;ch>='0'&&ch<='9';ch=getchar())
        x=x*10+ch-'0';
    return x*f;
}
inline void chkmin( int &a,int b ) { if(a>b) a=b; }
inline void chkmax( int &a,int b ) { if(a<b) a=b; }
#define _ read()
const int N=1e5+5;
ll res[N],ans,sz[N];
int f[N],a[N],b[N];
int n,m;
inline int find( int x ) { return f[x]==x?x:f[x]=find(f[x]); }
int main() {
	n=_; m=_;
	for( int i=1;i<=m;i++ ) {
		a[i]=_; b[i]=_;
	} 
	for( int i=1;i<=n;i++ ) sz[i]=1,f[i]=i;
	for( int i=m;i;i-- ) {
		res[i]=1ll*n*(n-1)/2-ans;
		int fa=find(a[i]),fb=find(b[i]);
		if(fa!=fb) {
			ans+=sz[fa]*sz[fb];
			sz[fa]+=sz[fb];
			f[fb]=fa;
		}
	}
	for( int i=1;i<=m;i++ ) cout<<res[i]<<"\n";
}

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

#ifdef TESTING
  #include "dump.hpp"
#else
  #define DUMP(...)
  #define DEBUG(...)
#endif

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define INT(n) int n;assert(0<scanf("%d",&n))

static const int MAXP = 55555;
vector<int> ps, fs;
void init(){
  fs.reserve(1 + MAXP);
  for(int i = 0; i <= MAXP; i++){fs.push_back(i);}
  for(int i = 2; i <= MAXP; i++){
    if (fs[i] == i){
      ps.push_back(i);
      for (int j = i; j <= MAXP; j += i){
        fs[j] = min(fs[j], i);
      }
    }
  }
}
bool isprime(const long long& n){
  if (n <= MAXP){
    return (1 < n && fs[n] == n);
  } else {
    for(int p: ps){
      if (n % p == 0){return false;}
    }
    return true;
  }
}

int main(){
  init();
  INT(n);
  vector<int> ans;
  int cnt = 0;
  REP(k, 11, 55555, 5){
    if (isprime(k)){
      ans.PB(k);
      cnt++;
    }
    if (cnt == n){
      break;
    }
  }
  for(int e: ans){
    printf("%d ", e);
  } printf("\n");
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(){
	int N, Y, i, j, k;
	scanf("%d%d", &N, &Y);
	for(i = 0; i <= N; i++){
		for(j = 0; i + j <= N; j++){
			k = N - i - j;
			if(10000 * i + 5000 * j + 1000 * k == Y){
				printf("%d %d %d\n", i, j, k);
				return 0;
			}
		}
	}
	printf("-1 -1 -1\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cstring>
#include <queue>
#include <utility>
#include <algorithm>
#define INF 700000000

using namespace std;

vector<pair<int, int>> adj[110];

int solve (int x, int d)
{
    int dst[110];
    bool done[110];
    priority_queue<pair<int, int>> que;
    for (int i=0; i<110; i++) dst[i]=INF;
    memset(done, false, sizeof(done));
    dst[x]=0;
    que.push({0,x});
    while (!que.empty())
    {
        int a=que.top().second;
        que.pop();
        if (done[a]) continue;
        done[a]=true;
        for (auto u : adj[a])
        {
            int b=u.first, w=u.second;
            if (dst[a]+w<dst[b])
            {
                dst[b]=dst[a]+w;
                que.push({-dst[b], b});
            }
        }
    }
    if (dst[d]==INF) return -1;
    else return dst[d];
}

int main()
{
    while (1)
    {
        for (int i=0; i<110; i++) adj[i].clear();
        int n, k, a, b, c, d;
        bool ok;
        cin>>n>>k;
        if (n==0 && k==0) break;
        for (int i=0; i<k; i++)
        {
            cin>>a>>b>>c;
            if (a==0)
            {
                cout<<solve(b,c)<<'\n';
            }
            else
            {
                cin>>d;
                ok=true;
                for (auto itr=adj[b].begin(); itr!=adj[b].end(); itr++)
                {
                    if (itr->first==c)
                    {
                        itr->second=min(itr->second, d);
                        ok=false;
                    }
                }
                if (ok) adj[b].push_back({c,d});
                ok=true;
                for (auto itr=adj[c].begin(); itr!=adj[c].end(); itr++)
                {
                    if (itr->first==b)
                    {
                        itr->second=min(itr->second, d);
                        ok=false;
                    }
                }
                if (ok) adj[c].push_back({b,d});
            }
        }
    }
    return 0;
}



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

int main(){
    string word={"keyence"};
    string S;
    cin>>S;
    
    int N = S.size();
    
    
    if(S.find(word)!=-1){
        cout<<"YES"<<endl;
        return 0;
    }
    
    int i=0,k=0;
    if(S[i]==word[k]){
        while(S[i]==word[k]){
            i++;
            k++;
        }
        
        for(;i<N;i++){
            if(S.substr(i,N-k+1) == word.substr(k,N-k+1)){
                cout<<"YES"<<endl;
                return 0;
            }
        }
        
    }
    
    cout<<"NO"<<endl;
    
    
    
}

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

int main() {
int N;
  cin >> N;
  int count = 0;
  for(int i = 1; i <= 9; i++){
  	for(int j = 1; j <= 9; j++){
    	if(i * j == N){
        	count ++;
        }
    }
  }
  if(count == 0){
  	cout << "No" << endl;
  }
  else cout << "Yes" << endl;
}

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

int main(){

    long long N, M;
    cin >> N >> M;
    vector<long long> X(M);
    for(int i = 0; i < M; i++) cin >> X[i];
    
    sort(X.begin(), X.end());

    vector<long long> diff;
    for (int i = 1; i < X.size(); i++) diff.push_back(X[i] - X[i - 1]);
    sort(diff.rbegin(), diff.rend());

    long long ans = X.back() - X.front();
    for(long long i = 0; i < min((long long)diff.size(), N - 1); i++) ans -= diff[i];

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define endl "\n"
#define mod 1000000007
#define INF 1e18
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define w(x) int x; cin >> x; while (x--)

using namespace std;
using namespace __gnu_pbds;

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

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

int xpowery(int x, int y)
{
	int ans = 1;
	while (y)
	{
		if (y & 1)
			ans = (ans * x) % mod;
		x = (x * x) % mod;
		y = y / 2;
	}
	return ans;
}

const int N = 1e5 + 5;
int h[N], n;

int cache[N];

int solve(int m)
{
	if (m > n)
		return cache[m] = 1e9;

	if (m == n)
		return cache[m] = 0;

	if (cache[m] != -1)
		return cache[m];

	return cache[m] = min(abs(h[m] - h[m + 1]) + solve(m + 1), abs(h[m] - h[m + 2]) + solve(m + 2));
}

int32_t main()
{
	IOS;
	//rwf();

	cin >> n;

	memset(cache, -1, sizeof(cache));

	for (int i = 1; i <= n; i++)
	{
		cin >> h[i];
	}

	int ans = solve(1);

	cout << ans;

	return 0;
}

Measured memory_bytes: 3328
x = gets.to_i
if x >= 400 && x <= 599
	puts 8
elsif x >= 600 && x <= 799
	puts 7
elsif x >= 800 && x <= 999
	puts 6
elsif x >= 800 && x <= 999
	puts 6
elsif x >= 1000 && x <= 1199
	puts 5
	elsif x >= 1200 && x <= 1399
	puts 4
	elsif x >= 1400 && x <= 1599
	puts 3
	elsif x >= 1600 && x <= 1799
	puts 2
elsif x >= 1800 && x <= 1999
	puts 1
end

Measured memory_bytes: 14396
#include <stdio.h>
#define N 100

int main(){
  int i, j, n, arr[N], tmp, minj, count = 0;
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%d", &arr[i]);
  }
  
  for(i = 0; i < n; i++){
    minj = i;
    for(j = i; j < n; j++){
      if(arr[j] < arr[minj]) minj = j;
    }

    if(minj != i){
      tmp = arr[i];
      arr[i] = arr[minj];
      arr[minj] = tmp;
      count++;
    }
  }
  
  for(i = 0; i < n - 1; i++){
    printf("%d ", arr[i]);
  }
  printf("%d\n%d\n", arr[i], count);
  
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,s,f) for(i=s;i<f;i++)
#define print(v) for(auto &z:v) cout<<z<<' ';cout<<'\n'
#define db cout<<"db: "
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define all(v) v.B,v.E
#define sz(v) (int)((v).size())
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define clk1 clock_t start_time=clock()
#define clk2 cout<<(clock()-start_time)/(double)CLOCKS_PER_SEC
#define clean(arr) memset(arr,0,sizeof(arr))
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;
    int l,r,d;
    cin>>l>>r>>d;

    cout << r/d - (l-1)/d;
    return 0;
}

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

int main(){
  int n,m;
  ll k;
  cin>>n>>m>>k;
  ll vec[n],vecb[m];
  ll vecsum[n+1],vecbsum[m+1];
  vecsum[0]=0,vecbsum[0]=0;
  for(int i=0;i<n;i++){
    cin>>vec[i];
    vecsum[i+1]=vecsum[i]+vec[i];
  }
  for(int i=0;i<m;i++){
    cin>>vecb[i];
    vecbsum[i+1]=vecbsum[i]+vecb[i];
  }
  int ans=0;
  for(int i=0;i<=n;i++){
    ll time=vecsum[i];
    if(time>k){
      continue;
    }
    ll limit=k-time;
    if(limit>=vecbsum[m]){
      ans=max(ans,i+m);
      continue;
    }
    int ok=0,ng=m;
    for(int i=0;i<40;i++){
      int c=(ok+ng)/2;
      if(limit>=vecbsum[c]){
        ok=c;
      }
      else{
        ng=c;
      }
    }
    ans=max(ans,i+ok);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 9888
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n;
    cin >> n;
    cout << (intl)((n + 1) / 2)/ (ld)n << endl;
    return 0;
}

Measured memory_bytes: 256
import math
s = input()
ss = s.split(" ")
a = int(ss[0])
b = int(ss[1])
x = int(ss[2])

x = x/a

if(x == a*b/2):
    print("{0:.6f}".format(45))
    
elif(x > a*b/2):
    y = a*b - x
    c = y*2/a
    v = math.degrees(math.atan(c/a))
    print("{0:.6f}".format(v))
    
else:
    c = 2*x/b
    v = 90 - math.degrees(math.atan(c/b))
    print("{0:.6f}".format(v))
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define re register
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define lb long double
const int N=1e6+10;
const int mod=10086;
const int mod2=19260811;
void read(int &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
int a[N];
int main()
{
    int k,n;
    read(k),read(n);
    for(re int i=1;i<=n;i++) read(a[i]);
    int maxn=a[1]+k-a[n];
    for(re int i=2;i<=n;i++) maxn=max(maxn,a[i]-a[i-1]);
    printf("%d\n",k-maxn);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (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)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1) << (n))
#define all(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
template <class T>
bool chmax(T& a, const T& b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b)
{
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;


signed main()
{
    int n, k;
    cin >> n >> k;
    std::map<int, int> a;
    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        a[temp]++;
    }
    int now = a.size();
    int out = 0;
    std::vector<int> num;
    auto it = a.begin();
    for (int i = 0; i < now; i++) {
        num.pb(it->second);
        it++;
    }
    std::sort(num.begin(), num.end());
    for (int i = 0; i < now - k; i++) {
        out += num[i];
    }

    cout << out << endl;
    return 0;
}

Measured memory_bytes: 14964
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
#define N 5
using namespace std;

ll a[N];

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

inline void init(){
	REP(i, 1, 3) a[i] = read();
}

inline void work(){
	init();
	sort(a + 1, a + 4);
	if ((a[1] == a[2] && a[2] != a[3]) || (a[2] == a[3] && a[1] != a[2])) puts("Yes");
	else puts("No");
}

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

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

using namespace std;
int main(void)
{
  int n, p;
  string s;
  cin >> n >> p;
  cin >> s;
  long long c;
  
  c = 0;

  if (p == 2 || p == 5) {
    for (int i = n - 1; i >= 0; i--) {
      int ch = (int)(s[i] - '0');
      if (ch % p == 0) {
	c += i + 1;
      }
    }
  } else {
    map<int, int> mm;
    int r = 0;
    int mten = 1;
    for (int i = n - 1; i >= 0; i--) {
      int ch = (int)(s[i] - '0');
      r = (r + ch * mten) % p;
      mten = (mten * 10) % p;
      if (mm.find(r) != mm.end()) {
	c += mm[r];
	mm[r]++;
      } else {
	mm[r] = 1;
      }

      if (r == 0) {
	c++;
      }
    }
  }
  
  cout << c << endl;
  return 0;
}


Measured memory_bytes: 900
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

ll rep_power_modM(ll a, ll n, ll M = MOD){
    if(n == 0)return 1;
    if(n%2 == 0){ll tmp = rep_power_modM(a,n/2,M); return tmp*tmp%M;}
    return a*rep_power_modM(a,n-1,M)%M;
}

int main(){
	int N; cin>>N;
	int cnt_zero = 0;
	map<pair<ll,ll>, P> e_ans;
	rep(i,N){
		ll x,y; cin>>x>>y;
		if(x == 0 && y == 0){ ++cnt_zero; continue;}
		ll g = gcd(x,y);
		x /= g;
		y /= g;
		if(y<0) x = -x, y = -y;
		if(y == 0 && x < 0) x = -x, y = -y;
		bool ch = false;
		if(x<=0){
			ch = true;
			ll t = x;
			x = y; y = -t;
		}
		if(ch)e_ans[{x,y}].first++;
		else e_ans[{x,y}].second++;
	}
	ll ans = 1;
	for(auto x: e_ans){
		int a = x.second.first;
		int b = x.second.second;
		ll e = 1;
		e += rep_power_modM(2,a);
		e += rep_power_modM(2,b); e %= MOD;
		--e; --e;
		e %= MOD;
		ans *= e;
		ans %= MOD;
	}
	--ans;
	ans += cnt_zero;
	ans %=MOD; 
	if(ans < 0)ans += MOD;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 16024
#include<bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
const ll mod = 1000000007;
// const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"
#define TO_STRING(VariableName) # VariableName

template <typename T>ostream &operator<<(ostream &out,const vector<T> &v) {rep(i,(int)v.size()-1)cout<<v[i]<<" ";cout<<v[(int)v.size()-1];return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const map<T1, T2> &p) {out << "(" << p.first << ", " << p.second << ")";return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const pair<T1, T2> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template<class T>void debag(const T &obj){cout<<obj<<endl;}

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

ld f(vector<ll>a){
	sort(all(a));
	ll n=a.size();
	if(n%2==0)return (ld)((ld)a[n/2]+(ld)a[n/2-1])/(ld)2;
	else return a[n/2];
}

bool solve(){
	ll n;cin>>n;
	vector<ll>a(n);
	vector<ll>b(n);
	rep(i,n)cin>>a[i]>>b[i];
	ld x=f(a);
	ld y=f(b);
	ld ans;
	if(n%2==0){
		ans=(y-x)/0.5+1;
	}else 
		ans=(y-x)/1+1;
		
		
		cout<<(ll)ans<<endl;
  	return false;
}




signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(30);
  solve();
}


Measured memory_bytes: 7928
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()
cnt = 0
flag = True
flag_win = 0
def jannkenn(string):
    if string ==  'r':
        return p
    elif string == 'p':
        return s
    elif string == 's':
        return r
for i in range(k):
    last = i
    for j in range(n):
        if i+k*j < n:
            if  j == 0:
                cnt += jannkenn(t[i+k*j])
                #print(i,j)
                flag_win = 1
            elif t[last] != t[i+k*j]:
        #        print(i,j)
                cnt += jannkenn(t[i+k*j])
                flag_win = 1
                
            elif t[last] == t[i+k*j]:
                if flag_win == 0:
                    cnt += jannkenn(t[i+k*j])
                    flag_win = 1
                    
                else:
                    flag_win = 0
                
        else:
            break
        last = i+k*j
print(cnt)

Measured memory_bytes: 3316
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            long a = Long.parseLong(in.next());
            long b = Long.parseLong(in.next());
            long c = Long.parseLong(in.next());
            long k = Long.parseLong(in.next());

            if (k % 2 == 0) out.println(a - b);
            else out.println(b - a);
        }

    }
}



Measured memory_bytes: 24020
#!/usr/bin/ruby
Z=10**9+7
def d(x,y) x.zip(y).reduce(0){|s,(a,b)|s+a*b} end
def mul(x,y)
	y=y.transpose
	[[d(x[0],y[0])%Z,d(x[0],y[1])%Z],[d(x[1],y[0])%Z,d(x[1],y[1])%Z]]
end
def pow(x,y)
	z=1
	while y>0
		z=z*x%Z if y%2>0
		x=x*x%Z
		y/=2
	end
	z
end
H,W,K=gets.split.map(&:to_i)
if K==0
	p 1
	exit
end
K-=1
M=$<.map{|e|e.chomp.chars}
c=M.count{|s|s[0]=='#'&&s[-1]=='#'}
d=M.transpose.count{|s|s[0]=='#'&&s[-1]=='#'}
if c>0&&d>0
	p 1
	exit
end
if d>0
	c,d=d,c
	M=M.transpose
H,W=W,H
end
a=b=0
M.each{|s|W.times{|i|
	a+=1 if s[i]=='#'
	b+=1 if i<W-1&&s[i]=='#'&&s[i+1]=='#'
}}
if c==0&&d==0
	p pow(a,K)
	exit
end
 
#848924
a=a*pow(c,Z-2)%Z
b=b*pow(c,Z-2)%Z
if a==1
	B=(1-b*(K%Z))%Z
else
	C=(1-b*pow(a-1,Z-2))%Z*pow(a,K)%Z
	B=(C+b*pow(a-1,Z-2))%Z
end
p B*pow(c,K)%Z

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

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

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

    int64_t area=1,x=-1,y=-1;
    int c=0;
    for(i=0;i<n-1;i++)
    {
        if(c==2)break;
        if(a[i]==a[i+1])
        {
            c++;
            area*=a[i];
            i++;
        }
    }
    if(c<2)cout<<0<<endl;
    else cout<<area<<endl;
}


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int n;
	cin >> n;
	int a = 0, b = 0, c = 0;
	for(int i = 0; i < n; i++) {
		long long t;
		cin >> t;
		if(t % 4 == 0) {
			a++;
		}
		if(t % 4 == 1 || t % 4 == 3) {
			b++;
		}
	}
	if(a + b == n) {
		if(b <= a + 1) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		if(b <= a) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	
	return 0;	
}


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

#define rep(i, a) for (int i = 0; i < (a); i++ )
#define FOR(i, m, n) for(int i = m; i < n; i++)
 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> A;
    rep(i,N) {
        int a;
        cin >> a;
        A.push_back(a);
    }
    sort(A.begin(),A.end());
    ll ans = 0;

    rep(i,K) {
        ans+=A[i];
    }
    cout << ans << endl;
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const ll Nmax=1e9;
const ll INF=1e9;

int intpow(int a,int b){
  int out=1;
  rep(i,b){
    out*=a;
  }
  return out;
}

int main(){
  int h,w,k;
  cin>>h>>w>>k;
  vector<string> c(h);
  rep(i,h){
    cin>>c[i];
  }

  int Ncase;
  Ncase=intpow(2,h+w);
  int ans=0;

  rep(ic,Ncase){
    int nblack=0;
    rep(i,h){
      rep(j,w){//c[i][j]を考える．
        if(c[i][j]=='.'){
          continue;
        }
        if((ic>>i)&1 || (ic>>(j+h))&1){
          continue;
        }
        nblack++;
      }
    }

    if(nblack==k){
      ans++;
    }


  }

cout<<ans<<endl;


}


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

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

  string T="CODEFESTIVAL2016";
  int ans=0;
  for(int i=0;i<S.size();i++) if(S.at(i)!=T.at(i))  ans++;
  cout << ans << endl;

  return 0;
}

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

int main() {
    int x,y;
    cin >> x >> y;
    cout << x + y/2 << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

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


#define sz(a)             int((a).size())
#define tr(c,i)           for(auto i = (c).begin(); i != (c).end(); i++)
#define trr(c,i)          for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define present(c,x)      ((c).find(x) != (c).end())
#define cpresent(c,x)     (find(all(c),x) != (c).end())
#define pb                push_back
#define all(x)            (x).begin(),(x).end()
#define ll                long long
#define fr                first
#define sc                second
#define M                 1000007
#define PI 3.14159265358979323846

int solve()
{
    int a;
    cin>>a;
    cout<<a+a*a+a*a*a;
    return 0;
}

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

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

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

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

int main(){
    int X,Y;
    cin >> X >> Y;
    for(int i=0;i<=X;i++){
        for(int j=0;i+j<=X;j++){
            if(i+j==X&&2*i+4*j==Y){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3648
import bisect

def main():
    N = int(input())
    A = sorted([int(i) for i in input().split()])
    B = sorted([int(i) for i in input().split()])
    C = sorted([int(i) for i in input().split()])

    counter = 0
    for b in B:
        a_count = bisect.bisect_left(A, b)
        c_count = N - bisect.bisect_right(C, b)
        counter += a_count*c_count
            

    print(counter)

if __name__ == "__main__":
    main()


Measured memory_bytes: 23240
H, W = map(int, input().split())
C = [list(input()) for _ in range(H)]

A = [[""]*W for _ in range(2*H)]
for i in range(2*H):
    for j in range(W):
        A[i][j] = C[i//2][j]

for a in A:
    print("".join(a))

Measured memory_bytes: 3316
#include <cstdio>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <cstdlib>
#include <iostream>
#include <cmath>

using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)

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

  int a, b;
  cin >> a >> b;
  int sum = 0;
  rep (i, 1000) {
    sum += i;
    if (b - a == i) {
      cout << sum - b << endl;
    }
  }

  return 0;
}


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

int main() {
   int a, b, c;
   cin >> a >> b >> c;
   cout << max(a, max(b,c)) - min(a, min(b,c)) << endl;

}


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

using namespace std;

#define MAX 200

struct Point{
  int x, y;

  bool operator < (const Point p)const{
    if(x != p.x){
      return x < p.x;
    }else{
      return y < p.y;
    }
  }
};

int n, m;
Point star[MAX], pict[MAX*5];

Point search(){
  Point res;
  vector<Point> v;

  for(int i = 0 ; i < m ; i++){
    for(int j = 0 ; j < n ; j++){
      Point P;
      P.x = pict[j].x - star[i].x;
      P.y = pict[j].y - star[i].y;
      v.push_back(P);
    }
  }
  sort(v.begin(),v.end());

  int cnt = 1;
  Point p = v[0];
  for(int i = 1 ; i < (int)v.size() ; i++){
    if(cnt == m){
      res = p;
      break;
    }

    if(p.x != v[i].x || p.y != v[i].y){
      p = v[i];
      cnt = 1;
    }else{
      cnt++;
    }
  }

  return res;
}

int main(){
  while(cin >> m, m){
    for(int i = 0 ; i < m ; i++){
      cin >> star[i].x >> star[i].y;
    }

    cin >> n;
    for(int i = 0 ; i < n ; i++){
      cin >> pict[i].x >> pict[i].y;
    }

    Point p = search();
    cout << p.x << " " << p.y << endl;
  }

  return 0;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


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

  vector<double> a(n);
  
  cin >> a;

  double ans = 0;
  for (ll i = 0; i < n; i++)
  {
    ans+= 1.0/a[i];
  }
  ans = 1.0 / ans;

  cout<< setprecision(7)<< fixed <<ans<<endl;

}


Measured memory_bytes: 256
(function() {
    'use strict';

    var lines = [];
    require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    }).on('line', function(line) {
      lines.push(line);
    });
    process.stdin.on('end', function() {
      //lines.forEach(function(line) {
        //var tokens = line.split(' ').map(Number);
        //    console.log(tokens[0] + ' ' + tokens[1]);
      //}
      //)
      ;

    // ToDo start
      //var line2token = lines[1].split(" ")
      var N = lines[0]
      var K = lines[1]
      var X = lines[2].split(" ")
      var total = 0

      for(var i=0;i<N;i++){
          total += Math.min(Math.abs(X[i]*2),Math.abs((X[i]-K)*2))
      }
      console.log(total)
      
//      console.log( Math.pow(parseInt(lines[0]),2) - parseInt(lines[1])  )
    // ToDo end

    });


})();



Measured memory_bytes: 7756
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
ll n,m,k,ans;
string s,t;
const ll powll = 1LL<<1;

bool cmp(P a, P b){
  return a.first+a.second < b.first+ b.second;
}

int main(void){
  int a,b; cin >> a >> b;
  string s = "";
  if(a > b){
    rep(i,a) s += b + '0';
  }else{
    rep(i,b) s += a + '0';
  }
  cout << s << "\n";
}

Measured memory_bytes: 256
import numpy as np

X = int(input())

nextprime = 0
i = -1

if X >= 4:
  while nextprime == 0:
    i += 1
    amari = 1
    maxnumber = int(np.sqrt(X+i))
    for j in range(2, maxnumber + 1):
      if ((X+i)/j) % 1 == 0:
        amari = 0
        break
    if amari == 1:
      nextprime = X+i  
  
  print(X+i)
  
else:
  print(X)

Measured memory_bytes: 12428
#include<iostream>
#include<algorithm>
#include<vector>
#define lamba ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define all(x) x.begin(), x.end()
using namespace std;

const int zyan = 1e2 + 1;

int n, a[105], mn = zyan, mx = -zyan;

int fast() {
cin >> n;

for(int i=1;i<=n;i++){
cin >> a[i];
mn = min(mn, a[i]);
mx = max(mx, a[i]);
}
/*
int checker = 0;

for(int i=2;i<=n;i++){
	if(a[i] == a[1])checker++;
}


if(checker == n-1){
cout << 0;
return 0;
}*/

int mid = (mn + mx) % 2 + (mn + mx) >> 1;

int res = 0;

for(int i=1;i<=n;i++){
	if(mid == a[i])continue;
	else res += (a[i] * a[i]) - (a[i] * mid) - (mid * a[i]) + (mid * mid);
}

cout << res;

}

int main(){
lamba;

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

	long long ans = 1e18;

	for (int j = -4000; j <= 4000; ++j) {
		long long cur = 0;
		for (int i = 1; i <= n; ++i) {
			cur += (a[i] - j) * 1ll * (a[i] - j);
		}
		ans = min(ans, cur);
	}
	
	cout << ans;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;
  cin >> a >> b;
  vector<int> c(b);
  for (int i=0; i<b; i++){
    cin >> c.at(i);
  }
  int d = 0;
  for (int i=0; i<b; i++){
    d += c.at(i);
  }
  if (d >= a){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
 
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int time = scan.nextInt();
        
        int h = time / 3600;
        time = time % 3600;
        int m = time / 60;
        time = time % 60;
        
        System.out.println(h + ":" + m + ":" + time);
 
    }
 
}


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

int main(){
  char a, b; cin >> a >> b;
  if(a == 'H' && b == 'H' || a == 'D' && b == 'D') cout << 'H' << endl;
  else cout << 'D' << endl;
  return 0;
}

Measured memory_bytes: 256
# 2020/05/30
# NOMURA プログラミングコンテスト 2020 - B

# Input
t = input()
s = list()

# Calc
for i in range(len(t)):
    if t[i] == '?':
        s.append('D')
    else:
        s.append(t[i])

# Output
print(''.join(s))


Measured memory_bytes: 11016
// Remeber Choose Compiler: GCC9
#include <bits/stdc++.h>

using namespace std;

// Debug Output Utility
#ifdef LOCAL
#define dbg(args...)             \
    do {                         \
        cout << #args << " -> "; \
        err(args);               \
    } while (0)
void err() { std::cout << std::endl; }
template <typename T, typename... Args>
void err(T a, Args... args) {
    std::cout << a << ' ';
    err(args...);
}
template <template <typename...> class T, typename t, typename... A>
void err(const T<t> &arg, const A &... args) {
    for (auto &v : arg)
        std::cout << v << ' ';
    err(args...);
}
#else
#define dbg(...)
#endif

// Macro Definitions:
#define mp make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

// Type Alias:
using int64 = long long;
using PII   = pair<int, int>;

// Global Const Variable
const int64 INF     = 0x3f3f3f3f;
const int MOD       = 1000000007;
const int MAXN      = ((1 << 18) + 5);
const int M         = 200005;
const int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

int64 a[MAXN];

void run() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    int64 ans = 0;
    if (n & 1) {
        ans += a[n / 2] + a[n - 1];
        for (int i = n / 2 + 1; i < n - 1; i++)
            ans += 2 * a[i];
    } else {
        ans += a[n - 1];
        for (int i = n / 2; i < n - 1; i++)
            ans += 2 * a[i];
    }
    cout << ans << endl;
}

// Debug Input Redirection
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    run();
}

Measured memory_bytes: 5204
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const long long INF =  999999999;

ll N,T,l[100019],r[100100],inout[100010];

int main(){
  cin>>N>>T;
  ll ans=0,t=0;
  fill(inout,inout+N,0);
  REP(i,N){
    cin>>l[i]>>r[i];
    inout[l[i]]++;
    inout[r[i]]--;
  }
  REP(i,T){
    t+=inout[i];
    ans=max(t,ans);
  }
  cout << ans<<endl;
}



Measured memory_bytes: 5424
package main

import "fmt"

func main() {
	var N, K int
	fmt.Scan(&N, &K)

	ans := 0
	for b := K + 1; b <= N; b++ {
		ans += (N/b)*(b-K) + relu((N%b - K + 1))
	}
	if K == 0 {
		ans -= N
	}
	fmt.Println(ans)
}

func guchoku() {
	var N, K int
	fmt.Scan(&N, &K)

	ans := 0
	for i := 1; i <= N; i++ {
		for j := 1; j <= N; j++ {
			if j%i >= K {
				ans++
			}
		}
	}
	fmt.Println(ans)
}

func relu(a int) int {
	if a > 0 {
		return a
	}
	return 0
}


Measured memory_bytes: 512
#include <cstdio>
#include <map>
// B - Picking Up

using namespace std;

int x[55],y[55];
map<pair<int,int>,int> m;

int main() {
    int N,i,j,ans,p,q,mx;
    
    scanf("%d",&N);

    for (i = 1;i <= N;i++)
        scanf("%d%d",&x[i],&y[i]);

    for (i = 1;i <= N;i++) {
        for (j = 1;j <= N;j++) {
            if (i != j) {
                p = x[i] - x[j];
                q = y[i] - y[j];
                m[{p,q}]++;
            }
        }
    }

    mx = 0;
    for (pair<pair<int,int>,int> p : m)
        mx = max(mx,p.second);

    printf("%d\n",N - mx);

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Bit_check(val,pos)     (bool)(val & (1ll<<pos))
ll ar[500009],br[500009],cr[500009];
map<ll,ll>mp;
vector<ll>v;
int main()
{
    ll a,b,c,i,j,k=0,x=0,y,z,f;
    string s,d;
    cin>>a;
    for(i=1;i<=a;i++)
    {
        cin>>b;
        if(b%2==0)
        {
            if(b%3==0 || b%5==0)
            {

            }
            else
            {
                k=1;
            }
        }
    }
    if(k==1)
    {
        cout<<"DENIED"<<endl;
    }
    else
    {
        cout<<"APPROVED"<<endl;
    }
}


Measured memory_bytes: 256
module ModInt
  MOD = 998244353

  def to_mod(a); a % MOD; end
  def add(a, b); (a + b) % MOD; end
  def mul(a, b); (a * b) % MOD; end
  def inv(a); a.pow(MOD - 2, MOD); end
  def div(a, b); mul(a, inv(b)); end
end

class FactTable
  include ModInt

  def initialize(n)
    @fact = [1] * (n + 1)
    @finv = [1] * (n + 1)
    2.upto(n) { |i| @fact[i] = mul(@fact[i - 1], i) }
    @finv[n] = inv(@fact[n])
    n.downto(3) { |i| @finv[i - 1] = mul(@finv[i], i) }
  end

  def nCk(n, m)
    mul(mul(@fact[n], @finv[m]), @finv[n - m])
  end
end

n,m,k = gets.split.map(&:to_i)
ft = FactTable.new(n)
include ModInt

ans = 0
0.upto(k) do |k|
  b = (m-1).pow(n-1-k, MOD)
  b = mul(b, m)
  b = mul(b, ft.nCk(n-1,k))
  ans = add(ans, b)
end
puts ans

Measured memory_bytes: 17484
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int N;
    int T, A;
    int ans;
    double ave_Ans = INT_MAX;
    int H[1000] = {};
    cin >> N;
    cin >> T >> A;
    for(int i = 0; i < N; i++){
        cin >> H[i];
    }
    for(int i = 0; i < N; i++){
        double sa =abs( A - (T - H[i] * 0.006) );
        if(ave_Ans > sa){
            ave_Ans = sa;
            ans = i+1;
        }
    }
    
    cout << ans << endl;
    
}


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

namespace ConsoleApp1
{
    class Program
    {

        static void Main(string[] args)
        {
            var imp = Console.ReadLine().Split(' ');
            double T = double.Parse(imp[0]);
            int X = int.Parse(imp[1]);

            double TX = T / X;
            Console.Write(TX);
            


           

        }
    }
}

Measured memory_bytes: 11092
N,M=list(map(int, input().split()))

a = [0]*M
b = [0]*M
c = [0]*N

for i in range(M):
    a[i],b[i]=list(map(int, input().split()))

for j in range(N):
    
    for k in range(M):
        if a[k]==j+1:
            c[j]+=1

        if b[k]==j+1:
            c[j]+=1

    print(c[j])

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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(m);
  vector<int> b(m);
  rep(i,m){
    cin >> a.at(i) >> b.at(i);
  }
  vector<int> perm;
  rep(i,n-1){
    perm.push_back(i+1);
  }
  int cnt = 0;
  bool willend = false;
  vector<int> permplus(n);
  rep(i,n){
    if(i == 0){
      permplus.at(i) = 1;
    }else{
      permplus.at(i) = perm.at(i-1)+1;
    }
  }
  while(true){
    bool isok = false;
    bool dame = false;
    rep(i,n-1){
      rep(j,m){
        if((a.at(j) == permplus.at(i) && b.at(j) == permplus.at(i+1))
           ||(a.at(j) == permplus.at(i+1) && b.at(j) == permplus.at(i))){
          isok = true;
        }
      }
      if(!isok){
        dame = true;
      }
      isok = false;
    }
    if(!dame){
      cnt++;
      /*rep(i,n){
        cout << permplus.at(i) <<",";
      }
      cout << endl;*/
    }
    willend = !(next_permutation(perm.begin(),perm.end()));
    if(willend){
      break;
    }
    rep(i,n){
      if(i == 0){
        permplus.at(i) = 1;
      }else{
        permplus.at(i) = perm.at(i-1)+1;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256