akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ABC100D_EX
{
    public class Program
    {
        struct Cake
        {
            public long X;
            public long Y;
            public long Z;

            public Cake(long x, long y, long z)
            {
                X = x;
                Y = y;
                Z = z;
            }
        }

        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var N = ss.Next(int.Parse);
            var M = ss.Next(int.Parse);

            var Cakes = new Cake[N];
            for (var i = 0; i < N; i++)
            {
                Cakes[i] = new Cake(ss.Next(long.Parse), ss.Next(long.Parse), ss.Next(long.Parse));
            }

            var ans = 0L;
            for (var i = -1; i <= 1; i += 2)
            for (var j = -1; j <= 1; j += 2)
            for (var k = -1; k <= 1; k += 2)
            {
                ans = Math.Max(ans, Cakes.Select(c => c.X * i + c.Y * j + c.Z * k)
                    .OrderByDescending(x => x)
                    .Take(M)
                    .Sum());
            }

            sw.WriteLine(ans);
            //---------------------------------
        }

        static void Main()
        {
            var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput()));
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            new Program().Solve(ss, sw);
            sw.Flush();
        }

        static readonly Func<string, string> String = s => s;
    }

    public class StreamScanner
    {
        static readonly char[] Sep = { ' ' };
        readonly Queue<string> buffer = new Queue<string>();
        readonly TextReader textReader;

        public StreamScanner(TextReader textReader)
        {
            this.textReader = textReader;
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (buffer.Count != 0) return parser(buffer.Dequeue());
            var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries);
            foreach (var nextString in nextStrings) buffer.Enqueue(nextString);
            return Next(parser);
        }

        public T[] Next<T>(Func<string, T> parser, int x)
        {
            var ret = new T[x];
            for (var i = 0; i < x; ++i) ret[i] = Next(parser);
            return ret;
        }

        public T[][] Next<T>(Func<string, T> parser, int x, int y)
        {
            var ret = new T[y][];
            for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);
            return ret;
        }
    }
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0;}
template<class T>bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0;}

using ll = long long;
using R = long double;
const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max(x, 0.0L));}

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

// Problem Specific Parameter:

const int limit = 5010;
vector<int> graph[limit];

bool used[limit];
int match[limit];

bool dfs(int v) {
	used[v] = true;
	for (auto &u : graph[v]) {
		const int w = match[u];
		if (w == -1 or (used[w] == false and dfs(w))) {
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

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

	fill_n(match, n + 1, -1);
	int ans = 0;

	rep(v, 1, n + 1) {
		int u;
		cin >> u;
		graph[u].push_back(v);
		graph[v].push_back(u);
		fill_n(used, n + 1, false);
		if (dfs(v)) ans++;
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3468
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let A: usize = read();
    let B: usize = read();
    for i in 0..5000 {
        if (i as f64 * 0.08).floor() as usize == A && (i as f64 * 0.1).floor() as usize == B {
            println!("{}", i);
            return;
        }
    }
    println!("-1");
}


Measured memory_bytes: 4352
import java.io.InputStream
import java.io.BufferedReader

fun main(args: Array<String>) {
  val inputStream = System.`in`
  val reader = inputStream.bufferedReader()
  val x = reader.readLine()!!
  for(i in IntRange(1,Integer.parseInt(x))) {
    val s = reader.readLine()!!
    val e = s.split(' ').map{ Integer.parseInt(it) }
                        .map{ z -> z*z }
                        .sorted()
    if(e[0]+e[1] == e[2]) println("YES")
    else println("NO")
  }
}


Measured memory_bytes: 32460
#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 pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define int               long long
#define fr                first
#define sc                second
#define vc                vector
#define endl              '\n'
#define pii               pair<int,int>
#define msi               map<string,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define LSB(i)            ((i)&-(i))

template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 1e5 + 5;
int n, m;
vc<int>g[N];
int dp[N];

int DFS(int v)
{
    if (dp[v] != -1)
        return dp[v];
    int ans = 0;
    for (auto u : g[v])
    {
        ans = max(ans, DFS(u) + 1);
    }
    dp[v] = ans;
    return ans;
}

void solve()
{
    cin >> n >> m;
    mem1(dp);
    for (int i = 1; i <= m; i++)
    {
        int x, y;
        cin >> x >> y;
        g[x].pb(y);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        ans = max(ans, DFS(i));
    }
    cout << ans;
}
signed main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

Measured memory_bytes: 8576
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()


//library mod int
template <int mod>
struct modint{
    ll x;

    //constructor
    modint(ll x=0): x((x%mod+mod)%mod){}

    //unary operator
    modint operator-() const { return modint(mod-x);}
    modint inv() const { return this->pow(mod-2);}
    
    //compound assignment
    modint& operator+=(const modint& a){
        if((x+=a.x)>=mod) x-=mod;
        return *this;
    }
    modint& operator-=(const modint& a){
        if((x-=a.x)<0) x+=mod;
        return *this;
    }
    modint& operator*=(const modint& a){
        (x*=a.x)%=mod;
        return *this;
    }
    modint& operator/=(const modint& a){
        return *this *= a.inv();
    }

    //arithmetic
    // なぜmodintの後ろに＆を書いたり書かなかったりしてるかの理解ができていない
    //おそらく＆をつけるとポインタで参照しているのでもとの値を書き換えることができる
    //＆をつけないとコピーを作ってからそれに対して計算するので、もとの値は変更されない
    modint operator-(const modint& a) const {return modint (*this) -= a ; }
    modint operator+(const modint& a) const {return modint (*this) += a ; }
    modint operator*(const modint& a) const {return modint (*this) *= a ; }
    modint operator/(const modint& a) const {return modint (*this) /= a ; }
    //n should not be smaller than 0.
    modint pow(ll n) const{
        auto x=modint(1);
        auto m=*this;
        while(n>0){
            if(n&1) x*=m;
            n>>=1;
            m*=m;
        }
        return x;
    }

    //compare
    bool operator==(const modint& a) const {return x==a.x ; }
    bool operator!=(const modint& a) const {return x!=a.x ; }

    //I/O
    friend istream& operator>>(istream& is, modint& a ) noexcept {return is >> a.x ; }
    friend ostream& operator<<(ostream& os, const modint& a ) noexcept {return os << a.x ; }
};

//modの調整
constexpr int mod = 1e9 + 7;
using mint = modint<mod>;

//////////////////////////////////////////////////////////////////////
//combination
vector<mint> mintcombvector;
int startmintcomb(int n){
    mintcombvector.push_back(0);
    mintcombvector.push_back(1);
    rep(i,n) mintcombvector.push_back(mintcombvector[i+1]*(i+2));
    return 0;
}
mint comb(mint a, mint b){
    if(a.x<b.x || a.x<=0 || b.x<0) return mint(0);
    if(b.x==0) return mint(1);
    if(a==b) return mint(1);
    return mintcombvector[a.x]*(mintcombvector[b.x].inv())*(mintcombvector[a.x-b.x].inv());
}
//combinationを使いたいときは　startmintcomb(n=代入したい数の最大値); を始めに打つこと




int main(){
    startmintcomb(3e6);
    int nn,mm;
    cin>>nn>>mm;
    mint n(nn), m(mm);
    map<int,int> pr;
    int kari=m.x;
    for(int i=2; i*i<m.x+1; ++i){
        if(kari%i==0){
            while(kari%i==0){
                pr[i]++;
                kari/=i;
            }
        }
    }
    if(kari!=1) pr[kari]++;
    mint ans(1);
    for(auto& v: pr){
        mint a=v.second;
        a+=n.x-1;
        ans*=comb(a,v.second);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define mp       make_pair
#define mt	  make_tuple
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF=1<<29;
const double EPS=1e-9;
const ll MOD = 1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int N;
vector<int> diff;
vector<int> A;
map<int, int> deg;

int main(){
  cin >> N;
  A.resize(N);
  for (auto &val : A){
    cin >> val;
    deg[val]++;
  }
		       
  int left = 0;
  int right = N - 1;
  for (int i = 0; i < N; i++){
    diff.push_back(abs(right - left));
    right--;
    left++;
  }
  ll res = 1;
  for (auto &val : diff){
    res *= deg[val];
    res %= MOD;
    deg[val]--;
    //cout << val << " ";
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 4860
#include <iostream>
using namespace std;
int main(void){
    int S, h, m, s;
    cin >> S;
    h = S/(60*60);
    m = S%(60*60)/60;
    s = S%60;
    cout << h << ":";
    cout << m << ":";
    cout << s << endl;
    // Your code here!
    
}



Measured memory_bytes: 3084
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;

string S;

int main()
{
	cin>>S;
	for(int i=0;i<S.length();i++)
	{
		if((i+1)&1)
		{
			cout<<S[i];
		}
	}
	puts("");
	return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
#define Rushia_mywife ios::sync_with_stdio(0);cin.tie(0);
#define rep(i,head,n) for(int i=(head);i<n;i++)
#define int long long
#define F first
#define S second
#define pb push_back
#define p2(n) (1<<(n))
#define lg2(n) __lg(n)
using namespace std;
using pii = pair<long long,long long>;
using ld = long double;
mt19937 mt_rand(time(0));
const int mod = 1000000007;
const int hnum = 998244353;
const ld PI = acos(-1);

int n,m;
int sx,sy,ex,ey;
int a[1001][1010];
int dx[] = {1,-1,0,0};
int dy[] = {0,0,-1,1};

bool can(int x,int y){
    return x>0&&x<=n&&y>0&&y<=m;
}

void solve(){
    cin >> n >> m;
    cin >> sx >> sy;
    cin >> ex >> ey;
    rep(i,1,n+1){
        rep(j,1,m+1){
            char x; cin >> x;
            if(x=='.')
                a[i][j] = 0;
            else
                a[i][j] = 1;
        }
    }
    deque<pair<pii,int>>q;
    q.push_back({{sx,sy},0});
    while(!q.empty()){
        pair<pii,int>now = q.front();
        q.pop_front();
        if(now.F.F==ex&&now.F.S==ey){
            cout << now.S << '\n';
            return;
        }
        if(a[now.F.F][now.F.S])
            continue;
        a[now.F.F][now.F.S] = 1;
        rep(i,0,4)
            if(can(now.F.F+dx[i],now.F.S+dy[i])&&!a[now.F.F+dx[i]][now.F.S+dy[i]])
                q.push_front({{now.F.F+dx[i],now.F.S+dy[i]},now.S});
        rep(i,-2,3)
            rep(j,-2,3)
                if(can(now.F.F+i,now.F.S+j)&&!a[now.F.F+i][now.F.S+j])
                    q.push_back({{now.F.F+i,now.F.S+j},now.S+1});
    }
    cout << -1 << '\n';
}

signed main(){
    Rushia_mywife
    solve();
}

Measured memory_bytes: 12888
#include <iostream>
#include <vector>
int main(void){
    
    std::string s;
    std::cin >> s;
    int n = s.length() - 1;
    long long ans = 0;
    for (int bit = 0; bit < (1<<n); bit++) {
        long long sum = 0;
        std::vector<long long> check;
        std::string elm = "";
        for (int i = 0; i < n+1; i++) {
            elm += s[i];
            if (i < n+1 && bit & (1<<i)) {
                check.push_back(std::stoll(elm));
                elm = "";
            }
        }
        check.push_back(std::stoll(elm));
        for (int i = 0; i < check.size(); i++) {
            sum += check[i];
        }
        ans += sum;
    }
    
    std::cout << ans << std::endl;
    
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define INF 900000000

using namespace std;

int main()
{

	while(true){	
		int H,W,k=0;
		cin>>H>>W;
		if(H==0&&W==0) break;
		while (k<H)
		{	
			for(int i=0;i<W;i++){
				cout<<"#";
			}
			cout<<endl;
			k++;
		}
		cout<<endl;
	}
   return 0;
}



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

int main(){
  int n,k;
  cin>> n >> k;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin>> a[i];
  
  //全丸太の長さをx以下にするのに必要な回数がk以下になる最小のxを二分探索？
  double left=0, right=1e9; //left:不可能 right:可能
  int64_t count=0;
  while(right-left>1){
    double x=(left+right)/2.0;
    count=0;
    for(int i=0; i<n; i++){
      double cut=a[i]/x;
      if(cut==(int)cut) cut-=1;
      count+=(int)cut;
    }
    if(count<=k) right=x;
    else left=x;
  }
  
  int ans=(int)right; //ここで right<1 だと ans=0 で divided by 0 になる
  if(ans==0){
    cout<< 1 << endl;
    return 0;
  }
  count=0;
  for(int i=0; i<n; i++){
    count+=(a[i]-1)/ans;
  }
  if(count>k) ans++;
  cout<< ans << endl;
}

Measured memory_bytes: 3916
if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split(' ')))
    A.sort()
    Alice = 0
    Bob = 0
    turn = True
    for _ in range(N):
        if turn:
            Alice += A.pop()
            turn = False
        else:
            Bob += A.pop()
            turn = True
            
    print(abs(Alice - Bob))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e3+20;
string s;
int main()
{
	while(cin>>s)
	{
		int p=0,ans=0;
		for(int i=0;s[i];i++)
		{
			if(i%2&&s[i]=='g')
				ans++;
			if(i%2==0&&s[i]=='p')
				ans--;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int N, X;
    scanf("%d %d",&N, &X);

    vector<int> m(N);
    for(int i=0;i<N;i++){
        scanf("%d",&m[i]);
    }

    int amari=X;
    int D=0;

    for(int i=0;i<N;i++){
        amari-=m[i];
        D+=1;
    }
    int P;
    P=*min_element(m.begin(),m.end());
    D+=amari/P;
        printf("%d\n",D);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <queue>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) find(Range(c), x) != c.end()
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, n, m, xs, x) vector<vector<T>> xs(n, vector<T>(m, x))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs, 0); For(i, n) For(j, m) cin >> xs[i][j]
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"

using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    Cins(int, n, d);
    Sort(d);
    d.erase(unique(Range(d)), d.end());
    Cout(d.size());
}


Measured memory_bytes: 892
from collections import defaultdict
import sys
input = sys.stdin.readline
inf = float('INF')

n, m = map(int, input().split())
if m == 0:
    print('Yes')
    exit()
edges = defaultdict(list)

for i in range(m):
    left, right, dist = map(int, input().split())
    edges[left-1].append([right-1, dist])
    edges[right-1].append([left-1, -dist])

seen = [inf] * n
for node in range(n):
    if seen[node] != inf:
        continue

    seen[node] = 0
    todo = []
    while edges[node]:
        to, dis = edges[node].pop()
        todo.append([to, dis])
    while todo:
        new, dis = todo.pop()
        if seen[new] == inf:
            seen[new] = dis
        elif seen[new] != dis:
            print('No')
            exit()

        while edges[new]:
            to, n_dis = edges[new].pop()
            todo.append([to, dis + n_dis])

print('Yes')


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

namespace ProblemA
{
    class Program
    {
        static void Main(string[] args)
        {
            var read = Console.ReadLine();
            Console.WriteLine(read.ToLower() == read ? "a" : "A");
        }
    }
}


Measured memory_bytes: 26300
#include <stdio.h>
int main(void){
    int a,b;
    char op;
        while(1){
            scanf("%d %c %d",&a,&op,&b);
            if(op=='?') break;
            if(op=='+'){
                printf("%d\n",a+b);
            }
            else if(op=='-'){
                printf("%d\n",a-b);
            }
            else if(op=='*'){
                printf("%d\n",a*b);
            }
            else if(op=='/'){
                printf("%d\n",a/b);
            }
        }
    return 0;
}


Measured memory_bytes: 2756
#include <stdio.h>

int main(void){
    int n, x;
    scanf("%d%d", &n, &x);
    int L[n];
    int count = 1;
    int d = 0;
    for(int i = 0; i < n; i++){
        scanf("%d", &L[i]);
        d += L[i];
        if(d <= x){
            count += 1;
        }
    }
    printf("%d\n", count);
    return 0; 
}

Measured memory_bytes: 128
/*
 * “My code isn't a mess! It's organised chaos!”
 */

/*
 * short     2^15-1 ~ 3e4
 * int       2^31-1 ~ 2e9
 * long x86  2^31-1 ~ 2e9
 * long long 2^63-1 ~ 9e18
 */

#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define fr(a,b) for (int a=0; a<b; ++a)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1000000007ll;
const int infty = numeric_limits<int>::max();
struct _{_(){ios_base::Init i;ios_base::sync_with_stdio(0);cin.tie(0);}}_;
void err() {cerr << endl;}
template<typename T, typename... Ts>
void err(T a, Ts... as) {cerr << a << ' '; err(as...);}

 /*
  * Всегда прогоняй макс-тест перед 
  * нажатием «Отослать». Всегда.
  */ 

int main() {
    int n;
    cin >> n;
    vector<int> mincount(26);
    string s;
    fr(i,n) {
        cin >> s;
        vector<int> count(26);
        for (char c : s) {
            count[c - 'a']++;
        }
        if (!i) {
            mincount = count;
        } else {
            fr(j,26) {
                mincount[j] = min(mincount[j], count[j]);
            }
        }
    }

    fr(i,26) {
        fr(j,mincount[i]) {
            cout << char('a' + i);
        }
    }
    cout << endl;

    return 0;
}

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

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define loop(i,a,b) for(int (i)=(a);(i)<(b);++(i))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;


int main(void){
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int count = 0;
  a++;b++;c++;
  rep(i,a)rep(j,b)rep(k,c)
    if(i * 500 + j * 100 + k * 50 == x)count ++;
    
  cout<<count<<endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#define N 101

int main()
{
  int i,j,n,count=0,v,c,c1,v1;
  int G[N][N],col[N],d[N],pi[N],mincost,i2;

  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++)
      G[i][j] = -1;
  }

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    scanf("%d%d",&v,&c);
    for(j = 0; j < c; j++){
      scanf("%d%d",&v1,&c1);
      G[v][v1] = c1;
    }
  }

  for(i = 0; i < n; i++){
    col[i] = 0;
    pi[i] = -1;
    d[i] = 10000001;
  }

  d[0] = 0;

  while(1){
    mincost = 10000001;
    for(i = 0; i < n; i++){
      if(col[i] != 2 && d[i] < mincost){
        mincost = d[i];
        i2 = i;
      }
    }
    if(mincost == 10000001)break;

    col[i2] = 2;


    for(i = 0; i < n; i++){
      if(G[i2][i] != -1 && col[i] != 2 && (G[i2][i]+d[i2]) < d[i]){
        pi[i] = i2;
        d[i] = G[i2][i] + d[i2];
        col[i] = 1;
      }
    }
  }
  for(i = 0; i < n; i++)printf("%d %d\n",i,d[i]);
    return 0;
}

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

int main()
{
    long long a, b, c;
    std::cin >> a >> b >> c;
    long long bite1;
    long long bite2;
    if (a + b >= c)
    {
        bite1 = a <= c ? a : c;
        bite2 = c - bite1;
    }
    else
    {
        bite1 = a;
        bite2 = b;
    }
    std::cout << a - bite1 << " " << b - bite2 << std::endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
#include <iterator>
 
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
 
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

typedef pair<float, float> point;
typedef vector<point> segments;


void print_array(segments list)
{
	for (int i = 0; i < list.size(); i++)
	{
		cout << list[i].fr << " " << list[i].sc << endl;
	}
}

void print_point(point pt)
{
	cout << pt.fr << " " << pt.sc << endl;
}



void koch(int n, point p1,point p2)
{
	if (n == 0)
	{
		return;
	}
	point s=std::make_pair((2*p1.first+p2.first)/3,(2*p1.second+p2.second)/3);
    point t=std::make_pair((p1.first+2*p2.first)/3,(p1.second+2*p2.second)/3);
    float ux=(s.first+std::cos(M_PI*60/180)*(t.first-s.first)-std::sin(M_PI*60/180)*(t.second-s.second));
    float uy=(s.second+std::sin(M_PI*60/180)*(t.first-s.first)+std::cos(M_PI*60/180)*(t.second-s.second));
    point u=std::make_pair(ux,uy);
    koch(n-1, p1, s);
    print_point(s);
    koch(n-1, s, u);
    print_point(u);
    koch(n-1, u, t);
    print_point(t);
    koch(n-1, t, p2);

}

int main()
{
	int n; cin >> n;
	segments segment;
	point p1 = mp(0, 0);
	point p2 = mp(100, 0);
	print_point(p1);
	koch(n, p1, p2);
	print_point(p2);
	return 0;
}

Measured memory_bytes: 3252
#include<bits/stdc++.h>
using namespace std;
typedef		long long       ll;
typedef         long double      dl;
typedef     unsigned long long  ull;
#define		pb              push_back
#define		PB              pop_back
#define		nn              "\n"
#define     O_O             ios_base::sync_with_stdio(false); cin.tie(NULL)
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define		ss              ' '
#define         arrsize(a)      (sizeof(a)/sizeof(a[0]))
//#define       arrsize(a)      (sizeof(a)/sizeof(*a))
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
#define		pi              acos(-1.0)
typedef        pair <int, int>   pii;
typedef       pair <ll, ll>      pll;
typedef      vector< pair <ll, ll> >      vpll;
typedef		vector<ll>      vll;
typedef		map<string,ll>      msl;
typedef		map<ll,ll>      mll;
#define yes cout << "YES\n"
#define no cout<<"NO\n"
//#define sort(x) sort(x.begin(), x.end())
//sort(a,a+n,greater<ll>())
//for (auto it = mp.begin(); it != mp.end(); ++it){}
#define MAX 1000005
#define mod 1000000007



int main()
{
 //O_O ;
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
 ll temp=a/d,temp3=c/b;
 ll temp2=a%d,temp4=c%b;
 //c
 if(temp2)
    temp++;
    if(temp4)
        temp3++;
        //cout<<temp<<ss<<temp3<<nn;
    if(temp>=temp3)
        cout<<"Yes"<<nn;
    else
        cout<<"No"<<nn;



    return 0;
}


Measured memory_bytes: 3620
s = input()
check = True
count_C = s[2:-1].count("C")
for i in range(len(s)):
    if i == 0:
        if not (s[i] == "A"):
            check = False
    elif i == 1:
        if not (s[i].islower()):
            check = False
    else:
        if not(s[i].islower()) and not(s[i] == "C"):
            check = False
if check and count_C == 1:
    print("AC")
else:
    print("WA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  string s,t; cin >> s >> t;
  bool ans=true;
  if(s.size()+1!=t.size()) ans=false;
  if(s.size()+1==t.size()){
    rep(i,s.size()) {
      if(s.at(i)!=t.at(i)) ans=false;
    }
  }
  
  if(ans==true) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 3620
import itertools
n = int(input())
l = sorted(list((map(int, input().split()))))
res = 0
pos = list(itertools.combinations(l, 3))
for pos_i in pos:
    pos_i = sorted(list(pos_i))
    if len(set(pos_i)) < 3:
        continue
    if pos_i[-1] < pos_i[0] + pos_i[1]:
        res += 1
print(res)


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

using namespace std;

typedef long long ll;

ll abs(ll a, ll b){
  if( a > b){return a - b;}
  else{return b - a;}}


int main(){
  int N,M; cin >> N >> M;
  vector<pair<ll,ll>> X(N);
  for(int i = 0; i < N; i++){ cin >> X[i].first >> X[i].second;}
  vector<pair<ll,ll>> Y(M);
  for(int j = 0; j < M; j++){ cin >> Y[j].first >> Y[j].second;}
  
  for(int i = 0; i < N; i++){ //iは生徒のナンバー 0-indexed
    ll ans = 1; ll min_distance = 1e9;
    for(int j = 0; j < M ; j++){
     ll s = abs(X[i].first ,Y[j].first)+abs(X[i].second ,Y[j].second);
      if( s < min_distance){ ans = j + 1; min_distance = s;}
      else{continue;}
       
       ;}
  
  cout << ans << endl;}

return 0;}
      


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long md=1000000000;
#define re 
int main()
{
	re long long S,a;
	scanf("%lld",&S);
	a=(S+md-1)/md;
	printf("0 0 %lld %lld %lld %lld\n",a,1ll,a*md-S,md);
}

Measured memory_bytes: 256
/**
*   Bismillahir Rahmanir Rahim.
*   Imtiaz_rafi
*   PCIU, CHITTAGONG
**/
#include<bits/stdc++.h>
using namespace std;
#define speed() ios::sync_with_stdio(0);cin.tie(0);
#define file() freopen ("input.txt", "r", stdin);freopen ("output.txt", "w", stdout);
#define rep(i,a) for(ll i=0;i<a;i++)
#define rep1(i,begin,end) for(ll i=begin;i<=end;i++)
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(v)   v.begin(),v.end()
#define rall(v)   v.rbegin(),v.rend()
#define pb push_back
#define pf push_front
#define mp make_pair
#define pi acos(-1)
#define MOD 1e9+7
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
// bitshift (1LL<<(3)) *2^3
typedef long long int ll;
typedef vector<ll>vi;
typedef map<ll,ll>mi;
typedef pair<ll,ll>pll;
typedef set<ll>st;
typedef set<char>sc;
ll dx[] ={-1,+1,0,0,+1,-1,+1,-1};
ll dy[] ={0,0,-1,+1,+1,+1,-1,-1};
const ll mx = 1e5+123;
bool vis[mx];
vi adj[mx];
int main()
{
    speed();
    ll a,b,c,k;
    cin>>a>>b>>c;
    cin>>k;
    while(k--)
    {
        if(b<=a)
        {
            b = b*2;
        }
        else if(c<=b)
        {
            c*=2;
        }
    }
    if(a<b && b<c)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 5908
#require 'prime'
#require 'openssl'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+).to_i end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gi
a=gsmi
ans=1
putsend 0 if a.count(0)>0
a.each do |i|
  ans=ans*i
  putsend -1 if ans>10**18
end
puts ans

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

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

int N, K;
double ans = 0;

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

  for (int i = 1; i <= N; i++){
    double P = (double) 1 / (double) N;
    ll now = i;

    while (now <= K - 1){
      P *= 0.5; now *= 2;
    }
    ans += P;
  }

  cout << setprecision(32) << ans << endl;


  return 0;
}


Measured memory_bytes: 3792
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

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

// 2^60 > 10 ^ 12
const int MAX_BITS = 60;

vector<int> bits(60, 0);

ll count(const ll x, const ll base) {
    ll cnt = 0;
    cnt += (x / base) * (base / 2LL);
    cnt += max(0LL, (x % base) - (base / 2LL - 1));
    return cnt;
}

void solve(const ll A, const ll B) {
    for (int i = 0; i < MAX_BITS; i++) {
        ll twos = 2LL << i;
        ll cnt_a = count(A - 1, twos);
        ll cnt_b = count(B, twos);
        // printf("twos: %lld, cnt_a: %lld, cnt_b: %lld\n", twos, cnt_a, cnt_b);
        ll cnt = cnt_b - cnt_a;
        if (cnt % 2 == 0) {
            bits[i] = 0;
        } else {
            bits[i] = 1;
        }

        // printf("i: %d, bits[%d]: %d\n", i, i, bits[i]);
    }
}

int main(void) {
    ll A, B;
    cin >> A >> B;

    // if (A == B) {
    //     cout << A << endl;
    //     return 0;
    // }

    solve(A, B);

    ll ans = 0;
    for (int i = 0; i < MAX_BITS; i++) {
        if (bits[i] == 1) {
            ans += 1LL << i;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void)
{
	string a, b; cin >> a >> b;
	if (a[0] == b[0]) cout << "H" << endl;
	else cout << "D" << endl;
}


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

long long N;


long long pow(long long rep) {
	long long ret = 1;
	for(long long i = 0; i < rep; i++){
		ret *= 26;
	}
	return ret;
}


int main(){
	cin >> N;
	N--;

	long long cur = 0;
	for(long long i = 1; i < 20; i++) {
		//cout << "i = " << i << endl;
		long long num = pow(i);
		if(cur + num > N) {
			long long rest = N - cur;
			//cout << "rest = " << rest << endl;
			//length = i;
			string ans = "";
			for(long long pos = i - 1; pos >= 0; pos--) {
				//cout << "pos = " << pos << endl;
				long long tmp = pow(pos);
				long long idx = rest / tmp;
				//cout << "idx = " << idx << endl;
				ans += 'a' + idx;
				rest %= tmp;
			}
			cout << ans << endl;


			return 0;
			//length i;
		} else {
			cur += num;
		}
	}
}


Measured memory_bytes: 3652
package main

import "fmt"

func scanNums(len int) (nums []int) {
    var num int
    for i := 0; i < len; i++ {
        fmt.Scan(&num)
        nums = append(nums, num)
    }
    return nums
}

func main(){ 
  bisckets := 0
  time := 0
  nums := scanNums(3)

  for i:=1;; i++ {
    time += nums[0]
    if float64(time) >= float64(nums[2]) + 0.5 {
      break
    }
    bisckets += nums[1]
  }
  
  fmt.Println(bisckets)
}

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

typedef long long ll;
const int MaxN = 212345;
const ll mod = 998244353;


void solve_case() {
	ll n;
	cin >> n;
	
	ll h[n+1];
	h[0] = 0;
	for (int i = 0; i < n; i++) {
		cin >> h[i + 1];
	}
	
	ll dp[n + 1];
	dp[1] = 0, dp[0] = 0, dp[2] = abs(h[2] - h[1]);
	for (int i = 3; i <= n; i++)  {
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i - 2] - h[i]));
	}
	
	cout << dp[n] << "\n";
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    ll t=1;
    //cin >> t;
    while(t--) solve_case();
}


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

struct Card {char suit, value; };

void bubble(struct Card A[], int N){
    for(int i = 0;i<N;i++){
        for(int j = N-1;j>=i+1;j--){
            if(A[j].value<A[j-1].value){
                Card t = A[j]; A[j]=A[j-1]; A[j-1] = t;
            }
        }
    }
}

void selection(struct Card A[],int N){
    for(int i = 0;i<N;i++){
        int minj = i;
        for(int j = i;j<N;j++){
            if(A[j].value<A[minj].value) minj=j;
        }
        Card t = A[i]; A[i]=A[minj]; A[minj]=t;
    }
}

void printf(struct Card A[],int N){
    for(int i = 0;i<N;i++){
        if(i>0) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

bool isStable(struct Card C1[],struct Card C2[],int N){
    for(int i = 0;i<N;i++){
        if(C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

int main(){
    Card C1[100],C2[100];
    int N;
    char ch;
    
    cin >> N;
    for(int i = 0;i<N;i++){
        cin >> C1[i].suit >> C1[i].value;
    }
    
    for(int i = 0;i<N;i++) C2[i]=C1[i];
    
    bubble(C1,N);
    selection(C2,N);
    
    printf(C1,N);
    cout << "Stable" << endl;
    printf(C2,N);
    if(isStable(C1,C2,N)){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3096
#ifdef _LOCAL
#	include <dbg_print.h>
#else
#	define NDEBUG
#	define dprint(...)
#endif

#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#include <iostream>
#include <algorithm>
#include <assert.h>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);
	
	int h, n;
	cin >> h >> n;
	for(int i=0; i<n; ++i)
	{
		int a;
		cin >> a;
		h -= a;
	}

	cout << (0 < h ? "No" : "Yes") << "\n";

	return 0;
}


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

int main(){
    int n,p;
    while(cin>>n>>p){
        if(n==0 and p==0) return 0;
        vector<int> d(n,0);
        int pp = p;
        int t = 0;
        while(1){
            if(p>0){
                p--;
                d[t]++;
            }else{
                p += d[t];
                d[t] = 0;
            }
            if(d[t]==pp){
                cout << t << endl;
                break;
            }
            t = (t+1)%n;
        }
    }
}

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

int main()
{
    int n;
    string s;
    cin >> n;
    cin >> s;
    int totl = 0, totr = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '(') totl++;
        else
        {
            if (totl > 0) totl--;
            else totr++;
        }
    }
    for (int i = 0; i < totl; i++) s = s + ')';
    for (int i = 0; i < totr; i++) s = '(' + s;
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<(ll)m; i++)
#define FOR(i,n,m) for(long long i=n; i<(ll)m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> a(n+2);
	REP(i,n) cin>>a[i+1];
	a[0]=0;
	a[n+1]=0;
	vector<ll> ans(n);
	ll sum=0;
	FOR(i,1,n+2) sum+=abs(a[i]-a[i-1]);
	FOR(i,1,n+1) {
		ans[i-1]=sum+abs(a[i-1]-a[i+1])-abs(a[i-1]-a[i])-abs(a[i+1]-a[i]);
	}
	REP(i,n) cout<<ans[i]<<endl;
}


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

int main() {
  int n;
  cin >> n;
  
  int N=n;
  int sum=0;
  while (n%10!=0){
    sum+=n%10;
    n/=10;
  }
  
  if (N%sum==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import math
while True:
    n = int(input())
    if n==0:
        break
    s =list(map(int,input().split()))
    
    m = sum(s)/len(s)
    S=0
    for i in range(n):
        S += (s[i]-m)**2
    
    A = S/n
    a = math.sqrt(A)
        
    print(f'{a:.08f}')


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

#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;

int n;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    clock_t ck;
    ck = clock();
    cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        // int up = -1;
        // for (int l = 1, r = n; l <= r; ) {
        //     int m = (l+r) / 2;
        //     if (i*m <= n) {
        //         up = m;
        //         l = m+1;
        //     }
        //     else
        //         r = m-1;
        // }
        // ans += up;
        ans += (n-1)/i;
    }
    cout << ans << '\n';
    ck = clock()-ck;
    cerr << "It took " << 1.0*ck/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

Measured memory_bytes: 3800
import numpy as np

S      = input()
S      = S.split()
N      = int(S[0])
D      = int(S[1])
matrix = np.zeros([N, D])
count  = 0


for i in range(0, N, 1):
    X_vector = input()
    X_vector = X_vector.split()
    for j in range(0, D, 1):
        matrix[i][j] = int(X_vector[j])

for i in range(0, N, 1):
    a_vector = matrix[i]
    for j in range(i+1, N, 1):
        b_vector = matrix[j]
        length = np.linalg.norm(b_vector-a_vector)
        if length.is_integer():
            count = count + 1
print(count)


Measured memory_bytes: 13132
n = gets.to_i
data = $<.map{|l|l.split.map(&:to_i)}

max = 0
for x in 0..(n-1)
  sum  = data[0][0..x].inject(:+)
  sum += data[1][x..-1].inject(:+)
  max = [max, sum].max
end

p max


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return ((a%md)*(b%md))%md;}
int addmod(int a, int b, int md) {return (a+b)%md;}
int submod(int a, int b, int md) {return (((a-b)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}


signed main(void)
{
	IOS;
	int h; cin>>h;
	int lv=0;
	int ans=0;
	while(h > 0) {
		ans +=(1ll<<lv);
		h/=2;
		lv++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
ll m=1000000007;
ll sieve[1000001]={0},i,j;
ll power(ll p, ll k)
{
ll a=1;
while(k)
{
if(k&1)
a=(a*p)%m;
p=(p*p)%m;
k>>=1;
}
return a;
}
using namespace std;
int main()
{
ll a,b;
cin>>a>>b;
cout<<max(0ll,a-2*b);
}

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

int main(){
    int n;
    cin>>n;
    int x[200000];
    for(int i=0; i<n; i++){
        cin>>x[i];
    }
    int tx[200000];
    for(int i=0; i<n; i++) tx[i]=x[i];
    sort(tx, tx+n);
    int midr=tx[n/2];
    int midl=tx[n/2-1];
    for(int i=0; i<n; i++){
        if(midr<=x[i]) cout<<midl<<endl;
        else cout<<midr<<endl;
    }
    return 0;
}


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

int N,id;
double Max,T,H,A;
int main()
{
	cin >> N >> T >> A;
	Max = 2e9;
	for(int i = 1; i <= N; i++){
		cin >> H;
		double res = abs(A - T + H * 0.006);
		if(res < Max){
			Max = res;
			id = i;
		}
	}
	cout << id << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
d={}
for k in range(2,10**6):
  while n%k<1: n//=k; d[k]=d.get(k,0)+1
if n>1: d[n]=1
a=0
for i in d.values():
  t=c=0
  while t+c<i: c+=1; t+=c
  a+=c
print(a)

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

int main() {
  string s,t;
  cin >> s >> t;
  
  int count=0;
  for(int i=0; i<s.size(); i++){
    if(s.at(i)!=t.at(i)){
      count++;
    }
  }
  cout << count << endl;
  
}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define SORT(n) sort((n).begin(),(n).end(),greater<int>())
#define SORTP sort((n).begin(),(n).end(),greater<pair<int,int>>());
#define pb push_back
#define eb emplace_back
using namespace std;
struct CWW{CWW(){ios::sync_with_stdio(false);cin.tie(0);}}cww;
int main()
{
	vector<int> vc(3);
	REP( i, 3 ){
		cin >> vc[i];
	}
	int count1{},count2{};
	REP( i, 3 ){
		if( vc[i] == 5 ){
			count1++;
		}else if( vc[i] == 7 ){
			count2++;
		}
	}
	cout << ( count1 == 2 && count2 == 1 ? "YES" : "NO" ) << endl;
	return 0;
}

Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())

a = (x2 - x1, 0)
b = (0, y2 - y1)

x3, y3 = x2 - y2 + y1, y2 + x2 - x1
x4, y4 = x3 - y3 + y2, y3 + x3 - x2
print(x3, y3, x4, y4)

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

long nCr(long n, long r)
{
  if (n < r) return 0;
  long ans = 1;
  for(long i = n; i > n - r; i--) ans = ans*i;
  for(long i = 1; i < r + 1; i++) ans /= i;
  return ans;
}

int main()
{
  int N;
  cin >> N;
  vector<long> A(N);
  map<long, long> Aij;
  long ans = 0;
  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i);
    if (Aij.count(A.at(i) - (i+1))) ans += Aij.at(A.at(i) - (i+1));
    if (Aij.count(-(A.at(i) + (i+1)))) Aij.at(-(A.at(i) + (i+1)))++;
    else Aij[-(A.at(i) + (i+1))] = 1;
  }
  cout << ans << endl;
}


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


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

	int len = S.size() - 1;
	int n = pow(2, len);

	long long total = 0;
	for (int i = 0; i < n; i++) {
		int b = i;
		vector<string> v;
		int bfr = 0;
		int counter = 1;
		while (counter <= len) {
			if (b % 2 == 1) {
				v.push_back(S.substr(bfr, counter-bfr));
				bfr = counter;
			}
			b >>= 1;
			counter++;
		}
		string last = S.substr(bfr);
		v.push_back(last);

		long long sum = 0;
		for (string str : v) {
			sum += stoll(str);
		}
		total += sum;
	}

	cout << total << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    string n;
    cin >> n;

    ll s(0);
    for (auto c: n)
        s += c-'0';

    int p = atoi(n.c_str());
    if (p % s == 0)
        cout << "Yes" << endl; 
    else
        cout << "No" << endl; 
    

    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<int, Pii > P1;

#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))

const ll MOD = 1000000007;
const double EPS = 1e-10;
const int MAX = 200000;

int main() {
  ll n;
  cin >> n;
  vector<ll> a;
  rep (i, n) {
    ll t;
    cin >> t;
    a.push_back(t);
  }
  ll ans = 0;
  vector<ll> sum;
  for (int j = 0; j < n; ++j) {
    sum.push_back(a[j]);
    if (j > 0) {
      sum[j] = (sum[j-1] + a[j]);
      sum[j] %= MOD;
    }
  }
  for (int i = 1; i < n; ++i) {
    ll tmp = sum[i-1] * a[i];
    tmp %= MOD;
    ans += tmp;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7892