akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n;
        while(true){
            n = sc.nextInt();
            if(n == 0) break;
            int[] s = new int[n];
            int sum = 0;
            double square = 0;
            for(int i=0; i<n; i++){
                s[i]=sc.nextInt();
                sum += s[i];
            }
            double avg = (double)sum / n;
            for(int i=0; i<n; i++){
                square += Math.pow(s[i]-avg, 2);
            }
            double variance = square / n;
            System.out.println(Math.sqrt(variance));
        }
    }
}


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

int main() {
	multiset<int, greater<int>> ms; int temp;
	for (int i = 0; i < 10; i++) { cin >> temp; ms.insert(temp); }
	auto itr = ms.begin();
	for (int i = 0; i < 3; i++) { cout << *itr << endl; itr++; }
	return 0;
}


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

int main(){
  double a, b, x, k, h;
  cin >> a >> b >> x;
  if(x > a * a * b / 2.00000000){
    x = (a * a * b - x) / (a * a) * 2.00000000;
    k = atan(x / a);
    h = 180.0000000 * k / 3.141592653;
  }
  else{
    x = x / (a * b) * 2.00000000;
    k = atan(b / x);
    h = 180.0000000 * k / 3.141592653;
  }
  cout << fixed << setprecision(7);
  cout << h << endl;
}

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

using namespace std;

int main() {
    int x = 0, y = 0, z = 0, ans = 0;
    cin >> x >> y >> z;

    while (x >= y + z + z) {

        ans++;
        x -= (y + z);

    }
    cout << ans << endl;
    return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y=x;
    if(z->key < x->key)x = x->left;
    else x = x->right;
    
  }
  z->parent =y;
  if(y == NIL)root = z;
  else {
    if(z->key < y->key)y->left = z;
    else y->right = z;
  }


}

void inorder(Node u){
  if(u == NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);

}
void preorder(Node u){


 if(u == NIL)return;
 printf(" %d",u->key);
 preorder(u->left);
 preorder(u->right);


  
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 25180
#include<stdio.h>

int main(void)
{
   int A,B,C,D;
   scanf("%d%d%d%d",&A,&B,&C,&D);
   if(A+B>C+D)
   		printf("Left\n");
   else if(A+B==C+D)
   		printf("Balanced\n");
   else
   		printf("Right\n");			
   return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

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

    return 0;
}

Measured memory_bytes: 5504
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;



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

    vector<ll> num(26,0);
    rep(i,n){
        ll t = s[i] - 'a';
        num[t]++;
    }
    ll ans = 0;
    // COMinit();
    // ans += num[0];
    rep(i,26){
        ans += num[i] + ans * num[i];
        ans %= MOD;
    }

    cout << ans <<endl;
}

Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;

public class Test
{
	public static void Main()
	{
        string[] line = Console.ReadLine().Split(' ');
        long a = long.Parse(line[0]);
        long b = long.Parse(line[1]);
        long x = long.Parse(line[2]);

        long min;
        if(a == 0){
            min = -1;
        } else {
            min = (a - 1) / x;
        }    

        long max = b / x;

        Console.WriteLine(max - min);
    }                                                                                                                                                                       
}

Measured memory_bytes: 13140
#include<iostream>
#include <string>
#include<stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
const ll MOD=1000000007ll;
const int MAX = 1000010;

ll fact[MAX], fact_inv[MAX];

// 繰り返し二乗法
ll power(ll a, ll b) {
	ll res = 1;
	while (b > 0) {
		if (b & 1) res = res * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return res;
}

ll comb(ll n, ll r) {
	return (fact[n] * fact_inv[r]) % MOD * fact_inv[n - r] % MOD;
}



int main() {

	ios::sync_with_stdio(false);
	cin.tie(0);
	int n = 1000000;
	// cin>>n;
	fact[0] = 1;
	// 階乗の計算
	REP(i, n) fact[i + 1] = fact[i] * (i + 1) % MOD;
	fact_inv[n] = power(fact[n], MOD - 2);
	// 逆元の計算
	FORR(i, 0, n) fact_inv[i] = fact_inv[i + 1] * (i + 1) % MOD;

	
	int X, Y;
	cin >> X >> Y;
	int N;
	long long int ans = 0,l = 1;
	if (X % 2 == 0)N = X / 2;
	else N = X / 2;

	for (int k = 0; k <= N; k++) {
		

		if ( X - 2 * k == ( Y - k ) / 2 && ( Y - k ) %  2 == 0 ) {

			ans += comb((k + (Y - k) / 2), k);

		}
	}
	
	ans = ans % MOD;

	cout << ans << endl;
	


	return 0;
}

	






Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define dcout cout << fixed << setprecision(15)
#define rep(i, a) for(int i = 0; i < a; i++)
#define arep(i, x) for(auto i : x)
#define all(v) v.begin(), v.end()
#define int long long
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
using namespace std;
signed main() {
    int n;
    cin >> n;
    VE a;
    rep(i, n) {
        int enter;
        cin >> enter;
        a.pb(enter);
    }
    int ans = 0;
    rep(i, n - 1) {
        if(a[i + 1] == a[i]) {
            a[i + 1] = 10001;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

template <typename T, typename ET>
struct ReRooting {
    struct edge {
        int to;
        ET data;
        edge(int to, ET data) : to(to), data(data) {}
    };

    using F = function<T(T, T)>;
    using L = function<T(T, ET)>;
    vector<vector<edge>> G;
    vector<T> dp, res;
    const T id;
    const F f;
    const L l;

    ReRooting(int V, const F f, const L l, const T id)
        : G(V), f(f), l(l), id(id), dp(V, id), res(V, id) {}

    void add_edge(int u, int v, ET c, ET cr) {
        G[u].emplace_back(v, c);
        G[v].emplace_back(u, cr);
    }

    void add_edge(int u, int v, ET c) {
        add_edge(u, v, c, c);
    }

    void dfs(int v, int pre) {
        for (auto e : G[v]) {
            if (e.to == pre) continue;
            dfs(e.to, v);
            dp[v] = f(dp[v], l(dp[e.to], e.data));
        }
    }

    void rdfs(int v, int pre) {
        for (auto e : G[v]) {
            res[v] = f(res[v], l(dp[e.to], e.data));
        }
        int n = G[v].size();
        vector<T> lsum(n + 1, id), rsum(n + 1, id);
        for (int i = 0; i < n; i++) {
            lsum[i + 1] = f(lsum[i], l(dp[G[v][i].to], G[v][i].data));
        }
        for (int i = n - 1; i >= 0; i--) {
            rsum[i] = f(rsum[i + 1], l(dp[G[v][i].to], G[v][i].data));
        }
        for (int i = 0; i < n; i++) {
            if (G[v][i].to == pre) continue;
            dp[v] = f(lsum[i], rsum[i + 1]);
            rdfs(G[v][i].to, v);
        }
    }

    vector<T> solve() {
        dfs(0, -1);
        rdfs(0, -1);
        return res;
    }
};

signed main() {
    int n;
    ll m;
    cin >> n >> m;
    auto f = [&](ll a, ll b) { return a * b % m; };
    auto l = [&](ll a, int b) { return (a + b) % m; };
    ReRooting<ll, int> rr(n, f, l, 1);
    int x, y;
    rep(i, n - 1) {
        cin >> x >> y;
        x--;
        y--;
        rr.add_edge(x, y, 1);
    }
    auto ans = rr.solve();
    rep(i, n) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 28928
#include <iostream>
#include <unordered_map>
using lint = int64_t;
using P = std::pair<lint, lint>;

#define rep(i, n)  for (lint i = 0; i < (n); ++i)

class union_find {
private:

	static const lint array_size = 2 * 100010;
	lint par[array_size], rank[array_size], size[array_size];

public:

	void init(lint n) noexcept {
		if (array_size <= n) return;
		for (lint i = 0; i < n; ++i) {
			par[i] = i;
			rank[i] = 0;
			size[i] = 1;
		}
	}

	lint root(lint x) noexcept {
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}
  
	void unite(lint x, lint y) noexcept {
		x = root(x); y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) {
			par[x] = y;
			size[y] += size[x];
		}
		else {
			par[y] = x;
			if (rank[x] == rank[y]) ++rank[x];
			size[x] += size[y];
		}
	}
};

namespace std {
	template<class T1, class T2>
	struct hash<pair<T1, T2>> {
		size_t operator()(const pair<T1, T2>& value) const noexcept {
			auto hash1 = hash<T1>{}(value.first);
			auto hash2 = hash<T2>{}(value.second);

			size_t seed = hash1 ^ (hash2 << 10);
			return seed;
		}
	};
}

lint n, k, l;
std::unordered_map<P, lint>mp;
union_find a, b;
int main() {
	scanf("%lld %lld %lld", &n, &k, &l);
	a.init(n), b.init(n);
	rep(i, k) {
		lint p, q;
		scanf("%lld %lld", &p, &q);
		a.unite(p - 1, q - 1);
	}
	rep(i, l) {
		lint r, s;
		scanf("%lld %lld", &r, &s);
		b.unite(r - 1, s - 1);
	}
	rep(i, n) mp[P(a.root(i), b.root(i))]++;
	rep(i, n) printf("%lld%c", mp[P(a.root(i), b.root(i))], " \n"[i == n - 1]);
}

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll h,n;cin>>h>>n;
  rep(i,0,n){
    ll a;cin>>a;h-=a;
  }
  ans1(h<=0);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int a,b,c,ans=0,max,min,mid,abs=0;
  scanf("%d %d %d",&a,&b,&c);
  if(a > b)
    {
      if(c > a)
	{
	  max = c;
	  mid = a;
	  min = b;
	}
      else
	{
	  max = a;
	  if(b > c)
	    {
	      mid = b;
	      min = c;
	    }
	  else
	    {
	      mid = c;
	      min = b;
	    }
	}
    }
  else
    {
      if(c > b)
	{
	  max = c;
	  mid = b;
	  min = a;
	}
      else
	{
	  max = b;
	  if(a > c)
	    {
	      mid = a;
	      min = c;
	    }
	  else
	    {
	      mid = c;
	      min = a;
	    }
	}
    }
  abs = 2 * max - (mid + min);
  if(abs % 2 == 0)
    {
      ans = abs / 2;
    }
  else
    {
      ans = 1 + (abs+1) / 2;
    }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define pii 3.14
#define mod (ll)(998244353)
#define inf (ll)(1e18)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define pi pair<int,int>
#define N (ll)(2e5+5)

void solve()
{
    int x,ans;
    for(int i=1;i<=5;i++)
    {
        cin>>x;
        if(!x)
            ans = i;
    }
    cout<<ans;

}

int main()
{
    fio;
    ll tc = 1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
}


Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define UMap        std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd   ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm   ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    llong abs   ( llong n )          { return ( n < 0 ) ? -n : n; }
    template<class A, class B>inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B>inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    signed call_of_Cthulhu( signed datum ) {

        int a, b;
        read a >> b;
        echo std::max ( a + b, std::max ( a - b, a * b ) ) fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); echo std::fixed << std::setprecision(8); int main_result = Rlyeh::call_of_Cthulhu(114514); return main_result;}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int x, y;
    
    // input
    cin >> x;
    cin >> y;
    
    // will x >= y
    if(x < y){
        int temp = x;
        x = y;
        y = temp;
    }
    
    while(1){
        int rem = x % y;
        if(rem == 0){
            cout << y << endl;
            break;
        }
        x = y;
        y = rem;
    }
    
    return 0;
}


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

dic = {}
for i in range(n):
  str = input()
  if str in dic:
    nowNum = dic.get(str)
    dic[str] = nowNum+1
  else:
    dic[str] = 1

dic_sorted = sorted(dic.items(), key=lambda x:x[1], reverse=True)

answerString = []
answerString.append(dic_sorted[0][0])
nowCnt = dic_sorted[0][1]

for i in range(len(dic_sorted)-1):
  if dic_sorted[i+1][1] == nowCnt:
    answerString.append(dic_sorted[i+1][0])
  else:
    break

last = sorted(answerString)

for result in last:
  print(result)
    

Measured memory_bytes: 113880
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  var h = input[1].split(" ").map(i => parseInt(i));
  var a = input[2].split(" ").map(i => parseInt(i));
  for(var i=0;N/Math.pow(2,i)>0.5;i++){
    var x = i;
  }
  var n = Math.pow(2,x);
  var dp = new Array(Math.pow(2,x)*2-1).fill(0);
  function query(a,b,k,l,r){
    if(r<=a||b<=l){
      return 0;
    }else if(a<=l&&r<=b){
      return dp[k];
    }else{
      var vl=query(a,b,k*2+1,l,(l+r)/2);
      var vr=query(a,b,k*2+2,(l+r)/2,r);
      return Math.max(vl,vr);
    }
  }
  function update(i,x){
    i+=n-1;
    dp[i]=x;
    while(i>0){
      i=Math.floor((i-1)/2);
      dp[i]=Math.max(dp[i*2+1],dp[i*2+2]);
    }
  }
  //dp[h[0]]=a[0];
  var ans=0;
  for(var i=0;i<N;i++){
    var max=0;
    max=query(0,h[i]-1,0,0,n);
    update(h[i]-1,max+a[i]);
    ans=Math.max(ans,max+a[i]);
  }
  console.log('%s', ans);
  return ans;
}
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    vec a(6);
    rep(i, 6) cin >> a[i];
    if(a[4]-a[0] <= a[5]) cout << "Yay!" << endl;
    else cout << ":(" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7700
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main()
{
    char str[1000];
    fgets(str, sizeof(str), stdin);



    if (str[1]=='B')
    {
        printf("ARC\n");
    }
    else
    {
        printf("ABC\n");
    }


    return 0;
}

Measured memory_bytes: 1492
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int n = sc.nextInt();
        if (m > n){
            System.out.println("a > b");
        }else if(m < n){
            System.out.println("a < b");
        }else{
            System.out.println("a == b");
        }
    }
}



Measured memory_bytes: 26320
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a[1000],ans=-1;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    for(int j=0;j<i;j++){
      int t=a[i]*a[j];
      int p=t%10,f=1;
      t/=10;
      while(t){
	if(p-1!=t%10)f=0;
	p=t%10,t/=10;
      }
      if(f)ans=max(ans,a[i]*a[j]);
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3108
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] t = new int[n];
        for (int i = 0; i < n; i++) {
            t[i] = Integer.parseInt(sc.next());
        }
        int m = Integer.parseInt(sc.next());
        for (int i = 0; i < m; i++) {
            int p = Integer.parseInt(sc.next());
            int x = Integer.parseInt(sc.next());
            int temp = t[p - 1];
            t[p - 1] = x;
            System.out.println(Arrays.stream(t).sum());
            t[p - 1] = temp;
        }
    }
}

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

#define _cTime (chrono::system_clock::now())
#define progress (chrono::duration_cast<chrono::milliseconds>(_cTime-_sTime).count())
#define reset _sTime=_cTime
auto reset;

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

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

/*他のライブラリを入れる場所*/
// 2,3,4, 6, 8, 9,10,12,14,15,
// 2,3,4, 0, 2, 3, 4,0,
// 2,5,9,15,23,32,42,
// 2,5,3, 3, 5, 2, 0

// S==0 -> ok
// s==1 -> 4を29997
// s==2 -> 6を29998 (n>=4)
// s==3 -> 6を29997 (n>=4)
// s==4 -> 4を30000 
// s==5 -> 8を29997 (n>=5)
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	if(n==3){
		puta(2,5,63);
		return 0;
	}else if(n==4){
		puta(2,5,20,63);
		return 0;
	}

	int cnt=0;
	vi ans;
	range(i,1,30001){
		if(i%6%2 and i%6%3)continue;
		cnt++;
		ans.push_back(i);
		if(cnt==n) break;
	}
	ll s=sum(ans);
	if(s%6==1) ans[2]=29997;
	if(s%6==2) ans[3]=29998;
	if(s%6==3) ans[3]=29997;
	if(s%6==4) ans[2]=30000;
	if(s%6==5) ans[4]=29997;
	puta(ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
#define REP(i,n) for (int i = 0; i <(n); ++i)
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  string s;
  cin >> s;
  REP(i,s.size()-8){
    cout << s[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <iostream>
using namespace std;
int main(void)
{
  int N;
  cin >> N;
  int data[N];
  for (int i = 0; i < N; i++)
  {
    cin >> data[i];
  }

  int tmp = data[0];
  int count = 1;
  while (true)
  {

    if (tmp == 2)
    {
      cout << count << endl;
      break;
    }
    tmp = data[tmp - 1];
    count++;
    if (count > N)
    {
      cout << -1 << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

bool is_Prime(int n) {
  if(n == 2) return true;
  if(n < 2 || n % 2 == 0) return false;
  for(int i = 3; i*i <= n; i+=2) {
    if(n % i == 0) return false;
  }
  return true;
}

const long long INF = 1LL << 60;
const long long P = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> v;
  long long ans = 1;
  for(int i = 1; i <= n; i++) {
    if(is_Prime(i)) {
      v.push_back(i);
    }
  }
  long long count;
  for(int i = 0; i < v.size(); i++) {
    count = 0;
    int tmp = v[i];
    for(int j = v[i]; j <= n;) {
      count += n / j;
      j = j*tmp;
    }
    ans *= count+1;
    ans %= P;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n,k;
    cin>>n>>k;
    priority_queue<ll> pq,pq1;
    for(int i=0; i<n; i++)
    {
        ll x;
        cin>>x;
        if(x>=0)
        {
            pq.push(x);
        }
        else
        {
            pq1.push(abs(x));
        }
    }
    deque<ll> pos,neg;
    while(pq.size()>0)
    {
        pos.push_back(pq.top());
        pq.pop();
    }
    while(pq1.size()>0)
    {
        neg.push_back(pq1.top());
        pq1.pop();
    }
    ll res=1LL;
    ll mod=1e9;
    mod+=7LL;
    ll nw=pos.size()+(neg.size()-(neg.size()%2));
    if(pos.size()==0 && k%2==1)
    {
        nw=-1;
    }
    if(nw>=k)
    {
        if(k%2)
        {
            k--;
            res=pos.front();
            pos.pop_front();
            res=res%mod;
        }
        while(k>0)
        {
            ll req=1LL;
            ll val;
            if(pos.size()==0)
            {
                req=0;
            }
            else
            {

                val=pos.front();
                pos.pop_front();
                ll val1=1LL;
                if(pos.size()>0)
                {
                    val1=pos.front();
                }
                req=val*val1;
            }
            ll req1=0;
            ll x1;
            if(neg.size()>0)
            {
                x1=neg.front();
                neg.pop_front();
                ll x2=1LL;
                if(neg.size())
                {
                    x2=neg.front();
                }
                req1=x1*x2;
            }
            if(req1>=req)
            {
                k-=2;
                res=(res*(req1%mod))%mod;
                if(neg.size())neg.pop_front();
                if(req!=0)
                {
                    pos.push_front(val);
                }
            }
            else
            {
                k-=2;
                res=res*(req%mod);
                res=res%mod;
                if(pos.size()) pos.pop_front();
                if(req1!=0)
                {
                    neg.push_front(x1);
                }
            }
        }
        cout<<res<<"\n";
    }
    else
    {
        while(k>0)
        {
            ll val=1e18;
            if(pos.size())
            {
                val=pos.back();
            }
            ll val1=1e18;
            if(neg.size())
            {
                val1=neg.back();
            }
            ll req=min(val,val1);
            if(req==val)
            {
                res=res*(req%mod);
                res%=mod;
                k--;
                pos.pop_back();
            }
            else
            {
                res=res*(-1LL*req);
                res=res%mod;
                k--;
                neg.pop_back();
            }
        }
        if(res<0) res+=mod;
        cout<<res<<"\n";
    }
    return 0;
}


Measured memory_bytes: 6484
#include <stdio.h>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
#include <map>
#include <ctime>
#include <cmath>
#include <string.h>
#define inf 0x7fffffff
using namespace std;
struct I
{
    int x,y;
};


int a,b,k,n,m,i,c,d,e,o[2222],l[3][332222],dx[20]={1,0,-1,0},dy[20]={0,1,0,-1},dz[20]={1,-1};

long long x,y,z;
//map <string,int> m;
int j[501060];


//char r[6][50005];
//deque<int> d;
struct P
{
    int x,y,z;
    bool operator<(const P &a)const
    {
            if(x-y!=a.x-a.y)
            return x-y<a.x-a.y;
       return x<a.x;
    }
};
stack<P> s;
double u;
//P u[500000];
vector <int> v[411010];
priority_queue<P> q,q1;
string r,r1;
map<int,int > p;
//A==65
//Z==90

//a==97
bool asd(P a,P b)
{
    return a.x<b.x;
}

int g(int w)
{
    for(int j=3;j*j<=w;j+=2)
        if(w%j==0) return 0;
    return 1;
}

int f(int t,int h)
{

}

int main()
{
    cin>>r;
    for(int t=0;t<r.size();t++)
        o[r[t]]++;
    x=(long long)(r.size())*(r.size()-1)/2;
    for(int t='a';t<='z';t++)
        x-=(long long)o[t]*(o[t]-1)/2;
    x++;
    printf("%lld",x);
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep1c(i, n) for (int i = 1; i <= (int)(n); i++)

using namespace std;

static const int MAX = 10009, NINF = -1000000009;
int N, M, A[10], dp[MAX];
map<int, int> mp;
vector<int> use;

void solve() {
  dp[0] = 0;
  rep1c(i, N) {
    dp[i] = NINF;
    for(const int& j : use) {
      if(i-mp[j]>=0 && dp[i-mp[j]]>=0) dp[i] = max(dp[i], dp[i-mp[j]] + 1);
    }
  }
  int n = N;
  vector<int> res;
  while(n>0) {
    for(const int& j : use) {
      if(n-mp[j]>=0 && dp[n] == dp[n-mp[j]] + 1) {
        res.push_back(j);
        n -= mp[j];
        break;
      }
    }
  }
  for(const int& i : res) cout << i;
  cout << endl;
}

int main() {
  mp[1] = 2;
  mp[2] = 5;
  mp[3] = 5;
  mp[4] = 4;
  mp[5] = 5;
  mp[6] = 6;
  mp[7] = 3;
  mp[8] = 7;
  mp[9] = 6;
  scanf("%d %d", &N, &M);
  rep(i, M) {
    int A;
    scanf("%d", &A);
    use.push_back(A);
  }
  sort(use.begin(), use.end());
  reverse(use.begin(), use.end());
  solve();
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define NIL -1

struct Node{
    int p,l,r;
};

void preParse(vector<Node> &T,int u){
    if(u==NIL){
        return;
    }
    cout<<' '<<u;
    preParse(T,T[u].l);
    preParse(T,T[u].r);
}

void inParse(vector<Node> &T,int u){
    if(u==NIL){
        return;
    }
    inParse(T,T[u].l);
    cout<<' '<<u;
    inParse(T,T[u].r);
}

void postParse(vector<Node> &T,int u){
    if(u==NIL){
        return;
    }
    postParse(T,T[u].l);
    postParse(T,T[u].r);
    cout<<' '<<u;
}

int main(){
    int n;
    cin>>n;
    vector<Node> T(25);
    for(int i=0;i<n;i++){
        T[i].p=T[i].l=T[i].r=NIL;
    }
    for(int i=0;i<n;i++){
        int x,y,z;
        cin>>x>>y>>z;
        if(y!=-1){
            T[x].l=y;
            T[y].p=x;
        }
        if(z!=-1){
            T[x].r=z;
            T[z].p=x;
        }
    }
    int root;
    for(int i=0;i<n;i++){
        if(T[i].p==-1){
            root=i;
        } 
    }

    cout<<"Preorder"<<endl;;
    preParse(T,root);
    cout<<endl;
    
    cout<<"Inorder"<<endl;
    inParse(T,root);
    cout<<endl;

    cout<<"Postorder"<<endl;
    postParse(T,root);
    cout<<endl;
}


Measured memory_bytes: 3100
import java.io.PrintWriter;
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        sc.close();

        if (A<10 && B<10) {
            System.out.println(A*B);
        } else {
            System.out.println("-1");
        }
    }
}


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

#define INF INT_MAX
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

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

	int a,b,c;
	cin >> a >> b >> c;

	if(a == b && b == c){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
   
	return 0;
}


Measured memory_bytes: 256
from functools import lru_cache
N = int(input())
K = int(input())

@lru_cache(None)

def F(N,K):
  assert N>=0
  if N<10:
    if K==0:
      return 1
    if K==1:
      return N
    return 0
  q,r = divmod(N,10)
  ret = 0
  if K>=1:
    ret += F(q,K-1)*r
    ret += F(q-1,K-1)*(9-r)
  ret += F(q,K)
  return ret

print(F(N,K))

Measured memory_bytes: 38896
#include <stdio.h>
int main (){
int max=0,sum=0,k,a[21],i,j;
scanf ("%d",&k);
  for (i=0;i<k;i++){
  scanf ("%d",&a[i]);
  if(max<a[i]){
    max=a[i];
  }
    if (max-1<a[i]){
    sum++;
    }
  }
  
printf ("%d",sum);
return 0;
}

Measured memory_bytes: 128
use std::vec::Vec;

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

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

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let s: String = read();
    let mut ans = 0;
    
    ans = if s == "SUN" {
      7
    } else if s == "MON" {
      6
    } else if s == "TUE" {
      5
    } else if s == "WED" {
      4
    } else if s == "THU" {
      3
    } else if s == "FRI" {
      2
    } else if s == "SAT" {
      1
    }else {
      0
    };

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int n, k;
double x[65], y[65], c[65], r[65];
double eps = 1e-9;

double dist(pair<double, double> p, pair<double, double> q) {
	double xx = (p.first - q.first)*(p.first - q.first);
	double yy = (p.second - q.second)*(p.second - q.second);

	return sqrt(xx + yy);
}

vector<pair<double, double>> circle_circle_intersection(double x1, double y1, double r1, double x2, double y2, double r2) {
	vector<pair<double, double>> ans;
	double d = dist(make_pair(x1, y1), make_pair(x2, y2));
	if (d > r1 + r2) {
		return ans;
	}
	if (x1 == x2 && y1 == y2) {
		ans.push_back(make_pair(x1, y1)); return ans;
	}
	if (d < abs(r1 - r2)) {
		ans.push_back(make_pair(x1, y1)); return ans;
	}

	double a = (r1*r1 - r2*r2 + d*d)/(2*d);
	double h = sqrt(r1*r1 - a*a);


	double x3 = (x2 - x1)*(a/d) + x1;
	double y3 = (y2 - y1)*(a/d) + y1;

	ans.emplace_back(x3 + h*(y2 - y1)/d, y3 - h*(x2 - x1)/d);
	ans.emplace_back(x3 - h*(y2 - y1)/d, y3 + h*(x2 - x1)/d);

	return ans;
}

int check(double t) {
	int ans = 0;
	for (int i = 0; i < n; i++) {
		r[i] = t/c[i];
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			vector<pair<double, double> > pts = circle_circle_intersection(x[i], y[i], r[i], x[j], y[j], r[j]);
			for (auto p: pts) {
				int cnt = 0;
				for (int k = 0; k < n; k++) {
					if (dist(p, make_pair(x[k], y[k])) <= r[k] +eps) cnt++;
				}
				ans = max(ans, cnt);
			}
		}
	}
	

	return ans;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> k;
	if (k == 1) {
		cout << "0\n"; exit(0);
	}
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> c[i];
	}

	double l = 0, r = 100000000;
	while(r-l>=1e-7)
	{
		double mid = (l + r)/2;

		if (check(mid) >= k) {
			r = mid;
		} else {
			l = mid;
		}
	}
	cout << fixed << setprecision(9) << r << '\n'; 

	return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	run()
}

func run() {
	setSpace()
	n, limit := int(readN()), readN()
	dp := make([][]int, n+1)
	// dp[i][sum_w] = v の最大値
	// dp[i][j] = i 番目までの品物を、重さを j 以下になるように選んだときの価値の最大値
	// 品物を選ばない & 品物を選ぶ のふた通りで DP を更新する
	dp[0] = make([]int, limit+1)
	for i := 0; i < n; i++ {
		w, v := readN(), readN()
		dp[i+1] = make([]int, limit+1)
		for sumW := 0; sumW <= limit; sumW++ {
			// まずは普通に品物を選択せずに更新する
			chmax(&dp[i+1][sumW], dp[i][sumW])
			if sumW-w >= 0 {
				// 品物を選択した場合で更新する
				chmax(&dp[i+1][sumW], dp[i][sumW-w]+v)
			}
		}
	}

	fmt.Println(dp[n][limit])
}

func chmax(a *int, b int) {
	if *a > b {
		return
	}
	*a = b
}

// ------以下、ユーティリティ------

var sc = bufio.NewScanner(os.Stdin)

func setSpace() {
	sc.Split(bufio.ScanWords)
}

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

func readN() int {
	n, err := strconv.Atoi(read())
	if err != nil {
		panic(err)
	}
	return n
}


Measured memory_bytes: 81536
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*
int inv[1000001]={0};int invf[1000001]={0};
void findinverse(){
	inv[0]=1;
	inv[1] = 1;
	for(int i = 2; i <=1e6 ; ++i)
		inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
	invf[0]=1;invf[1]=1;
	for(int i=2;i<=1e6;i++){
		invf[i]=invf[i-1]*inv[i]%mod;
	}
}*/
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> orderedMultiset;
int solve()
{
	int n;
	cin>>n;
	int a[n];
	forci(0,n)
		cin>>a[i];
	int sum=0;
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]){
			sum+=abs(a[i]-a[i-1]);
			a[i]=a[i-1];
		}
	}
	cout<<sum<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}



Measured memory_bytes: 5220
import sys
N = int(input())
A = list(map(int, input().split()))
for a in A:
  if a == 0:
    print(0)
    sys.exit()
x = 1
for a in A:
  x = x * a
  if x > 1000000000000000000:
    print(-1)
    sys.exit()
print(x)


Measured memory_bytes: 21636
#include<bits/stdc++.h>
using namespace std;
#define fast {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
typedef long long int ll;
typedef string S;
#define M 1e18
#define AS 250005
#define in(x)  cin>>x
#define in4(w,x,y,z) cin>>w>>x>>y>>z
#define in3(x,y,z) cin>>x>>y>>z
#define o(x)  cout<<x
#define o2(x,y) cout<<x<<' '<<y;
#define o3(x,y,z) cout<<x<<' '<<y<<' '<<z
#define o4(w,x,y,z)cout<<w<<' '<<x<<' '<<y<<' '<<z
#define sp cout<<' '
#define nw cout<<endl
#define rt return
#define fr(i,a,n) for(ll i=a;i<=n;i++)
#define frm(i,a,n) for(ll i=n;i>=a;i--)
#define P pair<ll,ll>
#define vc vector<ll>
#define pb push_back
#define MP map<ll,ll>
bool sortin(const pair<ll,ll> &e,const pair<ll,ll> &f){return (e.first<f.first);}
bool POT(ll x){return x && (!(x&(x-1)));}
ll i,j,k,l,m,n,p,q,r,a,b,c,x,y,z,ts,mn=1e18,mod=1e9+7;
ll ar[AS],br[AS],xr[AS],tem[AS];
int main()
{
    fast;
   in3(x,y,z);
   if(y*z>=x)o("Yes");
   else o("No");
}



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

int main(){
  int i,n,atob=0,btoa=0;
  string s;
  cin >> n >> s;
  for(i=0;i<n;i++){
    if(s[i]=='R') atob++;
  }
  int ans=atob,now;
  for(i=0;i<n;i++){
    if(s[i]=='R') atob--;
    else btoa++;
    now=max(atob,btoa);
    ans=min(ans,now);
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3692
import numpy as np
n = int(input())
D = np.array(list(map(int, input().strip().split())))

if D[0] == 0:
    count = [0] * (len(D)+1)
    max_d = max(D)
    for d in D:
        count[d] += 1

    if count[0] == 1:
        ans = 1
        for i in range(2,max_d+1):
            if count[i] <= 0:
                ans = 0
                break
            ans *= count[i-1]**count[i]

        print(ans%998244353)
    else:
        print(0)
else:
    print(0)

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

long long n, w;

int values[110], weights[110];

int sDP[101][301][101];

int saved;

int dp(short index, int weight, int cnt) {
	int &ret = sDP[index][weight][cnt];
	if (ret != -1) return ret;
	
	if (index == n-1) {
		weight += weights[index];
		cnt++;
		if (weight + cnt*saved > w) {
			return ret = 0;
		} else {
			return ret = values[index];
		}
	}
	
	ret = dp(index+1, weight, cnt);
	if (weight + weights[index] + (cnt+1)*saved <= w) {
		ret = max(ret, dp(index+1, weight + weights[index], cnt+1) + values[index]);
	}
	
	return ret;
}

int main() {
	memset(sDP, -1, sizeof(sDP));
	
	cin >> n >> w;
	cin >> weights[0] >> values[0];
	saved = weights[0];
	weights[0] = 0;
	for (int i = 1; i < n; i++) {
		cin >> weights[i] >> values[i];
		weights[i] -= saved;
	}
	cout << dp(0, 0, 0);
}

Measured memory_bytes: 12288