akhauriyash/Code-Regression huggingface dataset:
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll n = inl(), m = inl();
        ll max_l = -1;
        ll min_r = ll_inf;
        rep(i, m) {
            ll l = inl(), r = inl();
            l--, r--;
            max_l = max(max_l, l);
            min_r = min(min_r, r);
        }
        if (max_l > min_r) cout << 0 << endl;
        else cout << min_r - max_l + 1 << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 384
import math

N = int(input())

def digits(A):
    ans = 1
    while A >= 10:
        A //= 10
        ans += 1
    return ans

def F(A, B):
    return max(digits(A), digits(B))

ans = 11
for A in range(1, int(math.sqrt(N)) + 1):
    B = N // A
    if A * B == N:
        ans = min(ans, F(A, B))
print(ans)


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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

signed main()
{
    int n;
    int p[100];
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> p[i];

    int cnt = 0;
    for (int i = 0; i < n; i++)
        if (p[i] != i + 1)
            cnt++;

    if (cnt <= 2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using boost::multiprecision::cpp_int;
typedef unsigned long long ll;
const int INF = 1e9;

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

  cout << ((4 * a * b < (c - a - b) * (c - a - b) && c - a - b > 0) ? "Yes"
                                                                    : "No")
       << endl;
  return 0;
}


Measured memory_bytes: 256
from fractions import gcd

n = int(input())
num = list(map(int, input().split(' ')))

def find_max(idx):
    
    prev_gcd = gcd(num[idx[0]], num[idx[1]])
    curr_excluded_num = None

    for i in range(n):
        if i == idx[0] or i == idx[1]:
            continue
        
        curr_gcd = gcd(prev_gcd, num[i])
        if curr_gcd == prev_gcd:
            continue
        else:
            if curr_excluded_num is None:
                curr_excluded_num = num[i]
            else:
                if curr_gcd > gcd(prev_gcd, curr_excluded_num):
                    prev_gcd = curr_gcd
                else:
                    prev_gcd = gcd(prev_gcd, curr_excluded_num)
                    curr_excluded_num = num[i]

    
    return prev_gcd



if n == 2:
    print(max(num[0], num[1]))
elif n == 3:
    a = gcd(num[0], num[1])
    b = gcd(num[0], num[2])
    c = gcd(num[2], num[1])
    print(max(max(a, b), c))

else:
    ans = find_max((0, 1))
    ans = max(find_max((2, 3)), ans)
    print(ans)


Measured memory_bytes: 89432
is_Prime = [True] * (10**5 + 1)
is_Prime[0] = False
is_Prime[1] = False
for i in range(2, int((10**5+1)**0.5)+1):
    for j in range(2*i, 10**5+1, i):
        is_Prime[j] = False
P = [i for i in range(10**5+1) if is_Prime[i] and is_Prime[(i+1)//2]]
odd = [0 for i in range(10**5+2)]
odd[0] = 0
for i in range(1, len(odd)):
    odd[i] = odd[i-1]
    if i in P:
        odd[i] += 1
Q = int(input())
for q in range(Q):
    l, r = map(int, input().split())
    print(odd[r]-odd[l-1])

Measured memory_bytes: 80768
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	A
# CreatedDate:  2020-09-13 20:49:12 +0900
# LastModified: 2020-09-13 21:00:44 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    x = int(input())
    if x == 0:
        print(1)
    else:
        print(0)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9144
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int h, w;
  char c[200][200];
  
  scanf("%d%d", &h, &w);
  for(int i = 0; i < h; i++){
    scanf("%s", c[i]);
    printf("%s\n", c[i]);
    printf("%s\n", c[i]);
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v) cerr<<#v":[ ";for (auto macro_vi:v){cerr<<macro_vi<< " ";}cerr<<"]"<<endl;
#define ddump(v) cerr<<#v":"<<endl;for(auto macro_row:v) {cerr<<"["; for (auto macro__vi:macro_row){cerr<<macro__vi<< " ";}cerr<<"]"<<endl;}
#define damp(m) for(auto macro_pair:m){cerr<< macro_pair.first<<":"<<macro_pair.second<<endl;}
#define dpair(p) cerr << #p":"<<"(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(v) v.begin(), v.end()
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    int c = 0;
    rep(i,3){
        if(s[i]==t[i]){
            c++;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cmath>
typedef long long ll;
const int maxn = 1e5 + 5;
const ll mod = 1e9 + 7;

int main (int argc, char **argv) {
  ll n;
  std::cin >> n;
  ll m = sqrt(n);
  ll ans = n - 1;
  for (int i=2; i <= m; i++) {
    if (n%i==0) {
      ans = std::min(ans, (i-1) + (n/i-1));
    }
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 3196
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	n, m, x := nextInt(), nextInt(), nextInt()
	a := map[int]bool{}

	for i := 0; i < m; i++ {
		a[nextInt()] = true
	}

	l, r := 0, 0
	for i := x + 1; i < n+1; i++ {
		if a[i] {
			r++
		}
	}
	for i := 0; i < x+1; i++ {
		if a[i] {
			l++
		}
	}

	fmt.Println(min(l, r))
}


Measured memory_bytes: 640
//#pragma  GCC optimize("Ofast")

//#ifdef  DEBUG
//#define _GLIBCXX_DEBUG
//#endif

// -Ofast
// -O3
// -O2
// -fsanitize=address
// -fsanitize=undefined

// add_compile_options()

#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <stack>
#include <bitset>
#include <queue>
#include <algorithm>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
#include <unordered_map>
#include <cmath>
#include <cassert>
#include <random>

using namespace std;
//using namesparsace __gnu_pbds;

void solve();

signed main() {
    srand(time(0));
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    //freopen("input.txt", "r", stdin);
    //freopen("trench.out", "w", stdout);
    solve();
    return 0;
}

#define ld double
#define int long long

const int maxN = 410, maxK = 1e5 + 10, inf = 2e18 + 10, mod = 1e9 + 7;

int n, a[maxN], dp[maxN][maxN], pref[maxN];

int sum(int l, int r) {
    if (l == 0) return pref[r];
    return pref[r] - pref[l - 1];
}

void solve() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    pref[0] = a[0];
    for (int i = 1; i < n; i++) {
        pref[i] = pref[i - 1] + a[i];
    }
    for (int len = 1; len < n; len++) {
        for (int l = 0; l + len < n; l++) {
            int r = l + len;
            int e = inf;
            for (int c = l; c < r; c++) {

                e = min(e, dp[l][c] + dp[c + 1][r] + sum(l, r));
            }
            dp[l][r] = e;
        }
    }
    cout << dp[0][n - 1];
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, m;
  cin >> n >> m;
  
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a.at(i);
  }
  
  double allv=0;
  for(int j=0; j<n; j++){
    allv = allv + a.at(j);
  }
  
  int sum=0;
  for(int k=0; k<n; k++){
    if(a.at(k) >= allv/4/m){
      sum++;
    }
  }
  
  if(sum >= m){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
  
   
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

int main(void) {
    string s;
    cin >> s;
    int n = s.size();
    if (s[0] == s[n-1]) {
        if (n % 2 == 0) puts("First");
        else puts("Second");
    }
    else {
        if (n % 2 == 0) puts("Second");
        else puts("First");
    }
    return 0;
}


Measured memory_bytes: 640
N = int(input())
a_list = list(map(int, input().split()))
b_list = [0 for _ in range(N)]
ans_list = []
ballN = 0
for i in range(N, 0, -1):
    y = 2
    x = i * y
    while x <= N:
        ballN += b_list[x-1]
        y += 1
        x = i * y
    if ballN % 2 == a_list[i - 1]:
        ballN = 0
        continue
    else:
        b_list[i-1] = 1
        ans_list.append(i)
        ballN = 0



ans = map(str, ans_list)
ans = " ".join(ans)

M = sum(b_list)
print(M)
print(ans)

Measured memory_bytes: 19876
n = int(input())
x = list(map(int, input().split()))
ans = 10 ** 16
for i in range(min(x), max(x) + 1):
    total = 0
    for j in range(n):
        total += (x[j] - i) ** 2
    ans = min(ans, total)
print(ans)

Measured memory_bytes: 38640
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

t=0


judge=True

while judge:
    for a in A:
        if a%2!=0:
            judge=False
            break
    if judge:
        A = [i//2 for i in A]
        t+=1

print(t)


Measured memory_bytes: 3064
function Main(input) {
		const nums = input.split(" ");
		const A = parseInt(nums[0], 10);
		const P = parseInt(nums[1], 10);
		const pies = Math.floor((A * 3 + P) / 2);
		console.log(pies);

  	}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;//998244353;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template<class _T> static void getint(_T& a) {
	if (sizeof(_T) > sizeof(int)) {
		scanf("%lld", &a);
	}
	else {
		scanf("%d", &a);
	}
}
template <class _T> static _T tp_abs(_T a) {
	if (a < (_T)0) {
		a *= (_T)-1;
	}
	return a;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

class data {
public:
	int a, b, c, d;
};

static int dfs(std::vector<int> An, int M, int N, std::vector<data>& qi)
{
	int val = 0;
	if (An.size() == N) {
		int Q = qi.size();
		for (int q = 0; q < Q; q++) {
			if (An[qi[q].b] - An[qi[q].a] == qi[q].c) {
				val += qi[q].d;
			}
		}
	}
	else {
		int idx = An.size();
		int last = 1;
		if (idx) {
			last = *An.rbegin();
		}
		An.push_back(0);
		for (int num = last; num <= M; num++) {
			An[idx] = num;
			val = std::max(val, dfs(An, M, N, qi));
		}
	}
	return val;
}


static void exec()
{
	int N, M, Q;
	get(N, M, Q);

	std::vector<data> qi(Q);
	for (int i = 0; i < Q; i++) {
		get(qi[i].a, qi[i].b); qi[i].a--; qi[i].b--;
		get(qi[i].c, qi[i].d);
	}

	printf("%d\n", dfs(std::vector<int>(), M, N, qi));
}


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t w, h, x, y;
  std::cin >> w >> h >> x >> y;
  double ans = w * h;
  ans /= 2;
  std::cout << std::fixed << std::setprecision(10) << ans << " ";
  if (x * 2 == w && y * 2 == h) {
    std::cout << 1 << std::endl;
  } else {
    std::cout << 0 << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc067c()
}

fun abc067c() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map { it.toInt() }

    if (n == 2) return println(Math.abs(aList[0] - aList[1]))

    val cumulativeSum = LongArray(n)
    cumulativeSum[0] = aList.first().toLong()
    for (i in 1 until n) cumulativeSum[i] = cumulativeSum[i - 1] + aList[i]

    val allSum = cumulativeSum.last()

    val answer = cumulativeSum.drop(1).dropLast(1).map { Math.abs(allSum - it * 2) }.min()

    println(answer)
}


Measured memory_bytes: 80340
using System;
namespace Program_NTL_1_A {
	class Program {
		static void Main(string[] args) {
			int n = int.Parse(Console.ReadLine());
			Console.Write(n + ":");
			for(int i = 2; i * i <= n; i++) {
				while (n % i == 0) {
					Console.Write(" " + i);
					n /= i;
				}
			}
			if (n > 1) Console.Write(" " + n);
			Console.WriteLine();
		}
	}
}

Measured memory_bytes: 9224
/*
 * I won't be broken
 * I won't be tortured
 * I won't be beaten down
 * I have the answer
 * I can take the pressure
 * I will turn it all around
 * Lift me up above this
 * The flames and the ashes
 * Lift me up and help me to fly away
*/
#include <bits/stdc++.h>
using namespace std;
int n,h,a[100005],b[100005];
int main(){
        scanf("%d%d",&n,&h);
        for(int i = 0; i<n; i++)
                scanf("%d %d",&a[i],&b[i]);
        sort(a,a+n);
        sort(b,b+n);
        int i = n-1;
        int res = 0;
        while(b[i]>=a[n-1]&&i>=0&&h>0){
                h=h-b[i];
                i--;
                res++;
        }
        //printf("%d %d\n",res,h);
        if(h>0){
                res+=h/a[n-1]+(h%a[n-1]!=0);
        }
        printf("%d\n",res);

        return 0;
}



Measured memory_bytes: 1024
def resolve():
    '''
    code here
    '''
    N, C, K = [int(item) for item in input().split()]
    Ts = [int(input()) for _ in range(N)]
    Ts.sort()

    res = 0
    temp_psg = 0
    lim = Ts[0] + K

    for i in range(N):
        temp_psg += 1
        if Ts[i] > lim:
            res += 1
            temp_psg = 1
            lim = Ts[i] + K
        else:
            if temp_psg == C and i < N-1:
                res += 1
                temp_psg = 0
                lim = Ts[i+1] + K
        # print(Ts[i], temp_psg, res, lim)
    
    if temp_psg > 0:
        res += 1
    print(res)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 13376
def E(x):
  y = int(x)
  return (y + 1) / 2

N, K = map(int, input().split())
p = list(map(E, input().split()))
ps = [0, p[0]]
ans = 0

for i in range(1, len(p)):
  ps.append(ps[i] + p[i])

for i in range(K, N+1):
  ans = max(ans, ps[i] - ps[i-K])

print(ans)


Measured memory_bytes: 23524
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 3e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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;}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll h,w,m; cin >> h >> w >> m;
    vector<ll> H(h), W(w);
    map<Pll, ll> mp;
    rep(i,0,m){
        ll ht,wt; cin >> ht >> wt;
        ht--;wt--;
        H[ht]++;W[wt]++;
        mp[{ht, wt}]++;
    }

    ll hma = *max_element(all(H));
    ll wma = *max_element(all(W));
    vector<ll> hms, wms;
    rep(i,0,h){
        if(H[i] == hma)hms.emplace_back(i);
    }
    rep(i,0,w){
        if(W[i] == wma)wms.emplace_back(i);
    }

    ll hs = hms.size(), ws = wms.size();
    if(hs * ws > m){
        cout << hma + wma << "\n";
    }
    else{
        for(auto x : hms)for(auto y : wms){
            if(mp.count({x, y}))continue;
            cout << hma + wma << "\n";
            return 0;
        }
        cout << hma + wma - 1 <<"\n";
    }
    

}

Measured memory_bytes: 34992
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		String buf = " ";
		String buf2 = " ";
		int ans = 0;
		int a,b,c;
		int count = 10 + '0';
		boolean[] list = new boolean[1000];
		Arrays.fill(list,false);
		for(char i = '0';i < count;i++){
			if(S.indexOf(i) != -1){
				buf = S.substring(S.indexOf(i) + 1);
			}else{
				continue;
			}
			for(char j = '0';j < count;j++){
				if(buf.indexOf(j) != -1){
					buf2 = buf.substring(buf.indexOf(j) + 1);
				}else{
					continue;
				}
				for(char k = '0';k < count;k++){
					if(buf2.indexOf(k) != -1){
						a = i - '0';
						b = j - '0';
						c = k - '0';
						list[a * 100 + b * 10 + c] = true;
					}
				}
			}
		}
		for(int i = 0;i < 1000;i++){
			if(list[i]){
				ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 30164
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def triangle(n):
  i=1
  while i*(i+1)/2<=n:
    i+=1
  return i-1
  
import collections
prime_prod=collections.Counter(prime_factorize(int(input())))
print(sum([triangle(i) for i in list(prime_prod.values())]))

Measured memory_bytes: 9372
N = int(input())

s = input().split()
A = []
for i in range(N):
  A.append(int(s[i]))
  
result = 0
A.sort(reverse=True)
result += A[0]
A.pop(0)
if N % 2 == 0:
  result += sum(A[:(int(N/2)-1)])*2
else:
  result += (sum(A[:(int((N-1)/2)-1)])*2 + A[int((N-1)/2)-1])
    
print(result)

Measured memory_bytes: 32300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	if (n == 1) {
		printf("Hello World\n");
	} else {
		int a, b; cin >> a >> b;
		printf("%d\n", a + b);
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                while(sc.hasNext()){
                        String s = sc.nextLine();
                        int sum = 0;
                        int prev = 0;
                        for(int i = s.length()-1; i >= 0; i--){
                                int tmp = toInt(s.charAt(i));
                                if(prev > tmp){
                                        sum -= tmp;
                                }else{
                                        sum += tmp;
                                }   
                                prev = tmp;
                        }   
                        System.out.println(sum);
                }   
                sc.close();
        }   
        static int toInt(char c){
                if(c == 'I'){
                        return 1;
                }   
                if(c == 'V'){
                        return 5;
                }   
                if(c == 'X'){
                        return 10; 
                }   
                if(c == 'L'){
                        return 50; 
                }   
                if(c == 'C'){
                        return 100;
                }   
                if(c == 'D'){
                        return 500;
                }   
                if(c == 'M'){
                        return 1000;
                }   
                return 0;
        }   
}

Measured memory_bytes: 0
using System;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                char[] dlm = " ".ToCharArray();
                string[] str = Console.ReadLine().Split(dlm);

                int a = int.Parse(str[0]);
                int b = int.Parse(str[2]);
                string op = str[1];
                int r = 0;

                if (op == "+") r = a + b;
                else if (op == "-") r = a - b;
                else if (op == "*") r = a * b;
                else if (op == "/") r = a / b;
                else if (op == "?") break;

                Console.WriteLine(r);

            }


        }
    }
}


Measured memory_bytes: 15980
//b
#include <iostream>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <functional>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>

#define REP(i,b,n) for(int i=b;i<n;i++)
#define REPR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PB push_back
#define MP make_pair

using namespace std;

static const double PI = acos(-1.0);
static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> pii;	

int main(){
	
	int n;
	
	while(cin>>n, n>=0){
		
		string res = "";
		vector<int> b;
		
		while(n>0){
			b.push_back(n % 2);
			n /= 2;	
		}
		
		n = b.size();
		
		if(n%2){
			b.push_back(0);
			n++;
		}
		
		reverse(b.begin(), b.end());

		for(int i=0; i<n; i+=2){
			int d = b[i]*2+b[i+1];
			res += (char)('0'+d);
		}
		
		if(res=="")
			res = "0";
		
		cout << res << endl;
	}
	
	return 0;	
}

Measured memory_bytes: 1224
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<iomanip>
#include<unordered_map>
#define deg(x) cerr<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;typedef long long LL;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e9+7;
const int inf=1e9+7;
const double eps=1e-6;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return (r+m)%m;}
const double pi=acos(-1);

int main(){
	int x;cin>>x;
	if(x>=30)puts("Yes");
	else puts("No");
}


Measured memory_bytes: 3020
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll x, y, z;
    cin >> x >> y >> z;
    string ans = x + y >= z ? "Yes" : "No";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
h, w, k = map(int, input().split())
grid = [list(input()) for _ in range(h)]
cnt = 0

for rows in range(1 << h):
    for cols in range(1 << w):
        black = 0
        for i in range(h):
            if (rows >> i) & 1:
                continue
            for j in range(w):
                if (cols >> j) & 1:
                    continue
                if grid[i][j] == "#":
                    black += 1

        if black == k:
            cnt += 1

print(cnt)

Measured memory_bytes: 9204
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use proconio::{input, marker::*};
use superslice::*;
fn main() {
    input! {
        r: i64,
    }
    let r = r as f64;
    println!("{}", r * 2. * std::f64::consts::PI);
}


Measured memory_bytes: 2188
using System;
using System.Linq;
using System.Text;

public class AtCoder_154_B
{
    public static void Main()
    {
        //var exStdIn = new System.IO.StreamReader( "input.txt" );
        //System.Console.SetIn( exStdIn );

        char[] s = Console.ReadLine().ToCharArray();

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.Length; i++)
        {
            sb.Append("x");
        }

        Console.WriteLine(sb.ToString());
    }
}


Measured memory_bytes: 13140
#include <iostream>

int main(void) {
    int a, b;
    std::cin >> a >> b;
    if(a < b) {
        std::cout << "a < b" << std::endl;
    }else if(a > b){
        std::cout << "a > b" << std::endl;
    }else{
        std::cout << "a == b" << std::endl;
    }
    return 0;
}



Measured memory_bytes: 3096
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func solve(n int) int64 {
	if n == 0 {
		return 2
	} else if n == 1 {
		return 1
	}

	var p2, p1, ans int64
	p2 = 2
	p1 = 1
	for i := 2; i <= n; i++ {
		ans = p1 + p2
		p2 = p1
		p1 = ans
	}
	return ans
}

func main() {
	defer stdout.Flush()

	n := readInt()
	println(solve(n))
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAXSUM = 4e6;
bitset<MAXSUM + 2010> dp;

int main() {
	int N, sum = 0;
	scanf("%d", &N);
	dp[0] = 1;
	for (int i = 0; i < N; i++) {
		int A;
		scanf("%d", &A);
		sum += A;
		dp |= (dp << A);
	}
	debug("sum %d\n", sum);
	//debug("! %s\n", dp.to_string().c_str());
	for (int ans = (sum - 1) / 2 + 1; ; ans++) {
		if (dp[ans]) {
			printf("%d\n", ans);
			break;
		}
	}
	return 0;
}


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

using namespace std;
#define int long long int
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define vi vector <int>
#define sz(s) (int)s.size()
#define pii pair<int,int>
#define piii pair< int,pair<int,int> >
#define tiii tuple <int,int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define rall(v) v.rbegin(),v.rend()
#define endl '\n'
#define matrix vector <vector <int> >
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define NAYAN freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define N 101
#define mod 1000000007
#define mod2 998244353
#define inf 1e18

int a[N];
int K;

int dp[N][100001];


int32_t main()
{
    boost
    // #ifndef ONLINE_JUDGE 
    // NAYAN
    // #endif

    int n;
    
    cin >> n >> K;
    
    int i,j;

    for(i=1;i<=n;i++)
    {
        cin >> a[i];
    }

    for(i=0;i<=K;i++)
    {
        dp[0][i]=0;
    }

    for(i=0;i<=n;i++)
    {
        dp[i][0]=1;
    }

    dp[0][0]=1;

    for(i=1;i<=n;i++)
    {
        vector <int> pref(K+1,0);
        pref[0]=1;
        for(j=1;j<=K;j++)
        {
            pref[j]=(pref[j-1]+dp[i-1][j])%mod;
        }

        for(j=1;j<=K;j++)
        {
            int l;
            l=j-a[i]-1;
            dp[i][j]=pref[j];
            if(l>=0)
            {
                dp[i][j]=(dp[i][j]-pref[l]+mod)%mod;
            }
        }
    }

    // for(i=0;i<=n;i++)
    // {
    //     for(j=0;j<=K;j++)
    //     {
    //         cout << i << " " << j<< " " << dp[i][j] << endl;
    //     }
    // }

    cout << dp[n][K] << endl;
    
    
    
}

Measured memory_bytes: 79988
#!/usr/bin/ruby -Ku

require 'pp'

loop do
  n = gets.split(nil)[0].to_i
  
  break if n == 0

  player = Array.new
  hand = Array.new(4)
  
  player.push n
  hand[n] = 1
  4.times{
    n = gets.split(nil)[0].to_i
    player.push n
    hand[n] = 1
  }
  
  if !hand[1] && hand[2] && hand[3] then # 2win 3lose
    5.times{|i| player[i] -= 1}
  elsif hand[1] && !hand[2] && hand[3] then # 3win 1lose
    5.times{|i| player[i] = ((player[i]-1==0)?1:0) + 1}
  elsif hand[1] && hand[2] && !hand[3] then # 1win 2lose
  elsif
    5.times{|i|player[i] = 3}
  end

  player.each{|h| puts h};
end

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

l = [0] * 100
l[0] = 2
l[1] = 1

if n == 0 or n == 1:
    print(l[n])
if n>=2:
    for i in range(2, n+1):
        l[i] = l[i-1] + l[i-2]
    print(l[n])
    


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define push_back pb

const int mod = 1000000007;
const int inf = 1e9;

int main(){
    int N, K;
    cin >> N >> K;
    int dp[N+1], h[N+1];
    repn(i, 1, N){cin >> h[i];}
    dp[1] = 0;
    repn(i, 2, N){
        dp[i] = inf;
    }
    repn(i, 1, N){
        repn(j, 1, K){
            if(i - j < 1){continue;}
            int tmp_min = dp[i-j] + abs(h[i] - h[i-j]);
            dp[i] = min(dp[i], tmp_min);
        }
    }

    cout << dp[N];
}

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

#define ll long long
#define fi first
#define se second
#define mp make_pair

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;


int main(){
	
	fastio();
	double a,b,c;
	cin>>a>>b>>c;
	if(a/c <=b)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 3736
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
 
int main() {
    string s;
    cin >> s;
    pair <int,int> a;
    a.first = 0;
    a.second = 0;
    for(int i =0;i<s.size();i++) {
        if (s[i] == '0') {
            a.first++;
        } else {
            a.second++;
        }
    }
    int mi = min (a.first, a.second);
    cout << mi *2 << endl;

}

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

const int N = 200001;
using namespace std; 

int n,a[N]; 
bool b[N]; 

bool check(int x){ 
	for(int i=1;i<=(n<<1)-1;++i)
		b[i]=(a[i]<=x); 
	for(int i=0;i<n;++i){
		if(b[n-i]==b[n-i-1])
			return b[n-i];
		if(b[n+i]==b[n+i+1])
			return b[n+i];} 
	return b[1]; 
} 

int main(){ 
	scanf("%d",&n);
	for(int i=1;i<=(n<<1)-1;++i)
		scanf("%d",a+i); 
	int l=1,r=(n<<1)-1,m; 
	while(l<r)
		if(check(m=l+r>>1))
			r=m;
		else l=m+1; 
	printf("%d",l); 
}


Measured memory_bytes: 1280
//In the name of Allah
//In the name of the compassionate of the merciful
//Ya Ali!
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename Type>
using ordered_multiset = tree<Type, null_type, less_equal<Type>, rb_tree_tag, tree_order_statistics_node_update> ;

typedef long long ll ;
typedef long double ld ;

#define f first
#define s second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(x) x.begin() , x.end()
#define mp make_pair
#define pll pair<ll,ll>
#define pii pair<int,int>

//ifstream fin("input.txt");
//ofstream fout("output.txt");
// fflush(stdout);

const ll maxn = 310 ;
const ll INF = 1e18 ;

ll mod = 1e9 + 7 , p1 = 999999929 , p2 = 999999937 ;

ll n , k , dp[maxn][maxn][maxn] ;
string s1 ;

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

cin >> s1 >> k ;
n = s1.size() ;

for(int i = 0 ; i < n ; i ++)
  for(int j = 0 ; j <= k ; j ++)
    dp[i][i][j] = 1 ;

for(int r = 1 ; r < n ; r ++){
 for(int l = r-1 ; l >= 0 ; l --){
  for(int co = 0 ; co <= k ; co ++){
    dp[l][r][co] = max(dp[l][r][co] , dp[l+1][r][co]) ;
    dp[l][r][co] = max(dp[l][r][co] , dp[l][r-1][co]) ;
   if(r-l>1){
    if(s1[l] == s1[r])dp[l][r][co] = max(dp[l][r][co] , dp[l+1][r-1][co]+2) ;
    if(co > 0)dp[l][r][co] = max(dp[l][r][co] , dp[l+1][r-1][co-1]+2) ;
   }
   else{
    if(s1[l] == s1[r])dp[l][r][co] = 2 ;
    if(co>0)dp[l][r][co] = 2;
   }
  }
 }
}
cout << dp[0][n-1][k] ;
 return 0;
}


Measured memory_bytes: 225536
from itertools import product
h, w, k = map(int, input().split())
c = [input() for _ in range(h)]

res = 0
for use_h in product([0, 1], repeat=h):
    for use_w in product([0, 1], repeat=w):
        
        cnt = 0
        for i in range(h):
            for j in range(w):
                # if(use_h[i] == 1 or use_w[j] == 1): continue
                # if(c[i][j] == '.'): continue

                if(use_h[i] == 0 and use_w[j] == 0 and c[i][j] == '#'): cnt += 1
        
        if(cnt == k): res += 1

print(res)

Measured memory_bytes: 9148
#include<stdio.h>
#include<stdlib.h>
#define NUM 500000
#define NUM1 1000000000

int count=0;
void merge(int*,int,int,int);
void mergeSort(int*,int,int);
int main(){
  int n,i,left,right,a[NUM];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }

  left=0;
  right=n;
  
  mergeSort(a,left,right);
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i+1!=n){
      printf(" ");
    }
  }
  printf("\n%d\n",count);

  return 0;
}

void merge(int *a,int left,int mid,int right){
  int i,j,k,n1,n2;
  int *L;
  int *R;
  n1=mid-left;
  n2=right-mid;
  L=(int *)malloc((n1+1)*sizeof(int));
  R=(int *)malloc((n2+1)*sizeof(int));
  for(i=0;i<n1;i++){
    L[i]=a[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=a[mid+i];
  }
  L[n1]=NUM1;
  R[n2]=NUM1;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      a[k]=L[i];
      i++;
      count++;
    }else{
      a[k]=R[j];
      j++;
      count++;
    }
  }
  free(L);
  free(R);
}

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



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

int main(void) {
  std::string str1;
  int a, z = 0;
  std::cin >> str1;

  a = str1.find('A');
  z = str1.rfind('Z');
  std::cout << z - a + 1 << '\n';

return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

struct tick{
  ll x,y,c;
  tick(){}
  tick(ll x,ll y,ll c):x(x),y(y),c(c){}
  friend istream& operator>>(istream& is,tick& t){
    return is>>t.x>>t.y>>t.c;
  }
};

int main(){

  ll A,B,M;
  cin>>A>>B>>M;
  vector<ll> a(A),b(B);
  cin>>a>>b;
  vector<tick> m(M);
  cin>>m;

  ll ans = *min_element(a.begin(),a.end())+*min_element(b.begin(),b.end());
  for(tick& t:m){
    t.x--;t.y--;
    chmin(ans,a[t.x]+b[t.y]-t.c);
  }
  cout<<(ans)<<endl;
  

}

Measured memory_bytes: 4096
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;

int main()
{
    ll n;
    cin >> n;
    vector<ll> f(n+1, 0);
    for(int i = 1; i < n+1; i++){
        for(int j = i; j < n+1; j = j + i){
            f[j]++;
        }
    }
    ll ans = 0;
    for(int i = 1; i< n+1; i++){
        ans += i * f[i];
    }
    cout << ans << endl;
    return 0;
}

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

template<class T>
int InRange(T val, T min, T max)
{
  if(val >= min && val <= max){
    return 0;
  }
  
  if(val > max){
    return 1;
  }
  
  return -1;
}

int main()
{
  int h, w;
  cin >> h >> w;
  
  char temp;
  
  class direction
  {
    public:
    bool u = 0;
    bool d = 0;
    bool r = 0;
    bool l = 0;
  };
  vector<vector<direction>> mov(h, vector<direction>(w));
  vector<vector<int>> maze(h, vector<int>(w, 0));
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> temp;
      if(temp == '.'){
        maze.at(i).at(j) = 1;
        if(i > 0){
          mov.at(i - 1).at(j).d = 1;
        }
        if(i < h - 1){
          mov.at(i + 1).at(j).u = 1;
        }
        if(j > 0){
          mov.at(i).at(j - 1).r = 1;
        }
        if(j < w - 1){
          mov.at(i).at(j + 1).l = 1;
        }
      } 
    }
  }
  
  class coordinate
  {
    public:
    int i;
    int j;
  };
  coordinate tempc;
  queue<coordinate> q;

  int maxd = 0, ans = 0;

  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(maze.at(i).at(j)){
        vector<vector<int>> d(h, vector<int>(w, -1));
        d.at(i).at(j) = 0;
        tempc.i = i; tempc.j = j; maxd = 0;
        q.push(tempc);
        
        while(!q.empty()){
          coordinate cplace;
          cplace.i = q.front().i; cplace.j = q.front().j;
          
          if(mov.at(cplace.i).at(cplace.j).u){
            if(d.at(cplace.i - 1).at(cplace.j) == -1){
              tempc.i = cplace.i - 1; tempc.j = cplace.j;
              q.push(tempc);
              d.at(cplace.i - 1).at(cplace.j) = d.at(cplace.i).at(cplace.j) + 1;
              maxd = d.at(cplace.i).at(cplace.j) + 1;
            }
          }
          if(mov.at(cplace.i).at(cplace.j).d){
            if(d.at(cplace.i + 1).at(cplace.j) == -1){
              tempc.i = cplace.i + 1; tempc.j = cplace.j;
              q.push(tempc);
              d.at(cplace.i + 1).at(cplace.j) = d.at(cplace.i).at(cplace.j) + 1;
              maxd = d.at(cplace.i).at(cplace.j) + 1;
            }
          }
          if(mov.at(cplace.i).at(cplace.j).r){
            if(d.at(cplace.i).at(cplace.j + 1) == -1){
              tempc.i = cplace.i; tempc.j = cplace.j + 1;
              q.push(tempc);
              d.at(cplace.i).at(cplace.j + 1) = d.at(cplace.i).at(cplace.j) + 1;
              maxd = d.at(cplace.i).at(cplace.j) + 1;
            }
          }
          if(mov.at(cplace.i).at(cplace.j).l){
            if(d.at(cplace.i).at(cplace.j - 1) == -1){
              tempc.i = cplace.i; tempc.j = cplace.j - 1;
              q.push(tempc);
              d.at(cplace.i).at(cplace.j - 1) = d.at(cplace.i).at(cplace.j) + 1;
              maxd = d.at(cplace.i).at(cplace.j) + 1;
            }
          }
          
          q.pop();
        }
        if(maxd > ans)
          ans = maxd;
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256