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

vector<bool> x(1e6 + 1, true);
vector<vector<int>> y(1e6 + 1);

// エラトステネスの篩(nは1以上) O(nloglogn)
void sieve(int n) {
  x.at(0) = x.at(1) = false;
  for (int i = 2; i <= n; i++) {
    if (x.at(i)) {
      y[i].emplace_back(i);
      for (int j = 2 * i; j <= n; j += i) {
        x.at(j) = false;
        y[j].emplace_back(i);
      }
    }
  }
  // return x;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  
  sieve(1e6);
  
  bool pwise = true;
  vector<bool> used(1e6 + 1, false);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < y[a.at(i)].size(); j++) {
      if (used[y[a.at(i)][j]]) {
        pwise = false;
        break;
      }
      used[y[a.at(i)][j]] = true;
    }
    if (!pwise) break;
  }
  
  if (pwise) {
    cout << "pairwise coprime\n";
    return 0;
  }
  
  int keep = a.at(0);
  for (int i = 1; i < n; i++) keep = gcd(keep, a.at(i));
  
  if (keep == 1) {
    cout << "setwise coprime\n";
    return 0;
  }
  
  cout << "not coprime\n";
  return 0;
}

Measured memory_bytes: 62952
#include <bits/stdc++.h>
using namespace std;
 
bool a[100001];
int wa[100001];
 
int main(){
  int n,m;
  cin >> n >> m;
 
  int ac=0,pe=0;
  if(m==0){
    cout << ac << " " << pe << endl;
    return 0;
  }
  for(int i=0; i<m; i++){
    int p;
    string s;
    cin >> p >> s;
    if(a[p]) continue;
    if(s=="AC"){
      ac++;
      pe+=wa[p];
      a[p] = true;
    }else if(s=="WA"){
      wa[p]+=1;
    }
  }
  cout << ac << " " << pe << endl;
  return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

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; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

vector<bool> beki(1010);

int main() {
    int x;
    cin >> x;
    beki[1] = 1;
    for (int i = 2; i <= x; ++i) {
        int tmp = i*i;
        while(tmp <= x){
            beki[tmp] = 1;
            tmp *= i;
        }
    }

    for (int i = x; i >= 0; --i) {
        if(beki[i]){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(ll i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (ll i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<ll, ll>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const ll INF = 1E+18;


int main(){
    ll n;
    cin >> n;
    vector<pair<P, ll>> a(n);
    rep(i, n) cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(whole(a));
    vector<ll> ans(n+1, INF);
    ll all = 1;
    rep(i, n) {
        all *= 3;
    }
    vector<vector<ll>> distx(1LL<<n, vector<ll>(n));
    vector<vector<ll>> disty(1LL<<n, vector<ll>(n));


    rep(i, 1LL<<n) {
        rep(j, n) {
            distx[i][j] = abs(a[j].first.first);
            disty[i][j] = abs(a[j].first.second);
            rep(k, n) {
                if (i>>k&1) {
                    chmin(distx[i][j], abs(a[j].first.first-a[k].first.first));
                    chmin(disty[i][j], abs(a[j].first.second-a[k].first.second));
                }
            }
        }
    }
    rep(xi, all) {
        vector<ll> v(n);
        ll x = xi;
        ll lx = 0;
        ll ly = 0;
        ll num = 0;
        rep(i, n) {
            v[i] = x%3;
            x /= 3;
            if (v[i]==1) {
                num++;
                lx+=1LL<<i;
            }
            if (v[i]==2) {
                num++;
                ly+=1LL<<i;
            }   
        }
        ll sum = 0;
        rep(i, n) {
            ll res = min(distx[lx][i], disty[ly][i]);
            res *= a[i].second;
            sum += res;
        }
        chmin(ans[num], sum);
    }
    rep(i, n+1) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 12936
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn vec<T, F: FnMut(usize) -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|i| f(i)).collect()
}

const MODULO: usize = 998244353;

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let s: usize = scan(tokens);
    let a: Vec<usize> = vec(n, |_| scan(tokens));
    let mut count: Vec<usize> = vec![0; s];
    let mut ans: usize = 0;
    for i in 0..n {
        if a[i] > s {
            continue;
        }
        ans = (ans + count[s - a[i]] * (n - i)) % MODULO;
        for x in (a[i] + 1..s).rev() {
            count[x] = (count[x] + count[x - a[i]]) % MODULO;
        }
        if a[i] == s {
            ans = (ans + (i + 1) * (n - i)) % MODULO;
        } else {
            count[a[i]] = (count[a[i]] + i + 1) % MODULO;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef long double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define sortvec(a) sort(a.begin(), a.end())
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define cerr if(true)cerr
void print(){cout<<endl;}
template<typename T,typename... Args>
void print(T a, Args... args) {cout<<a<<" ";print(args...);}
lli llipowerp(lli x, lli y, lli p=LLONG_MAX)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli binarySearch(vector<int> arr, int l, int r, int x)
{
    if (r >= l)
    {
        lli mid = l + (r - l) / 2;
        if (arr[mid] == x)
            return mid;
        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);
        return binarySearch(arr, mid + 1, r, x);
    }
    return -1;
}
template <typename T>
inline void printvec(vector<T> inp){
    for(auto it:inp) cout<<it<<" ";
    cout << endl;
}
//---------------------------------------------------------------------------------
int n;
int a[25][25];
int dp[(lli)((lli)1<<21)+10];
lli get(lli pos){
    if(pos==0) return 1;
    if(dp[pos]!=-1) return dp[pos];


    dp[pos]=0;
    bitset<22> tmp(pos);
    bitset<22> ntmp;
    int k=tmp.count();
    fori(n){
        if(tmp[i]==1){
            if(a[i][k-1]){
                ntmp = tmp;
                ntmp[i] = 0;
                dp[pos] += get(ntmp.to_ullong());
                dp[pos]%=mod;
            }
            else{
                ;
            }

        }
    }
    return dp[pos];


}
int main(){
    cin>>n;
    fori(n){
        forj(n) cin>>a[i][j];
    }
    memset(dp,-1,sizeof(dp));
    //cout<<(lli)(1<<21)+10<<endl;
    cout<<get((lli)((lli)1<<n)-1)<<endl;
}


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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

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

    string str;
    cin >> str;
    int cnt = 0;

    rep(i, str.length()) {
        if (str[i] == 'o') {
            cnt++;
        }
    }
    // cout << cnt << endl;

    if (str.length() < 15) {
        cnt += (15 - str.length());
    }
    if (cnt >= 8) {
        cout << "YES" << endl;

    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use feature qw( say );

my $n   = <>;
my @a   = split / /, <>;
my $cnt = 1;

my $increasable = 1;
my $decreasable = 1;
my $before      = $a[0];
for (@a) {
    if ( not $increasable and $before < $_ ) {
        ++$cnt;
        $increasable = 1;
        $decreasable = 1;
    }
    elsif ( not $decreasable and $_ < $before ) {
        ++$cnt;
        $increasable = 1;
        $decreasable = 1;
    }
    elsif ( $before < $_ ) {
        $decreasable = 0;    # just increase
    }
    elsif ( $_ < $before ) {
        $increasable = 0;    # just decrease
    }
    $before = $_;
}

say $cnt;


Measured memory_bytes: 17516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 7;
const int A = 11;

vector<int> q[N];
int d[2][N];
int ans[N];
int a[N], c[N], u[N], v[N];

int main()
{
	ios::sync_with_stdio(false);

	int n, m, Q;
	cin >> n >> m;
	for (int i=0; i<m; i++)
	{
		cin >> u[i] >> v[i];
		u[i]--, v[i]--;
	}
	cin >> Q;
	for (int i=1; i<=Q; i++)
	{
		int d;
		cin >> a[i] >> d >> c[i];
		a[i]--;
		q[d].push_back(i);
	}
	for (int i=0; i<A; i++)
	{
		memset(d, 0, sizeof d);
		for (auto x : q[i])
			d[0][a[x]] = x;
		for (int j=0; j<i; j++)
		{
			for (int k=0; k<m; k++)
			{
				d[1][u[k]] = max(d[1][u[k]], max(d[0][v[k]], d[0][u[k]]));
				d[1][v[k]] = max(d[1][v[k]], max(d[0][v[k]], d[0][u[k]]));
			}
			for (int k=0; k<n; k++)
				d[0][k] = max(d[0][k], d[1][k]), d[1][k] = 0;
		}
		for (int j=0; j<n; j++)
			ans[j] = max(ans[j], d[0][j]);
	}
	for (int i=0; i<n; i++)
		cout << c[ans[i]] << "\n";
	return 0;
}

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


int dfs(int curr_node, vector<bool> visited, vector<vector<bool>>& edge) {
  if (all_of(visited.begin(), visited.end(), [](bool node){return node;})) return 1;
  int ret = 0;
  for (int next_node = 0; next_node < visited.size(); ++next_node) {
    if (!edge[curr_node][next_node]) continue;
    if (visited[next_node]) continue;
    visited[next_node] = true;
    ret += dfs(next_node, visited, edge);
    visited[next_node] = false;
  }
  return ret;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<bool>> edge(n, vector<bool>(n, false));
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    edge[a - 1][b - 1] = true;
    edge[b - 1][a - 1] = true;
  }
  vector<bool> visited(n, false);
  visited[0] = true;
  cout << dfs(0, visited, edge) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int n;
	int k;
	int h[100000];
	int count = 0;
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
		if (h[i] >= k) {
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}


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

string a, b;
int main(){
	cin >> a >> b;
	if(a == b)cout << "EQUAL" << endl;
	else{
		if(a.size() == b.size()){
			if(a > b)cout << "GREATER" << endl;
			else cout << "LESS" << endl;
		}else{
			if(a.size() > b.size())cout << "GREATER" << endl;
			else cout << "LESS" << endl;
		}
	}
	return 0;
}
//GREATER LESS

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

void answer1() {
  map<int, bool> mp;
  int in;
  while (cin >> in) {
    if (mp.find(in) == mp.end()) {
      mp[in] = true;
    }
  }
  cout << mp.size() << endl;
}

void answer2() {
  bool d[101] = {0};
  int in;
  while (cin >> in) {
    d[in] = true;
  }
  int count = 0;
  for (int d_i: d) {
    if (d_i) {
      count++;
    }
  }
  cout << count << endl;
}

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


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30

template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

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

    ll l = lcm(c, d);
    ll e = (b / c) - (a - 1) / c;
    ll f = (b / d) - (a - 1) / d;
    ll g = (b / l) - (a - 1) / l;
    cout << (b - a + 1) - e - f + g << endl;


    return 0;
}


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

int n, m, k;
int t[100][100], c[100][100];
int INF = 1<<21;

void solve(){
    for(int k = 0; k < m; k++){
        for(int i = 0; i < m; i++){
            for(int j = 0; j < m; j++){
                t[i][j] = min(t[i][j], t[i][k] + t[k][j]);
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }
}

int main(){
    while(1){
        cin >> n >> m;

        if(n + m == 0)  break;
        
        for(int i = 0; i < m; i++){
            for(int j = 0; j < m; j++){
                c[i][j] = t[i][j] = INF;
            }
        }
        
        int a, b, cost, tim;
        for(int i = 0; i < n; i++){
            cin >> a >> b >> cost >> tim;
            a--; b--;
            c[a][b] = c[b][a] = cost;
            t[a][b] = t[b][a] = tim;
        }

        solve();

        cin >> k;
        int p, q, r;
        for(int i = 0; i < k; i++){
            cin >> p >> q >> r;
            p--; q--;
            if(r == 0)          cout << c[p][q] << endl;
            else if(r == 1)     cout << t[p][q] << endl;
        }

    }
    return 0;
}


Measured memory_bytes: 3096
from collections import Counter
N,P = map(int,input().split())
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
p = Counter(prime_factorize(P))
ans = 1
for k,v in p.items():
    if v >= N:
        ans *= k**(v//N)
print(ans)

Measured memory_bytes: 3316
A,B = list(map(int,input().split()))
import math
if A == 0 and B != 0:
  D = math.factorial(B-2)
  F = math.factorial(B) // 2// D
  print(F)
  exit()
if A != 0 and B == 0:
  C = math.factorial(A-2)
  E = math.factorial(A) // 2// C
  print(E)
  exit()
if A == 0 and B == 0:
  print(0)
  exit()
elif A == 1 and B != 1:
  D = math.factorial(B-2)
  F = math.factorial(B) // 2// D
  print(F)
  exit()
elif A != 1 and B == 1:
  C = math.factorial(A-2)
  E = math.factorial(A) // 2// C
  print(E)
  exit()
elif A == 1 and B == 1:
  print(0)
  exit()
C = math.factorial(A-2)
D = math.factorial(B-2)
E = math.factorial(A) // 2// C
F = math.factorial(B) // 2// D
print(E+F)

Measured memory_bytes: 3064
#include <iostream>
#include <map>
using namespace std;
int main(){
    int n; cin >> n;
    map<string, int> ans={
        {"AC",  0},
        {"WA",  0},
        {"TLE", 0},
        {"RE",  0}
    };
    for(int i=0; i<n; i++){
        string s; cin >> s;
        ans.at(s) += 1;
    }
    cout << "AC x "  << ans.at("AC")  << "\n";
    cout << "WA x "  << ans.at("WA")  << "\n";
    cout << "TLE x " << ans.at("TLE") << "\n";
    cout << "RE x "  << ans.at("RE")  << "\n";
}

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

using namespace std;

typedef long long int li;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

vi par,sz,vis,dis;
vector<vi> graph;
vector<vector<pair<li,li>>> wgraph;

void init(li n)
{
    par.resize(n);
    sz.resize(n);
    wgraph.resize(n);
    dis.resize(n);
    vis.resize(n);
    graph.resize(n);

    f(i,0,n-1)
    {
        par[i]=i;
        sz[i]=1;
        dis[i]=1e18;
    }
}

li root(li a)
{
    while(a!=par[a])
    {
        par[a]=par[par[a]];
        a=par[a];
    }

    return a;
}

void unio(li a,li b)
{
    li r_a=root(a);
    li r_b=root(b);

    if(par[r_a]!=r_b)
    { 
        if(sz[r_a]<sz[r_b])
        {
            par[r_a]=par[r_b];
            sz[r_b]+=sz[r_a];
            sz[r_a]=0;
        }
        else
        {
            par[r_b]=par[r_a];
            sz[r_a]+=sz[r_b];
            sz[r_b]=0;
        }
    }
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li n;

    cin>>n;

    li a[n];

    for(li i=0;i<n;i++)
        cin>>a[i];

    map<li,li> m;

    f(i,0,n-1)
    {
        if(m.count(a[i]))
        {
            cout<<"NO";
            return 0;
        }
        else
        {
            m[a[i]]++;
        }
    }

    cout<<"YES";

    return 0;
}

Measured memory_bytes: 14336
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<typeinfo>
#include<functional>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


/*
 1  insertionSort(A, n, g)
 2      for i = g to n-1
 3          v = A[i]
 4          j = i - g
 5          while j >= 0 && A[j] > v
 6              A[j+g] = A[j]
 7              j = j - g
 8              cnt++
 9          A[j+g] = v
 10
 11 shellSort(A, n)
 12     cnt = 0
 13     m = ?
 14     G[] = {?, ?,..., ?}
 15     for i = 0 to m-1
 16         insertionSort(A, n, G[i])
 */


void insert(vector<ll> &A,ll g,ll &count){
    for(ll i=g;i<A.size();i++){
        ll v=A[i];
        ll j=i-g;
        while(j>=0 && A[j]>v){
            A[j+g]=A[j];
            j-=g;
            count++;
        }
        A[j+g]=v;
    }
}

vector<ll> G;

ll shell(vector<ll> &A){
    ll count=0;
    for(ll i=0;i<G.size();i++){
        insert(A,G[i],count);
    }
    return count;
}


int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++){cin>>a[i];}
    G={1};
    for(int i=0;G[i]*2+1<n;i++){
        G.push_back(G[i]*2+1);
    }
    reverse(G.begin(),G.end());
    ll count=shell(a);
    cout<<G.size()<<endl;
    for(int i=0;i<G.size();i++){
        cout<<G[i];
        if(i+1!=G.size()){cout<<" ";}
    }
    cout<<endl<<count<<endl;;
    for(int i=0;i<n;i++){
        cout<<a[i]<<endl;
    }
    
    
    return 0;
}



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

/* prototype declaration */
void treasureHunt();

int main(int argc, const char *argv[])
{
	treasureHunt();
	return 0;
}

void treasureHunt()
{
	int r, theta_a, theta_b = 0;
	double x = 0.0, y = 0.0;

	do{
		scanf("%d,%d", &r, &theta_a);
		x += r*sin(1.0*theta_b/180*M_PI);
		y += r*cos(1.0*theta_b/180*M_PI);
		theta_b += theta_a;
	}while(r != 0 && theta_a != 0);
	
	printf("%d\n",(int)x);
	printf("%d\n",(int)y);
}

Measured memory_bytes: 0
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

M = int(input())
print(48-M)


Measured memory_bytes: 4464
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    { 
        
        static void Main(string[] args)
        {
            string s = ReadLine();
            WriteLine(
                s.Substring(0, 4) + " " + s.Substring(4,s.Length-4)
                );
        }
    }
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> x(N + 1), y(M + 1);
    for (int i = 1; i <= N; i++) {
        cin >> x[i];
    }
    for (int i = 1; i <= M; i++) {
        cin >> y[i];
    }

    ll mod = 1e9 + 7;
    ll X = 0;
    for (int i = 1; i < N; i++) {
        ll temp = (x[i + 1] - x[i]) % mod;
        temp = (temp * i) % mod;
        temp = (temp * (N - i)) % mod;
        X = (X + temp) % mod;
    }

    ll Y = 0;
    for (int j = 1; j < M; j++) {
        ll temp = (y[j + 1] - y[j]) % mod;
        temp = (temp * j) % mod;
        temp = (temp * (M - j)) % mod;
        Y = (Y + temp) % mod;
    }

    cout << (X * Y) % mod << endl;
}


Measured memory_bytes: 1792
n, m, r = gets.split.map(&:to_i)
rs      = gets.split.map(&:to_i)

d = Array.new(201){ Array.new(201, Float::INFINITY) }
m.times do
  a, b, c = gets.split.map(&:to_i)
  d[a][b] = c
  d[b][a] = c
end

1.upto(n) do |k|
  1.upto(n) do |i|
    1.upto(n) do |j|
      if d[i][j] > d[i][k] + d[k][j]
        d[i][j] = d[i][k] + d[k][j]
      end
    end
  end
end

min_cost = Float::INFINITY
rs.permutation(r) do |seq|
  cost = 0
  1.upto(seq.size - 1) do |i|
    a = seq[i]
    b = seq[i-1]
    cost += d[a][b]
  end
  if cost < min_cost
    min_cost = cost
  end
end
puts min_cost

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

typedef long long ll;

const int MX=200005;
int a[MX][3],N,M,P;
ll b[20][66][66];

ll fun(ll x,ll y){
ll c=0;
    while(x%y==0){
        c++;
        x/=y;
    }
    return c;
}

ll sum(int x,int y,int z){
    ll s=0;
    for(int i=y;i<=N;i++){
        for(int j=z;j<=M;j++){
            s+=b[x][i][j];
        }
    }
    return s;
}

int main()
{
    int n,x;
    double y;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%lf",&y);
        x=y;
        if(x==y){
            a[i][0]=fun(x,2);
            a[i][1]=fun(x,5),a[i][2]=0;
        }
        else{
            ll z=0;
            char s[20];
            sprintf(s,"%0.9f",y);
            int m=strlen(s),f=-1;
            while(s[m-1]=='0') m--;
            if(s[m-1]=='.') m--;
            for(int j=0;j<m;j++){
                if(isdigit(s[j])){
                    ll d=s[j]-'0';
                    z=z*10ll+d;
                }
                else f=j;
            }
            a[i][0]=fun(z,2),a[i][1]=fun(z,5);
            if(f!=-1) a[i][2]=m-f-1;
        }
        b[a[i][2]][a[i][0]][a[i][1]]++;
        N=max(N,a[i][0]),M=max(M,a[i][1]),P=max(P,a[i][2]);
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<=P;j++){
            int x=max(0,a[i][2]+j-a[i][0]);
            int y=max(0,a[i][2]+j-a[i][1]);
            ans+=sum(j,x,y);
        }
        if(a[i][2]==0) ans--;
    }
    printf("%lld\n",ans>>1);
    return 0;
}

Measured memory_bytes: 6216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll f(ll x){
	ll res = 0;
	while(__builtin_popcount(x) != 0){
		x %= __builtin_popcount(x);
		res++;
	}
	return res;
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    string x; cin >> x;
    
    ll cnt = 0; zep(i, 0, n)if(x[i] == '1')cnt++;
    //print(cnt)
    ll LMOD = cnt - 1, RMOD = cnt + 1;
    
    ll fac[n][2], l = 1, r = 1;
    zep(i, 0, n){
    	if(cnt > 1){
    		l %= LMOD; fac[i][0] = l; l *= 2;
    	}
    	r %= RMOD; fac[i][1] = r; r *= 2;
    	//cout << fac[i][0] << " " << fac[i][1] << endl;
    }
    
    ll L = 0, R = 0;
    zep(i, 0, n){
    	if(x[i] == '1'){
    		if(cnt > 1){
    			L += fac[n - 1 - i][0]; L %= LMOD;
    		}
    		R += fac[n - 1 - i][1]; R %= RMOD;
    	}
    }
    //cout << L << " " << R << endl;
    zep(i, 0, n){
    	if(x[i] == '1'){
    		if(cnt > 1){
    			ll q = (L + (LMOD - (fac[n - 1 - i][0] % LMOD))) % LMOD;
    			//cout << i << " " << q << endl;
    			print(f(q) + 1)
    		}else{
    			print(0)
    		}
    	}else{
    		ll q = (R + fac[n - 1 - i][1] % RMOD) % RMOD;
    		print(f(q) + 1)
    	}
    }
    //print(f(3905230))
    //print(3905230 % 14)
    return 0;
}

Measured memory_bytes: 6888
N = int(input())
H = list(map(int,input().split()))

a = 0
b = 0
h = H[0]

for i in range(1,N):
    if h >= H[i]:
        h = H[i]
        a +=1
    else:
        b = (a if a > b else b)
        a = 0
        h = H[i]
b = (a if a > b else b)


print(b)

Measured memory_bytes: 15020
import sys
input = sys.stdin.readline
from math import factorial

MAX_V = 10**9 + 7


def nCr(n, r):
    if n < r:
        return 0
    return factorial(n) // (factorial(n - r) * factorial(r))


n, b_k = map(int, input().split())
r_k = n-b_k
spot = r_k+1

min_k = min(b_k, spot)

for i in range(1, b_k+1):
    c = nCr(spot, i) * nCr(b_k-1, i-1)
    print(c % MAX_V)


Measured memory_bytes: 3316
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j, temp;
  int A[N+1];
  int count=0;
  scanf("%d", &n);

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

  for (i=0;i<n;i++)
  {
    for (j=n-1;j>i;j--)
    {
      if (A[j-1]>A[j])
      {
        temp=A[j];
        A[j]=A[j-1];
        A[j-1]=temp;
        count++;
      }
    }
  }

  trace(A, n);

  printf("%d\n",count);
  
  
  return 0;
}

Measured memory_bytes: 1816
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	string s;
	cin>>n>>s;
	cout<<(n<3200?"red":s)<<endl;
}


Measured memory_bytes: 256
//ABC057B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int n, m;
	cin >> n >> m;
	vector<long long int> a(n), b(n), c(m), d(m);
	for(int i=0;i<n;i++){
		cin >> a.at(i) >> b.at(i);
	}
	for(int i=0;i<m;i++){
		cin >> c.at(i) >> d.at(i);
	}
	for(int i=0;i<n;i++){
		long long int l = abs(c.at(0)-a.at(i))+abs(d.at(0)-b.at(i));
		int x = 1;
		for(int j=1;j<m;j++){
			if(abs(c.at(j)-a.at(i))+abs(d.at(j)-b.at(i)) < l){
				l = abs(c.at(j)-a.at(i))+abs(d.at(j)-b.at(i));
				x = j+1;
			}
		}
		cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

void dfs(vector<vector<int>> &v, int lv, ll &ans, int hv, int wb, int limw, ll sv){
  if(lv == 4){
    ans = max(ans, sv);
    return ;
  }
  dfs(v, lv+1, ans, hv, wb, limw, sv);
  int ahv = 0;
  for(auto i : v.at(lv)){
    ahv += wb+lv;
    sv += i;
    if(hv + ahv > limw) break;
    dfs(v, lv+1, ans, hv+ahv, wb, limw, sv);
  }
}

int main(){
  int n, w;
  cin >> n >> w;
  int ww;
  vector<vector<int>> v(4, vector<int>());
  rep(i, n){
    int iw, iv;
    cin >> iw >> iv;
    int d = 0;
    if(i == 0){
      ww = iw;
    }else{
      d = iw - ww;
    }
    v.at(d).push_back(iv);
  }
  rep(i, 4){
    sort(v.at(i).rbegin(), v.at(i).rend());
  }

  ll ans = 0;
  dfs(v, 0, ans, 0, ww, w, 0);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,a,n) for(ll i=(a); i<(ll)(n); i++)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(v) (v).begin(), (v).end()

int main(void) {
    string s;
    cin >> s;
    bool can = true;
    int ans = 0;
    int ini = 0;
    int fin = s.size() - 1;
    while (ini <= fin) {
        if (s[ini] == s[fin]) {
            ini++; fin--;
        } else {
            if (s[ini] == 'x') {
                ans++;
                ini++;
            } else if (s[fin] == 'x') {
                ans++;
                fin--;
            } else {
                can = false;
                break;
            }
        }
    }
    if (can) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

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

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int r, g;
  cin >> r >> g;
  int diff = g - r;
  int ans = r + diff * 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>

using namespace std;

const int N = 8;
array<int, N> row;
array<bool, N> col;
array<bool, 2*N-1> dpos;
array<bool, 2*N-1> dneg;
array<array<bool, N>, N> X;

void print_board() {
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            if (X[i][j]) {
                if (row[i] != j)
                    return;
            }
        }
    }

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            auto c = row[i] == j ? "Q" : ".";
            cout << c;
        }
        cout << endl;
    }
}

void solve(int i) {
    if (i == N) {
        print_board();
        return;
    }

    for (int j = 0; j < N; ++j) {
        if (col[j] || dpos[i+j] || dneg[i-j+N-1]) {
            continue;
        }
        // (i, j)????????????????????????
        row[i] = j;
        col[j] = dpos[i+j] = dneg[i-j+N-1] = true;
        solve(i+1);
        // (i, j)?????????????????????????????????
        row[i] = 0;
        col[j] = dpos[i+j] = dneg[i-j+N-1] = false;
    }
}

int main() {
    int k;
    cin >> k;
    for (int i = 0; i < k; ++i) {
        int r, c;
        cin >> r >> c;
        X[r][c] = true;
    }

    fill(row.begin(), row.end(), -1);
    solve(0);

    return 0;
}

Measured memory_bytes: 3096
// kid_kb //
	
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define ull unsigned long long int
#define lower(str) transform(str.begin(),str.end(),str.begin(),::tolower);
#define upper(str) transform(str.begin(),str.end(),str.begin(),::toupper);
#define mod 1000000007
#define SORT(vec) sort(vec.begin(),vec.end());
#define pb push_back
#define csb __builtin_popcount
#define msb(n) (ll)(log2(n))
#define DIG(n) floor(log10(n))+1
#define kb ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ptr(arr) for(auto i:arr)cout<<i<<" ";
#define ptr2(vec) for(auto i:vec){for(auto j: i){cout<<j<<" ";}cout<<endl;}
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mem(a,val) memset(a,val,sizeof(a))
//cout<<fixed<<setprecision(8)<<endl;
	
void solve(){
	int x;
	cin>>x;
	if(x==0)cout<<1<<endl;
	else cout<<0<<endl;
}
int main()
{
	kb
	ll t;
	t=1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;
}



Measured memory_bytes: 3648
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define CLR2d(x,m,n) memset(x, -1, sizeof(x[0][0]) * m * n)
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >


int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
ll po(ll b,ll p){
    ll res=1;
    while(p){
        res*=b;
        p--;
    }
    return res;
}
ll lg2(ll x){
    ll res=0;
    while(x>1){
        res++;
        x/=2ll;
    }
    return res;
}
void solve(){
    ll k,x;
    cin>>k>>x;
    k*=500;
    if(x<=k) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

signed main()

{
    IOS;
    /*#ifndef ONLINE_JUDGE
        freopen ("data.in","r",stdin);
        freopen ("data.out","w",stdout);
    #endif*/
    int t;
    t=1;
    while(t--){
        solve();
    }

     return 0;

}
///Alhamdulillah




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

    int main(){
        int n;
        cin >> n;
        int a;
        double g;
        vector<int> d;
        while (n--){
            cin >> a;
            d.push_back(a);
        }
        for (auto it = d.begin(); it != d.end(); it++){
            g += (double)1 /(*it) ;
        }
        cout << (double) 1/g ;        
        return 0;
    }

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

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 A,B,C;
	cin >> A >> B >> C;
	cout << A * B / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#define N 500000
using namespace std;

int A[N];
int n;

int count = 0;

void Merge(int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    int L[n1 + 1];
    int R[n2 + 1];

    for (int i = 0; i < n1; i++)
    {
        L[i] = A[left + i];
    }
    for (int i = 0; i < n2; i++)
    {
        R[i] = A[i + mid];
    }
    L[n1] = INT_MAX;
    R[n2] = INT_MAX;
    int i = 0;
    int j = 0;

    for (int k = left; k < right; k++)
    {
        if (L[i] < R[j])
        {
            A[k] = L[i];
            i++;
        }
        else
        {
            A[k] = R[j];
            j++;
        }
        count++;
    }
}
void MergeSort(int left, int right)
{
    if (left + 1 < right) //注意
    {
        int mid = (left + right) / 2;
        MergeSort(left, mid);
        MergeSort(mid, right);
        Merge(left, mid, right);
    }
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }

    MergeSort(0, n);

    for (int i = 0; i < n; i++)
    {
        cout << A[i];
        if (i != n - 1)
        {
            cout << ' ';
        }
    }
    cout << endl;
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 6924
#include <cstdio>
int main(){
    int cards[4][13] = {0};
    int num, existing;
    char mark;
    int i, j;
    
    scanf("%d", &existing);
    for (i = 0; i < existing; i++){
        scanf(" %c %d", &mark, &num);
        if (mark == 'S'){
            cards[0][num - 1] = 1;
        }else if (mark == 'H'){
            cards[1][num - 1] = 1;
        }else if (mark == 'C'){
            cards[2][num - 1] = 1;
        }else if (mark == 'D'){
            cards[3][num - 1] = 1;
        }
    }
    for (i = 0; i < 4; i++){
        for (j = 0; j < 13; j++){
            if (cards[i][j] == 0){
                if (i == 0){
                    printf("S %d\n", j + 1);
                }else if (i == 1){
                    printf("H %d\n", j + 1);
                }else if (i == 2){
                    printf("C %d\n", j + 1);
                }else if (i == 3){
                    printf("D %d\n", j + 1);
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2668
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Scanner;
import java.util.AbstractMap.SimpleEntry;
import java.util.HashSet;
import java.util.Iterator;

class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] a = new int[N];
        boolean[] same = new boolean[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt()+1;
        }
        int[] dp = new int[N+1];
        long ans = 1;
        int col = 0;
        dp[0]=3;
        for (int i = 0; i < N; i++) {
            // System.out.println(dp[a[i] - 1]);
            ans *= dp[a[i] - 1];
            ans %= MOD;
            dp[a[i]-1]--;
            dp[a[i]]++;
        }
        // switch(col){
        // case 1:ans*=3;break;

        // case 2:ans*=6;break;

        // case 3:ans*=6;break;
        // }
        // ans %= MOD;

        System.out.println(ans);
    }
}

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

int main(){
    int n;
    cin>>n;
    vector<int> vec(n);
    for(int i=0;i<n;i++){
        cin >> vec.at(i);
    }
    bool ans=true;
    int max=0;
    for(int i=0;i<n-1;i++){
        if(max < vec.at(i))max=vec.at(i);
        if(vec.at(i) > vec.at(i+1)){
            if(max-vec.at(i+1) > 1){
                ans=false;
                break;
            }
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 640
fun solve(A: Int, P: Int) {
    println((A * 3 + P) / 2)
}

fun main() {
//    val S = readLine()!!
//    val N = readLine()!!.toInt()
    val (A, P) = readLine()!!.split(" ").map { it.toInt() }
//    val A = readLine()!!.split(" ").map { it.toInt() }
    solve(A, P)
}

Measured memory_bytes: 36428
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    a = min(a,b);
    c = min(c,d);
    cout << a+c;
    return 0;
}

Measured memory_bytes: 504
// vim: ts=2 sw=2 sts=2
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;

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


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

#define lpsbd(i, s, b, d) for(size_t i = (s); i < (b); i+=(d))
#define lpsb(i, s, b) for(size_t i = (s); i < (b); i++)
#define lpn(i, n) for(size_t i = 0; i < (n); i++)
#define fa(i, x) for(auto &i: x)
#define vcd(t, n, d) vector<t>(n, d)
#define vc(t, n) vector<t>(n)
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

const ll MOD = 1000000007;

int main(void)
{
    int M, D;
    cin >> M >> D;
    int ans = 0;
    for (int i = 1; i <= M; i++)
    {
        for (int  j = 1; j <= D; j++) if (j % 10 >= 2 && j >= 20 && (j % 10) * (j / 10) == i) ans++;
    }
    cout << ans <<endl;
    return 0;
}

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

using namespace std;

//#define int long long
#define FOR(i, j, k) for(int i = j; i < (int)k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF (1 << 30)

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

const int MOD = 1e9 + 7;
const int dy[] = {0, 0, 1, -1};
const int dx[] = {1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

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

    int d, c;
    cin >> d >> c;
    cout << d * c << endl;
    return 0;
}

Measured memory_bytes: 3160