akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep (i, n) {
        cin >> a[i];
    }
    sort(all(a), greater<ll>());
    vector<int> b;
    vector<int> c;
    if (n % 2 == 0) {
        rep (i, n / 2 - 1) {
            b.push_back(2);
        }
        b.push_back(1);
        b.push_back(-1);
        rep (i, n / 2 - 1) {
            b.push_back(-2);
        }
        ll ans = 0;
        rep (i, n) {
            ans += a[i] * b[i];
        }
        cout << ans << endl;
    } else {
        rep (i, n / 2) {
            b.push_back(2);
            c.push_back(-2);
        }
        rep (i, n / 2 - 1) {
            b.push_back(-2);
            c.push_back(2);
        }
        rep(i, 2) {
            b.push_back(-1);
            c.push_back(1);
        }
        sort(all(b), greater<int>());
        sort(all(c), greater<int>());
        ll ans0, ans1;
        ans0 = ans1 = 0;
        rep (i, n) {
            ans0 += a[i] * b[i];
            ans1 += a[i] * c[i];
        }
        cout << max(ans0, ans1) << endl;
    }
}

Measured memory_bytes: 2044
#include <stdio.h>
 
int main()
{
  int x, y, r;    
 
  scanf("%d %d", &x, &y);

  if (y > x) {
    r = y;
    y = x;
    x = r;
  }
 
  while (y > 0) {
    r = x % y;
    x = y;
    y = r;
  }

  printf ("%d\n", x);
 
  return 0;
}

Measured memory_bytes: 592
import math

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

sqrtM = math.floor(math.sqrt(M))
maxd  = min(sqrtM, M // N)

d1 = max(      d for d in range(1, maxd  + 1) if M % d == 0)
d2 = max((M // d for d in range(N, sqrtM + 1) if M % d == 0), default=1)
print(max(d1, d2))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define Tayeb ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define PI acos(-1)
typedef long long ll;
using namespace std;
int main()
{
    Tayeb;
    int A,B,H,M;
    double h1,h2,m,distance=0;

    cin >> A >> B >> H >> M;
    h1=PI * (1.0/6) * H;
    h2=PI * (1.0/360) * M;
    m=PI * (1.0/30) * M;
    distance=A*A;
    distance+=B*B;
    distance-=2*A*B*cos(h1+h2-m);
    printf("%.20lf",sqrt(distance));

    return 0;

}

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

#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()

using namespace std;
using namespace __gnu_pbds;

typedef tree< int, null_type, less< int >, rb_tree_tag, tree_order_statistics_node_update> ost;
// name.find_by_order(x) or name.order_of_key(x)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
typedef vector<vector<int>> vvi;

void yes() {printf("YES\n");}
void no() {printf("NO\n");}

int dx4[] = {-1, 1, 0, 0};
int dy4[] = {0, 0, -1, 1};
int dx8[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};

const int maxn = 2e5 + 5, maxv = 2e6 + 5;
const int MOD = 1e9 + 7;

int mult(ll a, ll b) {return (a * b) % MOD;}
int pot(int n, int k) {
	int ret = 1, pot = n;
	for(;k > 0;k >>= 1, pot = mult(pot, pot)) 
		ret = mult(ret, (k & 1) ? pot : 1);
	return ret;
}
int divide(int a, int b) {return mult(a, pot(b, MOD - 2));}
int add(int a, int b) {a += b;if(a >= MOD) a -= MOD;return a;}
int sub(int a, int b) {a -= b;if(a < 0) a += MOD;return a;}

vector<int> fact;
void calc_fact(int n) {
	fact = vector<int>(n + 1, 1);
	for(int i = 1;i <= n;i++) fact[i] = mult(fact[i - 1], i);
}
int choose(int n, int k) {return divide(fact[n], mult(fact[n - k], fact[k]));}

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

ll gcd(ll a, ll b) {return (b == 0 ? a : gcd(b, a % b));}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}

ll phi(ll x) {
	double ret = x;
	for(ll i = 2;i * i <= x;i++) {
		if (x % i) continue;
		ret *= (1.0 - 1.0 / (double)i);
		while (x % i == 0) x /= i;
	}
	if (x > 1) ret *= (1.0 - 1.0 / (double)x );
	return (ll)ret;
}

void solve() {
	vi v1(2, 0);
	vi v2(2, 0);
	cin >> v1[0] >> v1[1] >> v2[0] >> v2[1];
	ll ans = -2e18;
	for(int i = 0;i < 2;i++) {
		for(int j = 0;j < 2;j++) ans = max(ans, (ll)v1[i] * v2[j]);
	}
	printf("%lld\n", ans);
}

int main() {
	int t = 1;
	//scanf("%d", &t);
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define int long long
#define N (int) 3e5
#define INF (int) 1e18
using namespace std;
int n;
int a[N];

int sum1[N], sum2[N], sum3[N];

signed main () {
//	freopen ("sample.in", "r", stdin);
//	freopen ("ABC162F.out", "w", stdout);
	
	cin >> n;
	for (int i = 1; i <= n; i ++) cin >> a[i];
	
	sum1[1] = a[1], sum1[2] = a[2];
	for (int i = 3; i <= n; i ++) {
		sum1[i] = sum1[i-2] + a[i];
	}
	sum2[n] = a[n], sum2[n-1] = a[n-1];
	for (int i = n-2; i >= 1; i --) {
		sum2[i] = sum2[i+2] + a[i];
	}
	
	int ans = -INF;
	for (int i = 1; i+3 <= n; i += 2) {
		ans = max (ans, sum1[i] + sum2[i+3]);
	}
	
	for (int i = 1; i <= n; i ++) sum3[i] = - INF;
	
	if (n % 2 == 0) {
		ans = max (ans, max (sum1[n], sum1[n-1]));
		cout << ans << endl;
	} else {
		int tmp = INF;
		for (int i = 1; i <= n; i += 2) tmp = min (tmp, a[i]);
		ans = max (ans, max (sum1[n-1], sum1[n]-tmp));
		
		for (int i = 2; i+3 <= n; i += 2) ans = max (ans, sum1[i] + sum2[i+3]);
		
		
		for (int i = n-3; i >= 2; i -= 2) sum3[i] = max (sum3[i+2], sum2[i+3]) + a[i];
		for (int i = 1; i+6 <= n; i += 2) ans = max (ans, sum1[i] + sum3[i+3]);
		
		cout << ans << endl;
	}
	
	return 0;
}

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

int main() {
  int N,L;cin>>N>>L;
  int left=L;
  int right=L+N-1;
  int all=0;
  for(int i=1;i<=N;i++) all+=L+i-1;
  if(left>=0) cout<<all-L<<endl;
  else if(right<=0) cout<<all-L-N+1<<endl;
  else cout<<all<<endl;
}

Measured memory_bytes: 3608
#include <iostream>

using namespace std;
#define MAX_BIT_NUMBER  62
#define MOD 1000000007LL

long long X, v[MAX_BIT_NUMBER], ans;
int i, n, j;

inline long long M (long long value){
    if (value < MOD)
        return value;
    return value % MOD;
}

long long exp (int k){
    if (!k)
        return 1LL;
    if (k & 1)
        return M(2LL * exp (k - 1));
    long long val = exp (k / 2);
    return M (val * val);
}

int main()
{
    cin >> n;
    for (i = 0; i < n; ++i){
        cin >> X;
        for (j = 0; j < MAX_BIT_NUMBER; ++j)
            if (X & (1LL << j))
            ++v[j];
    }
    for (i = 0; i < MAX_BIT_NUMBER; ++i)
    if (v[i]){
        ans = M (ans + M(v[i] * (n - v[i])) * exp (i));
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    string s;
    cin >> s;
    cout << s.substr(0, 4) << " " << s.substr(4, 8) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	private static final int MAX_B=4;
	private static final int MAX_F=3;
	private static final int MAX_R=10;
	private static Scanner sc=new Scanner(System.in);
	private static int n=sc.nextInt();
	private static int[][][] room=new int[MAX_B][MAX_F][MAX_R];
	public static void main(String[] args){
		for(int i=0;i<MAX_B;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		}
		int b,f,r,v;
		for(int i=0;i<n;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			room[b-1][f-1][r-1]+=v;
		}
		for(int i=0;i<MAX_B-1;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		}
		for(int j=0;j<MAX_F;j++){
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		}
	}
}

Measured memory_bytes: 29560
package main

import (
	"fmt"
)

func main() {
	a := 0
	b := 0
	fmt.Scan(&a, &b)

	sum := a + b
	sub := a - b
	mul := a * b

	ans := big(sum, big(sub, mul))
	fmt.Println(ans)
}

func big(i, j int) int {
	if i < j {
		return j
	}
	return i
}


Measured memory_bytes: 512
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N = int(input())
    a = 'zabcdefghijklmnopqrstuvwxy'
    ans = ''
    i = 0
    while N > 0:
        ans += a[N%26]
        N =  (N-1)//26
        # print(N)
    print(ans[::-1])

if __name__ == "__main__":
    main()


Measured memory_bytes: 9464
n = int(input())
mat = [list(map(int, input().split())) for _ in range(n)]
ans = 0
d = [[1] * n for _ in range(n)]
for i in range(n):
    for j, c2 in enumerate(row[i] for row in mat):
        for k, (c1, c3) in enumerate(zip(mat[j], mat[i])):
            if c1 > c2+c3:
                print(-1)
                exit(0)
            elif i != j and i != k and c1 == c2 + c3:
                d[j][k] = 0
for i in range(n):
    for j in range(n):
        if d[i][j]:
            ans += mat[i][j]
print(ans // 2)

Measured memory_bytes: 45660
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

bool check(int a, int b) {
	return a > b;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int k, n; cin >> k >> n;
    vector<int> data(n);
    for (auto &v : data)
        cin >> v;
    data.push_back(data[0] + k);
    int maxV = 0;
    for (int i = 0 ; i < n ; i ++)
        maxV = max(maxV, data[i + 1] - data[i]);
    cout << k - maxV << '\n';

}


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

int main(){
  int n;
  cin >> n;
  vector<vector<int> > a(2,vector<int>(n));
  rep(i,2) rep(j,n) cin >> a[i][j];

  vector<vector<int> > dp(2,vector<int>(n+1,0));

  rep(i,2) {
    rep(j,n+1) { 
      if (j < n) dp[i][j+1] = max(dp[i][j+1],dp[i][j] + a[i][j]);
      if (i == 0) dp[i+1][j] = max(dp[i+1][j],dp[i][j] + a[i][j]);
    }
  }
 
  cout << dp[1][n] << endl;
  return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: usize = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let (c, a): (Vec<char>, Vec<usize>) = {
        let (mut c, mut a) = (vec![], vec![]);
        for _ in 0..(2 * N) {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            c.push(iter.next().unwrap().chars().collect::<Vec<_>>()[0]);
            a.push(iter.next().unwrap().parse().unwrap());
        }
        (c, a)
    };
    let mut W = vec![0; N + 1];
    let mut B = vec![0; N + 1];
    for i in 0..(2 * N) {
        if c[i] == 'W' {
            W[a[i]] = i;
        }
        if c[i] == 'B' {
            B[a[i]] = i;
        }
    }

    const INF: usize = 1_000_000_000_000_000;
    let mut dp = vec![vec![INF; N + 1]; N + 1];
    dp[0][0] = 0;
    let mut x = vec![vec![0; N + 1]; N + 1];
    for i in 0..(N + 1) {
        x[i][0] = (0..W[i]).filter(|&k| c[k] == 'W' && a[k] > i).count()
            + (0..W[i]).filter(|&k| c[k] == 'B').count();
        for j in 1..(N + 1) {
            x[i][j] = if B[j] < W[i] {
                x[i][j - 1] - 1
            } else {
                x[i][j - 1]
            };
        }
    }
    let mut y = vec![vec![0; N + 1]; N + 1];
    for j in 0..(N + 1) {
        y[0][j] = (0..B[j]).filter(|&k| c[k] == 'B' && a[k] > j).count()
            + (0..B[j]).filter(|&k| c[k] == 'W').count();
        for i in 1..(N + 1) {
            y[i][j] = if W[i] < B[j] {
                y[i - 1][j] - 1
            } else {
                y[i - 1][j]
            };
        }
    }
    for i in 0..(N + 1) {
        for j in 0..(N + 1) {
            dp[i][j] = if i == 0 && j == 0 {
                0
            } else if i == 0 {
                dp[i][j - 1] + y[i][j]
            } else if j == 0 {
                dp[i - 1][j] + x[i][j]
            } else {
                std::cmp::min(dp[i][j - 1] + y[i][j], dp[i - 1][j] + x[i][j])
            };
        }
    }
    let ans = dp[N][N];

    println!("{}", ans);
}


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

#define int64_t long long

int main() {
	int64_t x, y;
	cin >> x >> y;

	vector<int64_t> p = { x, y, -x, -y };

	int64_t g[4][4];
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			g[i][j] = 1e15;
			if (i == j) {
				g[i][j] = 0;
			}
			if (p[i] == -p[j]) {
				g[i][j] = min(g[i][j], 1LL);
			}
			if (p[i] <= p[j]) {
				g[i][j] = min(g[i][j], p[j] - p[i]);
			}
		}
	}

	for (int k = 0; k < 4; k++) {
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
			}
		}
	}

	cout << g[0][1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char s;
  cin >> s;
  if (s =='a'||s =='i'||s =='u'||s =='e'||s =='o'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }

}

Measured memory_bytes: 256
prime_sieve=[1 for i in range(51)]
prime_sieve[0]=0
prime_sieve[1]=0
prime=[]

for i in range(2,51):
  if prime_sieve[i]==1:
    prime.append(i)
    for j in range(2,50//i+1):
      prime_sieve[i*j]=0


#print(len(prime))
count=[0 for i in range(15)]

X=int(input())

for i in range(2,X+1):
  for j in range(15):
    while i%prime[j]==0:
      i=i//prime[j]
      count[j]+=1


tw=0
fr=0
# 5 5 3

fif=0

# 5 15

tf=0


# 25 3 


sf=0



for i in range(15):
  if count[i]>=4:
    fr+=1
  if count[i]>=2:
    tw+=1
  if count[i]>=14:
    fif+=1
  if count[i]>=24:
    tf+=1
  if count[i]>=74:
    sf+=1




ans=fr*(fr-1)*(tw-2)//2+fif*(fr-1)+tf*(tw-1)+sf
print(ans)








Measured memory_bytes: 38512
#include<bits/stdc++.h>
#define fi first
#define sf scanf
#define se second
#define pf printf
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mem(x,y) memset((x),(y),sizeof(x))
#define fup(i,x,y) for(int i=(x);i<=(y);++i)
#define fdn(i,x,y) for(int i=(x);i>=(y);--i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef std::pair<int,int> pii;
using namespace std;

int vis[10];

int main()
{
    fup(i,1,6)
    {
        int x;sf("%d",&x);
        ++vis[x];
    }
    sort(vis+1,vis+5);
    if(vis[1]==vis[2] && vis[1]==1 && vis[3]==vis[4] && vis[4]==2)
        puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 256
def mark(s, x):
    for i in range(x + x, len(s), x):
        s[i] = False

def sieve2(n):
    s = [True] * n
    for x in range(2, int(n**0.5) + 1):
        if s[x]: mark(s, x)
    return [i for i in range(0,n) if(s[i] and i%5==2)]

print(" ".join(map(str,sieve2(55555)[:int(input())])))


Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

struct EdgeD
{
	int to;
	ll cost;
};

void calcShortestD(vector<vector<EdgeD>>& G, int s, int maxV, vector<ll>& d)
{
	for (auto i = 0; i < maxV; ++i)
	{
		d.push_back(LLONG_MAX);
	}
	d[s] = 0;

	priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> q;
	q.push({ 0, s });

	while (!q.empty())
	{
		auto p = q.top();
		q.pop();
		auto v = p.second;
		if (d[v] < p.first)
		{
			continue;
		}

		for (auto& e : G[v])
		{
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				q.push({ d[e.to], e.to });
			}
		}
	}
}

int main()
{
	int n, m, s, t;
	cin >> n >> m >> s >> t;
	--s;
	--t;

	vector<vector<EdgeD>> GY(n);
	vector<vector<EdgeD>> GS(n);
	for (auto i = 0; i < m; ++i)
	{
		int u, v;
		ll a, b;
		cin >> u >> v >> a >> b;
		--u;
		--v;
		GY[u].push_back({ v, a });
		GY[v].push_back({ u, a });
		GS[u].push_back({ v, b });
		GS[v].push_back({ u, b });
	}

	vector<ll> dY;
	vector<ll> dS;
	calcShortestD(GY, s, n, dY);
	calcShortestD(GS, t, n, dS);

	vector<ll> ans;
	ans.push_back(LLONG_MAX);
	for (auto i = n - 1; i >= 0; --i)
	{
		auto prev = *ans.rbegin();
		auto temp = dY[i] + dS[i];
		ans.push_back(min(prev, temp));
	}
	reverse(ans.begin(), ans.end());

	for (auto i = 0; i < n; ++i)
	{
		cout << (ll)1e15 - ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 19900
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans=100000000
for _ in range(n):
    absh=abs(t-h[_]*0.006-a)
    if ans>absh:
        ans=absh
        ansnum=_+1
print(ansnum)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
int64_t INF = 10010010010;
// int64_t INF = 1000000007;
// int64_t INF = 9223372036854775807;
// int64_t INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll h,w;
    cin >> h >> w;
    // まず1:2に切る
    // 次に1:1に切る
    // hで切る場合、wできる場合

    vi va = {h/3, h/3+1};
    vi vb = {w/2, w/2+1};
    ll res = INF;
    for(ll a: va){
        for(ll b:vb){
            ll sqa = a * w;
            ll sqb = b * (h-a);
            ll sqc = w*h - sqa - sqb;
            ll minimum = min(sqa, min(sqb,sqc));
            ll maximum = max(sqa, max(sqb,sqc));
            res = min(res, maximum-minimum);
            // cout << "a:" << a << " b:" << b << " res:" << res << endl;
            // cout << "minimum:" << minimum << " maximum:" << maximum << endl;
        }
    }
    va = {w/3, w/3+1};
    vb = {h/2, h/2+1};
    for(ll a: va){
        for(ll b:vb){
            ll sqa = a * h;
            ll sqb = b * (w-a);
            ll sqc = w*h - sqa - sqb;
            ll minimum = min(sqa, min(sqb,sqc));
            ll maximum = max(sqa, max(sqb,sqc));
            res = min(res, maximum-minimum);
            // cout << "a:" << a << " b:" << b << " res:" << res << endl;
            // cout << "minimum:" << minimum << " maximum:" << maximum << endl;
        }
    }
    va = {w/3, w/3+1};
    vb = {w/3, w/3+1};
    for(ll a: va){
        for(ll b:vb){
            ll sqa = a * h;
            ll sqb = b * h;
            ll sqc = w*h - sqa - sqb;
            ll minimum = min(sqa, min(sqb,sqc));
            ll maximum = max(sqa, max(sqb,sqc));
            res = min(res, maximum-minimum);
            // cout << "a:" << a << " b:" << b << " res:" << res << endl;
            // cout << "minimum:" << minimum << " maximum:" << maximum << endl;
        }
    }
    va = {h/3, h/3+1};
    vb = {h/3, h/3+1};
    for(ll a: va){
        for(ll b:vb){
            ll sqa = a * w;
            ll sqb = b * w;
            ll sqc = w*h - sqa - sqb;
            ll minimum = min(sqa, min(sqb,sqc));
            ll maximum = max(sqa, max(sqb,sqc));
            res = min(res, maximum-minimum);
            // cout << "a:" << a << " b:" << b << " res:" << res << endl;
            // cout << "minimum:" << minimum << " maximum:" << maximum << endl;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int x, y;

    while (1) {
        cin >> x >> y;
        if (x == 0 and y == 0) break;

        if (x < y) {
            cout << x << " " << y << "\n";
        } else {
            cout << y << " " << x << "\n";
        }
    }
}

Measured memory_bytes: 3108
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int[] L = new int[N];
            for (int i = 0; i < N; i++) {
                L[i] = in.nextInt();
            }
            Arrays.sort(L);

            long sum = 0;
            for (int i = 0; i < N; i++) {
                for (int j = i + 1; j < N; j++) {
                    for (int k = j + 1; k < N; k++) {
                        if (L[i] + L[j] <= L[k]) {
                            break;
                        }
                        sum++;
                    }
                }
            }
            out.println(sum);
        }
    }
}



Measured memory_bytes: 28128
using System;

namespace atcoder_BegginerContest95_Question3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            var pricePizzaA = Int32.Parse(input[0]);
            var pricePizzaB = Int32.Parse(input[1]);
            var pricePizzaC = Int32.Parse(input[2]);
            var numPizzaA = Int32.Parse(input[3]);
            var numPizzaB = Int32.Parse(input[4]);
            var minPrice = 0;

            if(pricePizzaA > pricePizzaC * 2)
            {
                while (numPizzaA >= 1)
                {
                    minPrice += pricePizzaC * 2;
                    numPizzaA--;
                    numPizzaB--;
                }
            }

            if (pricePizzaB > pricePizzaC * 2)
            {
                while (numPizzaB >= 1)
                {
                    minPrice += pricePizzaC * 2;
                    numPizzaA--;
                    numPizzaB--;
                }
            }

            if (pricePizzaA + pricePizzaB > pricePizzaC * 2)
            {
                while (numPizzaA >= 1 && numPizzaB >= 1)
                {
                    minPrice += 2 * pricePizzaC;
                    numPizzaA -= 1;
                    numPizzaB -= 1;
                }
            }

            if (numPizzaA <= 0) numPizzaA = 0;
            if (numPizzaB <= 0) numPizzaB = 0;

            minPrice += numPizzaA * pricePizzaA + numPizzaB * pricePizzaB;
            Console.WriteLine(minPrice);
        }
    }
}


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

int main(){
 int X,Y;
 cin >> X >> Y;
 if((Y-2*X)%2==0 && (Y-2*X)>=0){
   if((4*X-Y)%2==0 && (4*X-Y)>=0){
     cout << "Yes" << endl;
   }
   else{
     cout << "No" << endl;
   }
 }
 else{
   cout << "No" << endl;
 }
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

ll f(int i){
	int ans=1;
	if(i<=0) return 1;
	while(i--) ans*=2;
	return ans;
}

int main(){
	string s;
	cin >>s;
	int n=s.length();
	ll ans=0;
	ll num=0;
	for(int i=0; i<n;i++){
		for(int j=1;j<=n-i;j++){
			num=0;
			ll w=1;
			for(int k=j-1;k>-1;k--){
				num+=w*(s[k+i]-'0');
				w*=10;
			}
		ans+=num*f(i-1)*f(n-i-j-1);
		}
	}
	cout << ans;


	return 0;
}

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

#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;

int main(int argc, char *argv[]) {
    ll x, a;
    cin >> x >>  a;

    if (x < a) MSG(0)
    else MSG(10)
    return 0;
}


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

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(10);

    vector<int> v(3, -1);
    bool bad = false;
    int N, M; cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        int s, c;
        cin >> s >> c;
        int idx = s - 1;
        if (v[idx] == -1 || v[idx] == c) { v[idx] = c; continue;}
        bad = true;
    }
    if (N == 3)
    {
        if (bad || v[0] == 0) cout << -1 << endl;
        else {
            if (v[0] == -1) v[0] = 1;
            if (v[1] == -1) v[1] = 0;
            if (v[2] == -1) v[2] = 0;
            cout << v[0] * 100 + v[1] * 10 + v[2] << endl;
        }
    } else if (N == 2) {
        if (bad || v[0] == 0) cout << -1 << endl;
        else {
            if (v[0] == -1) v[0] = 1;
            if (v[1] == -1) v[1] = 0;
            cout << v[0] * 10 + v[1] << endl;
        }
    } else {
        if (bad) cout << -1 << endl;
        else {
            if (v[0] == -1) v[0] = 0;
            cout << v[0] << endl;
        }
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

void solve() {
  int N;
  cin >> N;

  for (int i = 1; i <= 500000; i++) {
    if ((int)(i * 1.08) == N) {
      cout << i << endl;
      return;
    }
  }

  cout << ":(" << endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define f(i,n) for(int i=0; i<n; ++i)
#define fi(i,st,n) for(int i=st; i<=n; ++i)
#define veci vector<int>
#define vecp vector<pair<int,int> >
#define vecl vector<ll>
int prime[100000+10];

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

ll power(ll a, ll n, ll mod) {
	ll res = 1;
	while(n > 0) {
		if(n&1) {
			res = (res*a)%mod;
		}
		a = (a*a)%mod;
		n = n/2;
	}
	return res;
}

ll sum(int arr[], int n) {
	ll res = 0;
	f(i,n) {
		res += arr[i];
	}
	return res;
}

void seive() {
	prime[1] = 0;
	for(int i=2; i<=100000; i++) {
		prime[i] = 1;
	}
	for(ll i=2; i<=100000; i++) {
		if(prime[i]) {
			for(ll j=i*i; j<=100000; j+=i) {
				prime[j] = 0;
			}
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,x,m;
	cin>>n>>x>>m;
	set<ll> st;
	vector<ll> v;
	st.insert(x);
	v.pb(x);
	ll ans = 0;
	for(ll i=1; i<=n; i++) {
		ans += x%m;
		x = x*x%m;
		if(st.find(x) != st.end()) {
			ll sum = 0;
			int pos = 0;
			for(; pos<v.size(); pos++) {
				if(v[pos] == x) {
					break;
				}
			}
			for(int i=pos; i<v.size(); i++) {
				sum += v[i];
			}
			ans += ((n-i)/(v.size()-pos))*sum;
			ll rem = (n-i)%(v.size()-pos);
			
			while(rem) {
				ans += v[pos];
				pos++;
				rem--;
				if(pos == v.size()) {
					pos = 0;
				}
			}
			break;
		}
		st.insert(x);
		v.pb(x);
	}
	cout<<ans<<"\n";
 	return 0;
}


Measured memory_bytes: 5892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

int main(){
    int n, k, x, y;
    cin >> n >> k >> x >> y;

    int ans = 0;
    if(n > k) ans = k * x + (n-k) * y;
    else ans = n * x;
    cout << ans << endl;
}


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

constexpr int64_t mod = 1000000007;

vector<int64_t> fact, inv;

int64_t power(int64_t n, int64_t k) {
  if (k == 0) return 1;
  int64_t res = power(n * n % mod, k / 2);
  if (k % 2) res = res * n % mod;
  return res;
}

void init(int n) {
  fact.push_back(1);
  inv.push_back(1);
  for (int i = 1; i <= n; i++) {
    fact.push_back(i * fact.at(i - 1) % mod);
    inv.push_back(power(fact.at(i), mod - 2));
  }
}

int64_t ncr(int n, int r) {
  if (r < 0 or n - r < 0) return 0;
  return fact.at(n) * inv.at(r) % mod * inv.at(n - r) % mod;
}

int main() {
  int64_t n, m;
  cin >> n >> m;
  init(m);
  int64_t ans = 0;
  for (int i = 0; i <= n; i++) {
    int s = 1 - i % 2 * 2;
    ans += fact.at(m - i) * inv.at(m - n) % mod * ncr(n, i) % mod * s;
    if (ans < 0) ans += mod;
    ans %= mod;
  }
  ans *= fact.at(m) * inv.at(m - n) % mod;
  ans %= mod;
  cout << ans << endl;
}


Measured memory_bytes: 11188
#include <bits/stdc++.h>
using namespace std;
#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++)

int main(){
  int k,x;
  cin >> k >> x;
  if(k*500 >= x) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

long comb_count(int n, int m) {
    if (m == 0) return 1;
    if (n == 0) return 0;
    return (n * comb_count(n - 1, m - 1) / m);
}

int main()
{
    int N, M;
    cin >> N >> M;
    cout << comb_count(N, 2) + comb_count(M, 2) << endl;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    cin >> N;
    cout << 800 * N - 200 * (N / 15) << endl;
}


Measured memory_bytes: 256
import bisect
n,k = map(int,input().split())
a = list(map(int,input().split()))
# for i in a[0:bisect.bisect_left(t,0)]:
m = a[0:bisect.bisect_left(a,0)]+[0]
p = [0]+a[bisect.bisect_left(a,0):]
# for i in range(len(m)-2,-1,-1):
#     m[i] += m[i+1]
# for i in range(1,len(p)):
#     p[i] += p[i-1]
# print(p)
# print(m)
ans = 10**9
for i in range(max(k-len(m)+1,0),min(len(p),k+1)):
    ans = min(ans,2*p[i]+abs(m[-(k-i+1)]))
    # print(ans,i,-(k-i+1),p[i],abs(m[-(k-i)]))
for i in range(max(k-len(p)+1,0),min(len(m),k)):
    ans = min(ans,2*abs(m[-i-1])+abs(p[k-i]))
    # print(ans,i,(k-i),abs(m[-i-1]),abs(p[k-i]))
print(ans)

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

using ll = long long;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int tc = 1;
    // cin >> tc;
    while(tc--) {
        ll n;
        cin >> n;
        string b;
        cin >> b;
        
        string c = "";
        c += b[0];
        c += b[2];
        c += b[3];
        
        ll m = stoi(c);
        n *= m;
        n /= 100;
        cout << n << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionD
    {
        public static void Main(string[] args)
        {
            // 整数の入力
            long n = long.Parse(Console.ReadLine());

            Console.WriteLine(Count(n));

            Console.Out.Flush();
        }

        public static long Count(long n)
        {
            if (n == 1)
            {
                return 1;
            }

            return 1 + 2 * Count(n / 2);
        }
    }
}


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

using namespace std;

int *A;

int main(void)
{
	int N, K;
	cin >> N >> K;

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

	sort(A, A + N);

	int kind = 0, tmp = A[0];
	int cnt = 1;
	int *num = new int[N];
	for (int i = 1; i < N; ++i) {
		if (A[i] > tmp) {
			num[kind] = cnt;
			++kind;
			cnt = 0;
			tmp = A[i];
		}
		++cnt;
	}
	num[kind] = cnt;
	++kind;

	sort(num, num + kind);

	int sum = 0;
	for (int i = 0; i < kind - K; ++i) {
		sum += num[i];
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1792
s=input()
former,latter=int(s[:2]),int(s[2:])

#0,13<=x<=99で年だけ　1<=x<=12で年か月,　ほかはどっちか
def decide(x):
    if x==0 or 13<=x<=99:
        return 0  #年だけ
    elif 1<=x<=12:
        return 1  #どっちもある
f=decide(former)
l=decide(latter)
if f==0 and l==1:
    print('YYMM')
elif f==1 and l==0:
    print('MMYY')
elif f==0 and l==0:
    print('NA')
else:
    print('AMBIGUOUS')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	Int a, b; cin >> a >> b;
	if(a > b) swap(a, b);
	for(Int i=0; i<b; ++i) cout << a;
	cout << "\n";
}

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

ans = 10 ** 6
count=0
l_c = [0] * n
for i, c in enumerate(s):
    if c == "#":
        count += 1
    l_c[i] = count
count=0
r_c = [0] * n
for i, c in enumerate(s[::-1]):
    if c == ".":
        count += 1
    r_c[n-1-i] = count

for i in range(1,n):
    ans = min(ans, l_c[i-1] + r_c[i])

ans = min(ans, s.count("#"), s.count("."))
print(ans)

Measured memory_bytes: 14856
#include <iostream>
#include<string.h>
#include<algorithm>
using namespace std;
typedef long long ll;
#define M 100000+100

int main()
{
    int n,k,s;
    cin>>n>>k>>s;
    int temp=n-k;
    while(k--)
        cout<<s<<" ";
    if(s<1000000000)
    while(temp--)
        cout<<s+1<<" ";
    else
      while(temp--)
        cout<<"1"<<" ";
    return 0;
}


Measured memory_bytes: 1280
def factorization(n):
    if(n == 1):
        return []
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def solve(N):
    ans = 0
    arr_list = factorization(N)
    for arr in arr_list:
        prime = arr[0]
        times = arr[1]
        count = 1
        while True:
            times -= count
            if(times < 0):
                break
            ans += 1
            count += 1
    return ans

#print(solve(24))
#print(solve(1))
#print(solve(64))
#print(solve(1000000007))
#print(solve(997764507000))

def main():
    N = int(input())
    print(solve(N))

main()

Measured memory_bytes: 63420
N = int(input())
count = 0
count_max = count
for i in range(N):
    di_1, di_2 = [int(i) for i in input().split()]
    if di_1 == di_2:
        count += 1
    else:
        count_max = max([count_max, count])
        count = 0
count_max = max([count_max, count])
if count_max >= 3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9184
import java.util.*;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);

	void run(){

		int[] dp = new int[51];

		Arrays.fill(dp, Integer.MAX_VALUE - 3000);

		dp[0] = 0;

		int price[] ={380,550,850,380*4,(int)(550*4*0.85 + 0.4),(int)(850*3*0.88 + 0.4)} ;

		int weigh[] ={  2,  3,  5, 10,12,15} ;

		for(int i = 0;i < 6;i++){

			for(int j=0;weigh[i]+j < 51;j++){

				dp[j+weigh[i]] = Math.min(dp[j] + price[i],dp[j+weigh[i]]);

			}

		}

		for(;;){

			int n = sc.nextInt()/100;

			if(n==0) break;

			System.out.println(dp[n]);

		}

	}

	public static void main(String[] args){

		Main m = new Main();

		m.run();

	}

}

Measured memory_bytes: 12000
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        h: usize, w: usize,
        s: [Chars; h],
    }

    let mut flag = true;

    let directions = vec![(0, 1), (1, 0), (-1, 0), (0, -1)];

    for x in 0..w {
        for y in 0..h {
            if s[y][x] != '#' { continue; }
            let mut cnt = 0;
            for &(dx, dy) in directions.iter() {
                let (cx, cy) = (x as i32 + dx, y as i32 + dy);
                if cx < 0 || cy < 0 || cx >= w as i32 || cy >= h as i32 { continue; }
                if s[cy as usize][cx as usize] == '#' { cnt += 1}
            }

            if cnt == 0 { flag = false; break }
        }
    }
    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
    
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define I(x, a) for(auto x : a)
#define F(i, l, r) for(auto i = l; i < r; ++i)
#define DF(i, l, r) for(auto i = l; i > r; --i)
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define all(x) x.begin(),x.end()
#define ret return
#define cont continue
#define brk break
#define ins insert
#define sz(a) ((int)(a).size())

typedef long long ll;
typedef unsigned long long ull;
typedef long double dbl;
typedef pair <int, int> pii;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)1e9 + 7;
const dbl eps = (dbl)1e-8;
const int maxn = (int)4e6 + 5;
const dbl pi = acos(-1);

int n;
ll s, a[2005];
bitset <maxn> d1, d2;

int main() {
//    fin("t.in");
    sync;
    cin >> n;
    s = 0;
    F(i, 0, n) {
    	cin >> a[i];
    	s += a[i];
    }
    s = s / 2 + s % 2;
    d1.reset();
    d1[0] = 1;
    F(i, 0, n) {
    	d1 = d1 | (d1 << a[i]);
    }
    F(i, s, inf) {
    	if (d1[i]) {
    		cout << i << endl;
    		exit(0);
    	}
    }
    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K, h;
  int ans = 0;
  cin >> N >> K;
  for(int i = 0; i < N; i++){
    cin >> h;
    if(h >= K) ans++;
    else continue;
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
    string str;
    while (cin >> str) {
        int n = str.size();
        bool isC = false, isF = false;
        for (auto ch : str) {
            if (ch == 'C') {
                isC = true;
            }
            if (ch == 'F' && isC) {
                isF = true;
            }
        }
        if (isF) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>

typedef long long LL;

using namespace std;

int main()
{
	LL a,b,c,k;
	LL sum = 0;
	cin >> a >> b >> c >> k;
	if(k <= a)
		printf("%lld\n",k);
	else if(k > a)
	{
		if(k <= (a+b))
			printf("%lld\n",a);
		else
			printf("%lld\n",a-(k-a-b));
	}
	return 0;
} 

Measured memory_bytes: 3748
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    string s;
    getline(cin, s);

    if(s == "1 1 0" || s == "0 0 1")
        cout << "Open" << endl;
    else
        cout << "Close" << endl;

    return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    ll N, ans=0;
    cin >> N;
    vector<ll> A(N+1);
    vector<ll> B(N);
    rep(i, N+1) cin >> A[i
    ];
    rep(i, N) cin >> B[i];
    rep(i, N){
        if(A[i]>=B[i]) ans+=B[i];
        else{
            ans+=min(A[i]+A[i+1], B[i]);
            A[i+1]=max(A[i+1]-(B[i]-A[i]), ll(0));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
import sys

if __name__ == '__main__':
	input()
	A = list(map(int,sys.stdin.readline().split()))

	cnt = 0
	EVE = [i for i in A if i % 2 == 0]

	for j in EVE:
		while True:
			j = j // 2
			if j % 2 == 1:
				cnt += 1
				break
			cnt += 1

	print(cnt)


Measured memory_bytes: 4084
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int a[]=new int[101],i,max=0;
		while(s.hasNext()){
			a[s.nextInt()]++;
		}
		for(i=0;i<101;i++){
			if(a[i]>max) max=a[i];
		}
		for(i=0;i<101;i++){
			if(a[i]==max){
				System.out.println(i);
			}
		}
	}
}

Measured memory_bytes: 0
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 20;
char dn[dm], * di = dn;
inline void putint(int X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

int to[200001], ne[200001];
int H[100001], PM[100001], Pm[100001];
int kotae[100001];
bool OK = true;
pair<int, int> sagasu(int A, int pre) {
	bool OE[2] = {};
	if (PM[A] < 1e6) OE[PM[A] & 1] = 1;
	for (int i = H[A]; i; i = ne[i]) {
		if (to[i] != pre) {
			auto p = sagasu(to[i], A);
			if (p.first < 1e6) OE[p.first & 1] = 1;
			PM[A] = min(PM[A], p.first);
			Pm[A] = max(Pm[A], p.second);
		}
	}
	if (OE[0] && OE[1]) OK = false;
	if (PM[A] < Pm[A]) OK = false;
	return mp(PM[A] + 1, Pm[A] - 1);
}
void sagasu2(int A, int M, int prev) {
	if (M + 1 <= PM[A]) kotae[A] = M + 1;
	else kotae[A] = M - 1;
	for (int i = H[A]; i; i = ne[i]) {
		if (to[i] != prev) sagasu2(to[i], kotae[A], A);
	}
}

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


	int N = getint();
	for (int i = 1; i < 2 * (N - 1); i += 2) {
		int a = getint(), b = getint();
		to[i] = a;
		ne[i] = H[b];
		H[b] = i;
		to[i + 1] = b;
		ne[i + 1] = H[a];
		H[a] = i + 1;
	}
	int K = getint();
	int v, p;
	rep1(i, N) {
		PM[i] = 5e6;
		Pm[i] = -5e6;
	}
	rep(i, K) {
		v = getint();
		p = getint();
		PM[v] = p;
		Pm[v] = p;
	}

	sagasu(1, 0);

	if (OK) {
		sagasu2(1, PM[1] - 1, 0);
		*di++ = 'Y';
		*di++ = 'e';
		*di++ = 's';
		*di++ = '\n';
		rep1(i, N) putint(kotae[i]);
		fwrite_unlocked(dn, di - dn, 1, stdout);
	}
	else printf("No");

	Would you please return 0;
}

Measured memory_bytes: 11264
<?php
fscanf(STDIN, "%s", $S);
fscanf(STDIN, "%d", $Q);

// 反転フラグ
$reverse = false;

// 配列
$strList = [];
$strList = array_fill(0, 1000000 * 2, '');
$strList[1000000] ="";
$idx1 = 1000000 - 1;
$idx2 = 1000000 + 1;

for($i = 0; $i < $Q; $i++) {
	// query入力
	$query = trim(fgets(STDIN));
	$list = explode(" ", $query);
	
	if($list[0] == "1") {
		$reverse = !$reverse;
	}
	else {
		if(($list[1] == "1" && $reverse == false) || ($list[1] != "1" && $reverse != false)) {
			$strList[$idx1] = $list[2];
			$idx1--;
		}
		else {
			$strList[$idx2] = $list[2];
			$idx2++;
		}
	}
}

if($reverse) {
	$strList[1000000] = strrev($S);
}
else {
	$strList[1000000] = $S;
}

$S = "";
if($reverse) {
	for($i = $idx2 - 1; $i > $idx1; $i--) {
		echo "{$strList[$i]}";
	}
}
else {
	for($i = $idx1 + 1; $i < $idx2; $i++) {
		echo "{$strList[$i]}";
	}
}
 
echo "\n";

Measured memory_bytes: 74488
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define mod 1000000007;
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll k;
    cin>>k;
    string s;
    cin>>s;
    ll n=s.length();
    if(n<=k)
    cout<<s;
    else
    {
        for(int i=0;i<k;i++)
        cout<<s[i];
        cout<<"...";
    }
    

    return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#define FOR(i,a,b) for(int i=a;i<=b;++i)

const int N=2005;
const int P=924844033;
int n,k,a[N],fac[N];
long long f[N][N][2][2];
bool vis[N];

int main() {
    scanf("%d%d",&n,&k);
    fac[0]=1;
    FOR(i,1,n) fac[i]=1LL*fac[i-1]*i%P;
    int tot=0;
    FOR(i,1,n) if(!vis[i]) for(int j=i;j<=n;j+=k) vis[j]=1,a[++tot]=j;
    f[0][0][0][0]=1;
    a[0]=-(1<<30);
    FOR(i,1,n) {
        f[i][0][0][0]=1;
        FOR(j,1,i) {
            f[i][j][0][0]=(f[i-1][j][1][0]+f[i-1][j][0][0]+(a[i]-a[i-1]==k)*f[i-1][j-1][0][0])%P; // i丢给i-1
            f[i][j][0][1]=(a[i+1]-a[i]==k)*(f[i-1][j-1][1][0]+f[i-1][j-1][0][0])%P; // i+1丢给i
            f[i][j][1][0]=(f[i-1][j][0][1]+f[i-1][j][1][1]+(a[i]-a[i-1]==k)*f[i-1][j-1][0][1])%P; // i-1丢给i
            f[i][j][1][1]=(a[i+1]-a[i]==k)*(f[i-1][j-1][0][1]+f[i-1][j-1][1][1])%P;
        }
    }
    int ans=0;
    FOR(i,0,n) {
        int sum=(f[n][i][0][0]+f[n][i][0][1]+f[n][i][1][0]+f[n][i][1][1])%P;
        if(i&1) (ans+=P-1LL*sum*fac[n-i]%P)%=P;
        else (ans+=1LL*sum*fac[n-i]%P)%=P;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 123648
#include <iostream>

int main() {

	int a, b;

	std::cin >> a >> b;

	if ((a * b) % 2 == 0) {
		std::cout << "Even" << std::endl;
	}
	else if ((a * b) % 2 == 1) {
		std::cout << "Odd" << std::endl;
	}
}

Measured memory_bytes: 256