akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
    int n,x,y,b,p,i,j,a[365];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %d %d %d",&x,&y,&b,&p);
        if(b>=5&&p<=2){
            if(x*b+y*p>(x*b+y*2)*0.8){
                a[i]=(x*b+y*2)*0.8;
            }
            else {
                a[i]=x*b+y*p;
            }
        }
        if(b<=5&&p>=2){
            if(x*b+y*p>(x*5+y*p)*0.8){
                a[i]=(x*5+y*p)*0.8;
            }
            else {
                a[i]=x*b+y*p;
            }
        }
        if(b<=5&&p<=2){
            if(x*b+y*p>(x*5+y*2)*0.8){
                a[i]=(x*5+y*2)*0.8;
            }
            else {
                a[i]=x*b+y*p;
            }
        }
        if(b>=5&&p>=2){
            a[i]=(x*b+y*p)*0.8; 
        }
    }
    for(j=0;j<n;j++){
        printf("%d\n",a[j]);
    }
    return 0;
}

Measured memory_bytes: 1032
package main

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

func main() {

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	in1 := strings.Split(sc.Text(), " ")
	truckNum, _ := strconv.Atoi(in1[1])

	var loads []int
	var total int

	// TODO binary search
	for {
		sc.Scan()
		in := sc.Text()
		if len(in) == 0 {
			break
		}
		load, _ := strconv.Atoi(in)
		loads = append(loads, load)
		total += load
	}

	p := findP(loads, truckNum, total)
	fmt.Println(p)
}

func findP(loads []int, truckNum int, total int) int {

	left := 0
	right := total
	for {
		mid := (left + right) / 2
		last := (right - left) <= 1
		if canLoad(loads, truckNum, mid) {
			if last {
				return mid
			}
			right = mid
		} else {
			if last {
				return mid + 1
			}

			left = mid
		}
	}

	return 0
}

func canLoad(loads []int, truckNum int, maxLoad int) bool {

	total := 0
	loadIndex := 0

	all := true
	for i := 0; i < truckNum; i++ {
		all = true
		for j := loadIndex; j < len(loads); j++ {
			total += loads[j]
			loadIndex = j
			if total > maxLoad {
				total = 0
				all = false
				break
			}
		}
		total = 0
	}

	return all

}



Measured memory_bytes: 6084
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,X; cin >> N >> X;
    VL L(N); REP(i,N) cin >> L[i];

    LL ans = 1;
    LL high = 0;
    REP(i,N){
        high += L[i];
        if(high <= X) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    LR = []
    for _ in range(M):
        l, r = map(int, input().split())
        LR.append([l, r])

    left, right = LR[0]
    for i in range(1, M):
        l, r = LR[i]
        if left > r or right < l:
            return 0
        elif left <= r:
            left = max(left, l)
            right = min(right, r)
    return right - left + 1

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 19528
s = input()
if (int(s[:2]) > 12 or int(s[:2]) == 0) and 0 < int(s[2:]) <= 12:
    print("YYMM")
if 0 < int(s[:2]) <= 12 and (int(s[2:]) > 12 or int(s[2:]) == 0):
    print("MMYY")
if 0 < int(s[:2]) <= 12 and 0 < int(s[2:]) <= 12:
    print("AMBIGUOUS")
if (int(s[:2]) > 12 or int(s[:2]) == 0) and (int(s[2:]) > 12 or int(s[2:]) == 0):
    print("NA")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
const double PI = acos(-1);

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

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

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

struct UnionFind {
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }

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

//素因数分解
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}
//const auto &pf = prime_factorize(i);
//for (auto p : pf) cout << p.first << " " << p.second;

long long pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % MOD;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

int main()
{
    int a; cin >> a;
    cout <<a * a << endl;
    return 0;
}


Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int n;
long a[200200];
long ans;
main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	if(a[0])cout<<-1<<endl;
	else
	{
		for(int i=0;i<n;i++)
		{
			if(a[i]+1!=a[i+1])ans+=a[i];
			if(a[i]+1<a[i+1])
			{
				cout<<-1<<endl;
				return 0;
			}
		}
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1061109567;
const ll LINF = 4557430888798830399ll;

/*---*/

bool vis[15];

void TestCase() {
    int n, k;
    scanf("%d%d", &n, &k);
    for(int i = 1, x; i <= k; ++i) {
        scanf("%d", &x);
        vis[x] = 1;
    }
    for(int i = n; i <= 99999; ++i) {
        int x = i;
        int suc = 1;
        while(x > 0 && suc == 1) {
            int di = x % 10;
            if(vis[di]) {
                suc = 0;
                break;
            }
            x /= 10;
        }
        if(suc) {
            printf("%d\n", i);
            return;
        }
    }
    exit(-1);
}

int main() {
#ifdef KisekiPurin
    freopen("KisekiPurin.in", "r", stdin);
    //freopen("KisekiPurin.out", "w", stdout);
#endif // KisekiPurin
    //InitCase();
    int t = 1;
    //scanf("%d", &t);
    for(int i = 1; i <= t; ++i) {
        //printf("Case #%d:", i);
        TestCase();
    }
    return 0;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = ns()
b = ns()
c = ns()

ans = 0
for ai, bi, ci in zip(a,b,c):
    if ai == bi == ci:
        continue
    
    elif ai == bi or bi == ci or ci == ai:
        ans += 1
    
    else:
        ans += 2
        
print(ans)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
for i in range(N):
    b = B[i]
    if B[i] <= A[i]:
        cnt += B[i]
    elif B[i] <= A[i] + A[i + 1]:
        cnt += B[i]
        A[i + 1] -= B[i] - A[i]
    else:
        cnt += A[i] + A[i + 1]
        A[i+1] = 0
print(cnt)


Measured memory_bytes: 97648
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 1100000000000000000LL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	int R,G;
	cin>>R>>G;
	cout<<R+(G-R)*2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

typedef long long ll;

ll a[222222], dif[222222], s, t;

ll temperature(ll v){ return -(v > 0 ? v * s : v * t); }

int main(void)
{
	ll n, q, i, ans = 0;

	scanf("%lld %lld %lld %lld" ,&n, &q, &s, &t);
	for (i = 0; i <= n; i++)
	{
		scanf("%lld" ,&a[i]);

		if (i > 0)
			dif[i] = a[i] - a[i - 1];

		ans += temperature(dif[i]);
	}
	while (q--)
	{
		ll L, R, X;

		scanf("%lld %lld %lld" ,&L, &R, &X);

		if (R < n)
		{
			ans += temperature(dif[R + 1] - X) - temperature(dif[R + 1]);
			dif[R + 1] -= X;
		}

		ans += temperature(dif[L] + X) - temperature(dif[L]);
		dif[L] += X;

		printf("%lld\n" ,ans);
	}
	return 0;
}


Measured memory_bytes: 5876
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int[] x = new int[N];
		int[] y = new int[M];
		for(int i = 0; i < N; i++) {
			x[i] = sc.nextInt();
		}
		int n = x[0];

		for(int i = 0; i < M; i++) {
			y[i] = sc.nextInt();
		}
		int m = y[0];

		for(int i = 1; i < N; i++) {
			n = Math.max(n, x[i]);
		}

		for(int i = 1; i < M; i++) {
			m = Math.min(m, y[i]);
		}
		if(n < m && X < m && m <= Y) {
			System.out.println("No War");
		}else {
			System.out.println("War");
		}
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    int a,b; cin>>a>>b;
    cout<<2*b-a<<endl;
}

Measured memory_bytes: 256
class BIT:
    def __init__(self,N):
        self.N=N
        self.bit=[0]*(N+1)
        self.b=1<<N.bit_length()-1
    def add(self,a,w):
        x=a
        while(x<=self.N):
            self.bit[x]+=w
            x+=x&-x
    def get(self,a):
        ret,x=0,a-1
        while(x>0):
            ret+=self.bit[x]
            x-=x&-x
        return ret
    def cum(self,l,r):
        return self.get(r)-self.get(l) 
    def lowerbound(self,w):
        if w<=0:
            return 0
        x=0
        k=self.b
        while k>0:
            if x+k<=self.N and self.bit[x+k]<w:
                w-=self.bit[x+k]
                x+=k
            k//=2
        return x+1

N=int(input())
A=list(map(int,input().split()))
dic={}
for i in range(N):
    dic[A[i]]=i+1
bit=BIT(N)
ans=0
for i in range(1,N+1):
    d=dic[i]
    bit.add(d,1)
    c=bit.get(d+1)
    L=bit.lowerbound(c-1)
    R=bit.lowerbound(c+1)
    ans+=(R-d)*(d-L)*i
print(ans)

Measured memory_bytes: 127840
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

#define DEBUG
#ifdef DEBUG
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
#else
template <class T, class... Args>
void debug(const T &x, const Args &... args) {}
template <class T> void debugVector(const vector<T> &v) {}
#endif

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<vector<ll>> a(N, vector<ll>(N));
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            cin >> a[i][j];
        }
    }
    vector dp(1 << N, -LLINF);
    for(int S = 0; S < (1 << N); S++) {
        dp[S] = 0;
        for(int i = 0; i < N; i++) {
            for(int j = i + 1; j < N; j++) {
                if((S & (1 << i)) && (S & (1 << j))) {
                    dp[S] += a[i][j];
                }
            }
        }
        for(int T = (S - 1) & S; T > 0; T = ((T - 1) & S)) {
            chmax(dp[S], dp[T] + dp[S ^ T]);
        }
    }
    cout << dp[(1 << N) - 1] << endl;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
//	Table is the complete reverse of dp
//	Always think of the pattern (LCM, GCD)
//	Be careful of unsigned
//	double epsilon = FLT_EPSILON;
//	Think of a solution that gets TLE and optimize it
int MOD;
long long fast_power(long long base, long long power) {
    long long result = 1;
    while (power > 0) {
        if (power & 1) {
            result = ((result % MOD) * (base % MOD)) % MOD;
        }
        base = ((base % MOD) * (base % MOD)) % MOD;
        power >>= 1;
    }
    return result;
}
int main()
{
    cin.tie(nullptr); cout.tie(nullptr); ios_base::sync_with_stdio(false);
    int n;
	string s;
    cin >> n >> s;
    const int N = 2e5 + 1;
    int ans[N];
    ans[0] = 0;
    for(int i = 1; i < N; i++)
    {
    	int cnt = 0;
    	for(int j = 0; j < 18; j++)
    		if(i & (1 << j))
    			cnt++;
    	ans[i] = 1 + ans[i % cnt];
    }
    int cnt = 0;
    for(char &i: s)
    	if(i == '1')
    		cnt++;
    int mod[2], tmp = 0;
    cnt++;
    for(int i = 0; i < n; i++)
    {
    	tmp <<= 1;
    	tmp += s[i] - '0';
    	if(tmp >= cnt)
    		tmp -= cnt;
    }
    mod[0] = tmp;
    cnt -= 2;
    if(cnt <= 0)
    	mod[1] = 0;
    else
    {
    	tmp = 0;
		for(int i = 0; i < n; i++)
		{
			tmp <<= 1;
			tmp += s[i] - '0';
			if(tmp >= cnt)
				tmp -= cnt;
		}
		mod[1] = tmp;
    }
	cnt++;
    for(int i = 0; i < n; i++)
    {
    	if(s[i] == '1')
    		MOD = cnt - 1;
    	else
    		MOD = cnt + 1;
    	if(!MOD)
    	{
    		cout << 0 << endl;
    		continue;
    	}
    	tmp = fast_power(2, n - i - 1);
    	if(s[i] == '1')
    		cout << 1 + ans[((mod[1] - tmp) % MOD + MOD) % MOD];
    	else
    		cout << 1 + ans[(mod[0] + tmp) % MOD];
    	cout << endl;
    }
}


Measured memory_bytes: 4524
N = int(input())
a = [int(i) for i in input().split()]

num2 = 0
num4 = 0

for i in a:
    if i % 2 == 0:
        if i%4 == 0:
            num4 += 1
        else:
            num2 += 1

judge = num4 * 2 + 1 * int(num2 < 2) + num2 * int(num2 > 1)

if judge >= N:
    print('Yes')
else:
    print('No')
    

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

int main()
{
	string S, T;
	cin >> S >> T;
	vector<int> P(26, -1);
	vector<int> Q(26, -1);
	bool ans = true;
	for (int i = 0; i < S.size(); i++)
	{
		int a = S[i] - 'a';
		int b = T[i] - 'a';

		if (P[a] >= 0 && P[a] != b)	ans = false;
		if (Q[b] >= 0 && Q[b] != a) ans = false;
		if (P[a] < 0) P[a] = b;
		if (Q[b] < 0) Q[b] = a;
	}
	if (ans)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

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

#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define endl '\n'
// #define int long long

typedef pair<int,int> pii;
const int N = 10+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n, m;
vector<int> s[N];
int p[N];
int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n >> m;
	for(int i=0; i<m; i++){
		int sz; cin >> sz;
		while(sz--) {
			int x; cin >> x;
			x--;
			s[i].push_back(x);
		}
	}
	for(int i=0; i<m; i++){
		cin >> p[i];
	}
	int ans = 0;
	for(int i=0; i<(1<<n); i++){
		bool ok = true;
		for(int j=0; j<m; j++){
			int cnt = 0;
			for(auto x:s[j]){
				if ((i>>x)&1) cnt++;
			}
			if (cnt%2 != p[j]) ok = false;
		}
		if (ok) ans++;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;

int main(){
    int w, h, n;
    int xx = 0, yy = 0;
    cin >> w >> h >> n;
    int x, y, a;

    REP(i, n){
        cin >> x >> y >> a;
        if(a == 1){
            xx = max(x, xx);
        }else if(a == 2){
            w = min(x, w);
        }else if(a == 3){
            yy = max(y, yy);
        }else{
            h = min(y, h);
        }
    }

    if((w - xx) > 0 && (h >= yy) > 0) cout << (w - xx) * (h - yy) << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;
constexpr double eps = 1e-11;
using C = complex<double>;

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    C V[4];
    for(int j=0;j<4;j++){
      double x, y;
      cin >> x >> y;
      V[j] = C(x, y);
    }
    C AB = V[1] - V[0];
    C CD = V[3] - V[2];
    double area = (conj(AB) * CD).imag();
    if(abs(area) < eps)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}


Measured memory_bytes: 3148
#include "bits/stdc++.h"
using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

//#define int long long
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

struct P
{
	int x, y, t;
	P(int x, int y, int t) :x(x), y(y), t(t){}
	P() :P(-1, -1,-1) {}
};

string A[1000];
int cnt[1000][1000];
int H, W, N;

int solve(P sp)
{
	static const int dx[] = { 1,0,-1,0 };
	static const int dy[] = { 0,1,0,-1 };

	int ans = 0;
	rep(k, 1, N + 1)
	{
		queue<P> q;
		q.push(sp);
		cnt[sp.y][sp.x] = k;
		while (true)
		{
			P tp = q.front(); q.pop();
			if ((int)A[tp.y][tp.x] == ((int)'0' + k))
			{
				sp = P(tp.x, tp.y, 0);
				ans += tp.t;
				break;
			}

			rep(i, 0, 4)
			{
				P np(tp.x + dx[i], tp.y + dy[i], tp.t + 1);
				if (0 <= np.x&&np.x < W && 0 <= np.y&&np.y < H)
				{
					if (A[np.y][np.x] != 'X'&&cnt[np.y][np.x] < k)
					{
						cnt[np.y][np.x] = k;
						q.push(np);
					}
				}
			}
		}
	}

	return ans;
}

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

	P sp;
	cin >> H >> W >> N;
	rep(i, 0, H)
	{
		cin >> A[i];
		if (sp.x == -1)
		{
			rep(j, 0, SZ(A[i]))
			{
				if (A[i][j] == 'S')
				{
					sp = P(j, i, 0);
					break;
				}
			}
		}
	}
	cout << solve(sp) << endl;

	return 0;
}


Measured memory_bytes: 7968
q = int(input())
for _ in range(q):
    a, b = map(int, input().split())
    if a == b:
        print(2 * (a - 1))
        continue
    if a > b:
        a, b = b, a
    ans = a - 1

    l, r = -1, b - 1
    while r - l > 1:
        k = (l + r) // 2
        x = min(k, (a + 1 + k) // 2)
        y = (a + 1 + k) - x
        if x * y < a * b:
            l = k
        else:
            r = k
    ans += l
    print(ans)


Measured memory_bytes: 3064
n, m = gets.strip.split.map(&:to_i)
a = gets.strip.split.map {|e| e.to_i%m }

m_a = [a.first]
(1...n).each do |i|
  m_a[i] = (m_a[i-1]+a[i])%m
end

numbers = m_a.group_by(&:itself)

result=0
numbers.each do |_, arr|
  c = arr.length
  next if c<2

  result += c*(c-1)/2
#p result
end
result += m_a.count(&:zero?)


#p"--"
#p a
#p m_a
p result


Measured memory_bytes: 16204
n,*a=`dd`.split.map &:to_i
s,idx=[0,1].map{|x|
	idx=[]
	s=0
	x.step(n-1,2){|i|
		if a[i]>0
			idx<<i
			s+=a[i]
		end
	}
	[s,idx]
}.max

if s<1
	i=(0...n).max_by{|i|a[i]}
	p a[i]
	r=n.downto(i+2).to_a+[1]*i
else
	p s
	r=n.downto(idx[-1]+2).to_a
	idx.reverse.each_cons(2){|j,i|
		r+=((i+j)/2+1).downto(i+2).to_a
	}
	r+=[1]*idx[0]
end
p r.size,*r

Measured memory_bytes: 4484
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        if(n % 2 == 0){
            System.out.println(n/2 - 1);
        }else{
            System.out.println(n/2);
        }
    }



    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte())
                return buffer[ptr++];
            else
                return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr]))
                ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext())
                throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext())
                throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
                throw new NumberFormatException();
            return (int) nl;
        }

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

}



Measured memory_bytes: 21204
#include <iostream>
#include <string>

using namespace std;

int main(){
    int K;
    string S;
    cin >> K;
    cin >> S;

    if(S.length() <= K){
        cout << S << endl;
    }else{
        cout << S.substr(0, K) << "..." << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Pair = pair<int, int>;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define INF 1000000007
#define SEP " "

int     main()
{
	ll n;
	cin >> n;
	map<ll, ll> m;
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		sum += a;
		m[a]++;
	}
	ll q;
	cin >> q;
	vector<ll> b(q), c(q);
	for (int i = 0; i < q; i++) {
		cin >> b[i] >> c[i];
	}
	vector<ll> ans(q);
	for (int i = 0; i < q; i++) {
		sum += (c[i] - b[i] ) * m[b[i]];
		m[c[i]] += m[b[i]];
		m[b[i]] = 0;
		ans[i] = sum;
	}
	for (int i = 0; i < q; i++) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 11260
[N,Y] = list(map(int,input().split()))
x = [0,0,0]
x[0] = Y//10000
x[1] = (Y - (10000*x[0]))//5000
x[2] = (Y - (10000*x[0]) - (5000*x[1]))//1000
ans = [-1,-1,-1]
for i in range(x[0]+1):
    for j in range(x[1]+(2*i)+1):
        N_temp = (x[0]-i) + (x[1]+2*i-j) + (x[2]+5*j)
        if N_temp == N:
            ans = [(x[0]-i) , ((x[1]+2*i-j)) , (x[2]+5*j)]
            print('{0[0]} {0[1]} {0[2]}'.format(ans))
            exit()
        elif N_temp > N:
            break
print('{0[0]} {0[1]} {0[2]}'.format(ans))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define co cout
#define ci cin
#define sf1(n) scanf("%lld",&n);
#define sf2(n,m) scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define en cout<<endl;
#define pb push_back
#define coy cout<< "YES"<<endl;
#define con cout<< "NO"<<endl;
#define For(a,b) for(ll a=0;a<b;a++)
#define br break;
#define i64 long long
i64 M=10000000;
//ll b[805],ans[805];
map< ll,pair<ll,ll> >mp;

int main()
{
    ll t,n,g,k,m,mx=0,mn=1e9,res,c1,x,y,c2;
    string ab;
    ci>>ab;
    if(ab=="Sunny") co<< "Cloudy";
    else if(ab=="Cloudy") co<< "Rainy";
    else if(ab=="Rainy") co<<"Sunny";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mn(a,b) (a < b ? a : b)
#define mx(a,b) (a > b ? a : b)
#define f first
#define s second
#define mp make_pair
#define all(v) (v).begin(),(v).end()

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long x, t;
    cin>>x>>t;
    cout<<mx(0, x - t);
    return 0;
}


Measured memory_bytes: 256
/*  In the name of ALLAH */

#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define ll long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);
 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif



int main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
  

    int n;
    string s;
    cin>>n>>s;
    ll r,g,b;
    // r=g=b=0;
    r = count(all(s), 'R');
    g = count(all(s), 'G');
    b = count(all(s), 'B');
    ll ans = r*g*b;
    for(int i = 0 ; i < n;i++){
        for(int j = 1;j<n;j++){
            int left  = i -j;
            int right = i+j;
            if(left >=0 && left < n && right>= 0 && right < n && s[left]!=s[i] && s[i]!=s[right]  && s[right]!=s[left]) ans--;
        }
    }

    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
using namespace std;
int dist[7][7] = { {0,0,0,0,0,0,0},{6,0,0,0,0,0,0},{13,7,0,0,0,0,0},{18,12,5,0,0,0,0},{23,17,10,5,0,0,0},{43,37,30,25,20,0,0},{58,52,45,40,35,15,0} };
int money[7][7] = { {0,300,500,600,700,1350,1650},{0,0,350,450,600,1150,1500},{0,0,0,250,400,1000,1350},{0,0,0,0,250,850,1300},{0,0,0,0,0,600,1150},{0,0,0,0,0,0,500},{0,0,0,0,0,0,0} };
int a, b, c, d, e, f;
int main() {
	while (true) {
		cin >> a; if (a == 0) { break; }cin >> b >> c >> d >> e >> f; b = b * 60 + c; e = e * 60 + f; a--; d--;
		for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) { if (dist[i][j] == 0) { dist[i][j] = dist[j][i]; }if (money[i][j] == 0) { money[i][j] = money[j][i]; } } }
		if (((b >= 1050 && b <= 1170) || (e >= 1050 && e <= 1170)) && dist[a][d] <= 40) { if (money[a][d] % 100 == 0) { cout << money[a][d] / 2 << endl; } else { cout << money[a][d] / 2 + 25 << endl; } }
		else { cout << money[a][d] << endl; }
	}
}

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

int main()
{
	int N,T;
	cin >> N >> T;
	int cost = INT_MAX, time = INT_MAX;
	int stk_c, stk_t;
	for (int i = 0; i < N; i++) {
		cin >> stk_c >> stk_t;
		if (stk_t <= T) {
			if (stk_c < cost) {
				cost = stk_c;
				time = stk_t;
			}
		}
	}
	if (cost == INT_MAX) {
		cout << "TLE" << endl;
	}
	else {
		cout << cost << endl;
	}
}


Measured memory_bytes: 256
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    ll n=s.size();
    ll m=(n+1)/2;
    ll sum=0;
    rep(i,n){
        if(i<m){
            if(s[i]=='p'){
                sum--;
            }
        }else{
            if(s[i]=='g'){
                sum++;
            }
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 512
S=[int(c) for c in input()]
N=len(S)
r=all([S[i]==S[N-i-2] for i in range(N//2)]) and S[0] and not S[-1]
t=[(1,2)]
e=2
for i in range(1,(N-1)//2):
    t.append((e,i+2))
    if S[i]:
        e=i+2
f=1
if N%2==0:
    t.append((e,N-e+1))
    if S[N//2-1]:
        f=0
for i in range(0,(N-1)//2):
    t.append([e if t[i][j]==e and f else (N-e+1 if t[i][j]==N-t[i][j]+1 and f else N-t[i][j]+1) for j in range(2)])
if r:
    print(*[str(l[0])+" "+str(l[1]) for l in t],sep='\n')
else:
    print(-1)

Measured memory_bytes: 28904
from itertools import combinations
N = int(input())
X = ["M","A","R","C","H"]
Y = [0 for _ in range(5)]
for _ in range(N):
  S = input()
  for i, x in enumerate(X):
    if x == S[0]:
      Y[i] += 1
      break
    
ans = 0
for y in combinations(Y, 3):
  ans += y[0] * y[1] * y[2]
print(ans)

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

int main() {
  int a,b;
  cin>>a>>b;
  string s;
  cin>>s;
  bool ans=true;
  for(int i=0;i<s.size();i++){
    if(i==a && s[i]!='-') ans=false;
    if(i!=a && !isdigit(s[i])) ans=false;
  }
if(ans) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#define INF (1e9)
#define H 50
#define A 26
using namespace std;
int n,h,w,x1[A],x2[A],y1[A],y2[A];
string s[H];
bool used[H][H],e[A],ans;
vector<int> v;

void solve(){
  do{
    bool f=true;
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++) used[i][j]=false;
    for(int i=0;i<v.size();i++){
      int l=v[i];
      for(int j=y1[l];j<=y2[l];j++)
	for(int k=x1[l];k<=x2[l];k++){
	  if(!used[j][k]&&s[j][k]-'A'!=l) f=false;
	  used[j][k]=true;
	}
    }
    if(f) ans=true;
  }while(next_permutation(v.begin(),v.end()));
}

int main(){
  cin>>n;
  while(n--){
    cin>>h>>w;
    for(int i=0;i<A;i++) x1[i]=INF,x2[i]=-1,y1[i]=INF,y2[i]=-1,e[i]=false;
    for(int i=0;i<h;i++) cin>>s[i];
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
	char c=s[i][j];
	if(c!='.'){
	  int idx=c-'A';
	  e[idx]=true;
	  x1[idx]=min(x1[idx],j);
	  x2[idx]=max(x2[idx],j);
	  y1[idx]=min(y1[idx],i);
	  y2[idx]=max(y2[idx],i);
	}
      }
    for(int i=0;i<A;i++)
      if(e[i]) v.push_back(i);
    ans=false;
    solve();
    if(ans) cout<<"SAFE"<<endl;
    else cout<<"SUSPICIOUS"<<endl;
    v.clear();
  }
  return 0;
}

Measured memory_bytes: 1228
import java.util.Scanner;

/**
 * ABC044B
 */
public class Main {

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

        String word = sc.nextLine();
        sc.close();

        int[] moji = new int['z' - 'a' + 1];

        for (int i = 0; i < word.length(); i++) {
            char c = word.charAt(i);

            moji[c - 'a']++;
        }

        boolean flag = true;
        for (int i = 0; i < moji.length; i++) {
            if (moji[i] % 2 != 0) {
                flag = false;
                break;
            }
        }

        if (flag) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define LL long long
#define N 200007
using namespace std;
namespace IO
{
    char ibuf[(1<<21)+1],*iS,*iT;
    char Get() { return (iS==iT? (iT=(iS=ibuf)+fread(ibuf,1,(1<<21)+1,stdin),(iS==iT? EOF:*iS++)):*iS++); }
    int read(){int x=0;char ch=Get();while(ch>57||ch<48)ch=Get();while(ch>=48&&ch<=57)x=x*10+(ch^48),ch=Get();return x;}
}
using namespace IO;
int max(int a,int b){return a>b? a:b;}
int head[N],ver[N<<1],edge[N<<1],Next[N<<1],tot=1,Size,mx,root,size[N],vis[N],fa[N],W[N],p,cnt;
LL Maxv;
void add(int u,int v,int w){ver[++tot]=v,Next[tot]=head[u],head[u]=tot,edge[tot]=w;}
int Find(int x){return x==fa[x]? x:fa[x]=Find(fa[x]);}
struct Edge{int u,v;LL w;}e[N*50];
int operator<(Edge a,Edge b){return a.w<b.w;}
void dfs(int u,int Fa)
{
    size[u]=1;int Max=0;
    for(int i=head[u],v;i;i=Next[i]) if(!vis[v=ver[i]]&&v^Fa) dfs(v,u),size[u]+=size[v],Max=max(Max,size[v]);
    Max=max(Max,Size-size[u]);if(Max<mx) mx=Max,root=u;
}
void Dfs(int u,int Fa,LL dep)
{
    if(dep+W[u]<Maxv) Maxv=dep+W[u],p=u;
    for(int i=head[u],v;i;i=Next[i]) if(!vis[v=ver[i]]&&v^Fa) Dfs(v,u,dep+edge[i]);
}
void link(int u,int Fa,LL dep)
{
    e[++cnt]=Edge{u,p,Maxv+dep+W[u]};
    for(int i=head[u],v;i;i=Next[i]) if(!vis[v=ver[i]]&&v^Fa) link(v,u,dep+edge[i]);
}
void solve(int u)
{
    vis[u]=1,Maxv=1e18,p=0,Dfs(u,0,0),link(u,0,0);
    for(int i=head[u],v;i;i=Next[i]) if(!vis[v=ver[i]]) mx=Size=size[v],dfs(v,u),solve(root);
}
int main()
{
    int n=read(),i,u,v,w;
    LL ans=0;
    for(i=1;i<=n;++i) W[i]=read(),fa[i]=i;
    for(i=1;i<n;++i) u=read(),v=read(),w=read(),add(u,v,w),add(v,u,w);
    Size=mx=n,dfs(1,0),solve(root),sort(e+1,e+cnt+1);
    for(i=1;i<=cnt;++i) if((u=Find(e[i].u))^(v=Find(e[i].v))) ans+=e[i].w,fa[u]=v;
    return !printf("%lld",ans);
}


Measured memory_bytes: 77312
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#define int long long
#define ll getchar();getchar();return 0;
using namespace std;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n%i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x,int y) {
	int ans;
	for (int i = (min(x, y)); i >= 1; i--) {
		if (x%i == 0 && y%i == 0) {
			ans = i;
			break;
		}
	}
		return ans;
}
int yakusuunowa(int n) {
	int ans=0;
	for (int i = 1; i <= n; i++) {
		if (n%i == 0)ans += i;
	}
	return ans;
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int ketanowa(int n) {
	int cnt = 0, sum = 0;
	for (int i = 10; i <= n * 10; i *= 10) {
		if (i == 10)cnt += n % i;
		else sum += (n%i - n % (i / 10)) / (i / 10);
	}
	return cnt + sum;
}
signed main() {
	int x, y,ans=1,trueans=0;
	cin >> x >> y;
	int sanada = y / x;
	while (ans <= sanada) {
		ans *= 2;
		trueans++;
	}
	cout << trueans << endl;
	ll
}

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

#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000000

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

    int x, y;

    cin >> x >> y;

    int num = (1 << 3) - 1;

    int ans = (num - (1 << (x-1)) - (1 << (y-1)));

    cout << (log2(ans) + 1) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);

    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");
    int n = Integer.parseInt(sl[0]);

    System.out.print("Christmas");
    for(int i = 24; i >= n; i--)
    {
     System.out.print(" Eve");
    }

  }

}

Measured memory_bytes: 21716
#include "bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

int main() {
	long long A; cin >> A;
	float B; cin >> B;
	long long C = B * 100 + 0.0001;
	cout << (long long)(A * C)/100;
}

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

int main(){
    int N; cin >> N;
    long long count = 0;
    vector<vector<long>> ab(9, vector<long>(9,0));
    for(int i=1; i<=N; i++){
        string sn = to_string(i);
        int a = (int) sn[0] - '0';
        int b = (int) sn[sn.size()-1] - '0';
        //cout << a << " " << b << endl;
        if(!a || !b) continue;
        ab[a-1][b-1]++;
    }
    for(int i=0; i<9; i++){
        for(int j=0; j<9; j++){
            count += ab[i][j]*ab[j][i];
            //cout << ab[i][j]*ab[j][i];
        }
        //cout << endl;
    }
    cout << count << endl;
}


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

using namespace std;

int main(){
	int n, a, b, bcnt = 1, pass = 0;
	string s;
	cin >> n >> a >> b >> s;
	for(int i = 0; i < n; i++){
		if(s[i] == 'a'){
			if(pass < (a + b)){
				cout << "Yes" << endl;
				pass++;
			}else{
				cout << "No" << endl;
			}
		}else if(s[i] == 'b'){
			if(pass < (a + b) && bcnt <= b){
				cout << "Yes" << endl;
				pass++;
				bcnt++;
			}else{
				cout << "No" << endl;
			}
		}else{
			cout << "No" << endl;
		}
	}
	return 0;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 200005

ll a , b , n , k , m , t;
string s;

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

ll max(ll a , ll b){
    if(a > b)   return a;
    return b;
}
int main()
{
    _FastIO;
    cin >> a >> n;
    cin >> b >> m;
    cin >> t;
    ll c = n * t;
    ll d = m * t;
    if(a < b){
        if((a + c) >= (b + d)){
            cout << "YES" << endl;
            return 0;
        }
        cout << "NO" << endl;
        return 0;
    }
    if((b - d) >= (a - c)){
            cout << "YES" << endl;
            return 0;
        }
        cout << "NO" << endl;
        return 0;
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include<algorithm>

using namespace std;



int main() {
	string s;
	cin >> s;
	int n = s.length();

	int cnt_0 = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '0') {
			cnt_0++;
		}
	}

	int cnt_1 = n - cnt_0;

	int min = cnt_0;
	if (min > cnt_1) {
		min = cnt_1;
	}
	
	cout << 2 * min << endl;

}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
 int a,b,c,d;
 cin >> a >> b >> c >> d;
 while(1){

      c-=b;
     if(c<=0){
         cout << "Yes" << endl;
         return 0;
     }
     
     a-=d;
     if(a<=0){
         cout << "No" << endl;
         return 0;
     }
    
 }
 
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define FOR(i, n, m) for (ll i = (n); i < (m); ++i)
#define FORR(i, n, m) for (ll i = (m) - 1; i >= (n); --i) 
#define FORE(x, xs) for (auto &x: (xs))
#define ALL(v) v.begin(), v.end()
#define ZERO(a) memset(a,0,sizeof(a))

const int INF = 1000000009;
const int MOD = 1000000007;
const double EPS = 1e-14;
const double PI = acos(-1);

const int MAX = 2e5;

ll N;
ll A[100000];
ll d[100000];

int main() {
  string ans = "YES";

  cin >> N;
  ll sum = 0;
  REP (i, N) {
    cin >> A[i];
    sum += A[i];
  }

  ll k = sum/(N*(N+1)/2);
  if (sum%(N*(N+1)/2)) ans = "NO";
  REP (i, N) {
    d[i] = A[i]-A[(i+1)%N]+k;
    if (d[i] < 0 || d[i]%N != 0) ans = "NO";
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.begin(), a.end())
using namespace std;
#define m 1000000007

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

    int a, b, c; cin>>a>>b>>c;
    cout<<min(c, b/a);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;
int main()
{
    int A,B,K,ans;
    cin>>A>>B>>K;
    if(B-A+1<=2*K){
        for(ans=A;ans<=B;ans++)cout<<ans<<endl;
    }else{
        for(ans=A;ans<A+K;ans++)cout<<ans<<endl;
        for(ans=B-K+1;ans<=B;ans++)cout<<ans<<endl;
    }
    return 0;

}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main(){
    int T,N,D;

    scanf("%d",&T);

    while(T--){
        scanf("%d %d",&N,&D);

        long long ans = 0;

        for(int i = 0;i < 7;++i){
            if(D >> i & 1){
                ans += (2LL * ((N - 1) / 2) + 1) * (1 << i);
            }else{
                ans += 2LL * (N / 2) * (1 << i);
            }
        }

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

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }

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

   int sum = 0;
   int tmp = N + abs(L);
   int sign = 0;
   for (int i = 1; i <= N; i++) {
      sum += L + i - 1;
      if (tmp > abs(L + i - 1)) {
         tmp = abs(L + i - 1);
         if (L + i - 1 > 0) sign = 1;
         else sign = -1;
      }
   }
   cout << sum - tmp * sign << endl;
   return 0;
}


Measured memory_bytes: 256