akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define  all(v)     (v).begin(),(v).end()
#define  rall(v)    (v).rbegin(),(v).rend()
#define  pb         push_back
#define  eb         emplace_back
#define  mp         make_pair
#define  ff         first
#define  ss         second
#define  pf         push_front
#define  bs         binary_search
#define  lb         lower_bound
#define  ub         upper_bound
#define  dec(x)   fixed<<setprecision(x)
#define  lcm(a,b)   (a*b/__gcd(a,b))
const ll inf=LLONG_MAX;
const ll mod=1e9+7;
const ld pi=acos(-1);
                    
void solution(){

    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans1=(a*c);
    ll ans2=(a*d);
    ll ans3=(b*c);
    ll ans4=(b*d);
    ll ans=max(ans1,max(ans2,max(ans3,ans4)));
    cout<<ans;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t;
    t=1;
    //cin>>t;
    while(t--){
        solution();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    ll sum = 0;
    rep(i,n) {
        if (!(i&1)) sum += a[i];
        else sum -= a[i];
    }
    cout << sum << endl;
    REP(i,n) {
        sum *= -1;
        sum += 2*a[i-1];
        cout << sum << endl;
    }
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;



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

    ll x = h;
    ll count = 0;
    while(x != 1){
        x /= 2;
        count += 1;
    }
    cout << fixed << (ll)(pow(2,(count + 1)) - 1) << endl;
}


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

int main(){
  char S[3];
  cin>>S;
  sort(S,S+3);
  if(S[0]=='a' && S[1]=='b' && S[2]=='c')
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
	
	return 0;
	}

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

const int N = 100010;

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

  vector<int> a(n);
  vector<int> odd(N), even(N);
  int odd_max = 0, oddv = 0;
  int even_max = 0, evenv = 0;
  rep(i,n) {
    cin >> a[i];
    if(i % 2 == 0) {
      even[a[i]]++;
      if(even[a[i]] > even_max) {
        even_max = even[a[i]];
        evenv = a[i];
      }
    }
    else {
      odd[a[i]]++;
      if(odd[a[i]] > odd_max) {
        odd_max = odd[a[i]];
        oddv = a[i];
      }
    }
  }

  int answer = n + 1;
  // SET EVEN
  for (int i = 0; i < N; i++) {
    if(i == evenv) continue;

    int tmp = n - even_max - odd[i];
    answer = min(answer, tmp);
  }
  // SET ODD
  for (int i = 0; i < N; i++) {
    if(i == oddv) continue;

    int tmp = n - odd_max - even[i];
    answer = min(answer, tmp);
  }

  cout << answer << endl;

  return 0;
}



Measured memory_bytes: 4552
#include <iostream>
#include <cstdio>
using namespace std;
const int maxn = 2e5 + 50,maxm = 5.3e5,mod = 924844033,g = 5;
int n,x,y,cnt,N,last[maxn],d[maxn],siz[maxn],ifac[maxn],inv[20],W[20],inv_W[20],rev[maxm],F[maxm],G[maxm];
struct edge{
	int v,nxt;
}e[2 * maxn];
int read(){
	int x = 0;
	char c = getchar();
	while(c < '0' || c > '9') c = getchar();
	while(c >= '0' && c <= '9') x = x * 10 + (c ^ 48),c = getchar();
	return x;
}
inline int add(int x,int y){
	if(x + y < mod) return x + y;
	else return x + y - mod;
}
inline int dec(int x,int y){
	if(x - y >= 0) return x - y;
	else return x - y + mod;
}
int qpow(int x,int k){
	int d = 1,t = x;
	while(k){
		if(k & 1) d = 1ll * d * t % mod;
		t = 1ll * t * t % mod,k >>= 1;
	}
	return d;
}
void NTT_init(int n){
	N = 1;
	int cnt = 0;
	while(N <= n) N <<= 1,cnt ++;
	for(int i = 0; i < N; i ++) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (cnt - 1));
}
void NTT(int *F,int n,int p){
	for(int i = 0; i < n; i ++) if(i < rev[i]) swap(F[i],F[rev[i]]);
	int cnt = 1;
	for(int i = 1; i < n; i <<= 1){
		int w1 = (p == 1 ? W[cnt] : inv_W[cnt]);
		for(int j = 0; j < n; j += i << 1){
			int w = 1;
			for(int k = j; k < j + i; k ++){
				int t1 = F[k],t2 = 1ll * w * F[k + i] % mod;
				F[k] = add(t1,t2),F[k + i] = dec(t1,t2);
				w = 1ll * w * w1 % mod;
			}
		}
		cnt ++;
	}
	if(p == -1) for(int i = 0; i < n; i ++) F[i] = 1ll * F[i] * inv[cnt - 1] % mod;
}
void Mul(int *F,int *G,int n){
	NTT_init(n << 1);
	NTT(F,N,1),NTT(G,N,1);
	for(int i = 0; i < N; i ++) F[i] = 1ll * F[i] * G[i] % mod;
	NTT(F,N,-1);
}
void init(int n){
	NTT_init(n << 1);
	int t = qpow(2,mod - 2);
	inv[0] = 1;
	for(int i = 1; (1 << i) <= N; i ++) inv[i] = 1ll * inv[i - 1] * t % mod;
	for(int i = 1; (1 << i) <= N; i ++) W[i] = qpow(g,(mod - 1) / (1 << i)),inv_W[i] = qpow(W[i],mod - 2);
}
inline void insert(int x,int y){
	cnt ++,e[cnt].v = y,e[cnt].nxt = last[x],last[x] = cnt;
}
void dfs(int u,int fa){
	siz[u] = 1;
	for(int i = last[u]; i; i = e[i].nxt){
		int v = e[i].v;
		if(v == fa) continue;
		dfs(v,u);
		siz[u] += siz[v];
	}
	if(u != fa) d[siz[u]] --,d[n - siz[u]] --;
}
int main(){
	n = read();
	for(int i = 1; i < n; i ++){
		x = read(),y = read();
		insert(x,y),insert(y,x);
	}
	dfs(1,1);
	d[n] = n;
	init(n);
	int p = 1;
	for(int i = 0; i <= n; i ++) p = 1ll * p * (i ? i : 1) % mod,F[n - i] = 1ll * p * dec(d[i],0) % mod;
	int t = qpow(p,mod - 2); 
	for(int i = n; i >= 0; i --) G[i] = ifac[i] = t,t = 1ll * t * i % mod;
//	for(int i = 0; i <= n; i ++) cout << F[i] << ' ' << G[i] << endl;
	Mul(F,G,n);
	for(int i = 1; i <= n; i ++) printf("%d\n",1ll * ifac[i] * F[n - i] % mod);
	return 0;
}

Measured memory_bytes: 29372
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll N,A,B;
  cin >> N >> A >> B;
  ll X[100010];
  ll ans=0;
  for(int i=1;i<=N;i++){
    cin >> X[i];
  }
  for(int i=1;i<N;i++){
    ans+=min(B,(X[i+1]-X[i])*A);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <algorithm>
#include <list>
#include <map>
#include <cmath>
#include <string>
#include <iterator>
#include <vector>
 
using namespace std;

typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '
 
const int MAXN = 1e5 + 5;
int k[MAXN];

int largest(int a, int b){
	return (a<b)?b:a;
}

int main() {
	ll a = 0, b = 0, c = 0;
	cin >> a >> b >> c;
	if(a == 0){
		cout << (long long)b/c+1 << endl;
 	}
	else{
		cout << (long long)(b/c - (a-1)/c) << endl;
	}

    return 0;
}

Measured memory_bytes: 256
import java.util.*;


public class Main {

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

        int N = sc.nextInt();
        int R = sc.nextInt();

        if(N >= 10){
            System.out.println(R);
        } else {
            System.out.println(R + 100* (10 - N));
        }

    }

}








Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 100000000
#define MOD 1000000009

typedef  long long ll;

using namespace std;

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r != 0){
        r = a % b;
        a = b;
        b = r;
    }
    return r;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}


void solve(void){
   int n;
   string c;
   cin >> n >>c;
   int ans = 0;
   int tmp = 0;
   rep(i,0,n){
       if(c[i] == 'I') tmp++;
       else tmp--;
       ans = max(ans,tmp);
   }
   cout << ans << endl;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}

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

#define MOD 1000000007
#define int long long

struct segmentTree {
    int size;
    vector<int>tree;

    void ini(int n){
        size = 1;
        while(size < n) {
            size *= 2;
        }
        tree.assign(2 * size, 0LL);
        return;
    }

    void set(int i, int val, int x, int lx, int rx){
        if(rx - lx == 1){
            tree[x]  = 0;
            tree[x] = (tree[x] | (1LL << val));
            return ;
        }
        int m = (lx + rx) / 2;
        if(i < m){
            set(i, val, 2 * x + 1, lx, m);
        }else{
            set(i, val, 2 * x + 2, m, rx);
        }
        tree[x] = tree[2 * x + 1] | tree[2 * x + 2];
        return;
    }
    void set(int i, int val){
        set(i, val, 0, 0, size);
        return ;
    }

    int query(int l, int r, int x, int lx, int rx){
        ///cout << lx << " " << rx << "\n";
        ///cin.ignore();
        if(l <= lx && r >= rx-1){
            ///cout << "complite\n";
            return tree[x];
        }
        if(l >= rx || r < lx){
            ///cout << "no overlape\n";
            return 0;
        }
        int m = (rx + lx) / 2;
        int val = query(l, r, 2 * x + 1, lx, m);
        int val1 = query(l, r, 2 * x + 2, m, rx);
        return val | val1;
    }
    int query(int l, int r){
        return query(l, r, 0, 0, size);
    }
};

int32_t main() {
    int n;
    while(cin >> n) {
        segmentTree st;
        st.ini(n);

        string input;
        cin >> input;

        for(int i = 0; i < n; i++){
            int val = input[i] - 'a';
            st.set(i, val);
        }
        int m;
        cin >> m;
        while(m--){
            int op; cin >> op;
            if(op == 1){
                int idx;
                char ch;
                cin >> idx >> ch;
                int val = ch - 'a';
                st.set(idx-1, val);
            }else{
                int l, r;
                cin >> l >> r;
                int val = st.query(l-1, r-1);
                cout << __builtin_popcount(val) << "\n";
            }
        }
    }
    return 0;
}

Measured memory_bytes: 12508
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h>
 
#define len(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
 
#ifdef LOCAL
	#define dbg(x) cout << #x << " = " << x << endl;
#else 
	#define dbg(x)
#endif 
 
using namespace std;
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("file1.txt", "r", stdin);                                       
    freopen("file2.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(15);
    solve();  	
}

const int MAXN = 1e5 + 10;
int cur[MAXN];

void solve() {
	int n, k, q;
	cin >> n >> k >> q;
	for (int i = 0; i < q; ++i) {
		int id; cin >> id;
		id--;
		cur[id]++;
	}

	int sum = accumulate(cur, cur + n, 0);
	for (int i = 0; i < n; ++i) {	
		int val = k - (sum - cur[i]);
		if (val <= 0) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}
}

Measured memory_bytes: 1408
X, N = map(int, input().split())
if N==0:
    print(X)
else:
    p = list(map(int, input().split()))
    
    for i in range(0,102):
        down = X - i
        up = X + i
        if down in p and up in p:
            pass
        elif down in p:
            temp = up
            break
        else:
            temp = down
            break



    print(temp)

Measured memory_bytes: 9040
try:
	while True:
		s = input().split(" ")
		if len(s)==3:
			a, b, c = map(int, s)
			cab = c-a-b
			ans = "No"
			if 0<cab:
				if a*b*4<cab**2:
					ans = "Yes"
			print(ans)
#			print(a**0.5+b**0.5<c**0.5)
except:
	pass


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

using namespace std;
int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {
        if(a<=8&&b<=8)
            printf("Yay!\n");
        else
            printf(":(\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXN 100010
using namespace std;
typedef pair<int,string >pii;


bool ord(pii a,pii b){
    if(a.first!=b.first){
        return a.first>b.first;
    }
    return a.second<b.second;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    int n,maior=1;
    map<string,int>word;
    string s;

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        if(word.find(s)==word.end()){
            word[s]=1;
        }
        else{
            word[s]++;
            maior=max(maior,word[s]);
        }





    }

    for(auto it=word.begin();it!=word.end();it++){
        if(it->second==maior){
            cout<<it->first<<"\n";
        }
    }




    }

Measured memory_bytes: 23808
#include<stdio.h>
 
int main(void){
  unsigned int a,b;
  scanf("%d %d",&a,&b);
  if((a * b)%2 == 1){
  	printf("Odd\n");
  }else if((a * b)%2 == 0){
  	printf("Even\n");
  }
	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args){
		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
		List<String> list = new ArrayList<String>();
		String strLine = "";
		int i = 1;
		int j = 1;
		int k = 0;
		try{
			while(true){
				strLine = insBR.readLine();
				list.add(strLine);
				try{
					i = Integer.parseInt(list.get(k));
				}catch(NumberFormatException e){
					e.printStackTrace();
				}
				if(i != 0){
					System.out.println("Case " + j + ": " + i);
					j++;
					k++;
				}else{
					break;
				}
			}

		}catch(IOException e){
			e.printStackTrace();
		}

	}

}



Measured memory_bytes: 31984
#include <iostream>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

typedef complex<double> P;

int main(void){
  int n; cin >> n;
  while(n--){
    double ra, rb;
    P a,b;
    cin  >> a.real() >> a.imag() >> ra >> b.real() >> b.imag() >> rb;
    double d = abs(a-b);
    int ans;
    if(0){}
    else if(d + rb < ra) ans = 2;
    else if(d + ra < rb) ans = -2;
    else if(d > ra + rb) ans = 0;
    else ans = 1;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1244
import math
n = int(input())
coo = []
sum = 0
con = 0
for i in range(n):
    coo.append(tuple(map(int, input().split())))

for i in range(n-1):
    for j in range(i+1, n):
        sum += math.sqrt((coo[i][0]-coo[j][0])**2+(coo[i][1]-coo[j][1])**2)
        con += 1
fact = math.factorial(n)
num = fact*(n-1)/con
print(sum*num/fact)


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

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    int N, M;
    cin >> N >> M;
    vi h(N);
    REP(i, N) cin >> h[i];

    vvi to(N, vi());
    REP(i, M) {
        int a, b;
        cin >> a >> b;  
        a--; b--;
        to[a].emplace_back(b);
        to[b].emplace_back(a);
    }


    int ans = 0;
    REP(i, N) {
        bool ok = true;
        int hi = h[i];
        vi t = to[i];
        for (int hj : t) {
            if (h[hj] >= hi) ok = false;
        }

        if (ok) {
            ans++;
            //cout << "i=" << i << endl;
        }
    }

    cout << ans << endl;

    return 0;
}


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

vector<int> topological_sort(const vector<vector<int>>& g) {
    int n = g.size();
    vector<int> tpl, indeg(n, 0);
    vector<bool> seen(n, false);
    for (int i = 0; i < n; i++) {
        for (auto v : g[i]) indeg[v]++;
    }
    for (int s = 0; s < n; s++) {
        if (indeg[s] == 0 && !seen[s]) {
            queue<int> que; que.emplace(s); seen[s] = true;
            while (!que.empty()) {
                int u = que.front(); que.pop(); tpl.emplace_back(u);
                for (int i = 0; i < g[u].size(); i++) {
                    int v = g[u][i]; indeg[v]--;
                    if (indeg[v] == 0 && !seen[v]) {
                        seen[v] = true; que.emplace(v);
                    }
                }
            }
        }
    }
    if (tpl.size() != n) tpl.clear();
    return tpl;
}

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    vector<vector<int>> g(n);
    for (int i = 0; i < m; i++) {
        int s, t;
        scanf("%d%d", &s, &t);
        g[s].emplace_back(t);
    }
    
    vector<int> ans = topological_sort(g);
    for (auto v : ans) printf("%d\n", v);
    return 0;
}


Measured memory_bytes: 3820
//DUEL
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("unroll-loops")
#define shandom_ruffle(a, b) shuffle(a, b, rng)
#define vi vector<int>
#define vl vector<ll>
#define popcnt __builtin_popcount
#define popcntll __builtin_popcountll

using namespace std;
using namespace __gnu_pbds;

using ll=long long;
using ull=unsigned long long;
using ld=long double;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}
inline int rund() {int x576363482791fuweh=rng();return abs(x576363482791fuweh)%RAND_MAX;}
template<class T>
void prVec(vector<T> w,bool fl=false)
{
	cout<<w.size()<<en;
	for (int i=0;i<int(w.size())-1;++i) cout<<w[i]<<' ';
	if (w.size()) cout<<w[w.size()-1]<<en;
	if (fl) cout<<flush;
}

void M998()
{
	swap(MOD,MOD2);
}

ll raand()
{
	ll a=rund();
	a*=RAND_MAX;
	a+=rund();
    return a;
}

#define rand raand

ll raaand()
{
	return raand()*(MOD-7)+raand();
}

string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}

string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

ll sti(string a,int base=10)
{
	ll k=0;
	for (int i=0;i<(int)a.size();++i)
	{
		k*=base;
		k+=a[i]-'0';
	}
	return k;
}

template<class T>
void eras(vector<T>& a,T b)
{
	a.erase(find(a.begin(),a.end(),b));
}

string its(ll k,int base=10)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%base)+'0');
		k/=base;
	}
	reverse(a.begin(),a.end());
	return a;
}

ll min(ll a,int b)
{
	if (a<b) return a;
	return b;
}

ll min(int a,ll b)
{
	if (a<b) return a;
	return b;
}

ll max(ll a,int b)
{
	if (a>b) return a;
	return b;
}

ll max(int a,ll b)
{
	if (a>b) return a;
	return b;
}

ll gcd(ll a,ll b)
{
	if (b==0) return a;
	return gcd(b,a%b);
}

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

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

inline int mult(ll a,ll b)
{
	return (a*b)%MOD;
}

inline int pot(int n,int k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

int divide(int a,int b)
{
	return mult(a,pot(b,MOD-2));
}

inline int sub(int a,int b)
{
	if (a-b>=0) return a-b;
	return a-b+MOD;
}

inline int add(int a,int b)
{
	if (a+b>=MOD) return a+b-MOD;
	return a+b;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

const int N=300010;
int n,k;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for (int i=0;i<10;++i) bases.push_back(rand()%(MOD-13893829*2)+13893829);
	cin>>k>>n;
	while (n--)
	{
		int a;
		cin>>a;
		k-=a;
	}
	if (k<=0) cout<<"Yes";
	else cout<<"No";
}





Measured memory_bytes: 256
import sys
from heapq import *

MAX_INT= 10 ** 10

n = int(input())
adj_list = []

for _ in range(n):
  commands = sys.stdin.readline().split()
  lst = [ commands[i:i+2] for i in range(2, len(commands), 2)]
  adj_list.append(lst)

def dijkstra():
  # initialization
  visited = [False] * n
  dist_arr = [MAX_INT] * n
  pq = []
  prev = [None] * n

  # append 0 to pqs
  pq = [(0, 0)]
  dist_arr[0] = 0

  while len(pq) > 0:
    dist, idx = heappop(pq)
    visited[idx] = True

    # updating current values in dist
    for edge in adj_list[idx]:
      cur_idx, cur_dist = [ int(e) for e in edge]
      if visited[cur_idx]: continue

      new_dist = dist + cur_dist

      if new_dist < dist_arr[cur_idx]:
        dist_arr[cur_idx] = new_dist
        heappush(pq, (dist_arr[cur_idx], cur_idx))

  return dist_arr

distArr = dijkstra()
for i in range(n):
  print(i, distArr[i])



Measured memory_bytes: 106288
//
// Created by Mahmoud Rashad on 11/27/19.
//

#include <bits/stdc++.h>


using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<ii, ii>> vii;


int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.out", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;

    int n;
    cin >> n;
    vector<int> arr(n + 1);
    for (int &x  : arr)
        cin >> x;
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        int mn = min(x, arr[i]);
        ans += mn;
        x -= mn;
        arr[i] -= mn;
        mn = min(x, arr[i + 1]);
        ans += mn;
        x -= mn;
        arr[i + 1] -= mn;
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 640
S = open(0).read().lower()
a = [0 for i in range(26)]
for c in S:
    if ord(c) >= 97 and ord(c) <= 97+25:
        a[ord(c)-97] += 1
for i in range(26):
    print('{} : {}'.format(chr(i+97), a[i]))



Measured memory_bytes: 5560
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] line = new int[w];
        for(int i = 0; i < w; i++) line[i] = i + 1;

        for(int i = 0; i < n; i++) {
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            int tmp = line[a];
            line[a] = line[b];
            line[b] = tmp;
        }

        for(int i = 0; i < w; i++) {
            System.out.println(line[i]);
        }
    }
}


Measured memory_bytes: 26168
h,w=map(int,input().split())
M=list(input() for _ in range(h))
c=[]
for i in range(h):
    if "#" not in M[i]:
        c.append(i)
for dot in c[::-1]:
    M.pop(dot)

c=[]
col=[]
for i in range(len(M[0])):
    flag=1
    for j in range(len(M)):
        if "#" in M[j][i]:flag=0
    if flag==1:c.append(i)

for i in c[::-1]:
    for row in M:
        list(row).pop(i)
for i in range(len(M)):
    flag=0
    for j in range(len(M[0])):
        if j not in c:
            print(*M[i][j],end="")
            flag=1
    if i<len(M)-1 and flag==1:print()    

Measured memory_bytes: 4468
import itertools

L=[ input() for i in range(5)]

P=list(itertools.permutations( range(5) ))
ans=float("inf")

for p in P:
	t=0
	for idx, x in enumerate(p):
		t+=L[x]
		if t%10!=0 and idx!=4 :
			t+=10- (t%10)
	ans=min(ans,t)

print ans


Measured memory_bytes: 28396
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t = 1;
const ll inf=2*hell;
const ld PI = 3.1415926535897932384626433832795, eps = 1e-8;
inline ll mult(ll x,ll y){return (x*y)%hell;}
inline ll add(ll x,ll y){x+=y;return x%hell;}
inline ll powMod(ll base,ll expo){
	ll ans=1;
	while(expo){
		if(expo&1)ans=mult(ans,base);
		base=mult(base,base);
		expo>>=1;
	}
	return ans;
}
inline ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
void solve(){
	ll a, b;
	cin>>a>>b;
	a<=b?cout<<"unsafe":cout<<"safe";
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   	//cin>>t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


Measured memory_bytes: 3636
def solve():
    N = int(input())

    yakusu = []
    for i in range(1, int(N**0.5)+100):
        if N%i==0:
            yakusu.append(i)
    # nyakusu = []
    # for y in yakusu:
    #     nyakusu.append( N // y)
    # yakusu += nyakusu
    # yakusu.sort()

    ans = 0
    for y in yakusu:
        x = N//y - 1
        if x == 0: continue
        if N//x == N % x:
            ans += N // y - 1

    print(ans)
    
    # ans = 0
    # lst = []
    # ama = []
    # sho = []
    # for m in range(1, N+1):
    #     if N//m == N%m:
    #         ans += 1
    #         lst.append(m)
    #         ama.append(N%m)
    #         sho.append(N//m)

    # print("ans: ", ans)
    # print("   : ", lst)
    # print("sho: ", sho)
    # print("ama: ", ama)
    

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3188
n,*s=open(0)
n=int(n)
c=0
for _ in range(n):
  for i in range(n*n):
    i,j=i//n,i%n
    if s[i][j]!=s[j][i]:
      break
  else:
    c+=n    
  s=s[1:]+s[:1]
print(c)

Measured memory_bytes: 41948
#include <iostream>

using namespace std;

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


Measured memory_bytes: 256
s=int(input())
n=s

# ---------------------------------------
# nCr(n, r, m) テンプレ
mod = 10**9+7

fac = [1,1] # 階乗 n!
inv = [0,1] # 逆元 1/n
finv = [1,1] # 逆元の階乗 (n^-1)! = (1/n)!

for i in range(2, n+10):
    fac.append( (fac[-1] * i ) % mod )
    inv.append( (-inv[mod%i] * (mod//i)) % mod )
    finv.append( (finv[-1] * inv[-1]) % mod )

def nCr(n, r, m):
    if (n<0 or r<0 or n<r): return 0
    r = min(r, n-r)
    return fac[n] * finv[n-r] * finv[r] % m
# ---------------------------------------

ans = 0
d=s//3
amari=s%3
i=1
while d-i>=0:
  #print(i)
  j=amari+3*(i-1)
  #print(d-i+j,j)
  ans+=nCr(d-i+j,j,mod)
  i+=1
ans%=mod
print(ans)

Measured memory_bytes: 9252
mod = 10 ** 9 + 7

K = input()
D = int(input())

s = 0
dp = [0] * D
for k in K:
    k = int(k)

    T = [0] * D
    for i, dpi in enumerate(dp):
        for x in range(10):
            T[(i + x) % D] = (T[(i + x) % D] + dpi) % mod
    for x in range(k):
        T[(s + x) % D] += 1

    s = (s + k) % D
    dp = T

print((dp[0] + (-1 if s != 0 else 0)) % mod)

Measured memory_bytes: 44380
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;

LL solve(int n, vector<int>& a) {
	if (n == 0) {
		return a[0] == 1 ? 1 : -1;
	}
	vector<LL> vmx(n + 2);
	LL mn = 0;
	for (int i = n; i >= 0; --i) {
		LL curr = a[i];
		LL upper = 1LL << min(60, i);
		mn = (mn + 1) / 2 + curr;
		if (mn > upper) return -1;
		vmx[i] = min(vmx[i + 1] + curr, upper);
	}
	LL ans = 1 + a[n], mx = 1;
	for (int i = 1; i < n; ++i) {
		mx = min(vmx[i], (mx - a[i - 1]) * 2);
		ans += mx;
	}
	return ans;
}

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		int n = -1;
		cin >> n;
		if (n < 0) return 0;
		vector<int> a(n + 1);
		for (int i = 0; i <= n; ++i) {
			cin >> a[i];
		}
		cout << solve(n, a) << endl;
	}
	return 0;
}


Measured memory_bytes: 4580
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  ll x,y;
  cin >> x >> y;
  if(abs(x-y)<=1) cout << "Brown" << endl;
  else cout << "Alice" << endl;
  return 0;
}


Measured memory_bytes: 256
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch

#include<bits/stdc++.h>

using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define inf INT_MAX/3
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 3.141592653589793
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}

char a[9][9];
int main()
{
    ios_base::sync_with_stdio(0);
     ll int n;
     cin>>n;
     ll ara[n];
     bool ok=0;
     ll x=1;
     for(ll i=0;i<n;i++)
     {
         cin>>ara[i];
         if(ara[i]==1) ok=true;
     }
     if(!ok)
     {
         cout<<-1<<endl;
         return 0;
     }
     else
     {
         for(ll i=0;i<n;i++)
         {
             if(ara[i]==x)
                x++;
         }
         cout<<n-x+1<<endl;
     }

}



Measured memory_bytes: 1792
#include <iostream>
#include <queue>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  u64 w_max;
  cin >> n >> w_max;
  u64 w1;
  vector< priority_queue < u64 > > w(4);
  for (int i = 0; i < n; ++i) {
    u64 wi, vi;
    cin >> wi >> vi;
    if (i == 0) {
      w1 = wi;
    }
    w[wi-w1].push(vi);
  }
  int n_max = max(w[0].size(), max(w[1].size(), max(w[2].size(), w[3].size())));
  u64 sum_v[4][n_max+1];
  for (int i = 0; i < 4; ++i) {
    for (int j = 0; j < n_max+1; ++j) {
      sum_v[i][j] = 0;
    }
    int wi_size = w[i].size();
    for (int j = 0; j < wi_size; ++j) {
      u64 wi = w[i].top();
      w[i].pop();
      sum_v[i][j+1] = sum_v[i][j] + wi;
    }
  }
  u64 v_max = 0;
  for (int i1 = 0; i1 <= n_max; ++i1) {
    for (int i2 = 0; i2 <= n_max; ++i2) {
      for (int i3 = 0; i3 <= n_max; ++i3) {
        for (int i4 = 0; i4 <= n_max; ++i4) {
          if (i1*w1 + i2*(w1+1) + i3*(w1+2) + i4*(w1+3) > w_max) continue;
          v_max = max(v_max, sum_v[0][i1] + sum_v[1][i2] + sum_v[2][i3] + sum_v[3][i4]);
        }
      }
    }
  }
  cout << v_max << endl;

  return 0;

}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 500000

void Maximum_Heap(int*,int);
void buildMaxHeap(int*);

int heap_size;

int main(){
  int n,i,a[MAX];

  scanf("%d" ,&n);
  for(i = 0 ; i < n ; i++){
    scanf("%d" ,&a[i]);
  }
  heap_size = n;
  buildMaxHeap(a);
  for(i = 0 ; i < n ; i++){
    printf(" %d" ,a[i]);
  }
  printf("\n");

  return 0;
}

void Maximum_Heap(int a[],int p){
  int l = -1,r = -1,tmp,largest;

  if(2*p+1 < heap_size){
    l = 2*p+1;
  }

  if(2*p+2 < heap_size){
    r = 2*p+2;
  }

  if(l != -1 && a[l] > a[p]){
    largest = l;
  }else{
    largest = p;
  }

  if(r != -1 && a[r] > a[largest]){
    largest = r;
  }

  if(largest != p){
    tmp = a[p];
    a[p] = a[largest];
    a[largest] = tmp;

    Maximum_Heap(a,largest);
  }
}

void buildMaxHeap(int a[]){
  int i;

  for(i = heap_size/2-1 ; i >= 0 ; i--){
    Maximum_Heap(a,i);
  }
}

Measured memory_bytes: 2552
#include <stdio.h>

char s[100001];
int a[100001];
int k, len;

int toa(char c) {
    return 123-c;
}

void solve(int n, int cnt) {
    int to;
    to = toa(a[n]);
    if(n==(len-1)) {
        cnt%=26;
        a[n]+=cnt;
        if(a[n]>122) a[n]-=26;
        return;
    }
    if(a[n]!=97 && to<=cnt) {
        a[n]='a';
        cnt-=to;
    }
    solve(n+1, cnt);
}

int main()
{
    scanf("%s\n%d", s, &k);
    while(s[++len]);
    for(int i=0; i<len; i++)
        a[i]=s[i];

    solve(0, k);

    for(int i=0; i<len; i++)
        printf("%c", a[i]);

    return 0;
}


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

const int MaxN=1e5+5;

int N,K,Ans;
int A[MaxN],B[MaxN],X[MaxN],Y[MaxN],Tmp[MaxN<<1];
int Fa[MaxN];

int Get_Fa(int x){
	return x==Fa[x]?x:Fa[x]=Get_Fa(Fa[x]);
}

int main(){
	int i,r1,r2;
	scanf("%d",&N),N++;
	for(i=1;i<N;i++){
		scanf("%d",&A[i]);
		A[N]^=A[i];
	}
	for(i=1;i<N;i++){
		scanf("%d",&B[i]);
		B[N]^=B[i];
	}
	memmove(X,A,sizeof(X));
	memmove(Y,B,sizeof(Y));
	sort(X+1,X+N+1);
	sort(Y+1,Y+N+1);
	for(i=1;i<N;i++)
		if(X[i]^Y[i]){
			puts("-1");
			return 0;
		}
	for(i=1;i<=N;i++)
		if(A[i]^B[i]||i==N){
			Tmp[++K]=A[i],Tmp[++K]=B[i];
			Ans+=(i<N);
		}
	if(!Ans){
		puts("0");
		return 0;
	}
	sort(Tmp+1,Tmp+K+1);
	K=unique(Tmp+1,Tmp+K+1)-Tmp-1;
	for(i=1;i<=K;i++)
		Fa[i]=i;
	for(i=1;i<=N;i++)
		if(A[i]^B[i]){
			A[i]=lower_bound(Tmp+1,Tmp+K+1,A[i])-Tmp;
			B[i]=lower_bound(Tmp+1,Tmp+K+1,B[i])-Tmp;
			if((r1=Get_Fa(A[i]))^(r2=Get_Fa(B[i])))
				Fa[r1]=r2;
		}
	for(i=1;i<=K;i++)
		Ans+=(Get_Fa(i)==i);
	printf("%d\n",Ans-1);
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll m;

int main(){
  cin>>m;
  cout<<48-m<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;

const int mod = 1e9 + 7;
int binomialCoeff(int n, int r) {
    int res = 1;
    if(r > n - r)r = n - r;
    for(int i = 0; i < r; i++) {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}


int power(int x, int n, int mod) {
    //(x^n)%mod
    int result = 1;
    while(n) {
        if(n % 2)
            result = (result * x) % mod;
        x = (x * x) % mod;
        n /= 2;
    }
    return result;
}

int inverseMod(int x, int mod) {
    return power(x, mod - 2, mod);
}
int32_t main() {

    fast

    int s;
    cin >> s;

    //vector<vector<int>>dp(s + 1, vector<int>(s + 1, 0));
    vector<int>dp(s + 1, 0);
    dp[0] = 1;
    for(int i = 3; i <= s; i++) {
        for(int j = 3; j <= i; j++) {
            dp[i] += dp[i - j];
            dp[i] %= mod;
        }
    }
    cout << dp[s];

    return 0;
}



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

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int a,b,c;
  int t=0;
  cin >> a >> b >> c;
  int x=0;
  vector <int> m;
  int f=0;
  while(f==0&&(60*x+c)%(a+b)>a) {
    for(int i=0;i<m.size();i++){
      if(m[i]==(60*x+c)%(a+b)) {
	f=1;
	cout << -1 << endl;
      }
    }
    m.push_back((60*x+c)%(a+b));
    x++;
  }
  if(f==0)
  cout << (60*x+c) << endl;
  return 0;
}

Measured memory_bytes: 1216
import std.stdio, std.algorithm, std.array, std.math;

void main() {
  for(double w, h, d; readf("%f %f %f\n", &w, &h, &d), w + h + d != 0;) {
    double[] arr = sort([w, h, d]).array;
    double n; readf("%f\n", &n);
    foreach(i; 0..n) {
      double k;
      readf("%f\n", &k);
      writeln(pow((k * 2), 2) - pow(arr[0], 2) <= pow(arr[1], 2)  ? "NA" : "OK");
    }
  }
}

Measured memory_bytes: 1124
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define inf1 INT_MAX
#define inf2 LLONG_MAX
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define sbit __builtin_popcount
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define rit(it,x) for(auto it=x.begin();it!=x.end();it++)
#define cases(t) int t; cin>>t; rep(casn,1,t+1)
#define fill(a,b) memset(a,b,sizeof(a))
#define dbg(x) cerr<<#x<<" "<<x<<endl;
#define dbga(arr,n) cerr<<#arr<<": "; rep(tt,0,n)cerr<<arr[tt]<<" "; cerr<<endl;
#define infile ifstream fin; fin.open("input.txt")
#define outfile ofstream fout; fout.open("output.txt")
#define vec vector<int>
#define pii pair<int,int>
#define plii pair<ll,int>
#define pll pair<ll,ll>
#define p_queue priority_queue< plii,vector< plii >,greater< plii > > 
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%lld",&x)
#define sst(x) scanf("%s",x)
#define pl(x) printf("%lld\n",x)
#define pi(x) printf("%d\n",x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
ll n,arr[100005],dp[100005];

inline ll binex(ll a,ll b)
{
    ll ans=1,temp=a%mod;
    while(b!=0){
        if(b&1) ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b=b>>1;
    }
    return ans;
}

inline int solve(int idx,int des)
{
    if(idx==des) return dp[idx]=0;
    if(idx>des) return inf1;
    if(dp[idx]!=-1) return dp[idx];
    return dp[idx]=min(abs(arr[idx]-arr[idx+1])+solve(idx+1,des),abs(arr[idx]-arr[idx+2])+solve(idx+2,des));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    rep(i,0,n) cin>>arr[i];
    fill(dp,-1);
    cout<<solve(0,n-1)<<endl;
}

Measured memory_bytes: 4224
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



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

    P(min(a,b) + min(c,d));
	
	return  0;
}

Measured memory_bytes: 256
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict
from fractions import gcd

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M = getlist()
	A = getlist()
	B = [int(A[i] // 2) for i in range(N)]
	LCM = B[0]
	for i in range(N - 1):
		GCD = gcd(LCM, B[i + 1])
		LCM = int(LCM * B[i + 1] / GCD)
		if LCM >= 10 ** 10:
			break

	if LCM > M:
		print(0)
	else:
		ans = (M - LCM) // (2 * LCM) + 1
		D = defaultdict(int)
		for i in range(N):
			x = B[i]
			val = 0
			while True:
				if x % 2 == 0:
					val += 1
					x = int(x // 2)
				else:
					break
			D[val] += 1

		if D[val] != N:
			ans = 0

		print(ans)


if __name__ == '__main__':
	main()

Measured memory_bytes: 83820
#include <bits/stdc++.h>
using namespace std;
 
int a[200010];
int b[200010];
int main() {
	int n; cin >> n;
	for (int i=0; i<n; ++i)	{
		cin >> a[i];
        b[i] = a[i];
	}

	sort(b, b+n);
		
	for (int i=0; i<n; ++i)	{
		if (a[i]==b[n-1]) {
            cout << b[n-2] << endl;
        } else {
			cout << b[n-1] << endl;
        }
	}
 
	return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
using namespace std;

int n;
vector<double> a;
vector<vector<double> > dp;

double fun(int i,int c){
	if(c==(n+1)/2)
		return 0;
	if(i==n)
		return 1;

	if(dp[i][c]!=-1)
		return dp[i][c];

	double ans = 0;
	ans += fun(i+1,c)*a[i];
	ans += fun(i+1,c+1)*(1-a[i]);
	return dp[i][c] = ans;
}

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

	cin>>n;
	a.resize(n);
	dp.assign(n,vector<double>((n+1)/2,-1));
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	printf("%.9lf",fun(0,0));
	// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
	return 0;
}

Measured memory_bytes: 35840
#include <bits/stdc++.h>
using namespace std;
 
#define    int                      long long int
#define    ld                       long double
#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1000000007
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL);
#define    pb                       push_back
#define    mp                       make_pair
#define    T                        int ttt; cin >> ttt; while(ttt--)
#define    ff                       first
#define    ss                       second
#define    all(container)            container.begin() , container.end()
#define    sz(container)             (int)container.size()
#define    pii                      pair <int , int>
#define    sp(x)                    setprecision(x)

int power(int x, int y, int p)  
{  
    int 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;  
}  
  

int32_t main()
{
    speed upp
    int x,y;
    cin>>x>>y;
    int z=min(x%y,y-x%y);
    cout<<z;
}

Measured memory_bytes: 256
data = [0 for _ in range(26)]
while True:
    try:
        moji = input()
    except EOFError:
        break
    for m in moji:
        point = ord(m)
        if 65 <= point <= 90:
            data[point - 65] += 1
        elif 97 <= point <= 122:
            data[point - 97] += 1
[print(f'{chr(i + 97)} : {data[i]}') for i in range(26)]



Measured memory_bytes: 5580