akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    // calculation
    if (d <= a || b <= c) {
        cout << 0 << "\n";
    } else if (c <= a) {
        if (d <= b) cout << abs(a - d) << "\n";
        else cout << abs(a - b) << "\n";
    } else if (c <= b) {
        if (d <= b) cout << abs(c - d) << "\n";
        else cout << abs(c - b) << "\n";
    }
    return 0;
}


Measured memory_bytes: 888
n,m = map(int, input().split())
h = list(map(int, input().split()))
gd = [1]*n
for i in range(m):
  a,b = map(int, input().split())
  if h[a-1] >= h[b-1]:
    gd[b-1] = 0
  if h[a-1] <= h[b-1]:
    gd[a-1] = 0
cnt = 0
for i in gd:
  cnt += i
print(cnt)

Measured memory_bytes: 20112
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

vector<int> p;

int find_root(int x) {
  if (p[x] != x) p[x] = find_root(p[x]);
  return p[x];
}

void unite(int x, int y) {
  int nx = find_root(x);
  int ny = find_root(y);
  if (nx == ny) return;
  else {
    if (nx > ny) p[nx] = ny;
    else p[ny] = nx;
  }
}

int main() {
  int n, m; cin >> n >> m;
  vector<vector<int>> a(n);
  vector<bool> check(m, false);
  rep(i, n) {
    int k; cin >> k;
    rep(j, k) {
      int l; cin >> l;
      l --;
      check[l] = true;
      a[i].push_back(l);
    }
  }

  p = vector<int>(m);
  rep(i, m) p[i] = i;
  rep(i, n) {
    for (int j = 1; j < a[i].size(); j ++) {
      unite(a[i][0], a[i][j]);
    }
  }

  int sum = 0;
  rep(i, m) {
    if (p[i] == i && check[i]) sum ++;
  }

  if (sum == 1) cout << "YES" << endl;
  else cout << "NO" << endl; 
}

Measured memory_bytes: 6144
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;cin >> s;
    ll k; cin >> k;
    ll n = s.size();
    vector dp(n + 1, vector(2, vector(2, vector(5, 0LL))));

    dp[0][0][0][0] = 1;
    rep(i,0,n) rep(j,0,2) rep(l,0,2) rep(m,0,4) rep(d, 0,10){
        ll t = s[i] - '0';
        if(j == 0 && d > t)break;

        ll _i = i + 1;
        ll _j = j == 0 && t == d ? 0 : 1;
        ll _l = l == 0 && d == 0 ? 0 : 1;
        ll _m = d != 0 ? m + 1 : m;
        dp[_i][_j][_l][_m] += dp[i][j][l][m];
    }
    debug(dp[n]);
    ll ans = 0;
    ans = dp[n][0][1][k] + dp[n][1][1][k];

    cout << ans << endl;
}

Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n;
ll a[310];

signed main() {
	cin >> n;
	ll x = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (2 <= i)x ^= a[i];
	}
	ll p = a[0] + a[1] - x;
	if (p < 0 || p % 2) {
		cout << -1 << endl;
		return 0;
	}
	p /= 2;
	if (p&x) {
		cout << -1 << endl;
		return 0;
	}
	ll q = a[0] - p;
	if (q < 0) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = 39; i >= 0; i--)if ((x&(1LL << i)) && (1LL << i) <= q)q -= (1LL << i);
	if (!p&&q == a[0]) {
		cout << -1 << endl;
		return 0;
	}
	cout << q << endl;
}


Measured memory_bytes: 3632
#include <stdio.h>

int main(){
  int N, T;
  int i, judge;
  
  scanf("%d %d", &N, &T);

  int c[N], t[N];

  judge=1001;
  
  for(i=0; i<N; i++){
    scanf("%d %d", &c[i], &t[i]);
    if(t[i]<=T){
      if(c[i]<judge)
	judge=c[i];
    }    
  }

  if(judge==1001)
    printf("TLE\n");
  else
    printf("%d\n", judge);

  return 0;

}

Measured memory_bytes: 128
num = input()
num_list = [int(i) for i in input().split(' ')]

from collections import deque

def cal_minus(three_pos):
    p = three_pos[0]
    c = three_pos[1]
    n = three_pos[2]
    dic = {'p':p, 'c': c, 'n':n}
    sorted_dict = sorted(dic.items(), key=lambda x : x[1])
    name = sorted_dict[1][0]
    if name == 'p':
        return 2 * abs(p-c)
    elif name == 'c':
        return 0
    else:
        return 2 * abs(c-n)
        

minus_list = []
three_pos = deque([0, num_list[0], num_list[1]])
for i in range(0, len(num_list)):
    minus = cal_minus(three_pos)
    minus_list.append(minus)
    if i < len(num_list)-2:
        next_ = num_list[i + 2]
    else:
        next_ = 0
    three_pos.append(next_)
    three_pos.popleft()
    
all_ = 0
pre = 0
for i in range(len(num_list)):
    plus = abs(num_list[i] - pre)
    pre = num_list[i]
    all_ += plus
all_ += abs(num_list[-1])

for i in minus_list:
    print(all_-i)

Measured memory_bytes: 14048
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

int main(void) {
	int n;
	cin>>n;
	vector<int> a(n);
	REP(i, n) cin>>a[i];
	sort(ALL(a));
	cout<<a[n - 1] - a[0]<<endl;
}



Measured memory_bytes: 256
#include <stdio.h>

int main() {
    const int MAX = 20;
    char input[MAX];
    for (int i = 0; i < MAX; ++i) {
        input[i] = 0;
    }
    char result[MAX];
    for (int i = 0; i < MAX + 1; ++i) {
        result[i] = 0;
    }

    scanf("%s", &input);
    int counts = 0;
    {
        int offset = 0;
        while (input[offset] != 0) {
            counts++;
            offset++;
        }
    }

    for (int i = 0; i < counts; ++i) {
        result[counts - i - 1] = input[i];
    }

    printf(result);
    printf("\n");
    return 0;
}

Measured memory_bytes: 952
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe
int digit(int a){
    int count = 0;
    for (int i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }     
    }
    return count;
}
//pow(x,n) == x^n

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

int n,count = 0,m = 100;
cin >> n;
vector<int> a(n);
rep(i,n) cin >> a[i];

rep(i,n){
       if (a[i]%2 != 0)
    {
        cout << 0 << endl;
        return 0;
    }
}

rep(i,n){
    count = 0;
    while(1){
        
        if (a[i]%2 !=  0)
        {
            break;
        }
        a[i] /= 2;
        count++;
    }
    m = min(m,count);
}

cout << m << endl;




//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//for(int i = ; i < ; i++){}

int main(){
  int n,x;
  cin>>n>>x;
  int m[n];
  for(int i = 0; i<n; i++){
    cin>>m[i];
    x-=m[i];
  }
  sort(m,m+n);
  cout<<n+x/m[0]<<endl;

}




Measured memory_bytes: 256
// AOJ NTL_1_E Extended Euclid Algorithm
// 2018.5.5 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int extended_gcd(int a, int b, int *x, int *y)
{
	int d;

	if (b == 0) { *x = 1; *y = 0; return a; }
	d = extended_gcd(b, a%b, y, x);
	*y -= a / b * (*x);
	return d;
}

int main()
{
	int a, b, x, y;

	a = in(), b = in();
	extended_gcd(a, b, &x, &y);
	printf("%d %d\n", x, y);
	return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;

const ll mod = 1000000007;


int main() {

    ll N;
    cin >> N;

    vector<ll> T(N);
    vector<ll> A(N);

    for(int i=0; i<N; i++) cin >> T[i];
    for(int i=0; i<N; i++) cin >> A[i];

    if( A[0] != T[N-1] ) {
	cout << 0 << endl;
	return 0;
    }
    
    vector<int> is(N,0);

    ll pre = -1;
    for(int i=0; i<N; i++) {
	if(pre < T[i]) {
	    is[i] = 1;
	    pre = T[i];
	    if( T[i] > A[i] ) { // 矛盾
		cout << 0 << endl;
		return 0;
	    }
	}
    }

    pre = -1;
    for(int i=N-1; i>=0; i--) {
	if(pre < A[i]) {
	    is[i] = 1;
	    pre = A[i];
	    if( A[i] > T[i] ) { //矛盾
		cout << 0 << endl;
		return 0;
	    }
	}
    }
    

    for(int i=0; i<N; i++) {
	if( is[i] == 0 ) {
	    is[i] = min(T[i],A[i]);
	}
    }

    ll ans = 1;
    for(int i=0; i<N; i++) {
	ans *= is[i];
	ans %= mod;
    }



    cout << ans << endl;
    
	

    
}


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


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

	set<int> s;
	s.insert(1);

	int p = 6;
	while(p <= N) {
		s.insert(p);
		p *= 6;
	}

	p = 9;
	while (p <= N) {
		s.insert(p);
		p *= 9;
	}

	vector<int> dp(N + 1, N + 1);
	dp[0] = 0;
	for(int i=0;i<N;i++) {
		for(int v : s) {
			if(i + v <= N) {
				dp[i + v] = min(dp[i + v], dp[i] + 1);
			}
		}
	}
	cout << dp[N] << endl;

	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;++i)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;

int main(){
  int n,m;cin>>n>>m;
  int r,l;
  int a[n+2]={};
  for(int i=0;i<m;i++){
    cin >> l >> r;
    a[l] += 1,a[r+1] -= 1;
  }
  for(int i=1;i<=n;i++){
    a[i] += a[i-1];
  }
  int ans = 0;
  for(int i=0;i<=n;i++){
    if(a[i]==m)ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
// C - Traveling Salesman around Lake
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	int K, N; cin>>K>>N;
	int d[N];
	int pre = K;
	rep(i, N){
		int now; cin>>now;
		d[i] = now - pre;
		pre = now;
	}
	d[0] += 2*K - pre;
	int max_dist = 0;
	rep(i, N) max_dist = max(max_dist, d[i]);
	cout<< K - max_dist <<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e5+5;
const int inf=2000000000;
/* GRL_1_A 
index_0
directed edge
There are no parallel edges
There are no self-loops

*/
struct Info{
    int to,cost;
    Info(int _to,int _cost){
        to=_to,cost=_cost;
    }
    bool operator< (const Info& arg) const {
        return cost>arg.cost;
    }
};
vector <Info> Edges[maxn];
int d[maxn];
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int V,E,st;
    cin>>V>>E>>st;
    fill(d+0,d+V,inf);
    rep(i,1,E){
        int s,t,d0;
        cin>>s>>t>>d0;
        Edges[s].push_back(Info(t,d0));
    }
    priority_queue<Info> Q;
    d[st]=0;
    Q.push(Info(st,d[st]));
    while(!Q.empty()){
        Info now=Q.top();
        Q.pop();
        for(auto v:Edges[now.to]){
            if(d[v.to]>d[now.to]+v.cost){
                d[v.to]=d[now.to]+v.cost;
                Q.push(Info(v.to,d[v.to]));
            }
        }
        
    }
    rep(i,0,V-1){
        if(d[i]==inf)cout<<"INF\n";
        else cout<<d[i]<<endl;
    }
}
/* 
4 6 1
0 1 1
0 2 4
2 0 1
1 2 2
3 1 1
3 2 5

1 ≤ |V| ≤ 1000
0 ≤ |E| ≤ 2000
-10000 ≤ di ≤ 10000


|V| |E| r
s0 t0 d0
s1 t1 d1
:
s|E|−1 t|E|−1 d|E|−1
 */


Measured memory_bytes: 13012
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,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

x,y,z=MI()
ans=int((x-z)/(y+z))
print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
string S, T, B = "~";
bool isOK(string A1, string A2) {
	for (int i = 0; i < A1.size(); i++) {
		if (A1[i] != '?' && A1[i] != A2[i])return false;
	}
	return true;
}
int main() {
	cin >> S >> T;
	for (int i = 0; i <= (int)S.size() - (int)T.size(); i++) {
		string U = S.substr(i, T.size());
		if (isOK(U, T) == true) {
			string V = S;
			for (int j = i; j < i + T.size(); j++)V[j] = T[j - i];
			for (int j = 0; j < i; j++) { if (V[j] == '?')V[j] = 'a'; }
			for (int j = i + T.size(); j < V.size(); j++) { if (V[j] == '?')V[j] = 'a'; }
			B = min(B, V);
		}
	}
	if (B == "~")cout << "UNRESTORABLE" << endl;
	else cout << B << endl;
	return 0;
}



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

int main() {
  int N,count;
  cin >>N;
  count = 1;
  vector<int> vec(N);
  for (int i=0;i<N;i++) {
    cin >> vec.at(i);
  }
  sort (vec.begin(),vec.end());
  reverse (vec.begin(),vec.end());
  
  for (int i=0;i<N;i++){
    if ((i!=0)&&(vec.at(i) != vec.at(i-1)))
     count ++;
    }
  cout << count <<endl;
}

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

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


int main()
{
	int n; cin >> n;
	string s; cin >> s;
	vector<char> alp = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
	string ans = "";
	rep(i, 0, s.size() - 1)
	{
		ans += alp[(s[i] - 'A' + n) % 26];
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;



int main(){
    int a, b;
    cin >> a >> b;
    if(a%2==0||b%2==0) out("No");
    else out("Yes");
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#pragma GCC optimize("O3")

#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstring>
#include <numeric>
#include <set>
#include <queue>
#include <deque>
#include <array>
#include <string>
#include <cmath>
#include <random>
#include <ctime>
#include <map>
#include <functional>
#include <bitset>
#include <complex>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using ld = long double;

ll calc(ll x) {
	if (x == 1) {
		return 1;
	}
	return 2 * calc(x / 2) + 1;
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll x;
	cin >> x;
	cout << calc(x);
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int w[8][3] = {
  { 0, 1, 2 },
  { 3, 4, 5 },
  { 6, 7, 8 },
  { 0, 3, 6 },
  { 1, 4, 7 },
  { 2, 5, 8 },
  { 0, 4, 8 },
  { 2, 4, 6 }
};

int main() {
  char s[16];
  while (scanf("%s", s) == 1) {
    for (int i = 0; i < 8; i++) {
      int r = 0;
      for (int j = 0; j < 3; j++)
        r += s[w[i][j]] == 'o' ? 1 : s[w[i][j]] == 'x' ? -1 : 0;
      if (r == 3) {
        puts("o");
        goto next;
      }
      if (r == -3) {
        puts("x");
        goto next;
      }
    }
    puts("d");
next:;
  }
  return 0;
}

Measured memory_bytes: 0
# coding: utf-8
import re
import math
#import numpy as np
n = int(input())
X = list(map(int, input().split()))
C=[1 for a in range(n-1)]
mod = 10 ** 9 + 7
fac = math.factorial(n - 1) % mod

for i in range(1,n - 1):
    len=i+1#左にあるスライムの個数
    C[i]=C[i-1]+ pow(len, mod - 2,mod)
    C[i]%=mod

ans = 0
for i in range(n-1):
    ans+=C[i]*(X[i+1]-X[i])
    ans%=mod
ans*=fac
ans%=mod
print(ans)

Measured memory_bytes: 62744
from copy import deepcopy
N, K = map(int, input().split())
X, Y = [], []
for _ in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
PX, PY = deepcopy(X), deepcopy(Y)
X.sort()
Y.sort()

ans = (X[-1] - X[0]) * (Y[-1] - Y[0])

for xi in range(N - 1):
    for xj in range(xi + 1, N):
        for yi in range(N - 1):
            for yj in range(yi + 1, N):
                num = 0
                lx, rx = X[xi], X[xj]
                by, uy = Y[yi], Y[yj]

                for i in range(N):
                    if lx <= PX[i] and PX[i] <= rx and by <= PY[i] and PY[i] <= uy:
                        num += 1

                if num >= K:
                    ans = min(ans, (rx - lx) * (uy - by))
print(ans)


Measured memory_bytes: 49756
array = input().split()
stack = []

while True:
    if len(array) == 0: break
    e = array.pop(0)
    if e.isdigit():
        stack.append(e)
    else:
        num1 = stack.pop()
        num2 = stack.pop()
        stack.append(str(eval(num2 + e + num1)))

print(stack[0])

Measured memory_bytes: 7424
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define mods 1000000007LL
int n,berturut[5][100005],terdekat[5][100005],posnow[5];
long long beda[5],arr[100005],dp[5][100005],prefiks[5][100005],ans;
//0 refers to X
//1 refers to Y
long long modulo(long long angka)
{
	if(angka>=mods||angka<=-mods)
		angka%=mods;
	if(angka<0)
		angka+=mods;
	return angka;
}
int main()
{
	scanf("%d%lld%lld",&n,&beda[0],&beda[1]);
	for(int i=1;i<=n;i++)
		scanf("%lld",&arr[i]);
	for(int i=0;i<2;i++)
	{
		posnow[i]=n;
		berturut[i][n]=n;
		terdekat[i][n]=posnow[i]+1;
	}
	for(int i=n-1;i>=1;i--)
	{
		for(int j=0;j<2;j++)
		{
			while(arr[posnow[j]]-arr[i]>=beda[j])
				posnow[j]--;
			terdekat[j][i]=posnow[j]+1;
			if(terdekat[j][i]==i+1)
				berturut[j][i]=berturut[j][i+1];
			else
				berturut[j][i]=i;
		}
	}
	//basecase
	dp[0][n]=1;
	dp[1][n]=1;
	prefiks[0][n]=1;
	prefiks[1][n]=1;
	prefiks[0][n+1]=0;
	prefiks[1][n+1]=0;
	for(int i=n-1;i>=1;i--)
	{
		for(int j=0;j<2;j++)	//jenis
		{
			int k=(j+1)%2;		//jenis yang lain
			dp[j][i]=0;
			if(terdekat[j][i]<=berturut[k][i+1])
				dp[j][i]=modulo(prefiks[j][terdekat[j][i]]-prefiks[j][berturut[k][i+1]+1]);
			if(terdekat[j][i]<=berturut[k][i+1]+1)
				dp[j][i]=modulo(dp[j][i]+dp[k][berturut[k][i+1]]);
			prefiks[j][i]=modulo(prefiks[j][i+1]+dp[j][i]);
		}
	}
	ans=modulo(dp[0][1]+dp[1][1]);
	cout<<ans<<endl;
}

Measured memory_bytes: 5888
#include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<map>
#include<cassert>
#include<functional>

using namespace std;

int main(){
    long long n,a,b,c,d,e;
    cin >> n ;
    cin >> a >> b >> c >> d >> e;
    long long nums[5] = {a,b,c,d,e};
    long long max = 0;
    for(int i = 0;i < 5;i++){
        if(max < (n-1)/nums[i]){
          max = (n-1)/nums[i];
        }
    }
    long long t = 0;
    t += max + 5;
    cout << t << endl;

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#define debug(x) cout<<"***"<<x<<"***"<<endl;
using namespace std;
int main()
{
	int x,a;
	cin>>x>>a;
	if (x<a) cout<<0;
	else cout<<10;
	return 0;
}


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

int main(){
  int n, m, a, b, s;
  s = 0;
  b = 0;
  string t;
  cin >> n >> m;
  vector<int> p(n, 0);
  vector<int> c(n, 0);
  for(int i = 0; i < m; i++){
    cin >> a >> t;
    a--;
    if(p[a] == 0){
      if(t == "AC"){
        p[a] = 1;
      }
      if(t == "WA"){
        c[a]++;
      }
    }
  }
  for(int i = 0; i < n; i++){
    s = s + p[i];
    if(p[i] == 1)
      b = b + c[i];
  }
  cout << s << ' ' << b << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned long;
using ULL = unsigned long long;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

    void Solve() {
        UL N; cin >> N;
        bool ok[13][4] = {};
        string S = "SHCD";
        rep(i, N) {
            char c; cin >> c;
            UL idx; cin >> idx; idx--;
            ok[idx][S.find(c)] = true;
        }
        rep(s, 4) {
            rep(i, 13) {
                if (!ok[i][s]) cout << S[s] << " " << (i + 1) << endl;
            }
        }
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    cout << fixed << setprecision(10);
    p->Solve();
    return 0;
}



Measured memory_bytes: 3172
#include <bits/stdc++.h>  // clang-format off
using namespace std;
using Int = long long;
#define REP2(i, n) for (Int i = 0, max_i = (n); i < max_i; i++)
#define REP3(i, a, b) for (Int i = (a), max_i = (b); i < max_i; i++)
#define OVERLOAD2(_1, _2, _3, name, ...) name
#define REP(...) OVERLOAD2(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
struct SetupIO { SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Feb  9 21:00:01 JST 2020
 **/

signed main() {
    string s;
    cin >> s;
    REP(i, s.size()) cout << 'x';
    cout << endl;
}


Measured memory_bytes: 256
/*
*
* author: ian macleod
*
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef vector<long long int> vll;

#define IO                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b) for(ll i=a;i>=b;i--)

ll power(ll x, ll y) {
    ll res = 1;     // Initialize result
    x = x ;
    if (y==0)return 1;
    if(x==0)return 0;
    while (y > 0) {
        if (y & 1)
            res = (res*x);
        y = y>>1; // y = y/2
        x = (x*x);  // Change x to x^2
    }
    return res;
}


void solve() {
    
    ll k,a,b;
    cin >> k >> a >> b;
    for (ll i = a; i <= b; i++) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return;
        }
    }
    cout << "NG" << '\n';
    return ;
}



int main() {
    solve();
}



Measured memory_bytes: 3620
from itertools import permutations

N, M = map(int, input().split())

adjM = [[0] * N for v in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    adjM[a - 1][b - 1] = 1
    adjM[b - 1][a - 1] = 1

# 頂点を訪れる順番を全通り試す
ans = 0
for vs in permutations(range(1, N)):
    vs = [0] + list(vs)
    for i in range(N - 1):
        if adjM[vs[i]][vs[i + 1]] == 0:
            break
    else:
        ans += 1

print(ans)


Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys


def solve(N: int, C: int, s: "List[int]", t: "List[int]", c: "List[int]"):
    imos = [[0]*(10**5+2) for _ in range(C+1)]
    channel = dict()

    for i in range(N):
        if channel.get(c[i]) != None:
            channel[c[i]].append((s[i],t[i]))
        else:
            channel[c[i]] = [(s[i],t[i])]

    from itertools import accumulate
    for c in range(1,C+1):
        if channel.get(c) == None:
            continue
        ## start 時間でsort
        channel[c].sort(key = lambda x:x[0])

        # 終了時間が現在一番遅いものを保持しておく
        t_last = -1
        for s,t in channel[c]:
            if t_last == s:
                imos[c][t_last+1] +=1
            else:
                imos[c][s] += 1
            t_last = t
            imos[c][t+1] -= 1
        imos[c]=list(accumulate(imos[c]))

    answer = 0
    for i in range(1,10**5+1):
        a = 0
        for c in range(1,C+1):
            a += imos[c][i]
        answer = max(a,answer)
    
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    s = [int()] * (N)  # type: "List[int]"
    t = [int()] * (N)  # type: "List[int]"
    c = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        s[i] = int(next(tokens))
        t[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, C, s, t, c)

if __name__ == '__main__':
    main()


Measured memory_bytes: 45052
X, K, D = map(int, input().split())

t = X // D
if abs(t) >= K:
  if X > 0:
  	print(abs(X-(D*K)))
  elif X < 0:
    print(abs(X+(D*K)))
  exit(0)

nokori = K - t
if X-(D*t) <= 0:
  if nokori % 2 == 0:
  	print(abs(X-(D*t)))
  else:
    print(abs(X-(D*(t-1))))
else:
  if nokori % 2 == 0:
  	print(abs(X-(D*t)))
  else:
    print(abs(X-(D*(t+1))))


Measured memory_bytes: 61300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,ll> Q;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<Q>G[200005];
bool rem[200005]={};
int sub[200005]={},n,q;
vector<P1>edge;
ll a[200005];
int make(int v,int u)
{
    int cnt=1;
    for(int i=0;i<G[v].size();i++)
    {
        int v2=G[v][i].fi;
        if(rem[v2] || v2==u) continue;
        cnt+=make(v2,v);
    }
    return sub[v]=cnt;
}
P search(int v,int u,int siz)
{
    //size and index
    P res=mp(INF,-1);
    int s=1,m=0;
    for(int i=0;i<G[v].size();i++)
    {
        int v2=G[v][i].fi;
        if(rem[v2] || v2==u) continue;
        res=min(res,search(v2,v,siz));
        m=max(m,sub[v2]);
        s+=sub[v2];
    }
    m=max(m,siz-s);
    res=min(res,mp(m,v));
    return res;
}
vector<int>L;
pair<ll,int>p;
void dfs(int v,int u,ll d)
{
    p = min(p,mp(d+a[v],v));
    for(int i=0;i<G[v].size();i++)
    {
        int v2=G[v][i].fi;
        if(rem[v2] || v2==u) continue;
        dfs(v2,v,d+G[v][i].sc);
    }
}
void dfs2(int v,int u,ll d)
{
    edge.pb(mp(d+a[v]+p.fi,mp(v,p.sc)));
    for(int i=0;i<G[v].size();i++)
    {
        int v2=G[v][i].fi;
        if(rem[v2] || v2==u) continue;
        dfs2(v2,v,d+G[v][i].sc);
    }
}
void sol(int v)
{
    make(v,-1);
    int sz = sub[v];
    int cent=search(v,-1,sub[v]).sc;
    rem[cent]=true;
    L.clear(); L.pb(cent); p = mp(a[cent],cent);
    for(int i=0;i<G[cent].size();i++){
        if(!rem[G[cent][i].fi]) dfs(G[cent][i].fi,cent,G[cent][i].sc);
    }
    edge.pb(mp(a[cent]+p.fi,mp(cent,p.sc)));
    for(int i=0;i<G[cent].size();i++){
        if(!rem[G[cent][i].fi]) dfs2(G[cent][i].fi,cent,G[cent][i].sc);
    }
    for(int i=0;i<G[cent].size();i++) if(!rem[G[cent][i].fi]) sol(G[cent][i].fi);
    rem[cent]=false;
}
struct uf{
    int par[200005];
    void init(){ rep(i,200005) par[i]=i; }
    int find(int x){ if(x==par[x]) return x; else return par[x] = find(par[x]); }
    void unite(int x,int y){
        x = find(x); y = find(y);
        if(x == y) return;
        par[x] = y;
    }
    bool same(int x,int y){ return find(x) == find(y); }
}uf;
int main(){
    scanf("%d",&n);
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    rep(i,n-1){
        int a,b; ll c; scanf("%d%d%lld",&a,&b,&c); a--; b--;
        G[a].pb(mp(b,c));
        G[b].pb(mp(a,c));
    }
    sol(0);
    ll ans = 0;
    SORT(edge); uf.init();
    rep(i,edge.size()){
        ll v = edge[i].fi; int p = edge[i].sc.fi, q = edge[i].sc.sc;
        if(uf.same(p,q)) continue;
        uf.unite(p,q); ans+=v;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 110560
#include <bits/stdc++.h>
using namespace std;
void alert(vector<int> vec){
  for(int i=0; i<vec.size(); i++) cout << vec.at(i) << " ";
  cout << vec.at(vec.size()-1) << endl;
}


int main(){
  int K; cin >> K;
  vector<int> vec={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << vec.at(K-1)  << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {


    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int H = scanner.nextInt();
            int W = scanner.nextInt();
            if ( H == 0){
                break;
            }
            for (int i= 0; i < H; i++){
                for (int j=0; j<W; j++){
                    if (i == 0 || i == H-1){
                        System.out.print("#");
                    }else {
                        if (j == 0 || j == W-1){
                            System.out.print("#");
                        }else {
                            System.out.print(".");
                        }
                    }

                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 33856
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

class WarshallFloyd
{
  static const ll MAX_V = 210;
  ll V;
  ll d[MAX_V][MAX_V];

public:
  WarshallFloyd(ll V_) : V(V_)
  {
    rep(i, V) rep(j, V)
    {
      d[i][j] = (i == j ? 0 : LINF);
    }
  }

  inline void add_E(int s, int t, ll d_)
  {
    d[s][t] = d_;
  }

  inline void calc()
  {
    rep(k, V) rep(i, V) rep(j, V)
    {
      d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    }
  }

  inline ll dist(int s, int t)
  {
    return (d[s][t] >= LINF / 2 ? LINF : d[s][t]);
  }
};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
  int h, w;
  cin >> h >> w;
  WarshallFloyd wf(10);
  rep(i, 10) rep(j, 10)
  {
    ll c;
    cin >> c;
    wf.add_E(i, j, c);
  }
  wf.calc();
  ll ans = 0;
  rep(i, h * w)
  {
    ll a;
    cin >> a;
    if (a == -1)
      continue;
    ans += wf.dist(a, 1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
A,B = map(int,input().split())
C = list(map(int,input().split()))
ans = 0
for i in range(A-1):
    if B < C[i]+C[i+1]:
        minus = C[i]+C[i+1]-B
        if C[i+1]<minus:
            C[i+1]=0
        else:
            C[i+1]-=minus
        ans += minus
print(ans)

Measured memory_bytes: 14540
/* Nurgazy Zhandos */

#include <bits/stdc++.h>

#define F first
#define S second

#define pf push_front
#define pb push_back
#define mp make_pair
#define pp pop_back
#define in insert

#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define sz(a) a.size()
#define STOP return 0

#define nl '\n'

#define int long long

using namespace std;

typedef pair <long long, long long> pll;
typedef pair <int, long long> pil;
typedef pair <long long, int> pli;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long double ld;
typedef long long ll;

const int MAX_N = 1e5 + 123;
const int inf = 1e9 + 123;
const ll INF = 1e18 + 123;
const int NN = 2e6 + 123;
const double eps = 1e-9;
const int mod = 1e9 + 7;

/*void random() {
 		unsigned int FOR;
 		asm("rdtsc" : "=A" (FOR));
	srand(FOR);
}*/

inline void fre() {
	#ifdef TEZZY
//	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
	#endif
}

inline void boost() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
}

main () {
	fre();
	boost();

	int a, b, k;
	cin >> a >> b >> k;
	
	if(b - a + 1 >= k * 2) {
   		for(int i = a; i <= a + k - 1; i++) cout << i << nl;
   		for(int i = b - k + 1; i <= b; i++) cout << i << nl;
   }
   else {
    	for(int i = a; i <= b; i++) cout << i << nl;
   }
}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Policy;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var s = input.ReadLine();
        var t = input.ReadLine();

        int c = 0;
        for(int i=0; i<s.Length; i++) {
            if(s[i] != t[i]) c++;
        }

        return c;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        if(n == 0) return ret;
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 27192
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()


int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];
  double sum = 0;
  rep(i, n) {
    for (int j = i+1; j < n; j++) {
      sum += sqrt( (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]) );
    }
  }
  printf("%.9lf\n", sum*2/n);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;


int main(){

    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    vector<int> waters;
    for(int i = 0; i <= F/100; i++){
        for (int j = 0; j <= F/100; j++){
            int water = i*A*100 + j*B*100;
            if (water <= F){
                waters.push_back(water);
            }
        }
    }

    vector<int> sugars;
    for (int i = 0; i <= F; i++){
        for(int j = 0; j <= F; j++){
            int sugar = i*C + j*D;
            if (sugar <= F){
                sugars.push_back(sugar);
            }
        }
    }

    int ans_sugar_water = 0;
    int ans_sugar = 0;
    double max_concentration = -1.0;
    for(int i = 0; i < waters.size(); i++){
        for (int j = 0; j < sugars.size(); j++){
            int water_sugar = waters[i] + sugars[j];
            if (water_sugar <= F){
                int dissolve_amount = waters[i] / 100 * E;
                if (dissolve_amount >= sugars[j]){
                    double concentration = 100.0*sugars[j]/(water_sugar);
                    if (max_concentration < concentration){
                        max_concentration = concentration;
                        ans_sugar_water = water_sugar;
                        ans_sugar = sugars[j];
                    }
                }
            }
        }
    }

    cout << ans_sugar_water << " " << ans_sugar << endl;
}

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

int main(){
  long long int A, B, C, K;
  cin >> A >> B >> C >> K;
  
  long long int ans = 0;
  if(K-A > 0){
    ans += A;
    K -= A;
  }else{
    ans += K;
    cout << ans;
    return 0;
  }
  K -= B;
  if(K > 0) ans -= K;

  cout << ans;
  return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define gcd __gcd
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define mp make_pair
#define pb push_back
#define pq priority_queue
#define um unordered_map
#define us unordered_set
#define lb lower_bound
#define ub upper_bound
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define sbits(a) __builtin_popcount(a)
#define lcm(a, b) ((a * b) / gcd(a, b))
#define nani(x) cerr << #x << " is " << x << endl;
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({ v, w }), g[v].pb({ u, w });
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000
#define mod 1000000007

typedef long long ll;

const int N = 1e5 + 5;

int A[105];
bool dp[N];

int main()
{
    fast;

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

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

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

    for (int i = 0; i <= k; i++) {
        if (dp[i])
            continue;
        for (int x = 0; x < n; x++) {
            if (i + A[x] <= k && !dp[i + A[x]])
                dp[i + A[x]] = 1;
        }
    }

    if (dp[k])
        cout << "First";
    else
        cout << "Second";

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
int main()
{
    using namespace std;
    int K, A, B;
    cin >> K;
    cin >> A >> B;
    if (A % K == 0 || B / K > A / K)
    {
        cout << "OK" << endl;
    }
    else
    {
        cout << "NG" << endl;
    }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,arr[200100];
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>arr[i];
  sort(arr,arr+n);
  for(int i=0;i<n-1;i++){
    if(arr[i]==arr[i+1]){
      cout<<"NO"<<endl;
      return 0;
    }
      
  }
  cout<<"YES"<<endl;
}


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

int main() {
  int ramen = 700;
  string s;
  cin >> s;
  
  if(s[0] == 'o') {
    ramen += 100;
  }
  
  if(s[1] == 'o') {
    ramen += 100;
  }
  
  if(s[2] == 'o') {
    ramen += 100;
  }
  cout << ramen << endl;
}

    

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll N, M;
vector<VL> G;
vector<bool> went;
ll ans = 0;

void dfs(ll now, ll cnt) {
    if(cnt == N) {
        ans++;
        cout << now << "\n";
    }
    FOREACH(to, G[now]) {
        if(!went[to]) {
            went[to] = true;
            dfs(to, cnt + 1);
            went[to] = false;
        }
    }
}
signed main() {
    cin >> N;
    G.assign(N, VL(N, 0));
    REP(i, N) {
        LCIN(u, k);
        u--;
        REP(j, k) { G[u][IN() - 1] = 1; }
    }
    REP(i, N) {
        REP(j, N) {
            if(j == N - 1) cout << G[i][j] << "\n";
            else cout << G[i][j] << " ";
        }
    }
    return 0;
}



Measured memory_bytes: 3180
#include<time.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
using namespace std;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

template<typename ...Ts>
void show(Ts... ts){
  cout<<"#:";
  auto print=[](auto v){cout<<v<<" ";};
  initializer_list<int>{(void(print(ts)),0)...};
  cout<<endl;
}

int main(void){
    string s,t;
    cin>>s;
    int N=stoi(s);
    int n=s.size();
    int x=0;
    rep(i,n){
        x+=s[i]-'0';
    }
    if (N%x==0){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
}






Measured memory_bytes: 256
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val nums = inputs.head.split(" ").map(_.toInt)
  val a = nums(0) * nums(1)
  val b = nums(2) * nums(3)

  println(if(a < b) { b } else { a })
}

Measured memory_bytes: 25548