akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  	ci(n);
  ll ans=1;
  FOR(i,0,n){
	ll a;
    	ci(a);
    ans=lcm(ans,a);
  }
  co(ans)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,A;
  cin>>H>>A;
  if(H%A==0){
    cout<<H/A<<endl;
  }
  else if(H>A && H%A!=0){
    cout<<H/A+1<<endl;
  }
  else if(H<=A){
    cout<<1<<endl;
  }
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

using namespace std;

int main(){
    int a,b;
    double c,d;
    scanf("%d %d",&a,&b);
    c=static_cast<double>(a);
    d=static_cast<double>(b);
    printf("%d %d %.5f\n",a/b,a%b,c/d);
}




Measured memory_bytes: 2736
// C

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};

int main(){
  int N,P[200000];
  cin>>N;
  for (int i(0);i<N;i++) cin>>P[i];
  int cnt(0),mini(1e9);
  for (int i(0);i<N;i++){
    if (P[i] <= mini){
      cnt++;
    }
    mini = min(mini,P[i]);
  }
  cout<< cnt << endl;
  return 0;
}


Measured memory_bytes: 1024
h,w = [],[]
while True:
	a,b = map(int,input().split())
	if a == 0 and b == 0:
		break
	else:
		h.append(a)
		w.append(b)
for i in range(len(h)):
	if w[i]%2 == 0:
		for k in range(h[i]):
			if k%2 == 0:
				print("#."*(w[i]//2),sep="")
			else:
				print(".#"*(w[i]//2),sep="")
	else:
		for k in range(h[i]):
			if k%2 == 0:
				if w[i]//2 != 0:
					print("#."*(w[i]//2),"#",sep="")
				else:
					print("#")
			else:
				if w[i]//2 != 0:
					print(".#"*(w[i]//2),".",sep="")
				else:
					print(".")
	print("")


Measured memory_bytes: 5656
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
  int s;
  cin >> s;
  set<int> a;
  int m = 1;
  int t = s;
  a.insert(s);

  while(1){
    if(t % 2 == 0) t = t/2;
    else t = 3 * t + 1;
    a.insert(t);
    m++;
    if(a.size() != m) break;
  }
  cout << m << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

class Combination {
   public:
    Combination(int n) {
        fac = new ll[n];
        inv = new ll[n];
        finv = new ll[n];
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        REP(i, 2, n) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    ll cnr(int n, int k) {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

   private:
    ll *fac, *inv, *finv;
};

ll power(ll n, ll p, ll mod) {
    ll ans = 1;
    while (p > 0) {
        if (p & 1) ans = ans * n % mod;
        n = n * n % mod;
        p >>= 1;
    }
    return ans;
}

int main() {
    int K; string S; cin >> K >> S;
    Combination comb(K + S.size());
    
    ll ans = 0;
    REP(i, 0, K + 1) {
        ans += (comb.cnr(i + S.size() - 1, i) * power(25, i, MOD) % MOD) * power(26, K - i, MOD) % MOD;
        ans %= MOD;
    }
    
    cout << ans << endl;
    return 0;
}

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

int main(){
    char x, y;
    cin >> x >> y;
    if((x > y)) cout << '>' << endl;
    else if(x == y) cout << '=' << endl;
    else cout << '<' << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>

int a[101];
int b[101];

void shift_left (int *array, int index, int max)
{
  int i;
  
  for (i=index; i<max; i++) {
    array[i] = array[i+1];
  }
  return;
}

int main()
{
  int cnt;
  int N;
  int i;
  int j;

  cnt = scanf("%d", &N);

  for (i=1; i<=N; i++) {
    cnt = scanf("%d", &a[i]);
  }
  
  j = N;
restart:
  for (i=N; i>0; i--) {
    if (a[i] == 0) continue;
    if (a[i] == i) {
      b[j] = i;
      j--;
      if (j == 0) break;
      shift_left(a, i, (N+1));
      goto restart;
    }
  }
  
  if (j != 0) {
    printf("-1");
    return 0;
  }

  for (j=1; j<=N; j++) {
    printf("%d\n", b[j]);
  }

  return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    ll n, x;
    cin >> n >> x;
    struct test {
        ll b, l, u, maxx;
        ll operator()(ll x) {
            if (x <= b)
                return l * x;
            else
                return l * b + u * (x - b);
        }
        bool operator<(const test &rhs) const { return maxx > rhs.maxx; };
    };
    vector<test> tests;
    ll sumb = 0;
    for (int i = 0; i < n; ++i) {
        ll b, l, u;
        cin >> b >> l >> u;
        sumb -= b * l;
        ll maxx = l * b + u * (x - b);
        test t  = {b, l, u, maxx};
        tests.push_back(t);
    }
    if (sumb == 0) {
        cout << 0 << "\n";
        return 0;
    }
    sort(tests.begin(), tests.end());
    vl cumsum(n, 0);
    cumsum[0] = tests[0].maxx;
    for (int i = 1; i < n; ++i) {
        cumsum[i] = cumsum[i - 1] + tests[i].maxx;
    }
    auto check = [&](ll mid) {
        for (int i = 0; i < n; ++i) {
            ll fullmark = mid / x;
            if (fullmark >= n) {
                return true;
            }
            ll score = sumb + tests[i](mid % x);
            if (fullmark != 0)
                score += cumsum[fullmark - 1];
            if (fullmark - 1 >= i) {
                score -= tests[i].maxx;
                score += tests[fullmark].maxx;
            }
            if (score >= 0)
                return true;
        }
        return false;
    };
    ll ok = n * x;
    ll ng = 0;
    while (abs(ok - ng) != 1) {
        ll mid = (ng + ok) / 2;
        if (check(mid))
            ok = mid;
        else
            ng = mid;
    }
    cout << ok << "\n";
    return 0;
}

Measured memory_bytes: 6512
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;

int main(){
    int res_x,res_y;
    int W,H;
    cin>>H>>W;
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            string str;
            cin>>str;
            if(str=="snuke"){
                res_x=i;
                res_y=j;
            }
        }
    }
    char ans = 'A'+res_y-1;
    cout<<ans<<res_x<<endl;
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
//
//  atcoder.cpp
//
//
//  Created by 中川阿津志 on 2018/12/05.
//
#include <bits/stdc++.h>
#define REP(i, N) for(int i=0; i<N; i++)
using namespace std;

//#include "atcoder.hpp"

long long gcd(long long a, long long b) {
    if (a>b) swap(a,b);
    
    auto r = b % a;
    
    return (r ? gcd(r, a) : a);
}
int main() {
    int N, K;
    
    cin >> N >> K;
    
    REP(i,N){
        int a,b;
    }
    
    cout << ((N+1) / 2 >= K ? "YES" : "NO") << endl;
    
    return 0;
}


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

int main(){
  int H,W;
  cin >> H >> W;
  string S[H];
  rep(i,H){
    cin >> S[i];
  }
  int a[H][W];
  rep(i,H)rep(j,W){
    a[i][j]=-1;
  }
  int dh[4]={0,1,0,-1};
  int dw[4]={1,0,-1,0};
  int cnt=0;
  ll ans=0;
  queue<pii> q;
  rep(i,H)rep(j,W){
    if(a[i][j]==-1){
      ll w=0;
      ll b=0;
      q.push(pii(i,j));
      cnt++;
      a[i][j]=cnt;
      while(!q.empty()){
        pii n=q.front();
        q.pop();
        if(S[n.first][n.second]=='#') b++;
        else w++;
        rep(k,4){
          int nh=n.first+dh[k];
          int nw=n.second+dw[k];
          if(nh>=0 and nh<H and nw>=0 and nw<W){
            if(S[n.first][n.second]!=S[nh][nw] and a[nh][nw]==-1){
              q.push(pii(nh,nw));
              a[nh][nw]=cnt;              
            }
          }
        }
      }
      ans+=b*w;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    string s;
    cin >> n >> k >>s;
    s[k - 1] = tolower(s[k - 1]);
    cout << s << endl;
}

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

#define LL long long
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VB vector<bool>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

const std::string YES = "YES";
const std::string Yes = "Yes";
const std::string NO = "NO";
const std::string No = "No";

bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }

// 4近傍（右, 下, 左, 上）
const std::vector<int> dy = { 0, -1, 0, 1 };
const std::vector<int> dx = { 1, 0, -1, 0 };

using namespace std;


void solve(int W, int N, VI &v, VI &w) {
    VVI dp(N + 1, VI(W + 1, -1));
    dp[0][0] = 0;
    FOR(i, 0, N) {
        int value = v[i];
        int weight = w[i];

        FOR(j, 0, dp[0].size()) {

            if (dp[i][j] == -1) { continue; }

            // not use
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);

            // use
            if (j + weight < dp[0].size()) {
                dp[i + 1][j + weight] = max(dp[i + 1][j + weight], dp[i][j] + value);
            }
        }
    }

    int ans_value = -1;
    int ans_weight = -1;
    FOR(j, 0, W + 1) {
        if (dp[N][j] > ans_value) {
            ans_value = dp[N][j];
            ans_weight = j;
        }
    }
    cout << ans_value << endl;
    cout << ans_weight << endl;
}

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

    int no = 1;
    while (true) {
        int W, N;
        cin >> W;
        if (W == 0) { break; }
        cin >> N;
        vector<int> v(N), w(N);
        FOR(i, 0, N) {
            char dummy;
            cin >> v[i];
            cin >> dummy;
            cin >> w[i];
        }
        cout << "Case " << no++ << ":" << endl;
        solve(W, N, v, w);
    }
    return 0;
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define I(x, a) for(auto x : a)
#define F(i, l, r) for(auto i = l; i < r; ++i)
#define E(i, l, r) for(auto i = l; i <= r; ++i)
#define DF(i, l, r) for(auto i = l; i >= r; --i)
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define ret return
#define cont continue
#define brk break
#define ins insert
#define sz(a) ((int)(a).size())

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

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)1e9 + 7;
const dbl eps = (dbl)1e-8;
const int maxn = (int)2e5 + 5;
const dbl pi = acos(-1);

int a[maxn], b[maxn], c[maxn];
int ans, n;

void calc(int bit) {
	F(i, 0, n) {
		c[i] = (b[i] & ((1 << (bit + 1)) - 1));
	}
	sort(c, c + n);
	int cnt = 0;
	F(i, 0, n) {
		int x = (a[i] & ((1 << (bit + 1)) - 1));
//		if (bit == 2)
//			cout << x << " " << (x & (1 << bit)) << endl;
		if (x & (1 << bit)) {
			if (c[0] + x < (1 << (bit + 1))) {
				auto it = upper_bound(c, c + n, (1 << (bit + 1)) - x - 1);
				while (it >= (c + n) || *it + x >= (1 << (bit + 1)))
					--it;
				cnt += (it - c) + 1;
			}
			if (c[n - 1] + x >= ((1 << (bit + 1)) | ((1 << bit)))) {
				auto it = lower_bound(c, c + n, ((1 << (bit + 1)) | ((1 << bit))) - x);
				cnt += (c + n - it);
			}
		} else {
			if (x + c[n - 1] < (1 << bit))
				cont;
			auto itr = upper_bound(c, c + n, (1 << (bit + 1)) - x - 1);
			while (itr >= (c + n) || *itr + x >= (1 << (bit + 1)))
				--itr;
			auto itl = lower_bound(c, c + n, (1 << bit) - x);
			cnt += (itr - itl) + 1;
		}
//		if (bit == 2)
//			cout << i << " " << cnt << endl;
	}
//	if (cnt != 0)
//		cout << "bit = " << bit << ": " << cnt << endl;
	if (cnt & 1)
		ans |= (1 << bit);
}

int main() {
//    fin("t.in");
    sync;
    cin >> n;
    F(i, 0, n) {
    	cin >> a[i];
    }
    F(i, 0, n) {
    	cin >> b[i];
    }
    ans = 0;
    E(i, 0, 28) {
    	calc(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

struct point{
    ll x,y;
};

static const ll MAX = 90001;
ll dp[MAX]; // cost of min(possible) to i
point pos[MAX];

int main() {
    

    ll h,w,d;
    cin >> h >> w >> d;
    for (ll i=1;i<=h;i++){
        for (ll j=1;j<=w;j++){
            ll a;
            cin >> a;
            point p;
            p.x = i;
            p.y = j;
            pos[a] = p;
        }
    }
    for (ll i=0;i<d;i++){
        dp[i] = 0;
        ll k=1;
        while(i+d*k <= h*w){
            dp[i+d*k] = dp[i+d*(k-1)] + abs(pos[i+d*k].x - pos[i+d*(k-1)].x) + abs(pos[i+d*k].y - pos[i+d*(k-1)].y);
            k++;
        }
    }
    ll q;
    cin >> q;
    for (ll i=0;i<q;i++){
        ll l,r;
        cin >> l >> r;
        cout << dp[r] - dp[l] << endl;
    }

}




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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int64 dx[3] = {0, 1, -1};
int64 dy[3] = {0, 1, -1};
int64 dz[3] = {0, 1, -1};

int64 n, m, p;

int main(void) {
  while (cin >> n >> m >> p && n + m + p) {
    auto f = make_v<int64>(n, n, n);
    auto h = make_v<int64>(n, n);

    auto in = [&](int64 x, int64 y, int64 z) {
      return 0<=x&&x<n&&0<=y&&y<n&&0<=z&&z<n;
    };

    auto check = [&]() {
      REP(i, n) REP(j, n) REP(k, n) {
        REP(a, 3) REP(b, 3) REP(c, 3) {
          int64 x = i, y = j, z = k;
          int64 p = f[x][y][z];;
          int64 cnt = 0;
          if (a + b + c == 0) continue;
          while (in(x, y, z) && f[x][y][z] == p) {
            x += dx[a]; y += dy[b]; z += dz[c];
            cnt++;
          }
          if (cnt >= m && p == 1) return 1;
          if (cnt >= m && p == -1) return -1;
        }
      }
      return 0;
    };

    int64 q = 1;
    bool ok = 1;
    REP(i, p) {
      int64 x, y;
      cin >> x >> y; x--; y--;
      f[x][y][h[x][y]] = q;
      h[x][y]++;
      q *= -1;
      int64 ret = check();
      if (ok && ret == 1) {
        cout << "Black " << i+1 << endl;
        ok = 0;
      } else if (ok && ret == -1) {
        cout << "White " << i+1 << endl;
        ok = 0;
      }
    }
    if (ok) {
      cout << "Draw" << endl;
    }
  }
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F first
#define S second
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define sz size()
#define all(A)    A.begin(), A.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define f0(i,b)   for(int i=0;i<(b);i++)
#define f1(i,b)   for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define mod 1000000007

#define forr(i,n)    for(i=0; i<n; i++)
#define whilee(i,t)  while(i!=t)
#define  sl(a)  scanf("%lld",&a)
#define  pl(a)  printf("%lld",a)

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;

//for(auto it =A.begin(); it!=A.end(); it++)
//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//count(A.begin(), A.end(), X); //counts the occurrences of X
//distance(A.begin(),A.end());  //distance between first to last element
//accumulate(A.begin(), A.end(), 0); //add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//swap(S[0], T[0]);
//scanf("%d",&x);
//printf("%d\n",x);

//vector <int> A;
//deque <int> A;
//queue <int> A;
//stack <int> A;
//set <int> A;
//map <int,int> A;
//pair <int,int> A ;
//vector <pair <int,int>> A ;
//bitset<32> bset1;
//char ch;
//string S, T, U;
ll i, j, k, a, b,  d, f, g, h, l, m, n, p, q, r, s, t, u, v, w, x, y, z, maxx=INT_MIN, minn=INT_MAX, ans=0, sum=0, cnt=0;
double c;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);//NULL
    cout.tie(nullptr);//NULL
    //int A[n];
    //scan(n);
    cin>>n>>x;
    c=(double)n/x;
    printf("%.10lf\n",c);
    //cout<<n<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

// union find
ll union_find_find(ll node, vector<ll> &vec) {
  if (vec[node] == -1)
    return node;
  ll ret = union_find_find(vec[node], vec);
  vec[node] = ret;
  return ret;
}

void union_find_union(ll a, ll b, vector<ll> &vec) {
  ll a_root = union_find_find(a, vec);
  ll b_root = union_find_find(b, vec);
  if (a_root != b_root)
    vec[b_root] = a_root;
}

unordered_map<ll, unordered_set<ll>> dis;
unordered_map<ll, unordered_set<ll>> group;

void solve() {
  ll N, M, K;
  cin >> N >> M >> K;
  vector<ll> uf(N, -1);
  rep (i, M) {
    ll A, B;
    cin >> A >> B;
    A--;
    B--;
    union_find_union(A, B, uf);
    dis[A].insert(B);
    dis[B].insert(A);
  }
  rep (i, K) {
    ll C, D;
    cin >> C >> D;
    C--;
    D--;
    dis[C].insert(D);
    dis[D].insert(C);
  }
  rep (i, N) {
    group[union_find_find(i, uf)].insert(i);
  }
  bool flag = false;
  rep (i, N) {
    ll g = union_find_find(i, uf);
    unordered_set<ll> keep;
    for (auto it: dis[i]) {
      if (group[g].count(it)) {
        keep.insert(it);
        group[g].erase(it);
      }
    }
    if (flag) cout << " ";
    flag = true;
    cout << group[g].size() - 1;
    for (auto it: keep) group[g].insert(it);
  }
  cout << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 41764
#include<bits/stdc++.h>
using namespace std;
void Solve_Case()
{
    /// Brute Force
    int N,M;

    cin >> N >> M;

    vector<int> v(N);

    for(auto &i : v)
        cin >> i;

    vector< pair<int,int> > vp(M);

    for(auto &i : vp)
    {
        cin >> i.second >> i.first;
    }
    sort(v.begin(),v.end());

    sort(vp.begin(),vp.end(),greater< pair<int,int> > ());

    long long sum = 0;
    int j = 0;
     for (auto i : vp)
     {
         int cnt = i.second;
        int val = i.first;
        while(cnt -- && j < N && v[j] <= val)
            v[j] = val , j++;
     }
     for(auto i : v)
        sum += i;

     cout << sum;
}
int main()
{
    int TestCases = 1;
    //cin >>  TestCases;
   while(TestCases--)
   {
       Solve_Case();
   }
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int h[100000];
int main() {
	int n;
	cin >> n;
	vector < int > dp(n+3,1e9);
	dp[0]=0;
	for (int i=0;i<n;i++) {
		cin>>h[i];
	}
	for(int i=0;i<n;i++) {
		dp[i+1]=min(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
		dp[i+2]=min(dp[i+2],dp[i]+abs(h[i]-h[i+2]));
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>


#define rep(i,p,q) for(int i = p;i < q;++i)
#define ll long long

using namespace std;

/*
//E
ll d[300000];
int main(void) {
	ll n, m;
	cin >> n >> m;
	vector<vector<ll>> edge = vector<vector<ll>>(3 * n);
	rep(i, 0, m) {
		ll u, v;
		cin >> u >> v;
		rep(j, 0, 3) {
			ll u0 = (u - 1)*3;
			ll v0 = (v - 1)*3;
			edge[u0 + j].push_back(v0 + (1+j) % 3);
		}	
	}
	ll s, t;
	cin >> s >> t;
	s = (s-1)*3;
	t = (t-1)*3;
	rep(i, 0, 300000) {
		d[i] = 1e8;
	}
	d[s] = 0;
	queue<ll> q = queue<ll>();
	q.push(s);
	ll ans = -1;
	while (q.size() > 0) {
		ll v = q.front();
		q.pop();

		for (auto& nv : edge[v]) {
			if (d[nv] > d[v] + 1) {
				d[nv] = d[v] + 1;
				if (nv == t) break;
				q.push(nv);
			}
		}
		if (d[t] != 1e8) {
			ans = d[t] / 3;
			break;
		}

	}
	
	cout << ans << endl;
}
*/


//D

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void) {
	COMinit();
	ll n, k;
	cin >> n >> k;
	rep(i, 1, k + 1) {
		if (n - k + 1 >= i) {
			cout << COM(n - k + 1, i) * COM(k - 1, i - 1) % MOD << endl;
		}
		else cout << 0 << endl;
	}
}

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

#define ran 201101

int n;
int a[ran];

int main() {
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	if (a[1]>0) {
		cout<<-1<<endl;
		return 0;
	}
	
	long long ans=0LL;
	int lim = 0;
	for(int i=n;i>0;i--) {
		if (a[i] > lim) {
			ans += a[i];
			lim = a[i];
		} else if (a[i] < lim) {
			cout<<-1<<endl;
			return 0;
		}
		
		lim--;
		if (lim<0) lim = 0;
	}
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 1024
S = input()
Q = int(input())
queries = []
for i in range(Q):
    query = [x for x in input().split()]
    query[0] = int(query[0])
    if query[0] == 2:
        query[1] = int(query[1])
    queries.append(query)

former = []
latter = []
is_normal = True
for query in queries:
    if query[0] == 1:
        is_normal = not is_normal
    
    else:
        if is_normal and query[1] == 1:
            former.append(query[2])
        elif not is_normal and query[1] == 1:
            latter.append(query[2])
        elif is_normal and query[1] == 2:
            latter.append(query[2])
        elif not is_normal and query[1] == 2:
            former.append(query[2])

if is_normal:
    ans = "".join(former[::-1]) + S + "".join(latter)
else:
    ans = "".join(latter[::-1]) + S[::-1] + "".join(former)

print(ans)
    


Measured memory_bytes: 29828
#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            line.pop();
            line
        }
    )
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let iter = line.split_whitespace();
            iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    )
}

fn solve(a:i32, b:i32, c:i32, d:i32) -> bool {
    if (a-c).abs() <= d {
        return true
    }

    if (a-b).abs() <= d && (b-c).abs() <= d{
        return true
    }

    false
}

fn main() {
    let (a,b,c,d) = parse_line!(i32, i32,i32,i32);

    println!("{}", if solve(a,b,c,d) { "Yes" } else { "No"});
}

fn solve_test() {
    assert_eq!(solve(4,7,9,3), true);
    assert_eq!(solve(100,10,1,2), false);
    assert_eq!(solve(10,10,10,1), true);
    assert_eq!(solve(1,100,2,10), true);
}


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

using namespace std;

int main(){

    string a,b,r;
    char resposta[30];
    int x,y;

    cin >> a >> b;
    r=a+b;
      
    for(int i=0;i<r.size();i++){
        resposta[i] = r.at(i);
    }
    resposta[r.size()] = '\0';

    x=atoi(resposta);
    y=sqrt(x);

    if(x%y==0){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 256
// HTTF.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include "bits/stdc++.h"
//実装が重そうな問題はある程度考えてから書く
//初期化を忘れずに（特に二分探索とか）
//コーナーケースを考えて（特に場合分けとか）
//不可解すぎるバグは配列外参照（配列の長さ）を検討

#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define int LL
#define pb emplace_back
#define eb pb

using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef long long LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr, Vpr, greater<pr> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5 * 1e5 + 1000;
const int SIZE2 = 2010;
const int SIZE3 = 400;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p = 7 + 1e9;
const ld INF = 1e18;
const long double EPS = 1e-7;
typedef pair<ld, ut> pld;
ut N, M, K, X, L, Y, Q, D;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;
VI edges[SIZE];
LL vals[SIZE], maps2[SIZE2][SIZE2], answer = zero;
LL maps[SIZE2][SIZE2];
LL A[SIZE],B[SIZE];
LL solve2(int now, int from) {
	LL ans = 0;
	VI v;
	for (auto next : edges[now]) {
		if (next != from)
			v.pb(solve2(next, now)+1);
	}
	if (v.empty()) return 0;
	LL st = 0;
	sort(ALL(v));
	ans = v[0];
	FOR(i, 1, v.size()) {
		ans = max(ans + 1, v[i]);
	}
	return ans;
}
LL solve() {
	cin >> N;
	EFOR(i, 2, N) {
		cin >> A[i];
		edges[A[i]].pb(i);
	}
	cout <<solve2(1, -1) << endl;
	return 0;
}
signed main() {
	solve();
	cin >> N;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 29696
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>
#include<bitset>
#include<stack>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> lltpl;

int dy8[8] = { 2,2,-2,-2,1,1,-1,-1 };
int dx8[8] = { 1,-1,1,-1,2,-2,2,-2 };
int dx4[4] = { 1,0,0,-1 };
int dy4[4] = { 0,1,-1,0 };


/******************************************************************************************/


const int IINF = 1e9 + 7;
const ll LINF = LLONG_MAX;
constexpr ll MOD = 1e9 + 7;



template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}

// vector
template <typename T>
istream& operator>>(istream & is, vector<T> & vec) { for (T& x : vec) is >> x; return is; }
// pair
template <typename T, typename U>ostream& operator<<(ostream & os, pair<T, U> & pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; }
// vector
template <typename T>ostream& operator<<(ostream & os, const vector<T> & vec) { os << "{";	for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : ", "); }os << "}"; return os; }
// map
template <typename T, typename U>ostream& operator<<(ostream & os, map<T, U> & map_var) { os << "{";	repi(itr, map_var) { os << *itr; itr++; if (itr != map_var.end()) os << ", "; itr--; }os << "}"; return os; }
// set
template <typename T>ostream& operator<<(ostream & os, set<T> & set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; }os << "}"; return os; }



int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n, k;
	cin >> n >> k;
	ll ans = 1;
	for (int i = 0; i < n; i++)
	{
		ans *= k;
		ans %= MOD;
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3160
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int x, y;
        cin >> x >> y;

        if (x == 1 && y == 1) {
            cout << 1000000 << endl;
            return;
        } else {
            Int a = max(0ll, 4 - x);
            Int b = max(0ll, 4 - y);
            Int ans = 100000 * (a + b);
            cout << ans << endl;
        }

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
//        MaximumProfit.solve();
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        int n = Integer.parseInt(line);

        int[] r = new int[n];
        for (int index = 0; index < n; index++){
            line = scanner.nextLine();
            r[index] = Integer.parseInt(line);
        }

        int maxDiff = r[1] - r[0];
        int minR = r[0];
        for (int t = 1; t < n; t++) {
            int diff = r[t] - minR;
            maxDiff = max(maxDiff, diff);
            minR = min(minR, r[t]);
        }
        System.out.println(maxDiff);
    }

    private static int min(int x, int y) {
        return x < y ? x : y;
    }

    private static int max(int x, int y) {
        return x < y ? y : x;
    }
}



Measured memory_bytes: 166564
/* https://atcoder.jp/contests/abc090/tasks/arc091_a */

#include <iostream>
#include <algorithm>

long long N, M;

long long solve()
{
  if (N == 1 && M == 1) {
    return 1;
  }

  if (N == 1) {
    return M-2;
  }

  return (N-2)*(M-2);
}

int main(int argc, char *argv[])
{
  // Input
  long long n, m;
  std::cin >> n >> m;

  N = std::min(n, m);
  M = std::max(n, m);

  // Output
  std::cout << solve() << std::endl;

  return 0;
}


Measured memory_bytes: 256
toInt :: (String -> Int)
toInt x = read x ::Int

main = do
    x <- getLine
    let [l, r] = (map$toInt)$words x

    let
        distl = l `mod` 2019
        distr = r `mod` 2019

    print $ if (r `div` 2019) - (l `div` 2019) >= 1
        then
            0
        else
            minimum [x * y `mod` 2019 | x <- [distl..distr - 1], y <- [distl + 1..distr]]


Measured memory_bytes: 1148
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int n = 100;
        /*
        long n = long.Parse(Console.ReadLine());
        long[] input = new long[5];
        for(int a = 0; a < 5; a++)
        {
            input[a]=long.Parse(Console.ReadLine());
        }
        */
        //int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        string input= Console.ReadLine();
        string boin = "aiueo";
        Console.WriteLine(boin.Contains(input)?"vowel": "consonant");


        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法
 
        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();

    }
}

Measured memory_bytes: 11092
import numpy as np

N = int(input())
N_original = N
N_a_m = int(np.floor(N**(0.5)))


for i in range(1,N_a_m+1):
    j = N_a_m+1 - i
    if N%j == 0:
        N_A = j
        break


    
N_B = len(str(int(N_original/N_A)))
        
print(N_B)

Measured memory_bytes: 13124
a,b,c,x,y = map(int,input().split())
cx,cy = 0,0
ans = 0

a1 = a*x+b*y
if x<y:
    a2 = 2*c*x + b*(y-x)
else:
    a2 = 2*c*y + a*abs(y-x)
a3 = c*max(x,y)*2
print(min([a1,a2,a3]))


Measured memory_bytes: 38384
import itertools
a = int(input())
e = range(1, a + 1, 1)
b = list(itertools.combinations(e, 2))
for i, item in enumerate(b):
    if sum(x % 2 == 0 for x in item) != 1:
        del b[i]
    elif sum(x % 2 != 0 for x in item) != 1:
        del b[i]
print(len(b))


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define FOR(i, n) for(ll i = 0; i < n; i++)
#define FORR(i, n) for(ll i = n; i >= 0; i--)
#define FORS(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) accumulate(v.begin(),v.end(),0)
#define SORT(v) sort(v.begin(),v.end())
#define OUT(n) (cout << n << endl)
#define IN1(a) (cin >> a)
#define IN2(a,b) (cin >> a >> b)
#define IN3(a,b,c) (cin >> a >> b >> c)
#define IN4(a,b,c,d) (cin >> a >> b >> c >> d)
#define REVS(v) reverse(v.begin(),v.end())
#define PI 3.14159265359
using namespace std;
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  int n;
  IN1(n);
  vector<int>aarray(n);
  FOR(i,n){
    cin >> aarray.at(i);
  }
  int ans=0;
  FORS(i,1,n-1){
    if (((aarray[i-1] > aarray[i]) && (aarray[i] > aarray[i+1])) || ((aarray[i-1] < aarray[i]) && (aarray[i] < aarray[i+1]))){
      ans++;
    }
  }
  OUT(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<c-(d-b)<<" "<<d+(c-a)<<" "<<a-(d-b)<<" "<<b+(c-a)<<endl;
}


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

int f(std::vector<int> w) {
    int l = 0;
    int r = w.size() - 1;

    int sum_l = w[l];
    int sum_r = w[r];
    while (l + 1 < r) {
        if (sum_l <= sum_r) {
            l++;
            sum_l += w[l];
        } else {
            r--;
            sum_r += w[r];
        }
    }
    return std::abs(sum_l - sum_r);
}

int main() {

    int n;
    std::cin >> n;

    std::vector<int> w;
    for (int i = 0; i < n; i++) {
        int tmp;
        std::cin >> tmp;
        w.push_back(tmp);
    }

    int result = f(w);
    std::cout << result << std::endl;

    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#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=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const int N = 200010;
ll n, ans[N];
int c[N], sz[N];
VI e[N];

void dfs(int now, int past, map<int, ll> &mp){
    sz[now] = 1;
    for (int next : e[now]){
        if (next == past) continue;
        map<int, ll> mp_next;
        dfs(next, now, mp_next);
        sz[now] += sz[next];
        ll x = sz[next] - mp_next[c[now]];
        ans[c[now]] -= x * (x + 1) / 2;
        if (mp.size() < mp_next.size()) mp.swap(mp_next);
        for (auto tmp : mp_next){
            mp[tmp.first] += tmp.second;
        }
    }
    mp[c[now]] = sz[now];
}

int main(void){
    cin >> n;
    REP(i,n) c[i] = in() - 1;
    REP(i,n-1){
        int u = in() - 1, v = in() - 1;
        e[u].push_back(v);
        e[v].push_back(u);
    }
    map<int, ll> mp;
    REP(i,n) ans[i] = n * (n + 1) / 2;
    dfs(0, -1, mp);
    REP(i,n){
        ll x = n - mp[i];
        ans[i] -= x * (x + 1) / 2;
    }
    REP(i,n) printf("%lld\n", ans[i]);
    return 0;
}


Measured memory_bytes: 70976
import Base.parse
import Base.StringVector

parse(::Type{String},  str::AbstractString) = str

isdelim(x::UInt8, xs::Set{UInt8}) = x in xs

function myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}
    out = StringVector(0)
    c::UInt8 = 0x00
    while !eof(s)
        c = read(s, UInt8)
        if !isdelim(c, delims)
            break
        end
    end
    push!(out, c)
    if eof(s)
        return out
    end
    while !eof(s)
        c = read(s, UInt8)
        if isdelim(c, delims)
            break
        end
        push!(out, c)
    end
    return out
end

delimset = Set([0x0a, 0x20])

function readword(io::IO = stdin, delims = delimset)::String
    word = myreaduntil(io, delims)
    i = length(word)
    if i == 0 || word[i] != 0x0a
        return String(word)
    elseif i < 2 || word[i-1] != 0x0d
        return String(resize!(word,i-1))
    else
        return String(resize!(word,i-2))
    end
end

pread(ty) = parse(ty, readword())

reads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)

readvec(tys::Tuple , len::Signed)::Vector{Tuple{tys...}} = @inbounds Tuple{tys...}[reads(tys...) for i in 1:len]

readvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]

function readmat(ty::Type, s...)::Matrix{ty}
    v = Matrix{ty}(undef, s...)
    @inbounds for i = 1:s[1]
        v[i,:] = readvec(ty, s[2])
    end
    v
end

function main()
    N = readline()
    println('7' in N ? "Yes" : "No")
end

main()


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

int digit_sum(int n, int base = 10) {
    int res = 0;
    while (n > 0) res += n % base, n /= base;
    return res;
}

int main() {
    int n; cin >> n;
    bool ok = n % digit_sum(n) == 0;
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
# https://www.youtube.com/watch?v=ENSOy8u9K9I&feature=youtu.be
# https://twitter.com/tempura_cpp/status/1259483252919635969

n, k = gets.to_s.split.map{|e|e.to_i}
a = [0].concat gets.to_s.split.map{|e|e.to_i}

cur = 1
while k > 0

  cur = a[cur] if k[0] == 1
  
  # a = Array.new(n+1){ |i| a[a[i]] }
  a = a.map{|t| a[t] }
  
  k >>= 1
end

puts cur

Measured memory_bytes: 82532
#include<bits/stdc++.h>
using namespace std;
#define fo(a,b,c) for(int a=b;a<=c;a++)
#define go(a,b,c) for(int a=b;a>=c;a--)

typedef long long ll;
const int maxn = 1e5+200;

int a[maxn];

int main(){
    ll n;cin>>n;
    if(n%2){
        ll tmp=n/2;
        cout<<tmp*n<<endl;
    }
    else{
        ll tmp=n-1;
        ll cnt=tmp/2*(n-1);
        cout<<cnt+tmp<<endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
	int w,a,b,ans;
	scanf("%d%d%d",&w,&a,&b);
	if(a<=b && b<=(a+w))ans=0;
	else if(a+w<b) ans = b-a-w;
	else ans=a-b-w;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<vector>

using namespace std;

int N, M;

vector<int> Adj[100005];

int X[100005], Y[100005], Z[100005];

int used[100005];

void VISIT(int K) {
	used[K] = 1;

	for (int i = 0; i < (int)Adj[K].size(); i++) {
		int y = Adj[K][i];
		if (used[y] == 0) { VISIT(y); }
	}
}

int main(void) {

	cin >> N >> M;

	for (int i = 1; i <= M; i++) {
		cin >> X[i] >> Y[i] >> Z[i];
	}

	for (int i = 1; i <= M; i++) {
		Adj[X[i]].push_back(Y[i]);
		Adj[Y[i]].push_back(X[i]);
	}


	int ans = 0;

	for (int i = 1; i <= N; i++) {
		if (used[i] == 0) {
			ans++;
			VISIT(i);
		}
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;

int hex(char x) {
  if (x <= '9') {
    return x - '0';
  } else {
    return x - 'A' + 10;
  }
}

int main() {
  char x, y; cin >> x >> y;
  int a = hex(x);
  int b = hex(y);
  if (a < b) cout << "<" << endl;
  if (a == b) cout << "=" << endl;
  if (a > b) cout << ">" << endl;
  return 0;
}

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

int main(){
    long long N;
    cin >> N;
    long long a[N+1];
    long long multi=0;
    long long i;
    for(i=1; i<=N; i++){
        cin >> a[i];
        multi = multi^a[i];
    }
    for(i=1; i<=N-1; i++){
        cout << (multi^a[i]) << " ";
    }
    cout << (multi^a[N]) << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 5252