akhauriyash/Code-Regression huggingface dataset:
//============================================================================
//Everyone has a different way of thinking, so God Created us
//   Hope You Respect My Way..,Thank You ):
// Author      : Murad
// Name        : Codeforces.cpp & Atcoder.cpp
// Description : Problem name
//============================================================================
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define ULL unsigned long long
#define MP make_pair
#define ff first
#define ss second
#define endl '\n'
#define INF 1e9 + 1
#define _INF INT32_MIN
#define pq priority_queue
#define MM multimap
#define PB push_back
#define vii vector<int>
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
char alphz[27] = { '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' };
float Euclidean(LL x1, LL x2, LL y1, LL y2) {
	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
LL gcd(LL a,LL b) {
	return !b ? a : gcd(b, a % b);
}
LL LCM(LL a, LL b) {
	return (a*b) / gcd(a, b);
}
void PrimeFactor(LL n)
{
	while (n % 2 == 0) {
		//printf("%d ", 2);
//		aa.insert(2);
		n /= 2;
	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		if (n%i == 0) {
			//printf("%d ", i);
			//aa.insert(i);
			n /= i;
		}
	}
	if (n > 2){
		//printf("%d ", n);
	//	aa.insert(n);
	};
}
bool is_square(LL x) {
	LL l = 0, r = x;
	while (l <= r) {
		LL mid = l + (r - l) / 2;
		if (mid*mid == x)return true;
		if (mid*mid > x)r = mid - 1;
		else l = mid + 1;
	}
	return false;
}
LL power(LL x, LL y)
{
	LL temp;
	if (y == 0)return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp*temp;
	else return x*temp*temp;
}
bool is_Prime(int x) {
	if (x == 2)return 1;
	else if (x % 2 == 0 || x < 2)return 0;
	for (int i = 3; i*i <= x; i += 2)
		if (x%i == 0)return 0;
	return 1;
}
int main()
{
	El3zba;
	/***  بسم الله الرحمن الرحيم   ***/
	LL n, k;
	cin >> n >> k;
	if (k % 2 == 1)
	{
		LL x = n / k;
		LL ans = x*x*x;
		cout << ans << endl;
	}
	else
	{
		LL x = 2 * n / k;
		LL a = x / 2;
		LL b = x - a;
		LL ans = a*a*a + b*b*b;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
#define ll long long int
const double mx = 2e6 + 5 ;

void solve()
{
	int n;
	ll ans = 0;
	cin>>n;
	vector<int> vect(n);
	REP(i,n)
		cin>>vect[i];
	sort(all(vect));
	ans+=vect[n-1];
	int ptr = n-2;
	int start = n-3;
	int cnt = 0;
	while(start>-1)
	{
		if(cnt==2)
		{
			cnt = 0;
			ptr--;
		}
		ans+=vect[ptr];
		start--;
		cnt++;
	}
	if(n==1)
		ans = 0;
	cout<<ans<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3964
r, g, b, n = map(int, input().split())
count = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        if (n - r * i - j * g) % b == 0 and (n - r * i - j * g) >= 0:
            count += 1
print(count)


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

const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = { 0,-1, 0, 1};

int main(){
    int h, w; cin >> h >> w;
    vector<string> maze(h);
    rep(i,h) cin >> maze[i];
    bool can = true;
    rep(i,h)rep(j,w){
        if(maze[i][j]=='.') continue;
        bool can2 = false;
        rep(dir,4){
            int ni = i + dx[dir];
            int nj = j + dy[dir];
            if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
            if(maze[ni][nj] == '#') {
                can2 = true;
                break;
            }
        }
        if(!can2) {
            can = false;
            break;
        }
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
signed main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if (b/a<c/a)  cout<<"OK";
	else if (b%a==0 || c%a==0)  cout<<"OK";
	else  cout<<"NG"; 
	re 0;
}


Measured memory_bytes: 3636
from itertools import product

n, m = map(int, input().split())
ss = product([0, 1], repeat=n)
lb = [[0] * n for _ in range(m)]
for i in range(m):
    tmp = list(map(int, input().split()))
    k = tmp.pop(0)
    for j in tmp:
        lb[i][j-1] = 1

p = list(map(int, input().split()))
ans = 0
for state in ss:
    flag = True
    sc = 0
    for j, l in enumerate(lb):
        if sum([min(e) for e in zip(l, state)]) % 2 != p[j]:
            flag = False
            break
    if flag:
        ans += 1
print(ans)

Measured memory_bytes: 3064
from math import cos, radians

a, b, h, m = map(int, input().split())

hs = 360 * h / 12 + 30 * m / 60
ms = 360 * m / 60

c = (
    max(hs, ms) - min(hs, ms)
    if max(hs, ms) - min(hs, ms) <= 180
    else 360 - (max(hs, ms) - min(hs, ms))
)
c = radians(c)
ans = (a ** 2 + b ** 2 - (2 * a * b * cos(c))) ** (1 / 2)
print(ans)


Measured memory_bytes: 9524
#include<bits/stdc++.h>
using namespace std;
#define inf 100000000000000000
#define ll long long 
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define test ll t ; cin>>t; while(t--)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
int main(){
	//mahakal(),fast;
	
	ll n ,a , b ;
	cin>>n>>a>>b ;
	if(a==0){
		cout<<0<<endl;return 0;
	}
	ll ans = a*(n/(a+b))+min(a,n%(a+b));
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
a,b,c = map(int,input().split())
samecount = 0
if a == b:
    samecount = samecount + 1
if a == c:
    samecount = samecount + 1
if b == c:
    samecount = samecount + 1

if samecount == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include <stdio.h>
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461
int main(void) {
	// your code goes here
	double a;
	scanf("%lf",&a);
	printf("%lf %lf\n",a*a*PI,2*a*PI);;
	return 0;

}


Measured memory_bytes: 2068
import java.util.Arrays;
import java.util.Scanner;


public class Main {
	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		long[] inputs = new long[3];
		for(int i = 0; i < 3; i++){
			inputs[i] = sc.nextLong();
		}
		
		Arrays.sort(inputs);
		
		
		for(int i = 0; i < 3; i++){
			System.out.print(inputs[i] + ((i != 2) ? " " : ""));
		}
		System.out.println();
		
		
	}
	
}

Measured memory_bytes: 17184
#define DEBUG 0
/**
 * File    : D.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-6-29 21:11:25
 * Powered by Visual Studio Code
 */
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
using ll = long long;
void Yes()
{
  cout << "Yes" << endl;
  exit(0);
}
void No()
{
  cout << "No" << endl;
  exit(0);
}
const int MAX_SIZE = 1000010;
class mint
{
public:
  static ll MOD;
  ll x;
  mint() : x(0) {}
  mint(ll x) : x(x % MOD) {}
  mint operator-() const { return x ? MOD - x : 0; }
  mint &operator+=(const mint &a)
  {
    if ((x += a.x) >= MOD)
    {
      x -= MOD;
    }
    return *this;
  }
  mint &operator-=(const mint &a) { return *this += -a; }
  mint &operator*=(const mint &a)
  {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint &operator/=(const mint &a) { return (*this *= power(MOD - 2)); }
  mint operator+(const mint &a) const { return mint(*this) += a; }
  mint operator-(const mint &a) const { return mint(*this) -= a; }
  mint operator*(const mint &a) const { return mint(*this) *= a; }
  mint operator/(const mint &a) const { return mint(*this) /= a; }
  bool operator<(const mint &a) const { return x < a.x; }
  bool operator==(const mint &a) const { return x == a.x; }
  const mint power(ll N)
  {
    if (N == 0)
    {
      return 1;
    }
    else if (N % 2 == 1)
    {
      return *this * power(N - 1);
    }
    else
    {
      mint half = power(N / 2);
      return half * half;
    }
  }
};
ll mint::MOD = 1e9 + 7;
istream &operator>>(istream &stream, mint &a) { return stream >> a.x; }
ostream &operator<<(ostream &stream, const mint &a) { return stream << a.x; }
mint inv[MAX_SIZE];
mint fact[MAX_SIZE];
mint factinv[MAX_SIZE];
void init()
{
  inv[1] = 1;
  for (int i = 2; i < MAX_SIZE; i++)
  {
    inv[i] = (-inv[mint::MOD % i]) * (mint::MOD / i);
  }
  fact[0] = factinv[0] = 1;
  for (int i = 1; i < MAX_SIZE; i++)
  {
    fact[i] = mint(i) * fact[i - 1];
    factinv[i] = inv[i] * factinv[i - 1];
  }
}
mint choose(int n, int k)
{
  if (n >= 0 && k >= 0 && n - k >= 0)
  {
    return fact[n] * factinv[k] * factinv[n - k];
  }
  return 0;
}
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
// const double epsilon = 1e-10;
// const ll infty = 1000000000000000LL;
// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

int N, K;

mint solve(int i)
{
  int R = N - K;
  int B = K;
  int r = R - (i - 1);
  int b = B - i;
  if (r < 0 || b < 0)
  {
    return 0;
  }
  return choose(r + i, i) * choose(b + i - 1, i - 1);
}

int main()
{
  init();
  cin >> N >> K;
  for (auto i = 1; i <= K; i++)
  {
    cout << solve(i) << endl;
  }
}

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

int coin[6] = {500, 100,50, 10, 5, 1};

int main(void){
    // Your code here!
    int tmp;
    while(cin>>tmp){
        if(tmp == 0){
            break;
        }
        int sum = 1000 - tmp;
        int cnt = 0;
        int s = 0;
        bool flag = false;
        while(true){
            if(sum == 0){
                flag = true;
                break;
            } else if(sum - coin[s] >= 0){
                sum -= coin[s];
                cnt += 1;
            } else{
                s++;
            }
            
        }
        
        cout << cnt << endl;

    }
    return 0;
}



Measured memory_bytes: 3048
N, Y = list(map(int, input().split()))

exist = False
for i in range(N + 1):
  for j in range(N - i + 1):
      total = 10000 * i + 5000 * j + 1000 * (N - i - j)
      if total == Y:
        exist = True
        i_1 = i
        j_1 = j
        k_1 = N - i - j

if exist:
  print(i_1, j_1, k_1)
else:
  print(-1, -1, -1)

Measured memory_bytes: 3188
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int main(){
    char a[105];
    int h,w;
    while(~scanf("%d%d",&h,&w)){
        for(int i=0;i<h;i++){
            scanf("%s",a);
            puts(a);
            puts(a);
        }
    }
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

int main()
{
  int n;
  cin >> n;
  
  vi L(n);
  rep(i, n) cin >> L[i];

  sort(all(L));

  int sum = 0;
  rep(i, n-1) sum += L[i];

  if(L[n-1] < sum) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a 
#define vb vector<long long int> b
const ll M=1e9+7;
const ll inf=1e18+5;
using namespace std;
ll t;
void fast(){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
ll bs(ll arr[], ll l, ll r, ll x){ 
	ll mid=0;
    if (r >= l){
		if (arr[mid] == x) return mid; 
        if (arr[mid] > x) return bs(arr, l, mid - 1, x); 
        return bs(arr, mid + 1, r, x); 
    }
    return -1;
}
ll power(ll x,ul y,ll p){
	ll res = 1;
	x = x % p;
	if(x == 0) return 0;
	while (y > 0){
		if (y & 1) res = (res*x) % p;
		y = y>>1;
		x = (x*x) % p;
		}
	return res;
}


void solve(){
	ll n,k;
	cin>>n>>k;
	ll a[n+1];
	set<ll>s;
	for(ll i=1;i<=n;i++) cin>>a[i];
	vector<bool> vis(n + 1, 0);
	deque<ll> ar;
	ll curr=1;
	while(!vis[curr]){
		vis[curr]=1;
		ar.push_back(curr);
		curr=a[curr];
	}
	if(k<(int)ar.size()) cout<<ar[k]<<"\n";
	else{
		while(ar.front()!=curr){ ar.pop_front(); k--;}
		cout<<ar[k%ar.size()]<<"\n";
	}
 }
int main(){
	fast();
	solve();
	return 0;
}



Measured memory_bytes: 6292
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////

#define N 300004

ll kai[N];
ll kai2[N];
ll po(ll i,ll p){
    if(p==0)return 1;
    else if(p==1)return mod(i);
    else if(p%2==0)return mod(po(mod(mod(i)*mod(i)),p/2));
    else  return mod(mod(i)*mod(po(i,p-1)));
}
void calc(){
    kai[0]=1;
    kai2[0]=1;
    for(int i=1;i<N;i++){
        kai[i]=mod(kai[i-1]*i);
        kai2[i]=mod(po(kai[i],i_5));
    }
}
ll comb(ll n,ll k){
    if(n==0){
        if(k==0)return 1;
        else return 0;
    }
    else if(n<k)return 0;
    else return mod(mod(mod(kai[n])*mod(kai2[n-k]))*mod(kai2[k]));
}
///////////
l_l p[N+2];
ll ca(ll a,ll b){
    return comb(p[b].first-p[a].first+p[b].second-p[a].second,p[b].first-p[a].first);
}
ll cal(ll a,ll b,ll c){
    ll d=ca(a,b);
    ll e=ca(b,c);
    return mod(d*e);
}

int main(){
    calc();
    ll h,w,n;cin>>h>>w>>n;
    rep(i,0,n-1)cin>>p[i].first>>p[i].second;
    sort(p,p+n);
    p[n]=l_l(1,1);
    p[n+1]=l_l(h,w);
    ll dp[n];
    rep(i,0,n-1){
        dp[i]=ca(n,i);
        rep(j,0,i-1){
            if(p[j].first<=p[i].first&&p[j].second<=p[i].second)Add(&dp[i],-mod(dp[j]*ca(j,i)));
        }
    }
    //rep(i,0,n-1)cout<<dp[i]<<" ";cout<<endl;
    ll ans=cal(n,n+1,n+1);
    rep(i,0,n-1){
        Add(&ans,-mod(dp[i]*ca(i,n+1)));
    }
    cout<<mod(ans)<<endl;
    
    return 0;
}






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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	assert(N >= 2);
	string s; cin >> s;
	vector<int> A(N);
	for (int i = 0; i < N; i++) { A[i] = s[i] - '1'; }

	N--; // number of iterations instead

	int ans2 = 0;
	for (int i = 0; i <= N; i++) {
		if ((N & i) == i) {
			ans2 += A[i]; ans2 %= 2;
		}
	}

	if (ans2) {
		cout << 1 << '\n';
		exit(0);
	} else {
		int ans4 = 0;
		for (int i = 0; i <= N; i++) {
			if (A[i] == 1) {
				cout << 0 << '\n';
				exit(0);
			}
			assert(A[i] % 2 == 0);
			if ((N & i) == i) {
				ans4 += A[i]; ans4 %= 4;
			}
		}
		cout << ans4 << '\n';
	}

	return 0;
}

// 2
// 02
// 002
// 0002
// 00002
// 000002


Measured memory_bytes: 5276
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ll n,k,ans=0;
    cin>>n>>k;
    for(int i=1; i<=n; i++)
    {
        if(i-1<k)
            continue;
        ll pos=i-1;
        ll can=(i-k);
        ans+=(n/i)*can;
        ll rem=n%i;
        if(rem)
        {
            if(rem<k)
                continue;
            ans+=(rem-k);
            if(k)
                ans++;
        }
    }

    cout<<ans<<endl;

    return 0;
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(M)]

roads = [[] for _ in range(N)]

for a, b in ab:
    roads[a-1].append(b)
    roads[b-1].append(a)

ans = 0

for i, r in enumerate(roads):
    r_ = set(r)
    if len(r_) == 0:
        ans += 1
    else:
        flag = True
        h = H[i]
        for x in r_:
            if H[x-1] >= h:
                flag = False
                break
        if flag:
            ans += 1
    
print(ans)

Measured memory_bytes: 110560
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<long long> a(n), base;
	for(auto & e : a) cin >> e;
	long long all = 0;
	for(auto & e : a) all ^= e;
	for(auto & e : a) e &= ~all;
	for(auto e : a){
		for(auto b : base) e = min(e, e ^ b);
		if(e){
			base.push_back(e);
			sort(base.rbegin(), base.rend());
		}
	}
	long long up = 0;
	for(auto b : base) up = max(up, up ^ b);
	cout << all + 2 * up << endl;
	return 0;
}


Measured memory_bytes: 1024
N, M =map(int,input().split())
F=[]
L=[]


for i in range(M):
    a, b=map(int,input().split())
    if a==1:
        F.append(b)

    if b==N:
        L.append(a)

FF=set(F)
LL=set(L)

for _ in FF:
    if _ in LL:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 21828
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define ces(d) cout<<" "<<endl;

int main() {
   
int N;
cin >>N;
bool H=false;
fx(25){
	fy(13){
		if(x*4+y*7==N){
			ce("Yes");
			H=true;
			x=25;y=13;
		}
	}
}

if(!H){
	ce("No");
}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;
typedef pair<long double,long double> P;

long double squ(long double x){
    return x*x;
}
int main(){
    int n;
    cin >> n;
    vector<P> spot(9);
    rp(i,n){
        long double x,y;
        cin >> x >> y;
        spot.at(i+1)=make_pair(x,y);
    }
    long double dissum=0.0;
    for(int i=1; i<n; i++){
        for(int j=i+1; j<=n;j++){
            dissum+=sqrt(squ(spot[i].first-spot[j].first)+squ(spot[i].second-spot[j].second));
        }
    }
    int pairs=n*(n-1)/2;
    long double ans;
    ans = dissum/(long double)pairs * (long double)(n-1);
    cout <<fixed<<setprecision(12)<< ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    int N;
    cin >> N;

    ll howManyDivide = inf;
    FOR(i, 0, N){
        ll a;
        cin >> a;
        ll divideNum = 0;
        while(a % 2==0){
            a /= 2;
            divideNum++;
        }
        howManyDivide = min(howManyDivide, divideNum);
    }

    p(howManyDivide);
    
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int N,K;
  cin >> N >> K;
  vector<int> v(N);
  for(int i = 0; i < N; i++){
    cin >> v[i];
  }
  sort(v.begin(), v.end());

  int ans = 0;
  for(int i = 0; i < K; i++){
    ans += v[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 3600
N = int(input())
W = list(map(int, input().split()))
ans = 10**9
for i in range(N - 1):
    s1 = W[:i + 1]
    s2 = W[i + 1:]
    diff = abs(sum(s1) - sum(s2))
    if diff < ans:
        ans = diff
print(ans)


Measured memory_bytes: 63232
#include<bits/stdc++.h>
using namespace std;
long long n,m,ans;
int main()
{
	cin>>n>>m;
	if(m>2*n)
	{
		ans=n+(m-2*n)/4;
	}
	else
	{
		ans+=m/2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define endl "\n"
#define print(X) cout << (X) << "\n"
#define answer(p) printf("Case #%lld:\n",(p)+1);
// #define input(X) getline(cin,X)
static const int INF = 1e+9+7;
static const ll INFL = 1e+18+7;
ll n,m,l;
string s,t;
ll d[200010],e[200010],dp[1001][1001];
int field[200][200];

typedef struct city{
  int k, y;
  bool operator < (const city &another)const{
    if(k != another.k)return k < another.k;
    return y < another.y;
  }
}city;

int main(){
  cin >> n >> m;
  vector<vector<city>> vec(n);
  vector<city> pre;
  map<city, int> ans;
  rep(i,0,m){
    city c;
    cin >> c.k >> c.y;
    vec[c.k-1].pb(c);
    pre.pb(c);
  }
  rep(i,0,n){
    sort(all(vec[i]));
    rep(j,0,vec[i].sz){
      ans[vec[i][j]] = j+1;
    }
  }
  rep(i,0,pre.sz){
    printf("%06d%06d\n",pre[i].k, ans[pre[i]]);
  }
  return 0;
}

Measured memory_bytes: 13940
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<x<<endl;
#define ll long long int
#define pb push_back
#define in insert
#define mp make_pair
#define F first
#define S second
#define N 1000000
#define MOD 1000000007
#define PI acos(-1)
int main()
{
	IOS
	map<string,string> mp;
	string s;
	cin>>s;
	mp["Sunny"]="Cloudy";
	mp["Rainy"]="Sunny";
	mp["Cloudy"]="Rainy";
	cout<<mp[s];
}

Measured memory_bytes: 256
<?php
/*
    Problem URL : http://arc060.contest.atcoder.jp/tasks/arc060_a

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

$ans = 0;

fscanf(STDIN, "%d %d", $N, $A);
$x = explode(" ", trim(fgets(STDIN)));

$arr = array();

for ($i = 0; $i < $N; $i++) {
	$diff = $x[$i] - $A;
	$arr[$i][$diff] = 1;
	if ($i != 0) {
		foreach ($arr[$i-1] as $key => $val) {
			$arr[$i][$key] += $arr[$i-1][$key];
			$arr[$i][$key+$diff] += $arr[$i-1][$key];			
		}
	}

	// echo "turn {$i}\n";
	// foreach ($arr[$i] as $key => $val) {
	// 	echo "{$key} {$val}\n";
	// }

}

echo isset($arr[$N-1][0]) ? $arr[$N-1][0] : 0 ;
echo PHP_EOL;


Measured memory_bytes: 6776
#include<cstdio>
const int N=103,M=1e9+7;
inline int Mod(int a){return a<M?a:a-M;}
int n,m,a[N],f[N][100003];
signed main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%d",a+i);
	for(int j=0;j<=m;j++)f[0][j]=1;
	for(int i=1;i<=n;i++)
	  for(int j=0;j<=m;j++)
		f[i][j]=Mod((j>0?f[i][j-1]:0)+Mod(f[i-1][j]-(j-a[i]-1<0?0:f[i-1][j-a[i]-1])+M));
	printf("%d",Mod(f[n][m]-(m>0?f[n][m-1]:0)+M));
	return 0;
}

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

int main(){
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    long long min= 10000000000;
    for(int i=0;i<=100000;i++){
        long long value = (long long)(2*c*i + max(0,x-i)*a+max(0,y-i)*b);
        if(value<min){
            min = value;
        }
    }
    cout << min << endl;
    /*if(a+b<=2*c){
        cout << a*x + b*y;
    }else{
        if(x>y){
            if(a>2*c){
                cout << 2*c*x; 
            }else{
                cout << 2*c*y + a*(x-y);
            }
        }else{
            if(b>2*c){
                cout << 2*c*y;
            }else{
                cout << 2*c*x + b*(y-x);
            }
        }
    }
    cout << endl;*/
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
	int a, b, c, d, e, f;
	std::cin >> a >> b >> c >> d >> e >> f;
	
	long double check = e * 1.0 / 100;
	long double max = -1, sugarMax = 0, allMax = 0;
	
	for (int i = 0; (i * 100 * a) <= f; ++i)
	{
		for (int j = 0; (j * 100 * b) + (i * 100 * a) <= f; ++j)
		{
			for (int k = 0; (j * 100 * b) + (i * 100 * a) + k * c <= f; ++k)
			{
				for (int it = 0; (j * 100 * b) + (i * 100 * a) + k * c + it * d <= f; ++it)
				{
					int sugar = k * c + it * d, water = i * 100 * a + j * 100 * b;
					if (water == 0)
						continue;
										
					//std::cout << e << " ";
					if (sugar * 1.0 / water <= check)
					{
						if (100 * 1.0 * sugar / (sugar + water) * 1.0 > max)
						{
							max = 100 * 1.0 * sugar / (sugar + water) * 1.0;
							allMax = sugar + water;
							sugarMax = sugar;
						}
					}
				}
			}
		}
	}
	
	std::cout << allMax << " " << sugarMax;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define int unsigned long long
#define max 1000000000000000000
void fast() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int32_t main() {
	fast();
	int n;
	cin >> n;
	int ans = 1;
	int a[n + 1];
	for (int i = 0; i < n; i++)
		cin >> a[i];

	int k;
	for (int i = 0; i < n; i++) {
		if (a[i] == 0) {
			cout << "0";
			return 0;
		}
	}
	for (int i = 0; i < n; i++) {
		k = a[i];
		if (ans == 0) {
			cout << ans;
			return 0;
		}
		if (k <= max / ans) {
			ans = ans * k;
		}
		else {
			cout << "-1";
			return 0;
		}
	}
	cout << ans;
}

Measured memory_bytes: 4420
n=int(input())
s=input()
e=s.count("E")
w=n-e
cnt_e=0
cnt_w=0
maxi=0
for i in range(n):
  if s[i]=="E":
    if maxi<=(w-cnt_w)+cnt_e:
      maxi=(w-cnt_w)+cnt_e
    cnt_e+=1
  else:
    if maxi<=(w-cnt_w-1)+cnt_e:
      maxi=(w-cnt_w-1)+cnt_e
    cnt_w+=1
print(n-(maxi+1))

Measured memory_bytes: 3704
#include<iostream>
#include<string>
#include<cstdlib>
#include<vector> 
using namespace std;
vector<int> ps={2,3,5,7,11,13,17,19,23,29,31,37,41
   ,43,47,53,59,61,67,71,73,79,83,89,97};

int are(int p, int N){
    if(N==0)return 0;
    return N/p + are(p, N/p);
}
int nanko(vector<int> a, int limit){
    int sum = 0;
    for(auto aaa:a){
        if(aaa>=limit)sum+=1;
    }
    return sum;
}
int main(){
    int N;
    cin>>N;
    vector<int> a;
    
    for(auto p: ps){
        int aaa=are(p, N);
        a.push_back(aaa);
    }
    /////////////////
    int t74=nanko(a, 74);
    int t24=nanko(a, 24);
    int t14=nanko(a, 14);
    int t4=nanko(a, 4);
    int t2=nanko(a, 2);
    int case1=t24*(t2-1);
    int case2=t14*(t4-1);
    int case3=t4*(t4-1)/2*(t2-2);
    int case4=t74;
    cout<<case1+case2+case3+case4<<endl;
}

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

int main() {
	int N, A[100];
	cin >> N;

	for (int k = 0; k < N; k++) cin >> A[k];
	cout << A[0];
	for (int m = 1; m < N; m++) cout << " " << A[m];
	cout << endl;

	for (int i = 1 ; i < N; i++) {
		int v = A[i];
		int j = i - 1;
		while(j >=0 && A[j] > v) {
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		cout << A[0];
		for (int l = 1; l < N; l++) {
			cout << " " << A[l];
		}
		cout << "\n";
	}

	return 0;

}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    int D;cin >> D;
    vector<int> c(26);
    vector<vector<int>> s(D, vector<int>(26));
    REP(i, 26)cin >> c[i];
    REP(i, D)REP(j,26)cin >> s[i][j];
    lint sat = 0;

    vector<int> las(26,-1),con(D);

    vector<int> t(D);
    REP(i, D)
        cin >> t[i];


    REP(i,D){
        int tt = t[i] - 1;
        las[tt] = i;
        sat += s[i][tt];
        REP(j,26)sat -= c[j] * (i - las[j]);
        cout << sat << "\n";
    }
    return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code
int main(int argc, char const* argv[])
{
    int n;
    cin >> n;
    if (n % 10 == 9 or (n / 10)  % 10 == 9) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}



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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef string ss;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    string s,t;
    ll k,cnt1 = 0,cnt2 = 0;
    cin >> s >> k;
    t = s + s;
    //cout << t << endl;
    ll n = t.size();
    ll m = s.size();

    REP(i,1,n){
        if(i < s.size()){
            if(t[i] == t[i-1]){
                cnt1++;
                t[i] = '#';
            }
        }
        else {
            if(t[i] == t[i-1]){
                cnt2++;
                t[i] = '#';
            }
        }
    }
     
    if(s == string(s.size(), s[0])){
        //cout << "000" << endl;
        //cout << "cnt1 : cnt2 " << cnt1 << " " << cnt2 << endl;
        cout << m * k / 2 << endl;
        return 0;
    }
    cout << cnt1 + cnt2 * (k-1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
	cout << fixed << setprecision(10);
	int a,b;
	cin >> a >> b;
	cout << ( a*b%2==0 ? "Even" : "Odd" ) << endl;
	return 0;
}

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


int main()
{
	string s;
	while (true)
	{
		getline(cin, s);
		if (s == "END OF INPUT")
			break;
		string r = "";
		for (int i = 0; i < s.size(); i++)
		{
			if (s[i] == ' ')
			{
				cout << r.size();
				r = "";
			}
			else
				r += s[i];
		}
		cout << r.size();
		cout << "\n";
	}
}



Measured memory_bytes: 3148
def main():
    n = int(input())
    p = list(map(int, input().split()))
    ans = 0
    minint = p[0]
    maxint = p[0]
    for i in range(n):
        if p[i] > maxint:
            maxint = p[i]
        elif p[i] <= minint:
            ans += 1
            minint = p[i]
    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 75344
#include<iostream>
using namespace std;
int main() {
	int a, b, c, k,ans=0;
	cin >> a >> b >> c >> k;
	if (k < a) { ans = k; cout << ans; return 0; }
	if (k >= a) { ans += a; k -= a; }
	if (k < b) { cout << ans; return 0; }
	if (k >= b) { k -= b; }
	if (k >= 0) { ans -= k; }
	cout << ans;
	return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

int swap(int *, int *);
int partition(int *, int, int);

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

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  
  s = partition(a, 0, n - 1);

  for(i = 0; i < s; i++){
    printf("%d ", a[i]);
  }
  printf("[%d] ", a[i]);

  s = i + 1;
  for(i = s; i < n; i++){
    if(i != n - 1)printf("%d ", a[i]);
    else printf("%d\n", a[i]);
  }
  
  return 0;
}

int swap(int *a, int *b) {
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
}

int partition(int *a, int p, int r) {
  int x = a[r];
  int i = p - 1;
  int j;

  for(j = p; j < r; j++){
    if(a[j] <= x){
      i++;
      swap(&a[i], &a[j]);
    }
  }
  swap(&a[i + 1], &a[r]);

  return i + 1;
}




Measured memory_bytes: 2148
from collections import deque

n, m = map(int, input().split())
eg = [[] for _ in range(n + 1)]

al = [0] * m
bl = [0] * m

for i in range(m):
    a, b = map(int, input().split())
    eg[a].append(b)
    eg[b].append(a)
    al[i], bl[i] = a, b

ans = 0
for i in range(m):
    x, y = al[i], bl[i]
    q = deque()
    q.append(1)
    seen = {1}
    while len(q) > 0:
        v = q.pop()
        for t in eg[v]:
            if t in seen:
                continue
            elif (v == x and t == y) or (v == y and t == x):
                continue
            q.append(t)
            seen.add(t)
    if len(seen) != n:
        ans += 1
print(ans)


Measured memory_bytes: 71372
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    int n,m;cin >> n;
    int t[n]; for(int i=0; i<n; i++) cin >> t[i];
    cin >> m;
    int p[m],x[m]; for(int i=0; i<m; i++) cin >> p[i] >> x[i];
    int ans=0;

    for(int i=0; i<m; i++){
        for(int j=0; j<n; j++){
            if(j+1==p[i]){ 
                ans+=x[i]; 
            }else{
                ans+=t[j];
            }
        }
        cout<<ans<<"\n";
        ans=0;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    long long q,s,h,d;
    long long n;
    long long minh,mind,ans;

    scanf("%lld%lld%lld%lld",&q,&s,&h,&d);
    scanf("%lld",&n);

    long long h1 = q * 4,h2 = s * 2;
    long long d1 = q * 8,d2 = s * 4;

    if (h1 <= h2) minh = h1;
    else minh = h2;

    if (minh >= h) minh = h;

    if (d1 <= d2) mind = d1;
    else mind = d2;

    if (mind >= d) mind = d;

    if (minh * 2 <= mind) mind = minh * 2;

    if (n % 2) ans = n / 2 * mind + minh;
    else ans = n / 2 * mind;

    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,n;
	cin>>k;
	string s;
	cin>>s;
	if(s.length()<=k){
		cout<<s<<endl;
	}
	else{
		for(i=0;i<k;i++){
			cout<<s[i];
		}
		cout<<"...";
	}
	return 0;	
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    ll n,k; cin >> n >> k;
    long double ans = 0.0;
    for(int i=1;i<=n;i++){
        ll count = 0;
        ll x = i;
        while(x<k){
            x*=2; count++;
        }
        ans += (long double)1/(long double)((ll)n*(ll)pow(2,count));
    }
    cout << setprecision(15) << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
const int N = 1e5;
using namespace std;
int n,a[N + 5],mx,a1;
bool cmp(int a,int b)
{
    return a > b;
}
int main()
{
    scanf("%d",&n);
    for (int i = 1;i <= n;i++)
        scanf("%d",&a[i]);
    sort(a + 1,a + n + 1,cmp);
    for (int i = 1;i <= n;i++)
        if (i <= a[i])
            mx = i;
    for (int i = mx + 1;i <= n;i++)
        if (mx <= a[i])
            a1 = i - mx;
    if (a1 % 2 == 1 || (a[mx] - mx) % 2 == 1)
        cout<<"First"<<endl;
    else
        cout<<"Second"<<endl;
    return 0;
}

Measured memory_bytes: 4148
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    double t[110];
    double v[110];
    cin >> N;
    rep(i,0,N){
        cin >> t[i];
    }
    rep(i,0,N){
        cin >> v[i];
    }

    double t_sum[110] = {};
    rep(i,1,N+1){
        t_sum[i] = t_sum[i-1] + t[i-1];
    }
    double vmin[50000] = {};
    double t_len = 0;
    rep(i,0,N){
        t_len += t[i];
    }
    rep(i,0,t_len * 2 + 1){
        double vmin_tmp = 1e9;
        double tt = double(i)/2;
        rep(j,0,N){
            if(tt < t_sum[j]){
                vmin_tmp = min(vmin_tmp, v[j] + t_sum[j] - tt);
            }else if(tt >= t_sum[j] && tt <= t_sum[j+1]){
                vmin_tmp = min(vmin_tmp, v[j]);
            }else{
                vmin_tmp = min(vmin_tmp, v[j] + tt - t_sum[j+1]);
            }
            // if(j == 0){
            //     if(tt <= t[0]){
            //         vmin_tmp = min(vmin_tmp, v[0]);
            //     }else{
            //         vmin_tmp = min(vmin_tmp, v[0] + tt - t_sum[1]);
            //     }

            // }else if(j == N-1){
            //     if(tt >= t[N-1]){
            //         vmin_tmp = min(vmin_tmp, v[N-1]);
            //     }else{
            //         vmin_tmp = min(vmin_tmp, v[N-1] + t[N-1] - tt);
            //     }
                
            // }else{
            //     if(tt < t[j-1]){
            //         vmin_tmp = min(vmin_tmp, v[j] + t[j-1] - tt);
            //     }else if(tt >= t[j-1] && tt <= t[j]){
            //         vmin_tmp = min(vmin_tmp, v[j]);
            //     }else{
            //         vmin_tmp = min(vmin_tmp, v[j] + tt - t[j]);
            //     }

            // }

        }
        vmin_tmp = min(vmin_tmp, tt);
        vmin_tmp = min(vmin_tmp, t_sum[N] - tt);
        vmin[i] = vmin_tmp;
    }
    double ans  = 0;

    rep(i,0,t_len * 2){
        ans += 0.25 * (vmin[i] + vmin[i+1]);
    }
    cout << setprecision(10) << ans  << endl;


}


Measured memory_bytes: 640
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
	auto N = readln.split[0].to!int;
	if (N == 1) { writeln("Hello World"); }
	else if (N == 2) {
		auto A = readln.split[0].to!int;
		auto B = readln.split[0].to!int;
		writeln(A+B);
	}
}


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

int main() {
  	char c;
    cin >> c;
    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}


Measured memory_bytes: 256
N, K, T, U, V, L = gets.split.map(&:to_f)

time = 0.0
distance = 0.0
stock = 0
restTime = 0.0
N.to_i.times do
  d = gets.to_f
  t = (d - distance) / V
  while true do
    break if restTime >= t || stock == 0
    restTime += T
    stock -= 1
  end
  if restTime >= t
    restTime -= t
    time += t
  else
    time += restTime
    time += (d - distance - V * restTime) / U
    restTime = 0.0
  end
  distance = d

  if stock < K
    stock += 1
  else
    restTime = T
  end
end

t = (L - distance) / V
while true do
  break if restTime > t || stock == 0
  restTime += T
  stock -= 1
end
if restTime >= t
  restTime -= t
  time += t
else
  time += restTime
  time += (L - distance - V * restTime) / U
  restTime = 0.0
end
distance = L

p time

Measured memory_bytes: 6152
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
//cout << fixed << setprecision(0)

int main() { 
  int n,x;cin>>n>>x;
  int m=INF,sum=0;
  rep(i,n){
    int a;cin>>a;
    sum += a;
    m = min(m,a);
  }
  cout << n+(x-sum)/m << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define PUTS(x) cout << (x) << endl;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())
#define MOD 1000000007

template <class Abel>
struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0; // to be set

    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) {
        for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM);
    }

    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1));
        sub_add(1, a, x);
        sub_add(0, b, x * (b - 1));
        sub_add(1, b, x * (-1));
    }

    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }

    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    int N;
    cin >> N;
    int Q;
    cin >> Q;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) { return rights[i] < rights[j]; });

    BIT<int> bit(N + 5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]] + 2, r + 2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i] + 1, lefts[i] + 2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;
}


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

using ll = long long;

// 組合せを素数で割った値を求める
const int MAX = 510000;
const ll MOD = 1e9 + 7;
long long fac[MAX], finv[MAX], inv[MAX];

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

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n, m;
  cin >> n >> m;
  
  map<ll, ll> mp;
  ll now = m;
  for (int i = 2; i * i <= m; i++) {
    while (now % i == 0) {
      mp[i]++;
      now /= i;
    }
  }
  if (now > 1) mp[now]++;
  
  COMinit();
  
  ll ans = 1;
  for (auto i : mp) {
    ans *= COM(i.second + n - 1, i.second);
    ans %= MOD;
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 12160
#include <stdio.h>

int main(void)
{
  int p, q, r, min;
  scanf("%d %d %d", &p, &q, &r);
  min = p + q;
  if(p + r < min)
  {
    min = p + r;
  }
  if(r + q < min)
  {
    min = r + q;
  }
  printf("%d\n", min);
  return 0;
}

Measured memory_bytes: 128
N = int(input())
a_list = list(map(int, input().split()))

count = 1
up_flag = None
prev_a = a_list[0]
for a in a_list[1:]:
  if up_flag is None:
    if prev_a == a:
      continue
    up_flag = a > prev_a
  if up_flag and a >= prev_a:
    prev_a = a
    continue
  elif not up_flag and a <= prev_a:
    prev_a = a
    continue
  else:
    up_flag = None
    count += 1
    prev_a = a

print(count)

Measured memory_bytes: 85296