akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

int n, k;
long long ans = 0;

int main() { 

  cin >> n >> k;

  for (int b = k + 1; b <= n; b++) {
    ans += 1ll * (b - k) * (n / b);
    int cur = n % b;
    if (cur >= k) {
      ans += cur - k + 1;
    }
    if (k == 0) {
      ans--;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int x;
    cin>>x;
    if(x==0)
    cout<<0;
    else
    {
        int a=x/500;
        x=x-500*a;
        int b=x/5;
        cout<<a*1000+b*5;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<int> prime{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
  vector<int> appear(15, 0);
  REP(i, 15) {
    int waru = prime[i];
    while (waru <= n) {
      appear[i] += n / waru;
      waru *= prime[i];
    }
  }
  int two = 0, four = 0, one_four = 0, two_four = 0, seven_four = 0;
  REP(i, 15) {
    if (appear[i] >= 2) ++two;
    if (appear[i] >= 4) ++four;
    if (appear[i] >= 14) ++one_four;
    if (appear[i] >= 24) ++two_four;
    if (appear[i] >= 74) ++seven_four;
  }
  int ans = 0;
  ans += seven_four;
  ans += max(two_four * (two - 1), 0);
  ans += max(one_four * (four - 1), 0);
  ans += max((four * (four - 1) / 2) * (two - 2) , 0);
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
ll strtoint(string str);
int main(){
	fast;
	string s; cin>>s;
	vector<string> days={"SUN","MON","TUE","WED","THU","FRI","SAT"};
	for(auto i=0;i<days.size();++i){
		if(days[i]==s){
			cout<<7-i<<'\n';
			break;
		}
	}
	return 0;
}
ll strtoint(string str){
	ll x=0;
	stringstream ss;
	ss<<str;
	ss>>x;
	return x;
}

Measured memory_bytes: 256
package main

import (
        "fmt"
)

func solution(a, b, c, d int) string {
        //t: ab
        //a: cd
        var ans string
        i := 0
        for {
                if (i & 1) == 0 {
                        c -= b
                } else {
                        a -= d
                }
                if a <= 0 {
                        ans = "No"
                        break
                }
                if c <= 0 {
                        ans = "Yes"
                        break
                }
                i++
        }
        return ans
}

func main() {
        var a, b, c, d int
        fmt.Scan(&a, &b, &c, &d)
        fmt.Println(solution(a, b, c, d))
}

Measured memory_bytes: 1752
#include <iostream>
#include<bits/stdc++.h>
#include<string>
#include<set>
#define ll long long

using namespace std;

int main()
{
  
  ll n;
  cin>>n;
  set<string> s;
  
  for(ll i=1;i<=n;i++)
   {
       string str;
       cin>>str;
       s.insert(str);
       
   }
   cout<<s.size()<<endl;
   
   return 0;
}

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

int mod = 1'000'000'007;

int fact(int n){
    long long x = 1;
    for (int i = 2; i <= n; i++){
        x *= i;
        x %= mod;
    }
    return x;
}

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<bool> LR(2 * n);
    long long ans = 1;
    for (int i = 0; i < 2 * n; i++){
        if (s[i] == 'W') LR[i] = (2 * n - 1 - i) % 2;
        else LR[i] = (2 * n - i) % 2;
    }
    int L = 0;
    for (int i = 0; i < 2 * n; i++) {
        if (!LR[i]) L++;
        else {
            ans *= L;
            ans %= mod;
            L--;
        }
    }
    if (L != 0) cout << 0 << endl;
    else cout << ans * fact(n) % mod << endl;
}

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

const int N = 5000;
const int MOD = 1e9 + 7;

int n, sz[N], pr[N / 2 + 1], dp[N][N + 1];
std::vector<int> tree[N];

void update(int& x, int a)
{
    x += a;
    if (x >= MOD) {
        x -= MOD;
    }
}

void dfs(int p, int u)
{
    sz[u] = 1;
    dp[u][1] = 1;
    for (int v : tree[u]) {
        if (v == p) {
            continue;
        }
        dfs(u, v);
        for (int k = sz[u] + sz[v]; k >= 0; -- k) {
            int tmp = 0;
            for (int j = std::max(k - sz[u], 0); j <= sz[v] && j <= k; ++ j) {
                update(tmp, 1LL * dp[u][k - j] * dp[v][j] % MOD);
            }
            dp[u][k] = tmp;
        }
        sz[u] += sz[v];
    }
    for (int k = sz[u]; k >= 1; -- k) {
        if (k % 2 == 0) {
            update(dp[u][0], (MOD - 1LL) * dp[u][k] % MOD * pr[k / 2] % MOD);
        }
    }
}

int main()
{
    scanf("%d", &n);
    for (int i = 0, x, y; i < n - 1; ++ i) {
        scanf("%d%d", &x, &y);
        x --, y --;
        tree[x].push_back(y);
        tree[y].push_back(x);
    }
    pr[0] = 1;
    for (int i = 1; i <= n / 2; ++ i) {
        pr[i] = (2 * i - 1LL) * pr[i - 1] % MOD;
    }
    dfs(-1, 0);
    printf("%d\n", static_cast<int>((MOD - 1LL) * dp[0][0] % MOD));
}

Measured memory_bytes: 97280
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

int n, a, b;
vector<int> h;

bool f(int m){
    int cnt = 0;
    rep(i, 0, n){
        if(h[i] > b * m){
            cnt += (h[i] - b * m + a - b - 1) / (a - b);
        }
    }
    return cnt <= m;
}

signed main(){
    cin >> n >> a >> b;
    rep(i, 0, n){
        int in;
        cin >> in;
        h. push_back(in);
    }
    sort(all(h));
    int l = 0, r = 1000000001, mid;
    rep(i, 0, 50){
        mid = (l + r) / 2;
        if(f(mid)){
            r = mid;
        }else{
            l = mid;
        }
    }
    cout << r << endl;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define int long long
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567, MAX = 1e18;
const long long infll = 4557430888798830399;
int n, p;
int mul(int a, int b) {
	if (a >= MAX / b) return MAX;
	return a * b;
}
int fpow(int a, int p) {
	if (!p) return 1;
	int tmp = fpow(a, p >> 1);
	tmp = mul(tmp, tmp);
	if (p & 1) tmp = mul(tmp, a);
	return tmp;
}
bool check(int x) {
	int lol = fpow(x, n);
	if (p % lol == 0) return 1;
	return 0;
}
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> p;
	//Answer is divisor of p. If it is x, then p must divide x ^ n.
	int ans = 1;
	for (int i = 1; i * i <= p; i++) if (p % i == 0) {
		int val1 = i, val2 = p / i;
		if (check(val1)) ans = max(ans, val1);
		if (check(val2)) ans = max(ans, val2);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        String ans = "";
        if (Integer.parseInt(a) > Integer.parseInt(b)) {
            for (int i=0; i<Integer.parseInt(a); i++) {
                ans += b;
            }
        }
        else if (Integer.parseInt(a) < Integer.parseInt(b)) {
            for (int i=0; i<Integer.parseInt(b); i++) {
                ans += a;
            }
        }
        else {
            for (int i=0; i<Integer.parseInt(b); i++) {
                ans += a;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23892
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    string s;
    cin >> s;
    rep(i, s.length()-1) {
        if ( s[i] == 'A' && s[i+1] == 'C' ) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

import math

primes = set()


def prime_factorization(n):
    global primes
    primess = set()
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            if i not in primess and i in primes:
                print("setwise coprime")
                exit()
            primes.add(i)
            primess.add(i)
    if n > 1:
        if n not in primess and n in primes:
            print("setwise coprime")
            exit()
        primess.add(n)
        primes.add(n)


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    a = A[0]
    for i in range(1, N):
        a = math.gcd(a, A[i])

    if a != 1:
        print("not coprime")
        return

    for i in range(N):
        prime_factorization(A[i])

    print("pairwise coprime")


if __name__ == '__main__':
    main()


Measured memory_bytes: 175460
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    ll n;
    cin>>n;
    ll base=-2;
    ll d=0;
    string res;
    ll quo;
    ll rem;
    while(n!=0){
        rem=n%2;
        if(rem==0)res+='0';
        else {res+='1';n-=llpow(-1,d);}
        n/=2;
        d++;
    }
    if(d==0)res+='0';
    reverse(res.begin(),res.end());
    cout<<res<<endl;
    return 0;
}




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

using namespace std;

int main()
{
    int a[3] = {0};
  	cin >> a[0] >> a[1] >> a[2];
  
 	sort(a, a+3);
  	if(a[0] == 5 && a[1] == 5 && a[2] == 7)
      cout << "YES";
 	else
      cout << "NO";
  
	return 0;
}  

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

vector<int> solve(int n,vector<int> x,vector<int> y,vector<int> p){
	const int INF=1LL<<62;

	int mul=1;

	for(int i=0;i<n;i++){
		mul*=3;
	}

	vector<vector<int> > xs(1<<n,vector<int>(n));
	vector<vector<int> > ys(1<<n,vector<int>(n));

	for(int i=0;i<1<<n;i++){
		for(int j=0;j<n;j++){
			xs[i][j]=abs(x[j]);
			ys[i][j]=abs(y[j]);

			for(int k=0;k<n;k++){
				if((i>>k)&1){
					xs[i][j]=min(xs[i][j],abs(x[j]-x[k]));
					ys[i][j]=min(ys[i][j],abs(y[j]-y[k]));
				}
			}
		}
	}

	vector<int> ans(n+1,INF);

	for(int i=0;i<1<<n;i++){
		int cnt=0;

		for(int j=0;j<n;j++)
			if((i>>j)&1)
				cnt++;

		for(int j=i;j>=0;j--){
			j&=i;
			int cost=0;

			for(int k=0;k<n;k++){
				if(!((i>>k)&1)){
					cost+=1LL*min({xs[j][k],ys[i-j][k]})*p[k];
				}
			}

			ans[cnt]=min(ans[cnt],cost);
		}
	}

	return ans;
}

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

	vector<int> x(n),y(n),p(n);

	for(int i=0;i<n;i++)
		cin>>x[i]>>y[i]>>p[i];

	vector<int> ans=solve(n,x,y,p);

	for(int i=0;i<=n;i++)
		cout<<ans[i]<<"\n";

	return 0;
}

Measured memory_bytes: 13028
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    ll k; cin >> k;
    vector <ll> as;
    REP(i, n){
        ll a; cin >> a;
        as.push_back(a-1);
    }
    vector <ll> sums;
    sums.push_back(0);
    map <ll, vector <int>> cnt;
    REP(i, n){
        ll add = as[i];
        sums.push_back((add + sums[i]) % k);
    }
    REP(i, n+1){
        cnt[sums[i]].push_back(i);
    }
    ll ans = 0;
    for (auto key : cnt){
       auto idxes = key.second;
       ll begin = 0;
       REP(end, idxes.size()){
           if (end == 0){
               continue;
           }
           while (idxes[end] - idxes[begin] >= k){
               begin++;
           }
           ans += (end - begin);
       }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int N,K,d,A,i,j,count=0;
    int sunuke[110]={0};
    cin >> N >> K;
    for(i=0;i<K;i++){
        cin >> d;
        for(j=0;j<d;j++){
            cin >> A;
            sunuke[A]++;
        }
    }
    for(i=1;i<=N;i++){
        if(sunuke[i]==0){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll X; cin >> X;
    if(X >= 30){
        return "Yes";
    }else{
        return "No";
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, tmp, tmp2;
	char w;
	while(1){
		cin >> a >> b;
		
		if(a == 0 && b == 0){
			break;
		}
		
		w = 'A';
		tmp = a + b;
		tmp2 = 0;
		for(int i = 1; i <= 4; i++){
			cin >> a >> b;
			if(tmp < (a+b)){
				tmp = a + b;
				tmp2 = i;
			}
		}
		
		cout << (char)(w+tmp2) << " " << tmp << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    ll n, k; string s;
    cin >> n >> k >> s; k--;
    rep(i, n){
        if(i != k) cout << s[i];
        else{
            if(s[i] == 'A') cout << "a";
            if(s[i] == 'B') cout << "b";
            if(s[i] == 'C') cout << "c";
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
from operator import itemgetter
N=int(input())
ab=[tuple(map(int,input().split())) for _ in range(N)]
ab=sorted(ab, key=itemgetter(1))
#print(ab)

c=0
for v in ab:
    if c+v[0]<=v[1]:
        c+=v[0]
    else:
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 39076
#include<bits/stdc++.h>
#define PI 2.0*acos(0.0)
#define ll              long long int
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        ((a)*(b))/gcd(a,b)
#define MOD             1000000007
#define mx              123456789
using namespace std;
int main()
{
    string s, s1;
    cin>>s>>s1;
    bool ok=0;
    for(int i=0; i<s.size(); i++)
    {
        if(s[i]!=s1[i])
        {
            ok=1;
            break;
        }
    }
    if(ok==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


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


int main(){
	long N;
	long count = 1e7;
	long white_count = 0;
	long black_count = 0;
	string S;

	cin >> N >> S;
	for(long i=0;i<N;i++){
		if(S[i]=='.'){
			white_count++;
		}
	}
	for(long i=0;i<N;i++){
		count = min(count, white_count+black_count);

		if(S[i]=='.'){
			white_count--;
		}
		else{
			black_count++;
		}
		count = min(count, white_count+black_count);
	}

	cout << count << endl;
	
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define      mp(x,y)          make_pair(x,y)
#define      pb(x)            push_back(x)
#define      each(it,s)       for(auto it = s.begin(); it != s.end(); ++it)
#define      forn(i, n)       for(int i = 0; i < (n); ++i)
#define      fill(a)          memset(a, 0, sizeof (a)
#define      sortA(v)         sort(v.begin(), v.end())
#define      pi               pair < int,int >
#define      f                first
#define      s                second
using namespace std;
typedef long long ll;
#define N 1000005
//**************_____Global Variables______******************
bool vis[N];
vector<int> *g;
//*************------Functions------------*********************

//************------Main function---------*********************
int main()
{
    //freopen("output.txt","w",stdout);
    //freopen("input.txt","r",stdin);
    ll q,h,s,d,n;
    cin>>q>>h>>s>>d>>n;
    long long ans = 0;
    ll m = min( min(8*q,d) , min(4*h,2*s) ) ;
    ans = (n/2)*m;
    n = n%2;
    if(n==1)
    {
        ans +=min( 4*q , min( 2*h,s )  );
    }
    cout<<ans;
    return 0;
}  

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 10000
#define NIL -1

struct Node{
  int parent,left,right;
};
struct Node T[MAX];
int n,D[MAX],H[MAX];

void setDepth(int u,int d){
  if(u==NIL)return;
  D[u]=d;
  setDepth(T[u].left,d+1);
  setDepth(T[u].right,d+1);
}

int setHeight(int u){
  int h1=0,h2=0;
  if(T[u].left != NIL)
    h1=setHeight(T[u].left)+1;
  if(T[u].right != NIL)
    h2=setHeight(T[u].right)+1;
  if(h1>h2) return H[u]=h1;
  else return H[u]=h2;
}

int getSibling(int u){
  if(T[u].parent==NIL)return NIL;
  if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)
    return T[T[u].parent].left;
  if(T[T[u].parent].right != u && T[T[u].parent].right != NIL)
    return T[T[u].parent].right;
  else return NIL;
}

void print(int u){
  int deg=0;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getSibling(u));
  if(T[u].left!=NIL) deg++;
  if(T[u].right!=NIL) deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);

  if(T[u].parent == NIL){
    printf("root\n");
  }else if(T[u].left == NIL && T[u].right == NIL){
    printf("leaf\n");
  }else{
    printf("internal node\n");
      }
}

int main(){
  int i,v,l,r,root;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].parent=NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].left=l;
    T[v].right=r;
    if(l!=NIL)T[l].parent=v;
    if(r!=NIL)T[r].parent=v;
  }
  for(i=0;i<n;i++){
    if(T[i].parent == NIL) root=i;
  }
  setDepth(root,0);
  setHeight(root);

  for(i=0;i<n;i++){
    print(i);
  }

  return 0;
}



Measured memory_bytes: 2108
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        double[] x = new double[n];
        for(int i = 0; i < n; i++){
            x[i] = scan.nextDouble();
        }
        double[] y = new double[n];
        for(int i = 0; i < n; i++){
            y[i] = scan.nextDouble();
        }
        double d1 = 0, d2 = 0, d3 = 0;
        double max = 0;
        for(int i = 0; i < n; i++){
            if(x[i] - y[i] <= 0){
                d1 += (x[i] - y[i]) * -1;
                d3 += ((x[i] - y[i]) * (x[i] - y[i]) * (x[i] - y[i])) * -1;
            }else{
                d1 += x[i] - y[i];
                d3 += (x[i] - y[i]) * (x[i] - y[i]) * (x[i] - y[i]);
            }
            d2 += (x[i] - y[i]) * (x[i] - y[i]);
            if(x[i] - y[i] < 0){
                if(max < (x[i] -y[i]) * -1){
                    max = (x[i] - y[i]) * -1;
                }
            }else{
                if(max < x[i] - y[i]){
                    max = x[i] - y[i];
                }
            }
        }
        d2 = Math.sqrt(d2);
        d3 = Math.cbrt(d3);
        System.out.println(d1);
        System.out.println(d2);
        System.out.println(d3);
        System.out.println(max);
    }
}

Measured memory_bytes: 28956
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  vector<int> ans(N,0);
  int k;
  for(int i=0;i<N-1;i++){
   	cin>>A.at(i);
    k=A.at(i)-1;
    ans.at(k)+=1;
  }
  for(int i=0;i<N;i++){
  	cout<<ans.at(i)<<endl;
  }
  return 0;
}

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

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int n;
    cin >> n;
    vector<double> p(n + 1);
    for (int i = 1; i <= n; i++) cin >> p[i];
    vector<vector<double>> dp(n + 1, vector<double>(n + 1));
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int h = 0, t = i; h <= i; h++, t--) {
            double p1 = h ? dp[h - 1][t] * p[i] : 0.0;
            double p2 = t ? dp[h][t - 1] * (1 - p[i]) : 0.0;
            dp[h][t] = p1 + p2;
        }
    }
    double ans = 0;
    for (int i = n / 2 + 1; i <= n; i++) {
        ans += dp[i][n - i];
    }
    cout << fixed << setprecision(10) << ans << '\n';
    return 0;
}

Measured memory_bytes: 73716
#include<iostream>
#include<vector>

using namespace std;

int main() {
	int n, ans = 0, x;
	cin >> n;
	vector<int> a(n);
	vector<int> c(n - 1);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		--a[i];
	}
	for (int i = 0; i < n; ++i) {
		cin >> x;
		ans += x;
	}
	for (int i = 0; i < n - 1; ++i) {
		cin >> c[i];
	}

	for (int i = 1; i < n; ++i) {
		if (a[i] == a[i - 1] + 1) {
			ans += c[a[i] - 1];
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

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

func scanInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = scanInt()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	as := scanInts(n - 1)
	m := map[int]int{}

	for _, a := range as {
		m[a]++
	}

	for i := 1; i <= n; i++ {
		fmt.Println(m[i])
	}

}


Measured memory_bytes: 14484
def solve(h):
    dp = [h[0]]
    for i in range(1, len(h)):
        a = h[i][0] + max(dp[i-1][1], dp[i-1][2])
        b = h[i][1] + max(dp[i-1][0], dp[i-1][2])
        c = h[i][2] + max(dp[i-1][0], dp[i-1][1])
        dp.append([a, b, c])
    return max(dp[-1])


if __name__ == "__main__":
    h = [[int(x) for x in input().split()] for y in range(int(input()))]
    print(solve(h))

Measured memory_bytes: 69720
def s_to_dict(s):
    word_dict = {}
    for i in s:
        if i in word_dict:
            word_dict[i] += 1
        else:
            word_dict[i] = 1
    return word_dict
# print(s_to_dict("asdfgesa"))
# {'a': 2, 's': 2, 'd': 1, 'f': 1, 'g': 1, 'e': 1}

#dict1 = {'a': 2, 's': 2, 'd': 1, 'f': 1, 'g': 1, 'e': 1}
#dict2 = {'a': 2, 's': 2, 'd': 1, 'f': 1, 'm': 1, 'e': 1}

def intersection_dict(dict1,dict2):
    new_dict = {}
    key_set = set(dict1.keys()) & set(dict2.keys())
    for key in key_set:
        new_dict[key] = min(dict1[key],dict2[key])
    #print(new_dict)
    return new_dict
#intersection_dict(dict1,dict2)

n = int(input())

first_dict = s_to_dict(input())
current_dict = first_dict
for i in range(n-1):
    current_dict = intersection_dict(current_dict,s_to_dict(input()))
#rint(current_dict)

sorted_keys = sorted(current_dict.keys())
#print(sorted_keys)
ans = ""
for key in sorted_keys:
    ans += (current_dict[key])*key
print(ans)

Measured memory_bytes: 3064
N = int(input())
A = input().split()
A1 = [a for a in A]
A2 = [a for a in A]

# Bubble Sort
flag = True
i = 0
while flag:
    flag = False
    for j in range(1, N - i):
        if int(A1[j][1]) < int(A1[j - 1][1]):
            A1[j - 1], A1[j] = A1[j], A1[j  -1]
            flag = True
    i += 1

print(*A1)
print('Stable')

# Selection Sort
for i in range(N - 1):
    mni = i
    for j in range(i + 1, N):
        if int(A2[j][1]) < int(A2[mni][1]):
            mni = j
    if mni != i:
        A2[i], A2[mni] = A2[mni], A2[i]

print(*A2)
print('Stable' if A1 == A2 else 'Not stable')


Measured memory_bytes: 5616
#include <iostream>
using namespace std;
string s;
int n,ans=1;
int main(void){
    cin>>s;
    for(int i=1;i<s.size();i++){
        if(s[i]!=s[i-1])ans++;
        else if(i==s.size()-1){
            cout<<ans<<endl;
            return 0;
        }
        else if(i==s.size()-2){
            cout<<ans+1<<endl;
            return 0;
        }
        else {
            ans+=2;
            i+=2;
        }
    }
    cout<<ans<<endl;
}


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

bool darray[10] = {false};
bool check(int num){
  while(num){
    if(darray[num % 10]){
      return false;
    }
    num /= 10;
  }
  return true;
}

void repeat(string&s, int a, int num){
  for(int i =0; i<num; i++){
    s += to_string(a);
  }
}

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

  	for(int i = 0; i<N;i++){
      int t;
      cin>>t;
      darray[t] = true;
    }
  
  	int min = 0;
  	for(int i = 0; i<10;i++){
      if(!darray[i]){
        min = i;
        break;
      }
    }
  
  	string s = to_string(money);
  	string ret = "";
  	bool change = false;
  	for(int i =0 ;i<s.length(); i++){
      int val = s[i] -'0';
      while(!check(val)){
        val++;
        change =true;
      }
      
      if(change){
        //not start from the first element
        string ts = "";
        if(i>0){
          	int add = to_string(val).length();
          	repeat(ts, min,s.length()-i-1+add);
			ret += ts;
        }else{
            repeat(ts, min,s.length()-1-i);
          	ret += to_string(val) + ts;
        }
        break;
      }else{
        ret += s[i];
      }
    }
  	cout<<ret<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int X = scanner.nextInt();
        if (A <= X && A + B >= X) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

    private class MyScanner {
        String[] s;int i;BufferedReader br;String reg = " ";
        MyScanner () {
            s = new String[0];i = 0;br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


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

int main(){
    int n, q;
    while(cin >> n >> q, n != 0 && q != 0){
        map<int,int> c;
        for(int i=0; i<n; ++i){
            int m;
            cin >> m;
            for(int j=0; j<m; ++j){
                int tmp;
                cin >> tmp;
                if(c.find(tmp) == c.end())
                    c.insert(map<int,int>::value_type(tmp,1));
                else
                    ++c[tmp];
            }
        }
        map<int,int>::iterator it = c.begin();
        int max = 0, res = 0;
        while(it!=c.end()){
            if(max < (*it).second && q <= (*it).second){
                max = (*it).second;
                res = (*it).first;
            }
            ++it;
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 908
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
#include<ctype.h>
using namespace std;


int main() {
	int n, k;
	long long int h[200000], ans=0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	sort(h, h + n);
	for (int i = 0; i <= n-k-1;i++) {
		ans += h[i];
	}
	cout << ans << endl;
}

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

int main() {
    int N, sum = 0;
    std::cin >> N;
    std::vector<int> s(N);
    for (int I = 0; I < N; I++) {
        std::cin >> s[I];
        sum += s[I];
    }

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

    int index = 0;
    while (!(sum % 10) && index < N) {
        if (s[index] % 10 != 0) {
            sum -= s[index];
        }
        index++;
    }
    if (sum % 10 == 0)
        std::cout << 0;
    else
        std::cout << sum;

    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
import math
from collections import deque 
from functools import reduce

# input = sys.stdin.readline

a, b, n = map(int, input().split())

if b > n:
    x = n
else:
    x = b - 1
num = (a * x) // b - a * (x // b) 
print(num)

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

int main() {
  int N;
  cin >> N;
  
  bool isImmig = true;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    if (A % 2 == 0) {
      if (A % 3 == 0 || A % 5 == 0) continue;
      else {
        isImmig = false;
        break;
      }
    }
    else continue;
  }
  
  isImmig ? cout << "APPROVED" << endl : cout << "DENIED" << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
pS=[input().split() for i in range(M)]
ac=0
wa=0

acd=[0 for i in range(N)]
walst=[0 for i in range(N)]
for p,S in pS:
    p=int(p)
    if not acd[p-1]:
        if S=="WA":
            walst[p-1]+=1
        else:
            ac+=1
            acd[p-1]=1
            wa+=walst[p-1]
print(ac,wa)


Measured memory_bytes: 74072
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;

int main() {
  int n, k;
  cin >> n >> k;
  vector<double> p(n);      // 0~n-1
  vector<double> s(n + 1);  // 0~n i+1... iまでの和
  s[0] = 0;
  rep(i, n) {
    cin >> p[i];
    s[i + 1] = s[i] + (1 + p[i]) / 2;
  }
  double mx = 0;
  for (int i = k; i < n + 1; i++) {
    mx = max(mx, s[i] - s[i - k]);
  }
  cout << fixed << setprecision(10) << mx;
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define N 400001
#define mod 1000000007
#define inf 1000000000
#define pp pair<ll,ll>
typedef long long int ll;
typedef long double ld;
#define MP make_pair

#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++)     
void fastIO(void);

void decimal(int);
ll modmulti(ll, ll, ll);
ll modadd(ll, ll, ll);
ll modpower(ll, ll, ll);
ll gcd(ll, ll );
ll modinv(ll, ll);
int sum(int,int);
bool check(ll a[], ll n){
   rep1(i,n){
      //cout<<a[i]<<" "<<a[i-1]<<endl;
      if(a[i]<a[i-1])
         return 0;
   }
   return 1;
}



int main()
{  
   fastIO();
   ll n;
   cin>>n;
   ll a[n];
   rep(i,n) cin>>a[i];
   if(check(a,n)){
      cout<<"YES\n";
      return 0;
   }
   rep(i,n){
      for(ll j = i+1;j<n;j++){
         swap(a[i],a[j]);
         if(check(a,n)){
            cout<<"YES\n";
            return 0;
         }
         swap(a[i],a[j]);
      }
   }
   cout<<"NO\n";
}























void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}

void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b, ll m){
   return ((a%m)*(b%m))%m;
}
ll modadd(ll a, ll b, ll m){
   return ((a%m)+(b%m))%m;
}
ll modpower(ll a, ll n, ll m){
   if(n==0)
      return 1;
   ll result = 1;
   while(n>0){
      if(n%2==1)
         result = modmulti(result,a,m);
      a = modmulti(a,a,m);
      n = n/2;
   }
   return result;
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a, ll m){
   return modpower(a,m-2,m);
}


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

int main(){
  int N;
  cin >> N;
  int x[N], y[N], h[N], a, b, c;
  for(int i = 0; i < N; i++){
    cin >> x[i] >> y[i] >> h[i];
    if(h[i] != 0){
      a = x[i], b = y[i], c = h[i];
    }
  }
  
  for(int cx = 0; cx <= 100; cx++){
    for(int cy = 0; cy <= 100; cy++){
      bool can = true;
      int H = c + abs(cx-a) + abs(cy-b);
      for(int i = 0; i < N; i++){
        if(h[i] != max(H-abs(cx-x[i])-abs(cy-y[i]), 0)) can = false;
      }
      if(can){
        cout << cx << " " << cy << " " << H << endl;
        return 0;
      }
    }
  }
  return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD (ll)(1e9+7)
ll R1, C1, R2, C2;
ll i,j,k;
ll Fa[2020202];

ll moddiv(ll a,ll b){
    a %= MOD;
    b %= MOD;
    for(ll m=MOD-2;m>0;m/=2){
        if(m&1){
            a=a*b%MOD;
        }
        b=b*b%MOD;
    }
    return a;
}

int main(){
    scanf("%lld%lld%lld%lld", &R1, &C1, &R2, &C2);
    Fa[0] = 1;
    fornum(i,0,2020000){
        Fa[i + 1] = Fa[i] * (i + 1) % MOD;
    }
    ll ans = 0;
    fornum(i,C1-1,C2){
        ans += moddiv(Fa[R2 + i + 2], Fa[i + 2]* Fa[R2]);
        ans += MOD - moddiv(Fa[R1 + i+1], Fa[i + 2]* Fa[R1-1]);
        ans %= MOD;
    }
    printf("%lld", ans);


    return 0;
}

Measured memory_bytes: 16000
#include <string>
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

string str;
int idx;


int getn() {
    char c = str[idx];
    idx++;
    return c-'0';
}

int calc() {
    char c = str[idx];
    if (c == '-') {
        idx++;
        return 2-calc(); 
    }
    if (c == '(') {
        idx++;
        int r1 = calc();
        char cc = str[idx];
        idx++;
        int r2 = calc();
        idx++;
        if (cc == '*') {
            return min(r1, r2);
        } else {
            return max(r1, r2);
        }
    } else {
        return getn();
    }
}

int main() {
    while (true) {
        string s;
        cin >> s;
        if (s == ".") break;
        int res = 0;
        for (int p = 0; p < 3; p++) {
            for (int q = 0; q < 3; q++) {
                for (int r = 0; r < 3; r++) {
                    str = "";
                    for (int i = 0; i < s.size(); i++) {
                        switch (s[i]) {
                        case 'P':
                            str += to_string(p);
                            break;
                        case 'Q':
                            str += to_string(q);
                            break;
                        case 'R':
                            str += to_string(r);
                            break;
                        default:
                            str += s[i];
                            break;
                        }
                    }
                    str += '=';
                    idx = 0;
                    //cerr << str << endl;
                    if (calc() == 2) {
                        //cerr << "asdkfjf" << endl;
                        res++;
                    }
                }
            }
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T> inline vector<T> readVector(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> void EXIT(T answer) { cout<<answer<<endl; exit(0); }
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef signed long long int ll;

const int MOD=1e9+7;
int N;
ll K;
int adj[55][55];
map<ll,vi> dp;

int fun(ll k, int f, int t) {
    if(k==1)
        return adj[f][t];
    if(!dp.count(k))
        dp[k] = vi(N*N, -1);
    if(dp[k][f*N+t]>=0)
        return dp[k][f*N+t];

    ll ways=0;
    FOR(i,N) {
        ways += 1LL * fun(k/2, f, i) * fun(k-k/2, i, t);
        ways %= MOD;
    }

    return dp[k][f*N+t]=ways;
}

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

    cin>>N>>K;
    FOR(i,N)
    FOR(j,N)
    cin>>adj[i][j];

    ll sum=0;
    FOR(i,N)
    FOR(j,N)
        sum = (sum + fun(K, i, j)) % MOD;
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 1408
N, K = map(int, input().split())
ans = 0
for n in range(1, N+1):
    if n >= K:
        ans += 1 / N
    else:
        L = 1
        V = n * 2
        while V < K:
            V *= 2
            L += 1
        ans += 0.5 ** L / N
print(ans)


Measured memory_bytes: 2940
//Hariom_Pandey

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x,t;
    cin>>n>>x>>t;
    int ans=0;
    for(int i=1; i<=n; i+=x){
        ans+=t;
        
    }
    cout<<ans;
    
  
}


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

using namespace std;

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define ALL(a)              a.begin(), a.end()
#define ALLN(a, n)          (a, a+n)
#define MAX                 10000007
#define MIN                 -10000007
void add_edge(int u, int v, vector<int> graph[]) 
{ 
    graph[u].push_back(v); 
    graph[v].push_back(u); 
} 
  
// Function to traverse the undirected graph 
// using DFS algorithm and keep a track of 
// individual lengths of connected chains 
void depthFirst(int v, vector<int> graph[], 
                vector<bool>& visited, int& ans) 
{ 
    // Marking the visited vertex as true 
    visited[v] = true; 
    //cout << v << " "; 
  
    // Incrementing the count of 
    // connected chain length 
    ans++; 
  
    for (auto i : graph[v]) { 
        if (visited[i] == false) { 
            // Recursive call to the DFS algorithm 
            depthFirst(i, graph, visited, ans); 
        } 
    } 
} 
  
// Function to initialize the graph 
// and display the result 
void UniqueConnectedComponent(int n, 
                              vector<int> graph[]) 
{ 
  
    // Initializing boolean visited array 
    // to mark visited vertices 
    vector<bool> visited(n + 1, false); 
  
    // Initializing a Set container 
    //unordered_set<int> result; 
  int maxx=0;
    // Following loop invokes DFS algorithm 
    for (int i = 1; i <= n; i++) { 
        if (visited[i] == false) { 
            // ans variable stores the 
            // individual counts 
            int ans = 0; 
  
            // DFS algorithm 
            depthFirst(i, graph, visited, ans); 
  
            // Inserting the counts of connected 
            // components in set 
            //result.insert(ans); 
            maxx=max(maxx,ans);
            //cout << "Count = " << ans << "\n"; 
        } 
    } 
  
    //cout << "Unique Counts of "
      //   << "connected components: "; 
  
    // The size of the Set container 
    // gives the desired result 
    cout << maxx << "\n"; 
} 
  

              
int main()
{
  ios::sync_with_stdio(0);
    cin.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
      
    int t;
    t=1;
     //  cin>>t;
    while(t--){
            int nodes; 
            cin>>nodes;
            vector<int> graph[nodes+1]; 
            int m;
            cin>>m;
            REP(i,1,m){
              ll x,y;
              cin>>x>>y;
              add_edge(x,y,graph);
            }
            UniqueConnectedComponent(nodes,graph);
       


             }
             cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}


Measured memory_bytes: 27200
// Hint: Don't look, No need, Let'em Play.

#include <bits/stdc++.h>
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#ifndef bhupixb
    #define var(...)
    #define stl(...)
#endif

using hr_clock = chrono::high_resolution_clock;

struct Timer_ {
    private: chrono::time_point<hr_clock> start_;
    public: Timer_(); ~Timer_();
}_;

#define single_test

template<class T>
int go(T &a, T &b, int k) {
    int ans = 0;
    for (int i = 0; i < (int)a.size(); ++i) {
        int x = a[i];
        if (x > k) return ans;
        int rem = k - a[i];
        auto it = lower_bound(b.begin(), b.end(), rem + 1) - b.begin();
        ans = max(ans, i + 1 + it);
    }
    return ans;
}

void solve() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a(n), b(m);
    for (int &x: a) cin >> x;
    for (int &x: b) cin >> x;
    int ans = 0;
    partial_sum(a.begin(), a.end(), a.begin());
    partial_sum(b.begin(), b.end(), b.begin());
    ans = max(go(a, b, k), go(b, a, k));
    cout << ans << '\n';

}

signed main() {
    fast;
    int t = 1;
    #ifndef single_test
        cin >> t;
    #endif
    while (t--) {
        // Timer_ _;
        solve();
    }

    return 0;
}

Timer_::Timer_() {
    start_ = hr_clock::now();
}

Timer_::~Timer_() {
    #ifdef bhupixb
    cerr << "took: " << chrono::duration_cast<chrono::microseconds>(hr_clock::now() - start_).count() / 1000 << " ms\n";
    #endif
}


Measured memory_bytes: 6404