akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353;
constexpr int MAX = 500050;
const double pi = acos(-1);
// constexpr double EPS = 1e-10;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;



void solve() {
	int A; cin >> A;
	double B; cin >> B;
	int C = (int)(B * 100 + 0.1);
	print(A*C / 100);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;
	//cin >> q;
	//while (q--)
	solve();
}


Measured memory_bytes: 3788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <complex>
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
using namespace std;
typedef long long ll;

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
//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int main()
{
	fastIO;
	int n, d;

	cin>>n>>d;

	int temp = (d * 2) + 1;
	int res = (n % temp == 0) ? n / temp : (n / temp) + 1;

	cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void C_task();

int main()
{
	C_task();
	
	fflush(stdout);
	return 0;
}

static void C_task()
{
	int N;
	get1int(N);

	auto df = new int[N + 1];
	for (int i = 0; i < N; i++) {
		get1int(df[i]);
	}
	df[N] = 0;

	std::sort(df, df + N);

	int cnt = df[N / 2] - df[N / 2 - 1];
	printf("%d\n", cnt);

	delete[] df;
}


Measured memory_bytes: 640
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,m = mi()
ali = li()

summ = 0
for i in range(n):
    summ += ali[i]

ki = summ / 4/ m
ans = 0
for i in range(n):
    if ali[i] >= ki:
        ans += 1
if ans >= m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void)
{
    int N, A, B, sum = 0;
    cin >> N >> A >> B;
    int plus;

    for (int i = 1; i <= N; ++i)
    {
        int tmp = i;
        plus = 0;
        while (tmp != 0)
        {
            plus += tmp % 10;
            tmp /= 10;
        }
        if (plus >= A && plus <= B)
            sum += i;
    }
    cout << sum << "\n";
}

Measured memory_bytes: 256
import java.util.stream.Stream;

public class Main {
    public static void main(final String[] args) {
        final java.util.Scanner scanner = new java.util.Scanner(System.in);
        final String line = scanner.nextLine();

        if (line.matches("10+")) {
            System.out.println("10");
        } else {
            final int sum = Stream.of(line.split("")).mapToInt(Integer::valueOf).sum();
            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 28756
#include <iostream>

int main(void) {
  std::string x;

  std::cin >> x;
  
  while(x != "0") {
    int sum = 0;
    
    for (int i = 0; i < x.size(); i++) {
      sum += x[i] - '0';
    }

    std::cout << sum << std::endl;

    std::cin >> x;
  }

  return 0;
}

Measured memory_bytes: 1188
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let r: i32 = buf.trim().parse().ok().unwrap();

    if r < 1200 {
        println!("ABC");
    } else if r < 2800 {
        println!("ARC");
    } else {
        println!("AGC");
    }
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, a[101010];
void solve(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
	
	i64 ans = n, cnt = a[0];
	for(int i = 1; i < n; i++){
		if(cnt*2 < a[i]) ans = n-i;
		cnt += a[i];
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int mo=1000000007;
const int N=5005;
int n,a[N];
int vis[N],p[N],sz[N];
int f[2][N];
int power(int x,int y){
	int s=1;
	for (;y;y/=2,x=1ll*x*x%mo)
		if (y&1) s=1ll*s*x%mo;
	return s;
}
int main(){
	int sum=0;
	scanf("%d",&n);
	For(i,1,n) scanf("%d",&a[i]);
	For(i,1,n) if (a[i]==-1) sum++;
	int ans=1ll*power(n-1,sum)*n%mo;
	//cout<<ans<<endl;
	For(i,1,n){
		p[i]=i;
		memset(vis,0,sizeof(vis));
		for (;a[p[i]]!=-1&&!vis[p[i]];vis[p[i]]=1,p[i]=a[p[i]]);
		if (a[p[i]]==-1) ++sz[p[i]];
		//cout<<
	}
	//For(i,1,n) cout<<sz[i]<<endl;
	memset(vis,0,sizeof(vis));
	For(i,1,n) if (vis[i]==0){
		++*vis; int j=i;
		for (;j!=-1&&!vis[j];vis[j]=*vis,j=a[j]);
		if (j!=-1&&vis[j]==*vis) ans=(ans+mo-1ll*power(n-1,sum))%mo;
	}
	//cout<<ans<<endl;
	f[0][0]=1;
	int pre=0,suf=1;
	For(i,1,n) if (sz[i]){
		memset(f[suf],0,sizeof(f[suf]));
		//cout<<i<<' '<<sz[i]<<endl;
		For(j,0,n){
			//cout<<f[pre][j]<<endl;
			if (!f[pre][j]) continue;
			f[suf][j]=(f[suf][j]+f[pre][j])%mo;
			f[suf][j+1]=(f[suf][j+1]+1ll*f[pre][j]*sz[i])%mo;
		}
		swap(pre,suf);
	}
	//cout<<f[suf][1]<<endl;
	//For(i,1,n) cout<<f[pre][i]<<' '; cout<<endl;
	f[pre][1]-=sum;
	For(i,1,sum){
		int val=f[pre][i];
		For(j,1,i-1) val=1ll*val*j%mo;
		ans=(ans+mo-1ll*val*power(n-1,sum-i)%mo)%mo;
	}
	printf("%d\n",ans);
	
}

Measured memory_bytes: 3948
#ALDS_1_3_B Queue
input = $stdin
# input = DATA
procs = []
completed = []
qtime = 0
n,q = input.gets.chomp.split.map(&:to_i)
n.times do
  name,time = input.gets.split
  procs.push(Hash[name,time.to_i])
end

while(procs.any?) do
  prok = procs.shift
  v = prok.first[-1]
  if (v > q) then
    prok[prok.first[0]]= v - q
    procs.push(prok)
    # binding.pry
    qtime += q
  else
    qtime += v
    puts "#{prok.first[0]} #{qtime}"
  end
end


Measured memory_bytes: 21640
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
ll n,m,i,j,k,l,t;
int main()
{
    scanf("%lld",&n);
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=n;j++)
        {
            for(k=1;k<=n;k++)
            {
                l=__gcd(i,j);
                l=__gcd(l,k);
                m+=l;
            }
        }
    }
    printf("%lld\n",m);
    return 0;
}


Measured memory_bytes: 3824
n, m  = map(int,input().split())
li = [list(map(int,input().split())) for i in range(n)]

li2 = [0]*m
for i in range(len(li)):
    for j in range(1,li[i][0]+1):
        li2[li[i][j]-1] += 1

if max(li2) == n:
    print(li2.count(max(li2)))
else:
    print(0)


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

typedef long long ll;

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    int k, s;
    cin >> k >> s;

    int mini = min(k, s);
    ll ans = 0;
    for (int z = 0; z <= mini; z++) {
        int t = s - z;
        if (t > k) ans += max(t + 1 - 2 * (t - k), 0);
        else ans += t + 1;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<set>

signed main(){
  int n;
  std::cin>>n;
  std::vector<int64_t> a(n);
  for(auto& ai:a)std::cin>>ai;
  std::sort(std::rbegin(a),std::rend(a));
  std::multiset<int64_t> st(std::begin(a),std::end(a));
  int ans = 0;
  for(int i=0;i<n;++i){
    if(st.find(a[i])==std::end(st))continue;
    st.erase(st.find(a[i]));
    for(int p2=40;p2-->0;){
      if(auto itr=st.find((1LL<<p2)-a[i]);itr!=std::end(st)){
        ans++;
        st.erase(itr);
      }
    }
  }
  std::cout<< ans <<std::endl;
}


Measured memory_bytes: 14028
import itertools
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
o=0
h=0
u=list(itertools.permutations(range(1,n+1)))
for i in range(len(u)):
    if u[i]==p:
        h=i
    if u[i]==q:
        o=i
print(abs(h-o))

Measured memory_bytes: 8052
s = input()
x, y = map(int, input().split())
m = list(map(len, s.split('T')))
# 最初は右に行くしかない
dp_x = {m[0]}
for i in m[2::2]:
    new_dp = set()
    for v in dp_x:
        new_dp |= {v + i, v - i}
    dp_x = new_dp

dp_y = {0}
for i in m[1::2]:
    new_dp = set()
    for v in dp_y:
        new_dp |= {v + i, v - i}
    dp_y = new_dp

print('Yes' if x in dp_x and y in dp_y else 'No')

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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

const char sp = ' ';
const int MOD = 1000000007;

using ll = long long;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int jpy = 0;
    double btc = 0.0;
    for(int i = 0; i < n; ++i){
        double x; string u;
        cin >> x >> u;

        if(u == "JPY"){
            jpy += x;
        }
        if(u == "BTC"){
            btc += x;
        }
    }

    double ans = 380000*btc+jpy; 
    ppp(ans);


    return 0;
}


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

using namespace std;


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

	int n,m,X,Y,t;
	vector <int> x,y;

	cin >> n >> m >> X >> Y;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		x.push_back(t);
	}

	for(int i=0;i<m;i++)
	{
		cin >> t;
		y.push_back(t);
	}

	sort(x.begin(),x.end());
	sort(y.begin(),y.end());

	for(int i=x[n-1]+1;i<=y[0];i++)
	{
		if(i>X && i<=Y)
		{
			cout << "No War" << '\n';
			return 0;
		}
	}

	cout << "War" << '\n';
	return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- ( `mod` 500 ) <$> readInt
	a <- readInt
	putStrLn $ which "Yes" "No" $ n <= a


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

int main() {
    int n, a, b;
    cin >> n >> a >> b;

    int train = n * a;

    if(train < b){
        cout << train << endl;
        return 0;
    }
    if(train >= b){
        cout << b << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        mut a: [u64; n],
    }
    let mut cum = 0;
    for i in 0..n {
        cum = cum ^ a[i];
    }

    if cum == 0 {
        println!{"Yes"};
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define light ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define REP(i,a,b) for(ll i = a; i < b; i++)
#define REPE(i,a,b) for(ll i = a; i <= b; i++)
#define REPR(i,a,b) for(ll i = a; i >= b; i--)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define bins(v, x) binary_search(v.begin(), v.end(), x)
const double pi = 2*acos(0.0);
const int INF = 1e9+1;
const int MOD = 1e9+7;
const int MOD1 = 998244353;

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<int>;

#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
 
ll modExp(ll base, ll exp, ll mod) {
   ll res = 1;
   while (exp > 0) {
    	if (exp % 2 == 1) {
        	res= (res * base) % mod;
		}
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}

ll inverse(ll base, ll exp, ll mod) {
   return modExp(base, exp - 2, mod);
}

bool compare(const pair<int,int> &i, const pair<int,int> &j) {
   return (i.S > j.S || (i.S == j.S && i.F > j.F));
}

void test() {
   int k;
   cin >> k;

   for(int i = 1; i <= k; i++) {
      cout << "ACL";
   }
}

int main() {
   //freopen("input.txt","r",stdin);
   //freopen("output.txt","w",stdout);
   light;
   cout.precision(15);
   cout << fixed;

   int t = 1;
   //cin >> t;
   for(int i = 1; i <= t; i++) {
      //cout << "Case #" << i << ": ";
      test();
   }
   return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <cstring>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int ans;
int A, B;

int main(void) {
    scanf("%d %d", &A, &B);
    
    printf("%d\n", max(0, A-2*B));
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[100000], b[100000], c[100000];

int gcd(int a, int b) { 
   if (b == 0) 
      return a; 
   return gcd(b, a % b);  
} 

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    memcpy(b, a, sizeof a);
    memcpy(c, a, sizeof a);
    for (int i = 1; i < n; ++i)
        b[i] = gcd(b[i], b[i - 1]);
    for (int i = 1; i < n - 1; ++i)
        c[n - i - 1] = gcd(c[n - i], c[n - i - 1]);

    int sol = 0;
    for (int i = 0; i < n; ++i)
        sol = max(sol, gcd(i ? b[i - 1] : 0, i != n - 1 ? c[i + 1] : 0));
    cout << sol;
}


Measured memory_bytes: 1408
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>
#include<cmath>
#include<cstring>
#include<map>
#include<sstream>
#include<math.h>
 
using namespace std;

int N,K;
vector<int>X(100);

int main(){
  
  cin>>N>>K;
    
  for(int i=0; i < N; ++i) cin>>X[i];
  
  int sum=0;
  
  for(int i=0; i < N; ++i){
  	if(X[i] > K - X[i]){
    sum += ((K - X[i]) * 2);
    }else{
    sum += (X[i] * 2);
    }
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 256
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

int main(){

    
    cin >> A;
    cin >> B;
    cin >> C;

    cin >> K;
    if(K<=A){
        cout << K << endl;
    }else if(K<=A+B){
        cout << A << endl;
    }else{
        cout << A - (K-A-B) << endl;
    }
    

}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int X, A, B; cin >> X >> A >> B;
  auto y = B - A;
  if (y <= 0) {
    cout << "delicious" << CRLF;
  } else if (y <= X) {
    cout << "safe" << CRLF;
  } else {
    cout << "dangerous" << CRLF;
  }
  
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N,M;
int s[10];
int c[10];

int main(){
	cin>>N>>M;
	REP(i,M){
		cin>>s[i]>>c[i];
	}
	REP(i,1001){
		int cc=0;
		int temp=i;
		if(temp==0){
			cc=1;
		}else{
			while(temp!=0){
				cc++;
				temp/=10;
			}
		}
		if(cc!=N)continue;
		bool check=false;
		REP(k,M){
			int temp=i;
			REP(j,N-s[k]){
				temp/=10;
			}
			if(temp%10!=c[k]){
				check=true;
			}
		}
		if(check)continue;
		cout<<i<<endl;
		return 0;
	}
	
	cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int ans=0,i;
  char S[15];
  scanf("%s",S);
  for(i=0;i<15;i++){
    if(S[i]=='x'){
      ans=ans+1;
    }
  }
  if(ans>=8){
    printf("NO");
  }
  else{
    printf("YES");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
 
 
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-8;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

//ここから編集

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
    
  string s, t; cin >> s >> t;
  int ans = 0;
  for(int i=0; i<s.size(); i++){
    if(s[i] != t[i])ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3768
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#define ll long long
using namespace std;
map<ll,int> us;
ll d[100010];
ll che=0;
int n,cnt=0;
struct node{
	int to,nxt,cap;
}e[200010];
int pos[100010],siz[100010],head[100010],ansa[100010],ansb[100010];
bool cmp(int a,int b){
	return d[a]>d[b];
}
void add(int u,int v){
	e[++cnt].to=v;e[cnt].nxt=head[u];head[u]=cnt;
	e[++cnt].to=u;e[cnt].nxt=head[v];head[v]=cnt;
}
void dfs(int x,int fa,int dep){
	che+=dep;
	int i;
	for(i=head[x];i;i=e[i].nxt){
		if(e[i].to==fa)  continue ;
		dfs(e[i].to,x,dep+1);
	}
}
int main(){
	scanf("%d",&n);
	int i,j;
	for(i=1;i<=n;++i){
		scanf("%lld",&d[i]);us[d[i]]=i;siz[i]=1;pos[i]=i;
	}
	sort(pos+1,pos+1+n,cmp);
	for(i=1;i<n;++i){
		ll x=d[pos[i]]-(n-siz[pos[i]])+siz[pos[i]];
		if(!us[x] || x>=d[pos[i]]){printf("-1\n");return 0;}
		ansa[i]=us[x];ansb[i]=pos[i];
		add(us[x],pos[i]);
		siz[us[x]]+=siz[pos[i]];
	}
	dfs(pos[n],0,0);
	if(che!=d[pos[n]]){printf("-1\n");return 0;}
	for(i=1;i<n;++i)  printf("%d %d\n",ansa[i],ansb[i]);
	return 0;
}

Measured memory_bytes: 15104
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>

using namespace std;

int t, p, r;
int ac[55][55], wa[55][55];
int cnt[55], score[55];
vector<pair<pair<int,int> , int> > vec;

int main(void)
{
  while(1){
    cin >> t >> p >> r;
    if(t == 0 && p == 0 && r==0) break;

    for(int i = 1; i <= t; i++){
      for(int j = 1; j <= p; j++){
        ac[i][j] = -1;
        wa[i][j] = 0;
      }
      cnt[i] = score[i] = 0;
    }

    int tid, pid, tm; string s;
    for(int i = 0; i < r; i++){
      cin >> tid >> pid >> tm >> s;
      if(ac[tid][pid] != -1) continue;
      if(s == "CORRECT"){
        cnt[tid]++;
        ac[tid][pid] = 1;
        score[tid] += wa[tid][pid]*1200 + tm;
      }
      else{
        wa[tid][pid]++;
      }
    }
    vec.clear();
    for(int i = 1; i <= t; i++){
      vec.push_back(make_pair(make_pair(-cnt[i], score[i]), i));
    }
    sort(vec.begin(), vec.end());
    for(int i = 0; i < vec.size(); i++){
      cout << vec[i].second << " " << -vec[i].first.first << " " << vec[i].first.second << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3208
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
#include <float.h>
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
typedef unsigned long long ll;

// 最大公約数求める関数
int my_gcd(int n , int m){
  if(n < m){
    int tmp = n;
    n = m;
    m = tmp;
  }
  int l  = n % m;
  while(l != 0){
    n = m;
    m = l;
    l = n % m;
}
return m;
}

//char⇒int関数
 int ctoi(char c) {
 	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}



int main(){
ll A,B,K; cin >> A >> B >> K;
ll a,b;
a = A - min(A,K);
b = K - min(A,K);
if(b > 0){
  if(b > B){
    b = 0;
  }
  else{
    b = B - b;
  }
}
else{
  b = B;
}
  cout << a << " " << b << endl;
  }


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

int f(int x) {
  int out = 0;
  while (x >= 1) {
    out += x%10;
    x /= 10;
  }
  return out;
}

int main() {
  int N;
  cin >> N;
  if (N % f(N) == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 384
from itertools import groupby
N = int(input())
S = input()
ans = []
#S1 = groupby(S)
a=0
a1=0
b=0
b1=0
S1 = groupby(list(S))
for key,group in S1:
  group = list(group)
  if list(key)==['(']:
    a1+=len(group)
  else:
    if a1<=len(group):
      b1+=len(group)-a1
      a1 = 0
    else:
      a1 -=len(group)
S = S+")"*a1
S = "("*b1+S
print(S)

Measured memory_bytes: 3064
def main21():
    data = input().split()
    num = []
    for i in range(3):
        num.append(int(data[i]))
    for i in range(10):
        num[2] = num[2] * num[0] - num[1]
        print(num[2])

if __name__ == "__main__":
    main21()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int k,a,b;
    cin >> k >> a >>b;
    for(int i=0;i<10000;i++){
        ll che = i*k;
        if(a<=che&&che<=b){
            cout <<"OK"<<endl;
            return 0;
        }
    }
    cout << "NG"<<endl;
}
    



Measured memory_bytes: 3672
#include <iostream>

using namespace std;


int main(){
    int grid[3][3];
    int a[3], b[3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> grid[i][j];
        }
    }
    a[0] = 0;
    for(int j=0;j<3;j++){
        b[j] = grid[0][j];
    }
    for(int i=1;i<3;i++){
        a[i] = grid[i][0] - b[0];
    }

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(grid[i][j] != a[i] + b[j]){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;

    return 0;
    
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, C, K = MAP()
tN = [INT() for i in range(N)]

tN.sort()
ans = 0
bus = 0
timer = K
for i in range(N):
    if 1 <= bus <= C-1:
        timer -= tN[i] - tN[i-1]
        # 時間が過ぎていたら今のバスは出発済にする
        if timer < 0:
            ans += 1
            bus = 0
            timer = K
    # 1,2人目は普通に乗せる
    if 0 <= bus <= C-2:
        bus += 1
    # 3人目が乗ったら出発
    elif bus == C-1:
        ans += 1
        bus = 0
        timer = K
# 未出発のバスを出発させる
if bus != 0:
    ans += 1
print(ans)


Measured memory_bytes: 9632
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define popb pop_back
#define popf pop_front
#define int long long int
#define vi         vector<int>
#define vll        vector<ll>
#define vpii       vector<pair<int,int>>
#define vpll       vector<pair<ll,ll>>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(container) int((container).size())
#define rep(i,a,b) for(i=a;i<b;i++)
#define tr(container,it)   for(auto it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())      //set,map etc.
#define cpresent(container, element) (find(all(container),element) != container.end())    //vector
#define hell 1000000007
#define PI 3.14159265
#define mod 998244353
#define fs first
#define sc second
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
void solve()
{
  int n,i,j,c=0;
  cin>>n;
  int a[n+1];
  map<int,int>m;
  rep(i,1,n+1)
  {
    cin>>a[i];
    m[a[i]]++;
  }
  tr(m,it)
  {
    c+=((it->sc)*(it->sc-1))/2;
  }
  rep(i,1,n+1)
  {
    cout<<c-((m[a[i]]*(m[a[i]]-1))/2)+
    ((m[a[i]]-1)*(m[a[i]]-2))/2;
    cout<<endl;
  }
}
signed main()
{
  fastio
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  int t;
  t=1;
  //cin>>t;
  while(t--)
  solve();
  TIME
  return 0;
}

Measured memory_bytes: 11136
#pragma GCC optimize ("O3")
#include <iostream>
#include <algorithm>
 
inline void fastin(int &num) {
    bool neg = false;
    int c;
    num = 0;
    c = getchar_unlocked();
    if (c == '-') {
        neg = true;
        c = getchar_unlocked();
    }
    for (; (c > 47 && c < 58); c = getchar_unlocked()) num = num * 10 + c - 48;
    if (neg) num *= -1;
}
 
inline void fastout(int64_t n) {
    int64_t N = n, rev, count = 0;
    rev = N;
    if (N == 0) { putchar_unlocked('0'); putchar_unlocked('\n'); return ;}
    while ((rev % 10) == 0) { ++count; rev /= 10;}
    rev = 0;
    while (N != 0) { rev = (rev<<3) + (rev<<1) + N % 10; N /= 10;}
    while (rev != 0) { putchar_unlocked(rev % 10 + '0'); rev /= 10;}
    while (count--) putchar_unlocked('0');
}
     
int main(){
    int N; fastin(N);
    int a; int64_t s[N] = {};
    fastin(a); s[0] = a;
    for (int i = 1; i < N; ++i){
      int t; fastin(t);
      s[i] = t + s[i - 1];
    }
    
    std::sort(s, s + N);
     
    int64_t ans = 0;
    int beg = 0;
     
    for (int i = 0; i < N; ++i) {
        if (s[i] == 0) ++ans;
    }
     
    while (beg < N){
        int end = beg;
        while (end + 1 < N && s[end + 1] == s[beg]) ++end;
        int64_t len = end - beg + 1;
        ans += len * (len - 1) / 2;
        beg = end + 1;
    }
    fastout(ans);         
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int i,sum=0;
  int N=n;
  for(i=0;i<10;i++){
    sum+=N%10;
    N/=10;
  }
  if(n%sum==0){
    cout << "Yes";
  }else{
    cout << "No";
  }
}
    


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
	int X, Y;
	cin >> X >> Y;

	int cnt = 0;
	while (X <= Y) {
		cnt++;
		X *= 2;
	}

	cout << cnt << endl;

    return 0;
}


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

int main(void){
    int n, m;
    cin >> n >> m;
    vector<int> p(m), y(m), l(m), num(n);
    vector<pair<int, int>> post(m);
    vector<pair<int, int>> city(m);
    for (int i = 0; i < m; i++) {
        cin >> p[i] >> y[i];
        post[i] = make_pair(y[i], p[i]);
        city[i] = make_pair(y[i], i);
    }
    for (int i = 0; i < n; i++) num[i] = 0;
    sort(post.begin(), post.end());
    sort(city.begin(), city.end());
    
//    for (int i = 0; i < m; i++) cout << city[i].second << "," << post[i].second << "," << post[i].first << endl;
    
    for (int i = 0; i < m; i++) {
        num[post[i].second]++; // 県番号
        l[city[i].second] = num[post[i].second];
    }
    
    for (int j = 0; j < m; j++) {
        int tmp = 0, pp = p[j];
        while (pp != 0) {
            tmp++;
            pp /= 10;
        }
        for (int i = 0; i < 6 - tmp; i++) cout << "0";
        cout << p[j];
        tmp = 0;
        int ll = l[j];
        while (ll != 0) {
            tmp++;
            ll /= 10;
        }
        for (int i = 0; i < 6 - tmp; i++) cout << "0";
        cout << l[j] << endl;
    }
    
}


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

int main()
{
    int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    cin >> K;
    cout << a[K-1] << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()

#define READ(x) (cin >> (x))

#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))

int main() {
    // get values from input
    string S;

    READ(S);

    // main procedure
    bool is_simular = (S[2] == S[3]) && (S[4] == S[5]);

    // output
    WRITE_N(is_simular ? "Yes" : "No");

    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

bool mmnmm(vi &dp, vi &data, int k)
{
    if (dp[k] == -1) {
      return false;
    } else if (dp[k] == 1) {
      return true;
    }
    bool state = true;
    rep(i, data.size()) {
        if (k >= data[i]) {
            state &= mmnmm(dp, data, k - data[i]);
        }
    }
    if (state) {
      dp[k] = -1;
      return false;
    } else {
      dp[k] = 1;
      return true;
    }
    //return dp[k] = state;
}

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

    int2(n, k);
    vi data(n);
    rep(i, n) {
        cin >> data[i];
    }

    vi dp(k+1, 0);
    if (mmnmm(dp, data, k)) {
        cout << "First" << endl;
    } else {
        cout << "Second" << endl;
    }
  
  rep(i, dp.size()) {
   // cout << dp[i] << " ";
  }

    return 0;
}


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

public class Main {

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

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      final int n = Integer.parseInt(br.readLine());
      String op;
      String[] words;
      Tree tree = new Tree();

      for(int i=0,k=0; i<n; i++,k=0){
        words = br.readLine().split(" ");
        op  = words[k++];
        if ( op.equals("insert") ) { 
          tree.insert(Integer.parseInt(words[k++]));
        }
        else {
          tree.dispRoundPath();
        }
      }

    }
    catch(IOException e) {
      System.out.println("IOException!");
    }
  }
}

class Tree {

  static final BTreeNode NIL = new BTreeNode(-1);
  BTreeNode root;
  StringBuilder buf;

  public Tree() {
    root = NIL;
    buf = new StringBuilder();
  }

  public void insert(int val) {
    BTreeNode y = NIL;
    BTreeNode x = root;
    BTreeNode z = new BTreeNode(val);

    while( !x.equals(NIL) ) {
      y = x;
      if( z.key < x.key )
        x = x.left;
      else
        x = x.right;
    }
    z.parent = y;

    if( y.equals(NIL) ){
      root = z;
    }
    else if( z.key < y.key )
      y.left = z;
    else
      y.right = z;
  } 
  void preParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      buf.append(" ").append(u.key);
      preParse(u.left);
      preParse(u.right);
    }
  }
  void inParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      inParse(u.left);
      buf.append(" ").append(u.key);
      inParse(u.right);
    }
  }

  void dispRoundPath() {

    inParse(root);
    buf.append("\n");
    preParse(root);
    buf.append("\n");

    System.out.print(buf);
    buf.setLength(0);
  }
}

class BTreeNode {
  int key;
  BTreeNode parent,left,right;

  public BTreeNode(int key) {
    this.key = key;
    this.parent =
    this.left =
    this.right = Tree.NIL;
  }

  @Override
  public boolean equals(Object o) {
    if(o == this) return true;
    if(o == null) return false;
    if(!(o instanceof BTreeNode)) return false;

    BTreeNode node = (BTreeNode)o;
    if(!(this.key == node.key)) return false;

    return true;
  }
}


Measured memory_bytes: 125356
#include <bits/stdc++.h>
 
using namespace std;
int main(void){
    long long H;
    cin >> H;
 
    long long sum;
    int i = 0;
  
    while (H != 0) {
      H = H / 2;
      sum += pow(2,i);
      i += 1;
    }
  cout << sum;
   return 0; 
}

Measured memory_bytes: 256