akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <cstdio>
#include <cmath>

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) for(int i = 0; i < (n); ++i)

using ll = long long;
using namespace std;

constexpr int INF = 2147483647; // 2 * 1e9
constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

struct Task{
	int time;
	int end_time;
	string name;
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	queue<Task> tasks;
	queue<Task> done;
	int n, q, now = 0;
	cin >> n >> q;
	REP(i, n){
		Task task;
		cin >> task.name >> task.time;
		tasks.push(task);
	}

	while(!tasks.empty()){
		Task task = tasks.front(); tasks.pop();
		if(task.time <= q){
			now += task.time;
			task.end_time = now;
			done.push(task);
		}
		else{
			now += q;
			task.time -= q;
			tasks.push(task);
		}
	}
	while(!done.empty()){
		Task task = done.front();done.pop();
		cout << task.name << " " << task.end_time << "\n";
	}
	return 0;
}

Measured memory_bytes: 6264
#include <iostream>
#include <math.h>
using namespace std;

int a[100010], n;

void init(int k) {
    int l = 0;
    while (a[n] == 0) {
        if (l == 0) {
            a[1] = l + 1;
            for (int i = 0; pow(6, i) <= 100000; i++) {
                a[int(pow(6, i))] = l + 1;
            }
            for (int i = 0; pow(9, i) <= 100000; i++) {
                a[int(pow(9, i))] = l + 1;
            }
        }
        else {
            for (int j = 1; j <= 100000; j++) {
                if (a[j] == l) {
                    if (a[j + 1] == 0) a[j + 1] = l + 1;
                    for (int i = 0; j + pow(6, i) <= 100000; i++) {
                        if (a[j + int(pow(6, i))] == 0) a[j + int(pow(6, i))] = l + 1;
                    }
                    for (int i = 0; j + pow(9, i) <= 100000; i++) {
                        if (a[j + int(pow(9, i))] == 0) a[j + int(pow(9, i))] = l + 1;
                    }
                }
            }
        }
        l++;
    }
    cout << a[n] << endl;
}



int main(void){
    cin >> n;
    for (int i = 1; i <= 100000; i++) a[i] = 0;
    init(1);
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x[] = new int[n + 1];
		int y[] = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			x[i] = sc.nextInt();
			y[i] = x[i];
		}
x[0]=0;
y[0]=0;
int max=0;
int ans=0;
for (int i = 1; i <= n; i++) {
if(max<=x[i]){
	max=x[i];
ans++;
}


}

System.out.println(ans);
	}
}

Measured memory_bytes: 22100
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int m = scanner.nextInt();
        int[] f = new int[m];
        long ans = 0;
        for (int i = 0; i < m; ++i) {
            int d = scanner.nextInt();
            long c = scanner.nextLong();
            while (c >= 10) {
                ans += (c / 10) * (d + 9);
                c = c / 10 + c % 10;
            }
            int t = 0;
            ans += c - 1;
            for (int j = 0; j < c; ++j) {
                t += d;
                while (t >= 10) {
                    t = t - 9;
                    ++ans;
                }
            }
            f[i] = t;
        }
        int t = 0;
        ans += m - 1;
        for (int i = 0; i < m; ++i) {
            t += f[i];
            while (t >= 10) {
                t = t - 9;
                ++ans;
            }
        }
        writer.println(ans);
        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        private void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        private char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        private String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

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

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

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

Measured memory_bytes: 53856
for e in iter(input,'0'):
 a=[list(map(int,input().split()))for _ in[0]*int(e)]
 b=[tuple(map(int,input().split()))for _ in[0]*int(input())]
 for s,t in b:
  u,v=a[0]
  x,y=s-u,t-v
  if not set((u+x,v+y)for u,v in a)-set(b):print(x,y);break


Measured memory_bytes: 5916
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
int ctoi(char c){return c-'0';}



// TODO: write
int main() {   
  int a,b;cin>>a>>b;
  rep(i,100000){
    if((int)(i * 0.08) == a && (int)(i * 0.1) == b){
      print(i);
      return 0;
    }
  }
  print(-1);
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
using namespace std;
int main() {
	long long x;
	long long ans = 0;
	cin >> x;
	for (int i = 1;;i++) {
		ans += i;
		if (ans >= x) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
s=list(input())
n=len(s)
list=[]
for i in range(n):
    if s[i]=="A":
        list.append(i+1)
        break
for i in range(n):
    if s[n-1-i]=="Z":
        list.append(n-i)
        break
print(list[1]-list[0]+1)

Measured memory_bytes: 4840
function main (s) {
    s=s.split(" ");
	for(var i=0;i<4;i++)s[i]=parseInt(s[i]);
	console.log((s[0]*s[1]>s[2]*s[3])?(s[0]*s[1]):(s[2]*s[3]));
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000000000000000
struct SEG{
	ll seg[1<<19];
	SEG(void){for(int i=0;i<1<<19;i++)seg[i]=INF;}
	void up(int a,ll x){
		a+=(1<<18)-1;
		seg[a]=min(seg[a],x);
		while(a>0){
			a=(a-1)/2;
			seg[a]=min(seg[a*2+1],seg[a*2+2]);
		}
	}
	ll que(int a,int b,int l,int r,int k){
		if(r<a||b<l)return INF;
		if(a<=l&&r<=b)return seg[k];
		return min(que(a,b,l,(l+r-1)/2,k*2+1),que(a,b,(l+r+1)/2,r,k*2+2));
	}
};
ll n,q,A,B,s,x[200005],ans=INF;
SEG l,r;
int main(void){
    scanf("%lld%lld%lld%lld",&n,&q,&A,&B);
    A--,B--;
    for(int i=0;i<q;i++){
		scanf("%lld",x+i);
		x[i]--;
	}
    l.up(B,abs(A-x[0])-B),l.up(A,abs(B-x[0])-A);
    r.up(B,abs(A-x[0])+B),r.up(A,abs(B-x[0])+A);
    for(int i=1;i<q;i++){
		ll p=min(l.que(0,x[i],0,(1<<18)-1,0)+x[i],r.que(x[i],n-1,0,(1<<18)-1,0)-x[i])+s;
		s+=abs(x[i]-x[i-1]);
		l.up(x[i-1],p-s-x[i-1]);
		r.up(x[i-1],p-s+x[i-1]);
	}
	for(int i=0;i<n;i++)ans=min(ans,l.seg[i+(1<<18)-1]+i);
	printf("%lld\n",ans+s);
}


Measured memory_bytes: 10112
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
  public static void main(String[] arg) {
    Scanner sc = new Scanner(System.in);
    int count = 0;
    // 入力値の1行目は不要なので読み捨てる
    sc.nextLine();
    // 入力値の2行目をint型の配列に格納
    int[] numbers = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::valueOf).toArray();
    sc.close();

    for (int i = 0; i < numbers.length; i++) {
      for (int j = numbers.length - 1; j >= i + 1; j--) {
        if (numbers[j] < numbers[j - 1]) {
          int tmp = numbers[j];
          numbers[j] = numbers[j - 1];
          numbers[j - 1] = tmp;
          count++;
        }
      }
    }

    System.out.println(
        Arrays.stream(numbers).boxed().map(String::valueOf).collect(Collectors.joining(" ")));
    System.out.println(count);
  }
}


Measured memory_bytes: 32804
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <numeric>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)

typedef long long ll;

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N, K;
    cin >> N >> K;

    ll one = abs(N-(K*((N/K)+1)));
    ll two = abs(N-(K*((N/K))));
    cout << min(one, two) << endl;
    return 0;
}


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

int main() {
    int x1,x2,x3,x4,y1,y2,y3,y4;
    int dx,dy;
    cin >> x1 >> y1 >> x2 >> y2;
    dx = x2-x1;
    dy = y2-y1;

    if(dx >= 0){
        if(dy >= 0){
            x3= x2 - abs(dy);
            y3= y2 + abs(dx);
            x4= x3 - abs(dx);
            y4= y3 - abs(dy);
        }else{
            x3= x2 + abs(dy);
            y3= y2 + abs(dx);
            x4= x3 - abs(dx);
            y4= y3 + abs(dy);
        }
    }else{
        if(dy >= 0){
            x3= x2 - abs(dy);
            y3= y2 - abs(dx);
            x4= x3 + abs(dx);
            y4= y3 - abs(dy);
        }else{
            x3= x2 + abs(dy);
            y3= y2 - abs(dx);
            x4= x3 + abs(dx);
            y4= y3 + abs(dy);
        }
    }

    cout <<  x3 << " " << y3 << " " << x4 << " " << y4 << endl;  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <queue>
#include <tuple>
#include <cstring>

using namespace std;

#define rep(i,n) for(int i = 0;i < n;i++)

char s[100][100];
int d[100][100][2];

int dx[2][9] = { { 1, 1, 1, 1, 1, 2, 2, 2, 3 },
				{ -1, -1, -1, -1, -1, -2, -2, -2, -3 } };
int dy[9] = { 2,1,0,-1,-2,1,0,-1,0 };

const int INF = 1e9;

typedef tuple<int, int, int> T;

bool cheak(int x, int y, int mx, int my){
	return x >= 0 && y >= 0 && x < mx && y < my;
}

int main(){

	int w, h;

	while (cin >> w >> h && w){

		memset(s, 0, sizeof s);

		rep(i, 100)rep(j, 100)rep(k, 2)d[i][j][k] = INF;

		queue<T> q;
		rep(y, h)rep(x, w){
			cin >> s[y][x];
			if (s[y][x] == 'S'){
				q.push(T(y, x, 0));
				q.push(T(y, x, 1));
				d[y][x][0] = 0;
				d[y][x][1] = 0;
			}
		}

		while (q.size()){
			int y = get<0>(q.front());
			int x = get<1>(q.front());
			int r = get<2>(q.front());
			q.pop();

			rep(i, 9){
				int tx = x + dx[r][i];
				int ty = y + dy[i];

				int tmp = 0;
				if (s[ty][tx] >= '0' && s[ty][tx] <= '9')tmp = s[ty][tx] - '0';

				if (cheak(tx, ty, w, h) && (d[ty][tx][1-r] > d[y][x][r] + tmp)
					&& (s[ty][tx] != 'X')){

					d[ty][tx][1-r] = d[y][x][r] + tmp;
					q.push(T(ty, tx, 1 - r));
				}
			}
		}

		int ans = INF;
		rep(y, h)rep(x, w){
			if (s[y][x] == 'T'){
				ans = min(ans, d[y][x][0]);
				ans = min(ans, d[y][x][1]);
			}
		}

		if (ans == INF)ans = -1;
		cout << ans << endl;
	}

	return 0;
}

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

using namespace std;

int n, k;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n >> k;
    if (k * (n / k) < n)
        return cout << n / k + 1, 0;
    return cout << n / k, 0;
}


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

int main(void) {
    int i, n, k, x=1;
    cin >> n >> k;
    for(i=0; i<n; i++) {
        if((x*2)>=(x+k))
            x+=k;
        else
            x*=2;
    }
    cout << x << endl;
}

Measured memory_bytes: 256
#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
// なぞなぞ： メモリの海上で未使用部分を奪い合う人々は誰？　答え：ハイレーツ
#define DB cerr<<"D"<<endl // これはデバッグ用
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";};
using P=pair<int,int>;
//const ll M = 1e9+7;
ll M;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
ll adad(ll x) {return x*(x+1)/2;} // 1～xの総和
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;}
bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}

int main() {
  int n; cin>>n;
  int ac=0,wa=0,tle=0,re=0;
  for(int i=0;i<n;i++) {
    string s; cin>>s;
    if (s[0]=='A') {
      ac++;
    } else if (s[0] == 'W') {
      wa++;
    } else if (s[0] == 'T') {
      tle++;
    } else {
      re++;
    }
  }
  cout<<"AC x "<<ac<<endl;
  cout<<"WA x "<<wa<<endl;
  cout<<"TLE x "<<tle<<endl;
  cout<<"RE x "<<re<<endl;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){
    int r,c,t;
    long long k=0;
    cin>>r>>c>>t;
    long long R[100][100]={};
    long long SA[100][100]={};
    for (int i=0;i<r;i++){
        for(int x=0;x<c;x++){
            cin>>R[i][x];
        }
    }
    for (int i=0;i<c;i++){
        for(int x=0;x<t;x++){
            cin>>SA[i][x];
        }
    }
    for(int s=0;s<r;s++){
        for (int i=0;i<t;i++){
            for(int x=0;x<c;x++){
                k+=R[s][x]*SA[x][i];
            }
            if (i==t-1) cout<<k;
            else cout<<k<<" ";
            k=0;
        }
        cout<<endl;
    }
}



Measured memory_bytes: 3240
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  int n;
  cin >> n;
  vl t(n);
  ll sum = 0;
  rep(i,n){
    cin >> t[i];
    sum += t[i];
  }

  int m;
  cin >> m;
  rep(i,m){
    int p,x;
    cin >> p >> x;
    cout << sum - t[p-1] + x << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <memory.h>
using namespace std;
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define red(i, a, b) for(int i = (a); i >= (b); i--)
#define ll long long
#define FI first
#define SE second
#define MP make_pair
#define PB push_back

const int N = 200;
const ll INF = 1e13;

struct edge
{
	int from, to;
	ll cap, flow;
};
vector<edge> edges;
vector<int> G[N];
bool vis[N];
int d[N], cur[N];

int n, s, t;
ll a[N];
ll sum = 0;

void addedge(int from, int to, ll cap)
{
	edges.PB((edge){from, to, cap, 0});
	edges.PB((edge){to, from, 0, 0});
	int m = edges.size();
	G[from].PB(m - 2);
	G[to].PB(m - 1);
}

bool bfs()
{
	memset(vis, 0, sizeof(vis));
	queue<int> q;
	q.push(s);
	d[s] = 0;
	vis[s] = 1;
	while(!q.empty())
	{
		int x = q.front(); q.pop();
		for(int i = 0; i < G[x].size(); i++)
		{
			edge& e = edges[G[x][i]];
			if (!vis[e.to] && e.cap > e.flow)
			{
				vis[e.to] = 1;
				d[e.to] = d[x] + 1;
				q.push(e.to);
			}
		}
	}
	return vis[t];
}

ll dfs(int x, ll a)
{
	if (x == t || a == 0) return a;
	ll flow = 0, f;
	for(int& i = cur[x]; i < G[x].size(); i++)
	{
		edge& e = edges[G[x][i]];
		if (d[x] + 1 == d[e.to] && (f = dfs(e.to, min(a, e.cap - e.flow))) > 0)
		{
			e.flow += f;
			edges[G[x][i] ^ 1].flow -= f;
			flow += f;
			a -= f;
			if (a == 0) break;
		}
	}
	return flow;
}

ll dinic()
{
	ll flow = 0;
	while(bfs())
	{
		memset(cur, 0, sizeof(cur));
		flow += dfs(s, INF);
	}
	return flow;
}

int main()
{
	scanf("%d", &n);
	rep(i, 1, n) scanf("%lld", &a[i]), sum += a[i];
	rep(i, 1, n) a[i] = -a[i];
	ll sum2 = 0;
	for(int i = 1; i <= n; i++)
	{
		if (a[i] > 0) addedge(0, i, a[i]), sum2 += a[i];
		else addedge(i, n + 1, -a[i]);
		for(int k = 2; i * k <= n; k++)
			addedge(i, i * k, INF);
	}
	t = n + 1; s = 0;
	ll ans = sum2 - dinic();

	printf("%lld\n", sum + ans);
	return 0;
}

Measured memory_bytes: 256
open System

let primeFactors (n: int64): Map<int64, int> =
    let rec f n i acc =
        if n % i = 0L then
            f (n / i) i (i::acc)
        elif n < i * i && n <> 1L then 
            n :: acc 
        elif n < i * i then 
            acc 
        else 
            f n (i + 1L) acc 
    f n 2L []
    |> List.groupBy id 
    |> List.map(fun (key, values) -> key, List.length values)
    |> Map.ofList

let getN (n: int): int =
    let rec f n proposed acc =
        if n >= proposed then 
            f (n - proposed) (proposed + 1) (acc + 1)
        else 
            acc 
    f n 1 0 

Console.ReadLine()
|> int64
|> primeFactors
|> Map.map(fun _ v -> getN v)
|> Map.toList 
|> List.map snd 
|> List.sum 
|> printfn "%i" 

Measured memory_bytes: 30316
K = int(input())

from fractions import gcd
ans = 0


m = [[0] * K for _ in range(K)]
for x in range(1, K + 1):
    for y in range(1, K + 1):
        m[x - 1][y - 1] = gcd(x, y)


for x in range(1, K + 1):
    for y in range(1, K + 1):
        for z in range(1, K + 1):
            if x == y and y == z:
                ans += x
            else:
                temp = m[x - 1][y - 1]
                if temp >= z:
                    temp = m[z - 1][temp - 1]
                else:
                    temp = m[temp - 1][z - 1]

                #ans += (3 * temp)
                ans += temp

print(ans)





Measured memory_bytes: 81172
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx")
// #pragma comment(linker, "/stack:200000000"]
 
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <stack>
#include <random>
#include <fstream>
#include <sstream>
#include <chrono>

#define fi first
#define se second
#define pb push_back
#define ll long long
#define ld long double
#define hm unordered_map 
#define pii pair<int, int>
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define cinv(v) for (auto& x: v) cin >> x
#define fr(i, n) for (int i = 0; i < n; ++i)
#define fl(i, l, n) for (int i = l; i < n; ++i)

#define int ll

using namespace std;

#ifdef __LOCAL
	#define dbg(x) cerr << #x << " : " << x << '\n'
	const int maxn = 20;
#else 
	#define dbg(x)
	const int maxn = 2e5 + 20;
#endif

//tg: @galebickosikasa
 
const ll inf = (ll) 2e9;
const ld pi = asin (1) * 2;
const ld eps = 1e-8;
const ll mod = (ll)1e9 + 7;
const ll ns = 97;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());



signed main () {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n;
	cin >> n;
	vector<int> goo (n);
	cinv (goo);
	int s = 0;
	for (auto& x: goo) {
		s ^= x;
	}
	for (auto& x: goo) {
		cout << (s ^ x) << ' ';
	}







}

Measured memory_bytes: 4780
#include <stdio.h>
#define MAX 100000

typedef struct{
  char S;
  int N;
}card;

void merge(card *A,int left,int mid,int right){
  int i,j,k,n1,n2;
  card L[MAX/2+1],R[MAX/2+1];
  n1 = mid - left;
  n2 = right - mid;
  for(i=0;i<n1;i++)
    L[i] = A[left + i];
  for(i=0;i<n2;i++)
    R[i] = A[mid + i];
  L[n1].N = 2000000000;
  R[n2].N = 2000000000;
  i=j=0;
  for(k=left;k<right;k++){
    if(L[i].N <= R[j].N){
      A[k] = L[i];
      i++;
    }
    else{
      A[k] = R[j];
      j++;
    }
  }
}

void mergeSort(card *A,int left,int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

int partition(card *A,int p,int r){
  int x,i,j;
  card tmp;
  x = A[r].N;
  i = p-1;
  for(j=p;j<r;j++){
    if(A[j].N <= x){
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;
  return i+1;
}

void quicksort(card *A,int p,int r){
  int q;
  if (p < r){
    q = partition(A,p,r);
    quicksort(A,p,q-1);
    quicksort(A,q+1,r);
  }
}


int main(){
  int i,j,n,c=1;
  card A[MAX],B[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c%d",&A[i].S,&A[i].N);
    B[i].S = A[i].S;
    B[i].N = A[i].N;
  }
  quicksort(A,0,n-1);
  mergeSort(B,0,n);

  for(i=0;i<n;i++){
    if(A[i].S != B[i].S)
      c = 0;
  }
  if(c)
    printf("Stable\n");
  else
    printf("Not stable\n");
  for(i=0;i<n;i++){
    printf("%c %d\n",A[i].S,A[i].N);
  }
  return 0;
}



Measured memory_bytes: 4072
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>

#define mod 1000000007
#define INF2 9999999999
#define INF (1<<30)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = __int64_t;

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

void solve(){
  string s, t1 = "", t2 = "";
  int x = 0, y = 0;
  cin >> s;
  for(int i = 0; i < s.length(); i++){
    if(i%2 == 0){
      t1 += "0";
      t2 += "1";
    }else{
      t1 += "1";
      t2 += "0";
    }
  }
  for(int i = 0; i < s.length(); i++){
    if(s[i] != t1[i]){
      x++;
    }
    if(s[i] != t2[i]){
      y++;
    }
  }
  cout << min(x, y) << endl;
}

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

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

int main()
{
  vector<int> vec(3);
  for(int i=0;i<3;i++)
  {
    cin>>vec.at(i);
  }
  cout<<vec.at(2)<<' '<<vec.at(0)<<' '<<vec.at(1)<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define INF ( 1 << 28 )
#define reps(i,j,n) for(int i = (j) ; i < (n) ; i++ )
#define rep(i,n) reps(i,0,n)

int main(){
  int N;
  while(cin >> N , N){
    bool flg = true;
    vector<int> a(N),b(N);
    rep(i,N) cin >> a[i];
    rep(i,N) cin >> b[i];
    sort(b.rbegin(),b.rend());
    rep(i,N){
      rep(j,N) if(a[j] > 0) a[j]--,b[i]--;
      if(b[i] != 0){
        flg = false;
        break;
      }
    }
    cout << (flg ? "Yes" : "No") << endl;
  }
}

Measured memory_bytes: 1268
// Optimise
#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 MULTI_TEST
#ifdef LOCAL
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
    out << '[' << p.first << ", " << p.second << ']';
    return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
    while (*name == ',' || *name == ' ')
        name++;
    std::cerr << name << " { ";
    for (const auto &v : arg)
        cerr << v << ' ';
    cerr << " }\n";
}
template <typename Arg1, typename... Args>
void PC(const char *names, Arg1 &&arg1, Args &&... args)
{
    while (*names == ',' || *names == ' ')
        names++;
    const char *comma = strchr(names, ',');
    std::cerr.write(names, comma - names) << " { ";
    for (const auto &v : arg1)
        cerr << v << ' ';
    cerr << " }\n";
    PC(comma, args...);
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
    std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    std::cerr.write(names, comma - names) << " = " << arg1;
    ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
auto TimeStart = chrono::steady_clock::now();
auto seed = TimeStart.time_since_epoch().count();
std::mt19937 rng(seed);
template <typename T>
using Random = std::uniform_int_distribution<T>;

const int NAX = 2e5 + 5, MOD = 1000000007;

void solveCase(int caseNo)
{
    int n;
    cin >> n;
    string str;
    for (int i = 0; i < n; i++)
        str += i + '0' + 1;
    vector<string> order;
    do
    {
        order.pb(str);
    } while (next_permutation(all(str)));
    pc(order);
    string a, s;
    for (int i = 0; i < n; i++)
    {
        int c;
        cin >> c;
        a += c + '0';
    }
    for (int i = 0; i < n; i++)
    {
        int c;
        cin >> c;
        s += c + '0';
    }
    db(a, s);
    cout << abs(lower_bound(all(order), a) - lower_bound(all(order), s)) << '\n';
}

int main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
#ifdef MULTI_TEST
    cin >> t;
#endif
    for (int i = 1; i <= t; ++i)
    {
        solveCase(i);
#ifdef TIME
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


Measured memory_bytes: 2424
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000
int ans = 1;
map<int,int> mp;
bool check(int a,int b){
	if(mp[a]<=0)return false;
	ans = mod(ans * mp[a]);
	mp[a]--;
	mp[b]++;
	return true;
}

int main(){
	
	int N;
	cin>>N;
	
	string S;
	cin>>S;
	
	
	mp[0] = N;
	
	
	
	for(int i=0;i<3*N;i++){
		if(S[i]=='R'){
			if(check(23,123))continue;
			if(check(2,12))continue;
			if(check(3,13))continue;
			if(check(0,1))continue;
					}
		else if(S[i]=='G'){
			if(check(13,123))continue;
			if(check(1,12))continue;
			if(check(3,23))continue;
			if(check(0,2))continue;
		}
		else{
			if(check(12,123))continue;
			if(check(1,13))continue;
			if(check(2,23))continue;
			if(check(0,3))continue;
		}
		
	}
	cout<<ans<<endl;
	
	return 0;
}


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

const int MAXN=1005;
const int MAXV=MAXN*(MAXN-1)/2;
vector<int> to[MAXV];
int id[MAXN][MAXN];
int toId(int i,int j){
  if(i>j)swap(i,j);
  return id[i][j];
}

bool visited[MAXV];
bool calculated[MAXV];
int dp[MAXV];
int dfs(int v){
  if (visited[v]) {
    if (!calculated[v])return -1;
    return dp[v];
  }
  visited[v]=true;
  dp[v]=1;
  for (int u: to[v]){
    int res=dfs(u);
    if (res==-1)return -1;
    dp[v]=max(dp[v],res+1);
  }
  calculated[v]=true;
  return dp[v];
}
  
int main(){
  int n;
  cin>>n;
  vector<vector<int>> a(n,vector<int>(n-1));
  rep(i,n){
    rep(j,n-1){
      cin>>a[i][j];
      a[i][j]--;
    }
  }
  int V=0;
  rep(i,n)rep(j,n){
    if (i<j){
      id[i][j]=V++;
    }
  }
  rep(i,n){
    rep(j,n-1){
      a[i][j]=toId(i,a[i][j]);
    }
    rep(j,n-2){
      to[a[i][j+1]].push_back(a[i][j]);
    }
  }
  int ans=0;
  rep(i,V){
    int res=dfs(i);
    if (res==-1){
      puts("-1");
      return 0;
    }
    ans=max(ans,dfs(i));
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
  

  int N, M;
  cin >> N >> M;
  int P;
  string S;
  vector<bool> AC(N + 1, false);
  vector<int> WA(N + 1, 0);

  int WA_cnt = 0, AC_cnt = 0;
  for(int i = 0; i < M; ++i) {
    cin >> P >> S;

    if(AC.at(P) == false && S == "WA") {
      WA.at(P)++;
    }
    else if(AC.at(P) == false && S == "AC") {
      AC.at(P) = true;
      AC_cnt++;
      WA_cnt += WA.at(P);
    }
  }

  cout << AC_cnt << " " << WA_cnt << endl;
  return 0;
}


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

int keta(int num){
  int ans= 0 ;
  int rem;

  for (int i = 4; i >= 0 ; i--){
    rem = pow(10,i);
    ans += (num / rem); 
    num = num % rem;
  }
  return ans;
}


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

  vector<int> cards(N);
  for (int i = 0; i < N; i++){
    cin >> cards.at(i);
  }

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

  int alice, bob =0;

  for (int i = 0; i < N; i++){
    if(i % 2==0){
      alice += cards.back(); 
    }else{
      bob += cards.back(); 
    }
    cards.pop_back();
  }
  
  cout << alice - bob << endl;
}


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

int k, d[100005];

void f(int p, int q) {
	if (p >= d[q]) return;
	d[q] = p;
	if (q == 0) return;
	f(p, q * 10 % k);
	f(p + 1, (q + 1) % k);
}

int main()
{
	int i;
	cin >> k;
	for (i = 0; i < k; i++) d[i] = 45;
	f(1, 1);
    cout << d[0] << endl;
    return 0;
}

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

ll inf = 1000000LL * 1000000LL * 1000000LL;

vector<int> parent[100010] , mark(100010,0) , dp(100010,0);

void dfs(int x){
	mark[x] = 1;
	for(auto i : parent[x]){
		if((int)parent[i].size() > 0 && !mark[i])dfs(i);
		dp[x] = max(dp[x] , dp[i] + 1);
	}
}



int main(int argc , char** argv){
	int n , m;
	scanf("%d%d",&n,&m);
	for(int i = 1 ; i <= m ; ++i){
		int a , b;
		scanf("%d%d",&a,&b);
		parent[b].push_back(a);
	}
	for(int i = 1 ; i <= n ; ++i){
		if(!mark[i]){
			dfs(i);
		}
	}
	int ans = 0;
	for(int i = 1; i <= n ; ++i)ans = max(ans , dp[i]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
int main() {
  int n;
  cin>>n;
  string s;
  map<string,int> a;
  rep(i,n){
    cin>>s;
    a[s]++;
  }
  cout<<"AC x "<<a["AC"]<<endl;
  cout<<"WA x "<<a["WA"]<<endl;
  cout<<"TLE x "<<a["TLE"]<<endl;
  cout<<"RE x "<<a["RE"]<<endl;
}

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

using namespace std;

typedef long long ll;

int N;
string b[36], s[36];

void show() {
  for (int i = 0; i < N; i++) {
    cout << b[i] << (i == N-1 ? '\n' : ' ');
  }
  cout << "Stable" << endl;

  for (int i = 0; i < N; i++) {
    cout << s[i] << (i == N-1 ? '\n' : ' ');
  }
  for (int i = 0; i < N; i++) {
    if(b[i] != s[i]) {
      cout << "Not stable" << endl;
      return;
    }
  }
  cout << "Stable" << endl;

}

void bubble_sort() {
  for (int i = 0; i < N; i++) {
    for (int j = N-1; j > i; j--) {
      if(b[j][1] < b[j-1][1]) {
        swap(b[j], b[j-1]);
      }
    }
  }
}

void selection_sort() {
  for (int i = 0; i < N; i++) {
    int minj = i;
    for (int j = i; j < N; j++) {
      if(s[j][1] < s[minj][1]) minj = j;
    }
    swap(s[i], s[minj]);
  }
}

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> b[i];
    s[i] = b[i];
  }

  bubble_sort();
  selection_sort();

  show();
}

Measured memory_bytes: 3204
#include<stdio.h>

int main(void){
    int a = 0;
    char s[256];

    scanf("%d", &a);
    scanf("%s", s);

    if(a >= 3200){
        printf("%s",s);
    }else if(a < 3200){
        printf("red");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  int keta = 0;
  int n = N;
  while(n > 0) {
    n /= 10;
    keta++;
  }
  int ans = 0;
  rep(k,keta) {
    if(k % 2 == 1) {
      ans += 9 * pow(10,k-1);
    }
  }
  if(keta % 2 == 1) {
    int start = pow(10,keta-1);
    ans += N - start + 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int n,m,i,j;
  cin>>n>>m;
  long long int weight[n+1];
   long long int value[n+1];
   weight[0]=0;
   value[0]=0;
  for( i=1;i<=n;i++) cin>>weight[i]>>value[i];

  long long int k[n+1][m+1];
  for( i=0;i<=n;i++){
    for( j=0;j<=m;j++){
      if(i==0 || j==0)
        k[i][j]=0;
      else if(weight[i] <= j)
        k[i][j]=max(k[i-1][j],(k[i-1][j-weight[i]]+value[i]));
      else
        k[i][j]=k[i-1][j];
    }
  }
  cout<<k[n][m];
  return 0;
}


Measured memory_bytes: 79104
use std::io;

#[derive(Debug)]
enum Square {
    Bomb,
    Empty,
}

type MineSqure = Vec<Vec<Square>>;

fn read_lines() -> MineSqure {
    let mut res = Vec::new();
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let h_w = line.trim().split_whitespace().map(|x| x.trim().parse::<i32>().unwrap()).collect::<Vec<i32>>();
    line.clear();

    for _ in 0..h_w[0] {
        io::stdin().read_line(&mut line).unwrap();
        let mut row: Vec<Square> = Vec::new();
        for l in line.trim().chars() {
            match l {
                '#' => row.push(Square::Bomb),
                '.' => row.push(Square::Empty),
                _ => panic!("input have irregal charactor ({})", l),
            }
        }
        line.clear();
        res.push(row);
    }
    res
 }

fn make_hint_square_vec(truth_square: MineSqure) -> Vec<Vec<char>> {
    let height = truth_square.len();
    let width = truth_square[0].len();
    let mut res: Vec<Vec<char>> = Vec::new();

    for row_i in 0..height {
        let mut row_vec: Vec<char> = Vec::new();
        for col_i in 0..width {
            let mut bomb_count = 0;
            if let Square::Bomb = truth_square[row_i][col_i] {
                row_vec.push('#');
                continue
            }
            for offset_r in (row_i as i32 -1)..(row_i as i32 +2) {
                for offset_c in (col_i as i32 -1)..(col_i as i32 +2) {
                    if offset_r >= 0 && offset_c >= 0 && offset_r < height as i32 && offset_c < width as i32 {
                        if let Square::Bomb = truth_square[offset_r as usize][offset_c as usize] {
                            bomb_count += 1;
                        }
                    }
                }
            }
            row_vec.push(std::char::from_digit(bomb_count, 10).unwrap());
        }
        res.push(row_vec);
    }
    res
}

fn print_square(square: Vec<Vec<char>>) {
    for row in square.iter() {
        for sq in row.iter() {
            print!("{}", sq);
        }
        println!("");
    }
}

fn main() {
    let input = read_lines();
    let res = make_hint_square_vec(input);
    print_square(res)
}

Measured memory_bytes: 4352
import java.io.*
import java.util.*

fun solve(N: Long) {
    if (N % 2L == 0L) {
        // N = 2m
        // N!! = 2^m * m!
        val m = N / 2
        val ans = Math.min(m + m.powerOfFactorial(2L), m.powerOfFactorial(5L))
        println(ans)
    } else {
        // N = 2m-1
        // N!! = (2m)!/(2^m * m!)
        val m = (N + 1) / 2
        val powOfTwo = (2*m).powerOfFactorial(2L) - m - m.powerOfFactorial(2L)
        val powOfFive = (2*m).powerOfFactorial(5L) - m.powerOfFactorial(5L)
        val ans = Math.min(powOfTwo, powOfFive)
        println(ans)
    }
    return
}

fun Long.powerOfFactorial(base: Long): Long {
    // this! がbaseで何回割り切れるか
    // [this / base] + [this/base*base] + ...
    var count = 0L
    var ret = base
    while (ret <= this) {
        count += (this / ret)
        ret *= base
    }
    return count
}

fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toLong()
    solve(N)
}


Measured memory_bytes: 31388
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<ll> a(n);
    int cnt = 0;
    ll sum = 0;
    bool zero = false;
    REP(i,n) {
        cin >> a[i];
        if (a[i] == 0) zero = true;
        if (a[i] < 0) {
            sum = sum+(-a[i]);
            cnt++;
        }
        else sum += a[i];
    }
    if (zero) {
        cout << sum << endl;
        return 0;
    }
    if (cnt%2 == 0) cout << sum << endl;
    else {
        ll m = LINF;
        REP(i,n) {
            m = min(m, abs(a[i]));
        }
        cout << sum-m*2 << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef vector<int> VI;
typedef vector<VI> VVI;
template<class T> T gcd( T a, T b ) {
	return !b ? a : gcd( b, a % b );
}
template<class T> T lcm( T a, T b ) {
	return a / gcd( a, b ) * b;
}
template<class T> string print_v( vector<T> v ) {
	OSS oss;
	for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end();
			++it_i ) {
		oss << *it_i << ", ";
	}
	return oss.str();
}

double calc( int y, int r, int t ) {
    if ( t == 1 ) {
        // ツ単ツ猟?
        return 1.0 + y * ( r / 100.0 ); 
    } else if ( t == 2 ) {
        // ツ個ウツ猟?
        return pow( 1.0 + r / 100.0, (double)y );
    }
    return 0.0;
}

int main() {
    int n, y;
    while ( cin >> n && n ) {
        cin >> y;
        int B[n], R[n], T[n];
        for ( int i = 0; i < n; ++ i ) {
            cin >> B[i] >> R[i] >> T[i];
        }
        
        int maxi = -1;
        double maxs;
        for ( int i = 0; i < n; ++ i ) {
            double s = calc( y, R[i], T[i] );
            if ( maxi == -1 || s > maxs ) {
                maxi = B[i];
                maxs = s;
            }
        }

        cout << maxi << endl;
    }
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

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

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
//  order_of_key (k) : Number of items strictly smaller than k .
//  find_by_order(k) : K-th element in a set (counting from zero).
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
#define int ll

const int N = 2e5 + 5;
const int INF = 1e9 + 5;

int n, a, b, c, d;

bool check(int l, int r, int l2, int r2) {
	return ((l2 <= l && l <= r2) || (l2 <= r && r <= r2));
}

main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> a >> b >> c >> d;
	for(int i = 1; i <= n - 2; ++i) {
		if(check(a + c * i, a + i * d, b + c * (n - i - 1), b + d * (n - i - 1))) {
			cout << "YES";
			return 0;
		}
	}
	cout << "NO";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> ii;
#define inf 1e9
#define F first
#define S second
#define dbg(x) cout<<#x<<" value : "<<x<<"\n";
#define rep(i,j,k) for(int i = (j); i <= (k); i++)
#define rep__(i,j,k) for(int i = (j); i < (k); i++)
#define per(i,j,k) for(int i = (j); i >= (k); i--)
#define per__(i,j,k) for(int i = (j); i > (k); i--)
#define mst(a,b) memset(a,b,sizeof(a))
#define sf(n) scanf("%d",&n)
#define stf(n,m) scanf("%d%d",&n,&m)
#define pf(n) printf("%d\n",n)
#define slf(n) scanf("%lld",&n)
#define plf(n) printf("%lld\n",n)
priority_queue<int,vector<int>,less<int> > q;
const int N=4e6+10;
const int mod=1e9+7;
int n;
string s;
void solve(){
	sf(n);
	cin>>s;
	if(n%2!=0)printf("No\n");
	else{
		int x=n>>1;
		bool ok=1;
		for(int i=0,j=x;i<x;i++,j++){
			if(s[i]==s[j])continue;
			else {
				ok=0;
				printf("No\n");
				break;
			}
		}
		if(ok)printf("Yes\n");
	}
	return;
} 

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

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

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}
ll gcd(ll x,ll y){
    if(x<y) return gcd(y,x);
    if(y==0) return x;
    return gcd(y,x%y);
}

int main(){
    ll a,b;cin>>a>>b;
    ll g=gcd(a,b);
    ll ans=1;
    for(ll i=2;g>1;i++){
        if(g%i==0){
            ans++;
            while(g%i==0){
                g=g/i;
            }
        }
        if(i!=2){
            i++;
        }
        if((i+1)*(i+1)>g && g!=1){
            ans++;
            g=1;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s = to_string(n);
  char a = s[s.size() -1 ];
  if(a=='2' || a=='4' || a=='5' || a=='7' || a=='9') {
    cout << "hon" << endl;
  } else if(a=='0' || a=='1' || a=='6' || a=='8') {
    cout << "pon" << endl;
  } else {
    cout << "bon" << endl;
  }
}

Measured memory_bytes: 3696