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

using namespace std;

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

const int INF = 1000000000; //
const ll LINF = (ll) 4000000000000000000; //
const ll MOD = (ll) 1000000007; //
const double PI = 3.1415926535898; //

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define NP(v) next_permutation(v.begin(),v.end())

//------------------------------------------------------

int main() {
    int n;
    cin >> n;
    ll a[3 * n];
    rep(i, 3 * n) cin >> a[i];

    sort(a, a + 3 * n);
    reverse(a, a + 3 * n);

    ll sum = 0;

    rep(i, n) sum += a[i * 2 + 1];

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>

int main(void){

	int x, i;
	int n;

	scanf("%d", &x);

	for(i=1; i<=x; i++) {
		if(i%3 == 0) printf(" %d", i);

		else{
			n = i;

		while(n % 10 != 3 && n) {
			n /= 10;
		}

		if(n){
			printf(" %d", i);
		}
		}
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 596
/*B - Uneven Numbers*/
#include <bits/stdc++.h>
using namespace std;

int main(){

	int n;
	cin >> n;

	if(n < 10)
		cout << n;

	if(n >= 10 and n <= 99)
		cout << "9";

	if(n >= 100 and n <= 999)
		cout << n - 90;

	if (n >= 1000 and n <= 9999)
		cout << "909";

	if(n >= 10000 and n <= 99999)
		cout << n - 9090;

	if(n == 100000)
		cout << 90909;

	return 0;
}

Measured memory_bytes: 256
import copy
n = int(input())
a = [int(input()) for _ in range(n)]
s = copy.copy(a)
s.sort(reverse=True)
first = s[0]
second = s[1]
mx = []
for i in range(n):
    if a[i] == first:
        mx.append(second)
    else:
        mx.append(first)
for i in range(n):
    print(mx[i])


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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

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

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }



int main()
{
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    
    int N;
    cin >> N;
    int ans = pow(N,3);
    cout << ans << endl;


}


Measured memory_bytes: 256
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
H,W = map(int,input().split())
# 盤面の受け取り
board = [[] for _ in range(H+2)]
board[0] = ["#"]*(W+2)
for i in range(1,H+1):
    board[i] = ["#"] + list(input()) + ["#"]
board[H+1] = ["#"]*(W+2)

for row in board:
    print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


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

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

ll n;
ll dp[2][10005];
ll cost[10005];

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

    cin >> n;

    for (int i = 0;i < n-1;i++){
        cin >> cost[i];
    }

    for (int i = 0;i < 2;i++){
        for (int j = 0;j <= n;j++){
            dp[i][j] = INT_MAX;
        }
    }

    dp[0][1] = 0;

    for (int i = 0;i < n-1;i++){
        for (int j = 0;j <= n;j++){
            if(dp[i%2][j] == LLONG_MAX) continue;
            dp[(i+1)%2][j+1] = min(dp[(i+1)%2][j+1],dp[i%2][j]); 
            dp[(i+1)%2][i+1-j+1] = min(dp[(i+1)%2][i+1-j+1],dp[i%2][j]+cost[i]);
        } 
        for (int j = 0;j <= n;j++){
            dp[i%2][j] = INT_MAX;
        }
    }

    cout << dp[(n-1)%2][n/2] << endl;


    return 0;

}


Measured memory_bytes: 3412
s=input()
t=input()
a=len(s)
b=len(t)
n_list=  ['' for i in range(a)]
b_list=['' for j in range(b)]
for i in range(b) :
  if s[0] in t[:i+1] :
    b_list[i]=s[0]
for i in range(a) :
  if t[0] in s[:i+1] :
    n_list[i]=t[0]

import copy
for i in range(1,b) :
  n_list1=copy.copy(n_list)
  n_list[0]=b_list[i]
  for j in range(1,a) :

    if len(n_list1[j])>len(n_list[j]) :
      n_list[j]=n_list1[j]
    if len(n_list[j-1])>len(n_list[j]) :
      n_list[j]=n_list[j-1]
    if t[i]==s[j] and len(n_list1[j-1])+1>len(n_list[j])  :
      n_list[j] = n_list1[j - 1]+t[i]

print(n_list[-1])

Measured memory_bytes: 158916
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
using lint = int64_t;

struct UnionFind {
    vector<int> par;
    UnionFind(int N) : par(N) {
        rep(i, N) par[i] = -1;
    }
    int root(int x) {
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (par[rx] > par[ry]) swap(rx, ry);
        par[rx] += par[ry];
        par[ry] = rx;
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    UnionFind UF(n);
    rep(i, q) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) {
            UF.unite(x, y);
        } else {
            cout << (UF.same(x, y) ? 1 : 0) << "\n";
        }
    }
    return 0;
}



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

int main() {
    string s, ls="", rs = "";
    cin >> s;

    int q;
    cin >> q;

    bool reversed = false;

    for (int i=0; i<q; i++){
        int t;
        cin >> t;

        if (t == 1) {
            reversed ^= true;
        } else {
            int f;
            cin >> f;
            char c;
            cin >> c;

            if (f == 1) {
                if (reversed) rs += c;
                else ls += c;
            } else {
                if (reversed) ls += c;
                else rs += c;
            }
        }
    }

    if (reversed) {
        reverse(rs.begin(), rs.end());
        reverse(s.begin(), s.end());
        string anss = rs + s + ls;
        for (int i=0; i<anss.size(); i++) {
            cout << anss.at(i);
        }
        cout << endl;
    } else {
        reverse(ls.begin(), ls.end());
        string anss = ls + s + rs;
        for (int i=0; i<anss.size(); i++) {
            cout << anss.at(i);
        }
        cout << endl;
    }
}

Measured memory_bytes: 1348
#include"bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
//#include <vector>
//#include <iostream>

typedef long long ll;
typedef unsigned long long ull;

#define MOD 1000000007
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; std::swap(a, b);
		u -= t * v; std::swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}



void Main()
{
	ull N, K;
	std::cin >> N >> K;
	std::vector<int> A(N), F(N);

	for (int i = 0; i < N; i++)
		std::cin >> A[i];

	for (int i = 0; i < N; i++)
		std::cin >> F[i];

	std::sort(A.begin(), A.end());
	std::sort(F.begin(), F.end(), std::greater<int>());
	ll left = -1, right = 1e18;
	ll middle;
	while(left + 1 < right) {
		ll k = K;
		middle = left + (right - left) / 2;
		bool flag = true;
		for (int i = 0; i < N; i++)
		{
			//ull k_used = (ull) std::ceil((double) A[i] - ((double)middle / (double) F[i]));
			k -= std::max(A[i] - middle / F[i], ll(0));
			//std::cout << "middle:" << middle << ", k:" << k <<", k_used:" << k_used <<", index:" << i << std::endl;
			if (k < 0)
			{
				flag = false;
				break;
			}
			if (i == N - 1)
			{
				flag = true;
			}
		}
		if (flag)
		{
			right = middle;
		}
		else
		{
			left = middle;
		}
	}
	std::cout << right << std::endl;
	return;
}

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


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

using namespace std;
#define IINF 1e9

int main(void){
  
  int n;
  cin >> n;
  
  vector<int> h(n), dp(n, IINF);
  dp[0] = 0;
  
  for(int i = 0;i < n;i++) cin >> h[i];
  
  for(int i = 1;i < n;i++){
    dp[i] = min(dp[i], dp[i-1]+abs(h[i-1]-h[i]));
    if(i > 1) dp[i] = min(dp[i], dp[i-2]+abs(h[i-2]-h[i]));
  }
  
  cout << dp[n-1] << endl;
  
  return 0;
}

Measured memory_bytes: 4036
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<ull> vul;
#define For(i, n) for(ll i = 0; i < n; i++)
#define len(n) (ll)(n).size()
#define FAST_IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Sort(a) sort(a.begin(), a.end())

ll dp[(ll)1e5][3];
ll n;
vector<vl> a;

int main() {
    FAST_IO;
    cin >> n;
    a.resize(n + 1, vl(3));
    For(i, n) For(j, 3) cin >> a[i][j];
    for (ll i = 1; i <= n; i++) {
        For(j, 3) {
            For(j1, 3) {
                if (j != j1) {
                    dp[i][j] = max({ dp[i][j], dp[i - 1][j1] + a[i - 1][j] });
                }
            }
        }
    }
    cout << max({ dp[n][0], dp[n][1], dp[n][2] }) << '\n';
    return 0;
}

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

uint64_t combination(uint64_t, uint64_t, const uint64_t&);

int main()
{
  const uint64_t mod = 1'000'000'007;
  uint64_t n, m;
  cin >> n >> m;
  uint64_t mm = m;
  uint64_t ans = 1;
  for (auto i = 2; i * i <= mm; i++) {
    if (mm % i == 0) {
      uint64_t count = 0;
      while (mm % i == 0) {
	count++;
	mm /= i;
      }
      ans *= combination(n + count - 1, count, mod);
      ans %= mod;
    }
  }
  if (mm != 1) {
    ans *= n;
    ans %= mod;
  }
  cout << ans << endl;
}

uint64_t modpow(uint64_t a, uint64_t p, const uint64_t& mod)
{
  if (p == 0) return 1;
  if (p % 2 == 0) {
    uint64_t h = modpow(a, p / 2, mod);
    return h * h % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

uint64_t combination(uint64_t a, uint64_t b, const uint64_t& mod)
{
  if (a - b < b) return combination(a, a - b, mod);
  uint64_t ansmul = 1;
  uint64_t ansdiv = 1;
  for (uint64_t i = 0; i < b; i++) {
    ansmul *= a - i;
    ansdiv *= i + 1;
    ansmul %= mod;
    ansdiv %= mod;
  }
  uint64_t ans = ansmul * modpow(ansdiv, mod - 2, mod) % mod;
  return ans;
}


Measured memory_bytes: 888
#include <stdio.h>

int main(){
  int A[100], N, i, j, x, ch, cnt = 0;
  scanf("%d",&N);
  for(i = 0; i < N; i++)scanf("%d",&A[i]);

  for(i = 0; i < N-1; i++){
    x = i;
    for(j = i; j < N; j++){
      if(A[j] < A[x]) x = j;
    }
    ch = A[i];
    A[i] = A[x];
    A[x] = ch;
    if(i != x)cnt++;
  }

  for(i = 0; i < N; i++){
    printf("%d",A[i]);
    if(i < N-1)printf(" ");
  }
  printf("\n");
  printf("%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2128
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import copy
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        lower, upper = [], []
        i = 1
        while i * i <= n:
            if n % i == 0:
                lower.append(i)
                if i != n // i:
                    upper.append(n // i)
            i += 1
        return lower + upper[::-1]

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def fact(N):
        res = {}
        tmp = N
        for i in range(2, int(N ** 0.5 + 1) + 1):
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if cnt > 0:
                res[i] = cnt
        if tmp != 1:
            res[tmp] = 1
        if res == {}:
            res[N] = 1
        return res


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


def solve():
    N = Scanner.int()
    A = Scanner.map_int()
    ans = 0
    j = 0
    A.sort(reverse=True)
    for i in range(1, N):
        ans += A[j]
        if i % 2 == 1:
            j += 1
    print(ans)


def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 33252
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAX = 501;
int cz[MAX][MAX];
int odl[MAX][MAX];
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};
int n;
void rel(int i,int j){
  int res = MAX;
  R(k,4){
    int ni = i + dx[k];
    int nj = j + dy[k];
    if(ni >= 0 && ni < n && nj >= 0 && nj < n){
      mini(res, odl[ni][nj]);
    }else{
      mini(res, 0ll);
    }
  }
  if(!cz[i][j]){
    res++;
  }
  if(odl[i][j] > res){
    odl[i][j] = res;
    R(k,4){
      int ni = i + dx[k];
      int nj = j + dy[k];
      if(ni >= 0 && ni < n && nj >= 0 && nj < n)
        rel(ni,nj);
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n;
  R(i,n)R(j,n){
    odl[i][j] = min(min(i,n-i-1), min(j,n-j-1)) + 1;
  }
  int res = 0;
  R(_,n*n){
    int pom;
    cin >> pom;pom--;
    int i = pom/n;
    int j = pom%n;
    res += odl[i][j] - 1;
    cz[i][j] = 1;
    rel(i,j);
    
  }
  cout << res << "\n";
}


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



int main() 
{ 
    long long int t;
    cin>>t;
    string s;
    set<string>st;
    while(t--)
    {
        cin>>s;
        st.insert(s);
    }
    cout<<st.size()<<endl;
}
// ((((#&#)^#)|(#^#))&(#|#))

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

int main() {
	int n, m;
	cin >> n >> m;
	vector< vector<int> > jobs(m); 
	rep(i, n) {
		int a, b;
		cin >> a >> b;
		if(a > m)continue; 
		jobs[m-a].push_back(b); 
	}
  
	priority_queue<int> q;
	ll ans = 0; 
  
	repback(i, m-1, 0){	
		for(int b : jobs[i]) { 
			q.push(b);
		}		
		if(!q.empty()) {  
		ans += q.top(); 
		q.pop(); 
		}
	}
	cout << ans << endl;
    return 0;	
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define pb push_back
#define vl vector<ll>
#define pll pair<ll,ll>
#define mp make_pair
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
	int n;
	cin>>n;
	int a[n],b[n],c[n-1];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	for (int i = 0; i < n; ++i)
	{
		cin>>b[i];
	}
	for (int i = 0; i < n-1; ++i)
	{
		cin>>c[i];
	}	
	int s=0;
	for(int i=0;i<n;i++)
	{
		s+=b[a[i]-1];
		if(i>0)
		{
			if(a[i]==a[i-1]+1)
			{
				s+=c[a[i-1]-1];
			}
		}
	}	
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 384
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


from collections import defaultdict

N = int(input())
S = [input() for _ in range(N)]
d = defaultdict(int)
for i in range(N):
    S[i] = sorted(S[i])
    d["".join(S[i])] += 1
ans = 0
for i in d.values():
    if i >= 2:
        ans += cmb(i, 2)

print(ans)


Measured memory_bytes: 37668
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <cmath>
#include <algorithm>

using namespace std;

const int INF = 1e6;

int main(){
    string s;
    cin >> s;
    s.replace(4, 1, "");
    s.replace(6, 1, "");
    int a = stoi(s);
    if (a <= 20190430)  cout << "Heisei" << endl;
    else  cout << "TBD" << endl;
}

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

int main() {
	string s;
	cin >> s;
	int n = s.size();
	string ans = "No";
	for (int i = 0;i < n - 1;i++) {
		if (s.substr(i, 2) == "AC") {
			ans = "Yes";
			break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	char s[55], t[55];
	scanf("%s%s", s, t);
	int n, m;
	n = strlen(s);
	m = strlen(t);
	int i, j;
	int v, c;  //V É A FLAG DELE.
	v = 0;
	for (i = n - m; i >= 0; i--)   //para o primeiro ex: i=7-5=2
	{
		c = 0;
		for (j = 0; j < m; j++)
			if (s[i + j] != t[j] && s[i + j] != '?')
				c++;
		if (c == 0)
		{
			v = 1;
			for (j = 0; j < m; j++)
				if (s[i + j] == '?')
					s[i + j] = t[j];
			break;
		}
	}
	if (v == 0)
	{
		printf("UNRESTORABLE\n");
		return 0;
	}
	for (i = 0; i < n; i++)
		if (s[i] == '?')
			s[i] = 'a';
	printf("%s\n", s);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAX 505
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
int n,pos=1,a[MAX*MAX],p[MAX],x[MAX];
bool vis[MAX];
bool cmp(int a,int b){return x[a]<x[b];}
int main()
{
	n=read();
	for(int i=1;i<=n;++i)x[i]=read(),a[x[i]]=i,p[i]=i;
	sort(&p[1],&p[n+1],cmp);
	for(int i=1;i<=n;++i)
	{
		int v=p[i];
		for(int j=1;j<v;++j)
		{
			while(a[pos])++pos;
			a[pos]=v;
		}
		if(pos>x[v]){puts("No");return 0;}
	}
	for(int i=1;i<=n;++i)
	{
		int v=p[i];
		for(int j=1;j<=n-v;++j)
		{
			while(a[pos])++pos;
			if(pos<x[v]){puts("No");return 0;}
			a[pos]=v;
		}
	}
	puts("Yes");
	for(int i=1;i<=n*n;++i)printf("%d ",a[i]);puts("");
	return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int n, i, j, k, s = 0;
	cin >> n;
	vector<int> a(n), ans(n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
		s ^= a[i];
	}
	for (i = 0; i < n; i++) {
		ans[i] = s ^ a[i];
		cout << ans[i] << " ";
	}
	cout << "\n";


	return 0;
}


Measured memory_bytes: 4316
def main():
    """
    x(i+1)=r * x(i)−D
    2001
    2010
    """
    r, D, x2000 = map(int, input().split())

    bef_x = x2000
    for _ in range(2001, 2010+1):
        ans = r * bef_x - D
        bef_x = ans
        print(ans)


if __name__ == '__main__':
    main()


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

int main(){
  int a, b; cin >> a >> b;
  int ans = 0;
  for(int i = a; i <= b; i++){
    string istr = to_string(i);
    if(istr[0] == istr[4] && istr[1] == istr[3]) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// kartikay26
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
template<typename L>void print(L x){cout << x << endl;}
template<typename T, typename... A>
void print(T x,A... r){cout << x << " ";print(r...);}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef long long int ll;
#define int ll
const int inf = LLONG_MAX;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int mod = 1e9+7;
const int N = 1e2+1;
const int W = 1e5+1;

int n, w;
int wt[N];
int vl[N];
int dp[N][W];

int32_t main(){
	fast_io();
	cin >> n >> w;
	for (int i = 1; i <= n; ++i) {
		cin >> wt[i] >> vl[i];
	}
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= w; ++j) {
			dp[i][j] = dp[i-1][j];
			if(j - wt[i] >= 0){
				dp[i][j] = max(dp[i][j], vl[i] + dp[i-1][j - wt[i]]);
			}
		}
	}
	print(dp[n][w]);
	return 0;
}

Measured memory_bytes: 78336
#include<bits/stdc++.h>
#define PI 3.141592653589
using namespace std;
using ll = long long;

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

int main(){
  int n; cin >> n;
  vector<int> w(n);
  for(int i=0; i<n; ++i) cin >> w[i];
  int sum1 = 0, sum2 = 0;
  int ans = 100;

  for(int i=0; i<n; ++i){
    sum1 = 0;
    sum2 = 0;
    for(int j=0; j<=i; ++j){
      sum1 += w[j];
    }
    for(int k=i+1; k<n; ++k){
      sum2 += w[k];
    }
    int dif = abs(sum1-sum2);
    ans = min(dif, ans);
  }

  cout << ans << endl;


}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define ll                 long long int
#define mod                998244353
#define pi                 3.14159265358979323846264338327950288419716939937510
#define setbit(x)          __builtin_popcountll(x)
#define db                 long double
#define pp(x)              pair<x,x>
#define ff                 first
#define ss                 second
#define FIO                ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc                 ll tc; cin>>tc; for(ll number = 1 ; number <= tc ; number ++ )
#define vv(x)              vector<x>
#define pb                 push_back
#define pob                pop_back
#define pf                 push_front
#define pof                pop_front
#define endl               "\n"
#define pq                 priority_queue
#define dbg(x)             { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)          { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define bp                 ll kkk; cin >>kkk;
#define dbgArr(a,n)        cout<<"Array "<<#a<<endl; for(ll i=0 ; i<n ; i++) cout<<a[i]<<" "; cout<<endl;
#define maxE(a,n)          *max_element(a,a+n);
#define minE(a,n)          *min_element(a,a+n);
#define forn(i,s,n)        for(ll i=s ; i<n ; i++)
#define fornr(i,e,s)       for(ll i=e-1 ; i>=s ; i--)
#define arr1(a,n)          for(ll i=1;i<=n;i++){ cin>>a[i]; }
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define print cout<<"Case #"<<number<<": "
#define all(x) x.begin(), x.end()
ll power(ll x, ll b) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= mod;} b >>= 1; x *= x; x %= mod;} return p % mod;}
using namespace std;
# define INF 1e15

struct ppp{
    ll a,b,c;
};

struct lex_compare {
    bool operator() (ppp p1, ppp p2){
        if(p1.a == p2.a){
            if(p1.b == p2.b) return p1.c < p2.c;
            else return p1.b < p2.b;
        }else{
            return p1.a < p2.a;
        }
    }
};

int main(){
    FIO;
    ll n; cin >> n;
    bool f = 0;
    ll c= 0;
    ll preva = 0, prevb = 0;
    while(n--){
        ll a,b; cin >> a >> b;
        if(a == b ){
            c++;
        }else{
            c = 0;
        }

        if(c == 3){
            f = 1;
        }
    }
    if(f){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vl a(n); cin>>a;
	sort(all(a));
	puta(a[n/2]-a[n/2-1]);
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>

int main(void){
    int N,K,Q,i,j;
    scanf("%d%d%d",&N,&K,&Q);
    int* M;
    M=(int*)malloc(sizeof(int)*N);
    for(i=0;i<N;i++){
        M[i]=K-Q;
    }
    for(i=0;i<Q;i++){
        int A;
        scanf("%d",&A);
        M[A-1]=M[A-1]+1;
    }
    for(i=0;i<N;i++){
        if(M[i]<=0){
            printf("No\n");
        }else{
            printf("Yes\n");
        }
    }
    free(M);
    return 0;
}

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

int main(void){
    string s, t;
    cin >> s >> t;

    set<string> st;

    for(int i=0; i+t.length()<=s.length(); i++){
        string ss = s.substr(i, t.length());
        bool flag = true;
        for(int j=0; j<t.length(); j++){
            if(ss[j] != '?' && t[j] != '?' && ss[j] != t[j]){
                flag = false;
                break;
            }
        }
        if(flag){
            string key = s.substr(0,i) + t + s.substr(i+t.length());
            for(int i=0; i<key.length(); i++){
                if(key[i] == '?'){
                    key[i] = 'a';
                }
            }
            st.insert(key);
        }
    }

    if(st.empty()){
        cout << "UNRESTORABLE" << endl;
    }else{
        cout << *st.begin() << endl;
    }

    return 0;
}

Measured memory_bytes: 508
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <stack>
#define rep(x,to) for(x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;




int main(void){

stack<int> stk;
int ww;	

	while(cin >> ww){
		if(ww != 0){
			stk.push(ww);
		}else{
			cout << stk.top() << endl;
			stk.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
string s;
int ans=0;
bool True(int l)
{
	for(int i=0;i<l;i++)
	{
		if(i==0&&s[i]!='A')
		return false;
		if(i>=2&&i<=l-2)
		{
			if(s[i]=='C')
			ans++;
		}
		if(s[i]!='A'&&s[i]!='C'&&s[i]<97)
		return false;
	}
	if(ans!=1)
	return false;
	return true;
}
int main()
{
	int l;
	cin>>s;
	l=s.size();
	if(True(l))
	cout<<"AC"<<endl;
	else
	cout<<"WA"<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n, sum = 0;
  cin >> n;
  for(int i = 1; i < n+1; i++){
    for(int j = 1; j < n+1; j++){
      for(int k = 1; k < n+1; k++){
        int a = __gcd(i,__gcd(j, k));
        sum += a;
        //cout << "gcd of "<<i << " " << j << " " << k << " = "<< a << endl;
      }
    }
  }
  cout << sum;
  return 0;
}

/*
         ,--"""",--.__,---[],-------._         
       ,"   __,'            \         \--""""""==;-
     ," _,-"  "/---.___     \       ___\   ,-'',"
    /,-'      / ;. ,.--'-.__\  _,-"" ,| `,'   /
   /``""""-._/,-|:\       []\,' ```-/:;-. `. /
             `  ;:::      ||       /:,;  `-.\
                =.,'__,---||-.____',.=
                =(:\_     ||__    ):)=
               ,"::::`----||::`--':::"._
             ,':::::::::::||::::::::::::'.
    .__     ;:::.-.:::::__||___:::::.-.:::\     __,
       """-;:::( O )::::>_|| _<::::( O )::::-"""
   =======;:::::`-`:::::::||':::::::`-`:::::\=======
    ,--"";:::_____________||______________::::""----.          , ,
         ; ::`._(    |    |||     |   )_,'::::\_,,,,,,,,,,____/,'_,
       ,;    :::`--._|____[]|_____|_.-'::::::::::::::::::::::::);_
      ;/ /      :::::::::,||,:::::::::::::::::::::::::::::::::::/
     /; ``''''----------/,'/,__,,,,,____:::::::::::::::::::::,"
     ;/                :);/|_;| ,--.. . ```-.:::::::::::::_,"
    /;                :::):__,'//""\\. ,--.. \:::,:::::_,"
   ;/              :::::/ . . . . . . //""\\. \::":__,"
   ;/          :::::::,' . . . . . . . . . . .:`::\
   ';      :::::::__,'. ,--.. . .,--. . . . . .:`::`
   ';   __,..--'''-. . //""\\. .//""\\ . ,--.. :`:::`
   ;    /  \\ .//""\\ . . . . . . . . . //""\\. :`::`
   ;   /       . . . . . . . . . . . . . . . . .:`::`
   ;   (          . . . . . . . . . . . . . . . ;:::`
   ,:  ;,            . . . . . . . . . . . . . ;':::`
   ,:  ;,             . . . . . . . . . . . . .;`:::
   ,:   ;,             . . . . . . . . . . . . ;`::;`
    ,:  ;             . . . . . . . . . . . . ;':::;`
     :   ;             . . . . . . . . . . . ,':::;
      :   '.          . . . . . . . .. . . .,':::;`
       :    `.       . . . . . . . . . . . ;::::;`
        '.    `-.   . . . . . . . . . . ,-'::::;
          `:_    ``--..___________..--'':::::;'`
             `._::,.:,.:,:_ctr_:,:,.::,.:_;'`
________________`"\/"\/\/'""""`\/"\/""\/"____________________________
 
*/

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

int main() {
    #ifdef LOCAL
    assert(freopen("c.in", "r", stdin));
    #else
    #endif
    string s;
    cin >> s;
    int n = sz(s);
    vector<bool> d(sz(s) + 1);
    d[0] = true;
    forn (i, n) {
        if (!d[i])
            continue;
        if (i + 5 <= n && s.substr(i, 5) == "dream")
            d[i + 5] = true;
        if (i + 5 <= n && s.substr(i, 5) == "erase")
            d[i + 5] = true;
        if (i + 6 <= n && s.substr(i, 6) == "eraser")
            d[i + 6] = true;
        if (i + 7 <= n && s.substr(i, 7) == "dreamer")
            d[i + 7] = true;
    }
    cout << (d[n] ? "YES" : "NO") << '\n';
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

class UnionFind{
public:
    //親の番号を格納する。親だった場合はー（その集合のサイズ）
    vector<int> parents;

    //作る時はparentsを-1で初期化する
    //こうすることで全部ばらばらになる
    UnionFind(int n){
        parents = vector<int>(n, -1);
    }

    //Aがどのグループにいるか調べる
    int root(int A){
        if(parents[A]<0) return A;
        return parents[A] = root(parents[A]);
    }

    //自分のいるグループの大きさを調べる
    int size(int A){
        return -parents[root(A)];
    }

    //AとBをくっつける
    bool connect(int A, int B){
        //AとBを直接ではなく親同士をくっつける
        A=root(A);
        B=root(B);
        if(A==B){
            return false;
        }

        //大きい方（A)に小さい方（B)をくっつけたい
        if(size(A)<size(B)) swap(A, B);

        parents[A] += parents[B];
        parents[B] = A;

        return true;
    }
};


class Edge {
    public:
    int source, target, cost;
    Edge(int source=0, int target=0, int cost=0):
    source(source), target(target), cost(cost){}
    bool operator < (const Edge &e) const{
        return cost < e.cost;
    }
};

int kruskal(int N, vector<Edge> edges){
    int totalCost = 0;
    sort(edges.begin(), edges.end());

    UnionFind uni(N);
    for(int i=0; i<edges.size(); i++){
        Edge e=edges[i];
        if(uni.root(e.source) != uni.root(e.target)){
            totalCost += e.cost;
            uni.connect(e.source, e.target);
        }
    }

    return totalCost;
}

int main(){
    int V,E; cin >> V >> E;
    vector<Edge> edges(E);
    for(int i=0; i<E; i++){
        cin >> edges[i].source >> edges[i].target >> edges[i].cost;
    }
    cout << kruskal(V, edges) << endl;
}


Measured memory_bytes: 5212
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define rep(i,N) for(ll i=0; i<N; i++)
const ll mod=1e9+7;

int main(){
	string S;
	cin >> S;
	string ans="No";
	if(S[0] != S[1] || S[0] != S[2] || S[1] != S[2]){
		ans="Yes";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int S, h, m, s;
        S = Integer.parseInt(str);
        h = S / 3600;
        S = S % 3600;
        m = S / 60;
        s = S % 60;
        System.out.println(h+":"+m+":"+s);
    }
    
}

Measured memory_bytes: 26156
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int H,W;cin>>H>>W;
  int c[10][10];
  int ans=0;
  REP(i,10){
    REP(j,10){
      cin>>c[i][j];
    }
  }
  // powerに入れる→c[i][j]の更新。ワーシャルフロイド
  for(int k=0;k<=9;k++){
    for(int i=0;i<=9;i++){
      for(int j=0;j<=9;j++){
        c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
      }
    }
  }


  // for(int i=0;i<=9;i++)P(power[i]);
  for(int i=1;i<=(H*W);i++){
    int a;cin>>a;
    if(a>-1){
      ans+=c[a][1];
    }
  }
  P(ans);
  return 0;
}


Measured memory_bytes: 256
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e2+5;

const int mod = 1e9+7;

int n;
int cnt[N];

vector < int > primeFactors(long long num){
    vector < int > prm;
    while (num % 2 == 0){
        prm.push_back(2);
        num = num/2;
    }
    for (long long i = 3; i*i <= num; i = i + 2){
        while (num % i == 0){
            prm.push_back(i);
            num = num/i;
        }
    }
    if (num > 2)
        prm.push_back(num);
    return prm;
}

int go(int idx , int mul , int tk){
    if(mul > 75)
        return 0;
    if(idx > 100)
        return mul == 75;
    int ways = go(idx + 1 , mul * max(tk+1 , 1) , 0);
    if(tk + 1 <= cnt[idx])
        ways += go(idx , mul , tk + 1);
    return ways;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i <= n; i++){
        vector < int > ret = primeFactors(i);
        for(auto v : ret){
            cnt[v]++;
        }
    }
    printf("%d\n" , go(1 , 1 , 0));
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
using namespace std;
typedef long long LL;
//#define _USE_MATH_DEFINES

int main(void) {
	int a, b, c, k, num = 0;

	cin >> a >> b >> c;
	cin >> k;

	num = a + b + c;
	num -= max(a, max(b, c));

	cout << num + pow(2, k)*max(a, max(b, c)) << endl;



	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
const double PI = acos(-1);
using namespace std;
int main()
{

  long long int t,n,i,j,k,l;

    cin>>i>>j>>k;
    l=i+j+k;
    if(l>=22)
    cout<<"bust"<<endl;
    else
    cout<<"win";
    
}

Measured memory_bytes: 3632
N = int(input())
A = list( map(int,input().split()) )
flag = [0 for i in range(8)]
n = 0
c = 0
for a in A:
  if a  >= 3200:
    n += 1
  elif flag[a//400] == 0:
    flag[a//400] = 1
    c += 1

if c == 0:
  print( 1 , c+n  )
else:
  print( c , c+n )

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define pb push_back
#define fi first
#define sec second
#define INF 1000000000
#define DINF 1000000000.0
#define eps 1e-18
int N,M;
int A[100100],B[100100];
ll x[100100];
struct edge{
	int to;
	vector<ll> costs;
	edge(){}
	edge(int to,vector<ll> costs):to(to),costs(costs){}
};
vector<edge> g[100100];
bool used[100100];
vector<ll> pr = {1000000007ll,1000000009ll,998244353ll};
vector<ll> dp[100100];
vector<ll> add(vector<ll>& a,vector<ll>& b){
	vector<ll> res;
	for(int i=0;i<a.size();i++){
		res.pb((a[i]*b[i])%pr[i]);
	}
	return res;
}
ll mypow(ll a,ll x,ll mod){
	ll res = 1ll;
	while(x){
		if(x&1ll)res = (res*a)%mod;
		a = (a*a)%mod;
		x >>= 1;
	}
	return res;
}
int main(){
	cin >> N >> M;
	cout << fixed << setprecision(20);
	for(int i=0;i<M;i++){
		cin >> A[i] >> B[i] >> x[i];
		A[i]--;B[i]--;
		vector<ll> c,d;
		for(int j=0;j<pr.size();j++){
			c.pb(x[i]%pr[j]);
			d.pb(mypow(x[i],pr[j]-2,pr[j]));
		}
		g[A[i]].pb(edge(B[i],c));
		g[B[i]].pb(edge(A[i],d));
		// cout << log(x[i]) << endl;
	}
	// toposort();
	/*for(int i=0;i<M;i++){
		if(rev[A[i]]>rev[B[i]]){
			cout << "No" << endl;
			return 0;
		}
	}*/	
	for(int i=0;i<N;i++){	
		if(dp[i].size()>0)continue;
		for(int j=0;j<pr.size();j++)dp[i].pb(1ll);
		queue<int> q;
		q.push(i);
		while(!q.empty()){
			int a = q.front();
			q.pop();
			for(int i=0;i<g[a].size();i++){
				edge& e = g[a][i];
				vector<ll> c = add(dp[a],e.costs);
				if(dp[e.to].size()==0){
					dp[e.to] = c;
					q.push(e.to);
				}else{
					if(dp[e.to]!=c){
						cout << "No" << endl;
						return 0;
					}
				}
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}




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

ll MX = 100000000000;



int main(){
    int a,b,q;
    cin>>a>>b>>q;
    vector<ll> s(a+2),t(b+2);
    s[0] = -1*MX;
    t[0] = -1*MX;
    s[a+1] = MX;
    t[b+1] = MX;
    rep(i,a) cin>>s[i+1];
    rep(i,b) cin>>t[i+1];

    ll x=0;
    ll sa,sb,ta,tb;
    vector<ll>::iterator itr;
    rep(i,q){
        ll ans = MX;

        cin>>x;
        itr = lower_bound(s.begin(),s.end(),x);
        sb = *itr;
        --itr;
        sa = *itr;

        itr = lower_bound(t.begin(),t.end(),x);
        tb = *itr;
        --itr;
        ta = *itr;


        ans = min({ans,x - min(sa,ta),max(sb,tb)-x});
        ans = min({ans,tb - sa + min(x - sa,tb - x),sb - ta + min(x - ta,sb - x)});

        cout << ans<< endl;
    }
}




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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll INF = 1e18;
    
    ll v,e,r;
    cin >> v >> e >> r;

    vector<ll> s(e);
    vector<ll> t(e);
    vector<ll> d(e);
    for(i = 0;i < e;++i){
        cin >> s.at(i) >> t.at(i) >> d.at(i);
    }
    
    vector<ll> vdist(v,INF);
    ll top = r;
    vdist.at(top) = 0;
    rep(j, v){
        bool update = false;
        for(i = 0;i < e;++i){
            if(vdist.at(s.at(i)) != INF && vdist.at(t.at(i)) > vdist.at(s.at(i)) + d.at(i)){
                vdist.at(t.at(i)) = vdist.at(s.at(i)) + d.at(i);
                update = true;
            }
        }
        if(!update) break;
        else if(j == v-1){
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }
    

    for(i = 0;i < v;++i){
        if(vdist.at(i) >= 1e14) cout << "INF" << endl;
        else cout << vdist.at(i) << endl;
    }

    return 0;
}


Measured memory_bytes: 3128
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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 INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
 int a,b;
  cin>>a>>b;
  vector<int> c(a);
  rep(i,a)
    cin>>c[i];
  sort(all(c));
  int d=0;
  rep(i,b)
    d+=c[i];
  out(d);
}


Measured memory_bytes: 3812