akhauriyash/Code-Regression huggingface dataset:
// Marcin Knapik
#include<bits/stdc++.h>
// #pragma GCC optimize("O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> // order_of_key
// #include <ext/pb_ds/tree_policy.hpp> // find by order
// using namespace __gnu_pbds; 
// #define ordered_set tree< int , null_type,less< int >, rb_tree_tag,tree_order_statistics_node_update>  

// const ll MAX_LL = 0xFFFFFFFFFFFFFFFF;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// #define losuj(a, b) uniform_int_distribution<ull>(a, b)(rng)

typedef long double             ld;
typedef long long               ll;
typedef unsigned long long      ull;
typedef pair<ll, ll>            pll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vector<ii>>      vvii;
typedef vector< ll >            vll;
typedef vector< pll >           vpll;

#define boost                   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define f                       first
#define s                       second

template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}

template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template<class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template<class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<class T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }

const ll INF = 1e9 + 7;
const ll mod = 1186782211;
// const ll BIG_INF = 1000000000000000000;
const ll BIG_INF = 15000000000000;
const ll N = 1e6+7;
const ll T = 1<<20;
const ll Hope = 1000000123;

ll n, m, k, q;	

ll ile[N];
ll tab[N];

ll wzorek(ll x){
	return x * (x-1) / 2;
}

int main(){
	boost;

	cin >> n;
	FOR(i, n){
		cin >> tab[i];
		ile[tab[i]]++;
	}
	ll ans = 0;
	FOR(i, N)
		ans += wzorek(ile[i]); 
	FOR(i, n){
		ans -= wzorek(ile[tab[i]]);
		ans += wzorek(ile[tab[i]] - 1);
		cout << ans << '\n';
		ans += wzorek(ile[tab[i]]);
		ans -= wzorek(ile[tab[i]] - 1);
	}
}

Measured memory_bytes: 8320
#include <stdio.h>
#define rep(i,n)for(int i=0;i<n;i++)
int main(){
  int n,m,a[51][51],b[51][51],f;
  char s[51];
  scanf("%d%d",&n,&m);
  rep(i,n){
    scanf("%s",s);
    rep(j,n)a[i][j]=(s[j]=='#'?1:0);
  }
  rep(i,m){
    scanf("%s",s);
    rep(j,m)b[i][j]=(s[j]=='#'?1:0);
  }
  
  rep(i,n+1-m)rep(j,n+1-m){
    f=1;
    rep(k,m)rep(l,m)if(b[k][l]^a[k+i][l+j])f=0;
    if(f){printf("Yes");return 0;}
  }
  printf("No");
  return 0;
}

Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007 
#define ll long long 
#define N 200005
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define piii pair<int, pii>
#define print(x) cout << #x << "=" << x << "\t";
#define endl "\n"
#define newline cout << endl;

int n;
int a[N];
ll dp[N];

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); 
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> a[i];
    dp[1] = abs(a[1] - a[0]);
    dp[2] = abs(a[2] - a[0]);
    for(int i=3;i<n;i++)
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
    cout << dp[n - 1];
    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>

int main(void){
  int x,y;
  scanf("%d",&x);
  scanf("%d",&y);
  if((y % 2 != 0)||(y<2*x)||(y>4*x)){
  	printf("No");
    return 0;
  }
  printf("Yes");
  return 0;
}
  
  

Measured memory_bytes: 1728
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod   998244353
#define PI 2*acos(0.0)
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};

ll bigmod(ll x, ll p)
{
    ll res = 1;
    while(p)
    {
        if(p&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        p >>= 1;
    }
    return res;
}

//=============================================ASIFAZAD==============================================//

int32_t main()
{
    io;
    int n, m;
    cin>>n>>m;
    vi val(n+1), adj(n+1);
    for(int i = 1; i<=n; i++)cin>>val[i];

    vector<bool> vis(n);


    while(m--)
    {
        int u,v;
        cin>>u>>v;
        if(val[u] > val[adj[v]])
            adj[v] = u;
        if(val[v] > val[adj[u]])
            adj[u] = v;
    }

    int ans = 0;
    for(int i = 1; i<= n;i++)
        if(val[i] > val[adj[i]])
            ans++;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3996
#include<bits/stdc++.h>
 using namespace std;
#define LL long long
#define P pair<LL,LL>
 const LL inf = 0x3f3f3f3f;
 const LL mod = 924844033;
 const LL N = 4e3+10;
 template <typename tp> inline void read(tp &x)
{
	x=0;char c=getchar();int f=0;
	for(;c>'9'||c<'0';f|=(c=='-'),c=getchar());
	for(;c<='9'&&c>='0';x=(x<<3)+(x<<1)+c-'0',c=getchar());
	if(f) x=-x;
}
int n,k,ans;
int vis[N][2],tot,en[N];
LL dp[N][N][2],f[N],fac[N];
signed main()
{
	read(n),read(k);
	for(int i=1;i<=n;i++)
		for(int j=0;j<=1;j++)
			if(!vis[i][j])
			{
				for(int x=i,y=j;x<=n;x+=k,y^=1)
					vis[x][y]=1,tot++;
				en[tot]=1;
			}
	en[0]=dp[0][0][0]=1;
	for(int i=0;i<2*n;i++)
		for(int j=0;j<=n;j++)
		{
			dp[i+1][j][0]=(dp[i][j][0]+dp[i][j][1])%mod;
			if(!en[i]) dp[i+1][j+1][1]=dp[i][j][0];
		}
	for(int i=0;i<=n;i++) f[i]=(dp[2*n][i][0]+dp[2*n][i][1])%mod;
	fac[0]=1;for(int i=1;i<=n;i++) fac[i]=(1ll*fac[i-1]*i)%mod;
	for(int i=0,j=1;i<=n;i++,j=-j)
		ans=((1ll*ans+1ll*j*fac[n-i]*f[i])%mod+mod)%mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 249728
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<climits>
#include<vector>
#include<algorithm>
#include<deque>
 
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define MAX 20
 
using namespace std;
 
typedef pair<int,int> ii;
 
int n,m;// n : the number of the space
deque<int> car,TIME;
deque<int> space[MAX];// tyusya space
deque<int> Index[MAX];
deque<ii> waiting;
vector<int> ANS; 
 
bool Insert1(int cindex,int cTIME){
  rep(i,n){
    if(space[i].size() >= 2)continue;
    if(space[i].empty()){
      space[i].push_back(cTIME);
      Index[i].push_back(cindex);
      return true;
    }
  }
  return false;
}
 
bool Insert2(int cindex,int ctime,int cTIME){
  int pos = -1;
  bool found = false;
  rep(i,n){
    if(space[i].size() >= 2)continue;
    int remain = space[i].front() - ctime;
    if(remain >= cTIME)found = true;
    else continue;
    if(pos == -1)pos = i;
    else {
      if( abs((space[ i ].front()-ctime)-cTIME) < 
	  abs((space[pos].front()-ctime)-cTIME) ){
	pos = i;
      }
    }
  }
 
  if(pos == -1 || !found)return false;
 
  space[pos].push_front(ctime+cTIME);
  Index[pos].push_front(cindex);
  return true;
}
 
bool Insert3(int cindex,int ctime,int cTIME){
  int pos = -1;
   rep(i,n){
     if(space[i].size() >= 2)continue;
    int remain = space[i].front() - ctime;
     if(remain >= cTIME) return false;
  
    if(pos == -1)pos = i;
    else {
      if( abs((space[ i ].front()-ctime)-cTIME) < 
	  abs((space[pos].front()-ctime)-cTIME) ){
	pos = i;
      }
    }
  }
 
  if(pos == -1)return false;
   space[pos].push_front(ctime+cTIME);
  Index[pos].push_front(cindex);
  return true;
}
 
 
void compute(){
  int ctime = 0;
  while(true){
 
    // out
    rep(i,n)while(!space[i].empty() && space[i].front() <= ctime){
      ANS.push_back(Index[i].front());
      space[i].pop_front(), Index[i].pop_front();
    }
 
    // IN
    if(!car.empty() && ctime%10 == 0){
      waiting.push_back(ii(car.front(),TIME.front()));
      car.pop_front(),TIME.pop_front();
    }
  
    while(true){
      deque<ii> next;
      deque<ii> tmp = waiting;
      while(!waiting.empty()){
	int cindex = waiting.front().first;
	int cTIME  = waiting.front().second; 
	waiting.pop_front();
     
	if(Insert1(cindex,cTIME+ctime)) continue;
	if(Insert2(cindex,ctime,cTIME)) continue;
	
	if(Insert3(cindex,ctime,cTIME)) continue;
	// it cannot be possible to insert the car
	next.push_back(ii(cindex,cTIME));
      }
      waiting = next;
      if(tmp == next)break;
      if(waiting.empty())break;
    }
 
    bool finish = true;
    rep(i,n)if(!space[i].empty()){
      finish = false;
      break;
    }
 
    if(car.empty() && finish) break;
    ctime += 1;
  }
}
 
int main(){
 
  while(cin >> n >> m,n|m){
    waiting.clear(), ANS.clear(), TIME.clear(),car.clear();
    rep(i,MAX)space[i].clear(),Index[i].clear();
 
    rep(i,m){
      int tm;
      cin >> tm;
      car.push_back(i);
      TIME.push_back(tm);
    }
 
    compute();
 
    rep(i,ANS.size()){
      if(i)cout << " ";
      cout << ANS[i]+1;
    } cout << endl;
  }
  return 0;
}

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

int main() {
  int n, m, r;

  cin >> n >> m >> r;
  while (!(n==-1 && m==-1 && r==-1)) {
    if (n==-1 || m==-1) {cout << "F" << endl;}
    else if (80 <= n+m) {cout << "A" << endl;}
    else if (65 <= n+m && n+m < 80) {cout << "B" << endl;}
    else if (50 <= n+m && n+m < 65) {cout << "C" << endl;}
    else if (30 <= n+m && n+m < 50) {
      if (50<=r) {cout << "C" << endl;}
      else       {cout << "D" << endl;}
    } else if (n+m < 30) {cout << "F" << endl;}

    cin >> n >> m >> r;
  }
  return 0;
}


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

using namespace std;

int main(){
    vector<int> nums(100001);
    vector<long long> ans(100001);
    int n, q;
    cin >> n;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        nums[a]++;
        ans[0] += (long long)a;
    }
    cin >> q;
    for(int i=1; i<=q; i++){
        int b, c;
        cin >> b >> c;
        int num_b = nums[b];
        ans[i] = ans[i-1] + (long long)(c-b)*(long long)(num_b);
        nums[b] = 0;
        nums[c] += num_b;
    }

    for(int i=1; i<=q; i++){
        cout << ans[i] << endl;
    }

    return 0;

}


Measured memory_bytes: 4584
(defun create-data ()
  (let ((n (read)) 
        (k (read))
        (h))
    (dotimes (i n) 
      (push (read) h)) 
    (values n k (sort (copy-list h) #'>))))

(defun fennec-vs-monster (n k h)
  (dotimes (i k) 
    (pop h) 
    (if (null h) 
        (return))) 
  (loop for i in h 
        sum i))


(multiple-value-bind (n k h) (create-data)
  (format t "~D~%" (fennec-vs-monster n k h)))


Measured memory_bytes: 61792
#!python3.8
# -*- coding: utf-8 -*-
# abc175/abc175_c
import sys
import math

def s2nn(s): return [int(c) for c in s.split(' ')]
def ss2nn(ss): return [int(s) for s in list(ss)]
def ss2nnn(ss): return [s2nn(s) for s in list(ss)]
def i2s(): return sys.stdin.readline().rstrip()
def i2n(): return int(i2s())
def i2nn(): return s2nn(i2s())
def ii2ss(n): return [i2s() for _ in range(n)]
def ii2nn(n): return ss2nn(ii2ss(n))
def ii2nnn(n): return ss2nnn(ii2ss(n))


def main():
    X, K, D = i2nn()
    absX = abs(X)
    if absX >= K * D:
        print(abs(absX - K * D))
        return
    try:
        a, c = divmod(absX, D)
    except:
        print(X)
        return
    b = K - a
    if b % 2:
        print(abs(c - D))
    else:
        print(abs(c))
    return


main()


Measured memory_bytes: 9172
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	llint i,n,K;cin>>n>>K;
	string str;cin>>str;
	REV(str);
	if(K>15){//同じ文字を複製できる
		SO(str);
		while(n--){cout<<str[0];}
		cout<<endl;
		return 0;
	}
	while(K--){
		string mae=str;
		REV(str);
		string rtsstr=str+mae;
		str=rtsstr.substr(0,n);
		for(i=1;i<=n;i++){mineq(str,rtsstr.substr(i,n));}
		//貪欲に小さいのを見つける
	}
	cout<<str<<endl;
	return 0;
}

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

using namespace std;

#define ll long long int 

void max_Self(ll& a, ll b)
{
    a = max(a,b);
}

int main()
{

    int n,w;
    cin>>n>>w;
    vector<ll>dp(w+1);
    for(int item=0;item<n;item++)
    {
        int wt,value;
        cin>>wt>>value;
        for(int i=w-wt;i>=0;i--)
            max_Self(dp[i+wt],dp[i]+value);
    }
    ll ans=0;
    for(int i=0;i<=w;i++)
        max_Self(ans,dp[i]);

    cout<<ans;
    return 0;
}


Measured memory_bytes: 3940
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#include <random>
#define INF 1000000007
using namespace std;

int main(void){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++){
		cin >> a[i];
		a[i]-=i+1;
	}
	sort(a.begin(),a.end());
	int key=(a[n/2]+a[(n-1)/2])/2;
	long long ans=0;
	for(int i=0; i<n; i++)ans+=abs(a[i]-key);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define m 1000000007
using namespace std;
int h,w;
vector<vector<char>> g(1000,vector<char>(1000));
vector<vector<long long>> dp(1000,vector<long long>(1000,-1));
long long grid(int i,int j){
    if(i<0 or j<0)return 0;
    if(i==0 &&j==0)return 1;
    if(g[i][j]=='#')return 0;
    if(dp[i][j]!=-1)return dp[i][j];
    dp[i][j] = grid(i-1,j)+grid(i,j-1);
    return dp[i][j]%m;
}
int main(){
    cin>>h>>w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>g[i][j];
        }
    }
    cout<<grid(h-1,w-1)<<"\n";
    return 0;
}

Measured memory_bytes: 9216
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#define pi (acos(-1))
using namespace std;


int main()
{
    int a,b,x;
    scanf("%d%d%d",&a,&b,&x);
    double A=a,B=b,X=x,ans;
    if(X<A*A*B/2.0)ans=atan(A*B*B/2.0/X)/pi*180;
    else ans=atan(2*(A*A*B-X)/A/A/A)/pi*180;
    printf("%.10f",ans);
    return 0;
}


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


int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n){
    cin>>a.at(i);
    b.at(i)=a.at(i);
  }
  sort(b.begin(),b.end());
  int s=b.at(n/2-1);
  int t=b.at(n/2);
  
  rep(i,n){
    if(a.at(i)<=s){
      cout<<t<<endl;
    }
    else{
      cout<<s<<endl;
    }
  }
  
}



Measured memory_bytes: 3712
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

int main(){
    char X;
    cin >> X;
    if('a'<= X && X <= 'z') cout<<'a'<<endl;
    else cout<<'A'<<endl;
    return 0;
}


Measured memory_bytes: 3072
#include<stdio.h>
#define N 100000
void show(int *,int,int);
int partition(int *,int,int);
int main(){
int q,i,n,num[N];
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&num[i]);
q=partition(num,0,n-1);
    show(num,q,n);
  return 0;

}
int partition(int A[],int p,int r){
int x,i,j,hoge;
x=A[r];
i=p-1;
for(j=p;j<=r-1;j++){
if(A[j]<=x){
i=i+1;
hoge=A[i];
A[i]=A[j];
A[j]=hoge;
}
  
}
hoge=A[i+1];
A[i+1]=A[r];
A[r]=hoge;
return i+1;
}
void show(int num[],int q,int n ){
int i;
for(i=0;i<n;i++){
  if(i!=0)
    printf(" ");
if(i==q)
  printf("[%d]",num[i]);
 else
   printf("%d",num[i]);
}
printf("\n");

}



Measured memory_bytes: 2244
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <string>
#include <climits>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vvi;
typedef vector <ll> vl;
typedef vector <vector <ll>> vvl;
typedef vector <bool> vb;
typedef vector <vector <bool>> vvb;

//const int kINF = INT_MAX;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

template <typename type>
ostream &operator<<(ostream &out, const vector <type> &massive) {
    for (const type &i : massive) {
        out << i << ' ';
    }
    return out;
}

template <typename type>
void print(const vector <type> &massive, const string &sep, const string &end) {
    if (!massive.empty()) {
        cout << massive[0];
        for (int i = 1; i < massive.size(); ++i) {
            cout << sep << massive[i];
        }
    }
    cout << end;
}

template <typename type>
void print(const vector <type> &massive) {
    print(massive, " ", "\n");
}

template <typename type>
void print(const type &element, const string &end) {
    cout << element << end;
}

template <typename type>
void print(const type &element) {
    print(element, "\n");
}

int main() {
    fast();

    //freopen("../input.txt", "r", stdin);

    int n, k;
    cin >> n >> k;
    vector <int> a(n);
    for (int &i : a) {
        cin >> i;
    }

    for (int i = 0; i < n - k; ++i) {
        if (a[i] < a[i + k]) {
            print("Yes");
        } else {
            print("No");
        }
    }

    return 0;
}


Measured memory_bytes: 3952
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define in insert
#define sz(x) ((in)(x).size())
using namespace std;
const int N = 1e5 + 123;


void read_file()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
}

void solve()
{
    int a,b,c;
    cin >> a >> b >> c;
    //if (c >= b - a){
        a-=b;
        cout << max(0,c - a) << endl;
    
    //else 
      //  cout << c << endl;
}

int main()
{
    solve();
    //cerr << printf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
    return (0);
}




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

using namespace std;

long long niz[2500];

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

    long long n,z,w;
    cin>>n>>z>>w;

    for(int i = 0; i < n; i++)
        cin>>niz[i];

    long long a = abs(w-niz[n-1]);
    long long b = abs(niz[n-2] - niz[n-1]);

    long long res = max(a,b);

    if(n > 1) cout<<res;
    else cout<< abs(w-niz[n-1]);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    map<string, int> blue;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if (blue.find(s) != blue.end()) {
            blue[s]++;
        } else {
            blue[s] = 1;
        }
    }
    int m;
    cin >> m;
    map<string, int> red;
    for (int i = 0; i < m; i++) {
        string s;
        cin >> s;
        if (red.find(s) != red.end()) {
            red[s]++;
        } else {
            red[s] = 1;
        }
    }
    int max_score = 0;
    for (map<string, int>::iterator it = blue.begin(); it != blue.end(); it++) {
        if (red.find(it -> first) != red.end()) {
            max_score = max(max_score, (it -> second) - red[it -> first]);
        } else {
            max_score = max(max_score, it -> second);
        }
    }
    cout << max_score;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
#define REP(i,n) for (int i=0;i<=(n);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int INF = 10000000;

int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    int n; cin >> n;
    if(n % 1000 == 0) cout << 0 << endl;
    else cout << 1000 - n % 1000 << endl; 
}

Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>
int main() {
	int m1, d1, m2, d2; std::cin >> m1 >> d1 >> m2 >> d2;
	if (m1 == m2) {
		std::cout << "0\n";
	}
	else {
		std::cout << "1\n";
	}
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define fastcin  ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main(){

	fastcin
	
	ll x, y = 100;
	int ans = 0;
	
	cin >> x;	
	
	while(y < x){
		ans++;
		y = y + y*0.01;
	}
	
	cout << ans << endl;
	      
	return 0;
}

Measured memory_bytes: 3604
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf 10000000000000000 //10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec));
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
using namespace std;

signed main() {
	int n;
	cin>>n;
	int a[3*n];
	rep(i,n*3) cin>>a[i];
	sort(a,a+n*3);
	reverse(a,a+n*3);
	int cnt=0;
	for(int i=1;i<=n;i++) {
		cnt+=a[i*2-1];
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 2560
w,h,x,y = gets.split.map(&:to_i)
w = w.to_f
h = h.to_f
ans = (w*h)/2
aha = 0
if x == (w/2) && y == (h/2)
  aha = 1
else
  aha = 0
end
puts "#{ans.to_f} #{aha}"

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <math.h>
#include <stdio.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
int n,x,y;
vector<pair<int,int>> p;
int kaijo(int x){
    if(x==0)return 1;
    return kaijo(x-1)*x;
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>x>>y,p.push_back(make_pair(x,y));
    double sum=0.0;
    sort(p.begin(),p.end());
    do{
        for(int i=1;i<n;i++){
            sum+=sqrt((p[i-1].f-p[i].f)*(p[i-1].f-p[i].f)+(p[i-1].s-p[i].s)*(p[i-1].s-p[i].s));
        }
    }while(next_permutation(p.begin(),p.end()));
    printf("%.10f\n",sum/kaijo(n));
}


Measured memory_bytes: 256
//
//  main.cpp

#include <iostream>
using namespace std;


int main(){
	int h1,h2,h3;//before
	int m1,m2,m3;
	int s1,s2,s3;
	int h1_,h2_,h3_;//after
	int m1_,m2_,m3_;
	int s1_,s2_,s3_;
	cin >> h1 >> m1 >> s1 >> h1_ >> m1_ >> s1_;
	cin >> h2 >> m2 >> s2 >> h2_ >> m2_ >> s2_;
	cin >> h3 >> m3 >> s3 >> h3_ >> m3_ >> s3_;
	int alls1 = (h1_*3600 + m1_*60 + s1_) - (h1*3600 + m1*60 + s1);
	int alls2 = (h2_*3600 + m2_*60 + s2_) - (h2*3600 + m2*60 + s2);
	int alls3 = (h3_*3600 + m3_*60 + s3_) - (h3*3600 + m3*60 + s3);
	
	int ansh1 = alls1 / 3600;
	int ansh2 = alls2 / 3600;
	int ansh3 = alls3 / 3600;
	alls1 %= 3600;
	alls2 %= 3600;
	alls3 %= 3600;
	
	int ansm1 = alls1/60;
	int ansm2 = alls2/60;
	int ansm3 = alls3/60;
	alls1 %= 60;
	alls2 %= 60;
	alls3 %= 60;
	
	int anss1 = alls1;
	int anss2 = alls2;
	int anss3 = alls3;
	
	cout << ansh1 << " " << ansm1 << " " << anss1 << endl;
	cout << ansh2 << " " << ansm2 << " " << anss2 << endl;
	cout << ansh3 << " " << ansm3 << " " << anss3 << endl;
	return 0;
}

Measured memory_bytes: 3096
import Data.List (sort)
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

getInts :: IO [Int]
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

main = do
  n <- readLn
  xn <- getInts
  let sn = sort xn
  let upMedian = sn !! (div n 2)
  let downMedian = sn !! ((div n 2) - 1)
  mapM_ print $ map (\x -> if x < upMedian then upMedian else downMedian) xn

Measured memory_bytes: 50300
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int  long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

const int N=2e5+100;

int32_t main(){
    string s,t;
    cin >> s >> t;
    ll cnt=0;
    for (int i=0;i<min(s.size(),t.size());i++){
        if (s[i]==t[i])
            cnt++;
    }
    cout << cnt;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int a = sc.nextInt();
		
		// 計算
		String result = "No";
		if(n%500 <= a) result = "Yes";
		
		// 出力
		System.out.println(result);
		
	}
}




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

int arr[10];
int greatest = - 1000;
int least = 1000;
int aob;
int a ;
int b;

int main()
{
	for(int i = 0 ; i <= 3 ; i ++)
	{
		cin >> arr[i];
		
	}
	if(arr[0] < arr[2])
	{

		if(arr[2] < arr[1])
		{
			if(arr[3] > arr[1])
			{
				cout << arr[1] - arr[2] << endl;
			}
			else 
			{
				cout << arr[3] - arr[2] << endl;
			}
		}
		else
		{
			cout << 0 << endl;
		}
	}
	else
	{
		if(arr[0] < arr[3])
		{
			if(arr[1] > arr[3])
			{
				cout << arr[3] - arr[0] << endl;
			}
			else 
			{
				cout << arr[1] - arr[0] << endl;
			}
		}
		else
		{
			cout << 0 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
import collections

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

c = collections.Counter(a)
dup = c.most_common()[0][0]

id = [i for i, x in enumerate(a) if x == dup]
L = id[0]
R = id[1]

MOD = 10**9 +7
factorial = [1]
inverse = [1]

for i in range(1, N+2):
    factorial.append(factorial[i-1] * i % MOD)
    inverse.append(pow(factorial[i], MOD-2, MOD))
    

def C(n, r):
    if n < r:
        return 0
    return (factorial[n] * inverse[r] * inverse[n-r]) % MOD

print(N)
for i in range(2, N+2):
    ans = (C(N+1, i) - C(L+(N-R), i-1)) % MOD
    print(ans)


Measured memory_bytes: 23772
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    n: usize
    }
    let ans = ((n - 1) / 2 + 1) as f64 / n as f64;
    println!("{}", ans);
}


Measured memory_bytes: 2228
#include <bits/stdc++.h>
using namespace std;
int n, a[200020], b[200020], bc;
int mn[800020];
int ad[800020];
void build(int x, int l, int r) {
	if (l + 1 == r) {
		mn[x] = b[l];
		return;
	}
	int m = (l + r) / 2;
	build(x * 2 + 1, l, m);
	build(x * 2 + 2, m, r);
	mn[x] = min(mn[x * 2 + 1], mn[x * 2 + 2]);
	return;
}
void push(int x) {
	mn[x * 2 + 1] += ad[x];
	mn[x * 2 + 2] += ad[x];
	ad[x * 2 + 1] += ad[x];
	ad[x * 2 + 2] += ad[x];
	ad[x] = 0;
}
void change(int x, int l, int r, int L, int R) {
	if (L <= l && r <= R) {
		mn[x]++;
		ad[x]++;
		return;
	}
	if (r <= L || R <= l) {
		return;
	}
	push(x);
	int m = (l + r) / 2;
	change(x * 2 + 1, l, m, L, R);
	change(x * 2 + 2, m, r, L, R);
	mn[x] = min(mn[x * 2 + 1], mn[x * 2 + 2]);
}
int query(int x, int l, int r, int L, int R) {
	if (L <= l && r <= R) {
		return mn[x];
	}
	if (r <= L || R <= l) {
		return 2e9;
	}
	push(x);
	int m = (l + r) / 2;
	return min(query(x * 2 + 1, l, m, L, R), query(x * 2 + 2, m, r, L, R));
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		b[i] = a[i];
	}
	sort(b, b + n);
	bc = unique(b, b + n) - b;
	build(0, 0, bc);
	long long z = 0;
	for (int i = 0; i < n; i++) {
		int p = lower_bound(b, b + bc, a[i]) - b;
		z += query(0, 0, bc, p, bc) - a[i];
		change(0, 0, bc, 0, p);
	}
	printf("%lld\n", z);
	return 0;
}
/////

Measured memory_bytes: 7936
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, a, b;
  cin >> n >> a >> b;
  print(n/(a+b)*a+min(n%(a+b), a));
}


Measured memory_bytes: 256
import kotlin.math.abs

fun main() {
    val n = nextInt()
    val k = nextInt()
    val xn = nextIntList()
    val ans = solve(n, k, xn)
    println(ans)
}


fun solve(n: Int, k: Int, xn: List<Int>): Int {
    return xn.map {xi ->
        val absK = abs(xi - k)
        val small = if (absK > xi) xi else absK
        2 * small
    }.sum()
}

fun nextInt(): Int {
    return readLine()!!.toInt()
}

fun nextIntList(): List<Int> {
    return readLine()!!.split(" ").map { it.toInt() }
}

Measured memory_bytes: 36488
#include <iostream>
#include <numeric>
#include <cmath>
#include <queue>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}

vector<ll> fact, factinv, inv;
ll mod = 998244353;
void prenCkModp(ll n) {
	fact.resize(n + 5);
	factinv.resize(n + 5);
	inv.resize(n + 5);
	fact.at(0) = fact.at(1) = 1;
	factinv.at(0) = factinv.at(1) = 1;
	inv.at(1) = 1;
	for (ll i = 2; i < n + 5; i++) {
		fact.at(i) = (fact.at(i - 1) * i) % mod;
		inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod;
		factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod;
	}

}
ll nCk(ll n, ll k) {
	return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod;
}

int modPow(long long a, long long n, long long p) {
	if (n == 0) return 1; // 0乗にも対応する場合
	if (n == 1) return a % p;
	if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
	long long t = modPow(a, n / 2, p);
	return (t * t) % p;
}

int main() {
	ll N, M, K;
	cin >> N >> M >> K;
	prenCkModp(N);
	ll an = 0;
	rep(i, K+1) {
		an += ((M * nCk(N - 1, i))%mod) * modPow(M - 1, N - 1 - i, mod);
		an %= mod;
	}
	cout << an << endl;
}

Measured memory_bytes: 7864
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin>>n;
    int count=0;
 for(int i=0;i<n;i++){
     string s;
     cin>>s;
     if(s=="Y"){
       count++;
     }
 }
 if(count==0){
     cout<<"Three"<<endl;
 }
 else if(count!=0){
     cout<<"Four"<<endl;
 }
}

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

int main() {
  int N, K;
  cin >> N >> K;
  string S;
  cin >> S;
  char D = S.at(K-1);
  if (D == 'A'){
    D = 'a';
  }else if(D == 'B'){
    D = 'b';
  }else if(D == 'C'){
    D = 'c';
  }
  S.at(K-1) = D;
  cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e5 + 123;
int n, a[N], b[N], p[N], f[N];

void upd(int x, int y) {
	for (; x <= 2 * n; x |= (x + 1))
		f[x] += y;
}

int getsum(int x) {
	int res = 0;
	for (; x >= 0; x = (x & (x + 1)) - 1)
		res += f[x];
	return res;
}

ll get(int x) {
	for (int i = 1; i <= n; i++) {
		if (a[i] <= x) b[i] = 1;
		else b[i] = -1;
	}
	upd(n, 1);
	ll res = 0;
	for (int i = 1; i <= n; i++) {
		p[i] = p[i - 1] + b[i];
		assert(p[i] + n >= 0 && p[i] + n <= 2 * n);
		res += getsum(p[i] + n - 1);
		upd(p[i] + n, 1);
	}
	upd(n, -1);
	for (int i = 1; i <= n; i++)
		upd(p[i] + n, -1);
	return res;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	int l = 0, r = 1e9 + 123;
	ll k = ((ll)n * (n + 1)) / 2;
	while (l < r - 1) {
		int mid = l + r >> 1;
		if (get(mid) >= k / 2 + 1)
			r = mid;
		else
			l = mid;
	}
	cout << r;
}


Measured memory_bytes: 5508
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int x;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> x;
	int ans;
	ans = (x / 500) * 1000;
	x %= 500;
	ans += (x / 5) * 5;
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
function Main(input) {
    //input = input.split("\n");
    x = parseInt(input, 10);
    if (x>=30) {
        console.log("Yes\n");
    } else {
        console.log("No\n");
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));//おまじない

Measured memory_bytes: 29520
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val s = cin.nextLine()

    var on = false
    var on_a_count: Long = 0
    var bc = false
    var ans: Long = 0
    for (i in 0..s.length-1) {
        if (bc) {
            if (s[i] == 'C') {
                ans += on_a_count
                bc = false
                continue
            } else {
                on = false
                bc = false
            }
        }
        if (!on) {
            if (s[i] == 'A') {
                on = true
                on_a_count = 1
            }
        } else {
            if (s[i] == 'A') {
                on_a_count += 1
            } else if (s[i] == 'B') {
                bc = true
            } else {
                on = false
            }
        }
    }
    println(ans)
}

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

int main() {
    int n, a, b;
    cin >> n >> a >> b;

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int num = i;
        int sum_d = 0;
        while (num != 0) {
            sum_d += num % 10;
            num /= 10;
        }
        if (sum_d >= a && sum_d <= b) {
            ans += i;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int i,j,c=1,p=0,a,b,y=0,x;
    cin >> a >> b;
    string g,f;
    for(i=0;i<b;i++)
    {
        p+=a*c;
        c=c*10;
    }
    c=1;
    for(i=0;i<a;i++)
    {
        y+=b*c;
        c*=10;
    }
    g=to_string(p);
    f=to_string(y);
    if(g<f)
    {
        cout << g << endl;
    }
    else
    {
        cout << f << endl; 
    }    
}


Measured memory_bytes: 3580
s, h, c, d = [],[],[],[]

n = int(input())

#add cards
for _ in range(n):
    suit, rank = input().split()
    rank = int(rank)
    if suit == "S":
        s.append(rank)
    elif suit == "H":
        h.append(rank)
    elif suit == "C":
        c.append(rank)
    elif suit == "D":
        d.append(rank)

#check cards
s_missing, h_missing, c_missing, d_missing = [],[],[],[]
for i in range(1, 14):
    if i not in s:
        s_missing.append(i) 
    if i not in h:
        h_missing.append(i) 
    if i not in c:
        c_missing.append(i) 
    if i not in d:
        d_missing.append(i) 

#print missing cards
for card in s_missing:
    print("S", card)
for card in h_missing:
    print("H", card)
for card in c_missing:
    print("C", card)
for card in d_missing:
    print("D", card)




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


int32_t main(){
	int  n , a , b;
	cin>>n>>a>>b;
	int ra = 0 , rb = 0 , rc = 0;
	for(int i = 0 ; i < n; i ++){
		int x;
		cin>>x;
		if(x <= a) ra ++;
		else if(x  > a && x <= b) rb++;
		else rc++;
	}
	cout<< min(ra , min(rb,rc))<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef long long ll;

int main() {
    int n, m; cin >> n >> m;
    vector<ll> x(n), y(n), z(n);
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i] >> z[i];
    }

    ll ans = 0;
    for (int bit = 0; bit < (1<<3); bit++)
    {
        vector<ll> a(n);
        for (int i = 0; i < n; i++)
        {   
            ll tmp = 0;
            if (bit & (1<<0)) tmp += x[i];
            else tmp -= x[i];
            if (bit & (1<<1)) tmp += y[i];
            else tmp -= y[i];
            if (bit & (1<<2)) tmp += z[i];
            else tmp -= z[i];

            a[i] = tmp;
        }
        sort(a.begin(), a.end());
        reverse(a.begin(), a.end());
        ll tmp = 0;
        for (int i = 0; i < m; i++)
        {
            tmp += a[i];
        }
        ans = max(ans, tmp);        
    }
    cout << ans << endl;
    
    return 0;
}


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

long long n, res[22][55][55], power26[27], mod = 1000000007; string S[55];

long long solve(int pos, int l, int r) {
	if (l > r) return 1;
	if (res[pos][l][r] >= 1) return res[pos][l][r] - 1;
	if (pos == 20) return 1;
	long long dp[28][55];
	for (int i = l - 1; i <= r; i++) {
		for (int j = 0; j < 28; j++) dp[j][i] = 0;
	}
	dp[0][l - 1] = 1;
	for (int i = 0; i < 27; i++) {
		for (int j = l - 1; j <= r; j++) {
			long long P = 1;
			for (int k = j; k <= r; k++) {
				if (pos == 19 && k - j >= 2) continue;

				if (k != j && S[k][pos] != (char)(95 + i + 1) && (i == 0 || S[k][pos] != '?')) P = 0;
				long long Q = dp[i][j] * P*solve(pos + 1, j + 1, k);
				dp[i + 1][k] += Q; dp[i + 1][k] %= mod;
			}
		}
	}
	res[pos][l][r] = dp[27][r] + 1;
	return res[pos][l][r] - 1;
}

int main() {
	cin >> n;
	power26[0] = 1; for (int i = 1; i < 21; i++) { power26[i] = (power26[i - 1] * 26LL) % mod; }
	for (int i = 1; i <= n; i++) {
		cin >> S[i];
		while (S[i].size() <= 20) S[i] += (char)(96);
	}
	cout << solve(0, 1, n) << endl;
	return 0;
}


Measured memory_bytes: 3856
from functools import reduce
import math
import bisect
import collections 
def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input())
    A = list(int(_) for _ in input().split())
    B = list(int(_) for _ in input().split())
    C = list(int(_) for _ in input().split())
    A.sort()
    C.sort()
    ans = 0

    for i in range(N):
        a_index = bisect.bisect_left(A,B[i])
        c_index = bisect.bisect_right(C,B[i])
        ans += a_index * (N-c_index)

    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 23856
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        int[] a = Read.Ints();
        Console.WriteLine(a[0]+a[1]>=10?"error":""+(a[0]+a[1])+"");
    }
    public static Boolean uso() { return false; }
    public static int gcd(int a, int b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static int lcm(int a, int b)
    {
        return a * b / gcd(a, b);
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (int i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] Ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

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

const long long MAX = 10000000;  // TLEならば小さくする
const long long MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (long long i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(long long n, long long k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	
	ll s; cin >> s;
	COMinit(); // 前処理
	ll n = s / 3;
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		ll x = s - 3 * i;
		ans += COM(i + x - 1, x);
		ans %= MOD;
	}
	cout << ans << endl;	
    return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;

  for (int i = 1; i <= h; ++i) {
    for (char j = 'A'; j - 'A' < w; ++j) {
      string s;
      cin >> s;

      if (s == "snuke") {
        cout << j << i << endl;
      }
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;
typedef std::vector<long long> vl;
typedef std::vector<std::vector<long long>> vvl;
#define out(x) cout<<x<<"\n";
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}
 
using namespace std;

void solve()
{
    ll k, a, b;
    cin >> k >> a >> b;
    ll ans = k + 1;//ずっとビスケットを叩くとき
    if(a<=b){
        ll x = 0;
        k -= a +1;
        if(k>=0){
            x += b;
            ll y = k % 2;
            k /= 2;
            chmax(ans, x + y + k * (-a + b));
        }
        cout << ans;
    }
    else{
        cout << ans;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 256