akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int N;
vector<ll> a;
vector<ll> canuse;

int main() {
    cin >> N;
    a.resize(N); canuse.resize(N);
    for (int i = 0; i < N; i++) scanf("%Ld", &a[i]);
    map<ll,int> flags;
    for (int i = 0; i < N; i++) {
        flags[a[i]]++;
        if(flags[a[i]] == 2) {
            canuse.push_back(a[i]);
            flags[a[i]] = 0;
        }
    }
    sort(canuse.begin(), canuse.end(), greater<ll>());
    ll ans = (canuse.size() > 1) ? canuse[0]*canuse[1] : 0;
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using pii = pair<int,int>;

const int INF = 1e9;

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

    // (pos, length)
    // (first, last)
    vector<pii> P(N);

    for(int i=0; i<N; i++){
        int pos, length;
        cin >> pos >> length;

        P.at(i).first = pos - length;
        P.at(i).second = pos + length;
    }

    sort(P.begin(), P.end(), [](pii p1, pii p2)->bool{return p1.second < p2.second;});

    // for(pii p : P)cout << "(" << p.first << "," << p.second << ")" << " ";
    // cout << endl;

    int now = -INF;
    int count = 0;
    for(int i=0; i<N; i++){
        pii p = P.at(i);
        if(now <= p.first){
            now = p.second;
            count++;
        }
    }

    cout << count << endl;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using P = pair<ll,ll>;

int main(){
   ll n,k;cin >>n>>k;
   ll ans=0;

    for (int b =k+1; b <=n ; ++b) {
        ans+=(n/b)*(b-k);
        ans+=(n%b-k)>=0?(n%b-k+1):0;
        if(k==0)ans--;
    }
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e3+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n;
string s, t;

vector<int> yer[30];
ll dp[MAXN];
string dd[MAXN];
ll par[MAXN];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("../IO/int.txt","r",stdin);
        freopen("../IO/out.txt","w",stdout);
    #endif
    cin>>s>>t;
    int n = s.length(), m = t.length();
    for(int i = 0; i < m; i++){
        yer[(int)(t[i] - 'a')].push_back(i + 1);
    }
    par[0] = -1;
    for(int i = 1; i <= min(n, m); i++){
        dp[i] = INF;
    }
    for(int i = 0; i < n; i++){
        int cur = s[i] - 'a';
        for(int j = min(n, m); j > 0; j--){
            ll ind = dp[j - 1];
            auto in = upper_bound(yer[cur].begin(), yer[cur].end(), ind);
            if(in == yer[cur].end()) continue;
            if(dp[j] > *in){
                dd[j] = dd[j - 1] + t[*in - 1];
                dp[j] = *in;
            }
        }
    }
    ll ind = 0;
    for(int i = min(n, m); i > 0; i--){
        if(dp[i] != INF){
            cout<<dd[i]<<endl;
            break;
        }
    }

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

Measured memory_bytes: 7808
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

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

    int a,b;
    cin >> a >> b;
    int d = b - a;
    int tmp = 0;
    for(int i=1; i<d; i++) tmp += i;
    cout << tmp - a << endl;
    
    return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

int v[MAXN];

map<int, int> cnt[2];

vector<pii> vv[2];

void solve(){
	int n;
	scanf("%d", &n);
	REP(i, 0, n) {
		scanf("%d", &v[i]);
		cnt[i & 1][v[i]]++;
	}
	REP(i, 0, 3) {
		cnt[0][1e6 + i] = cnt[1][1e6 + i] = 0;
	}
	REP(i, 0, 2) {
		FA(it, cnt[i]) {
			vv[i].pb(mp(it->_2, it->_1));
		}
		SORT(vv[i]);
		reverse(BE(vv[i]));
	}
	int ans = 0;
	REP(i, 0, 3) {
		REP(j, 0, 3) {
			//printf("%d %d %d %d\n", vv[0][i]._1, vv[0][i]._2, vv[1][j]._1, vv[1][j]._2);
			if (vv[0][i]._2 != vv[1][j]._2) {
				ans = max(ans, vv[0][i]._1 + vv[1][j]._1);
			}
		}
	}
	printf("%d\n", n - ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 6520
n=int(input())
s=[]
for i in range(n):
    x=input()
    y=[]
    for i in x:
        y.append(i)
    y.sort()
    s.append(''.join(y))

d=dict()

for i in range(n):
    if s[i] not in d.keys():
        d[s[i]]=1
    else:
        d[s[i]]+=1
ans=0
for v in d.values():
    ans+=v*(v-1)/2
print(int(ans))

Measured memory_bytes: 19484
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vi A(3);
  cin>>A[0]>>A[1]>>A[2];
  sort(ALL(A),greater<ll>());
  ll ans = A[0]-A[1];
  if((A[1]-A[2])%2){
    cout<<ans+(A[1]-A[2])/2+2<<endl;
  }else{
    cout<<ans+(A[1]-A[2])/2<<endl;
  }
  return 0;
}

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

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

    int x, y;
    cin>>x>>y;  //入力

    int num = x > y? x%y : y%x;
    if(num == 0) {
        cout<<x<<endl;
        return 0;
    }

    for(int i = num; i > 0; i--) {
        if(num%i==0 && y%i==0) {
            cout<<i<<endl;
            return 0;
        }
    }
}



Measured memory_bytes: 3216
import sys
sys.setrecursionlimit(10000000)
n, m = map(int, input().split())
a = []
for _ in range(m):
    _a = int(input())
    try:
        if _a == a[-1]:
            continue
    except:
        pass
    a.append(_a)
a.append(n + 1)
m = len(a)

memo = {0: 1, 1: 1, 2: 2}
def chk(n):
    if n in memo:
        return memo[n]
    else:
        make(n)
        return memo[n]

def make(n):
    if n in memo:
        return
    make(n - 1)
    make(n - 2)
    memo[n] = (memo[n-1] + memo[n-2]) % 1000000007

for i in range(m - 1):
    if a[i] + 1 == a[i + 1]:
        print(0)
        exit()

cur = 0
tot = 1
#from sys import stderr
#for k in range(100):
#    print(f'0-{k}: {chk(k)}', file=stderr)

for i in range(m):
    nxt = a[i] - 1
    add = chk(nxt - cur)
    #print(f'{cur}-{nxt}: {add}', file=stderr)
    tot *= add
    tot %= 1000000007
    cur = nxt + 2
print(tot % 1000000007)


Measured memory_bytes: 92900
#include<iostream>
#include<string.h>

using namespace std;
int main()
{
  string s,t;
  cin>>s>>t;
  int count=0;
  for(int i=0;i<s.length();i++)
  {
      if(s[i]!=t[i])
      {
          count++;
      }
  }
  cout<<count;
  
}

Measured memory_bytes: 3916
def gcd(x: int, y: int) -> int:
    if x % y == 0:
        return y
    return gcd(y, x % y)


def main():
    x, y = map(int, input().split())
    if x < y:
        x, y = y, x
    result = gcd(x, y)
    print(result)


if __name__ == "__main__":
    main()



Measured memory_bytes: 5600
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <utility>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    long long int n,k;
    cin>>n>>k;
    vector<pair<long long int,long long int>>ab(n);
    for(int i=0;i<n;i++){
        cin>>ab[i].first>>ab[i].second;
    }
    sort(ab.begin(),ab.end());
    for(int i=0;;i++){
        k-=ab[i].second;
        if(k<=0){
            cout<<ab[i].first;
            break;
        }
    }
}

Measured memory_bytes: 1792
n = int(input())
b = list(map(int,input().split()))
a = [0]*n
sum = 0
a[0] = b[0]
a[n-1] = b[n-2]
if n == 2:
    sum = b[0]*2
else:
    for i in range(n-2):
        if b[i] <= b[i+1]:
           a[i+1] = b[i]
        else:
            a[i+1] = b[i+1]
    for i in range(n):
        sum += a[i]
        
print(sum)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a += b;
	a %= MOD;
}


string s;
bool done[225816][2];
int memo[225816][2],n;

int solve(int p, int c){
	if(p==n){
		return 0;
	}
	if(done[p][c]){
		return memo[p][c];
	}
	done[p][c] = true;
	if(c){
		memo[p][c] = ((s[p]=='.')?1:0)+solve(p+1,c);
	}else{
		memo[p][c] = min(solve(p,1),((s[p]=='#')?1:0)+solve(p+1,c));
	}
	return memo[p][c];
}

int main(void){
	int i;
	cin >> n;
	cin >> s;
	cout << solve(0,0) << endl;
	return 0;
}


Measured memory_bytes: 14980
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int cou=0;
    while(b<=a){
        b*=2;
        cou++;
    }
    while(c<=b){
        c*=2;
        cou++;
    }
    if(cou<=k) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3588
n, t = map(int, input().split())
route = [list(map(int, input().split())) for _ in range(n)]
ans = float("inf")
for r in route:
	if r[1] <= t:
		ans = min(ans, r[0])

if ans == float("inf"):
	print("TLE")
else:
	print(ans)

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
q = int(input())

ls = [0]*q
rs = [0]*q

for i in range(q):
  l, r = map(int, input().split())
  ls[i] = l
  rs[i] = r

n = max(rs)
ass = []
is_prime = [True]*(n+1)
is_prime[0] = False
is_prime[1] = False

is_like = [0]*(n+1)
  
for i in range(2, n+1):
  if not is_prime[i]:
    continue
  if i%2 == 1 and is_prime[(i+1)//2] == True:
    is_like[i] = 1
  for j in range(i*2, n+1, i):
    is_prime[j] = False

from itertools import accumulate
cum_like = list(accumulate(is_like))

#print(cum_like)
for i in range(q):
  r = rs[i]
  l = ls[i]
  print(cum_like[r]-cum_like[l-1])


Measured memory_bytes: 52188
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((ll)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

bool is_prime(ll n) {
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0)
      return false;
  }
  return n != 1;
}

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

  while (true) {
    if (is_prime(X)) {
      cout << X << endl;
      return 0;
    } else {
      X++;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
constexpr double eps = 1e-6;
constexpr ll LINF = 100200300400500600ll;
constexpr int INF = 2*((1<<30)-1)+1;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
constexpr int dx[4] = {0,1,0,-1};
constexpr int dy[4] = {-1,0,1,0};
constexpr int mod = 1000000007;
#define Yes(ifeq) cout<<(( ifeq )? "Yes":"No")<<endl;

void Main(){
  int r;
  cin>>r;
  cout<<setprecision(6)<<2*r*3.14159265358979323846<<endl;
  
} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 3792
#include <cstdio>
#include <iostream>
#include <algorithm>
inline int Get() {
	char ch;
	while ((ch = getchar()) < '0' || ch > '9');
	int Num = ch - '0';
	while ((ch = getchar()) >= '0' && ch <= '9')
		Num = (Num << 3) + (Num << 1) + ch - '0';
	return Num;
}
const int N = 1e5 + 5;
int n, m, que[N], qn, fa[N], g[N], deg[N], flag[N], a[N], cnt;
int tot, first[N], next[N << 1], end[N << 1], ans, sum[N], ret[N], w[N];
inline void AddEdge(int x, int y) {
	++deg[x], ++deg[y];
	next[++tot] = first[x], first[x] = tot, end[tot] = y;
	next[++tot] = first[y], first[y] = tot, end[tot] = x;
}
int calc(int x) {
	que[qn = 1] = x, fa[x] = 0;
	for (int ql = 1, u; u = que[ql], ql <= qn; ++ql)
		for (int k = first[u], v; v = end[k], k; k = next[k])
			if (v != fa[u] && deg[v] < 2) fa[v] = u, que[++qn] = v;
	
	int res = 0;
	for (int qr = qn, u; u = que[qr], qr; --qr) 
		for (int k = first[u], v; v = end[k], k; k = next[k])
			if (v != fa[u] && deg[v] < 2) {
				int delta = 1 - g[v];
				res += delta > 0 ? delta : -delta;
				g[u] += delta, g[v] += delta;
			}
	
	return res;
}
inline int Abs(int x) {
	return x > 0 ? x : -x;
}
int main() {
	n = Get(), m = Get();
	for (int i = 1; i <= m; ++i) AddEdge(Get(), Get());
	
	for (int i = 1; i <= n; ++i) if (deg[i] < 2) que[++qn] = i, flag[i] = true;
	for (int ql = 1, u; u = que[ql], ql <= qn; ++ql)
		for (int k = first[u], v; v = end[k], k; flag[v] = true, k = next[k])
			if ((deg[v]--) == 2) que[++qn] = v;
		
	int x = 0;
	for (int i = 1; i <= n; ++i) if (deg[i] > 1) x = i;
	
	if (!x) {
		ans = calc(1);
		printf("%d\n", g[1] == 1 ? ans : -1);
		return 0;
	}

	a[cnt = 1] = x;
	while (true) {
		int u = a[cnt];
		for (int k = first[u], v; v = end[k], k; k = next[k])
			if (deg[v] > 1 && v != a[cnt - 1]) {
				a[++cnt] = v; break;
			}
			
		if (a[cnt] == x) {
			--cnt; break;
		}
	}
		
	for (int k = 1, u; u = a[k], k <= cnt; ++k) if (flag[u]) ans += calc(u);
	for (int k = 1, u; u = a[k], k <= cnt; ++k) sum[k] = 1 - g[u];
	
	ret[1] = 0;
	for (int k = 2; k <= cnt; ++k) ret[k] = sum[k] - ret[k - 1];
	
	if (cnt & 1) {
		int y = sum[1] - ret[1] - ret[cnt];
		if (y & 1) {
			puts("-1");
			return 0;
		}
		
		y >>= 1;
		for (int i = 1; i <= cnt; ++i)
			if (i & 1) ans += Abs(ret[i] + y); else ans += Abs(ret[i] - y);
	}
	else {
		if (ret[1] + ret[cnt] != sum[1]) {
			puts("-1");
			return 0;
		}
		
		for (int i = 1; i <= cnt; ++i)
			if (i & 1) w[i] = -ret[i]; else w[i] = ret[i];
			
		std :: sort(w + 1, w + cnt + 1);
		for (int i = 1; i <= cnt; ++i)
			if (i * 2 <= cnt) ans -= w[i]; else ans += w[i];
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 4992
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll K;
    cin >> K;
    if (K % 2 == 0) {
        cout << (K / 2) * (K / 2) << endl;
    } else {
        cout << (K / 2) * (K / 2 + 1) << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
const int maxn = 1e5 + 5 ;
int n , m ;
char s[maxn] ;
int cnt = 0 ;
int a[maxn] ;
int p[maxn] ;
int ans[maxn] ;
bool die()
{
	if(s[0] == '1' || s[n] == '1')
	  return 1 ;
	int max1 = 0 ;
	for(int i = 1 ; i <= n ; i ++)
	{
		if(s[i] == '0')  
		{
			a[++ cnt] = i ;
			continue ;
		}	
		int j = i ;
		while(j + 1 <= n && s[j + 1] == '1')
		  j ++ ;
		max1 = max(max1 , j - i + 1) ;
        i = j ;
	}
	if(max1 >= m)
	  return 1 ;
	return 0 ;
}
int main()
{
	scanf("%d%d" , &n , &m) ;
	scanf("%s" , s) ;
	if(die())
	  printf("-1\n") ;
	else
	{
		for(int i = 1 ; i <= m ; i ++)
		{
			if(i > n)
			  break ;
			if(s[i] == '0')
			  p[i] = 0 ;			  
		}
		for(int i = m + 1 ; i <= n ; i ++)
		{
			if(s[i] == '1')  continue ;
			int now = lower_bound(a + 1 , a + cnt + 1 , i - m) - a ;
			p[i] = a[now] ;
		}
		int now = n ;
		int x = 0 ;
		while(now != 0)
		{
			ans[++ x] = now - p[now] ;
			now = p[now] ;
		}
		for(int i = x ; i >= 1 ; i --)
		  printf("%d " , ans[i]) ;
	}
	return 0 ;
}

Measured memory_bytes: 1664
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int k;
  cin >> k;
  vector<long long> v;
  for (int i = 1; i <= 9; i++) v.push_back(i);
  
  long long ans;
  
  while (1) {
    
    if (k <= v.size()) {
      ans = v[k - 1];
      break;
    }
    k -= v.size();
    
    vector<long long> w = v;
    v = {};
    for (long long x : w) {
      for (int i = -1; i <= 1; i++) { // -1, 0, +1
        int a = x % 10 + i;
        if (a < 0 || a > 9) continue;
        v.push_back(x * 10 + a);
      }
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 1784
<?php
fscanf(STDIN, "%s", $T);
$T = str_replace('?', 'D', $T);
echo $T;
//calc($T);

function calc($S) {
    $score = 0;
    $len = strlen($S);
    $arr = str_split($S);
    for ($i = 0; $i < $len; $i++) {
        if ($arr[$i] === 'D') {
            $score++;
        }
        if ($i > 0 && $arr[$i - 1] === 'P') {
            $score++;
        }
    }
    echo PHP_EOL . $score;
}

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

struct edge{ int a,b,cost; };

int parent[100],height[100];

bool comp(const edge& e1,const edge& e2){
	return e1.cost < e2.cost;
}

int find(int x){
	if(parent[x] == x) return x;
	else return parent[x] = find(parent[x]);
}

void unite(int x,int y){
	x = find(x);
	y = find(y);
	if(x == y) return;
	if(height[x] < height[y]){
		parent[x] = y;
	}else {
		parent[y] = x;
		if(height[x] == height[y]) height[x]++;
	}
}

bool same(int x,int y){
	return find(x) == find(y);
}

int main(){
	int n,res = 0;
	cin >> n;
	vector<edge> es;
	for(int i = 0;i < n;i++) parent[i] = i;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			int t;
			cin >> t;
			if(t != -1) es.push_back({i,j,t});
		}
	}
	sort(es.begin(),es.end(),comp);
	for(int i = 0;i < es.size();i++){
		edge e = es[i];
		if(!same(e.a,e.b)){
			unite(e.a,e.b);
			res += e.cost;
		}
	}
	cout << res << endl;
	return 0;
}

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

int main() {
	string s, str;
	cin >> s >> str;
	int a, b;
	cin >> a >> b;
	string u;
	cin >> u;
	if(u == s)
		--a;
	else
		--b;
	cout << a << ' ' << b;
	
}

Measured memory_bytes: 3572
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		long x = sc.nextLong(), y = sc.nextLong();
		long ans = 1;
		while(x < y) {
			x *= 2;
			if(x <= y) {
				ans++;
			}
		}
		System.out.println(ans);
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 32692
#include <stdio.h>

int main(void)
{
	float freq[6] = {165.0, 170.0, 175.0, 180.0, 185.0};
	
	int n;
	float height;
	int count[6] = {};
	int i, j;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%f", &height);
		
		for (j = 0; j < 5; j++){
			if (height < freq[j]){
				break;
			}
		}
		
		count[j]++;
	}
	
	for (i = 0; i < 6; i++){
		printf("%d:", i + 1);
		for (j = 0; j < count[i]; j++){
			printf("*");
		}
		printf("\n");
	}
	
	return (0);
}

Measured memory_bytes: 636
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s;
    cin >> s;
    int cnt = 0;
    int max_cnt = 0;
    rep(i, 3) {
        if (s[i] == 'R') ++cnt;
        else {
            max_cnt = max(max_cnt, cnt);
            cnt = 0;
        }
    }
    max_cnt = max(max_cnt, cnt);
    cout << max_cnt << endl;
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <float.h>
#include <tgmath.h>
#define MOD 1000000007
using namespace std;
#define INT_MAX 2147000000
#define LONG_MAX 9223372036854775806

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    double a,b,x;
    cin >> a >> b >> x;
    ll s = a*a;
    ll tai = a*a*b;
    double amari = tai-x;
    double T;
    
    if(tai<x*2){
    T = (amari*2.0)/(a*a*a);
    }else{
        T = (a*b*b)/(2*x);

    }
    
    double front = 0;
    double back = M_PI/2;
    double i;
    for(int j=0;j<1000000;j++){
        i = (front+back)/2;
        if(T<tan(i))back = i;
        else front = i;
    }
    
    i *= (180/M_PI);
    printf("%2.8f\n",i);
    return 0;
}

Measured memory_bytes: 384
def upper_bound(A, x):
    s, t = -1, len(A)
    while t - s > 1:
        m = (s+t)//2
        if A[m] > x:
            t = m
        else:
            s = m
    
    return t

def lower_bound(A, x):
    s, t = -1, len(A)
    while t - s > 1:
        m = (s+t)//2
        if A[m] >= x:
            t = m
        else:
            s = m
    
    return t


N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

ans = 0
for b in B:
    ans += lower_bound(A, b) * (N - upper_bound(C, b))

print(ans)

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

using namespace std;
using ll = long long;

vector<int> edges[100005];

class UF{
public:
    vector<int> par;
    UF(int size){
        for(int i=0;i<size;i++) par.push_back(-1);
    }
    int find(int u){
        if(par[u]<0) return u;
        return par[u] = find(par[u]);
    }
    void merge(int u, int v){
        u = find(u);
        v = find(v);
        if(u==v) return;
        par[u] += par[v];
        par[v] = u;
    }
};

int n, m, k;

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

    cin>>n>>m>>k;

    UF* uf = new UF(n+5);
    for(int i=0;i<m;i++){
        int a, b;
        cin>>a>>b;
        a--;b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
        uf->merge(a, b);
    }
    for(int i=0;i<k;i++){
        int c, d;
        cin>>c>>d;
        c--;d--;
        edges[c].push_back(d);
        edges[d].push_back(c);
    }
    for(int i=0;i<n;i++){
        int foundi = uf->find(i);
        int ans = (-uf->par[foundi]) -1;
        for(int z: edges[i]){
            z = uf->find(z);
            if(foundi == z)
                ans--;
        }
        cout<<ans<<' ';
    }
    return 0;
}

Measured memory_bytes: 8056
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <algorithm>
#include <map>
#include <numeric>
#include <iomanip>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int MAX = 100;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */

/* function */

/* main */
int main() {

    int n; cin >> n;
    vector< priority_queue<int> > v(n, priority_queue<int>());
    int q; cin >> q;
    while (q--) {

        int op; cin >> op;
        int t; cin >> t;

        if (op == 0) {
            int x; cin >> x;
            v[t].push(x);

        }
        else if (op == 1) {
            if (v[t].empty())
                continue;
            cout << v[t].top() << '\n';
        }
        else {
            if (v[t].empty())
                continue;
            v[t].pop();
        }
    }
}



Measured memory_bytes: 4060
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main(){
  string S;
  cin >> S;
  int n = S.size();
  int s[n];
  for (int i = 0; i < n; i++){
    s[i] = (int)(S[i] - '0');
  }

  int ans = 753;
  for (int i = 0; i < n - 2; i++){
    int num = s[i] * 100 + s[i+1] * 10 + s[i+2];
    if (ans > abs(753 - num)) {
      ans = abs(753 - num);
    }
  }
  
  printf("%d\n", ans);
  
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;

int N, M;

vector<ll> x,y,z;

ll happy(int i, int j, int k){
	ll ans=0;
	vector<ll> v(N);
	for(int n=0;n<N;n++){
		v[n] = i*x[n] + j*y[n] + k*z[n];
	}
	sort(v.begin(),v.end(),std::greater<ll>());
	for(int m=0;m<M;m++){
		ans += v[m];
	}
	return ans;
}

ll sub_solve(int n){
	int i[3];
	for(int l=0;l<3;l++){
		if(n%2==0) i[l] = 1;
		else i[l] = -1;
		n /= 2;
	}
	return happy(i[0],i[1],i[2]);
}

void solve(){
	ll ans = 0;

	for(int i=0;i<8;i++){
		ans = max(ans, sub_solve(i));
	} 
	cout << ans << endl;
}


int main(){
	cin >> N >> M;
	x.resize(N);y.resize(N);z.resize(N);
	for(int i=0;i<N;i++){
		cin >> x[i] >> y[i] >> z[i];
	}

	solve();
	return 0;
}

Measured memory_bytes: 256
s = input()

n = len(s)
s_ans = ""

for i in range(n):
    if s[i] == "0":
        s_ans = s_ans + "0"

    elif s[i] == "1":
        s_ans = s_ans + "1"

    elif s[i] == "B":
        len_ans = len(s_ans)
        if len_ans >= 1:
            s_ans = s_ans[:len_ans-1]

        elif len_ans == 0:
            s_ans = s_ans

        else:
            print("error2")

    else:
        print("error1")

print(s_ans)

Measured memory_bytes: 8976
import sys
input = sys.stdin.readline

while True:
    n, m = map(int, input().split())
    if n == 0:
        break
    a = sorted(list(map(int, input().split())), reverse=True)
    ans = 0
    for i in range(n):
        for j in range(i+1, n):
            tmp = a[i] + a[j]
            if tmp <= m:
                ans = max(ans, tmp)
    if ans == 0:
        print("NONE")
    else:
        print(ans)



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

int solve(){
  string s; cin >> s;
  for(int i=0; i<8; i++){
    int n = s[0]-'0';
    string ans;
    ans+=s[0];
    for(int j=0; j<3; j++){
      if(i>>j&1){
        n += s[j+1]-'0';
        ans+='+';
      }else{
        n -= s[j+1]-'0';
        ans+='-';
      }
      ans+=s[j+1];
    }
    if(n==7){
      cout << ans+"=7" << endl;
      return 1;
    }
  }
}

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


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

void A()
{
  int K, A, B;
  cin >> K >> A >> B;
  
  for( int i = A/K; i < B/K+1; ++i ){
  	if( A <= K*i && K*i <= B ){
      cout << "OK" << endl;
      return;
    }
  }

  cout << "NG" << endl;
}

void B()
{
  long long int X;
  cin >> X;
  
  long long int base = 100;
  long long int ans = 0;
  while( true ){
    ++ans;
    base = base * 1.01;
    
    if( X <= base ){
      cout << ans << endl;
      return;
    }
  } 
}

int main()
{
  //A();
  B();
  
  return 0;
}


Measured memory_bytes: 3636
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

namespace CSharp_Shell
{

    public static class Program 
    {
        public static void Main() 
        {
        int a = int.Parse(Console.ReadLine());
        if(a==1){a=0;}
        else if(a==0){a=1;}
        Console.WriteLine(a);
        }
    }
}

Measured memory_bytes: 27544
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m; cin >> n >> m;
	vector<int> a(n),b(m),c(n,0);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	int mx=0;
	for(int i=0;i<m;i++){
		cin >> b[i];
		for(int j=0;j<n;j++){
			if(a[j]<=b[i]){
				c[j]++;
				mx=max(mx,c[j]);
				break;
			}
		}
	}
	for(int i=0;i<n;i++){
		if(c[i]==mx){
			cout << i+1 << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3120
n = gets.to_i
a = gets.split.map &:to_i

min = a.min
max = a.max
imin = a.index min
imax = a.index max

ans = []

if min>0 || min.abs<max.abs then
  n.times{|i|
    ans << [imax+1, i+1]
  }
  (n-1).times{|i|
    ans << [i+1, i+2]
  }
else
  n.times{|i|
    ans << [imin+1, i+1]
  }
  (n-1).times{|i|
    ans << [n-i, n-i-1]
  }
end

p ans.size
ans.each{|t| puts t*' '}

Measured memory_bytes: 1788
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func YesOrNo(b bool) {
	if b {
		puts("Yes")
	} else {
		puts("No")
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n, k := nextInt(), nextInt()
	a := nextInts(n)

	for i := k; i < n; i++ {
		YesOrNo(a[i] > a[i-k])
	}
}


Measured memory_bytes: 6008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int k, a, b;
  cin >> k >> a >> b;
  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
}

Measured memory_bytes: 3632
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    a = list(map(int, input().split()))
    b = sum(a)/n
    diff = 10000
    res = 0
    for i in range(n):
        if diff>abs(b-a[i]):
            diff = abs(b-a[i])
            res = i
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
n= int(input())
h = [int(i) for i in input().split()]
import numpy as np
h = np.array(h)
zero = np.array([int(0) for i in range(len(h))])

def calc(h, zero, minus):
    for k in range(len(h)):
        if minus[k] != 0:
            if k == len(h) - 1:
                zero[k] = zero[k] + 1
                return
            for w in range(k+1, len(h)):
                if minus[w] == 0:
                    zero[k:w] = zero[k:w] + 1
                    return
                elif w == len(h) - 1:
                    zero[k::] = zero[k::] + 1
                    return

def main(h, zero):
    for i in range(1, 1000001):
        minus = h - zero
        if np.sum(minus) == 0:
            print(i-1)
            return
        calc(h ,zero, minus)
main(h, zero)

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

int main()
{
  int c[10][10];
  int h, w;
  int a[200][200];

  cin >> h >> w;
  for(int i = 0; i < 10; i++)
    for(int j = 0; j < 10; j++)
      cin >> c[i][j];
  for(int i = 0; i < h; i++)
    for(int j = 0; j < w; j++)
      cin >> a[i][j];

  for(int k = 0; k < 10; k++)
    for(int i = 0; i < 10; i++)
      for(int j = 0; j < 10; j++)
        c[i][j] = min(c[i][j], c[i][k] + c[k][j]);

  int ans = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(a[i][j] == -1) continue;
      ans += c[a[i][j]][1];
    }
  }

  cout << ans << endl;

  return 0;
}

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

ll dp[40][40];
bool taken[40][40];
ll nums_interleaf(string& a,string& b,string& c,int i,int j)
{
    if(i==0 && j==0)
        return 1;
    if(dp[i][j]!=-1)
        return dp[i][j];
    ll ans = 0;
    if(i>=0 && a[i-1]==c[i+j-1])
    {
        ll cur = nums_interleaf(a,b,c,i-1,j);
        ans += cur;
    }
    if(j>=0 && b[j-1]==c[i+j-1])
    {
        ll cur = nums_interleaf(a,b,c,i,j-1);
        ans += cur;
    }
    dp[i][j] = ans;
    return dp[i][j];
}

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

    int n;
    cin>>n;
    string s;
    cin>>s;
    string org = s.substr(0,n);
    string mir = s.substr(n,n);
    ll cnt = 0;
    for(int i=0;i<(1<<n);++i)
    {
        string blu = "";
        string red = "";
        for(int j=0;j<n;++j)
        {
            if( (i>>j)&1 )
                blu += org[j];
            else
                red += org[j];
        }

        reverse(blu.begin(),blu.end());
        reverse(red.begin(),red.end());
        for(int i=0;i<40;++i)
            for(int j=0;j<40;++j)
            {
                dp[i][j] = -1;
                taken[i][j] = 0;
            }
        cnt += nums_interleaf(blu,red,mir,blu.size(),red.size());
    }
    cout<<cnt;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  int ans=-1,len=0;
  string s;
  while(getline(cin,s)){
    //getline(cin,s);
    //if(s==EOF) break;
    while(1/*len<30*/){
      ans = s.find("the");
      if(ans!=-1)break;
      ans = s.find("this");
      if(ans!=-1)break;
      ans = s.find("that");
      if(ans!=-1)break;
      for(int i=0;i<s.size();i++){
	if(s[i]=='z') s[i]='a';
	else if(s[i]>='a' && s[i]<'z') s[i]++;
      }
      //len++;
    }
    cout << s << endl;
  }
}

Measured memory_bytes: 1176
import java.util.Scanner;

public class Main {

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

		int N = scanner.nextInt();
		String s= scanner.next();

		int[] leftside = new int[N];
		int[] rightside = new int[N];

		leftside[0]=0;
		rightside[N-1]=0;
		for(int i=1;i<N;i++) {
			leftside[i]=(s.charAt(i-1)=='W')?leftside[i-1]+1:leftside[i-1];
			rightside[N-1-i]=(s.charAt(N-1-i+1)=='E')?rightside[N-1-i+1]+1:rightside[N-1-i+1];
		}

		int min = N+1;
		int wk;
		for(int i = 0;i < N;i++) {
			wk = leftside[i]+rightside[i];
			min=(min>wk)?wk:min;
		}

		System.out.println(min);

	}

}


Measured memory_bytes: 31572
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define str string
#define ld long double
#define vec vector
#define vll vec<ll>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()
#define kai "\n"
#define yuque priority_queue
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mie min_element
#define mae max_element
#define tos to_string
#define sep setprecision
#define lob lower_bound
#define upb upper_bound
#define nep next_permutation
#define MOD 1000000007ll
using namespace std;
void solve();
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed;
	solve();
}
struct pea{
	ll f,s;
	bool operator<(const pea &c)const{
		return f!=c.f?f<c.f:s<c.s;
	};
};
//深さ優先探索
vec<bool> seen;
vll ans;
void dfs(const vec<vll> &c,ll i=0){
	seen[i]=true;
	rep(j,0,c[i].size()){
		if(!seen[c[i][j]])dfs(c,c[i][j]);
	}
	ans.pub(i);
}
void solve(){
	ll v,e;cin>>v>>e;
	seen.resize(v,false);
	vec<vll> c(v);
	rep(i,0,e){
		ll s,t;cin>>s>>t;
		c[s].pub(t);
	}
	rep(i,0,v)if(!seen[i])dfs(c,i);
	rrep(i,ans.size()-1,0)cout<<ans[i]<<kai;
}


Measured memory_bytes: 3872
N = gets.to_i
A,B = N.times.map{gets.split.map(&:to_i)}.transpose
S = N.times.sort_by{|i| A[i] + B[i] }.reverse
pa = pb = 0
S.each_with_index do |s, i|
  if i.even?
    pa += A[s]
  else
    pb += B[s]
  end
end
puts pa - pb

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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9+7;
const int mod = 1e9+7;

int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;

    int cnt=k;

    for (;;) {
        if(a<b)break;
        b*=2;
        cnt--;
        if(a<b)break;
    }

    for (;;) {
        if(b<c)break;
        c*=2;
        cnt--;
        if(b<c)break;
    }

    if(cnt>=0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int n,l;
    cin>>n>>l;
    int a[n];
    int ans=0;
    int min=1000000;
    int num;
    rep(i,1,n){
        a[i-1] = i+l-1;
        ans += a[i-1];
        if(min>abs(a[i-1])){
            min = abs(a[i-1]);
            num = i-1;
        }
    }
    ans = ans - a[num];
    cout<<ans<<endl;
    return 0;
}

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

//関数宣言
//int func(int x, int y);

int main(void){

  //スカラー入力
  long long int N;

  scanf("%lld", &N);

  int i_max;
  i_max = floor(sqrt((double) N));
  /* printf("%d\n", i_max); */

  long long int R,m,ans=0;
  for(long long int i=1; i<=i_max; i++){
    R = (N-i)%i;
    if(R==0){
      m = (N-i)/i;
      if(m>i){
        ans = ans+m;
      }
      /* printf("i=%lld, m=%lld\n", i, m); */
    }
  }
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

unsigned long long int combi(int a,int b)
{
    int i;
    unsigned long long int C=1;
    for(i=1;i<=b;i++){
        C = C*(a-i+1)/i;
    }
    return C;
}

int main()
{
    int N,A,B,i,j,sum,sub=0;
    unsigned long long int v[50],max,C=0,ave=0;
    scanf("%d %d %d",&N,&A,&B);
    for(i=0;i<N;i++){
        scanf("%lld",&v[i]);
        for(j=i;j>0;j--){
            if(v[j]>v[j-1]){
                max=v[j];
                v[j]=v[j-1];
                v[j-1]=max;
            }
        }
    }
    if(v[0]==v[A-1]){
        sum=A;
        for(i=A;i<N;i++){
            if(v[0]==v[i]){
                sum++;
            }
            else break;
        }
        for(i=A;i<=B;i++){
            C+=combi(sum,i);
            if(i==sum) break;
        }
        printf("%lf\n%lld\n",(double)v[0],C);
    }
    else{
        sum=0;
        for(i=0;i<A;i++) ave+=v[i];
        for(i=0;i<N;i++){
            if(v[A-1]==v[i]){
                sum++;
                if(i<A) sub++;
            }
            else if(i>=A && v[A-1]!=v[i]) break;
        }
        printf("%lf\n%lld\n",(double)ave/A,combi(sum,sub));
    }
    return 0;
}

Measured memory_bytes: 128
# -*- coding:utf-8 -*-
import math

h_len,m_len,h,m = map(int,input().split())
m_deg = m/60*360
h_deg = h/12*360 + m/60*1/12*360
theta = math.radians(abs(m_deg-h_deg))

z = math.sqrt(h_len**2 + m_len**2 - 2*h_len*m_len*math.cos(theta))

print(z)

Measured memory_bytes: 9384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main()
{
	int n, k, q;
	cin >> n >> k >> q;
	vector<int> a(q);
	rep(i, q) cin >> a.at(i);
	vector<int> score(n, k-q);
	vector<string> result(n);
	rep(i, q) {
		score.at(a.at(i) - 1)++;
	}
	rep(i, n) {
		if (score.at(i) > 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
template <class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >> p.second;
	return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
	rep(i, v.size()) { is >> v[i]; }
	return is;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
long long modpow(long long a, long long n, long long mod = (1LL << 62)) {
	long long res = 1;
	if (n == 0) return 0;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int main() {
	int n, m;
	int ans = 0;
	cin >> n >> m;
	VPi data(m);
	cin >> data;
	//	sort(all(data));
	bool find = false;
	deque<int> at;
	int cnt;
	for (int i = modpow(10, n - 1); i < modpow(10, n) and !find; i++) {
	//	clog << i << endl;
		find = true;
		at.clear();
		cnt = i;
		if (cnt == 0) {
			at.pb(0);
		}
		while (cnt != 0) {
			at.push_front(cnt % 10);
		//	clog << at.front();
			cnt /= 10;
		}
		
		rep(j, m) {
			if (at[data[j].F - 1] != data[j].S) {
				find = false;
			}
		//	clog << find << endl;
			if (!find) break;
		}
		if (find) {
			ans = i;
		}
	}
	if (find)
		cout << ans << endl;
	else
		cout << -1 << endl;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
#define codejam cout<<"Case #"<<ii+1<<": ";
#define impossible cout<<"IMPOSSIBLE"<<endl;
#define error(s) throw runtime_error(s)
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=8e18;
const int32_t LOG=21;
const int MOD=MOD2;


int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      {
          int k,a,b;
          cin>>k>>a>>b;
          rep(i,a,b+1)
          {
             if(i%k==0)
             {
                cout<<"OK"<<endl;
                return 0;
             }
          }
          cout<<"NG"<<endl;
      }

      return 0;                         
}

/*
 TIPS:
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/

Measured memory_bytes: 3652