akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define lop(i, n) for(i=0; i<n; i++)

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main()
{
	int n, i, j, max=0;
	scanf("%d", &n);
	int a[200001];
	lop(i, n){ scanf("%d", &a[i]); }
	
	qsort(a, n, sizeof(int), compare_int);
	
	printf("%d", a[n/2]-a[(n/2)-1]);
	 
	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    double L;
    cin >> L;
    double l = L/3.0;
    printf("%lf\n",l*l*l);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	char c[2];

	for (int i = 0; i < 2; i++) {
		cin >> c[i];
	}

	if (c[0] == '9' || c[1] == '9') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	
}

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

using namespace std;

int main(){
   int count=0;
   string s;
   cin >> s;
   int n = s.size();
   //cout << n;
   for(int i=1;i<n;i++){
       if(s[i-1]==s[i])
         {
             if(s[i]=='1')s[i]='0';
             else s[i]='1';
             count++;
         }
   }
  cout << count ;//<<" " << s;
}

Measured memory_bytes: 512
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#define INF 10000000
#define MN 101
using namespace std;
typedef long long ll;

typedef struct P
{
	int pos,mon,eve;
	bool operator <(const P &a)const{ return eve>a.eve;};
}P;
typedef struct E{int to,cost,eve;}E;

int N,M,L;
int amb[MN][MN];
vector<E> G[MN];

int bfs(int s,int t,int y)
{
	int r=INF;
	priority_queue<P>Q;
	memset(amb,0x7f,sizeof(amb));
	amb[s][y]=0;
	P p={s,y,0};
	Q.push(p);
	for(;!Q.empty();)
	{
		p=Q.top();Q.pop();
		if(p.pos==t)
		{
			r=min(r,p.eve);
			return p.eve;
			continue;
		}
		for(int i=0;i<G[p.pos].size();i++)
		{;
			E np=G[p.pos][i];
			if(amb[np.to][p.mon]>p.eve+np.eve)//not gard
			{
				amb[np.to][p.mon]=p.eve+np.eve;
				P ins={np.to,p.mon,amb[np.to][p.mon]};
				Q.push(ins);
			}
			if(p.mon>=np.cost&&amb[np.to][p.mon-np.cost]>p.eve)//hire gard
			{
				amb[np.to][p.mon-np.cost]=p.eve;
				P ins={np.to,p.mon-np.cost,amb[np.to][p.mon-np.cost]};
				Q.push(ins);
			}
		}
	}
	return r;
}

int main()
{
	for(;scanf("%d%d%d",&N,&M,&L),N+M+L;)
	{
		for(int i=0;i<MN;i++)G[i].clear();
		for(int i=0;i<M;i++)
		{
			int s,t,l,e;
			scanf("%d%d%d%d",&s,&t,&l,&e);
			s--;t--;
			E tmp={t,l,e};
			G[s].push_back(tmp);
			tmp.to=s;
			G[t].push_back(tmp);
		}
		printf("%d\n",bfs(0,N-1,L));
	}
}

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

int main(void){
    int n = 0;
    int p[200001];
    int ans = 0, min = 200001;

    scanf("%d", &n);

    for(int i = 0; i < n; i++){
        scanf("%d", &p[i]);
        if(p[i] < min){
            min = p[i];
        }
        if(p[i] <= min){
            ans++;
        }
/*
        for(int j = 0; j <= i; j++){
            if(p[i] <= p[j]){
                if(j == i){
                    ans++;
                }
            }else{
                break;
            }
        }
*/
    }
/*
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= i; j++){
            if(p[i] <= p[j]){
                if(j == i){
                    ans++;
                }
            }else{
                break;
            }
        }
//        printf("i = %d ans = %d\n", i, ans);
    }
*/
    printf("%d\n", ans);

    return 0;

} 


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#define mop 1000000007

using namespace std;

int main() {
    
    int n;
    cin >> n;
    if(n == 3 or n == 5 or n==7){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

}

Measured memory_bytes: 256
//g++でビルド

#include "bits/stdc++.h"

using namespace std;

int main(){
    string s, t;
    cin >> s >> t;
    string result = "";
    int slen = s.size();
    int tlen = t.size();
    int dp[slen+1][tlen+1];

    for(int i = 0; i <= slen; i++){
        for(int j = 0; j <= tlen; j++){
            dp[i][j] = 0;
        }
    }
    
    for(int i = 0; i<slen; i++){
        for(int j = 0; j<tlen; j++){
            if(i == 0 && j == 0){
                if(s[i] == t[i]) dp[i+1][j+1] = 1;
                else dp[i+1][j+1] = 0;
            }else if(i == 0){
                if(dp[i+1][j] == 0){
                    if(s[i] == t[j]) dp[i+1][j+1] = 1;
                    else dp[i+1][j+1] = 0;
                }else{
                    dp[i+1][j+1] = 1;
                }
            }else if(j == 0){
                if(dp[j-1][0] == 0){
                    if(s[i] == t[j]) dp[i+1][j+1] = 1;
                    else dp[i+1][j+1] = 0;
                }else{
                    dp[i+1][j+1] = 1;
                }
            }else{
                if(s[i] == t[j]){
                    dp[i+1][j+1] = dp[i][j] + 1;
                }else{
                    dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
                }
            }
        }
    }

/*
    for(int i = 0; i <= slen; i++){
        for(int j = 0; j <= tlen; j++){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */

    int x = slen;
    int y = tlen;
    while(x != 0 && y != 0){
        //cout << "(x,y) = (" << x << "," << y << ")" << endl;
        int now = dp[x][y];
        int mid = dp[x-1][y-1];
        int up = dp[x][y-1];
        int left = dp[x-1][y];
        if(mid < now && up < now && left < now){
            result += s[x-1];
            x--; y--;
            //cout << "hey!"  << result << endl;
        }else if(up == now){
            y--;
        }else{
            x--;
        }
    }

    reverse(result.begin(), result.end());

    cout << result << endl;
    return 0;
}

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

#define debug(x) cout << (#x) << " is " << x << endl;
#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;

#define N 200005
int xa[N], an[N];

int main()
{
    int n;
    cin >> n;
    for(int i=0; i<n; i++) cin >> xa[i];
	int xo=0;
	for(int i=0; i<n; i++) xo ^= xa[i];
	
	for(int i=0; i<n; i++){
		if(i!= 0) cout << " ";
		cout << (xo^xa[i]);
	}
	puts("");
 
    return 0;
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<string> table(8);
    for(int i = 0; i < 8; i++) cin >> table[i];
    cout << 90 << endl;
    for(int j = 0; j < 8; j++)
    {
        for(int i = 7; i >= 0; i--) cout << table[i][j]; cout << endl;
    }
    cout << 180 << endl;
    for(int i = 7; i >= 0; i--)
    {
        for(int j = 7; j >= 0; j--) cout << table[i][j]; cout << endl;
    }
    cout << 270 << endl;
    for(int j = 7; j >= 0; j--)
    {
        for(int i = 0; i < 8; i++) cout << table[i][j]; cout << endl;
    }
    return 0;
}




Measured memory_bytes: 3232
#include<bits/stdc++.h>
#define max(x, y) ((x)>(y)?(x):(y))
#define min(x, y) ((x)<(y)?(x):(y))
#define abs(x) (((x)<0)?(-1*(x)):(x))
#define TESTC lli TC; cin>>TC; while(TC--)
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL)

using namespace std;
typedef long long int lli;
typedef long int li;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair<int, int> pri;
typedef pair<long long int, long long int> prlli;

#include<iostream>
#include<math.h>
#include<limits>
using namespace std;

int main(){
	FASTIO;
    int n;
    cin>>n;
    lli a = 2;
    lli b = 1, k;
    if(n == 0){
        cout<<a<<endl;
        return 0;
    }

    for(int i = 2; i <= n; ++i){
        k = b;
        b += a;
        a = k;
    }
    cout<<b<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b,c,p=3;
	
	cin>>a>>b>>c;
	
	if(a == b){
		p--;
	}
	
	if(a == c || b == c){
		p--;
	}
	
	cout<<p<<endl;
	
	return 0;
}

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

int main()
{
	ll N, H;
	cin >> N >> H;
	ll ma = 0;
	priority_queue<ll> pq;
	for (int i = 0; i < N; i++) {
		ll a, b;
		cin >> a >> b;
		ma = max(ma, a);
		pq.push(b);
	}
	ll res = 0;
	while (H > 0) {
		if (pq.empty() || pq.top() < ma) {
			ll t = (H + ma - 1) / ma;
			res += t;
			break;
			H = t * ma;
		}
		else {
			H -= pq.top(); pq.pop();
			res++;
		}
	}
	cout << res << endl;
	return 0;
}


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

__int128 lower (__int128 a, __int128 b, __int128 c, __int128 d) {
	__int128 l = 1, r = 1.5E18, ans = -1;
	while (l <= r) {
		__int128 m = (l + r) / 2;
		if (a * m / b < c) {
			l = m + 1;
		} else {
			if (c <= a * m / b && a * m / b <= d) ans = m;
			r = m - 1;
		}
	}
	return ans;
}

__int128 upper (__int128 a, __int128 b, __int128 c, __int128 d) {
	__int128 l = 1, r = 1.5E18, ans = -1;
	while (l <= r) {
		__int128 m = (l + r) / 2;
		if (a * m / b <= d) {
			if (c <= a * m / b && a * m / b <= d) ans = m;
			l = m + 1;
		} else {
			r = m - 1;
		}
	}
	return ans;
}

int K;
__int128 A[110000];

int main () {
	scanf ("%d", &K);
	A[0] = 1;
	for (int i = 1; i <= K; ++i) { int t; scanf ("%d", &t); A[i] = t; }
	if (A[K] != 2) { puts ("-1"); return 0; }
	__int128 grl = 1, grh = 1;
	for (int i = K - 1; i >= 0; --i) {
		__int128 nl = lower (A[i], A[i + 1], grl, grh);
		__int128 nu = upper (A[i], A[i + 1], grl, grh);
		grl = nl; grh = nu;
		if (grl == -1 || grh == -1) break;
	}
	if (grl == -1 || grh == -1) puts ("-1");
	else printf ("%lld %lld\n", (long long) grl, (long long) grh);
}


Measured memory_bytes: 1792
#include<iostream>
#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
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  ll a,b,c=0,d=0;cin>>a;
  rep(i,a){
    cin>>b;
    if(b==c+1){
      c=b;
    }
    else d++;
  }
  if(a==d)cout<<-1;
  else cout<<d;
}


Measured memory_bytes: 23680
#include<bits/stdc++.h>
#define bye return 0
#define Yes cout << "Yes" << "\n"
#define No  cout << "No" << "\n"
#define YES cout << "YES" << "\n"
#define NO cout << "NO" << "\n"
#define endl cout << "\n";
using namespace std;
int main(){
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> v;
    vector<int> v1;
    int a, b, c;

    cin >> a >> b;

    if(a==0){
    	if(b==100){
    		cout<< "101" << "\n";
    	}else{
    	cout << b << "\n";
       }
    }else if(a==1){
    	if(b==100){
    		cout<< "10100" << "\n";
    	}else{
    	cout << b*100 << "\n";
       }
    }else if(a==2){
    	if(b==100){
    		cout<< "1010000" << "\n";
    	}else{
    	cout << b*100*100 << "\n";
       }
    }
    
   bye;

}


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


int main(){
	int n,tmp=0,m,ans=1;
	char c;
	for(cin>>n;n>0;n--){
		cin>>c>>m;
		if(c==')')m*=(-1);
		tmp+=m;
		if(tmp<0){
			cout<<"NO"<<endl;
			break;
		}
		if(n==1){
			if(tmp==0){
				cout<<"YES"<<endl;
			}
			else{
				cout<<"NO"<<endl;
			}
		}
	}
	
	
	
	return 0;
}


Measured memory_bytes: 1160
#include <stdio.h>
const int N=20;
const int MAXN=1<<16;
const int INF=1e9+10;;
int min(int a,int b){return a>b?b:a;}
int main(){
    int n,dis[N][N],m,l,r,w,dp[MAXN][N],ans=INF,all;
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++)for(int j=0;j<n;j++)dis[i][j]=INF;
    while(m--){
        scanf("%d%d%d",&l,&r,&w);
        dis[l][r]=w;
    }
    all=1<<n;
    dp[0][0]=0;
    for(int i=1;i<all;i++)for(int j=1;j<n;j++)if(i&(1<<j)){
        if(i==1<<j)dp[i][j]=dis[0][j];
        else{
            dp[i][j]=INF;
            for(int k=0;k<n;k++)if(k!=j&&i&(1<<k))dp[i][j]=min(dp[i][j],dp[i-(1<<j)][k]+dis[k][j]);
        }
    }
    for(int i=1;i<n;i++)ans=min(ans,dp[all-2][i]+dis[i][0]);
    if(ans==INF)printf("-1\n");
    else printf("%d\n",ans);
}


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

int main() {
  int a,b;
  cin >> a >> b;
  int i,j,k;
  i = a + b;
  j = a - b;
  k = a * b;
  int l = max(i,j);
  int ans = max(l,k);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll n, m;
    cin >> n >> m;
    ll k = m;
    set<int> p;
    for (int i = 2; i <= sqrt(k); i++)
    {   
        if(k % i == 0){
            p.insert(k / i);
            p.insert(i);
        }
    }
    p.insert(1);
    p.insert(m);
    int ans = 0;
    for (auto v : p)
    {   
        if(v * n <= m)
        ans = v;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <deque>
#include <numeric>
#include <cmath>
#include <map>
#include <set>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r;
    cin >> r;
    if(r<1200){
        cout << "ABC" << endl;
    }
    else if(r>=1200 && r<2800){
        cout << "ARC" << endl;
    }
    else cout << "AGC" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

int main() {
    string n;
	cin >> n;
    fori(n.length()){
        if(n[i]=='7'){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
	return 0;
}

Measured memory_bytes: 3592
x,k,d = map(int,input().split())
if x < 0:
    x = -x
if x >= k*d:
    print(x-k*d)
    exit()
k -= x//d
x -= x//d*d

if k%2 == 0:
    print(x)
else:
    print(abs(x-d))



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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main(){
    ll x, y;
    cin >> x >> y;
    if (lcm(x, y) == x) cout << -1 << endl;
    else {
        ll x2 = x;
        while (x2 <= 1e18) {
            if (x2%y!=0) {
                cout << x2 << endl;
                return 0;
            }
            x2 += x;
        }
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
using namespace std;
int siz[101000],fa[101000];
int h[101000],nxt[201000],K=0,to[201000];
void ins(int u,int v){nxt[++K]=h[u];h[u]=K;to[K]=v;}
void dfs(int x,int f)
{
	fa[x]=f;siz[x]=1;
	for(int i=h[x];i;i=nxt[i])
	{
		if(to[i]==f)continue;
		dfs(to[i],x);siz[x]+=siz[to[i]];
	}
}
int main()
{
	int n;scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int a,b;scanf("%d%d",&a,&b);
		ins(a,b);ins(b,a);
	}
	dfs(1,0);int tot=0;
	for(int i=fa[n];i!=1;i=fa[i])tot++;
	int k=n;
	for(int i=1;i<=tot/2;i++)k=fa[k];
	int ls1=n-siz[k]-(tot-tot/2),ls2=siz[k]-tot/2;
	if(tot&1)
	{
		if(ls2<=ls1)puts("Fennec");
		else puts("Snuke");
	}
	else
	{
		if(ls1<=ls2)puts("Snuke");
		else puts("Fennec");
	}
	return 0;
}

Measured memory_bytes: 7680
#![allow(unused_imports)]
#![allow(unused_macros)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

//
// Macro debug!
//

#[cfg(debug_assertions)]
include! {"./procon/debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

//
// Macro input!
//

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//
// IteratorExt
//

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

//
// Main
//

fn main() {
    input! {
        k: isize,
        x: isize,
    }

    let a = x - k + 1;
    let b = x + k;
    let mut v = vec![];
    for i in a..b {
        v.push(format!("{}", i));
    }
    println!("{}", v.connect(" "));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*なるべくAi = Ciとなるようにして、AとCの総和を変えないようにかつBi<=Ci
となるようにCを作った時、Ai != Ciとなるiの個数を求める
*/

int main() {
 ll N;
 cin >> N;
 vector<ll> A(N);
 vector<ll> B(N);
 vector<ll> D;
 rep(i,N){
     cin >> A[i];
 }
 rep(i,N){
     cin >> B[i];
 }
 rep(i,N){
     if(A[i] - B[i] != 0){
         D.push_back(A[i]-B[i]);
     }
 }
 ll sumD = 0;
 rep(i,D.size()){
     sumD += D[i];
 }
if(sumD >= 0){
 sort(D.begin(),D.end());


 ll huSUM = 0;
 int huc = 0;
  for(int i = 0;i<D.size();i++){
     if(D[i] < 0){
      huSUM += D[i];
      huc++;
     }
 }

 vector<int> seiD;
 for(int i = 0;i<D.size();i++){
     if(D[i] > 0) seiD.push_back(D[i]);
 }

 sort(seiD.begin(),seiD.end());
 
 reverse(seiD.begin(),seiD.end());
 int seic = 0;

 for(int i = 0;i<seiD.size();i++){
     if(huSUM >= 0) break;
     huSUM += seiD[i];
     seic++;
 }
 cout << seic + huc << endl;
 }
 else cout << -1 << endl;
}

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  Solver(LL n) : n(n){};

  void solve() {
  }
};
class Solver2 {
 public:
  int n, r;
  Solver2(LL n, LL r) : n(n), r(r){};

  void solve() {
    if (n >= 10) {
      cout << r << endl;
    } else {
      cout << r + (10 - n) * 100 << endl;
    }
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, r;
  std::cin >> n >> r;

  Problem::Solver2 sol(n, r);
  sol.solve();
  return 0;
}


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

#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define mod 1000000007
const int N = 1e5+5;
int n,m,l,r,res = 0;
struct mang
{
    int x,y;
};
mang a[N];
bool cmp(mang A1,mang B1)
{
    return A1.x < B1.x;
}
int main()
{
    FAST
    cin >> n >> m;
    for (int i = 1; i <= m ; i++)
        cin >> a[i].x >> a[i].y;
    sort(a+1,a+m+1,cmp);
    l = a[1].x;
    r = a[1].y;
    res = 1;
    for (int i = 2; i <= m; i++)
    {
      if (a[i].x >= r)
      {
          res++;
          l = a[i].x;
          r = a[i].y;
      }
      else
      {
        l = max(a[i].x,l);
        r = min(a[i].y,r);
      }
    }
    cout << res;
    return 0;
}



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

int main(void){
    int H,W; cin >> H >> W;

    string S[H];
    for(int i=0; i<H; i++) cin >> S[i];

    for(int i=0; i<H; i++){
        string stream="";
        for(int j=0; j<W; j++){

            if(S[i][j]=='#'){
                stream+="#";
                continue;
            }

            int mine=0;
            for(int k=max(0,i-1); k<min(H,i+2); k++){
                for(int l=max(0,j-1); l<min(W,j+2); l++){
                    if(S[k][l]=='#') mine++;
                }
            }
            stream+=to_string(mine);
        }
        cout << stream << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<ll> vi;

const int INF = 1e9;
const int MOD = 1e9+7;

int main(void){
	int n, t;
	cin >> n >> t;
	int ans = INF;
	REP(i, n){
		int cc, tt;
		cin >> cc >> tt;
		if (tt <= t) ans = min(ans, cc);
	}
	if(ans == INF) cout << "TLE" << endl;
	else cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long power;
long long const mod = 1e9 + 7;
int main() {
	long long res1 = 1, res2 = 1, res3 = 1;
	long long bas1 = 10, bas2 = 9, bas3 = 8;
	cin >> power;
	while (power > 0) {
		if (power&1) {
			res1 = (res1 * bas1) % mod;
			res2 = (res2 * bas2) % mod;
			res3 = (res3 * bas3) % mod;
		}
		power /= 2;
		bas1 = (bas1 * bas1) % mod;
		bas2 = (bas2 * bas2) % mod;
		bas3 = (bas3 * bas3) % mod;
	}
	cout << ((res1 - (2 * res2) + res3) % mod + mod)%mod << endl;
	return 0;
}


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

int main(){
  int64_t n,f=0,b=0,j=0,c;
  cin >> n;
  vector<int64_t> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++){
      c=2;
      j=0;
      while(j<i-1){
        a[i] *= 2;
        c *= 2;
        j++;
      }
    b += a[i];
  }

  cout << (double)b/(double)c << endl;
}

Measured memory_bytes: 256
from collections import deque

def main():
    K = int(input())
    q = deque()
    for i in range(1,10,1):
        q.append(i)
    list = []
    while (len(list) <= 100002):
        v = q.popleft()
        list.append(v)
        amari = v%10
        if amari != 0 and amari != 9:
            q.append((v*10)+amari-1)
            q.append((v*10)+amari)
            q.append((v*10)+amari+1)
        elif amari == 0:
            q.append((v*10)+amari)
            q.append((v*10)+amari+1)
        else:
            q.append((v*10)+amari-1)
            q.append((v*10)+amari)

    return list[K-1]

print(main())


Measured memory_bytes: 23160
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <deque>
#include <array>
#include <algorithm>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
_T _DEF(T,in,int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int, in){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_DEF(bool, scan, char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b,m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=n%10*m+'0',n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{
	int e,b=0,s=1;
	range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
	struct it { int v, s; it (int _v, int _s) : v(_v), s(_s) {} operator int()const{return v;} operator int&(){return v;} int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin() {return {b, s};} it end() {return {e, s};}};

int main() {
	for (int n, w, d; n = in(), w = in(), d = in();) {
		deque<array<int, 2>> v{{w, d}};
		while (n--) {
			int p{in() - 1}, s{in()};
			auto a{v[p]}, b{a};
			int i{(s %= a[0] + a[1]) > a[0]};
			if (i)
				s -= a[0];
			b[i] -= a[i] = min(s, a[i] - s);
			v.erase(v.begin() + p);
			v.push_back(a);
			v.push_back(b);
		}
		vector<int> r;
		transform(v.begin(), v.end(), back_inserter(r), [](auto &a){return a[0] * a[1];});
		sort(r.begin(), r.end());
		out(r);
	}
}


Measured memory_bytes: 2608
#include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#include<utility>
#include<list>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define fori(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
struct XY
{
	int x;
	int y;
};


/*
(char)'1' - (int)48 = (int)1;


*/


int a[1005000] = {};
int main()
{
	for (int i = 2; i < 1005000; i++)a[i] = 1;
	for (int i = 2; i < 1005000; i++)
	{
		if (a[i] == 1)
		{
			for (int l = i * 2; l < 1005000; l += i)
			{
				a[l] = 0;
			}
		}
	}

	int b, n, m;
	cin >> b >> n >> m;
	while (b != 0 || n != 0 || m != 0)
	{
		for (int i = 0; i < m; i++)
		{
			while (1)
			{
				if (a[b] == 1)break;
				b += n;
			}
			if (i != m - 1)b += n;
		}

		cout << b << endl;


		cin >> b >> n >> m;
	}
}

Measured memory_bytes: 5084
#include<bits/stdc++.h>
using namespace std;
int main(){
  while(1){
    int n,cnt=0,a=0;
    int k[10009];
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin>>k[i];
      if(k[i]==0||k[i]==1)cnt++;
      if(k[i]==0)a++;
    }
    if(cnt==n)cout<<"NA"<<endl;
    else cout<<n-a+1<<endl;
  }
  return(0);
}



Measured memory_bytes: 3152
#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 d, n, ans;
  cin >> d >> n;
  
  if (n == 100) ans = 101 * pow(100, d);
  else ans = n * pow(100, d);
  cout << ans << endl;
  return 0;
}


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

int main(){
	string s,t;
	cin>>s>>t;
	vector<vector<pair<int,pair<int,int>>>> dp((int)s.length()+1, vector<pair<int,pair<int,int>>>((int)t.length()+1));
	for(int i = 0; i <= s.length(); i++){
		for(int j = 0; j <= t.length(); j++){
			if(s[i] == t[j] && i < s.length() && j < t.length()){
				dp[i+1][j+1].first = max(dp[i+1][j+1].first, dp[i][j].first + 1);
				dp[i+1][j+1].second = {i,j};
			}
			if(j < t.length())
			dp[i][j+1].first = max(dp[i][j+1].first, dp[i][j].first);

			if(i < s.length())
			dp[i+1][j].first = max(dp[i+1][j].first, dp[i][j].first);
		}
	}
	int i = s.length(), j = t.length();
	string answer = "";
	while(i > 0){
		if(i == 0)
			break;
		
		if(dp[i][j].first == dp[i][j-1].first){
			j--;
		}
		else if(dp[i][j].first == dp[i-1][j].first){
			i--;
		}
		else{
			answer += s[dp[i][j].second.first];
			i = i-1;
			j = j-1;

		}
	}
	reverse(answer.begin(), answer.end());
	cout<<answer<<endl;
	return 0;
}

Measured memory_bytes: 105984
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N, K;

    cin >> N >> K;

    int num[N];

    vector<int> v;

    int p;

    for (int i = 0; i < N; ++i)
    {
        cin >> p;
        v.push_back(p);
    }

    std::sort(v.begin(), v.end());

    int ans = 0;

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

        ans = ans + v.at(i);

    }

   cout << ans << endl;
}

Measured memory_bytes: 3620
/**************************
*                         *
*  Nothing Is Impossible  *
*                         *
**************************/
#include <algorithm>
#include <pthread.h>
#include <iostream>
#include <fstream>
#include <ctype.h>
#include <string>
#include <vector>
#include <thread>
#include <math.h>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <set>
#include <map>
#define GetRand(Min, Max) ((rand()%(int)(((Max) + 1)-(Min))) + (Min))
#define Rep(i, min, max) for(int i = min; i < max; ++i)
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef long double ld;
using namespace std;

void Solve(){
	ll a,b;	cin >> a >> b;
	if(b % a == 0){
		cout << a+b << endl;
	}else{
		cout << b-a << endl;
	}
}

int main(){
	ios::sync_with_stdio(NULL);
	cin.tie(NULL); cout.tie(NULL);
	Solve();
	return 0;
}

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

int Kaibun(int A){
    int kaibun = 0;
    while(true){
        kaibun += A % 10;
        A /= 10;
        if(A != 0){ kaibun *= 10; }
        else{ break; }
    }
    return kaibun;
}

int main(){
    int A,B;
    cin >> A >> B;
    int count = 0;
    
    for(int i=A;i<=B;i++){
        if(i == Kaibun(i)){ count++; }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.algorithm, std.range, std.typecons;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.to!(int[]);
    auto B = A.sort().group().map!(a => a).array;
    auto kind = B.length;
    assert(N % 2 == 1);
    if (kind % 2 == 0) {
        writeln(kind-1);
    } else {
        writeln(kind);
    }
}

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

#define int long long

struct Combination
{
  int mod;
  vector<int> mfact;
  vector<int> rfact;

  /*
    constructor : O(sz+log(mod))    
   */
  Combination(int sz, int mod) : mfact(sz+1), rfact(sz+1), mod(mod) {
    mfact[0] = 1;
    for ( int i = 1; i < (int)mfact.size(); i++ ) {
      mfact[i] = mfact[i-1]*i % mod;
    }
    rfact[sz] = inv(mfact[sz]);
    for ( int i = sz-1; i >= 0; i-- ) {
      rfact[i] = rfact[i+1]*(i+1) % mod;
    }
  }

  int fact(int k) const {
    return (mfact[k]);
  }

  int pow(int x, int n) const {
    int ret = 1;
    while ( n > 0 ) {
      if ( n & 1 ) (ret *= x) %= mod;
      (x *= x) %= mod;
      n >>= 1;
    }
    return (ret);
  }

  int inv(int x) const {
    return (pow(x, mod - 2));
  }

  /*
    permutation
   */
  int P(int n, int r) const {
    if ( r < 0 || n < r ) return (0);
    return (mfact[n]*rfact[n-r] % mod);
  }

  /*
    combination
   */
  int C(int n, int r) const {
    if ( r < 0 || n < r ) return (0);    
    return (mfact[n]*rfact[r]%mod * rfact[n-r]%mod);    
  }  

  /*
    combination with repetition
   */
  int H(int n, int r) const {
    if ( n < 0 || r < 0 ) return (0);
    return (r == 0 ? 1 : C(n+r-1, r));
  }

  /*
    stirling number
   */
  int S(int n, int r) const {
    int ret;
    for ( int i = 1; i <= r; i++ ) {
      
    }
  }

  /*
    bell number
   */
  int B(int n, int r) const {

  }
};

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, k;
  cin >> n >> k;

  Combination c(1000, 1e9+7);
  cout << c.P(k, n) << endl;  
  
  return 0;
}



Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <bitset>
#define ll long long
using namespace std;

bool judge(vector <int> A,int goal,bool orx);

int main(){
  string s,t;cin>>s>>t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());reverse(t.begin(),t.end());

  if(s<t) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;


  return 0;
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define um unordered_multiset
#define us unordered_set
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
#define debug(n1) cout<<n1<<"\n"
//fflush(stdin);
// do {
// // process permutation
// } while (next_permutation(permutation.begin(),permutation.end()));
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll a,b;
    cin>>a>>b;
    cout<<max((ll)0,a-2*b)<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update>
#define standardVar ll n,m,k,num,num1,num2,flag=0
#define nn <<"\n"
#define __ <<" "<<
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define ittr(x,v) for(auto x=v.begin();x!=v.end();x++)                  //COMMON FOR LOOP (ITERATOR)
#define itr(x,n) for(int x=0;x<n;x++)                                       //COMMON FOR LOOP (VARIABLE)
#define itrab(x,a,b) for(int x=a;x<b;x++)                                   //FOR LOOP WITH SPECIFIED START/END
#define itpr(v) ittr(x,v)cout<<*x<<" "; cout nn                         //PRINTS VECTOR,SET,MAP OF INTS
#define itppr(v) ittr(x,v)cout<<(*x).ff<<" "<<(*x).ss<<"  "; cout nn    //PRINTS VECTOR,SET,MAP OF PAIRS
#define sz(x) (ll)((x).size())
#define dTor(x) ((x)*pi)/180.0

#define pi   3.14159265359
#define INF  1000000000
#define INFF 1000000000000000000

typedef long long int ll;       //TYPEDEFS
typedef long double ld;
typedef vector<ll> vl;
typedef map<ll,ll> ml;
typedef set<ll> sl;
typedef string str;
typedef pair<ll, ll> pl;
typedef vector< pl > vpl;
typedef map<pl,ll> mpl;
typedef set< pl > spl;
typedef vector<str> vst;
typedef vector<vl> vvl;

const ll M=1000000007;          //COMMON MODULO PRIMES
const ll N=998244353;

ll power(ll x, ll y, ll p){     //MODULAR EXPONENTIATION
    ll res=1;
    x=x%p;
    if(x==0)
        return 0;
    while(y>0){
        if(y&1)
            res=(res*x)%p;
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}
ll inv(ll x, ll m){             //FERMAT INVERSE
    return power(x,m-2,m);
}
ll nCr(ll n, ll r){             //nCr MOD P  
    vl fac(10);
    if (r==0) 
        return 1;
    return (fac[n]*inv(fac[r],M)%M*inv(fac[n-r],M)%M)%M;
}
struct comp{                    //COMPARISON ON PAIRS
    template<typename T>        
    bool operator()(const T &a, const T &b){
        if (a.ff==b.ff)
            return (a.ss<b.ss);
        else
            return (a.ff<b.ff);
    }
};
bool mod(const pair<ll,ll> &a, const pair<ll,ll> &b){   //COMPARATOR FOR PAIRS (SORTING)
    if(a.ff!=b.ff)
        return (a.ff<b.ff);
    else
        return (a.ss>b.ss);
}
void sieve(){       //SIEVE OF ERATOSTHENES
    vector<bool> pr(1000000+1,1);
    for(ll i=2;i*i<=1000000;i++)
        if(pr[i]==1)
            for(ll j=i*i;j<=1000000;j+=i)
                pr[j]=0;
}
bool isValid(ll i, ll j, ll n, ll m){   //CHECKS FOR OVERFLOW
    if(i>=0&&i<n&&j>=0&&j<m){
        return true;
    }
    return false;
}

//MAIN FUNCTION STARTS HERE

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
        standardVar;
        str s,t;
        cin>>s>>t;
        n=sz(s);
        itr(i,n){
            if(t[i]!=s[i])
                flag=1;
        }
        if(flag==1)
            cout<<"No" nn;
        else
            cout<<"Yes" nn;
    return 0;
}

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

using namespace std;

int gcd(int a, int b);

int gcd3(int a, int b, int c);

int main() {
	int k;
	long sum = 0;
	cin >> k;
	
	for (int i = 1; i <= k; ++i) {
		for (int j = 1; j <= k; ++j) {
			for (int l = 1; l <= k; ++l) {
				sum += gcd3(i, j, l);
			}
		}
	}
	
	cout << sum;
	
	return 0;
}

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

int gcd3(int a, int b, int c) {
	return gcd(gcd(a, b), c);
}

Measured memory_bytes: 3624
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a<b){
            System.out.println("a < b");
        }else if(a>b){
            System.out.println("a > b");
        }else{
            System.out.println("a == b");
        }
        sc.close();
    }
}


Measured memory_bytes: 26124
#!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: 9124
<?php
  
fscanf(STDIN,"%d%d",$n,$k);
 

for($i=1;$i<=$n;$i++){
  $tmp = $n;
  $win_c = $i;
  while($k>$win_c){
  	$win_c *= 2;
    $tmp *= 2;
  }
  $win_per += 1/$tmp;
}



printf("%.14f", $win_per);
  
  
 



Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  string result;
  cin >> a >> b;
  if (a < b) {
    result = "a < b";
  } else if (a > b) {
    result = "a > b";
  } else if (a == b) {
    result = "a == b";
  }

  cout << result << endl;
}


Measured memory_bytes: 3172
fun main(args: Array<String>) {
    caddi2018d()
}

fun caddi2018d() {
    val n = readLine()!!.toInt()
    val aList = (1..n).map { readLine()!!.toInt() }

    val answer = if (aList.all { it % 2 == 0 }) "second" else "first"

    println(answer)
}


Measured memory_bytes: 38956
x1, y1, x2, y2 = map(int, input().split())
x3, y3 = x2 + y1 - y2, y2 - x1 + x2
x4, y4 = x3 + y2 - y3, y3 - x2 + x3
print(x3, y3, x4, y4)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include <vector>

#define LL long long

using namespace std;

long long A[200000] = { 0 };

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

	LL a,b;
	
	string s, ans = "";
	LL w;
	cin >> s >> w;

	for (int i = 0; i < s.length(); i += w) {
		ans += s.substr(i, 1);
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
main(){
  int a[11][11],i,j,n;
  for(;;){
    scanf("%d",&n);
    if(n==0)
      break;
    for(i=0;i<n;i++)
      for(j=0;j<n;j++)
	scanf(" %d",&a[j][i]);
    for(i=0;i<n+1;i++){
      a[n][i]=0;
      a[i][n]=0;
    }
    for(i=0;i<n;i++)
      for(j=0;j<n;j++)
	a[n][i]+=a[j][i];
    for(i=0;i<n+1;i++)
      for(j=0;j<n;j++)
	a[i][n]+=a[i][j];
    for(i=0;i<n+1;i++){
      for(j=0;j<n+1;j++)
	if(a[j][i]<10)
	  printf("    %d",a[j][i]);
	else if(a[j][i]<100)
	  printf("   %d",a[j][i]);
	else if(a[j][i]<1000)
	  printf("  %d",a[j][i]);
	else if(a[j][i]<10000)
	  printf(" %d",a[j][i]);
	else
	  printf("%d",a[j][i]);
      puts("");
    }
  }
  return 0;
}

Measured memory_bytes: 0
#define _GLIBCXX_DEBUG
typedef long long ll;
#include <bits/stdc++.h>

using namespace std;

ll mod = 1000000007;

template<class Type> inline bool chmax(Type& a, Type b) { if (a < b) { a = b; return 1; } return 0; }
template<class Type> inline bool chmin(Type& a, Type b) { if (a > b) { a = b; return 1; } return 0; }

template<class Type>
Type modpow(Type a, Type n, Type mod)
{
	Type res = 1;
	while (0 < n)
	{
		if (n & 1)
		{
			res = res * a % mod;
		}
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y)
	{
		swap(x, y);
	}

	while (0 < y)
	{
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
bool isPrime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2)
	{
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++)
	{
		if (isPrime[i])
		{
			Type j = i + i;
			while (j <= n)
			{
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binarySearchJudge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binarySearch(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok))
	{
		int mid = (ng + ok) / 2;
		if (binarySearchJudge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	int n, k;
	cin >> n >> k;
	int res = 1;
	for (int i = 0; i < n; i++)
	{
		int tmp = res;
		res = (tmp * 2 <= tmp + k) ? tmp * 2 : tmp + k;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    cin >> N;
    vector<double> v(N);
    priority_queue<double> que;
    REP(i, N) {
        cin >> v[i];
        que.push(-v[i]);
    }
    while(que.size() > 1) {
        double a = que.top();
        que.pop();
        double b = que.top();
        que.pop();
        // cout << (a + b) / 2 << endl;
        que.push((double)(a + b) / 2.0);
    }
    cout << -que.top() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod1 1000000007
#define ff first
#define ss second
#define INF INT_MAX
#define INFLL LLONG_MAX
typedef long long int ll;
// #define intLL unsigned long long int//used when x<2^64-1 && x>0
#define int long long//used when x<2^63-1
int fact[200005];
int power(int a, int b)
{
    int res=1;
    while(b)
    {
        if(b&1)
        {
            res*=a;
            res%=mod1;
        }
        a*=a;
        a%=mod1;
        b/=2;
    }
    return res;
}
int add(int a, int b)
{
    return (0LL+a+b)%mod1;
}
int sub(int a, int b)
{
    return add(a, mod1-b);
}
int mul(int a, int b)
{
    return (1LL*a*b)%mod1;
}
int inv(int x)
{
    return power(x, mod1-2);
}
int nCr(int n, int r)
{
    return mul(fact[n], inv(mul(fact[r], fact[n-r])));
}
int32_t main()
{

    IOS;
    int n, k;
    cin>>n>>k;
    int ans=0;
    for(int i=k;i<=n+1;i++)
    {
        int b=i*(i-1)/2;
        int a=i*(2*n+1-i);
        a=a/2;
        // cout<<a<<" "<<b<<"\n";
        ans=(0LL+ans+a-b+1)%mod1;
    }
    cout<<ans<<"\n";
    return 0;
}

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

#define MOD 1000000007ll
#define all(v) v.begin() , v.end()
#define allr(v) v.rbegin(), v.rend()
#define for0(i,n) for(__typeof(n) i = 0; i < n ; i++) 
#define forab(i,a,b) for(__typeof(a) i = a ; i < b ; i++) 
#define forba(i,b,a) for(__typeof(a) i = b ; i > a ; i--) 
#define forc(c,it) for(__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define pb     push_back
#define mp     make_pair
#define MAX 1005

int n;
ll ans;
vector<bool> isprime(MAX , true);
vector<int> primes;

void sieve()
{
	isprime[1] = false;
	int sq = sqrt(MAX) + 2;

	for(int i = 2 ; i < sq ; i++)
	{
		if(isprime[i])
		{
			for(int j = i*i ; j < MAX ; j = j + i)
				isprime[j] = false;
		}
	}

	for(int i = 2 ; i < MAX ; i++)
	{
		if(isprime[i])
			primes.pb(i);
	}
}

ll power(int n , int p)
{
	ll ans = 0;
	int x = p;

	while((n / x) > 0)
	{
		ans = ans + (n / x);
		x = x * p;
	}

	return ans;
}


int main(int argc, char const *argv[])
{
  scanf("%d" , &n);
  sieve();
  ans = 1;

  forc(primes , it)
  {
  	if(*it > n)
  		break;
  	ll x = power(n , *it);
  	ans = (ans * (x+1))%MOD;
  }

  printf("%lld" , ans);

  return 0;
} 

Measured memory_bytes: 256