akhauriyash/Code-Regression huggingface dataset:
// https://beta.atcoder.jp/contests/abc079
// status:

#define SUBMIT
//#define DEBUG

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <queue>
#include <numeric>
#include <limits>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const int MAX_C = 1000;
const int MAX_SIDE = 200;
const int N_NUMBER = 10;
const int NOT_VISITED = -1;

int c[N_NUMBER][N_NUMBER];
//int A[MAX_SIDE][MAX_SIDE];

// number_count[i] i (0 <= i <= 9)が出現する回数
int number_count[N_NUMBER];

// min_cost[i][j] iからj (0 <= i <= 9, 0 <= j <= 9)に変えるときの最小コスト
int min_cost[N_NUMBER][N_NUMBER];

int H, W;

void bfs(int start, int curr_i, int curr_cost) {
    if (c[start][curr_i] < curr_cost) return;

    min_cost[start][curr_i] = min(min_cost[start][curr_i], curr_cost);
//    cout << "cost: " << curr_cost << " transit: " << start << " -> " << curr_i << endl;
    for (int i = 0; i < N_NUMBER; ++i) {
        if (curr_i != i) bfs(start, i, curr_cost + c[curr_i][i]);
    }
}


void start_bfs() {
    for (int i = 0; i < N_NUMBER; ++i) {
        bfs(i, i, c[i][i]);
    }
}



int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    auto s = std::string(R"(2 4
0 9 9 9 9 9 9 9 9 9
9 0 9 9 9 9 9 9 9 9
9 9 0 9 9 9 9 9 9 9
9 9 9 0 9 9 9 9 9 9
9 9 9 9 0 9 9 9 9 2
9 9 9 9 9 0 9 9 9 9
9 9 9 9 9 9 0 9 9 9
9 9 9 9 9 9 9 0 9 9
9 9 9 9 2 9 9 9 0 9
9 2 9 9 9 9 9 9 9 0
-1 -1 -1 -1
8 1 1 8
)");
    stringstream stream(s);
#endif
    // initialization
    for (int y = 0; y < N_NUMBER; ++y) {
        for (int x = 0; x < N_NUMBER; ++x) {
            if (y == x) min_cost[y][x] = 0;
            else min_cost[y][x] = MAX_C;
        }
    }
    memset(number_count, 0, sizeof(number_count));

    // inputs
    stream >> H >> W;
    for (int y = 0; y < N_NUMBER; ++y) {
        for (int x = 0; x < N_NUMBER; ++x) {
            stream >> c[y][x];
        }
    }
    int A;
    for (int y = 0; y < H; ++y) {
        for (int x = 0; x < W; ++x) {
            stream >> A;
            if (A != -1) number_count[A]++;
        }
    }

    start_bfs();
    int ans = 0;
    for (int i = 0; i < N_NUMBER; ++i) ans += min_cost[i][1] * number_count[i];
    cout << ans << endl;

#ifdef DEBUG
    cout << "number_count:" << endl;
    for (int i = 0; i < N_NUMBER; ++i) cout << number_count[i] << " ";
    cout << endl;

    cout << "min cost:" << endl;
    for (int i = 0; i < N_NUMBER; ++i) {
        for (int j = 0; j < N_NUMBER; ++j) {
            cout << min_cost[i][j] << " ";
        }
        cout << endl;
    }
#endif
    return 0;
}

Measured memory_bytes: 384
/*
 *  Author  : StelaYuri
 * Language : GNU G++ 14
 */

//#pragma comment(linker,"/STACK:1024000000,1024000000")
//#pragma GCC optimize(3)
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<functional>
#include<iomanip>
//#include<unordered_map>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/hash_policy.hpp>
#define closeSync ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define multiCase int T;cin>>T;for(int t=1;t<=T;t++)
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define repp(i,a,b) for(int i=(a);i<(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define perr(i,a,b) for(int i=(a);i>(b);i--)
#define pb push_back
#define eb emplace_back
#define mst(a,b) memset(a,b,sizeof(a))
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=0x3f3f3f3f;
const ll LINF=0x3f3f3f3f3f3f3f3f;
const double eps=1e-12;
const double PI=acos(-1.0);
const double angcst=PI/180.0;
const ll mod=1e9+7;
ll max_3(ll a,ll b,ll c){if(a>b&&a>c)return a;if(b>c)return b;return c;}
ll min_3(ll a,ll b,ll c){if(a<b&&a<c)return a;if(b<c)return b;return c;}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll qmul(ll a,ll b){ll r=0;while(b){if(b&1)r=(r+a)%mod;b>>=1;a=(a+a)%mod;}return r;}
ll qpow(ll a,ll n){ll r=1;while(n){if(n&1)r=(r*a)%mod;n>>=1;a=(a*a)%mod;}return r;}
ll qpow(ll a,ll n,ll p){ll r=1;while(n){if(n&1)r=(r*a)%p;n>>=1;a=(a*a)%p;}return r;}



void solve()
{
    ll n;
    cin>>n;
    cout<<((qpow(10,n)-qpow(9,n)*2+qpow(8,n))%mod+mod)%mod<<'\n';
}
int main()
{
    closeSync;
    //multiCase
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3660
from heapq import heappop
from heapq import heappush
q=int(input())
L,R=[],[]
b_sum=0
l_sum,r_sum=0,0
count=0
mid=0
for _ in range(q):
  
  Q=list(map(int,input().split()))
  if Q[0]==1:
    a,b=Q[1],Q[2]
    count+=1
    b_sum+=b
    if count==1:
      mid=a
    elif count%2==0:
      if a<=mid:
        heappush(L,-a)
        l_sum+=a
        heappush(R,mid)
        r_sum+=mid
      else:
        heappush(L,-mid)
        l_sum+=mid
        heappush(R,a)
        r_sum+=a
    else:
      l,r=-heappop(L),heappop(R)
      if a<l:
        heappush(L,-a)
        l_sum+=a-l
        mid=l
        heappush(R,r)
      elif r<a:
        heappush(L,-l)
        mid=r
        heappush(R,a)
        r_sum+=a-r
      else:
        heappush(L,-l)
        mid=a
        heappush(R,r)

  else:
    if count%2==1:
      print(mid,r_sum-l_sum+b_sum)
    else:
      l=-heappop(L)
      print(l,r_sum-l_sum+b_sum)
      heappush(L,-l)




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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

ll calc(ll x){ //[0,x)のxor０から数えるので
    if(x<=0)return  0;
    ll ans=0;
    for (int i = 0; i < 50; ++i) {
        ll loop=(1LL<<(i+1));//周期
        ll co=(x/loop)*(loop/2);//ループした回数＊１の数
        co+=max(0LL,(x%loop)-(loop/2));//00001111 -に注意
        if(co%2==1){
            ans+=(1LL<<i);
        }
    }
    return ans;
}

int main(){
    ll a,b;cin >>a>>b;
    ll ans=calc(b+1)^calc(a);
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
C = readline().decode().rstrip()

l, r = 0, N - 1
cnt = 0

while l < r:
    if C[l] == 'R':
        l += 1
    elif C[r] == 'W':
        r -= 1
    else:
        l += 1
        r -= 1
        cnt += 1

print(cnt)

Measured memory_bytes: 26624
using System;
using System.Collections.Generic;
using System.Linq;
using static Scanner;

class Program
{
    public static void Main()
    {
        long n = ReadLong();
        long x = ReadLong();
        long m = ReadLong();

        var a = new List<long>() { x };
        var s = new List<long>() { 0, x };
        var c = new Dictionary<long, int>() { { x, 0 } };
        for (int i = 1; i < n; i++)
        {
            long next = a[^1] * a[^1] % m;

            if (c.ContainsKey(next))
            {
                long k = s[c[next]];
                long ans = k;
                n -= c[next];
                long len = i - c[next];
                ans += n / len * (s[^1] - k);
                ans += s[(int)(c[next] + (n % len))] - k;
                Console.WriteLine(ans);
                return;
            }

            a.Add(next);
            s.Add(s[^1] + next);
            c[next] = i;
        }
        Console.WriteLine(s[^1]);
    }
}

static class Scanner
{
    static Queue<string> que = new Queue<string>();
    public static string Read() { if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s); return que.Dequeue(); }
    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static IEnumerable<string> Read(long n) { for (long i = 0; i < n; i++) yield return Read(); }
    public static IEnumerable<int> ReadInt(long n) => Read(n).Select(int.Parse);
    public static IEnumerable<long> ReadLong(long n) => Read(n).Select(long.Parse);
}


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

int main(){
    int N,K;    cin>>N>>K;
    int R,S,P;  cin>>R>>S>>P;
    string T;   cin>>T;
    int pR=0,pS=0,pP=0; //出した手毎のポイント
    for(int i=0;i<N;i++){
        if(i>=K){
            if(T[i-K]==T[i])T[i]='n';
        }

        if(T[i]=='r')pP=pP+P;
        else if(T[i]=='p')pS=pS+S;
        else if(T[i]=='s')pR=pR+R;
    }
    int ans=pR+pS+pP;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define for_int(i,a,b) for(int i=(a);i<=(b);++i)
#define rep_int(i,a,b) for(int i=(a);i>=(b);--i)
#define for_ll(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep_ll(i,a,b) for(ll i=(a);i>=(b);--i)
#define ull unsigned long long
#define ll long long
#define db double
#define HPMAX 1005
#define KMP_MAX 1005
#define prime_MAX 1e6+5
#define quick_pow_mod 1e9+7
#define PII pair<int,int>
using namespace std;
//快读
int read() {
	char c = getchar();
	int x = 0, f = 1;
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (; isdigit(c); c = getchar())
		x = x * 10 + c - 48;
	return x * f;
}
int t;
int gcd(int a, int b) {
	return !b ? a : gcd(b, a % b);
}
int main() {
	t = read();
	int d = gcd(360, t);
	int lcm = 360 * t / d;
	cout << lcm/t << endl;
	return 0;
}


Measured memory_bytes: 3620
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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! {
        s: chars
    }
    if s.len() != 4 {
        println!("No");
        return;
    }
    for i in 0..s.len() {
        if s.iter().filter(|x| **x == s[i]).count() != 2 {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};

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



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll N; cin>>N;
  vector<ll> a(N),b(N); rep(i,N) cin>>a[i]; rep(i,N) cin>>b[i];
  ll suma=0,sumb=0; rep(i,N) {suma+=a[i]; sumb+=b[i];}
  ll K=sumb-suma; if(K<0) {cout<<"No"<<'\n'; return 0;}
  ll k=0,l=0; rep(i,N) if(a[i]>b[i]) k+=a[i]-b[i]; else l+=(b[i]-a[i]+1)/2;
  
  if(K>=k&&K>=l) cout<<"Yes"<<'\n';
  else cout<<"No"<<'\n';
  
  return 0;
}

Measured memory_bytes: 3788
N,M = map(int,input().split())
src = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(M)]
src.sort()

ans = 0
minb = N
for a,b in src:
    if a >= minb:
        ans += 1
        minb = b
    else:
        minb = min(minb,b)
if src[-1][0] < minb:
    ans += 1
print(ans)

Measured memory_bytes: 17000
N = int(input())
A = list(map(int, input().split()))
alta = []
for i in range(N):
    alta.append(A[i] - (i + 1))
# 最小値を0に揃えないとバグる
plus = min(alta)
for i in range(N):
    alta[i] -= plus

def f(x):
    sum = 0
    for i in alta:
        sum += abs(x - i)
    return sum

# 極値があるので三分探索使う
left, right = 0, max(alta)
# 答えが整数になる問題の場合このrightとleftの幅を3未満にするとバグる
while abs(right - left) > 3:
    mid1 = (right * 2 + left) // 3 + 1
    mid2 = (right + left * 2) // 3
    if f(mid1) >= f(mid2):
        # 上限を下げる（最小値をとるxはもうちょい下めの数だな）
        right = mid1
    else:
        # 下限を上げる（最小値をとるxはもうちょい上めの数だな）
        left = mid2
ans = float('inf')
for i in range(left, right + 1):
    ans = min(ans, f(i))
print(ans)

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

namespace ABC114A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());

            if (x == 7 || x == 5 || x == 3)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;

struct Input
{
	int h;
	int n;
	int[] a;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		auto array = readln().strip().split();
        h = array[0].to!int;
        n = array[1].to!int;
        a = readln().strip().split().map!(to!int).array;
	}
}

struct Output
{
}

auto main2(Input* input)
{
    auto sum = sum(input.a);
	return input.h <= sum ? "Yes" : "No";
}

unittest { writeln("begin unittest"); }

unittest // example1
{
	string example =
`10 3
4 5 6`;
	Input input = void;
	parseExample(input, example);
	auto result = main2(&input);
	writeln(result);
	assert(result == "Yes");
}

unittest // example2
{
	string example =
`20 3
4 5 6`;
	Input input = void;
	parseExample(input, example);
	auto result = main2(&input);
	writeln(result);
	assert(result == "No");
}

unittest // example3
{
	string example =
`211 5
31 41 59 26 53`;
	Input input = void;
	parseExample(input, example);
	auto result = main2(&input);
	writeln(result);
	assert(result == "No");
}

unittest { writeln("end unittest"); }

void parseExample(out Input input, string example)
{
	struct Adapter
	{
		string[] _lines;
		this(string input) { _lines = input.splitLines(); }
		string readln() { auto line = _lines[0]; _lines = _lines[1..$]; return line; }
	}
	parseInput(input, Adapter(example));
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	auto result = main2(&input);
	writeln(result);
}


Measured memory_bytes: 3992
//#include<bits/stdc++.h>
#include<iostream>
#include <algorithm>
#include<cstring>
#include<stdio.h>
#define INF 0x3f3f3f3f
using namespace std;
const int maxn=1e7+7;
int a[maxn];
int main()
{
    int n,m,l=1;
    cin>>n;
    long long ans=0,sum=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        while((sum^a[i])!=sum+a[i])
        {
            sum^=a[l];
            l++;
        }

        sum^=a[i];
        ans=ans+i-l+1;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<utility>
#include<cmath>
#include<stdlib.h>
#include<iomanip>
using namespace std;

int main(){
    int d,n;
    cin >> d >> n;
  	if(n%100 == 0){
       cout << fixed <<setprecision(0)<< 101 * pow(100,d) << endl;
    }else{
    	cout << n * pow(100,d) << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int K = sc.nextInt();

    int[] x = new int[N];

    for (int i = 0; i < N; i++) {
      x[i] = sc.nextInt();
    }

    sc.close();

    int d = 0;

    for (int i = 0; i < N; i++) {
      if (x[i] > K - x[i]) { 
        d += (K - x[i]) * 2;
      } else {
        d += x[i] * 2;
      } 
    }

    System.out.println(d);

  }

}

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

int main(){
  int n;
  double sum=0;
  cin >> n;
  vector<double> x(n);
  vector<string> u(n);
  for(int i=0;i<n;i++)cin >> x.at(i) >> u.at(i);
  for(int i=0;i<n;i++){
    if(u.at(i)=="JPY")sum+=x.at(i);
    else sum+=x.at(i)*380000.0;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  lli a,b,x,y,n,k;
  string s,r,t;
  cin>>s>>t;
  r+=t;
  r+=s;
  ou(r);
}

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

int main(){
  int n,a[100],b[100];
  int dp[100][100];

  cin >> n;
  for(int i=0;i<n;i++)cin >> a[i] >> b[i];

  for(int i=0;i<n;i++){
    fill(dp[i],dp[i]+n,(1<<31)-1);
    dp[i][i] = 0;
  }
  for(int i=1;i<n;i++){
    for(int j=0;j+i<n;j++){
      for(int k=j;k<j+i;k++){
	dp[j][j+i] = min(dp[j][j+i],dp[j][k]+dp[k+1][j+i]+a[j]*b[k]*a[k+1]*b[j+i]);
      }
    }
  }

  cout << dp[0][n-1] << endl;
}

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

#define pb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define digits(x) floor(log10(x) + 1)
#define countbits(x) ((int)log2(x)+1)
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define init(arr,value) memset(arr,value,sizeof(arr))
#define deb(x) cout << #x << "=" << x << endl;
#define test unsigned int tet;cin >> tet;while(tet--)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(10);cout << fixed;
#define int long long

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const ll N   = 500500;

signed main(void)
{
    	fastio
        int n;
        cin >> n;
        vector<int> a(n+1),dp(n+1);
        for(int i=1; i<=n; i++) cin >> a[i];

        dp[1] = 0;
        dp[2] = abs(a[2]-a[1]);
        for(int i=3; i<=n; i++){
            dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
        }
        cout << dp[n];

    	return 0;
}



Measured memory_bytes: 4744
/**
 *      ABC 81 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-02 05:11:14
**/

int CountEven(int A){
    int count = 0;
    while (A % 2 == 0){
        A /= 2;
        ++count;
    }
    return count;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N; cin >> N;
    vector<int> A;
    for (int i = 0; i < N; ++i) {
        int x; cin >> x;
        A.push_back(x);
    }
    vector<int> ans;
    for (int i = 0; i < N; ++i) {
        ans.push_back(CountEven(A[i]));        
    }
    sort(ans.begin(), ans.end());
    cout << ans[0] << endl;

    return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r = 0;
    rep(i, n) if (s[i]=='R') r++;
    if (r==0 || r==n) {
        puts("0");
        return 0;
    }

    int ans = 0;
    rep(i, n) if (s[i] == 'R' && r <= i) ans++;

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

Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    int n;
    cin >> n;
    int u=1;
    vector <string> qw (n);
    for (int i=0; i<n; ++i)
    {
        string q;
        cin >> q;
        qw[i]=q;
    }
    sort(qw.begin(),qw.end());
    for (int i=1; i<n; ++i)
    {
        if (qw[i-1]!=qw[i])
            u+=1;
    }
    cout << u << endl;
}

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

long long f(long long n){
    if(n < 10) return n;
    return n%10 + f(n/10);
}

double g(long long n){
    return (double)(n)/f(n);
}

int main() {
    vector<long long> res;
    long long base = 1;

    for(int i=0; i<15; ++i){
        for(int j=1; j<150; ++j){
            res.push_back(base*(j+1)-1);
        }
        base *= 10;
    }
    sort(res.begin(), res.end());
    res.erase(unique(res.begin(), res.end()), res.end());

    for(long long i=0; i<res.size(); ++i){
        for(long long j=i+1; j<res.size(); ++j){
            if(g(res[i]) > g(res[j])){
                res.erase(res.begin() + i--);
                break;
            }
        }
    }

    long long K; cin >> K;
    for(long long i=0; i<K; ++i) cout << res[i] << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[4];
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int i;
	for (i=1;i<4;i++) cin>>a[i];
	sort(a+1,a+4,cmp);
	cout<<a[1]*10+a[2]+a[3];
}

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

int main(){
    int num;
    cin >> num;
    vector<int> vec(num);
    for( int i = 0; i < num;i++ ){
        cin >> vec.at(i);
    }
    int sum = 0;
    for( int j = 0; j < num - 1;j++ ){
        for( int k = j + 1; k < num;k++ ){
            sum += vec.at(j) * vec.at(k);
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [0] * M
y = [0] * M
c = [0] * M
for i in range(M):
  x[i], y[i], c[i] = map(int, input().split())

min_cost = min(a) + min(b)

for i in range(M):
  min_cost = min(a[x[i]-1] + b[y[i]-1] - c[i], min_cost)

print(min_cost)

Measured memory_bytes: 23396
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,y,v;
    cin>>n>>k;
    if(n>=10)
    {
        cout<<k<<endl;
    }
    else
    {
        y=100*(10-n);
        v=y+k;
        cout<<v<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
require 'set'; require 'prime'
INF=Float::INFINITY
s = gets.chomp.split(//)
if s.size == 1
  puts s
  exit
end

ans=0
d=s.size-1
(2**d).times do |i|
  bits = i.to_s(2).split(//)
  (d - bits.length).times{bits.unshift('0')}

  tmp = 0
  cur = s[0]
  bits.each_with_index do |bit, i|
    if bit == '1'
      tmp += cur.to_i
      cur = s[i+1]
    else
      ss = s[i+1]
      cur = cur + ss
    end
  end
  tmp += cur.to_i

  ans += tmp
end

puts ans


Measured memory_bytes: 2556
import sys
from pprint import pprint

def solve(n, b):
    ans = 0

    for i, b_i in enumerate(b):
        if i == 0:
            ans += b_i
            continue
        ans += min(b_i, b[i-1])
    ans += b[i]

    print(ans)

if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    b = list(map(int, sys.stdin.readline().strip().split(" ")))
    solve(n, b)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
using db = double;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
  数値型から文字列に変換　to_string(number);これは簡単
  文字列から数値型に変換　stoi(number)
  文字列からllに変換　stoll(number)
  __gcd(a,b)は最大公約数を取ってくれる、aとb
  の大きい方をNとしたとき、計算量は√N
 */

//ここから書き始める
int main(){
	vector<int> a(3);
	rep(i,3) cin >> a[i];
	//要素数nの配列を作るテンプレート
	SORT(a);
	int A = a[1] - a[0] ;
	ll ans = 0 ;
	ans = (A % 2) == 0 ? 0 :2 ;
	ans += A / 2 ;
	ans += a[2] - a[1] ;
	cout << ans << endl;
}


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

int main(){
    int n, C;
    cin >> n >> C;

    vector<vector<int>> d(C, vector<int>(C)), c(n, vector<int>(n));
    for(int i=0; i<C; i++){
        for(int j=0; j<C; j++){
            cin >> d[i][j];
        }
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            cin >> c[i][j];
            c[i][j] -= 1;
        }
    }

    // preparation
    vector<vector<int>> p(3, vector<int>(C));// ((i+j) % 3, color)
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            p[(i+j) % 3][c[i][j]] += 1;
        }
    }

    long long int ans = 1e12;// INF
    for(int i=0; i<C; i++){
        for(int j=0; j<C; j++){
            if(i == j) continue;
            for(int k=0; k<C; k++){
                if(i == k || j == k) continue;

                long long int discomfort = 0;
                for(int x=0; x<C; x++){
                    discomfort 
                    += p[0][x] * d[x][i]
                    +  p[1][x] * d[x][j]
                    +  p[2][x] * d[x][k];
                }
                if(ans > discomfort) ans = discomfort;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main(){
	int n=0;
	int m=0;
	int a[102];
	int b[4];
	int s[102];
	int i=0;
	int j=0;
	int k=0;
	int p=0;
	int l=0;
	
	cin>>n;
	m=n*(n-1)/2;
	for(i=0;i<102;i++){
		a[i]=0;
		s[i]=0;
	}
	for(i=0;i<m;i++){
		for(j=0;j<4;j++){
			cin>>b[j];
		}
		if(b[2]>b[3]){
			a[b[0]-1]=a[b[0]-1]+3;
		}
		if(b[2]<b[3]){
			a[b[1]-1]=a[b[1]-1]+3;
		}
		if(b[2]==b[3]){
			a[b[1]-1]=a[b[1]-1]+1;
			a[b[0]-1]=a[b[0]-1]+1;
		}
	}
	for(i=0;i<n;i++){
		p++;
		for(j=0;j<n;j++){
			if(a[k]<a[j]){
				k=j;
			}
		}
		if(a[k]==0){
			break;
		}
		for(j=k+1;j<n+2;j++){
			if(a[k]==a[j]){
				s[j]=p;
				a[j]=0;
				l++;
			}
		}
		s[k]=p;
		a[k]=0;
		k=0;
		p=p+l;
		l=0;
	}
	for(i=0;i<n;i++){
		cout<<s[i]<<endl;
	}
}

Measured memory_bytes: 3080
/**
  * @file pa.cpp
  * @brief atcoder

  *

  * @author yao
  * @date 2018-09-23
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#define INF ((int)1e9)
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#endif //DBG

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

int main()
{
    int a[3];
    scanf("%d%d%d",a,a+1,a+2);
    printf("%d\n",a[0]+a[1]+a[2]+*std::max_element(a,a+3)*9);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
  double r, menseki, nagasa;
  scanf("%lf",&r);

  menseki = r*r*3.141592653589;
  nagasa = 2*r*3.141592653589;

  printf("%lf %lf\n",menseki,nagasa);
  return 0;
}

Measured memory_bytes: 1232
#include <iostream>

using namespace std;

int main(){
        while(1){
                unsigned char hand[5]={};
                unsigned char sum=0;
                for(int i=0;i<5;i++){
                        int h;
                        cin>>h;
                        if(h==0) return 0;
                        hand[i]=1<<(h-1);
                        sum|=hand[i];
                }
                if(sum==7) cout<<"3\n3\n3\n3\n3\n";
                else {
                        for(int i=0;i<5;i++){
                                if(sum==hand[i]) cout<<"3\n";
                                else if((sum^hand[i])==(hand[i]<<1)||(sum^hand[i])==(hand[i]>>2)) cout<<"1\n";
                                else if((sum^hand[i])==(hand[i]>>1)||(sum^hand[i])==(hand[i]<<2)) cout<<"2\n";
                        }
                }
        }
        return 0;
}

Measured memory_bytes: 1124
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define __builtin_popcount __builtin_popcountll

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const map<S, T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;
string s;
int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    while(cin >> s){
        if (s.back() == '1' || s[0] == '0') {
            cout << -1 << endl;
            continue;
        }
        s.pop_back();
        string t = s;
        reverse(ALL(t));
        if (s != t) {
            cout << -1 << endl;
            continue;
        }
        int p = 1;
        REP(i, s.size()) {
            cout << p << " " << i + 2 << endl;
            if (s[i] == '1') {
                p = i + 2;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;

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

    cin >> N;
    if (N < 1200) {
        cout << "ABC";
    } else if (N < 2800) {
        cout << "ARC";
    } else {
        cout << "AGC";
    }

    return 0;
}


Measured memory_bytes: 256
// atcoder/diverta2019/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  lli r, g, b, n;
  while (cin >> r >> g >> b >> n) {
    lli sum = 0;
    for (int i = 0; i * r <= n; ++i) {
      for (int j = 0; j * g <= n; ++j) {
        lli x = n - ((i * r) + (j * g));
        if (0 <= x && x % b == 0) {
          ++sum;
        }
      }
    }
    cout << sum << endl;
  }

  return 0;
}


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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int a,b,c;

main() {
    cin >> a >> b >> c;
    if (a==b) ct(c)
    else if (a==c) ct(b)
    else ct(a)
}









Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n;
    cin >> n;
    vector<ll> tm(n);
    vector<ll> sp(n);
    ll m = 0;
    for (int i = 0; i < n; i++) {
        cin >> tm[i];
        m += tm[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> sp[i];
    }
    vector<ll> ro(m + 1);
    vector<ll> spro(m + 1,1000000);
    vector<ll> mnspro(m + 1, 1000000);
    ll now = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < tm[i]+1; j++) {
            spro[now] = min(sp[i],spro[now]);
            if(mnspro[now]==1000000)mnspro[now] = min(sp[i], mnspro[now]);
            if (j == tm[i])break;
            now++;
        }
    }
    for (int i = 1; i < 250; i++) {
        for (int j = 1; j < m; j++) {
            if (ro[j + 1] >= i - 1 && ro[j - 1] >= i - 1 && spro[j] >= i) {
                ro[j] = i;
            }
        }
    }
    double ans = 0;
    for (int j = 0; j < m; j++) {
        ans += ro[j];
        if (ro[j + 1] == ro[j] && ro[j+1] < mnspro[j+1])ans += 0.25;
    }
    cout << fixed << setprecision(15)  << ans << endl;
}

Measured memory_bytes: 4016
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
#define ll long long
#define ld long double
#define ALL(x) begin(x),end(x)
     
int main() {
  ll n;
  cin >> n;
  
  map<string,ll> m;
  ll num = 0;
  rep(i,n){
    string s;
    cin >> s;
    m[s]++;
    num = max(num,m[s]);
  }
 
  for(auto i = m.begin(); i != m.end(); i++){
    if(i->second == num) cout << i->first << endl;
  }
  //rep(i,m.size()) cout << m[i] << endl;
}


Measured memory_bytes: 19244
import java.util.*;
import java.io.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                int n = Integer.parseInt(sc.next());
                sc.close();
                boolean ebishu = true;
                for(long i = 1 ; i <= 3500 && ebishu ; i++){
                        for(long j = 1 ; j <= i && ebishu ; j++){
                                if(1.0 * (n * i * j) / (4 * i * j - n * i - n * j) % 1 == 0 && (n * i * j) / (4 * i * j - n * i - n * j) > 0){
                                        ebishu = false;
                                        ou.print(i + " " + j + " " + (n * i * j) / (4 * i * j - n * i - n * j) + "\n");
                                }
                        }
                }
                ou.flush();
        }
}

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

#define all(x) x.begin(),x.end()

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long MOD=1e9+7;
const long long LINF=1e18;
const int INF=0x3f3f3f3f;
const int MAXN=100050;

void solve(int T){
	int n;
	scanf("%d",&n);
	if(n==0)printf("1");
	else printf("0"); 
}
signed main(){
	int t=1;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	//scanf("%d",&t); 
	for(int i=1;i<=t;i++){
		solve(i);
	}
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int N,A[3];
vector<int> V(8),used(8,0);
int dfs(int r){
    if(r == 3)return 0;

    int mini = INF;
    /*
    rep(i,0,N){
        if(used[i])continue;
        used[i] = 1;
        mini = min(mini, abs(V[i] - A[r]) + dfs(r+1) );
        used[i] = 0;
    }
    */
    rep(i,1, 1 << N){
        bool flag = 1;
        rep(j,0,N){
            int mask = i & (1 << j);
            if(mask && used[j])flag = 0;
        }
        if(!flag)continue;
        int num = 0;
        rep(j,0,N)if(i & (1 << j)){
            used[j] = 1;
            num += V[j];
        }
        mini = min(mini, abs(num - A[r]) + (__builtin_popcount(i) - 1) * 10 + dfs(r+1) );
        rep(j,0,N)if(i & (1 << j))used[j] = 0;
    }
    /*
    rep(i,0,N)rep(j,i+1,N){
        if(used[i] || used[j])continue;
        used[i] = used[j] = 1;
        mini = min(mini, abs(V[i] + V[j] - A[r]) + 10 + dfs(r+1));
        used[i] = used[j] = 0;
    }
    */
    //if(r == 1)cout << r << "," << mini << endl;
    return mini;
}
main(){
    cin >> N >> A[0] >> A[1] >> A[2];
    rep(i,0,N)cin >> V[i];

    cout << dfs(0) << endl;
    /*
    int sum = 0;
    rep(i,0,3){
        int mini = INF, idx = -1, idx2 = -1;
        rep(j,0,N){
            if(mini > abs(V[j] - A[i])){
                mini = abs(V[j] - A[i]);
                idx = j;
            }
        }
        rep(j,0,N)rep(k,j+1,N){
            if(mini > abs(V[j] + V[k] - A[i]) + 10){
                mini = abs(V[j] + V[k] - A[i]) + 10;
                idx = j,idx2 = k;
            }
        }
        cout << mini << endl;
        sum += mini;
        if(idx2 == -1 || N <= 3 - i){
            V.erase(V.begin() + idx);
            N--;
            break;        
        }else{
            V.erase(V.begin() + idx);
            V.erase(V.begin() + idx2 - 1);
            N -= 2;
        }
    }
    cout << sum << endl;
    */
}

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

int main()
{
	int n;
	cin >> n;
	if (n < 1)return 1;
	int nums[100];

	for (int i{ 0 }; i != n; i++) {
		cin >> nums[i];
	}

	for (int i{ 0 }; i != n; i++) {
		for (int j = i; j > 0 && nums[j - 1] > nums[j]; j--) {
			int temp = nums[j];
			nums[j] = nums[j - 1];
			nums[j - 1] = temp;
		}

		for (int k{ 0 }; k != n - 1; k++) {
			cout << nums[k] << ' ';
		}
		cout << nums[n - 1] << endl;
	}

	return 0;

}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
  int n;
  cin >> n ;
  vector<int> A(n) ;
  rep(i,n) cin >> A[i] ;
  ll sum =0 ;
  rep(i,n) sum+=A[i] ;
  ll sam=A[0] ;
  ll ans= abs(sam*2-sum) ;
  rep2(i,1,n-2){
    sam+=A[i] ;
    ans =min(ans,abs(2*sam-sum)) ;
  }
 cout << ans <<endl ;
     return 0;
}


Measured memory_bytes: 1024
solve i [] = 0
solve i [a] = if a == i then 1 else 0
solve i (a:b:xs)
  | i == a    = 1 + solve (i+2) xs
  | otherwise = solve (i+1) (b:xs)

main :: IO ()
main = do
    _ <- getLine
    p <- map read . words <$> getLine :: IO [Int]
    print $ solve 1 p

Measured memory_bytes: 20860
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

int Y, X;
vector<string> s;
int dy[4] = {-1,0,+1,0};
int dx[4] = {0,-1,0,+1};

int solve(int sy, int sx, int gy, int gx){
    using P = pair<int,int>;
    if (s[sy][sx] == '#' || s[gy][gx] == '#') return 0;
    if (sy == gy && sx == gx) return 0;
    queue<P> qu;
    vector<vector<int>> cost(Y, vector<int> (X, INF));
    qu.push({sy,sx});
    cost[sy][sx] = 0;
    int count = 0;
    while(qu.size()) {
        P top = qu.front(); qu.pop();
        int y = top.first;
        int x = top.second;
        if (y == gy && x == gx) return cost[y][x];
        rep(i,4){
            int ny = y+dy[i], nx = x+dx[i];
            if (ny < 0 || ny >= Y || nx < 0 || nx >= X) continue;
            if (s[ny][nx] == '#') continue;
            if (cost[ny][nx] > cost[y][x] + 1) {
                cost[ny][nx] = cost[y][x] + 1;
                qu.push({ny, nx});
            }
        }
    }
    return 0;
}

int main(void){
    cin >> Y >> X;
    s.resize(Y);
    rep(y,Y){
        cin >> s[y];
    }
    int res = 0;
    rep(sy,Y)rep(sx,X)rep(gy,Y)rep(gx,X){
        res = max(res, solve(sy,sx,gy,gx));
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
N,K=map(int,input().split())
V=list(map(int,input().split()))
ans=0
for i in range(K+1):
    for j in range(K+1):
        if i+j>K or i+j>N:
            continue
        tmp=V[:i]+V[N-j:]
        tmp.sort()
        count_tmp=0
        ans_tmp=sum(tmp)
        for k in tmp:
            if k < 0 and count_tmp < K-i-j:
                ans_tmp-=k
                count_tmp+=1
            ans=max(ans,ans_tmp)
print(ans)


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

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  int ans_1 = 0, ans_2 = 0;
  for (int i = 0; i < M; i++) {
    int a;
    cin >> a;
    if (a < X) {
      ans_1++;
    }
    else {
      ans_2++;
    }
  }
  cout << min(ans_1, ans_2) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
const int MOD = 1000000007;
int main() 
{ 
  
   
    /*int r;
    cin >> r;
    float pi = 3.14159265359;
    float ans = (float)(2*pi*r);
     printf("%0.20f", ans);
     */
    int n, m;
    cin >> n >> m;
    vector<int> ndays(m);
    for(int i = 0; i  < m; i++) {
    	cin >> ndays[i];
    }

     long long s = accumulate(ndays.begin(), ndays.end(), 0);
     if(s > n ) {
     	cout << "-1" << "\n";
     	return 0;
     } else {
     	cout << n - s <<"\n";
     }






    return 0; 
}

Measured memory_bytes: 3648