akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

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

  ll R[N][N];
  ll a;

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      cin >> a;
      R[i][j] = a;
    }
  }

  int L = 1 << N;
  ll SCORE[L];

  for (int mask = 0; mask < L; ++mask) {
    ll s = 0;

    for (int i = 0; i < N; ++i) {
      if (((mask >> i) & 1) == 0) continue;

      for (int j = i + 1; j < N; ++j) {
        if ((mask >> j) & 1) {
          s += R[i][j];
        }
      }
    }

    SCORE[mask] = s;
  }

  ll dp[L];
  memset(dp, 0, sizeof(dp));

  for (int used = 0; used < L; ++used) {
    int unused = used ^ (L - 1);
    int mask = unused;

    while (mask > 0) {
      ll v = dp[used] + SCORE[mask];
      int nmask = mask | used;

      dp[nmask] = max(dp[nmask], v);
      mask = (mask - 1) & unused;
    }
  }

  cout << dp[L - 1] << endl;

  return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>

int main() {

  int num1 = 1, num2 = 1;

  for (num1 = 1; num1 <= 9; num1++) {
    for (num2 = 1; num2 <= 9; num2++) {
      printf("%dx%d=%d\n", num1, num2, num1 * num2);
    }
  }

  return 0;
}

Measured memory_bytes: 520
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int N;
  cin >> N;
  int judge = 0;
  for(int i = 1;i <= 9;i++){
    for(int j = 1;j <= 9;j++){
      if(N == i*j){
        judge = 1;
        break;
      }
    }
  }
  if(judge == 1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3508
import sys
input = sys.stdin.buffer.readline
N, M = map(int, input().split())
G = [[] for _ in [0]*N]
E = []
for _ in [0]*M:
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    E.append((a, b))


class UnionFind:
    def __init__(self, n=0):
        self.d = [-1]*n
        self.u = n

    def root(self, x):
        if self.d[x] < 0:
            return x
        self.d[x] = self.root(self.d[x])
        return self.d[x]

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x == y:
            return False
        if x > y:
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x
        self.u -= 1
        return True

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def size(self, x):
        return -self.d[self.root(x)]

    def num_union(self):
        return self.u


ans = 0
for i in range(M):
    uf = UnionFind(N)
    for j, (a, b) in enumerate(E):
        if j == i:
            continue
        uf.unite(a, b)
    if uf.num_union() != 1:
        ans += 1
print(ans)


Measured memory_bytes: 73776
H, W = map(int, input().split())
a = []
for i in range(H):
  a.append(input())
cnt = 1
while cnt != 0:
  cnt = 0
  new = []
  for i in range(H):
    if a[i] == '.'*W:
      cnt += 1
    else:
      new.append(a[i])
  H = H - cnt
  cnt_2 = 0
  new_2 = ['' for _ in range(H)]
  for i in range(W):
    tmp = ''
    for j in range(H):
      tmp += new[j][i]
    if tmp == '.'*H:
      cnt_2 += 1
    else:
      for j in range(H):
        new_2[j] += tmp[j]
  cnt += cnt_2
  W = W - cnt_2
  a = new_2
for i in range(H):
  print(a[i])


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

class E
{
    static void Main()
    {
        Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        var h = read();
        var rs = Enumerable.Range(0, h[1]).Select(i => read()).Select(r => new R { A = r[0], B = r[1], C = r[2] - h[2] }).ToArray();
        map = rs.GroupBy(r => r.A).ToDictionary(g => g.Key, g => g.ToArray());

        var cs = Enumerable.Repeat(long.MinValue, h[0] + 1).ToArray();
        cs[1] = 0;
        long c;
        for (var i = 0; i < h[0]; i++)
            foreach (var r in rs)
                if (cs[r.A] != long.MinValue && cs[r.B] < (c = cs[r.A] + r.C)) cs[r.B] = c;

        foreach (var r in rs)
        {
            if (outs.Contains(r.B)) continue;
            if (cs[r.A] == long.MinValue || cs[r.B] >= cs[r.A] + r.C) continue;

            FindPath(r.B);
            if (outs.Contains(h[0])) { Console.WriteLine(-1); return; }
        }
        Console.WriteLine(Math.Max(cs[h[0]], 0));
    }

    static Dictionary<int, R[]> map;
    static HashSet<int> outs = new HashSet<int>();

    static void FindPath(int p)
    {
        if (!outs.Add(p)) return;
        if (!map.ContainsKey(p)) return;
        foreach (var r in map[p]) FindPath(r.B);
    }
}

struct R
{
    public int A, B, C;
}


Measured memory_bytes: 16736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b-1; i >= a; i--)
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;

signed main(){
    ll N; cin >> N;
    vector<ll> a(N);
    rep(i, 0, N) cin >> a[i];
    ll cnt = 0, t = 1;
    rep(i, 0, N){
        if(a[i] == t){
            t++;
        }else{
            cnt++;
        }
    }
    if(cnt == N) cout << -1 << endl;
    else cout << cnt << endl;
}


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

#define pb push_back
#define pf push_front
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()
#define what_is(x) #x << " is " << (x)

using namespace std;

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

const int N = (int)1e6 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;

void megaRandom() {
	unsigned int FOR;
 	asm("rdtsc" : "=A"(FOR));
  srand(FOR);
}

int n, a[N];
pii p[N];

void no() {
	puts("Impossible");
	exit(0);
}

void yes() {
	puts("Possible");
	exit(0);
}

int cnt[N];

int main() {
	megaRandom();
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++) {
		scanf("%d", &p[i].F);
	  cnt[p[i].F] ++;
		p[i].S = i;
	}
	sort(p + 1, p + n + 1);
	if(p[n].F != p[n - 1].F)
		no();	
	int midDist = p[n].F / 2 + p[n].F % 2;
	if(p[n].F & 1) {
	  if(cnt[midDist] != 2)
	  	no();
	} else {
		if(cnt[midDist] != 1)
			no();
	}
	for(int i = midDist + 1; i < p[n].F; i ++) 
		if(cnt[i] < 2)
			no();
	yes();	
	return 0;  
}


Measured memory_bytes: 2304
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

A = np.array(A)

cs1 = A.cumsum()
cs2 = A[::-1].cumsum()[::-1]
a = abs((cs1[:-1] - cs2[1:])).min()
print(a)


Measured memory_bytes: 33896
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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


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

    vector<VPII> e(n);
    REP(i,n-1){
        int u,v,w;
        cin>>u>>v>>w;
        u--;
        v--;
        e[u].PB(MP(v,w));
        e[v].PB(MP(u,w));
    }
    
    queue<int> q;
    VI color(n,-1);
    //color[0] = 0;
    q.push(0);

    while(!q.empty()){
        int now = q.front();
        q.pop();


        REP(i,SIZE(e[now])){
            int next = e[now][i].first;
            if(color[next] != -1){
                continue;
            }
            color[next] = (color[now] + e[now][i].second)%2;
            q.push(next);
        }
    }

    REP(i,n){
        cout<<color[i]<<endl;
    }
    


	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>

using namespace std;


int main() {

	int h, w;
	vector<vector<char > >a;

	cin >> h >> w;

	a.resize(h + 2);
	for (auto& e : a) {
		e.resize(w + 2);
	}

	for (int i = 0; i < w + 2; i++) {
		a[0][i] = '#';
		a[h + 1][i] = '#';
	}

	for (int i = 0; i < h + 2; i++) {
		a[i][0] = '#';
		a[i][w + 1] = '#';
	}

	for (int y = 1; y < h + 1; y++) {
		for (int x = 1; x < w + 1; x++) {
			char c;
			cin >> c;
			a[y][x] = c;
		}
	}

	for (int y = 0; y < a.size(); y++) {
		for (int x = 0; x < a[0].size(); x++) {
			cout << a[y][x];
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int int32_t
#define long int64_t

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

    int N, K;
    cin >> N >> K;
    vector<vector<int>> num_white(K + 1, vector<int>(K + 1)), num_black(K + 1, vector<int>(K + 1));
    for (int i = 0; i < N; i++) {
        int x, y;
        char c;
        cin >> x >> y >> c;
        if (c == 'W') {
            if ((x/K + y/K)%2 == 0) {
                num_white[x%K + 1][y%K + 1]++;
            } else {
                num_black[x%K + 1][y%K + 1]++;
            }
        } else {
            if ((x/K + y/K)%2 == 0) {
                num_black[x%K + 1][y%K + 1]++;
            } else {
                num_white[x%K + 1][y%K + 1]++;
            }
        }
    }

    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            if (i == 1 and j == 1) {
                continue;
            } else if (i == 1) {
                num_white[1][j] += num_white[1][j - 1];
                num_black[1][j] += num_black[1][j - 1];
            } else if (j == 1) {
                num_white[i][1] += num_white[i - 1][1];
                num_black[i][1] += num_black[i - 1][1]; 
            } else {
                num_white[i][j] += num_white[i][j - 1] + num_white[i - 1][j] - num_white[i - 1][j - 1];
                num_black[i][j] += num_black[i][j - 1] + num_black[i - 1][j] - num_black[i - 1][j - 1];
            }
        }
    }

    int ans = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            int cand = num_white[i][j] + (num_white[K][K] - num_white[i][K] - num_white[K][j] + num_white[i][j])
                    + (num_black[i][K] - num_black[i][j]) + (num_black[K][j] - num_black[i][j]);
            ans = max({ans, cand, N - cand});
        }
    }

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

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

#define mp(a,b) make_pair(a, b)
#define __builtin_popcount __builtin_popcountll

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

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


int T, n, m;

int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    cin >> n;
    vi v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i]; v[i] --;
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if(i == v[i]) {
            ans ++;
            if (i + 1 < v.size()) swap(v[i], v[i+1]);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;



int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (i * j == n) {
                cout << "Yes";
                return 0;
            }
        }
    }
    
    cout << "No";

}





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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<int> va(n);
  for (int i = 0; i < n; ++i) {
    cin >> va[i];
  }

  // 0番目の要素を除く場合の最大公約数
  // 全ての要素の最大公約数
  vector<int> gcds(n), rev_gcds(n);
  gcds[0] = va.front();
  rev_gcds[0] = va.back();
  for (int i = 1; i < va.size(); ++i) {
    gcds[i] = gcd(gcds[i - 1], va[i]);
    rev_gcds[i] = gcd(rev_gcds[i - 1], va[n - i - 1]);
  }

  auto except_gcd = [&](int idx) {
    if (idx == 0) {
      return rev_gcds[n - 2];
    } else if (idx == n - 1) {
      return gcds[n - 2];
    } else {
      return gcd(gcds[idx - 1], rev_gcds[n - idx - 2]);
    }
  };

  int ans = except_gcd(0);
  for (int i = 0; i < n; ++i) {
    ans = max(ans, except_gcd(i));
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 4532
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<string, int> SI;

int main()
{
//	cut here before submit 
//	freopen ("testcase.lottey_checker", "r", stdin );
	int n, m;
	while (scanf ("%d %d", &n, &m ) && n && m ){
		vector<SI> lottey (n );
		rep (i, n ){
			cin >> lottey[i].first >> lottey[i].second;
		} // end rep

		vector<string> my (m );
		rep (i, m ){
			cin >> my[i];
		} // end rep
		ll sum = 0LL;
		rep (i, n ){
			string l = lottey[i].first;
			rep (j, m ){
				bool found = true;
				rep (k, 8 ){
					if (l[k] == '*' ) continue;
					else
					if (l[k] != my[j][k] ){
						found = false;
						break;
					} // end if
				} // end rep
				if (found ){
					sum += (ll)lottey[i].second;
				} // end if
			} // end rep
		} // end rep
		cout << sum << endl;	
	} // end while
	
	return 0;
}

Measured memory_bytes: 1004
import bisect
s=input()
t=input()

d=dict()
for i in "abcdefghijklmnopqrstuvwxyz":
    d[i]=[]
for i,c in enumerate(s):
    d[c].append(i)

now=0
ans=0
for c in t:
    l=len(d[c])
    if l==0:
        print(-1)
        break
    i=bisect.bisect_left(d[c],now)
    if i<l:
        now=d[c][i]+1
    else:
        ans+=len(s)
        i=bisect.bisect_left(d[c],0)
        now=d[c][i]+1
else:
    ans+=now
    print(ans)

Measured memory_bytes: 7540
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(1e9 + 7)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

//////////////////////
// const int N = 316330;

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);

    int a,b;
    cin >> a >> b;

    int n = 1;
    int ps = 0;
    
    for(int i = 1; i <= n and n < b; i++) {
    	n += (a - 1);
    	ps++;
    }
    cout << ps << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <functional>
#include <map>
#include <tuple>
using namespace std;
int n, a[100009], maxn, maxid; vector<pair<int, int>>vec;
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) { cin >> a[i]; }
	for (int i = 1; i <= n; i++) {
		if (abs(a[i]) > maxn) { maxn = abs(a[i]); maxid = i; }
	}
	if (maxn == 0) { cout << "0" << endl; return 0; }
	for (int i = 1; i <= n; i++) {
		vec.push_back(make_pair(maxid, i));
		a[i] += a[maxid];
	}
	if (a[maxid] < 0) {
		for (int i = n - 1; i >= 1; i--)vec.push_back(make_pair(i + 1, i));
	}
	else {
		for (int i = 1; i < n; i++)vec.push_back(make_pair(i, i + 1));
	}
	cout << vec.size() << endl;
	for (int i = 0; i < vec.size(); i++)cout << vec[i].first << " " << vec[i].second << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

typedef long long int llint;

int main()
{
    llint n;
    scanf("%lld",&n);
    
    if(n&1)
    {
        printf("0\n");
        return 0;
    }
    llint ans=0;

    for(llint i=10;i<=n;i*=5)
    {
        ans+=(llint)n/i;
    }
    printf("%lld\n",ans);
}

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

int main(){
    int N, K;
    cin >> N >> K;
    int total = 0;
    for (int i=0; i<N; i++){
        int xi;
        cin >> xi;
        if (xi > (K - xi)){
            total += 2*(K-xi);
        }else{
            total += 2*xi;
        }
    }
    cout << total << endl;
}

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

int main(int argc, char* argv[])
{
  int N, K;
  bool is_available[10];
  std::vector< int > vd;

  for (int i = 0; i < 10; i++) {
    is_available[i] = true;
  }

  std::cin >> N >> K;
  for (int i = 0; i < K; i++) {
    int tmp;
    std::cin >> tmp;
    is_available[tmp] = false;
  }

  for (int i = N; i < N*10; i++) {
    int x = i;
    bool is_ok = true;
    while (x > 0) {
      int y = x % 10;
      if (!is_available[y]){
	is_ok = false;
	break;
      }
      x /= 10;
    }

    if (is_ok) {
      std::cout << i << std::endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 764
#include <stdio.h>
#include <algorithm>
using namespace std;

int R[10];
int adj[222][222];

int main()
{
    int n,m,r;
    scanf("%d%d%d",&n,&m,&r);
    for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) adj[i][j] = 1e9;
    for(int i=0; i<r; i++) scanf("%d",&R[i]);
    while(m--) {
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        adj[a][b] = adj[b][a] = c;
    }
    for(int k=1; k<=n; k++) {
        for(int i=1; i<=n; i++) {
            for(int j=1; j<=n; j++) {
                adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
            }
        }
    }
    sort(R, R+r);
    long long mn = (long long)1e18;
    do {
        long long dist = 0;
        for(int i=0; i<r-1; i++) dist += (long long)adj[R[i]][R[i+1]];
        mn = min(mn, dist);
    } while(next_permutation(R, R+r));
    printf("%lld",mn);
    return 0;
}


Measured memory_bytes: 384
text = list(input())
num = int(input())
for i in range(num):
    cmd = input().split()
    start, end = map(int, cmd[1:3])
    if cmd[0] == 'replace':
        text[start:end+1] = list(cmd[-1])
    elif cmd[0] == 'reverse':
        text[start:end+1] = (text[start:end+1])[::-1]
    elif cmd[0] == 'print':
        print(''.join(text[start:end+1]))


Measured memory_bytes: 5620
#include <cassert>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

const ll INF = LLONG_MIN;
int N, M, P;

struct Edge {
  int from;
  int to;
  int cost;

  Edge (int from = -1, int to = -1, int cost = -1) {
    this->from = from;
    this->to = to;
    this->cost = cost;
  }
};

int main() {
  vector<Edge> edges;

  cin >> N >> M >> P;
  vector<int> R[N + 1];

  int a, b, c;
  for (int i = 0; i < M; ++i) {
    cin >> a >> b >> c;

    edges.push_back(Edge(a, b, c - P));
    R[b].push_back(a);
  }

  bool visited[N + 1];
  memset(visited, false, sizeof(visited));

  queue<int> que;
  que.push(N);

  while (!que.empty()) {
    int v = que.front();
    que.pop();

    if (visited[v]) continue;
    visited[v] = true;

    for (int i = 0; i < R[v].size(); ++i) {
      int u = R[v][i];

      que.push(u);
    }
  }

  int loop_cnt = 0;
  ll cost[N + 1];
  for (int i = 0; i <= N; ++i) {
    cost[i] = INF;
  }
  cost[1] = 0;

  while (true) {
    bool updated = false;

    for (int i = 0; i < M; ++i) {
      Edge edge = edges[i];

      if (!visited[edge.to]) continue;
      if (cost[edge.from] == INF) continue;

      ll nc = cost[edge.from] + edge.cost;

      if (cost[edge.to] < nc) {
        cost[edge.to] = nc;
        updated = true;
      }
    }

    if (!updated) break;
    if (loop_cnt >= 2 * N) break;

    ++loop_cnt;
  }

  if (loop_cnt >= N || cost[N] == INF) {
    cout << -1 << endl;
  } else {
    cout << max(cost[N], 0LL) << endl;
  }

  return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <deque>
#include <cstdint>
#include <iostream>
#include <tuple>
#include <vector>

char board[1000][1000];

auto main() -> int {
  int h, w;
  std::cin >> h >> w >> std::ws;
  {
    std::vector<char> b{std::istreambuf_iterator<char>(std::cin), std::istreambuf_iterator<char>()};
    for (auto i = 0; i < h; ++i) {
      for (auto j = 0; j < w; ++j) {
        board[i][j] = b[i * (w + 1) + j];
      }
    }
  }

#ifdef DEBUG
  for (auto i = 0u; i < h; ++i) {
    std::cout << board[i] << std::endl;
  }
#endif

  using pii = std::pair<int, int>;
  using tiii = std::tuple<int, int, int>;

  auto q = std::deque<tiii>{};

  // start points
  for (auto i = 0; i < h; ++i) {
    for (auto j = 0; j < w; ++j) {
      if (board[i][j] == '#') {
        q.emplace_back(i, j, 0);
      }
    }
  }

  int r = 0;

  while (!q.empty()) {
    const auto p = q.front();
    q.pop_front();

    const auto p2 = std::get<2>(p);

    for (const pii& d : {pii{-1, 0}, pii{0, -1}, pii{0, 1}, pii{1, 0}}) {
      const auto i = std::get<0>(p) + d.first;
      const auto j = std::get<1>(p) + d.second;
      if (i < 0 || j < 0 || i >= h || j >= w || board[i][j] == '#') continue;

      board[i][j] = '#';
      q.emplace_back(i, j, p2 + 1);

      r = p2 + 1;

#ifdef DEBUG
      std::cout << "> " << r << " (" << i << ", " << j << ")" << std::endl;

      for (auto i = 0u; i < h; ++i) {
        std::cout << board[i] << std::endl;
      }
#endif
    }
  }

  std::cout << r << std::endl;
}


Measured memory_bytes: 13088
N, C = map(int, input().split())
K = [[0]*(10**5+1) for _ in range(C+1)]
T = [[] for _ in range(C+1)]
for i in range(N):
    s, t, c = map(int, input().split())
    T[c].append([s, t])
    K[c][t] = 1

for i in range(C+1):
    for j in range(len(T[i])):
        s, t = T[i][j]
        if K[i][s] == 0:
            T[i][j][0] -= 0.5
P = [0]*(10**6)
for i in range(C+1):
    for j in range(len(T[i])):
        for k in range(int(2*T[i][j][0]), 2*T[i][j][1]):
            P[k] += 1
print(max(P))


Measured memory_bytes: 126276
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

s = 0
pa = -100
for a in A:
    s += B[a-1]
    if a == pa + 1:
        s += C[pa-1]
    pa = a
print(s)

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

int main()
{
    long long int t;
    cin>>t;
    int check=1;
   // vector<ll > v;
    unsigned long long int ans=0;
    for(ll i=0;i<=t;i++)
    {
       
       if(i%3!=0 && i%5!=0)
       {
           //v.push_back(i);
           ans+=i;
       }

    }
    cout<<ans;
//   if(check)
//    cout<<"No";
    return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
int main() {

	int n;
	scanf("%d", &n);
	if (n < 105)printf("%d", 0);
	if (105 <= n && n < 135)printf("%d", 1);
	if (n >= 135 && n < 165)printf("%d", 2);
	if (165 <= n && n < 189)printf("%d", 3);
	if (n >= 189 && n < 195)printf("%d", 4);
	if (n >= 195)printf("%d", 5);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
	string S, M;
	cin >> S >> M;
	for (int i = 0; i < S.size(); i++) {
		if (i == 0) {
			cout << S[i];
		}
		else if (i == 1) {
			cout << M[0];
		}
	}
	cout << "C" << endl;
}

Measured memory_bytes: 3596
n,a,b = map(int, input().split())
p = 10 ** 9 + 7

##逆元計算
N = max(a, b)  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

fact = [ 0 for i in range(N+1)]
factinv = fact.copy()
inv = fact.copy()
cmb_list = fact.copy()

fact[0], fact[1] = 1, 1
factinv[0], factinv[1] = 1, 1
inv[0], inv[1] = 0, 1

for i in range(2, N + 1):
    fact[i] = (fact[i-1] * i) % p##階乗のリスト
    inv[i] = (-inv[p % i] * (p // i)) % p
    factinv[i] =(factinv[i-1] * inv[i]) % p##階乗の逆数のリスト

#分子の計算
n_a_inf_product = 1
for i in range(0, a):
    n_a_inf_product=(n_a_inf_product*(n-i))%p

n_b_inf_product = 1
for i in range(0, b):
    n_b_inf_product=(n_b_inf_product*(n-i))%p

cmb_a = (n_a_inf_product * factinv[a])%p
cmb_b = (n_b_inf_product * factinv[b])%p

ans = (pow(2, n, p) - 1 - cmb_a - cmb_b)%p
print(ans)

Measured memory_bytes: 28408
n, a, b = map(int, input().split())
v = list(map(int, input().split()))

def combination(n, k):
    a = 1
    for i in range(k):
        a *= (n - i)
        a //= (i + 1)
    return a

v.sort(reverse = True)
average = sum(v[:a]) / a
print(average)
amount = [a]
for i in range(a + 1, b + 1):
    average2 = sum(v[:i]) / i
    if average == average2:
        amount.append(i)
    else:
        break
com = 0
for i in amount:
    v1 = v[:i]
    v2 = v[i:]
    min_v = min(v1)
    m1 = v1.count(min_v)
    m2 = v2.count(min_v)
    com += combination(m1 + m2, min(m1, m2))
print(com)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define trace(x)  cerr << #x << ": " << x << endl;
typedef long long ll;
typedef long double ld;
int main()
{
	ld a,b,h,m;cin>>a>>b>>h>>m;ld p=h*60+m;ld pi=2*acos(0);
	ld posm=(ll)(6*p)%360;ll temp=(0.5*p)/360;
	ld posh=(0.5*p)-temp*360;
	ld ang=abs(posh-posm);
	ld c=pow(a,2)+pow(b,2)-2*a*b*cos(ang*pi/180);cout<<setprecision(10)<<sqrt(c);

}

Measured memory_bytes: 4164
A = [int(input()) for i in range(5)]
# A = [101, 86, 119, 108, 57]
# A = [29, 20, 7, 35, 120]
# A = [123, 123, 123, 123, 123]
B = [(10-a % 10) % 10 for a in A]
C = [-(-a//10)*10 for a in A]
print(sum(C)-max(B))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Max 1000004
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main(){
    ll n;
    cin>>n;
    ll a[n+2];ll b[n+2];
    for(int i=0;i<n-1;i++)
    {
        cin>>b[i];
    }
    a[0]=b[0];
    for(int i=1;i<n-1;i++)
    {
        a[i]=min(b[i],b[i-1]);
    }
    a[n-1]=b[n-2];
    ll res=0;
    for(int i=0;i<n;i++)
    {
        res+=a[i];
    }
    cout<<res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define sorted(a_1) sort(a_1.begin(),a_1.end())
#define rsorted(a_1) sort(a_1.rbegin(),a_1.rend())
#define t1(a_1) cout<<a_1<<endl;
#define t2(a_1) for(auto it_test : a_1) cout<<it_test<<" ";

const int MAX = 1000001;
vector<long long >isprime(MAX , true); 
vector<long long >prime; 
vector<long long >SPF(MAX); 
void Seive(int N) 
{ 
    isprime[0] = isprime[1] = false ; 
   
    for (long long int i=2; i<N ; i++) 
    { 
        if (isprime[i]) 
        { 
            prime.push_back(i);  
            SPF[i] = i; 
        } 
  
        for (long long int j=0; j < (int)prime.size() && i*prime[j] < N && prime[j] <= SPF[i]; j++) 
        { 
            isprime[i*prime[j]]=false; 
   
            SPF[i*prime[j]] = prime[j] ; 
        } 
    } 
} 

ll expo(ll a, ll b, ll m) 
{ 
    if (b == 0) 
        return 1; 
    ll p = expo(a, b / 2, m) % m; 
    p = (p * p) % m; 
  
    return (b % 2 == 0) ? p : (a * p) % m; 
} 
#define N_MAX 101
#define W_MAX 1000000001
#define V_SUM_MAX 100001

bool v[V_SUM_MAX][N_MAX];
vector<vector<ll>>dp(V_SUM_MAX,vector<ll>(N_MAX));
ll solveDp(int r, int i, vector<ll>&w, vector<ll>&val, int n) 
{ 
    // Base cases 
    if (r <= 0) 
        return 0; 
    if (i < 0) 
        return W_MAX; 
    if (v[r][i])
        return dp[r][i]; 
 	// t1("test");
    v[r][i] = 1; 
   
    dp[r][i]=min(solveDp(r, i - 1, w, val, n), w[i] + solveDp(r - val[i], i - 1, w, val, n)); 
    return dp[r][i]; 
} 
int knapsack(vector<ll>val, std::vector<ll> weight, int value, int n){
	for(int i=0;i<=value;i++){
		for(int j=0;j<=(int)n;j++){
			if(v[i][j]) continue;
			if(i==0) dp[i][j]=0;
			else if(j==0) dp[i][j] = W_MAX;
			else if(val[j-1]<=i) dp[i][j] = min(weight[j-1] + dp[i-val[j-1]][j-1],dp[i][j-1]);
			else dp[i][j] = dp[i][j - 1];
			v[i][j]=1;
		}
	}
	return dp[value][n];
}
void solve(){
	int n,we;
	cin>>n>>we;
	vector<ll>val(n),weight(n);
	for(int i=0;i<n;i++) cin>>weight[i]>>val[i];
	int sum1 = accumulate(val.begin(),val.end(),0);
	memset(v,false,sizeof(v));
	// for(int i=0;i<V_SUM_MAX;i++){
	// 	for(int j=0;j<W_MAX;j++){
	// 		dp[i][j] = INT_MAX;
	// 	}
	// }
	knapsack(val,weight,sum1,n);
	for(int i=sum1;i>=0;i--){
		// if(solveDp(i,n-1,weight,val,n)<=we){
		// 	cout<<i<<endl;
		// 	break;
		// }
		// t1("end");
		// t1(dp[17][n]);
		// if(knapsack(val,weight,i,n)<=we){
			
		// 	cout<<i<<endl;
		// 	break;
		// }
		if(dp[i][n]<=we){ cout<<i<<endl; break;}
	}
}

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

return 0;
}

Measured memory_bytes: 110836
fun main(args: Array<String>) {
    val line = readLine()!!.trim()
    val chars34: String = line.drop(2).take(2)
    val chars56: String = line.drop(4).take(2)
    val niteru34 = chars34.take(1) == chars34.drop(1).take(1)
    val niteru56 = chars56.take(1) == chars56.drop(1).take(1)

    if (niteru34 && niteru56) {
        println("Yes")
    } else {
        println("No")
    }
}


Measured memory_bytes: 34016
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder177
{
    class Program
    {
        static void Main(string[] args)
        {
            QB();
        }

        static void QA()
        {
            string[] splited = Console.ReadLine().Split(' ');

            int D = int.Parse(splited[0]);
            int T = int.Parse(splited[1]);
            int S = int.Parse(splited[2]);

            Console.WriteLine((((double)D / S) <= T) ? "Yes" : "No");
        }

        static void QB()
        {
            string S = Console.ReadLine();
            string T = Console.ReadLine();

            int cntNotMatchMin = 1001;

            for (int i = 0; i < S.Length - T.Length + 1; i++)
            {
                int cntNotMatch = 0;
                for (int j = 0; j < T.Length; j++)
                {
                    if (!S[i + j].Equals(T[j])) cntNotMatch++;
                }

                if (cntNotMatch < cntNotMatchMin) cntNotMatchMin = cntNotMatch;
            }

            Console.WriteLine(cntNotMatchMin);
        }
    }
}


Measured memory_bytes: 17652
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    string S; cin >> S;
    int sum = 0;
    int pos = 0;
    while ((pos = S.find("ABC", pos)) != string::npos) {
        sum++;
        pos++;
    }
    cout << sum << endl;
}


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

using namespace std;

long long dist[400][400];

int main(){
  int n;cin>>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)cin>>dist[i][j];
  }
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=0;k<n;k++){
        if(i == k) continue;
        if(j == k) continue;
        if(dist[i][k]+dist[k][j] < dist[i][j]){
          cout<<"-1"<<endl;
          return 0;
        }
      }
    }
  }
  long long ans = 0;

  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      bool f = true;
      for(int k=0;k<n;k++){
        if(i == k) continue;
        if(j == k) continue;
        if(dist[i][k]+dist[k][j] == dist[i][j]){
          f = false;
        }
      }
      if(f)ans += dist[i][j];
    }
  }

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

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

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

	for (int i = 0; i < N; i++) {
		int p = -1;
		for (int j = 0; j < b.size(); j++) {
			if (b[j] == j + 1) p = j;
		}
		if (p == -1) {
			cout << -1 << endl;
			return 0;
		}
		b.erase(b.begin() + p);
		ans[N - i - 1] = p+1;
	}

	for (int i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    ll money=1e3, n;
    cin >> n;
    ll num[n];
    rep(i,n){
        cin >> num[i];
    }
    rep(i,n-1){
        if(num[i] < num[i+1]){
            money = (money / num[i]) * num[i+1] + (money % num[i]);
        }
    }
    cout << money << endl;
}

Measured memory_bytes: 3624
/* by Natsu Kinmoe */
#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define loop(i,n) for(int i=0;i<(n);i++)
#define cont(i,n) for(int i=1;i<=(n);i++)
#define circ(i,a,b) for(int i=(a);i<=(b);i++)
#define range(i,a,b,c) for(int i=(a);((c)>0?i<=(b):i>=(b));i+=(c))
#define foreach(it,v) for(__typeof((v).begin()) it=(v).begin(),_e_D_=(v).end();it!=_e_D_;it++)
#define y0 y0O0OO00OO0OO0OO0OOO00OO0OO0O0O000OO0
#define y1 y1II11II11III11I1III11II111IIII1II1I1
#define pub push_back
#define pob pop_back
#define mak make_pair

typedef long long ll;
typedef long double lf;
const int Inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3fll;
/* Source code starts here */

int k,q;
ll d[5005],h[5005];

int main(){
	scanf("%d%d",&k,&q);
	loop(i,k)scanf("%lld",d+i);
	while(q--){
		int n,x,m;scanf("%d%d%d",&n,&x,&m);
		n--;x%=m;h[0]=0;
		int circhv=0;
		loop(i,k)h[i+1]=h[i]+d[i]%m,circhv+=(d[i]%m>0);
		int cyc=n/k,rem=n%k;ll sms=x+cyc*h[k];
		ll res=cyc*circhv-sms/m;sms%=m;
		loop(i,rem){
			int nsms=(sms+d[i])%m;
			if(nsms>sms)res++;sms=nsms;
		}
		printf("%lld\n",res);
	}
	return 0;
}

Measured memory_bytes: 3916
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <stack>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右下左上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, 1, 0, -1, -1, 1, 1, -1 };

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

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; ++i) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t szi, szj;
        inp(std::size_t _szi = 1, std::size_t _szj = 1) : szi(_szi), szj(_szj) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(szi); for (std::size_t i = 0; i < szi; ++i) std::cin >> a[i]; return a; }
        template <typename T> operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i) for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j]; return a;
        }
    };
    inp inp1;

    template<typename T>
    std::map<T, T> Factorize2Map(T x) {
        if (x <= 1) return std::map<T, T>();
        std::map<T, T> mp;
        for (T i = 2; i * i <= x; ++i) {
            while (x % i == 0) {
                x /= i;
                mp[i]++;
            }
        }
        if (x != 1) {
            mp[x]++;
        }
        return mp;
    }
}

int main() {

    ll n = inp1;

    int ans = 0;

    auto fact = Factorize2Map(n);

    for (auto p : fact) {
        ll cnt = 1;
        ll x = p.second;
        while (true) {
            if (x < cnt) break;
            x -= cnt;
            ++cnt;
            ++ans;
        }
    }

    Cout(ans);

    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int const mod = 1e9 + 7;
void plusle(int &a, int b){
    if((a += b) >= mod) a -= mod;
}
void minun(int &a, int b){
    if((a -= b) < 0) a += mod;
}
int add(int a, int b){
    return (a += b) >= mod ? a - mod : a;
}

const int M = (1 << 18) + 21;
int dp[42][M];
int n, x, y, z;

int main(){
    scanf("%d %d %d %d", &n, &x, &y , &z);
    dp[0][1] = 1;
    const int ban = (1 << z) + (1 << (z + y)) + (1 << (x + y + z));
    const int reduce = (1 << (x + y + z + 1)) - 1;
    for(int i = 1 ; i <= n ; i ++){
        for(int mask = 0 ; mask < (1 << x + y + z + 1) ; ++ mask){
            for(int p = 1 ; p <= 10 ; ++ p){
                int nmask = (mask << p) | 1;
                if((nmask & ban) == ban)continue;
                nmask &= reduce;
                plusle(dp[i][nmask], dp[i - 1][mask]);
            }
        }
    }
    int ans = 1;
    for(int i = 1 ; i <= n; i ++)
        ans = 1LL * 10 * ans % mod;
    for(int i = 0 ; i < M ; i ++)
        minun(ans, dp[n][i]);
    printf("%d\n", ans);
}


Measured memory_bytes: 42240
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	static Scanner sc =  new java.util.Scanner(System.in);

	public static void main(String[] args) {
		
		
		while ( sc.hasNext() ){
		
		double a = sc.nextInt();
		double b = sc.nextInt();
		double c = sc.nextInt();
		double d = sc.nextInt();
		double e = sc.nextInt();
		double f = sc.nextInt();
		
		double x = ( c*e - b*f ) / ( a*e - b*d );
		double y = ( a*f - c*d ) / ( a*e - b*d );
		
		BigDecimal bix = new BigDecimal (String.valueOf(x));
		BigDecimal biy = new BigDecimal (String.valueOf(y));
		x =bix.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
		y =biy.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
				
		System.out.println(String.format("%.3f",x) +  " " +String.format("%.3f",y));
	
		}

	}

}

Measured memory_bytes: 26740
//
/*
ID: kfoozmi1
LANG: C++
TASK:
*/
#include <bits/stdc++.h>
using namespace std;

#ifdef kfoozminus
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu() {
	cerr << endl;
}

template <typename T>
void faltu(T a[], int n) {
	for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
	cerr << endl;
}

template <typename First, typename ... hello>
void faltu(First arg, const hello&... rest) {
	cerr << arg << ' ';
	faltu(rest...);
}
#else
#define dbg(args...)
#endif

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define SQR(a) ((a) * (a))
#define vsort(v) sort(v.begin(), v.end())
#define PQ priority_queue
#define PI acos(-1)
#define EPS 1e-9

#define B1 43
#define B2 43

#define MOD1 1000000007
#define MOD2 1000000009
#define MOD  1000000007

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

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

inline bool checkBit(ll n, int i) { return n & (1LL << i); }
inline ll setBit(ll n, int i) { return n | (1LL << i); }
inline ll resetBit(ll n, int i) { return n & (~ (1LL << i)); }
inline bool EQ(double a, double b) { return fabs(a-b) < EPS; }
inline double dist(double ix, double iy, double jx, double jy) { return sqrt(SQR(ix - jx) + SQR(iy - jy)); }

#define PMX 1000000

int marked[PMX/64+2];

#define mark(x) marked[x>>6] |= (1<<((x&63)>>1))
#define check(x) (marked[x>>6] & (1<<((x&63)>>1)))

bool isPrime(int x)
{
    return (x>1) && ((x==2) || ((x&1) && (!(check(x)))));
}

void seive(int n)
{
    int i, j;
    for(i=3; i*i<=n; i+=2)
    {
        if(!check(i))
        {
            for(j=i*i; j<=n; j+=i<<1)
            {
                mark(j);
            }
        }
    }
}

ll bigMod(ll a, ll b)
{
	ll r = 1;
	while(b) {
		if(b & 1) (r *= a) %= MOD;
		b >>= 1;
		(a *= a) %= MOD;
	}
	return r;
}

#define INF 100000000
#define MX 100007

int main()
{
#ifdef kfoozminus
	//freopen("in", "r", stdin);
#endif
	int a, b, d;
	scanf("%d %d", &a, &b);
	if(a <= 0 && b >= 0) printf("Zero\n");
	else {
		d = max(min(-1, b) - a + 1, 0);
		if(d & 1) printf("Negative\n");
		else printf("Positive\n");
	}
        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;int n;
	cin>>n>>s;
	for(int i=0;i<s.length();i++)
	{
		s[i]=(char)((s[i]-'A'+n)%26+'A');
	}
	cout<<s<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int N,K;
    cin >> N >> K;
    int P[1100];
    
    for(int i=0;i<N;i++) cin >> P[i];

    sort(P,P+N);
    
    int sum = 0;
    for(int i=0;i<K;i++) sum += P[i];
    
    cout << sum;
    
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

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

    vector<pair<ll, ll>> dt(N);
    for(int i=0;i<N;i++){
        cin >> dt[i].second >> dt[i].first;
    }
    sort(dt.begin(), dt.end());
    reverse(dt.begin(), dt.end());

    vector<bool> used_neta(N, false);
    list<ll> unused;
    priority_queue<ll, vector<ll>, greater<ll>> used;
    ll total = 0;
    for(int i=0;i<N;i++){
        if(used_neta[dt[i].second]){
            unused.push_back(dt[i].first);
        }else{
            used_neta[dt[i].second] = true;
            total += dt[i].first;
            used.push(dt[i].first);
        }
    }

    while(used.size() > K){
        total -= used.top();
        used.pop();
    }
    for(ll i=0;i+used.size()<K;i++){
        total += unused.front();
        unused.pop_front();
    }
    ll ans = total + ll(used.size()) * used.size();
    while(!used.empty() && !unused.empty()){
        ll m = used.top();
        used.pop();
        if(m >= unused.front()) break;
        total -= m;
        total += unused.front();
        unused.pop_front();
        ans = max(ans, total + ll(used.size()) * ll(used.size()));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define ll long long
#define ull  unsigned long long
#define pb push_back

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 200000;
int a[N];
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, k;
    cin >> n >> k;
    int t = 1;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
        t = max(t, a[i]);
    }
    int x = __gcd(a[1], a[2]);
    for (int i = 2; i <= n; i++) x = __gcd(x, a[i]);
    if (k % x || k > t){
        cout << "IMPOSSIBLE";
    } else
        cout << "POSSIBLE";
}


Measured memory_bytes: 892