akhauriyash/Code-Regression huggingface dataset:
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#include<queue>
#define int long long
#define INF 1000000000000000000
using namespace std;
int ans=1,a,n;
bool boom;
int mul(int A,int B)
{
	int tmp=0;
	while(B)
	{
		if(A>INF||tmp>INF)
		{
			return boom=true;
		}
		if(B&1)
		{
			tmp+=A;
		}
		B>>=1;
		A<<=1;
	}
	if(tmp>INF)
	{
		return boom=true;
	}
	return tmp;
}
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>a;
		ans=mul(ans,a);
	}
	if(boom&&ans!=0)
	{
		cout<<"-1"<<endl;
	}
	else
	{
		cout<<ans<<endl;
	}
	return 0;
}


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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int N,K,R,S,P,ans=0;
    string str;
    cin >> N >> K >> R >> S >> P >> str;
    map<char, int> mp;
    mp['r']=P;
    mp['s']=R;
    mp['p']=S;

    REP(i,0,K){
        int idx=i;
        char memo='a'; //仮の記号
        while(1){
            if(idx>=N) break;
            if(str[idx]!=memo){
                ans+=mp[str[idx]];
                memo=str[idx];
            }else{
                memo='a';
            }
            idx+=K;
        }
    }
    P(ans);
}

Measured memory_bytes: 512
n = int(input())
nl = []
for i in range(1,int(n**0.5)+1):
  if n % i == 0:
    nl.append((i,n//i))
    nl.append((n//i,i))
m = 10**20
for i in nl:
  m = min(m,i[0]+i[1]-2)
print(m)

Measured memory_bytes: 40556
function main(input) {
  const formatted_input = input.split('\n');
 
  const N = formatted_input[0];
  const S = formatted_input[1];
  const K = formatted_input[2];

  var target = S.split('')[K-1]
 
  var result = [];
  for(var i=0; i<N ;i++ ){
    var current = S[i];
    if(current==target){
      result.push(current);
    }else{
      result.push('*');
    }
  }
  console.log(result.join(''));
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 21956
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define FOR0(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define FOR(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define FORD(i,l,r) for(int i=(r), _##i=(l); --i>=_##i; )
#define repi(i,a) for(__typeof((a).begin()) i=(a).begin(), _##i=(a).end(); i!=_##i; ++i)
#define dwni(i,a) for(__typeof((a).rbegin()) i=(a).rbegin(), _##i=(a).rend(); i!=_##i; ++i)
#define SZ(a) ((int)((a).size()))
#define printCase() "Case #" << caseNum << ": "
#define pb push_back
#define mp make_pair
#define INF ((int)1e9)
#define SYNC std::ios::sync_with_stdio(false);  cin.tie(NULL);
#define ff first
#define ss second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,ii> iii;
#define N 100005
int n,p[N];
ii  x[N], y[N];
int findSet(int u) {
    return p[u] == u ? u : p[u] = findSet(p[u]);
}
bool sameSet(int u, int v) {
    return findSet(u) == findSet(v);
}
void unite(int u, int v) {
    if(((int)rand()) &1) swap(u, v);
    p[findSet(u)] = findSet(v);
}
int main() {
    SYNC
    cin >> n;
    FOR0(i, n) {
        cin >> x[i].ff >> y[i].ff;
        x[i].ss = y[i].ss = p[i] = i;
    }
    priority_queue<iii> pq;
    sort(x, x + n);
    sort(y, y + n);
    FOR0(i, n-1) {
        pq.push(mp(x[i].ff - x[i+1].ff, mp(x[i].ss, x[i+1].ss)));
    }
    FOR0(i, n-1) {
        pq.push(mp(y[i].ff - y[i+1].ff, mp(y[i].ss, y[i+1].ss)));
    }
    ll ans = 0;
    while(!pq.empty()) {
        int curw = pq.top().ff, u = pq.top().ss.ff, v = pq.top().ss.ss; pq.pop();
        if(sameSet(u, v)) continue;
        unite(u, v);
        ans += curw;
    }
    cout << -ans;
}

Measured memory_bytes: 6900
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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 main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    for(ll h = 1; h <= 3500; ++h){
        for(ll n = 1; n <= 3500; ++n){
            ll div = 4*h*n - N*n - N*h;
            if(div <= 0) continue;
            ll x = N*h*n;
            if(x%div == 0){
                ll w = x / div;
                cout << h << " " << n << " " << w << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3616
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <string>
#include <unordered_map>
#include <iomanip>
#include <deque>
using namespace std;
//#define int long long
int ans[200][200];
signed main() {
#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	int n, m;
	cin >> n >> m;
	vector <int> v(26);
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j) {
			char c;
			cin >> c;
			v[c - 'a']++;
		}
	}
	sort(v.begin(), v.end());
	/*if (n == 1 || m == 1) {
		int p = max(n, m) % 2;
		int cnt = 0;
		for (auto it : v) {
			if (it % 2) {
				cnt++;
			}
		}
		if (cnt == p) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
		return 0;
	}*/
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j) {
			if (!ans[i][j]) {
				set <pair <int, int> > sss;
				sss.insert(make_pair(i, j));
				sss.insert(make_pair(n - i + 1, j));
				sss.insert(make_pair(i, m - j + 1));
				sss.insert(make_pair(n - i + 1, m - j + 1));
				int cnt = sss.size();
				for (int k = 0; k < 26; ++k) {
					if (v[k] >= cnt) {
						v[k] -= cnt;
						sort(v.begin(), v.end());
						for (auto it : sss) {
							ans[it.first][it.second] = 1;
						}
						goto ll;
					}
				}
				return 0 * printf("No");
			ll:;
			}
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 384
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

#define INF (1<<29)

using namespace std;


int main(void){
    int n,m,_r;

    cin >> n >> m >> _r;

    vector<int> r(_r);
    for(int i=0;i<_r;i++){
        cin >> r[i];
    }

    int a[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            a[i][j] = INF;
        }
    }
    for(int i=0;i<m;i++){
        int _a,_b,_c;
        cin >> _a >> _b >> _c;
        a[_a-1][_b-1] = _c;
        a[_b-1][_a-1] = _c;
    }

    for(int k=0;k<n;k++){
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                a[i][j] = min(a[i][j], a[i][k]+a[k][j]);
            }
        }
    }
    sort(r.begin(), r.end());
    int ans = INF;
    do{
        int tmp = 0;
        for(int i=1;i<r.size();i++){
            tmp += a[r[i-1]-1][r[i]-1];
        }
        ans = min(ans, tmp);
    }while(next_permutation(r.begin(), r.end()));
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 384
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

distance_list =[(b-a),(c-a),(d-a),(e-a),(c-b),(d-b),(e-b),(d-c),(e-c),(e-d)]

if max(distance_list) > k:
    print(':(')
else:
    print('Yay!')


Measured memory_bytes: 3064
import math
a,b,h,m=map(int,input().split())
tyok=h*30+m*0.5
tank=m*6

sa=max(tyok,tank)-min(tank,tyok)
if sa>180:
  sa=sa-360
c=a**2+b**2-2*a*b*math.cos(math.radians(sa))
print(math.sqrt(c))

Measured memory_bytes: 9536
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Scanner;
import java.lang.*;
import java.io.*;
import java.util.*;
import java.lang.Integer;
import java.util.HashMap;

class Main
{
    // driver function to test the above functions
    public static void main(String args[]) throws IOException
    {
        Reader.init(System.in);
        String s = Reader.next();
        char[] arr = s.toCharArray();
        int ans_b=0;
        for (int i=0; i<3; i++){
            char val= arr[i];
            if (val=='B'){
                ans_b++;
            }
        }

        if (ans_b==1 || ans_b==2){
            System.out.println("Yes");
        }

        else{
            System.out.println("No");
        }

    }

}

class solu{

}

/** Class for buffered reading int and double values */
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

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

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

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;
using tll = tuple<ll, ll, ll>;
using pqueue = priority_queue<ll, vector<ll>, greater<ll>>;
template <class T, size_t N1, size_t N2> using array2 = array<array<T, N2>, N1>;
template <class T, size_t N1, size_t N2, size_t N3> using array3 = array<array<array<T, N3>, N2>, N1>;
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,(n)-1,0)
#define FOR(i,a,b) for(int i=(a),i##Len_=(b);i<i##Len_;i++)
#define RFOR(i,a,b) for(int i=(a),i##End_=(b);i>=i##End_;i--)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((ll)x.size())
#define SORT_PAIR_SECOND(x) sort(ALL(x),[](auto& a,auto& b){return a.second<b.second;})
#define SORT_TUPLE_1(x) sort(ALL(x),[](auto& a,auto& b){return get<1>(a)<get<1>(b);})
template <class T> void chmax(T& a, const T& b) { if (b > a) a = b; }
template <class T> void chmin(T& a, const T& b) { if (b < a) a = b; }
const char* LF = "\n";
// ----------------------------------------------------------------
#define DUMP(x) {cout<<#x<<": "<<x<<"\n";}
#define DECLARE_DUMP_CONTAINER(V) template<class T>ostream&operator<<(ostream& o,V<T>&v){cout<<"{ ";for(auto&i:v)cout<<i<<" ";cout<<"}";return o;}
DECLARE_DUMP_CONTAINER(vector);
DECLARE_DUMP_CONTAINER(deque);

template<class T, size_t N> ostream& operator << (ostream& os, array<T, N>& v) {
    cout << "{ "; for (auto& i : v) cout << i << " " ; cout << "}";
    return os;
}

template <class T, class U> ostream& operator << (ostream& os, pair<T, U>& p) {
    cout << "(" << p.first << " " << p.second << ")";
    return os;
}

template <class T, class U, class V> ostream& operator << (ostream& os, tuple<T, U, V>& t) {
    cout << "(" << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << ")";
    return os;
}
// ----------------------------------------------------------------

namespace{struct _{_(){
    cin.tie(0);
    ios::sync_with_stdio(false);
}}a;}

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

signed main() {
    int N, M, Q;
    cin >> N >> M >> Q;

    //array2<ll, N+1, N+1> S = {0};
    vector<vector<ll>> S(N+1, vector<ll>(N+1, 0));
    vector<vector<ll>> T(N+1, vector<ll>(N+1, 0));

    REP(i, M) {
        int l, r;
        cin >> l >> r;
        S[l][r]++;
    }

    REP(i, N+1) {
        ll sum = 0LL;
        REP(j, N+1) {
            sum += S[i][j];
            T[i][j] = sum;
        }
    }

    REP(i, Q) {
        int l, r;
        cin >> l >> r;

        ll ans = 0LL;
        FOR(j, l, r+1) {
            ans += T[j][r] - T[j][l-1];
        }
        cout << ans << LF;
    }


    return 0;
}


Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pii pair<int,int>
const int mod = 1e9 + 7;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll x, y;
    cin >> x >> y;
    if (abs(x - y) < 2) {
        cout << "Brown\n";
    }
    else {
        cout << "Alice\n";
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <stack>
#include <climits>
#include <utility>
#include <cmath>
#include <iostream>

using namespace std;

#define rep(i,n,m) for(int i=n; i<=m; i++)
#define per(i,n,m) for(int i=n; i>=m; i--)
#define printi(x) printf("%d ", x)
#define printiln(x) printf("%d\n", x)
#define printiarray(a,n) for(int i=0; i<n-1; i++){printf("%d ", a[i]);} printf("%d\n", a[n-1])
#define copyiarray(a,n,b) for(int i=0; i<n; i++){b[i] = a[i];}
#define scani(x) scanf("%d", &x)
#define scaniarray(a,n) for(int i=0; i<n; i++){scanf("%d", &a[i]);}
#define scans(str) scanf("%s",str)
#define scanc(ch) scanf("%c", &ch)
#define mk make_pair
#define printd(x) printf("%lf ", x)
#define printdln(x) printf("%lf\n", x)
#define printllln(x) printf("%lld\n", x)

typedef long long ll;

const int MaxN = 200000;
int L[MaxN/2 + 2], R[MaxN/2 + 2];

ll merge(int *A, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    ll count = 0;
    rep(i,0,n1-1) {
        L[i] = A[left+i];
    }
    rep(i,0,n2-1) {
        R[i] = A[mid + i];

    }
    L[n1] = R[n2] = INT_MAX;
    int i = 0;
    int j = 0;
    rep(k,left,right-1) {
        if(L[i] <= R[j]) {
            A[k] = L[i];
            i++;
        }
        else {
            A[k] = R[j];
            j++;
            count += n1-i;

        }
    }
    return count;
}


ll mergesort(int *A, int left, int right) {
    if(left+1 < right){
        int mid = (left + right)/2;
        ll c1, c2, c3;
        c1 = mergesort(A, left, mid);
        c2 = mergesort(A, mid, right);
        c3 = merge(A, left, mid, right);
        return c1+c2+c3;
    } else {
        return 0;
    }
}

int main() {
    int n, B[MaxN];
    scani(n);
    scaniarray(B,n);
    // int count = 0;
    // count = bubbleSort(a,n);
    // printiln(count);
    ll count = mergesort(B,0,n);
    printllln(count);

    return 0;
}



Measured memory_bytes: 4784
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin >> N;
  if ( (N[1]==N[2])  && ( N[0]==N[1] || (N[2]==N[3]))){cout << "Yes"<< endl;}
  else {cout << "No" << endl;}
}

Measured memory_bytes: 256
#!/usr/bin/perl -w
chomp($n=<>);
chomp($hoge=<>);
@h=split(/ /,$hoge);
$cnt=0;
for($l=0;$l<$n;){
    if($h[$l]>0){
        for($i=$l;$i<$n && $h[$i]>0;$i++){
            $h[$i]--;
        }
        $cnt++;
    }else{
        $l++;
    }
}
print $cnt;

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

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

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
	int n; cin >> n;
	int y; cin >> y;
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= n - i; ++j) {
			for (int k = 0; k <= n - i - j; ++k) {
				int sum = (i * 10000) + (5000 * j) + (1000 * k);
				if (sum == y && ((i + j + k == n))) {
					cout << i << " " << j << " " << k << endl;
					return;
				}
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
    return;
}

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



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();

        System.out.println(solve(A, B, C));
    }

    private static String solve(int A, int B, int C) {
        return C + " " + A + " " + B;
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <queue>

using namespace std;

int main(){
	priority_queue<int> pq;
	string ope;
	int num;
	cin >> ope;
	while (ope != "end"){
		if (ope == "extract"){
			cout << pq.top() << endl;
			pq.pop();
		}else if (ope == "insert"){
			cin >> num;
			pq.push(num);
		}
		cin >> ope;
	}
	return 0;
}

Measured memory_bytes: 5452
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

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

    vector<int> W_i;

    for (int i { 0 }; i < N; ++i) {
        int tmp;
        cin >> tmp;
        W_i.push_back(tmp);
    }


    int result { INT_MAX };
    // どこで分割するかのループ
    for (int i { 1 }; i < N; ++i) {
        vector<int> S1 = vector<int>(W_i.begin(), W_i.begin() + i);
        vector<int> S2 = vector<int>(W_i.begin() + i, W_i.end());

        int S1_sum = accumulate(S1.begin(), S1.end(), 0);
        int S2_sum = accumulate(S2.begin(), S2.end(), 0);

        result = min({ result, abs(S1_sum - S2_sum)});
    }

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using Graph = vector<vector<ll>>;

class mint {
public:
    long long x;
    constexpr mint(long long x=0) : x((x%mod+mod)%mod) {}
    constexpr mint operator-() const { 
      return mint(-x);
    }
    constexpr mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator*=(const mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    constexpr mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    constexpr mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    constexpr mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    constexpr mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    constexpr mint inv() const {
        return pow(mod-2);
    }
    constexpr mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    constexpr mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
};
ostream& operator<<(ostream& os, const mint& m){
    os << m.x;
    return os;
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll n;
  cin >> n;
  vector<ll> a(1010, 1);
  rep(i,n) {
    ll t = i+1;
    auto v = prime_factorize(t);
    rep(i,v.size()) {
      a[v[i].first] += v[i].second;
    }
  }
  mint ans = 1;
  rep(i,1010) {
    ans *= a[i];
  }
  cout << ans << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

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

#define N 100000
#define MAX 100000 

int partition(int *, int, int);

int A[MAX];


int main()
{

  int i, n, a, j;

  scanf("%d", &n);
 
  for(i=0; i<n; i++){
    scanf("%d", &A[i]);
  }

  a = partition(A, 0, n-1);

  for(j=0; j<n; j++){
    if(j == a) printf("[%d] ", A[a]);
    else if(j == n-1) printf("%d\n", A[j]);
    else printf("%d ", A[j]);

   }  

  return 0;

}

int partition(int *A, int p, int r)
{

  int i, x, j, tmp1, tmp2;

  x = A[r];
  i = p - 1;

  for(j=p; j<=(r-1); j++){
    if(A[j] <= x){
      i = i + 1;
      tmp1 = A[i];
      A[i] = A[j];
      A[j] = tmp1;
    }
  }

    tmp2 = A[i+1];
    A[i+1] = A[r];
    A[r] = tmp2;

    return i+1;

}

Measured memory_bytes: 988
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll a[4];
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	ll ans=-INF;
	FOR(i,0,2){
		FOR(j,2,4){
			ans = max(ans, a[i] * a[j]);
		}
	}

	cout << ans << endl;

	return 0;
}



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

int main()
{
	int N;
	cin >> N;
	typedef pair<long long, long long> P;
	vector<P> p( N );
	for( int i = 0; i < N; i++ ) {
		long long X, L;
		cin >> X >> L;
		p[i] = P( X + L, X - L );
	}

	sort( p.begin(), p.end() );
	int ans = 0;
	long long nr = -1000000000;
	for( int i = 0; i < N; i++ ) {
		long long l, r;
		tie( r, l ) = p[i];
		if( l >= nr ) {
			nr = r;
			ans++;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 4836
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn solve_single(use_set: &BTreeSet<usize>, pow2: &Vec<u64>) -> Vec<Vec<u64>> {
    let max_idx = 51usize;
    let mut dp = vec![vec![std::u64::MAX; max_idx]; max_idx];
    for i in 0..max_idx {
        dp[i][i] = 0;
    }
    for i in 0..max_idx {
        for j in 0..i {
            for &k in use_set.iter() {
                if dp[i % k][j] != std::u64::MAX {
                    let new = dp[i % k][j] + pow2[k];
                    if new < dp[i][j] {
                        dp[i][j] = new;
                    }
                }
            }
        }
    }
    dp
}

fn is_ok(a: &Vec<usize>, b: &Vec<usize>, use_set: &BTreeSet<usize>, pow2: &Vec<u64>) -> bool {
    let dp = solve_single(use_set, pow2);
    (0..a.len()).all(|i| dp[a[i]][b[i]] != std::u64::MAX)
}

fn main() {
    let n = read::<usize>();
    let a = read_vec::<usize>();
    let b = read_vec::<usize>();
    let mut pow2 = vec![0u64; 51];
    pow2[0] = 1;
    for i in 1..51 {
        pow2[i] = pow2[i - 1] * 2;
    }

    let mut use_set = (1..51).collect::<BTreeSet<_>>();
    if !is_ok(&a, &b, &use_set, &pow2) {
        println!("-1");
        return;
    }
    for i in (1..51).rev() {
        use_set.remove(&i);
        if !is_ok(&a, &b, &use_set, &pow2) {
            use_set.insert(i);
        }
    }
    let ans = use_set.into_iter().map(|x| pow2[x]).sum::<u64>();
    println!("{:?}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
import itertools
n, m = map(int, input().split())
s = [list(map(int, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))

ans = 0
for item in itertools.product([0, 1], repeat=n):
    for i in range(m):
        if sum([item[j-1] for j in s[i]]) % 2 != p[i]:
            break
    else:
        ans += 1
print(ans)


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


struct mint {
    long long x;
    static const int MOD = 1000000007;
    mint(long long x=0): x(x%MOD) {}

    void operator=(const long long n) {
        x = n % MOD;
    }
    mint operator+(const mint n) {
        mint ret;
        ret.x = (x + n.x) % MOD;
        return ret;
    }
    mint operator-(const mint n) {
        mint ret;
        ret.x = (x - n.x + MOD) % MOD;
        return ret;
    }
    mint operator*(const mint n) {
        mint ret;
        ret.x = (x * n.x) % MOD;
        return ret;
    }
    mint operator/(const mint n) {
        mint ret;
        ret.x = (x * n.inv().x) % MOD;
        return ret;
    }

    mint inv() const {
        mint ret;
        long long a = x, b = MOD, u = 1, v = 0;
        while(b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        ret.x = u;
        return ret;
    }
};

mint mpow(mint a, int n) {
    mint ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * a;
        a = a * a;
        n >>= 1;
    }
    return ret;
}

void factorial(vector<mint>& fact) {
    for (int i = 0; i < fact.size(); i++) {
        if (i == 0 || i == 1) fact[i] = 1;
        else fact[i] = fact[i-1] * i;
    }
}

mint c(int n, int a, vector<mint>& fact) {
    return fact[n]/(fact[a]*fact[n-a]);
}

void p(int n, int max_a, vector<mint>& perm) {
    for (int i = 0; i <= max_a; i++) {
        if (i == 0) perm[i] = 1;
        else perm[i] = perm[i-1] * (n-i+1);
    }
}

ostream& operator<<(ostream& os, const mint& n)
{
    os << n.x;
    return os;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);


    int n;
    cin >> n;
    if (n % 2 == 0) cout << n/2 << endl;
    else cout << n/2 + 1 << endl;


    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int calc(int* a, int tmp, int n) {
	int cnt = 0;
	for (int i = 0; i < n; i++)
	{
		cnt += (tmp - a[i])*(tmp - a[i]);
	}
	return cnt;
}

void solve3() {
	int a[101];
	int n;
	cin >> n;
	int tmp = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		tmp += a[i];
	}
	tmp = tmp / n;
	int ans = calc(a, tmp, n);
	ans = min(ans, calc(a, tmp+1, n) );
	//cout << tmp << endl;
	cout << ans << endl;
}



void solve2() {
	string input;
	string ans = "";
	cin >> input;
	for (int i = 0; i < input.size(); i++)
	{
		if (input[i] == '1')
			ans += "1";
		if (input[i] == '0')
			ans += "0";
		if (input[i] == 'B')
			ans = ans.substr(0, ans.size() - 1);
	}
	
	cout << ans << endl;
}

void solve1() {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		ans += i;
	}
	cout << ans << endl;
}


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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int q, k;
    cin >> q;
    rep(i, q) {
        cin >> k;
        cout << lower_bound(all(a), k) - a.begin() << "\n";
    }
}


Measured memory_bytes: 3324
#include <iostream>
#include <string>

using namespace std;

typedef long long ll;

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

    ll easts[n+1];
    easts[0] = 0;
    for(int i=1;i<=n;++i){
        easts[i] = ((s[i-1] == 'E') ?1:0);
        easts[i] += easts[i-1];
    }

    ll ans = (1LL << 30);
    for(ll i=1;i<=n;++i){
        ans = min(ans, (i-1-easts[i-1]) + (easts[n]-easts[i]));
    }

    cout << ans << endl;
}

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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin >> s;
	bool c[26] = {};
	for (auto&& si : s) c[si-'a'] = true;
	int i = 0;
	while (i < 26 && c[i] == true) i++;
	if (i == 26) cout << "None";
	else cout << (char)(i+'a');
	cout << endl;
	return 0;
}


Measured memory_bytes: 512
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
n,k=map(int,input().split())
A=list(map(int,input().split()))
l=40

def bit_cnt(X,d):
    c=0
    d=l-d
    for x in X:
        if x&(1<<d):
            c+=1
    return c

DP=[[0]*2 for _ in range(l+1)]
for i in range(1,l+1):
    if DP[i-1][1]:
        DP[i][1]=1
    cnt=bit_cnt(A,i)
    if cnt>=n-cnt:
        DP[i][0]=DP[i-1][0]+cnt*(1<<(l-i))
        if (k>>(l-i))&1:
            DP[i][1]=1
    else:
        if DP[i][1]:
            DP[i][0]=DP[i-1][0]+(n-cnt)*(1<<(l-i))
        else:
            if (k>>(l-i))&1:
                DP[i][0]=DP[i-1][0]+(n-cnt)*(1<<(l-i))
            else:
                DP[i][0]=DP[i-1][0]+cnt*(1<<(l-i))
print(DP[-1][0])

Measured memory_bytes: 14816
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

const ll INF = 2e9;

ll dist[105][105];

void warchall_floyd(int N){
    rep(k,N)rep(i,N){
        if(dist[i][k] == INF) continue;
        rep(j,N){
            if(dist[k][j] == INF) continue;
	        chmin(dist[i][j], dist[i][k]+dist[k][j]);
        }
    }
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	rep(i,n){
		rep(j,n) dist[i][j] = INF;
		dist[i][i] = 0;
	}
	vector<int> a(m), b(m), c(m);
	rep(i,m){
		cin >> a[i] >> b[i] >> c[i];
		--a[i]; --b[i];
		dist[a[i]][b[i]] = c[i];
		dist[b[i]][a[i]] = c[i];
	}
	warchall_floyd(n);
	int ans = 0;
	rep(i,m){
		if(dist[a[i]][b[i]] == c[i]) continue;
		if(dist[b[i]][a[i]] == c[i]) continue;
		++ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3732
// created_by  Rishi_Mohan

#include<bits/stdc++.h>

#define    ll           long long
#define    db1(x)       cout<<#x<<"="<<x<<'\n'
#define    db2(x,y)     cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define    db3(x,y,z)   cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define    rep(i,n)     for(int i=0;i<(n);++i)
#define    repA(i,a,n)  for(int i=a;i<=(n);++i)
#define    repD(i,a,n)  for(int i=a;i>=(n);--i)

using namespace std;

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

   vector<int>v(n);
   for(int i=0;i<n;i++)	cin >> v[i];
   
   vector<int>dp(n,0);
   
   dp[0]=0;
   dp[1]=abs(v[0]-v[1]);
   
   for(int i=2;i<n;i++)
   {
   	  dp[i] = min((dp[i-2]+abs(v[i]-v[i-2])) , (dp[i-1]+abs(v[i]-v[i-1])));
   }
   
   cout <<  dp[n-1] << endl; 
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}

Measured memory_bytes: 1024
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	int size = str.size();
	
	LL sum = 0;
	LL now = str[0]-'0';

	for(int i=1;i<size;++i){		
		LL nextSum = 0;
		LL nextNow = 0;
		LL val = str[i]-'0';
		
		LL mul = ((LL)1) << i;//2^i
		nextSum += 2*sum + now;
		nextNow += now*10 + val*mul;

		sum = nextSum;
		now = nextNow;
	}
	cout << sum + now << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String args[]) throws Exception {
		MyScanner sc = new MyScanner();
		PrintWriter pr = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		int ar[] = new int[n];
		long xor = 0;
		
		for(int i = 0; i < n; i++) {
			
			ar[i] = sc.nextInt();
			xor ^= ar[i];
		}
		//System.out.println(xor);
		
		for(int i = 0; i < n; i++)
			pr.print((xor ^ ar[i]) + " ");
		pr.close();
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


Measured memory_bytes: 58380
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	string s; cin >> s;
	ll n = s.size();
	rep(i,(n-1)/2){
		if(s[i]!=s[(n-1)/2-1-i]){
			puts("No");
			return 0;
		}
	}
	REP(i,(n+1)/2,n){
		if(s[i]!=s[n-i-1]){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,ans=0;

int main()
{	cin>>n;
	if(n&1)
		cout<<(n-1)*(n+1)/2-(n-1)/2<<endl;
	else
		cout<<n*n/2-n/2<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	vector<pair<ll, ll>> vp(n);
	for( auto &k : vp ){
		cin >> k.first >> k.second;
	}
	reverse( vp.begin(), vp.end() );
	ll plus = 0;
	ll ans = 0;
	for( auto &k : vp ){
		ll x = k.first + plus, y = k.second;
		if( !( x % y == 0 ) ){
			ans += ( y - x%y );
			plus += ( y - x%y );
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(int argc, char *argv[]) {
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int n=0;
    while(a>=b){
        b*=2;
        n++;
        if(k<n){
            cout << "No" << endl;
            return 0;
        }
    }
    while(b>=c){
        c*=2;
        n++;
        if(k<n){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(a) for(int i=0;i<a;i++)
#define nrep(a,b) for(int i=a;i<b;i++)
#define mrep(a) for(int i=a;i>=0;i--)
#define ll long long
using namespace std;

int main(){
	ll n; cin >> n;
	n *= 3;
	ll ans = 0;
	vector<ll> a(n);
	rep(n) cin >> a[i];
	sort(a.begin(), a.end());
	ll count = n - 2;
	rep(n){
		ans += a[count];
		if (i + 1 == count) break;
		count -= 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <cmath>
# include <functional>
# include <utility>
# define MOD 1000000000+7
# define INF 2000000000
#define rep(i,rept)	for(int i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
int main() {
	//new
	double x;
	cin >> x;
	cout << ceil(x / 2) / x << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    // AtCoder
    // template
    vector<ll> abc(3);
    cin >> abc[0] >> abc[1] >> abc[2];
    if(abc[0] % 2 == 0 || abc[1] % 2 == 0 || abc[2] % 2 == 0) {
        cout << 0 << endl;
        return 0;
    }
    sort(all(abc));

    cout << ((abc[2] - abc[2] / 2) - abc[2] / 2) * abc[0] * abc[1];
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <numeric>
 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll N;
map<ll,ll> a,b;
ll ans;


int main(){
    cin >> N;
    ll n = N/2;
    for(int i = 0;i<n;i++){
        ll p,q;
        cin >> p >> q;
        auto ite = a.find(p);
        if(ite == a.end()){
            a.insert(P(p,1));
        }else{
            ite->second += 1;
        }
        ite = b.find(q);
        if(ite == b.end()){
            b.insert(P(q,1));
        }else{
            ite->second += 1;
        }
    }
    P maxa = P(0,0);
    P maxb = P(0,0);
    ll seca = 0;
    ll secb = 0;
    for(auto ite = a.begin(); ite != a.end();++ite){
        if(ite->second >= maxa.second){
            seca =  maxa.second;
            
            maxa.first = ite->first;
            maxa.second = ite->second;
        }else{
            if(ite->second > seca){
                seca = ite->second;
            }
        }
    }
    for(auto ite = b.begin(); ite != b.end();++ite){
        if(ite->second >= maxb.second){
            secb= maxb.second;
            maxb.first = ite->first;
            maxb.second = ite->second;
        }else{
        if(ite->second > secb){
            secb = ite->second;
        }
        }
    }
    if(maxa.first == maxb.first){
        ans = max(maxa.second+secb,maxb.second+seca);
        cout << N - ans << endl;
    }else{
        cout << N - (maxa.second + maxb.second )<< endl;
    }

}




Measured memory_bytes: 6528
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

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

int main() {

	int w, h, c, i;

	cin >> w >> h >> c;

	i = gcd(w, h);

	cout << (w/i) * (h/i) * c << endl;	

	return 0;
}

Measured memory_bytes: 3104
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
using namespace std;

long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {

	long res;
	
	long R , G , B , N; cin >> R >> G >> B >> N;
	long r, g, b;
	for (int i = 0; i <= 3000; i++) {
		for (int j = 0; j <= 3000; j++) {
			r = i * R;
			g = j * G;
			b = N - r - g;
            
			if (b >= 0) if (b % B == 0) if (b / B <= 3000) res++;
	   }
	}

	cout << res << endl;
}

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


ull gcd(ull a,ull b){
	if(!b) return a;
	return gcd(b,a%b);
}


int main(){
	vector<char> vec_s;
	string s,akiba = "AKIHABARA";
	cin >> s;
	rep(i,0,s.size()){
		vec_s.push_back(s[i]);
	}
	rep(i,0,10){
		vec_s.push_back(' ');
	}
	
	
	if(vec_s[0] != 'A'){
		vec_s.insert(vec_s.begin(),'A');
	}
	
	if(vec_s[4] != 'A'){
		vec_s.insert(vec_s.begin()+4,'A');
	}
	
	if(vec_s[6] != 'A'){
		vec_s.insert(vec_s.begin()+6,'A');
	}
	
	if(vec_s[8] != 'A'){
		vec_s.insert(vec_s.begin()+8,'A');
	}
	
	rep(i,0,9){
		if(akiba[i] != vec_s[i]){
			cout << "NO" << endl;
			return 0;
		}
	}
	if(vec_s[9] != ' '){
		cout << "NO" << endl;
	}
	else{
		cout << "YES" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

if abs(A-B) > (V*T)-(W*T):
  print('NO')
  exit()

tt =T/2
if tt%2 != 0:
    tt += 0.5

tt = int(tt)

for i in range(1,tt):
  if tt*V+A < tt*W+B:
    break
  if V*i+A >= W*i+B:
    print('YES')
    exit()

for i in range(tt,T+1):
  if V*i+A >= W*i+B:
    print('YES')
    exit()




Measured memory_bytes: 62904
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

struct P {
  int start, end;
  string name;

  P(int s, int e, string n) : start(s), end(e), name(n) { }
};

bool operator < (P a, P b) {
  return a.start != b.start ? a.start < b.start : a.end < b.end;
}

int main() {
  for(int N, Q; cin >> N >> Q && N; ) {
    vector<P> ps;

    for(int i = 0; i < N; i++) {
      int west, japan;
      string name;

      cin >> name >> japan >> west;

      ps.push_back(P(west - japan + 1, west, name));
    }

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

    for(int i = 0; i < Q; i++) {
      int year;
      cin >> year;

      string answer = "Unknown";

      for(int j = 0; j < N; j++) {
        if(ps[j].start <= year && year <= ps[j].end) {
          answer = ps[j].name;
          year = year - ps[j].start + 1;
          break;
        }
      }

      if(answer == "Unknown") {
        cout << answer << endl;
      } else {
        cout << answer << " " << year << endl;
      }
    }
  }
}

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

int main() {
	string s;
	string tmp1, tmp2;
	int n;
	int h;
	while (cin >> s, s != "-") {
		cin >> n;
		while (n--) {
			cin >> h;
			//????????¨
			tmp1 = "";
			for (int i = 0; i < h; i++) {
				tmp1 += s[i];
			}
			//????????¨
			tmp2 = "";
			for (int i = h; i < s.size(); i++) {
				tmp2 += s[i];
			}
			s = tmp2 + tmp1;
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <cstdio>
#include <string.h>
#include <iostream>
using namespace std;
int main()
{
	char st[1001][101],te[101];
	int n,l,i,ii;
	cin>>n>>l;
	for(i=0;i<n;++i)
	cin>>st[i];
	for(i=0;i<n-1;++i)
	for(ii=0;ii<n-1-i;++ii)
		if(strcmp(st[ii],st[ii+1])>0)
		{
			strcpy(te,st[ii]);
			strcpy(st[ii],st[ii+1]);
			strcpy(st[ii+1],te);
		}
		for(i=0;i<n;++i)
		cout<<st[i];
		return 0;
}
		

Measured memory_bytes: 888