akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<double> vec(N);
  for (int i=0;i<N;i++){
    cin >>vec.at(i);
  }
  double mother=0,child=1;
  
  for (int i=0;i<N;i++){
    child*=vec.at(i);
  }
  for (int i=0;i<N;i++){
    mother+=child/vec.at(i);
  }
  cout << child/mother <<endl;
}

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

int main(void){
    int n;
    long long dv = 1;
    long long max = 1;
    for(int i = 0; i < 18; i++){
	max *= 10;
    }
    std::cin >> n;
    std::vector<long long> a(n);

    for(int i = 0; i < n; i++){
	std::cin >> a[i];
    }

    for(int i = 0; i < n; i++){
	if(a[i] == 0){
	    std::cout << 0 << std::endl;
	    return 0;
	}
    }

    for(int i = 0; i < n; i++){
        if(dv <= max / a[i] + 1 && dv * a[i] <= max){
            dv *= a[i];
        }
        else{
           std::cout << -1 << std::endl;
	   return 0;
        }
    }
    std::cout << dv << std::endl;
    return 0;
}


Measured memory_bytes: 3580
package main

import (
	"fmt"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func main() {
	var n int
	fmt.Scan(&n)

	res := 1000000000
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)

		var cnt int = 0
		for a&1 == 0 {
			a /= 2
			cnt++
		}
		res = min(res, cnt)
	}
	fmt.Println(res)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
// #include <regex> //正規表現
using namespace std;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007ll
#define INF 1000000000
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
// グリッドグラフの移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int N; cin >> N;
VI t{1}; // 6^n, 9^n のテーブル．サイズは O(logN)

int p = 6;
while(p <= N){
    t.push_back(p);
    p *= 6;
}
p = 9;
while(p <= N){
    t.push_back(p);
    p *= 9;
}
sort(ALL(t));

// dp[i] = i 円引き出すのに必要な最小の操作回数
// dp[N] が答え．
VI dp(N + 1, INF);
dp[0] = 0;
int ts = t.size();

// O(NlogN)
rep(i, 1, N + 1){
    rep(j, 0, ts) {
        if (t[j] <= i) dp[i] = min(dp[i], dp[i - t[j]] + 1);
    }
    // cout << dp[i] << ' ';
}

cout << dp[N] << "\n";
}

// 境界，出力文字列 チェック



Measured memory_bytes: 640
#include<stdio.h>
int main(void) {
  int N,A,B,ans1,ans2;
  scanf("%d%d%d",&N,&A,&B);
  if(A<B)ans1=A;
  else ans1 = B;
  if(N-A-B>0)ans2=0;
  else ans2=A+B-N;
  printf("%d %d\n",ans1,ans2);
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
typedef long long ll;

#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REPI(x,y)	for (int i=(x);i<(y);i++)
#define REPJ(x,y)	for (int j=(x);j<(y);j++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef vector<vector<pair<int, int>>> GRA;

int i,j,N,x,a,m =1000000000;
string s;

int main() {
	cin >> N;

	REPI(0,N) {
		a = 0;
		cin >> x;
		while (x!=0 && !(x%2)){
			a++;
			x/=2;
		}
		m = MIN(m,a);
	}
	
	cout << m << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>

using namespace std;

typedef long long ll;

string beautify(string str) {
	string ret = "";
	for (int i = 0; i < str.size(); ++i) {
		char c = str[i];
		if ('a' <= c && c <= 'z') ret += c;
		else if ('A' <= c && c <= 'Z') ret += (char)(c-'A'+'a');
	}
	return ret;
}

class Dice {
private:
	int v[6];

public:
	int GetTop() { return v[0]; }
 	int GetFront() { return v[1]; }
	int GetRight() { return v[2]; }
	int GetLeft() { return v[3]; }
	int GetBack() { return v[4]; }
	int GetBottom() { return v[5]; }
	void Rotate(char op) {
		int newV[6];
		switch (op) {
		case 'N':
			newV[0] = v[1];
			newV[1] = v[5];
			newV[2] = v[2];
			newV[3] = v[3];
			newV[4] = v[0];
			newV[5] = v[4];
			break;

		case 'S':
			newV[0] = v[4];
			newV[1] = v[0];
			newV[2] = v[2];
			newV[3] = v[3];
			newV[4] = v[5];
			newV[5] = v[1];
			break;

		case 'E':
			newV[0] = v[3];
			newV[1] = v[1];
			newV[2] = v[0];
			newV[3] = v[5];
			newV[4] = v[4];
			newV[5] = v[2];
			break;

		case 'W':
			newV[0] = v[2];
			newV[1] = v[1];
			newV[2] = v[5];
			newV[3] = v[0];
			newV[4] = v[4];
			newV[5] = v[3];
			break;
		}
		for (int i = 0; i < 6; ++i) v[i] = newV[i];
	}
	void Spin(char op) {
		switch (op) {
		case 'R':
			Rotate('N');
			Rotate('E');
			Rotate('S');
			break;

		case 'L':
			Rotate('N');
			Rotate('W');
			Rotate('S');
			break;
		}
	}
	Dice(int v1, int v2, int v3, int v4, int v5, int v6) {
		v[0] = v1;
		v[1] = v2;
		v[2] = v3;
		v[3] = v4;
		v[4] = v5;
		v[5] = v6;
	}
	Dice() {}
};
bool operator ==(Dice& d1, Dice &d2) {
	return
		   d1.GetTop() == d2.GetTop()
		&& d1.GetFront() == d2.GetFront()
		&& d1.GetRight() == d2.GetRight()
		&& d1.GetLeft() == d2.GetLeft()
		&& d1.GetBack() == d2.GetBack()
		&& d1.GetBottom() == d2.GetBottom();
}

int main() {
	Dice d1, d2;
	{
		int v[6];
		for (int i = 0; i < 6; ++i) cin >> v[i];
		d1 = Dice(v[0], v[1], v[2], v[3], v[4], v[5]);
	}
	{
		int v[6];
		for (int i = 0; i < 6; ++i) cin >> v[i];
		d2 = Dice(v[0], v[1], v[2], v[3], v[4], v[5]);
	}

	bool ans = false;
	for (int k = 0; k < 4; ++k) {
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				if (d1 == d2) ans = true;
				d1.Rotate('N');
			}
			d1.Spin('R');
		}
		d1.Rotate('E');
	}

	cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1164
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;

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

  string ans = "";
  for(char c : S) {
    char nc = c+N;
    if (nc > 'Z') nc = nc-26;
    ans += nc;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int M = sc.nextInt();
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = sc.nextInt();
            }
            int[] A = new int[M];
            int[] B = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = sc.nextInt() - 1;
                B[i] = sc.nextInt() - 1;
            }

            ArrayList<Integer>[] nToN = new ArrayList[N];
            for (int i = 0; i < nToN.length; i++) {
                nToN[i] = new ArrayList<Integer>();
            }
            for (int i = 0; i < M; i++) {
                nToN[A[i]].add(B[i]);
                nToN[B[i]].add(A[i]);
            }

            int count = 0;
            for (int n = 0; n < N; n++) {
                ArrayList<Integer> ns = nToN[n];
                boolean isValid = true;
                for (int j = 0; j < ns.size(); j++) {
                    if (H[n] <= H[ns.get(j)]) {
                        isValid = false;
                    }
                }
                if (isValid) {
                    count++;
                }
            }

            System.out.println(count);
        }
    }
}


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

int main(){
    std::string S, T;
    std::cin >> S >> T;
    int cnt = 0;
    for(int i=0; i<S.size(); i++){
        if(S[i] != T[i]){
            cnt++;
        }
    }
    
    std::cout << cnt << std::endl;
    
    return 0;
}



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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct Flow {
    explicit Flow(int n) {
        mVertices.resize(n);
        mDir.assign(n, 0);
        mIter.assign(n, 0);
    }

    void addEdge(int from, int to, long long int cap) {
        mVertices[from].edge.emplace_back(Edge{to, cap, static_cast<int>(mVertices[to].edge.size())});
        mVertices[to].edge.emplace_back(Edge{from, 0, static_cast<int>(mVertices[from].edge.size())});
    }

    long long int maxFlow(int s, int t) {
        long long int retValue = 0;
        while (true) {
            bfs(s);
            if (mDir[t] == MAX_VALUE)
                break;
            fill(mIter.begin(), mIter.end(), 0);
            long long int flow = 0;
            while ((flow = dfs(s, t, INF_VALUE)) > 0)
                retValue += flow;
        }
        return retValue;
    }

    void bfs(int s) {
        fill(mDir.begin(), mDir.end(), MAX_VALUE);
        queue<int> q;
        q.push(s);
        mDir[s] = 0;
        while (!q.empty()) {
            int t = q.front();
            q.pop();
            int cost = mDir[t] + 1;
            for (const auto &e:mVertices[t].edge) {
                if (mDir[e.to] <= cost || e.capacity <= 0)
                    continue;
                mDir[e.to] = cost;
                q.push(e.to);
            }
        }
    }

    long long int dfs(int s, int t, long long int f) {
        if (s == t)
            return f;
        for (int &i = mIter[s]; i < mVertices[s].edge.size(); ++i) {
            Edge &e = mVertices[s].edge[i];
            if (e.capacity <= 0 || mDir[s] >= mDir[e.to])
                continue;
            long long int d = dfs(e.to, t, std::min(f, e.capacity));
            if (d > 0) {
                e.capacity -= d;
                mVertices[e.to].edge[e.rev].capacity += d;
                return d;
            }
        }
        return 0;
    }

    struct Edge {
        int to;
        long long int capacity;
        int rev;
    };
    struct Vertex {
        vector<Edge> edge;
    };
    vector<Vertex> mVertices;
    vector<int> mDir;
    vector<int> mIter;

    const int MAX_VALUE = 1e9;
    long long int INF_VALUE = (long long int) 1e15;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X, Y, E;
    cin >> X >> Y >> E;
    Flow flow(X + Y + 2);
    REP(i, E) {
        ll a, b;
        cin >> a >> b;
        flow.addEdge(a + 1, b + X + 1, 1);
    }
    REP(i, X) {
        flow.addEdge(0, i + 1, 1);
    }
    REP(i, Y) {
        flow.addEdge(i + X + 1, X + Y + 1, 1);
    }

    cout << flow.maxFlow(0, X + Y + 1) << endl;

    return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int a, b;
	cin >> a >> b;
	cout << a * b << endl;
    
    return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;
template <class T>
ostream &operator<<(ostream &s, vector<T> vec) {
    for (int i = 0; i < (int)vec.size(); ++i) {
        if (i > 0) {
            s << ' ';
        }
        s << vec[i];
    }
    return s << endl;
}
int main() {
    string S;
    cin >> S;
    int N = (int)S.size() + 1;
    vector<int> A(N);
    for (int l = 0; l < N - 1; l++) {
        int now = 0;
        int r = l;
        for (; r < N - 1 && S[r] == '<'; r++) {
            chmax(A[r], now);
            now++;
        }
        chmax(A[r], now);
        l = r;
    }
    for (int r = N - 1; r >= 0; r--) {
        int now = 0;
        int l = r;
        for (; l >= 0 && S[l] == '>'; l--) {
            chmax(A[l + 1], now);
            now++;
        }
        chmax(A[l + 1], now);
        r = l;
    }
    cerr << A;
    cout << accumulate(ALL(A), 0LL) << endl;
}


Measured memory_bytes: 4740
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int N = S.Length;
		if(N == 1){
			Console.WriteLine(S);
			return;
		}
		
		
		List<char> L = new List<char>();
		for(int i=0;i<N - 1;i++){
			L.Add('9');
		}
		L.Add(S[0]);
		L.Reverse();
		var s = new String(L.ToArray());
		var ll = long.Parse(s);
		var lx = long.Parse(S);
		if(ll == lx){
			Console.WriteLine(s.Sum(c => (int)(c - '0')));
		} else {
			Console.WriteLine((long)(S[0] - '0') - 1 + (N - 1) * 9);
		}
		
		
		
	}
	String S;
	public Sol(){
		S = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13268
package main

import "fmt"

func main() {
	var base string
	fmt.Scanf("%s", &base)
	switch base {
	case "A":
		fmt.Println("T")
	case "T":
		fmt.Println("A")
	case "C":
		fmt.Println("G")
	case "G":
		fmt.Println("C")
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>
 
using namespace std;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;
typedef vector<pii> vp;

#define INF (1<<29)
#define INFL (1ll<<60)
#define EPS (1e-8)
#define PI (acos(-1))
const ll MOD = 1000000007ll;

ll mod_pow(ll x, ll n, ll mod) {
	if (n == 0) return 1;
	ll res = mod_pow(x * x % mod, n / 2, mod);
	if (n & 1) res = res * x % mod;
	
	return res;
}

int n;
int a[112345], b[112345];
int data[2][112345];
int c[112345];

int main() {	
	cin >> n;
	REP(i, n) scanf("%d", a + i);
	REP(i, n) scanf("%d", b + i);
	
	fill(data[0], data[2], -1);
	data[0][0] = a[0];
	FOR(i, 1, n) if (a[i] != a[i - 1]) data[0][i] = a[i];
	
	data[1][n - 1] = b[n - 1];
	for (int i = n - 2; i >= 0; i--) if (b[i] != b[i + 1]) data[1][i] = b[i];
	
	fill(c, c + n, -1);
	
	bool ng = false;
	REP(i, n) {
		if (~data[0][i] && ~data[1][i]) {
			if (data[0][i] != data[1][i]) ng = true;
			else c[i] = data[0][i];
		}
		else {
			if (~data[0][i]) {
				if (a[i] > b[i]) ng = true;
				c[i] = data[0][i];
			}
			if (~data[1][i]) {
				if (b[i] > a[i]) ng = true;
				c[i] = data[1][i];
			}
		}
	}
	
	if (ng) puts("0");
	else {
		ll ans = 1;
		
		int pos = 0;
		while (pos < n) {
			if (c[pos] != -1) {
				pos++;
				continue;
			}
			
			int cnt = 0, l = pos - 1;
			while (c[pos] == -1) pos++, cnt++;
			int r = pos;
			
			ans = ans * mod_pow(min(a[l], b[r]), cnt, MOD) % MOD;
		}
		
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2304
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();

		if(a+b>=10)
			System.out.println("error");
		else
			System.out.println(a+b);
	}

}

Measured memory_bytes: 21716
//encoding:utf-8
//#include <iostream> //c++
//#include<stack> //スタックに関して　最新のデータから捨てる
//#include<queue> //キューに関して　最古のデータから捨てる
//#include<math.h>
//#include<vector>
//#include<algorithm> //sort とかにいる
#include<bits/stdc++.h>//vector,algorithm,que
#include<time.h> //時間にかんして

#define ll long long
#define MOD 1000000007
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  ll number = 1;
  for(int i=0;i<N;i++){
    if(number>K){
      number += K;
    }
    else{
      number = number*2;
    }
  }
  cout<<number<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

ll rep_power_modM(ll a, ll n, ll M = MOD){
    if(n == 0)return 1;
    if(n%2 == 0){ll tmp = rep_power_modM(a,n/2,M); return tmp*tmp%M;}
    return a*rep_power_modM(a,n-1,M)%M;
}

int main(){
	string s;cin>>s;
	map<ll,ll> cnt;
	vector<int> sum(s.size()+1,0);
	cnt[0]++;
	rep(i,s.size()){
		int t = (s[s.size()-1-i]-'0') * rep_power_modM(10,i, 2019)%2019;
		sum[i+1] = (sum[i] + t)%2019;
		cnt[sum[i+1]]++;
	}
	ll ans = 0;
	for(auto x: cnt)ans += (ll)x.second*(x.second-1)/2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4356
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = 998244353;
const long long INF_LL = 1e18+11; const int INF_int = 1e9+11;
#define ll long long
#define mp std::make_pair
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto x:a) cout << x << " ";cout << endl;
#define pii pair<int,int>
int main(){
    char a;
    cin >> a;
    if(int(a-'a')>=0) cout << 'a' << endl;
    else cout << 'A' << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>
int main(void){
    int m, f, r, p;
    while(1){
        scanf("%d %d %d", &m, &f, &r);
        p = m + f;
        if(m == -1 && f == -1 && r == -1) break;
        else if(m==-1||f==-1)
            printf("F\n");
        else if(80 <= p)
            printf("A\n");
        else if(65 <= p && p < 80)
            printf("B\n");
        else if(50 <= p && p < 65)
            printf("C\n");       
        else if(30 <= p && p < 50)
            if(r>=50)
                printf("C\n");
            else
                printf("D\n");
        else
            printf("F\n");
    }
   return 0;
   
}




Measured memory_bytes: 2072
n = input()
s = int(n)
min = 100000
for i in range(1,s):
  a = str(s - i)
  array1 = list(map(int, list(a)))
  array2 = list(map(int, list(str(i))))
  b = sum(array1) + sum(array2)
  if b < min:
    min = b
print(min)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ls x<<1
#define rs x<<1|1
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=1e7+19;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=3e5+100;
int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}
ll qpow(ll a,ll b){
	ll ret=1;
	while(b){
		if(b&1)ret*=a;
		b>>=1;
		a*=a;
	}
	return ret;
}
ll get(ll x){
	return x*(x+1)/2;
}
int a[maxn];
void solve()
{
    ll n;cin>>n;
    cout<<get(n-1)<<endl;
}
int main(){
	//freopen("in.txt","r",stdin);
	//freopen("D://out.txt","w",stdout);
    //IOS;
    solve();
    return 0;
}

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

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

ll mod(ll a){
  return a % 1000000007;
}


int main(){
  ll n; cin >> n; deque<ll> num;
  
  for(ll i=0; i < n; i++){
    ll x; cin >> x;
    if(i % 2 == 0) num.push_back(x);
    else num.push_front(x);
  }
  
  while(!num.empty()){
    if(n % 2 == 0){
      cout << num.front() << ' ';
      num.pop_front();
    }
    else{
      cout << num.back() << ' ';
      num.pop_back();
    }
  }
  
  cout << endl;
}


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

int main() {
  int N;
  string S;
  bool exist_y = false;
  
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> S;

    if (S == "Y") {
      exist_y = true;
      break;
    }
  }
  
  if (exist_y) {
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
      
}



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

int main(void){
    int n;
    cin >> n;
    int v[n],c[n];
    for(int i=0; i<n; i++) cin >> v[i];
    for(int i=0; i<n; i++) cin >> c[i];

    int x=0,y=0;
    for(int j=0; j<n; j++){
        if(v[j] > c[j]){
            x += v[j];
            y += c[j];
        }
    }

    cout << x - y << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <math.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
int n,m,ans,q;
P a[100005];
int main(void){
    cin>>n>>m;
    for(int i=0;i<m;i++)cin>>a[i].F>>a[i].S;
    sort(a,a+m);
    priority_queue<int,vector<int>,greater<int>>p;
    for(int i=0;i<m;i++){
        if(!p.empty()&&a[i].F>=p.top()){
            ans++;
            while(!p.empty())p.pop();
        }
        p.push(a[i].S);
    }
    if(!p.empty())ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
  
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const long long LINF = 1e18 + 3141;
 
void solve(){
    int a, b;
    cin >> a;
    if(a >= 30) {
        cout << "Yes";
    }else {
        cout << "No";
    }
}
 
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long ll;
ll n;
ll k;
std::vector<ll> posi, nega;
ll n1, n2;
ll cntz;
ll count(ll x) //小于等于x的数量
{
	if (x < 0)
	{
		ll c = 0;
		int j = n2;
		for (int i = 0; i < n1; i++)
		{
			while (j > 0 && -nega[j - 1] * posi[i] <= x)
				j--;
			c += n2-j;
		}
		return c * 2;
	}
	else if (x > 0) //用大于x的算
	{
		ll c = 0;
		int j = n1;
		for (int i = 0; i < n1; i++)
		{
			while (j > 0 && posi[i] * posi[j - 1] > x)
				j--;
			c += n1 - j;
			if (j <= i)
				c--;
		}
		j = n2;
		for (int i = 0; i < n2; i++)
		{
			while (j > 0 && nega[i] * nega[j - 1] > x)
				j--;
			c += n2 - j;
			if (j <= i)
				c--;
		}
		return n * (n - 1) - c;
	}
	else
		return 2 * n * cntz - cntz * (cntz + 1) + 2LL * n1 * n2;
}

int main()
{
	// freopen("test.in","r",stdin);
	scanf("%lld%lld", &n, &k);
	for (int i = 1; i <= n; i++)
	{
		ll a;
		scanf("%lld", &a);
		if (a > 0)
			posi.push_back(a);
		else if (a == 0)
			cntz++;
		else
			nega.push_back(-a);
	}
	std::sort(posi.begin(), posi.end());
	std::sort(nega.begin(), nega.end());
	n1 = posi.size();
	n2 = nega.size();
	// printf("%lld\n",count(-3));
	// for(ll i=1;i<=n*(n-1)/2;i++)
	// {
	// 	k=i;
	ll l = -1e18, r = 1e18, mid = (l + r) / 2;
	ll ans;
	while (l <= r)
	{
		ll temp = count(mid) / 2;
		if (temp >= k)
			r = mid - 1, ans = mid;
		else
			l = mid + 1;
		mid = (l + r) / 2;
		// printf("%lld %lld %lld\n",l,r,mid);
	}
	printf("%lld\n", ans);
	// }

	return 0;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

const ll mod = 1000000007;

template<typename T>
static inline void chmin(T & ref, const T  value) {
	if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
	if (ref < value) ref = value;
}

int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> as(n);
	rep(i, n) cin >> as[i];
	for (int i = k; i < n; i++) {
		if (as[i - k] >= as[i]) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 4788
N = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

k = 0
for i in range(N):
    j = N - i - 1
    bi = bl[j]
    ai1 = al[j+1]
    if bi <= ai1:
        k += bi
        continue
    elif bi > ai1:
        k += ai1
        bi -= ai1
        ai = al[j]
        if bi <= ai:
            k += bi
            al[j] -= bi
            continue
        elif bi > ai:
            k += ai
            al[j] = 0
            continue

print(k)

Measured memory_bytes: 18624
#include<stdio.h>

int main(){
	int N, T, A;
	scanf("%d%d%d", &N, &T, &A);
	T *= 1000;
	A *= 1000;
	int H[N];
	int t[N];
	int ans = 0;
	for(int i=0; i<N; i++){
		scanf("%d", &H[i]);
		t[i] = T - H[i]*6;
		if((t[i]>A?t[i]-A:A-t[i]) < (t[ans]>A?t[ans]-A:A-t[ans])){
			ans = i;
		}
	}
	printf("%d", ans+1);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
  int n;
  cin >> n;
  vector<int>d;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    d.push_back(x);
  }
  sort(d.begin(),d.end());
  int hn = n / 2;
  cout << d[hn] - d[hn-1];
  return 0;
}

Measured memory_bytes: 892
n,m = gets.split.map(&:to_i)
q = m.times.map{gets.split.map{|i|i.to_i-1}}.sort_by{|i,j|i*100000+j}
l = 1000000
ans = 0
m.times do |i|
    l = q[i][1] if l > q[i][1]
    if l <= q[i][0]
        ans += 1
        l = q[i][1]
    end
end
p ans+1

Measured memory_bytes: 14608
using System;

class Atcoder41
{
    public static void Main()
    {
        string letter = Console.ReadLine();

        if (letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u")
            Console.WriteLine("vowel");
        else
            Console.WriteLine("consonant");
    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
using namespace std;
int main() {
    int N;
    cin >> N;
    
    int d[100000];
    int i = 0;
    while(i < N){
        cin >> d[i];
        i++;
    }
    
    sort(d, d+N);
    cout << d[N/2] - d[N/2-1] << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
#include <set>

std::vector<int> X, Y;
std::string input;

std::set<int> resultX[2], resultY[2];

int main(void) {
	std::cin >> input;
	int start_x = 0, finish_x, finish_y;
	bool flag = true, XY = true;
	
	scanf("%d %d", &finish_x, &finish_y);

	int f = 0;
	for (int i = 0; i < input.size(); i++) {
		if (input[i] == 'T') {
			flag = false;
			if (XY) {
				XY = false;
				X.push_back(f);
			}
			else {
				XY = true;
				Y.push_back(f);
			}
			f = 0;
			continue;
		}

		if (flag)
			start_x++;
		else
			f++;
	}

	if (f != 0 && XY)
		X.push_back(f);
	else if (f != 0 && !XY)
		Y.push_back(f);

	resultX[0].insert(start_x);
	resultY[0].insert(0);

	for (int i = 0; i < X.size(); i++) {
		int cur = (i % 2), next = (i + 1) % 2;

		for (auto it = resultX[cur].begin(); it != resultX[cur].end(); it++) {
			int val1 = *it + X[i], val2 = *it - X[i];
			if (val1 <= 8000)
				resultX[next].insert(val1);
			if (val1 >= -8000)
				resultX[next].insert(val2);
		}
		resultX[cur].clear();
	}

	for (int i = 0; i < Y.size(); i++) {
		int cur = (i % 2), next = (i + 1) % 2;

		for (auto it = resultY[cur].begin(); it != resultY[cur].end(); it++) {
			int val1 = *it + Y[i], val2 = *it - Y[i];
			if (val1 <= 8000)
				resultY[next].insert(val1);
			if (val2 >= -8000)
				resultY[next].insert(val2);
		}
		resultY[cur].clear();
	}

	int curX = X.size() % 2, curY = Y.size() % 2;

	if (resultX[curX].find(finish_x) != resultX[curX].end() && resultY[curY].find(finish_y) != resultY[curY].end())
		printf("Yes\n");
	else
		printf("No\n");
}

Measured memory_bytes: 768
N=int(input())
A=[int(_) for _ in input().split()]
ans=0

while True:
    flg=True
    for i in A:
        if i%2==1:
            flg=False
            break
    
    if flg:
        A=[i//2 for i in A]
        ans+=1
    else:
        break
print(ans)

Measured memory_bytes: 2940
n,x = map(int,input().split(' '))
A = list(map(int,input().split(' ')))
A.sort()
i = 0
while i < n:
    if x > A[i]:
        x = x - A[i]
        i += 1
    elif x == A[i]:
        x = 0
        i += 1
        break
    else:
        break
if i == n and x > 0:
    print(i-1)
else:
    print(i)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
#define sort(v) sort(v.begin(), v.end())
#define sortr(v) sort(v.rbegin(), v.rend())
void chmin(int &a, int b) {if(a > b) a = b;}
void chmax(int &a, int b) {if(a < b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};


int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b && b == c) cout << "No";
    else if (a == b || b == c || c == a) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>

using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;

int main()
{
	int n;
	cin>>n;
	int ans=0;
	for(int i=3; i<=n; i+=2){
		int c=0;
		for(int j=1; j<=i; j++){
			if(i%j==0) c++;
		}
		if(c==8) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

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

const int MOD = 1000000007;


//void warshall_floyd(int n){
//    for(int k=0;k<n;k++){
//        for(int i=0;i<n;i++){
//            for(int j=0;j<n;j++){
//                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
//            }
//        }
//    }
//}
//ll calc_digit(ll N) {
//    ll res = 0;
//    while (N) {
//        ++res;
//        N /= 10;
//    }
//    return res;
//}
//ll sum_digit(ll N) {
//    ll res = 0;
//    while (N) {
//        res += N % 10;
//        N /= 10;
//    }
//    return res;
//}


int main(){
    int ans = 0;
    int a,b,c,x,y; cin >> a >> b >> c >> x >> y;
    while(true){
        if(x == 0 && y == 0) break;
        while(true){
            if(x == 0 || y == 0) break;
            ans += min(a+b,c*2);
            x--;y--;
        }
        if(x > 0){
            ans += min(a,c*2);
            x--;
        }
        if(y > 0){
            ans += min(b,c*2);
            y--;
        }
    }
    cout << ans;
}



Measured memory_bytes: 3492
#include <iostream>
#include <cstdio>

using namespace std;

int paper[14][14] = {0};

void drop(int n, int m, int l)
{
    if ( l == 3 )
    {
        paper[n - 2][m]++;

        paper[n - 1][m - 1]++;
        paper[n - 1][m]++;
        paper[n - 1][m + 1]++;
        
        paper[n][m - 2]++;
        paper[n][m - 1]++;
        paper[n][m]++;
        paper[n][m + 1]++;
        paper[n][m + 2]++;

        paper[n + 1][m - 1]++;
        paper[n + 1][m]++;
        paper[n + 1][m + 1]++;

        paper[n + 2][m]++;

    }
    else if ( l == 2 )
    {
        paper[n - 1][m - 1]++;
        paper[n - 1][m]++;
        paper[n - 1][m + 1]++;
        
        paper[n][m - 1]++;
        paper[n][m]++;
        paper[n][m + 1]++;

        paper[n + 1][m - 1]++;
        paper[n + 1][m]++;
        paper[n + 1][m + 1]++;
    }
    else if( l == 1 )
    {
        paper[n - 1][m]++;

        paper[n][m - 1]++;
        paper[n][m]++;
        paper[n][m + 1]++;

        paper[n + 1][m]++;
    }
    
    return;
}

int n, m, l;

int main()
{
    while (scanf("%d,%d,%d\n", &n, &m, &l) != EOF)
    {

        n += 2;
        m += 2;
        drop(n, m, l);
   /*      printf( "%d %d %d\n", n, m, l );
 */
/* 
        for (int i = 2; i < 12; i++)
        {
            for (int j = 2; j < 12; j++)
            {
                printf(" %d", paper[i][j]);
            }
            printf("\n");
        } */
    }

    int zero = 0, max = 0;
    for (int i = 2; i < 12; i++)
    {
        for (int j = 2; j < 12; j++)
        {
            if (paper[i][j] == 0)
            {
                zero++;
            }
            else if (paper[i][j] > max)
            {
                max = paper[i][j];
            }
        }
    }
    printf("%d\n%d\n", zero, max );
    return 0;
}


Measured memory_bytes: 3212
function Main(input) {
  var input = input.split("\n");
  var b = input[0];

  if(b == "A") {
    console.log("T");
  }
  if(b == "T") {
    console.log("A");
  }
  if(b == "C") {
    console.log("G");
  }
  if(b == "G") {
    console.log("C");
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        HashMap<Character, Character> map = new HashMap<>();
        map.put('A','T');
        map.put('T','A');
        map.put('C','G');
        map.put('G','C');
        StringBuilder sb = new StringBuilder();
        for( Character c : s.toCharArray()) {
            sb.append(map.get(c));
        }
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 22608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll h,n;cin>>h>>n;
    vi v(n),w(n);
    rep(i,n)cin>>w[i]>>v[i];
    vvi dp(n,vi(h+1,inf));
    rep(i,n){
        rep(j,h+1){
            if(j<=w[i])dp[i][j]=v[i];
            if(j>=w[i])chmin(dp[i][j],dp[i][j-w[i]]+v[i]);
            if(i)chmin(dp[i][j],dp[i-1][j]);
        }
    }
    out(dp[n-1][h]);
}

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

int main(){
  string s;
  cin >> s;
  reverse(s.begin(),s.end());
  for(int i=0; i<s.size(); i++){
    if(s[i]=='m' && s[i+1]=='a' && s[i+2]=='e' && s[i+3]=='r' && s[i+4]=='d') i+=4;
    else if(s[i]=='r' && s[i+1]=='e' && s[i+2]=='m' && s[i+3]=='a' && s[i+4]=='e' && s[i+5]=='r' && s[i+6]=='d') i+=6;
    else if(s[i]=='e' && s[i+1]=='s' && s[i+2]=='a' && s[i+3]=='r' && s[i+4]=='e') i+=4;
    else if(s[i]=='r' && s[i+1]=='e' && s[i+2]=='s' && s[i+3]=='a' && s[i+4]=='r' && s[i+5]=='e') i+=5;
    else{
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
  
  
  


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

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;

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

    vector<int> a(3*N);
    REP(i, 3*N)
        cin >> a[i];

    sort(a.begin(), a.end());

    long int sum = 0;
    for (int i = N; i < 3*N - 1; i += 2){
        sum += a[i];
    }

    cout << sum << endl;
}

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

int gcd(int a,int b) {
  return (b? gcd(b,a%b):a);
}

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

  int a[100005];
  for (int i=0; i<n; i++) {
    cin>>a[i];
  }
  int g_l[100005],g_r[100005];
  int g=a[0];
  for (int i=0; i<n; i++) {
    g=gcd(g,a[i]);
    g_l[i]=g;
  }
  g=a[n-1];
  for (int i=0; i<n; i++) {
    g=gcd(g,a[n-1-i]);
    g_r[n-1-i]=g;
  }
  int ans=g_r[1];
  for (int i=0; i<n-1; i++) {
    ans=max(ans,gcd(g_l[i-1],g_r[i+1]));
  }
  ans=max(ans,g_l[n-2]);
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 1408
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{

    private static int n;

    private static int rec(int sum,int pre,int cnt)
    {

	if(sum > n)
	    return 0;

	if(sum == n)
	    return 1;

	if(cnt >= 3)
	    {	   
		int dif = n-sum;
		
		    int res = (int)Math.sqrt(dif);
		    if(res >= pre)
			{
			    if(res*res == dif)return 1;
			}
		    return 0;
	    }
	
	
	int counter = 0;
	for(int i=pre;sum+Math.pow(i,2)<=n;i++)
	    {
		counter += rec(sum+i*i,i,cnt+1);
	    }
	return counter;
    }
    
      public static void main(String args[])throws IOException
    {
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));


	while(true)
	    {
		n = Integer.parseInt(in.readLine());
		if(n == 0)
		    break;
		System.out.println(rec(0,1,0));
	    }
    }
    
}

Measured memory_bytes: 9552
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k;
  cin>>n>>k;
  vector<int> flag(n);
  vector<int> treat(k);
  for(int i=0;i<k;i++){
    cin>>treat.at(i);
    vector<int> candy(treat.at(i));
    for(int j=0;j<treat.at(i);j++){
      cin>>candy.at(j);
    }
    for(int m=0;m<treat.at(i);m++){
      flag.at(candy.at(m)-1)=1;
    }
  }
  int x=n;
  for(int l=0;l<n;l++){
    x=x-flag.at(l);
  }
  cout<<x;
}

Measured memory_bytes: 3612
{-# LANGUAGE BangPatterns #-}

import Control.Monad
import qualified Data.ByteString.Builder as B
import qualified Data.ByteString.Char8 as C
import Data.List
import Data.Monoid
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import Debug.Trace
import System.IO


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

printV :: (Show a, U.Unbox a) => U.Vector a -> IO ()
printV v =
    let showB = B.string8 . show
    in  B.hPutBuilder stdout $ 
            U.foldl' (\ac a -> ac <> B.char8 ' ' <> showB a) (showB $ U.head v) (U.tail v)
                <> B.char8 '\n'

main :: IO ()
main = do
    [n,k] <- r'
    as <- r n
    res <- (k `timesUntilM` solve) (U.all (==n)) as
    printV res

solve :: U.Vector Int -> IO (U.Vector Int)
solve v = do
    let on  = U.imap (\i a -> max 1 ((i+1)-a)) v
        off = U.imap (\i a -> min (U.length v) (i+1+a)) v

    onI  <- UM.replicate (U.length v) 0
    offI <- UM.replicate (U.length v) 0
    U.forM_ on  (UM.modify onI  succ . pred)
    U.forM_ off (UM.modify offI succ . pred)
    onIF  <- U.freeze onI
    offIF <- U.freeze offI
    let difs = U.zipWith (-) (U.tail onIF) offIF
    return $ U.scanl' (+) (U.head onIF) difs

timesUntilM :: Monad m => Int -> (a -> m a) -> (a -> Bool) -> a -> m a
timesUntilM  0 f g x         = return x
timesUntilM !n f g x | g x   = return x
timesUntilM !n f g x         = f x >>= timesUntilM (n-1) f g


Measured memory_bytes: 45556
def toBasen2(x, sign):
    foo = ''
    k = 1
    while k <= x:
        if (x & k) == k:
            foo += '1'
            if not sign:
                x += k
        else:
            foo += '0'
        k <<= 1
        sign = not sign
    if foo == '':
        foo = '0'
    return foo[::-1]

def main():
    x = int(raw_input())
    if x >= 0:
        print toBasen2(x, True)
    else:
        print toBasen2(-x, False)

if __name__ == '__main__':
    main()

Measured memory_bytes: 2568
import java.io.*;
import java.util.*;

public class Main {

    private void solve() {
        Queue<Long> q = new ArrayDeque<>();
        for (int i = 1; i < 10; i++) {
            q.add((long)i);
        }

        int k = sc.nextInt();
        int n = 1;
        int ans = 0;
        while (n < k && !q.isEmpty()) {
            long u = q.poll();
            long d = u % 10;
            if (d > 0) {
                q.add(u * 10 + (d - 1));
            }
            q.add(u * 10 + d);
            if (d + 1 < 10) {
                q.add(u * 10 + (d + 1));
            }
            ++n;
        }

        out.println(q.poll());
    }

    private static PrintWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().solve();
        out.close();
    }
}


Measured memory_bytes: 42656
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountll
#define m_p make_pair
#define infi 1e18+1
#define eps 0.000000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
//////////////
auto clk=clock();
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define sz(x) ((long long)x.size())
#define int long long  
#define f80 __float128
#define pii pair<int,int>
/////////////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n,x,t;
	cin>>n>>x>>t;
	cout<<((int)((n+x-1)/x))*t;
	#ifdef ANIKET_GOYAL
		// cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
	#endif
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define ff first
#define ss second

void solve()
{
    int n, ans=0;
    cin>>n;
    int p=100;
    while(p<n)
    {
        int i=p/100;
        p+=i;
        ans++;
    }
    cout<<ans<<endl;
}

int32_t main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    int t=1;
    // cin>>t;
    while(t--)
        solve();
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
	char s[200005];
	int k=0;
	scanf("%s",s);
	for(int i=0;i<strlen(s);i++){
		k+=s[i]-'0';
		k%=9;
	}
	if(k%9==0){
		printf("Yes");
	}else{
		printf("No");
	}
}

Measured memory_bytes: 3940
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n,k,s,t,i,f;
    long long ara[200005];
    scanf("%lld %lld",&n,&k);
    for(i = 0;i < n;i++){
        scanf("%lld",&ara[i]);
    }
    for(i = k;i < n;i++){
        if(ara[i] > ara[i - k]){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
        t = s;
    }
    return 0;
}


Measured memory_bytes: 5312