akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
using namespace std;

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

    if(n < 6){
        cout << n << endl;
        return 0;
    }

    bool dp[n+1] = {}; // default false
    dp[0] = true;

    vector<int> six;
    vector<int> nine;

    int si = 1;
    while(n >= si*6){
        si*=6;
        six.push_back(si);
    }

    int ni = 1;
    while(n >= ni*9){
        ni *= 9;
        nine.push_back(ni);
    }


    int ans = 0;
    while(!dp[n]){
        ans++;
        for(int i = n; i >= 0; i--){
            if(dp[i]){
                dp[i+1] = true;
                for(auto p : six){
                    if(i+p <= n)    dp[i+p] = true;
                }

                for(auto p : nine){
                    if(i+p <= n)    dp[i+p] = true;
                }
            }
        }
    }

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

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

namespace TOPSIC2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] S = new string[N];
            for(int i = 0; i < N; i++)
            {
                S[i] = Console.ReadLine();
            }

            //HashSetに変換する
            HashSet<string> hs = new HashSet<string>(S);

            //配列に変換する
            string[] resultS = new string[hs.Count];
            hs.CopyTo(resultS, 0);

            Console.WriteLine(resultS.Length);
        }
    }
}


Measured memory_bytes: 38372
#include <bits/stdc++.h>
using namespace std;
const int maxn=200005;
int n,m,a[maxn],ord[maxn],path[maxn];
long long q;
int main()
{
	scanf("%d%lld",&n,&q);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int u=1;
	while (!ord[u])
	{
		ord[u]=++m;
		path[m]=u;
		u=a[u];
	}
	if (q<m)
	{
		printf("%d\n",path[q+1]);
		return 0;
	}
	q-=ord[u]-2;
	//cerr<<">>>>>>"<<ord[u]<<" "<<m<<" "<<q<<endl;
	printf("%d\n",path[ord[u]+(q-1)%(m-ord[u]+1)]);
	return 0;
}


Measured memory_bytes: 5980
def list_count(my_list,n,x):
    dic={} #辞書型の宣言
    for i in range(x,n,2):
        if my_list[i] in dic: #もしnumがkeyとして辞書にあれば
            dic[my_list[i]]+=1 #valueに+1
        else: #なければ
            dic[my_list[i]]=1 #dicにnumというkeyを追加し、対応するvalueを1とする
    return dic

n=int(input())
v=list(map(int,input().split()))
dic0=list_count(v,n,0)
dic1=list_count(v,n,1)
a=[[0,0],[0,0]]
b=[[0,0],[0,0]]
for i in dic0.keys():
    if a[0][1]<=dic0[i]:
        a[1][0]=a[0][0]
        a[1][1]=a[0][1]
        a[0][0]=i
        a[0][1]=dic0[i]
    elif a[1][1]<dic0[i]:
        a[1][0]=i
        a[1][1]=dic0[i]
for i in dic1.keys():
    if b[0][1]<=dic1[i]:
        b[1][0]=b[0][0]
        b[1][1]=b[0][1]
        b[0][0]=i
        b[0][1]=dic1[i]
    elif b[1][1]<dic1[i]:
        b[1][0]=i
        b[1][1]=dic1[i]
if a[0][0]==b[0][0]:
    print(n-max(a[0][1]+b[1][1],a[1][1]+b[0][1]))
else:
    print(n-a[0][1]-b[0][1])

Measured memory_bytes: 17912
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
--import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Fixed
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import Text.Printf
import System.IO
-- import System.IO.Unsafe
 
-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
whenM :: Monad m => m Bool -> m () -> m ()
whenM c a = c >>= flip when a
unconsU :: [a] -> (a, [a])
unconsU (x:xs) = (x, xs)
-- templete

space :: String -> String
space s = sub s
  where
    sub "" = ""
    sub (c:cs)
      | c=='_' = ' ' : sub cs
      | isUpper c = ' ' : toLower c : sub cs
      | otherwise = c : sub cs

capitalize (c:cs) = toUpper c : cs

cvtCase "U" s = concat $ map capitalize s
cvtCase "L" (s:ss) = concat $ s : map capitalize ss
cvtCase "D" s = intercalate "_" s

main = map (uncurry cvtCase . fmap (words . space)) . takeWhile ((/="X") . fst) . map (swap . apply2 (,) . words) . lines <$> getContents >>= mapM_ putStrLn


Measured memory_bytes: 4020
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<string>
#include<utility>
#include<iomanip>
#include<bitset>
#include<math.h>
using namespace std;

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

	cout << (a+(2*b))/((2*b)+1)<< endl;	
}

Measured memory_bytes: 256
import math

A, B = list(map(int, input().split()))
count = 0

def divisor(x):
    divs = []
    for i in range(1, math.floor(math.sqrt(x))+1):
        if x%i == 0:
            divs.append(i)
            if i**2 != x:
                divs.append(x//i)
    return divs

def evPrimal(x):
    if x < 4:
        return True
    divs = []
    for i in range(2, math.floor(math.sqrt(x))+1):
        if x%i == 0:
            return False
    return True

codiv = set(divisor(A)) & set(divisor(B))

for i in codiv:
    if evPrimal(i):
        count += 1

print(count)

Measured memory_bytes: 10956
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  long long n;
  cin >> n;
  string ans;
  while(n!=0){
    if(n%26==0){
      ans+='z';
    }else{
      ans+=n%26+'a'-1;
    }
    if(n%26==0){
      n/=26;
      n--;
    }else{
      n/=26;
    }
  }
  reverse(ans.begin(),ans.end());
  cout << ans;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll solve(ll num){
    ll ret = num * (num - 1) / 2;
    return ret;
}

int main() {
    ll n, m;
    cin >> n >> m;
    ll ans = solve(n) + solve(m); 
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s,t;
    cin >> s >> t;
    cout << t + s << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define in (void)scanf
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
//#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(int i=(int)(l);i<(int)(r);i+=(int)(k))
//#define Repp(i,l,r,k)for(LL i=(LL)(l);i<(LL)(r);i+=(LL)(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009,4999999999999997
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a,LL n,int m){LL x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
typedef struct fac { LL n, exp; }F;
LL fact(LL n,F*a){LL x=n,i,j,c=0;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
LL nibtan(LL* a,LL n,LL x){LL p=0,q=n/2,r=n-1;while(r-p>1){if(x>=a[q])p=q;if(x<=a[q])r=q;q=(p+r)/2;}return a[p]==x?p:r;}
//snippet

#define N 100009

void run(void) {
	int n, h, a[N], b[N], A = 0, x = 0;
	in("%d%d", &n, &h);
	rep(i, n) {
		in("%d%d", &a[i], &b[i]);
		A = Ma(A, a[i]);
	}
	sortdowni(b, n);
	while (b[x] >= A && h > 0 && x < n) h -= b[x++];
	if (h > 0)x += ceill((Lf)h / (Lf)A);
	printf("%d\n", x);
}

int main(void) {
	int test = 1;
//	in("%d", &test);
	while (test--) {
		run();
	}
	return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	int max = 0;
	
	int N = scan.nextInt();
	String[] s = new String[N];

	for(int i = 0; i < N; i++){
	    s[i] = scan.next();
	}

	int M = scan.nextInt();
	String[] t = new String[M];

	for(int i = 0; i < M; i++){
	    t[i] = scan.next();
	}

	for(int i = 0; i < N; i++){
	    int count = 1;
	    for(int j = i + 1; j < N; j++){
		if(s[i].equals(s[j])){
		    count++;
		}
	    }
	    for(int k = 0; k < M; k++){
		if(s[i].equals(t[k])){
		    count--;
		}
	    }
	    if(count > max){
		max =count;
	    }
	}

	System.out.println(max);
    }
}


Measured memory_bytes: 21844
/**
* Copyright(c)
* All rights reserved.
* Author : zzy
* Date : 2020-03-07-20.17.28
*/
#include <bits/stdc++.h>

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int)(x).size())

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

deque<char> dq;
string s;
int q, op, f;
char c;
bool normal = true;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
#endif
//???????????????????
    cin >> s;
    for (char ch : s) dq.push_back(ch);
    cin >> q;
    forn(i, q) {
        cin >> op;
        if (op == 1) normal = (normal == true ? false : true);
        else {
            cin >> f >> c;
            if (f == 1) {
                if (normal) dq.push_front(c);
                else dq.push_back(c);
            } else {
                if (normal) dq.push_back(c);
                else dq.push_front(c);
            }
        }
    }
    if (normal) {
        for (char ch : dq) cout << ch;
        cout << '\n';
    } else {
        auto it = dq.end();
        --it;
        while (true) {
            cout << *it;
            if (it == dq.begin()) break;
            --it;
        }
        cout << '\n';
    }


#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 976
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    string s;
    cin >> s;
    REP(i,s.size()/2) if(s[i] != s[s.size()-1-i]) {
        cout << "No" << endl;
        return;
    }
    cout << "Yes" << endl;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    int N;
    vector<vector<int>> a;

    vector<int> label;
    vector<int> gr;

    void dfs(int v, int c, int g) {
        label[v] = c;
        gr[v] = g;

        for (int i = 0; i < N; ++i) {
            if (a[v][i] == 0 && label[i] == -1) {
                dfs(i, 1 - c, g);
            }
        }
    }

    void solve() {
        cin >> N;
        a.resize(N, vector<int>(N, 0));
        for (int i = 0; i < N; ++i) a[i][i] = -1;

        label.resize(N, -1);
        gr.resize(N, 0);

        int cnt = N * (N - 1) / 2;
        int level = 1;


        while (cnt > 0) {
            fill(all(label), -1);
            fill(all(gr), -1);

            int g = 0;

            for (int i = 0; i < N; ++i) {
                if (label[i] == -1) {
                    dfs(i, 0, g);
                    g++;
                }
            }

            for (int i = 0; i < N; ++i) {
                for (int j = i + 1; j < N; ++j) {
                    if (gr[i] == gr[j] && label[i] != label[j]) {
                        cnt--;
                        a[i][j] = a[j][i] = level;
                    }
                }
            }

            level++;
        }

        for (int i = 0; i < N; ++i) {
            for (int j = i + 1; j < N; ++j) {
                cout << a[i][j] << " ";
            }
            cout << endl;
        }


    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pcont(x) for(auto i: x){cout << i << " ";} cout << "\n";

int main(){
    IOS;
    ll n, k;
    cin >> n >> k;
    vector<ll> m(n);
    for(ll i = 0ll; i<n; i++){
        cin >> m[i];
    }

    for(int i = k; i<n; i++){
        if(m[i-k] >= m[i])cout << "No\n";
        else cout << "Yes\n"; 
    }
    return 0;
}

Measured memory_bytes: 4760
N = gets.to_i
a = gets.split.map(&:to_i)

cnt = Hash.new(0)
ans = 0

a.each do |ai|
  cnt[ai] += 1
end
cnt.each do |k,v|
  if k > v
    ans += v
  elsif v > k
    ans += v-k
  end
end

puts ans

Measured memory_bytes: 14468
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt
    // T=0,A=1,G=2,C=3
    val dp = Array.ofDim[Int](N + 1, 4, 4, 4)
    dp(0)(0)(0)(0) = 1
    for (i <- 0 until N; c3 <- 0 until 4; c2 <- 0 until 4; c1 <- 0 until 4; c <- 0 until 4) {
      (c3, c2, c1, c) match {
        case (_, 1, 2, 3) |
             (_, 2, 1, 3) |
             (_, 1, 3, 2) |
             (1, _, 2, 3) |
             (1, 2, _, 3) =>
        case _ =>
          dp(i + 1)(c2)(c1)(c) = (dp(i + 1)(c2)(c1)(c) + dp(i)(c3)(c2)(c1)) % 1000000007
      }
    }
    var result = 0L
    for (c2 <- 0 until 4; c1 <- 0 until 4; c <- 0 until 4) {
      result = (result + dp(N)(c2)(c1)(c)) % 1000000007
    }
    println(result)
  }
}

Measured memory_bytes: 32624
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>

using ll = long long;
ll M = 1000000000000000;


using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int> ss(n);
	int maax = 0;
	int ans = 0;
	int cnt = 0;
	int j = 0;
	vector<int> aa(n);
	for (int i = 0;i < n;i++) {
		cin >> ss[i];
		if (maax >= ss[i]) {
			cnt++;
			maax = ss[i];
		}
		else {
			maax = ss[i];
			ans = max(ans,cnt);
			cnt = 0;
		}
		ans = max(cnt, ans);
	}
	
	cout << ans;
}


Measured memory_bytes: 3956
package main
 
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)
 
func run() {

	var N int64;
    N = nextInt();
    A := make([]int64,N+1);
    for i := 0 ; i < int(N+1) ; i++ {
        A[i] = nextInt();
    }
    B := make([]int64,N);
    for i := 0 ; i < int(N) ; i++ {
        B[i] = nextInt();
    }
	solve(N, A, B);

}

func solve(N int64, A []int64, B []int64){
	count := 0
	for i := 0; i < int(N); i++ {
		if A[i] <= B[i] {
			count += int(A[i])
			B[i] -= A[i]
		}else{
			count += int(B[i])
			B[i] = 0
		}

		if A[i+1] <= B[i] {
			count += int(A[i+1])
			A[i+1] = 0
		}else{
			count += int(B[i])
			A[i+1] -= B[i]
		}
	}
	Println(count)
}


// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024
 
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}
 
func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}
 
func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int64 {
	a, err := strconv.ParseInt(next(),10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}


type IntHeap []int
func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

/////数字と文字
// 基本クラス
type NS struct {
    Num int
    Str string
}

//////　数字と数字
// 基本クラス
type NN struct {
    Num1 int
    Num2 int
}

 
func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}



Measured memory_bytes: 11008
#include<iostream>

using namespace std;

int main(void)
{
        int n,y;
        cin >> n >> y;
        bool flag = false;

        int a,b;

        for(int i=0;i<=n;i++)
        {
                for(int j=0;j<=n-i;j++)
                {
                        if(10000*i+5000*j+1000*(n-i-j)==y)
                        {
                                flag = true;
                                a=i;
                                b=j;
                                break;
                        }
                }
        }

        if(flag==true)
        {
                cout << a << " " << b << " " << n-a-b << endl;
        }
        else
        {
                cout << "-1 -1 -1" << endl;
        }
}

Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;
const ll inf=1e18,MOD=1e9+7,MAX=1e6+2;



int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    IOS;
    int n;
    cin>>n;
    ll a[n],sum=0;
    lp(i,0,n)
        cin>>a[i],sum+=a[i];
    ll res=0;
    lp(i,0,n){
        sum-=a[i];
        res+=(a[i]*(sum%MOD))%MOD,res%=MOD;
    }
    cout<<res;
}

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

int main(){
    int h,w,x;
    cin >> h >> w >> x;
    vector<vector<int>> a_org(h,vector<int>(w));
    vector<vector<int>> a(h,vector<int>(w));
    char c;
    rep(i,h){
        rep(j,w){
            cin >> c;
            if(c == '#') a_org[i][j] = 1;
        }
    }
    int n = 0;
    int j,k;
    int ans = 0;
    int cnt;
    rep(i,1<<h+w){
        cnt = 0;
        rep(j,h){
            rep(k,w){
                a[j][k] = a_org[j][k];
            }
        }
        for(j=0;j<h;j++){
            if(i>>j&1){
                rep(k,w) a[j][k] = 0;
            }
        }
        for(j=h; j<h+w;j++){
            if(i>>j&1){
                rep(k,h) a[k][j-h] = 0;
            }
        }
        rep(j,h){
            rep(k,w){
                if(a[j][k] == 1) cnt++; 
            }
        }
        if(cnt == x) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

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

    int N, D; cin >> N >> D;
    vector<vector<int>> X(N);

    int tmp;
    rep(i,N) rep(j,D) {
        cin >> tmp;
        X[i].push_back(tmp);
    }

    int sum = 0;
    int ans = 0;
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            for (int k = 0; k < D; k++) {
                sum += (X[j][k] - X[i][k]) * (X[j][k] - X[i][k]);
            }
            for (int l = 0; l <= sum; l++) {
                if (l * l == sum) ans++;
            }
            sum = 0;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main()
{
   long long n,k;
   cin >> n >> k;
   long long temp;
   long long temp1,temp2;
   long long ans;
   if(k % 2 == 1){
       temp = n/k;
       ans = temp*temp*temp;
    }else{
        if(n < k/2){
            ans = 0;
        }else{
            temp1 = n/k;
            temp2 = (n+k/2)/k;
            ans = temp1*temp1*temp1+temp2*temp2*temp2;
        }
   }
   cout << ans << endl;
   return 0;
}

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

int main(){
  int n;
  cin >> n;
  if ((n - n % 10) % 111 == 0 || (n - (n / 1000) * 1000) % 111 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
 
#define lli long long int
#define endl "\n"
 
using namespace std;
 
typedef long long int LLI;
typedef double DB;
 
void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
}
 
 
bool comparator(pair<lli,lli> a,pair<lli,lli> b)
{
    if(a.first>b.first)
        return true;
    else if (a.first==b.second)
    {
        if(a.second>=b.second)
            return false;
        return true;
    }
    return false;
}
 
int mods(int x)
{
    if(x>0)
        return x;
    return -x;
}
 
lli gcd(lli a,lli b)
{
    return __gcd(a,b);
}
 
lli lcm(lli x,lli y,lli z)
{
    lli j=gcd(x,y);
    lli k=gcd(y*x/j,z);
    return (((x*y)/j)*z)/k;
} 

int arr[3][3];
bool vis[3][3]={0};

int main()
{
    fastio();
    int n; string s; cin>>n>>s;
    n*=pow(10,s.length());
    n+=stoi(s);
    if(n==ceil(sqrt(n))*ceil(sqrt(n))) {cout<<"Yes"; return 0;}
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        long n = scan.nextLong();
        long k = scan.nextLong();
        long out = 0;
        long[] h =  new long[(int)n];
        for(int i = 0; i < n; i++){
            h[i] = scan.nextLong();
        }
        Arrays.sort(h);
        for(int i = 0 ; i < n - k; i++){
            out += h[i];
        }
        System.out.println(out);
    }
}

Measured memory_bytes: 85656
package main

import (
  "fmt"
  "sort"
  "strings"
)
func main() {
  var s, t string
  fmt.Scan(&s)
  fmt.Scan(&t)

  s1 := strings.Split(s,"")
  t1 := strings.Split(t,"")

  sort.Strings(s1)
  sort.Sort(sort.Reverse(sort.StringSlice(t1)))

  s = strings.Join(s1, "")
  t = strings.Join(t1, "")

  if s < t {
    fmt.Println("Yes")
  } else {
    fmt.Println("No")
  }
}


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

template<class T>
ostream& operator<<(ostream& os,vector<T> const& v){for(auto itr=v.begin();itr!=v.end();++itr){if(itr!=v.begin())os<<' ';os<<*itr;}return os;}

struct point{
  int64_t x,y;
  point(){}
  point(double _x,double _y):x(_x),y(_y){}

  bool operator < (point const& rhs)const{
    return this->x==rhs.x?this->y<rhs.y:this->x<rhs.x;
  }

  friend istream& operator>>(istream& is,point& p){
    return is>>p.x>>p.y;
  }
  friend ostream& operator<<(ostream& os,point const& p){
    return os<<p.x<<" "<<p.y;
  }
};

signed main(){

  int n;
  cin>>n;
  vector<point> a(n);
  for(auto& ai:a)cin>>ai;
  sort(a.begin(),a.end());
  for(auto ai:a){
    cout<<ai<<endl;
  }

}


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

int main(void)
{
  int prm[1000000];
  for (int i = 0; i < 1000000; i++) prm[i] = 1;
  prm[0] = prm[1] = 0;
  for (int i = 2; i < 1000000; i++) {
    for (int j = 2; i*j < 1000000; j++) {
      prm[i*j] = 0;
    }
  }
  int n;
  while (cin >> n) {
    int ans = 0;
    while (n) {
      if (prm[n]) ans++;
      n--;
    }
    cout << ans << endl;
  }

  return 0;
}

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



int main(){
    ll N;
    cin >> N;
    vector<pair<ll,pair<ll,ll>>> v(N);
    for(int i = 0; i < N; i++){
        ll tmp1,tmp2;
        cin >> tmp1 >> tmp2;
        v[i] = make_pair(tmp1 + tmp2,make_pair(tmp1,tmp2));
    }
    sort(v.begin(),v.end(), greater<pair<ll,pair<ll,ll>>>());

    ll ans = 0;

    for(int i = 0; i < N; i++){
        if(i % 2 == 0){
            ans += v[i].second.first;
        }else{
            ans -= v[i].second.second;
        }
    }

    cout << ans << endl;
}



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

int n,m,a,b; 
int ans[100];

int main()
{
    cin>>n>>m;
    while (m--)
    {
    	cin>>a>>b;
    	ans[a]++;
    	ans[b]++;
    }
    for (int i=1;i<=n;i++) cout<<ans[i]<<endl;
	
}

Measured memory_bytes: 256
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define EPS (1e-7)
#define IINF ((int)1e9)


MY_NAMESPACE(testbed)
int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int a;
	cin >> a;
	int res = a + a * a + a * a * a;

	cout << res << "\n";
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 3660
def gcd(a, b)
  a=-a if a<0
  b=-b if b<0
  while b > 0
    a, b = b, a%b
  end
  a
end
def lcm(a, b)
  a=-a if a<0
  b=-b if b<0
  a*b/gcd(a, b)
end
def ngcd(*nums)
  d=0
  nums.each{|a| d=gcd(d, a)}
  d
end
def nlcm(*nums)
  l=1
  nums.each{|a| l=lcm(l, a)}
  l
end
class Array
  def gcd
    inject(:gcd) 
  end
  def lcm
    inject(:lcm)
  end
end
#======================================
#Array.gcd
#ngcd(a,b)

gets
a=gets.split.map &:to_i
g=a.gcd
c=0
loop{
break if g%(2**c)!=0
c+=1
}
p c-1

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

int main() {
    int n; cin >> n;
    long long res = 0;
    int prev = 1000000;
    for (int i = 0; i < n - 1; i++) {
        int b; cin >> b;
        res += min(prev, b);
        prev = b;
    }
    res += prev;
    cout << res << endl;
    return 0;
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

const int MAXN = 1005; // 素数を探す範囲
bool _is_prime[MAXN];     // 添え字に対応する値の素数判定を格納
int P[1005];

void eratosthenes(const long long N) {
  for (long long i = 0; i <= N; i++) {
    _is_prime[i] = true;
  }
  for (long long i = 2; i <= N; i++) {
    if (_is_prime[i]) {
      for (long long j = 2 * i; j <= N; j += i) {
        _is_prime[j] = false;
      }
      int tmp=N;
      while(!(tmp%i)){
        P[i]++;
        tmp/=i;
      }
    }
  }
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  
  ll cnt=0;
  irep(i,2,n+1){
    eratosthenes(i);
  }
  ll ans=1;
  rep(i,1005){
    if(P[i])ans=ans*(P[i]+1)%MOD;
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
n = int(input())

ans = ""
k = 0
while n // (26**(k)) > 0:
    ans = ans + str(chr(((n-1) % (26**(k+1))+1)//(26**k) + 96))
    n = n - ((n-1) % (26**(k+1))+1)
    k += 1

print(ans[::-1])


Measured memory_bytes: 9060
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

const double eps = 5e-3;

struct point {
  double x,y,z;
  point(){}
  point(double x, double y, double z):x(x),y(y),z(z){}
  point operator-(const point &t){
    return point(x-t.x,y-t.y,z-t.z);
  }
};

double abs(const point &a){
  return sqrt(a.x*a.x + a.y*a.y + a.z*a.z);
}

bool eq( double a, double b){
  return abs(a/b-b/a)<0.0001;
}

int main()
{
  int T;
  cin >> T;
  for(int tc=0;tc<T;++tc){
    int n;
    double l[3];
    vector<point> vp;

    for(int i = 0; i < 3; ++i){
      //  QR , RP , PQ
      cin >> l[i];
    }

    cin >> n;
    for(int i = 0; i < n; ++i){
      point p; cin >> p.x >> p.y >> p.z;
      vp.push_back( p );
    }

    for(int a = 0; a < n; ++a){
      
      for(int b = 0; b < n; ++b){
        if( a == b ) continue;
        
        for(int c = 0; c < n; ++c){
          if( b == c || a == c ) continue;
          
          double tl[3];
          
          tl[0] = abs(vp[a]-vp[b]);
          tl[1] = abs(vp[b]-vp[c]);
          tl[2] = abs(vp[c]-vp[a]);
          if( eq(tl[2]/l[2], tl[1]/l[1]) &&
              eq(tl[2]/l[2], tl[0]/l[0]) ){
            cout << c+1 << ' ' << a+1 << ' ' << b+1 << endl;
          }
        }
      }
    }
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
       int k,c=1,ans=7;
       cin>>k;
       if( k%10!=7 && k%10!=1 && k%10!=3 && k%10!= 9)cout<<-1;
       else
       {
           while(ans%k!=0 && c<10000000)
           {
               ans*=10;
               ans%=k;
               ans+=7;
               ans%=k;
               c++;
           }
           if(ans%k!=0)cout<<-1;
           else cout<<c;
       }
    }
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

 
void solve()
{
    string s;cin>>s;
    const int n=s.size();
    const int N=13;
    const int ans=5;
    vector<vector<ll>>dp(n+1,vector<ll>(N,0));dp[0][0]=1;
    REP(i,n)
    {
        int x;
        if(s[i]=='?')x=-1;
        else x=(int)(s[i]-'0');

        REP(j,10)
            if(x==-1||x==j)
                REP(k,N)
                {
                    dp[i+1][(k*10+j)%N]+=dp[i][k];
                    dp[i+1][(k*10+j)%N]%=mod;
                }
    }
    cout<<dp[n][ans]<<endl;
}

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

Measured memory_bytes: 13648
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++) cin >> a[i];
    if(n&1){
    	ll sum = 0, m = -a[0], num = m;
    	for(int i=0;i<n;i+=2) sum += a[i];
    	for(int i=2;i<n;i+=2) m = max(m + a[i-1],0LL) - a[i], num = max(num,m);
    	cout << sum + num <<endl;
    }
    else{
    	ll sum = 0;
    	for(int i=0;i<n;i+=2)sum += a[i];
    	ll ans = sum;
    	for(int i=n-2;i>=0;i-=2) (sum += a[i+1]) -= a[i], ans = max(sum,ans);
        cout << ans <<endl;
    }
    return 0;
}


Measured memory_bytes: 5188
while True:
  try:
    a, b, c, d, e, f = map(float, raw_input().split())

    x = (e*c-b*f) / (e*a-b*d)
    y = (c*d-a*f) / (b*d-e*a)

    if x == -0.0:
      x = 0

    if y == -0.0:
      y = 0

    print '%.3f %.3f' % (x,y)

  except EOFError:
    break

Measured memory_bytes: 6336
#include<cstdio>
using namespace std;

int arr[100010],brr[100010];

int main(void){
    int n,zero=0,one=0,two=0;
    bool fail=false;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&arr[i]);
        if(arr[i]%4==0){
            brr[i]=2;
            two++;
        }else if(arr[i]%2==0){
            brr[i]=1;
            one++;
        }else{
            zero++;
        }
    }
    if(zero>two){
        fail=true;
        if(n%2)if(two+1==zero)fail=false;
    }
    if(fail)printf("No\n");
    else printf("Yes\n");
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	int N,M;
	cin >> N >> M;
	vector<int> X(M);
	for(int i=0;i<M;i++) cin >> X[i];
	
	sort(X.begin(), X.end());
	
	vector<int> D(M-1);
	for(int i=0;i<M-1;i++) D[i] = X[i+1] - X[i];
	sort(D.begin(), D.end());

	if(N >= M){
		cout << 0 << endl;
		return 0;
	}
	
	ll tot = 0;
	for(int i=0;i<M-N;i++){
		tot += D[i];
	}
	
	cout << tot << endl;
	
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9+7;
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};

void solve() {
    int n;
    cin >> n;
    int count =0 ;
    while(n>0) {
        if(n%10 == 7){
            count++;
        }
        n/=10;
    }
    if(count>0){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
    

}

signed main() {
    boost;
    solve();
}

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

int main(){
  int N,K;
  int h[110000];
  cin >> N >> K;
  int res = 0;
  for (size_t i = 0; i < N; i++) {
      cin >> h[i];
      if (h[i] >=  K) {
        res++;
      }
  }
    cout << res << '\n';
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long N){
    LL ans = N - 1;
    for(LL i=2; i*i<= N; i++){
        if (N%i == 0) {
            ans = min(ans, (i-1) + (N/i-1));
        }
    }

    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

typedef pair< int, int > Pi;
typedef pair< int, Pi > Pii;

int main(){
  int N, d;
  Pii data[200000];
  multiset< int > X, Y;
  scanf("%d %d", &N, &d);
  for(int i = 0; i < N; i++){
    scanf("%d %d %d", &data[i].second.first, &data[i].second.second, &data[i].first);
  }
  sort( data, data + N);
  ll ret = 0, low = 0;
  for(int i = 0; i < N; i++){
    while(data[low].first < data[i].first - d){
      X.erase( X.find(data[low].second.first));
      Y.erase( Y.find(data[low].second.second));
      low++;
    }
    X.insert( data[i].second.first);
    Y.insert( data[i].second.second);

    ret = max( ret, (ll)(*--X.end() - *X.begin()) * (*--Y.end() - *Y.begin()));
  }
  printf("%lld\n", ret);
}

Measured memory_bytes: 24292
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;
int big(int a,int b)
{
    if(a>b)
        return a;
    else
        return b;
}

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    int ans=big(a+b,big(a-b,a*b));
    printf("%d\n",ans);

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>; 
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



int h, w;
char s[410][410];
vector<pair<int, int>> vec;
bool used1[410][410], used2[410][410];
int f[] = { 0,1,0,-1,0,-1,0,1 };
int g[] = { 1,0,-1,0,1,0,-1,0 };
void init() {
	memset(used1, false, sizeof(used1));
}
int bl, wh;
void dfs(int x, int y) {
	init();
	used1[x][y] = true;
	used2[x][y] = true;
	if (s[x][y] == '#')bl++;
	else wh++;
	rep(i,8){
		if (x + f[i] < 0 || x + f[i] >= h || y + g[i] < 0 || y + g[i] >= w)continue;
		if (s[x][y] != s[x + f[i]][y + g[i]] && !used2[x + f[i]][y + g[i]]) dfs(x + f[i], y + g[i]);
	}
}
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			cin >> s[i][j];
			if (s[i][j] == '#') {
				vec.push_back({ i,j });
			}
		}
	}
	int ans = 0;
	for (pair<int, int> i : vec) {
		if (used2[i.first][i.second])continue;
		bl = 0, wh = 0;
		dfs(i.first, i.second);
		ans += bl * wh;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9584
import java.util.*;

import static java.lang.Math.abs;

public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();

        int[] spot = new int[N+2];
        spot[0] = 0;
        spot[N+1] = 0;
        for(int i = 1; i <= N; i++){
            spot[i] = scan.nextInt();
        }
        
        int sum = 0;
        int[] dif = new int[N+2];
        dif[0] = 0;
        for(int i = 1; i <= N+1; i++){
            dif[i] = abs(spot[i] - spot[i-1]);
            sum += dif[i];
        }

        int ans;
        for(int i = 1; i <= N; i++){
            ans = sum;
            ans -= dif[i];
            ans -= dif[i+1];
            ans += abs(spot[i+1] - spot[i-1]);
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 63296