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

int main(){
    int N, M;
    std::cin >> N >> M;
    std::vector< std::vector< int > > LR(N);
    std::map< long long, int > dist;
    for(int i=0; i<M; i++){
        int tmpl, tmpr, tmpd;
        std::cin >> tmpl >> tmpr >> tmpd;
        tmpl--;
        tmpr--;
        LR[tmpl].push_back(tmpr);
        LR[tmpr].push_back(tmpl);
        long long tmp = (long long)tmpl * N + tmpr;
        dist[tmp] = tmpd;
        tmp = (long long)tmpr * N + tmpl;
        dist[tmp] = -1 * tmpd;
    }
    
    std::vector< bool > end_f(N, false);
    std::vector< int > dist_to1(N, 0);
    
    for(int i=0; i<N; i++){
        if(end_f[i]){
            continue;
        }
        if(LR[i].size() == 0){
            end_f[i] = true;
            continue;
        }
        std::deque< int > pos;
        std::deque< int > cost;
        pos.push_back(i);
        cost.push_back(dist_to1[i]);
        while(!pos.empty()){
            int cur_pos = pos[0];
            int cur_cost = cost[0];
            pos.pop_front();
            cost.pop_front();
            
            if(!end_f[cur_pos]){
                end_f[cur_pos] = true;
                dist_to1[cur_pos] = cur_cost;
                
                for(int j=0; j<LR[cur_pos].size(); j++){
                    pos.push_back(LR[cur_pos][j]);
                    long long tmp = (long long)cur_pos * N + LR[cur_pos][j];
                    cost.push_back(cur_cost + dist[tmp]);
                }
            }else{
                if(dist_to1[cur_pos] != cur_cost){
                    std::cout << "No" << std::endl;
                    return 0;
                }
            }
        }
    }
    
    std::cout << "Yes" << std::endl;
    
    
    return 0;
    
}


Measured memory_bytes: 37260
# coding: utf-8

intN = int(input())

intValues = list(map(int, input().split()))
intCosts = list(map(int, input().split()))

intTotalValue = 0
for intIdx, intValue in enumerate(intValues):
    intDiff = intValue - intCosts[intIdx]
    if intDiff > 0:
        intTotalValue += intDiff

print(intTotalValue)


Measured memory_bytes: 3060
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <iomanip>
#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int maxn = 1e5 + 37;

int gn[maxn];
vector <int> t[maxn];

void dfs (int v, int p = -1) { // find grundy_number
	for (auto w : t[v]) {
		if (w != p) {
			dfs (w, v);
			gn[v] ^= gn[w];
		}
	}
	gn[v] ++;
}

int main() {
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 1; i <= n - 1; i++) {
		int v, u;
		cin >> v >> u;
		t[v].PB (u);
		t[u].PB (v);
	}
	dfs (1);
	if (gn[1] == 1)
		cout << "Bob" << endl;
	else
		cout << "Alice" << endl;
}


Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); i++)


int main() {
    int N,K;cin >> N >> K;
    long long int ans = K;
    for (int i = 0;i < N-1;i++){
        ans*=(K-1);
    }
    cout << ans << endl;

}       

Measured memory_bytes: 256
n,k=map(int,raw_input().split())
ans=5*(n/11)
inv=(5*k)%11
for i in range(1,max(1,(n%11-1)*7+1)):
    if i%7 not in (1,0) and i%11==inv:ans+=1
for i in range(1,8):
    if i%7 not in (1,0) and i%11==inv:ans-=1
print ans


Measured memory_bytes: 8816
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<map>
#define mp make_pair
#define pb push_back
using namespace std;

template<class T>inline void read(T &x) {
  x = 0;
  T tmp = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') tmp = -1, c = getchar();
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + c - '0', c = getchar();
  x *= tmp;
}

const int N = 37;
int n;
char s[N + 10];
map<pair<string, string>, int>A;

int main(void) {
  read(n);
  scanf("%s", s + 1);
  for (int now = 0; now < (1 << n); ++now) {
    string a = "", b = "";
    for (int i = 0; i < n; ++i)
      if (now & (1 << i)) a = a + s[i + 1];
      else b = s[i + 1] + b;
    ++A[mp(a, b)];
  }
  long long ans = 0;
  for (int now = 0; now < (1 << n); ++now) {
    string a = "", b = "";
    for (int i = 0; i < n; ++i)
      if (now & (1 << i)) a = s[i + 1 + n] + a;
      else b = b + s[i + 1 + n];
    ans += A[mp(a, b)];
  }
  printf("%lld\n", ans);
  
  return 0;
}


Measured memory_bytes: 84992
#include <iostream>

using namespace std;

int main()
{
int n;
cin >>n;
int h[n],ans[n];
for(int i=0;i<n;i++){
    cin >> h[i];
}
ans[0]=0;
ans[1]=abs(h[0]-h[1]);
for(int i=2;i<n;i++){
    ans[i]=min(ans[i-1]+abs(h[i]-h[i-1]),ans[i-2]+abs(h[i]-h[i-2]));
}
cout << ans[n-1];
    return 0;
}


Measured memory_bytes: 1024
K = int(input())
S = input()
X = len(S)
mod = 10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod


A = 0
B = K
temp = cmb(A+X-1,X-1,mod)*power(25,A,mod)
temp %= mod
temp *= power(26,B,mod)
temp %= mod

ans = temp

for i in range(X+1,K+X+1):

    temp *= 25
    temp %= mod
    
    temp *= pow(26, mod-2, mod)
    temp %= mod
    
    temp *= i-1
    temp %= mod
    
    temp *= pow(i-X, mod-2, mod)
    temp %= mod    

    ans += temp
    ans %= mod

print(ans)

Measured memory_bytes: 227188
#include <bits/stdc++.h>
#define MAX 1000000007
using namespace std;

int main(){
    long long int n, k, a, b, i, j;
    
    cin >> n >> k;

    vector<long long int> v;
    vector<long long int> vb;
    vector<long long int> va;
    vb.assign(n, 0);
    va.assign(n, 0);
    for(i = 0; i < n; i++){
        cin >> a;
        v.push_back(a);
    }

    for(i = 0; i < n; i++){
        for(j = 0; j < n; j++){
            if(v.at(j) < v.at(i)){
                if(j > i){
                    va[i]++;
                } else{
                    vb[i]++;
                }
            }
        }
    }

    long long int totalsum = 0;

    for(i = 0; i < n; i++){
        if(k%2 == 0){
            totalsum+=((((va[i]*(k+1))%MAX)*(k/2))%MAX);
            totalsum%=MAX;
            totalsum+=(((vb[i]*(k/2))%MAX)*(k-1))%MAX;
            totalsum%=MAX;
        } else{
            totalsum+=(((va[i]*((k+1)/2))%MAX)*k)%MAX;
            totalsum%=MAX;
            totalsum+=((((vb[i]*(k))%MAX)*((k-1)/2))%MAX);
            totalsum%=MAX;
        }
    }
    cout << totalsum << endl;
}

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

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#define pb push_back
#define int long long
#define ld long double
#define ll long long
#define mp make_pair

mt19937 rnd(51);


int32_t main()
{ 
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int h, n, sum = 0;
	cin >> h >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		sum += a;
	}
	if (sum >= h)cout << "Yes";
	else cout << "No";
	return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
  ll N;
  ll L[111];
  ll i,j,k;
  ll ans = 0;
  cin >> N;
  for(i=0;i<=N-1;i++)
    cin >> L[i];
  sort(L,L+N);
  for(i=0;i<=N-3;i++)
    for(j=i+1;j<=N-2;j++)
      for(k=j+1;k<=N-1;k++){
        if(L[i] != L[j] && L[j] != L[k] && L[i]+L[j] > L[k]) ans++;
      }
  if(N <= 2) ans = 0;
  cout << ans << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
	#define dbg(x) cout << #x << " : " << x << endl;
#else 
	#define dbg(x)
#endif


#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 1000010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int dp[MX];
int dpt[MX];

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

    str s;
    cin >> s;
    fx(x, s)
    	x -= '0';
    while (s.back() == 0)
    	s.pop_back();
    str st;
    fi(0, siz(s) - 1)
    	st += char(9 - s[i]);
    st += 10 - char(s.back());
    reverse(all(st));
    reverse(all(s));
    dp[0] = min((int)s[0], 1 + 10 - s[0]);
    dpt[0] = min((int)st[0], 1 + 10 - st[0]);
    fi(1, siz(s)) {
    	dp[i] = s[i] + dp[i - 1];
    	dpt[i] = st[i] + dpt[i - 1];
    	if (s[i]) {
    		mine(dp[i], 10 - s[i] + dpt[i - 1]);
    	}
    	if (st[i]) {
    		mine(dpt[i], 10 - st[i] + dp[i - 1]);
    	}
    }
    cout << dp[siz(s) - 1] << '\n';
}

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

#define pb push_back
#define mk make_pair
#define lob lower_bound
#define upb upper_bound
#define fst first
#define scd second

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

inline int read(){
	int f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
inline ll readll(){
	ll f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int MAXN=1e5+5;
int n,k,p[MAXN],q[MAXN],t[MAXN],tt[MAXN],ttt[MAXN],a[MAXN],b[MAXN];
void rev(int *p,int *res){
	for(int i=1;i<=n;++i)res[p[i]]=i;
}
void mul(int *p,int *q,int *res){
	for(int i=1;i<=n;++i)res[i]=p[q[i]];
}
void cp(int *p,int *res){
	for(int i=1;i<=n;++i)res[i]=p[i];
}
void get_a(){
	for(int i=1;i<=n;++i)a[i]=i;
	int e=(k-1)/6;
//	if(k%6==1);
//	else if(k%6==2);
//	else if(k%6==3);
//	else if(k%6==4)cp(q,a);
//	else if(k%6==5)rev(p,t),mul(q,t,a);
//	else if(k%6==0)rev(p,t),mul(q,t,a);
//	else assert(0);
	//a=tt^e
	rev(p,t),rev(q,tt),mul(q,t,ttt),mul(ttt,tt,t),mul(t,p,tt);
	while(e){
		if(e&1)mul(a,tt,t),cp(t,a);
		cp(tt,ttt),mul(tt,ttt,t),cp(t,tt);//tt=tt*tt
		e>>=1;
	}
	if(k%6==1);
	else if(k%6==2);
	else if(k%6==3);
	else if(k%6==4)mul(a,q,t),cp(t,a);
	else if(k%6==5)mul(a,q,tt),rev(p,t),mul(tt,t,a);
	else if(k%6==0)mul(a,q,tt),rev(p,t),mul(tt,t,a);
	else assert(0);
}
void get_b(){
	if(k%6==1)cp(p,b);
	else if(k%6==2)cp(q,b);
	else if(k%6==3)rev(p,t),mul(q,t,b);
	else if(k%6==4)rev(p,b);
	else if(k%6==5)rev(q,b);
	else if(k%6==0)rev(q,t),mul(t,p,b);
	else assert(0);
}
int main() {
	n=read();k=read();
	for(int i=1;i<=n;++i)p[i]=read();
	for(int i=1;i<=n;++i)q[i]=read();
	get_a();
	get_b();
	rev(a,t),mul(a,b,tt),mul(tt,t,ttt);
	for(int i=1;i<=n;++i)printf("%d ",ttt[i]);puts("");
	return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<map>
#include<algorithm>
#include <iomanip>
#include <cmath>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <vector>
#include <bitset>
#include <queue>
#include <set>
#include <stack>
#include <string>

using namespace std;

int main() {
	string s; cin >> s;
	if (s.find("AC") != -1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL r;
	in >> r;
	out << 3 * r * r << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100010
int q, n, num;
ll len[N], val[N], ans[N], x;
void search(ll x, ll v) {
    if (x == 0) return;
    int add = upper_bound(len + 1, len + num + 1, x) - len - 1;
    if (add) {
        val[add] += (x / len[add]) * v;
        search(x % len[add], v);
    } else
        ans[1] += v, ans[x + 1] -= v;
}
int main() {
    scanf("%d%d", &n, &q);
    len[++num] = n;
    while (q--) {
        scanf("%lld", &x);
        while (num && len[num] >= x) num--;
        len[++num] = x;
    }
    val[num] = 1;
    for (ll i = num - 1; i; i--) {
        val[i] += len[i + 1] / len[i] * val[i + 1];
        search(len[i + 1] % len[i], val[i + 1]);
    }
    ans[1] += val[1], ans[len[1] + 1] -= val[1];
    for (ll i = 1; i <= n; i++) printf("%lld\n", ans[i] += ans[i - 1]);
    return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
const ll MOD = 1000000007;

const int MAX = 2000005;
ll modFact[MAX];
ll modInv[MAX];
ll modFactInv[MAX];

// calc nCr % mod
ll comb(int n, int r) {
  return modFact[n] * (modFactInv[r] * modFactInv[n - r] % MOD) % MOD;
}

ll modPow(ll x, ll n, ll mod) {
  ll res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

int main() {
  modFact[0] = modFact[1] = 1;
  modFactInv[0] = modFactInv[1] = 1;
  modInv[1] = 1;
  REP(i, 2, MAX) {
    modFact[i] = modFact[i - 1] * i % MOD;
    modInv[i] = MOD - modInv[MOD % i] * (MOD / i) % MOD;
    modFactInv[i] = modFactInv[i - 1] * modInv[i] % MOD;
  }

  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = modPow(2, n, MOD);
  ans = (ans + MOD - 1) % MOD;

  ll x = 1;
  rep(i, a) x = x * (n - i) % MOD;
  rep(i, a) x = x * modInv[(i + 1)] % MOD;

  ll y = 1;
  rep(i, b) y = y * (n - i) % MOD;
  rep(i, b) y = y * modInv[(i + 1)] % MOD;

  ans = (ans + MOD - x) % MOD;
  ans = (ans + MOD - y) % MOD;

  cout << ans << endl;
}


Measured memory_bytes: 47104
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

template<typename T>
T gcd(T a, T b) {
	if( a == 0 || b == 0 ) return 0;
	if( a < b ) swap(a, b);
	
	T r;
	while( r = a % b ) {
		a = b;
		b = r;
	}

	return b;	
}

int main(void) {
	int n, X;
	cin >> n >> X;
	
	vector<int> x, diff;
	for(int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		x.push_back(a);
	}
	
	x.push_back(X);
	sort(x.begin(), x.end());
	
	for(int i = 0; i < x.size() - 1; ++i) {
		diff.push_back(abs(x[i + 1] - x[i]));
	}
	
	int ans = diff[0];
	for(int i = 1; i < diff.size(); ++i) {
		ans = gcd(ans, diff[i]);
	}
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1400
n = int(input())
rate = 1.08

for i in range(max(n - 13, 0) + 1, n + 13 + 1):
  ans = int(i / rate)
  if int(ans * rate) == n:
    print(ans)
    break
  if i == n + 13 :
    print(":(")
    break

Measured memory_bytes: 2940
/*alurquiza*/
//T: Permutation
#include <bits/stdc++.h>

using namespace::std;

typedef long long LL;

const int SIZE = 3e3 + 1,MOD = 1e9 + 7;

long long DP[SIZE][SIZE];

long long query(LL A[SIZE],int ini,int fin){
	return (A[fin] - A[ini - 1] + MOD) % MOD;
}

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

	// freopen("milkvisits.in","r",stdin);
	// freopen("milkvisits.out","w",stdout);

	int N;
	cin >> N;

	string S;
	cin >> S;

	fill(DP[1] + 1,DP[1] + SIZE,1);

	for(int i = 2;i <= N;i++){
		for(int j = 1;j <= i;j++){
			if(S[i - 2] == '<'){
				DP[i][j] = query(DP[i - 1],j,N);
			}
			else{//S[i - 1] == '>'
				DP[i][j] = query(DP[i - 1],1,j - 1);
			}

			// cerr << i << ' ' << j << ' ' << DP[i][j] << '\n';
		}
		for(int j = 2;j <= N;j++)
			DP[i][j] = (DP[i][j] + DP[i][j - 1]) % MOD;
	}

	cout << query(DP[N],1,N) << '\n';

	return 0;
}

//g++ -std=c++11 -Wall DS.cpp -o main

Measured memory_bytes: 70656
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int a, b;
  cin >> a >> b;
  cout << max(0LL, a-b) << endl;
}


Measured memory_bytes: 256
use std::error::Error;
use std::io;

pub fn main() {
    if let Err(_e) = run() {
        panic!("failed.");
    }
}

fn run() -> Result<(), Box<dyn Error>> {
    let mut input = String::new();
    io::stdin().read_line(&mut input)?;
    let a_b: Vec<i32> = input
        .trim()
        .split_whitespace()
        .map(|s| s.parse::<i32>().unwrap())
        .collect();
    println!("{}", a_b[0] * a_b[1]);
    Ok(())
}


Measured memory_bytes: 2140
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(void){
    ll n;
    cin >> n;
    vector<ll> a(n),m(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
        if(i %2 == 0) m[0] += a[i];
        else m[0] -= a[i];
    }
    cout << m[0] << endl;
    for(int i = 1;i < n;i++){
        m[i] = 2*a[i-1]-m[i-1];
        cout << m[i] << endl;
    }
    return 0;
}


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

struct City {
	int idx;
	int Y;
	int P;
	int x;
};

bool comp(City i, City j) {
	return (i.Y < j.Y);
}

bool comp_idx(City i, City j) {
	return (i.idx < j.idx);
}

int main () {
	// Yは全て異なる
	int N, M;
	cin >> N >> M;
	vector<City> c(M+1);
	for (int i=1; i<=M; ++i) {
	 	cin >> c[i].P >> c[i].Y; 
		c[i].idx = i;
	}
	
	// M個の市, N個の県
	// i番目の市, Y_i年に生成, 県P_iに属す, もしx番目に誕生した市ならば、P_i x が認識番号となる。
	// ... i番目の市がP_iに属すx_i番目の誕生した市であることを求め、P_i x_i を全iについて求める。
	// 
	vector<City> cities;
	vector<vector<City> > c_all(N+1, cities);
	for (int i=1; i<=M; ++i) {
		c_all[c[i].P].push_back(c[i]);
	}
	
	// xを求める => sortする
	for (int i=1; i<=N; ++i) {
		if (c_all[i].size() == 0) continue;
		sort(c_all[i].begin(), c_all[i].end(), comp);
		for (int j=0; j<c_all[i].size(); ++j) {
			c_all[i][j].x = j+1;
			cities.push_back(c_all[i][j]);
		}
	}

	// cities入力順でソート
	sort(cities.begin(), cities.end(), comp_idx); 
	// 出力する
	for (int i=0; i<M; ++i) {
		printf("%06d%06d", cities[i].P, cities[i].x); 
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 10224
N = gets.to_i
a = gets.split.map(&:to_i).sort

h = Hash.new(0)
a.each{ |i| h[i] += 1 }

ans = 0
h.each do |k, v|
  
  d = v - k

  next if d == 0
  ans += d if d > 0
  ans += v if d < 0
end

puts ans

Measured memory_bytes: 17292
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
void dout(double d){printf("%.12f\n",d);}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;

int n, k, s, L[N], R[N];
V<int> e[N];
void dfs(int a, int p){
  int l, r;
  if(p < 0){
    l = L[a];
    r = R[a];
  }else{
    l = L[p]-1;
    r = R[p]+1;
  }
  if(L[a] == -IINF){
    L[a] = l;
    R[a] = r;
  }
  if((L[a]^l)&1 || L[a]>r || l>R[a]){
    cout << "No" << endl;
    exit(0);
  }
  maxs(L[a], l); l = L[a];
  mins(R[a], r); r = R[a];
  for(int b:e[a]) if(b != p){
    dfs(b, a);
    l = L[b]-1;
    r = R[b]+1;
    if((L[a]^l)&1 || L[a]>r || l>R[a]){
      cout << "No" << endl;
      exit(0);
    }
    maxs(L[a], l); l = L[a];
    mins(R[a], r); r = R[a];
  }
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n-1){
    int a, b;
    cin >> a >> b;
    a--;b--;
    e[a].pb(b);
    e[b].pb(a);
  }
  Fill(L, -IINF);
  Fill(R, -IINF);
  cin >> k;
  FOR(i, 0, k){
    int v, p;
    cin >> v >> p;
    v--;
    L[v] = p;
    R[v] = p;
    s = v;
  }
  dfs(s, -1);
  dfs(s, -1);
  printf("Yes\n");
  FOR(i, 0, n) printf("%d\n", L[i]);
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector <int> W(N);
    for (int i=0; i<N; i++) cin >> W.at(i);
    int L,R;
    int ans=0;
    for (int i=0; i<N; i++) ans+=W.at(i);
    L=0;
    R=ans;
    for (int i=0; i<N; i++) {
        L+=W.at(i);
        R-=W.at(i);
        ans = min(ans, abs(L-R));
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

const size_t INF=1uLL<<57;

size_t binary_knapsack(vector<size_t> w, vector<size_t> v, size_t c) {
    size_t n=w.size();
    size_t V=*max_element(v.begin(), v.end());
    vector<size_t> dp(n*V+1, INF); dp[0]=0;

    for (size_t i=0; i<n; ++i)
        for (size_t j=n*V; j>=v[i]; --j)
            if (dp[j] > dp[j-v[i]] + w[i])
                dp[j] = dp[j-v[i]] + w[i];

    size_t res=0;
    for (size_t k=0; k<=n*V; ++k)
        if (dp[k] <= c) res = k;

    return res;
}

int main() {
    size_t N, W;
    scanf("%zu %zu", &N, &W);

    vector<size_t> v(N), w(N);
    for (size_t i=0; i<N; ++i)
        scanf("%zu %zu", &v[i], &w[i]);

    printf("%zu\n", binary_knapsack(w, v, W));
    return 0;
}

Measured memory_bytes: 2860
#include <bits/stdc++.h>
using namespace std;
#define EPS (1e-10)
#define lessthan < EPS +

int main() {
	int N, K;
	double ans = 0;
	cin >> N >> K;
	for (int n = 1; n <= N; n++) {
		double m = max(0.0, ceil(log2(1.0 * K / n)));
		ans += pow(0.5, m) / N;
	}
	cout << fixed << setprecision(15) << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;

//25
typedef long long ll;

ll power(ll a , ll b) {
    ll ans = 1;
	while (b) {
		if (b & 1) {
			ans = ans  * a;
		}
		a = a * a;
		b  /= 2;
	}
	return ans;
}

int main() {
	string s;
	cin >> s;
	int n = (int)s.size();
	int a = 0;
	for (int i = 0; i < n; ++i) {
		if (s[i] == '1') a++;
	}
	cout << min(a * 2, 2 * (n - a));
} 	



Measured memory_bytes: 3740
#include <stdio.h>

int min3(int x, int y, int z){
    int min = x;
    if (y < min) min = y;
    if (z < min) min = z;
    return min;
}

int main(){
    int r,g,b,n;
    long ans = 0;

    scanf("%d %d %d %d",&r,&g,&b,&n);

    int lr = n/r+1;
    int lg = n/g+1;

    for (int i =lr; i >= 0; i--){
        if(i*r>n){
            continue;
        }else{
            for (int j =lg; j >= 0; j--){
                if(i*r+j*g>n){
                    continue;
                } else {
                    if((n - (i * r + j * g)) % b == 0){
                        ans++;
                    }

                }
            }
        }
    }
    printf("%ld\n",ans);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int main(){
	fast;
	ll a;
	string s;
	cin>>a;
	cin>>s;
	if(a>=3200){
		for(int i=0;i<s.size();i++)cout<<s[i];
		cout<<endl;
		return 0;
	}else cout<<"red"<<endl;
	cout<<endl;
	return 0;
	return 0;
}/*『你强归你强，我永不示弱』*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
long long ans[100005];
map<int,pair<int,int> > G;

int main() {
    scanf("%d", &n);
    for(int i = 1 ; i <= n; i++) {
        int x;
        scanf("%d", &x);
        if(G.find(x) != G.end()) {
            G[x].second++;
        }else {
            G[x] = make_pair(i, 1);
        }
    }
    G[0] = make_pair(0,0);
    while(G.size() > 1) {
        auto B1 = *--G.end();
        //cout << B1.first << ' ' << B1.second.first << ' ' << B1.second.second << endl;
        G.erase(--G.end());
        auto B2 = --G.end();
        ans[B1.second.first] += 1LL*B1.second.second*(B1.first-B2->first);
        B2->second.first = min(B2->second.first, B1.second.first);
        B2->second.second += B1.second.second;
    }
    for(int i = 1; i <= n; i++) {
        printf("%lld\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007ll

int N, X, Y, Z;
int dp[50][1 << 17];
int p;

int pou(int a, int b)
{
    int tmp = 1;
    for(int i = 0; i < b; i++){
        tmp = a * tmp % mod;
    }
    return tmp % mod;
}

int dfs(int pos, int bit)
{
    if(~dp[pos][bit]){
        return dp[pos][bit];
    }
    if((bit >> X + Y + Z - 1ll) & 1ll){
        if((bit >> Y + Z - 1ll) & 1ll){
            if((bit >> Z - 1ll) & 1ll){
                return dp[pos][bit] = 0ll;
            }
        }
    }
    if(pos == N){
        return dp[pos][bit] = 1ll;
    }
    //if(bit & (1ll << (p - 1ll))){
    //    bit ^= (1ll << (p - 1ll));
    //}
    int res = 0ll;
    for(int i = 1ll; i <= 10ll; i++){
        res = (res + dfs(pos + 1ll, ((bit << i) | (1ll << i - 1ll)) & ((1 << p) - 1))) % mod;
    }
    return dp[pos][bit] = res;
}

signed main()
{
    cin >> N >> X >> Y >> Z;
    p = X + Y + Z;
    memset(dp, -1ll, sizeof(dp));
    cout << (pou(10ll, N) - dfs(0ll, 0ll) + mod) % mod << endl;


    return 0;
}


Measured memory_bytes: 51456
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i=1; i<=n; i++) {
    int keta = 0;
    int v = i;
    while (v) {
      v/=10;
      keta++;
    }
    if (keta%2==1) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static Scanner sc;
	public static void main(String[] args){
		sc=new Scanner(System.in);
		int n=sc.nextInt();
		int x[]=new int[n];
		int y[]=new int[n];
		for(int i=0;i<n;i++){
			x[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++){
			y[i]=sc.nextInt();
		}
		Double d1=0.0,sum2=0.0,sum3=0.0,d4=0.0;
		for(int i=0;i<n;i++){
			d1+=Math.abs(x[i]-y[i]);
			sum2+=(x[i]-y[i])*(x[i]-y[i]);
			sum3+=Math.abs((x[i]-y[i])*(x[i]-y[i])*(x[i]-y[i]));
			d4=Math.max(d4,Math.abs(x[i]-y[i]));
		}
		System.out.println(d1);
		System.out.println(Math.sqrt(sum2));
		System.out.println(Math.cbrt(sum3));
		System.out.println(d4);
	}

}

Measured memory_bytes: 26488
#include <bits/stdc++.h>
#define endl "\n"
#include <set>
 
 
using namespace std;
int main(){
    
ios_base::sync_with_stdio(false);
    cin.tie(NULL);    
 
  int n, k; cin>>n>>k;
  int dp[n];
  vector <int> a;
  for (int i=0; i<n; i++)
  {
    int temp; cin>>temp;
    a.push_back(temp);
  }
  
  for (int i=0; i<n; i++)
  {
  	dp[i]=1000000000;
  }
  
  dp[n-1]=0;
  dp[n-2]=abs(a[n-1]-a[n-2]);
  
  for (int i=n-3; i>=0; i--)
  {
  	for (int j=1; j<=k && i+j<n; j++)
  	{
    int diff=abs (a[i+j]-a[i]);
    dp[i]= min( dp[i+j]+ diff, dp[i]);
  	}
  }  
  cout<<dp[0]<<endl;
}

Measured memory_bytes: 1144
#include<stdio.h>
int main(){
  int xper,ybase,ymax,ytuiper,siyou,xsum,ysum;
  scanf("%d",&xper);
  scanf("%d",&ybase);
  scanf("%d",&ymax);
  scanf("%d",&ytuiper);
  scanf("%d",&siyou);

  //Xテ」ツ?療」ツつε」ツ?ョテ」ツつ甘」ツつ?」ツ??」ツ?催」ツつ?
   xsum=siyou*xper;

  //Yテ」ツ?療」ツつε」ツ?ョテ」ツつ甘」ツつ?」ツ??」ツ?催」ツつ?
   if(ymax < siyou){
     ysum=ybase+(siyou-ymax)*ytuiper;
   }
   
   if(ymax >= siyou){
     ysum=ybase;
   }

   // print 
   if(ysum >= xsum){
     printf("%d\n",xsum);
   }
   
   else{
     printf("%d\n",ysum);
   }
   
   return 0;
   
}

Measured memory_bytes: 596
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define INS(x) string (s); cin >> s
#define INL(x) ll (x); cin >> x
#define VINT(a,n) vector<int> a(n)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()

int main () {
  VIN(p,3);
  sort(ALL(p));
  cout<<  p[0]+p[1];
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1

typedef long long ll;

const double PI = 3.141592653589793;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;


int main(){
    ll n,k;
    cin >> n >> k;
    int check[72];
    memset(check,0,sizeof check);
    ll temp = k;
    int c = 0;
    while(temp > 0){
        if(temp & 1) check[c] = 1;
        c++;
        temp >>= 1; 
    }
    ll table[c][n];
    for(int i = 0; i < n; i++) {
        ll a;
        cin >> a;
        table[0][i] = --a;
    }
    for(int i = 0; i < c - 1; i++){
        for(int j = 0; j < n; j++){
            table[i+1][j] = table[i][table[i][j]]; 
        }
    }
    ll pre = 0;
    for(int i = 0; i <= c; i++){
        if(check[i] == 1) pre = table[i][pre]; 
    }
    cout << pre + 1 << endl;
    return 0;
}

Measured memory_bytes: 97276
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int main() {
    int N = 0;
    map<int, int> A;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int c = 0;
        cin >> c;
        A[c]++;
    }
    cout << A.size() << endl;
    return 0;
}

Measured memory_bytes: 256
n,m,s,t=map(int,input().split())
yen=[[]*n for i in range(n)]
sunuke=[[]*n for i in range(n)]
for i in range(m):
  u,v,a,b=map(int,input().split())
  yen[u-1].append((a,v-1))
  yen[v-1].append((a,u-1))
  sunuke[u-1].append((b,v-1))
  sunuke[v-1].append((b,u-1))
  


#ダイクストラ法
#n:頂点数　s:始点　es:隣接リスト表現
import heapq
def dijkstra(n,s,es):
  d=[float("INF")]*n
  d[s]=0
  used=[False]*n
  used[s]=True
  edgelist=[]
  for to in es[s]:
    heapq.heappush(edgelist,to)
  while len(edgelist)>0:
    minedge=heapq.heappop(edgelist)
    v=minedge[1]
    if used[v]:
      continue
    used[v]=True
    d[v]=minedge[0]
    for to in es[v]:
      heapq.heappush(edgelist,(d[v]+to[0],to[1]))
  return d

ans=[0]*n
d_yen=dijkstra(n,s-1,yen)
d_sunuke=dijkstra(n,t-1,sunuke)
check=float("INF")
for i in range(n-1,-1,-1):
  check=min(d_yen[i]+d_sunuke[i],check)
  ans[i]=check


for j in range(n):
  print(10**15-ans[j])
  
  
  
  
  
      
    
    
    
    
  
  


  

Measured memory_bytes: 133992
"""#################################################################
【ABC109】
B_Shiritori
#################################################################"""

#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
txt = []
good = True
for i in range(N):
    txt += [IS()]
for s in txt:
    if txt.count(s) > 1:
        good = False
for i in range(N-1):
    if txt[i][-1] != txt[i+1][0]:
        good = False
if good == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
A, B = gets.split.map &:to_i
a = (A / 0.08).ceil
# b = (B / 0.10).ceil
b = ((B + 1) / 0.10).ceil - 1
p (a..b).find{|n|
  n * 8 / 100 == A && n * 10 / 100 == B
} || -1

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using 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 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;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int clz(int x) { return 31 - __builtin_clz(x); }
int clz(ll x) { return 63 - __builtin_clzll(x); }
int ctz(int x) { return __builtin_ctz(x); }
int ctz(ll x) { return __builtin_ctzll(x); }

class compare {
public:
	bool operator()(tuple<ll, ll> a, tuple<ll, ll> b) {
		return (get<1>(a) > get<1>(b));
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,in,mx=0;
	cin>>n;
	vector<pll> v;
	rep(i,n){
		cin>>in;
		mx=max(mx,in);
		v.push_back(pll(i,in));
	}
	v.push_back(pll(-1,0));
	sort(all(v),[](pll& a,pll& b){
		if(a.sc!=b.sc)return a.sc>b.sc;
		else return a.fs<b.fs;
	});
	vl ans(n);
	ll tgt=v[0].fs;
	rep(i,n+1){
		if(v[i].sc!=mx){
			ans[tgt]+=(mx-v[i].sc)*(i);
			mx=v[i].sc;
			tgt=min(tgt,v[i].fs);
		}
	}
	rep(i,n){
		cout<<ans[i]<<"\n";
	}
}

Measured memory_bytes: 3444
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip	;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,m,k;
	while(cin>>n>>m>>k,n+m+k){
		vvi dp(n+1,vi(n*m+1));
		dp[0][0]=1;
		rep(i,n)rep(j,n*m+1)if(dp[i][j])loop(x,1,m+1)if(j+x<=n*m){
			dp[i+1][j+x]+=dp[i][j];
		}
		ll out=0;
		rep(i,n*m+1)out+=dp[n][i]*max(1,i-k);
		cout<<shosu(9)<<out/pow(m,n)<<endl;
	}
}
 
 

Measured memory_bytes: 1456
n, m, x = map(int,input().split())
c = [0] * n
a = [[]] * n
for i in range(n):
    l = list(map(int,input().split()))
    c[i] = l[0]
    a[i] = l[1:]

inf = 10 ** 10
money = inf
for i in range(2**n):
    temp = 0
    r = [0] * m
    for j in range(n):
        if (i>>j)&1:
            temp += c[j]
            for k in range(m):
                r[k] += a[j][k]

    for j in r:
        if j >= x:continue
        break
    else:
        money = temp if temp < money else money

print(money if money != inf else -1)


Measured memory_bytes: 68368
#include <stdio.h>
 
int main(void) {
  char S[11];
  int i, ACGT, max_ACGT;
  for (scanf("%s",S), i = 0, max_ACGT = 0; S[i]; i++) {
    for (ACGT = 0; S[i+ACGT] && (S[i+ACGT] == 'A' || S[i+ACGT] == 'C' || S[i+ACGT] == 'G' || S[i+ACGT] == 'T'); ACGT++);
    if (max_ACGT < ACGT) {
      max_ACGT = ACGT;
    }
  }
  printf("%d",max_ACGT);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
void add(ll &a, ll b) {
	a += b;
	a %= MOD;
}
int main() {
	int n;
	cin >> n;
	VVVL dp(n + 1, VVL(2, VL(2, 0)));
	dp[0][0][0] = 1;
	rep(i, n) rep(j, 2) rep(k, 2) {
		rep(d, 10) {
			bool f1 = false, f2 = false;
			if (d == 0) f1 = true;
			if (d == 9) f2 = true;
			add(dp[i + 1][j | f1][k | f2], dp[i][j][k]);
		}
	}
	cout << dp[n][1][1] << endl;
	return 0;
}

Measured memory_bytes: 151472
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n;
long long s[100000];

int main() {
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  s[0] = a[0];
  for (int i = 1; i < n; i++) {
    s[i] = s[i-1] + a[i];
  }

  long long ans1 = 0;
  long long t = 0;
  //+-+-+-のとき
  for (int i = 0; i < n; i++) {
    int target = s[i]+t;
    if(i % 2 == 0 && target <= 0 ){//奇数番目、0以下なので加算
      int tmp = 1 - target;
      ans1 += tmp;
        t += tmp;
    }

    if(i % 2 == 1 && target >= 0 ){//偶数番目、0以上なので減算
    int tmp = 1 + target;
      ans1 += tmp;
        t -= tmp;
    }
      //cout << target << "," << t << endl;

  }

  long long ans2 = 0;
  t = 0;
  //-+-+-+のとき
  for (int i = 0; i < n; i++) {
       int target = s[i]+t;
    if(i % 2 == 0 && target >= 0 ){//-のとき
    int tmp = 1 + target;
      ans2 += tmp;
        t -= tmp;
    }
    if(i % 2 == 1 && target <= 0 ){//+のとき
    int tmp = 1 - target;
      ans2 += tmp;
        t += tmp;
    }
  }


  long long ans = (ans1<ans2 ? ans1 : ans2); 

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
using namespace std;
using ll = long long;



ll poww(ll a, ll b) {
    ll ans = 1;
    rep (i, b) {
        ans *= a;
        
    }
    return ans;
}


int main(void) {
    ll h;
    cin >> h;

    ll cnt2 = 1;
    while (h > 1) {
        h /= 2;
        cnt2++;
    }
    //cout << cnt2 << endl;
    cout << (poww(2, cnt2) - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split()) #intでインプット
H = list(map(int,input().split()))
#AB = [list(map(int,input().split())) for i in range(M)]


counter=[0]*N
for i in range(M):
    A, B = map(int,input().split())
    if H[A-1] > H[B-1]:
        counter[B-1]+=1
    elif H[A-1] < H[B-1]:
        counter[A-1]+=1
    else:
        counter[A-1]+=1
        counter[B-1]+=1
print(len([i for i, x in enumerate(counter) if x == 0]))

Measured memory_bytes: 20112
s = gets.chomp
cnt = 0
s.size.times do |i|
    if i % 2 == 0
        if s[i] == 'R' || s[i] == 'U' || s[i] == 'D'
            cnt += 1
        end
    else
        if s[i] == 'L' || s[i] == 'U' || s[i] == 'D'
            cnt += 1
        end
    end
end
puts cnt == s.size ? 'Yes': 'No'

Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  int n;
  cin >> n;
  int i;
  vector<int> d(n);
  for(i = 0;i < n;++i){
    cin >> d.at(i);
  }
  sort(d.begin(),d.end());
  int ans = 1;
  int temp = d.at(0);
  for(i = 1;i < n;++i){
    if(d.at(i) > temp){
      ++ans;
      temp = d.at(i);
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int N;
  cin>>N;
  using tp=tuple<string,int,int>;
  using vpa=vector<tp>;

  vpa data(N);
  for(int i=0;i<N;i++){
    string s;
    int p;
    cin>>s>>p;
    tp spi=make_tuple(s,p,i+1);
    data[i]=spi;
  }

  while(true){
    int change=0;
    for(int i=0;i<N-1;i++){
      if(get<1>(data[i])<get<1>(data[i+1])){
        swap(data[i],data[i+1]);
        change=1;
      }
    }
    if(change==0){
      break;
    }
  }

  while(true){
    int change=0;
    for(int i=0;i<N-1;i++){
      if(get<0>(data[i])>get<0>(data[i+1])){
        swap(data[i],data[i+1]);
        change=1;
      }
    }
    if(change==0){
      break;
    }
  }

  for(int i=0;i<N;i++){
    cout<<get<2>(data[i])<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<utility>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<cstring>
#define nax 1000005
#define mod 1000000007
#define ll long long int
using namespace std;
int main(){
	int r=0,g=0,b=0,n=0;
	cin >>r >> g >> b >> n;
	int rp=n/r,gp=n/g;
	int c=0,p=0;
	for(int i=0;i<=rp;i++){
		for(int j=0;j<=gp;j++){
			p=n-i*r-j*g;
			if(p>=0 && p%b==0){
//				cout << p << " ";
				c++;
			}
		}
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int que[1000000],l,r;

void push(int x) {
  que[r]=x;
  r++;
  if(r>=1000000) r=0;
}

int pop() {
  int d=que[l];
  l++;
  if(l>=1000000) l=0;
  return d;
}

int main() {
  l=r=0;
  int n,q,i;
  scanf("%d%d",&n,&q);
  char ch[n][10];
  int c[n];
  for(i=0; i<n; i++) {
    scanf("%s %d",ch[i],&c[i]);
    push(i);
  }
  int sum=0;
  while(l!=r) {
    int x=pop();
    if(q<c[x]) {
      sum+=q;
      c[x]-=q;
      push(x);
    } else {
      sum+=c[x];
      printf("%s %d\n",ch[x],sum);
    }
  }
  return 0;
}



Measured memory_bytes: 3136
n=int(input())
flag=False
for i in range(9,0,-1):
	if n%i==0:
		x=n//i 
		y=i 
		if x>=1 and x<=9 and y>=1 and y<=9:
			flag=True
if flag:
	print("Yes")
else:
	print("No") 

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

int main() {
    int N,K;
    cin >> N >>K;
    vector<int> A(N,0);
    for(int i=0;i<K;i++){
        int d;
        cin >> d;
        for(int j=0;j<d;j++){
            int a;
            cin >>a;
            --a;
            A[a]++; 
        }
    }
    int ans =0;
    for(int i=0;i<N;i++){
        if(A[i] ==0){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int n, m;
vector<vector<int>> edge;
vector<long double> memo, cnt;

long double solve();
void dfs1(int now, int p);

int main() {
  cout << fixed << setprecision(10);
  cin >> n >> m;
  edge.assign(n, vector<int>());
  for(int i = 0; i < m; ++i) {
    int s, t;
    cin >> s >> t;
    edge[--s].push_back({--t});
  }

  cout << solve() << endl;
  return 0;
}

long double solve() {
  long double ans = 1e18;
  for(int i = 0; i < n; ++i) {
    memo.assign(n, 0);
    for(int j = n - 1; j >= 0; --j) {
      long double maxnum = 0;
      for(auto nowe : edge[j]) {
        memo[j] += memo[nowe] + 1;
        maxnum = max(memo[nowe] + 1, maxnum);
      }
      if(i == j && edge[j].size() > 1) {
        memo[j] -= maxnum;
        memo[j] /= edge[j].size() - 1;
      }
      else if(edge[j].size() > 0)
        memo[j] /= edge[j].size();
    }
    ans = min(ans, memo[0]);
  }
  return ans;
}


Measured memory_bytes: 1408