akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main(){
	string s; cin >> s;
	int len = s.length();
	int flag[1000000] = { 0 };

	REP(i, len){
		flag[(int)s[i]]++;
		if(flag[(int)s[i]] == 2){
			cout << "no" << endl;
			return 0;
		}
	}
	
	cout << "yes" << endl;

	return 0;
}

Measured memory_bytes: 4096
#include <stdio.h>

int main() {
  char c[5];
  scanf("%s", c);
  if((c[0]==c[1] && c[1]==c[2]) || (c[1]==c[2]&&c[2]==c[3])) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int find(int x, auto &pa) { return pa[x] < 0 ? x : pa[x] = find(pa[x], pa); }
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,m ; cin >> n >> m;
    vector<int> pa(n, -1);
    int tot = n;
    while (m--) {
        int u, v; cin >> u >> v; u--, v--;
        int x = find(u, pa);
        int y = find(v, pa);
        if (x == y)
            continue;
        tot--;
        pa[x] += pa[y];
        pa[y] = x;
    }
    cout << tot - 1 << '\n';
}


Measured memory_bytes: 3700
# import bisect
# import copy
import fractions
#import math


# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product

def resolve():
    A, B, C, D = map(int, input().split())
    A = A - 1
    cntA = A - A // C - A // D + A // (C * D // fractions.gcd(C, D))
    cntB = B - B // C - B // D + B // (C * D // fractions.gcd(C, D))
    print(cntB - cntA)


resolve()

Measured memory_bytes: 63980
#include<bits/stdc++.h>
using namespace std;
bool check(string s,string t) {
	for (int i=0;i<s.size()-t.size()+1;i++) {
		bool flag=true;
		for(int j=0;j<t.size();j++){
			if(s[i+j]=='?'||s[i+j]==t[j])continue;
			else flag=false;
		}
		if(flag)return true;
	}
	return false;
}
int main(){
	string s,t; 
	cin>>s>>t;
	if(!check(s,t)){
		cout<<"UNRESTORABLE"<<endl;
		return 0;
	}
	for(int i=0;i<s.size();i++){
		if(s[i]=='?'){
			for(char c='a';c<='z';c++){
				s[i]=c;
				if(check(s,t))break;
			}
		}
	}
	cout<<s<<endl;
	return 0;
}

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

int main(){
  int N,A,B;

  cin>>N>>A>>B;

  if((B-A)%2==0)printf("Alice\n");
  else printf("Borys\n");



  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7,MAX = 1e5;


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()
{
	COMinit();
	int n,k;
	cin >> n >> k;
	for(int i = 1;i<=k;i++)
	{
		cout<<COM(n-k+1,i)*COM(k-1,i-1)%MOD<<endl;
	}
	return 0;
}

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

int main(){
  int n;
  cin>>n;
  int cnt=0;
  for(int i=0;i<n;i++){
    long long x;
    char p;
    cin>>p>>x;
    if(p=='(')cnt+=x;
    else if(p==')')cnt-=x;
    if(cnt<0){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  if(cnt==0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
	ll n;
	cin>>n;
	ll arr[n],max=0,brr[n];
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
		brr[i]=arr[i];
		if(max<arr[i])
		max=arr[i];
	}
	sort(brr,brr+n);
	for(ll i=0;i<n;i++)
	{
		if(arr[i]==max)
		cout<<brr[n-2]<<endl;
		else
		cout<<max<<endl;
	}
	return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}

vi dp;
vp ch;
vi ans,v;
vvi g;
void dfs(int i,int p){
    ll k=lb(dp,v[i]);
    ch.pb(k,dp[k]);
    dp[k]=v[i];
    ans[i]=lb(dp,inf);
    for(ll x:g[i])if(x!=p){
        dfs(x,i);
    }
    P t=ch.back();
    ch.pop_back();
    dp[t.fi]=t.se;
}
int main(){
    ll n;cin>>n;
    v=vi(n);ans=vi(n);
    dp=vi(n,inf);
    rep(i,n)cin>>v[i];
    g=vvi(n);
    rep(i,n-1){
        ll a,b;cin>>a>>b;a--;b--;
        g[a].pb(b);
        g[b].pb(a);
    }
    dfs(0,-1);
    for(ll x:ans)out(x);
}

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

int main(){
    string s,t;
    cin>>s>>t;
    vector<char>vec(s.size()),vek(t.size());
    for(int i=0;i<s.size();i++){
        vec[i]=s[i];
    }
    for(int i=0;i<t.size();i++){
        vek[i]=t[i];
    }
    sort(vec.begin(),vec.end());
    sort(vek.begin(),vek.end());
    reverse(vek.begin(),vek.end());
    for(int i=0;i<s.size();i++){
        s[i]=vec[i];
    }
    for(int i=0;i<t.size();i++){
        t[i]=vek[i];
    }
    if(s<t){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


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

int main(){
	int d,i,ans,d_di;
	while(cin>>d){
		ans = 0;
		for(i = d;i < 600;i += d){
			ans += i*i*d;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        if (S.startsWith("YAKI")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){

  int n,a,b;
  string str;

  cin >>a >> b;
  cout <<(a+b)%24 fin;
  
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 2e5 + 10;
vector<ii> a[N];
struct Node {
  int a, b;
  Node *left, *right;
  int64 maxv;
  int64 delta;
  void update(int64 C) {
    delta += C;
    maxv += C;
  }
  void pushdown() {
    if (!delta) return;
    left->update(delta);
    right->update(delta);
    delta = 0;
  }
  void pushup() {
    maxv = max(left->maxv, right->maxv);
  }
};
Node pool[N << 1], *last = pool;

Node* new_node(int a, int b) {
  Node* cur = last++;
  cur->a = a;
  cur->b = b;
  cur->maxv = cur->delta = 0;
  return cur;
}

Node* build(int a, int b) {
  Node* cur = new_node(a, b);
  if (a + 1 == b) return cur;
  cur->left = build(a, (a + b) / 2);
  cur->right = build((a + b) / 2, b);
  return cur;
}

int A, B;
int64 C;
void update(Node* cur) {
  if (cur->a >= A && cur->b <= B) {
    cur->update(C);
    return;
  }
  cur->pushdown();
  if ((cur->a + cur->b) / 2 > A) update(cur->left);
  if ((cur->a + cur->b) / 2 < B) update(cur->right);
  cur->pushup();
}

int64 query(Node* cur) {
  if (cur->a >= A && cur->b <= B) {
    return cur->maxv;
  }
  int64 ret = -(1LL << 60);
  cur->pushdown();
  if ((cur->a + cur->b) / 2 > A) ret = max(ret, query(cur->left));
  if ((cur->a + cur->b) / 2 < B) ret = max(ret, query(cur->right));
  return ret;
}

int64 dp[N];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  while (m--) {
    int L, R, V;
    scanf("%d%d%d", &L, &R, &V);
    a[R].emplace_back(L, V);
  }
  Node* root = build(0, n + 2);
  for (int i = 1; i <= n + 1; ++i) {
    A = 0; B = i;
    dp[i] = query(root);
    A = i; B = A + 1; C = dp[i];
    update(root);
    for (auto& it : a[i]) {
      A = it.first; B = i + 1; C = it.second;
      update(root);
    }
    // trace(i, dp[i]);
  }
  A = 0; B = n + 1;
  int64 ret = query(root);
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 28416
#include<iostream>
#include<string>
#include<vector>

using namespace std;

void Search1(vector<string>&, int, int, int, int, char);
void Search2(vector<string>&, int, int, int, int, char);

int main(){
  int i, j, h, w, count;
  char c;
  string s;
  vector<string> data;

  while(1){
    cin >> h >> w;
    if(h == 0 && w == 0) break;

    for(i=0; i<h; ++i){
      cin >> s;
      data.push_back(s);
    }

    for(i=0, count = 0; i<h; ++i){
      for(j=0; j<w; ++j){
	if(data[i][j] != '1'){
	  c = data[i][j];
	  Search1(data, i, j, h, w, c);
	  ++count;
	}
      }
    }

    cout << count << endl;
    data.clear();
  }

  return 0;
}

void Search1(vector<string>& data, int i, int j, int h, int w, char c){
  data[i][j] = '1';
  Search2(data, i-1, j, h, w, c);
  Search2(data, i+1, j, h, w, c);
  Search2(data, i, j-1, h, w, c);
  Search2(data, i, j+1, h, w, c);
}

void Search2(vector<string>& data, int i, int j, int h, int w, char c){
  if(i > -1 && i < h && j > -1 && j < w && data[i][j] == c)
    Search1(data, i, j, h, w, c);
}

Measured memory_bytes: 0
//
// Created by Ильдар Ялалов on 28.10.2019.
//

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <assert.h>
#include <string>
#include <stdio.h>
#include <time.h>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e18;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
#define pb push_back
#define eb emplace_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define mp make_pair
#define all(a) a.begin(),a.end()
bool debug = 0;
const int MAXN = 4e5 + 100;
const int LOG = 21;
const int mod = 1e9 + 7;
const int MX = (1e7 + 100) * 1.5;
typedef long long li;
const li MOD = 1000000000949747713ll;

template<class T1, class T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &rhs) {
    out << "( " << rhs.first << " , " << rhs.second << " )";
    return out;
}

ll x[MAXN],y[MAXN];

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

char dc[4] = {'L','R','D','U'};

void solve() {
    int n;
    cin >> n;
    for(int i = 1;i<=n;++i){
        cin >> x[i] >> y[i];
        dout << x[i]<<" "<<y[i]<<endl;
    }
    for(int i=1;i<=n;++i){
        if(((x[i]+y[i])&1) != ((x[1]+y[1])&1)){
            cout << -1;
            return;
        }
    }
    vector<int> vals;
    if((x[1] + y[1])%2==0){
        vals.pb(1);
    }

    for(int i=0;i<=30;++i){
        vals.pb(1<<i);
    }

    reverse(all(vals));

    vector<string> ans;
    for(int i=1;i<=n;++i){
        ll x0 = x[i];
        ll y0 = y[i];


        ll x1,y1;

        string cur;
        for(int d : vals){
            char val;
            for(int j = 0;j < 4;++j){
                ll x = x0 + dx[j] * d;
                ll y = y0 + dy[j] * d;
                if(j == 0 || (abs(x) + abs(y)) <= abs(x1) + abs(y1)){
                    x1 = x;
                    y1 = y;
                    val = dc[j];
                }
            }
            dout <<x1 <<" "<<y1<<endl;
            x0 = x1;
            y0 = y1;
            cur.pb(val);
        }
        ans.pb(cur);
        assert(x0 == 0 && y0 == 0);
    }

    cout << sz(vals)<<"\n";
    for(auto x: vals){
        cout <<x <<" ";
    }
    cout <<"\n";
    for(auto x:ans){
        cout << x <<"\n";
    }

}

signed main() {
#ifdef zxc
    debug = 0;
    freopen("../input.txt", "r", stdin);
    //  freopen("../output.txt", "w", stdout);
#else

#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(20);

    int t = 1;
    while (t--)
        solve();
    if (debug)
        cerr << endl << "time : " << (1.0 * clock() / CLOCKS_PER_SEC) << endl;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define Int long long
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  int N; cin >> N;
  int ans = 0;
  for(int i=1; i<=N; i*=2){ans=i;}
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s=sc.nextLine();
    int n=s.length();
    int cnt=0;
    int max=0;
    for(int i=0;i<n;i++)
    {
      if(s.charAt(i)=='R')
      cnt++;
      else
      {
        max=Math.max(max,cnt);
        cnt=0;
      }     
    }
    max=Math.max(max,cnt);
    System.out.println(max);
  }
}

Measured memory_bytes: 35704
# your code goes her
n,m = map(int,input().split())

if n == 1 and m == 1:
	print(1)
elif [m,n] == [1,2] or [m,n] == [2,1]:
	print(0)
elif m == 1 or n == 1:
	print(max([m-2,n-2]))
else:
	print((m-2)*(n-2))


Measured memory_bytes: 2940
use std::io::*;

mod disjoint_set {
    pub struct DisjointSet {
        parent: Vec<usize>,
        size: Vec<usize>,
    }
    impl DisjointSet {
        pub fn new(n: usize) -> DisjointSet {
            DisjointSet {
                parent: (0..n).collect(),
                size: vec![1; n],
            }
        }
        fn root(&mut self, x: usize) -> usize {
            if x == self.parent[x] {
                x
            } else {
                let tmp = self.parent[x];
                self.parent[x] = self.root(tmp);
                self.parent[x]
            }
        }
        pub fn merge(&mut self, x: usize, y: usize) {
            let x = self.root(x);
            let y = self.root(y);
            if x == y {
                return;
            }
            if self.size[x] > self.size[y] {
                self.size[x] += self.size[y];
                self.parent[y] = x;
            } else {
                self.size[y] += self.size[x];
                self.parent[x] = y;
            }
        }
        pub fn same(&mut self, x: usize, y: usize) -> bool {
            self.root(x) == self.root(y)
        }
    }
}

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let m: usize = itr.next().unwrap().parse().unwrap();

    let mut ds = disjoint_set::DisjointSet::new(n + m + 1);
    for i in 0..n {
        let k: usize = itr.next().unwrap().parse().unwrap();
        for _ in 0..k {
            let l = itr.next().unwrap().parse::<usize>().unwrap() - 1;
            ds.merge(i, n + l);
        }
    }

    let mut ok = true;
    for i in 0..n - 1 {
        if !ds.same(i, i + 1) {
            ok = false;
        }
    }
    if ok {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 8444
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int k = sc.nextInt();
		int max = Math.max(Math.max(a, b), c);
		int sum = max;
		for (int i = 0; i < k; i++) {
			sum *= 2;
		}
		System.out.println(sum - max + a + b + c);
	}
}

Measured memory_bytes: 21588
#include <iostream>

using namespace std ;

int main ()
{
    int n , maxH , cnt ;
    int arr [ 20 ] ;
    while ( cin >> n )
    {
        maxH = 0 ; cnt = 0 ;
        for ( int i = 0 ; i < n ; i++ )
        {
            cin >> arr[ i ] ;
            if ( arr [ i ] >= maxH )
            {
                maxH = arr [ i ] ;
                cnt ++ ;
            }
        }
        cout << cnt << endl ;
    }
}


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

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n);
    map<ll, int> mp;
    for(auto &x : a){
        cin >> x;
        mp[x % 4]++;
    }
    int x = mp[1] + mp[3];
    int y = mp[0];
    int z = mp[2];
    y -= (x - 1);
    if(z > 0 && y >= 1){
        cout << "Yes";
    }else if(z == 0 && y >= 0){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

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


int main() {
	int n;
	cin >> n;
	vector<int> a(n + 1), b(n);
	for (int i = 0; i <= n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) cin >> b[i];
	long long int res = 0;
	for (int i = 0; i < n; i++) {
		int j = min(a[i], b[i]);
		a[i] -= j;
		b[i] -= j;
		res += j;
		int k = min(a[i + 1], b[i]);
		a[i + 1] -= k;
		res += k;
	}
	cout << res << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
using namespace std;
int main() {
	string a, b, c;
	cin >> a >> b >> c;
	a[0] = a[0] - 'a' + 'A';
	b[0] = b[0] - 'a' + 'A';
	c[0] = c[0] - 'a' + 'A';
	cout << a[0] << b[0] << c[0] << endl;
	return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <cstdio>                                               //scanf,printf
#include <algorithm>                                            //max,min
#include <string>                                               //string
#include <cstring>                                              //strlen,strcat
#include <cctype>                                               //isalpha,tolower
#include <cmath>                                                //sqrt,sin
#include <stack>                                                //top,push
#include <queue>                                                //front,push
#include <vector>                                               //push_back,sort
#include <set>                                                  //insert,begin
#include <map>                                                  //insert,find
#include <list>                                                 //push_front,begin
#include <stdio.h>
using namespace std;
#define MAX 1000

int main(){
  int ab[4][4]={0};
  for(int i=1; i<=3; i++){
    for(int j=1; j<=3; j++){
      cin>>ab[i][j];
    }
  }
  
  bool c=true;
  if(ab[1][1]-ab[1][2]!=ab[2][1]-ab[2][2]||ab[2][1]-ab[2][2]!=ab[3][1]-ab[3][2]) c=false;
  
  if(ab[1][2]-ab[1][3]!=ab[2][2]-ab[2][3]||ab[2][2]-ab[2][3]!=ab[3][2]-ab[3][3]) c=false;
  
  if(ab[2][1]-ab[1][1]!=ab[2][2]-ab[1][2]||ab[2][2]-ab[1][2]!=ab[2][3]-ab[1][3]) c=false;
  if(ab[3][1]-ab[2][1]!=ab[3][2]-ab[2][2]||ab[3][2]-ab[2][2]!=ab[3][3]-ab[2][3]) c=false;
  
  if(c) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}
















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

using namespace std;

int N, T[100000+5], X[100000+5], Y[100000+5];

bool can(){
    for(int i = 0; i < N; i++){
        int dis = abs(X[i] - X[i+1]) + abs(Y[i] - Y[i+1]);
        int rem = T[i+1] - T[i] - dis;
        // printf("Move from (%d, %d) to (%d, %d) in %d sec\n", X[i], Y[i], X[i+1], Y[i+1], T[i+1]-T[i]);
        if(rem < 0 || rem%2==1) return false;
    }
    return true;
}

int main(){
    cin >> N;
    T[0] = 0; X[0] = 0; Y[0] = 0; 
    for(int i = 1; i <= N; i++) cin >> T[i] >> X[i] >> Y[i];

    if(can())
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 1408
import Data.List

modeW :: String -> String
modeW ss =
    let dist = (map (\ks -> (head ks, length ks)) . group . sort . words) ss
        maxn = (maximum . map snd) dist
    in concat $ map fst $ filter ((== maxn) . snd) dist

longestW :: String -> String
longestW ss = (snd . maximum . reverse . sort . map (\s -> (length s, s)) . nub . words) ss

main :: IO ()
main = interact $ (++ "\n") . unwords . (\ss -> [modeW ss, longestW ss])

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

int main(){
    long long n, k, q;
    cin >> n >> k >> q;
    vector<long long> ans(n, k);
    vector<long long> a(q);

    for(long long i = 0; i < q; i++){
        cin >> a[i];
        a[i]--;
    }

    for(long long i = 0; i < n; i++){
        ans[i] = ans[i] - q;
    }

    for(long long i = 0; i < q; i++){
        ans[a[i]]++;
    }

    for(long long i = 0; i < n; i++){
        if(ans[i] > 0){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }
    return 0;
}

Measured memory_bytes: 4752
n = gets.to_i
array = gets.split(" ").map(&:to_i)

ans = 0
(n-1).times do |i|
#   p "#{array[i]} #{array[i+1]}"
  if array[i] > array[i+1]
    diff = array[i] - array[i+1]
    array[i+1] += diff
    ans += diff
  end
end

puts ans

Measured memory_bytes: 28060
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    string S;
    cin >> S;
    bool isYes = true;
    for (int i = 1, n = S.size(); i <= n; ++i)
    {
        const char ch = S[i - 1];
        if (i % 2 == 1)
        {
            if (ch == 'L')
            {
                isYes = false; break;
            }
        }
        else
        {
            if (ch == 'R')
            {
                isYes = false; break;
            }
        }
    }
    if (isYes) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

using namespace std;

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

  string s, t;
  cin >> s >> t;
  {
    unordered_map<int,int> seen;
    char alpha = 'a';
    for (size_t i = 0; i < s.size(); ++i) {
      auto it = seen.find(s[i]);
      if (it == seen.end()) {
        seen.emplace(s[i], alpha);
        s[i] = alpha;
        ++alpha;
      } else {
        s[i] = seen[s[i]];
      }
    }
  }
  {
    unordered_map<int,int> seen;
    char alpha = 'a';
    for (size_t i = 0; i < t.size(); ++i) {
      auto it = seen.find(t[i]);
      if (it == seen.end()) {
        seen.emplace(t[i], alpha);
        t[i] = alpha;
        ++alpha;
      } else {
        t[i] = seen[t[i]];
      }
    }
  }
  if (s == t) {
    cout << "Yes\n";
  }else {
    cout << "No\n";
  }
}


Measured memory_bytes: 916
n = int(input())
b = list(map(int,input().split()))

a = [0] * n
a[0] = b[0]

for i in range(n - 1):
    if a[i] > b[i]:
        a[i] = b[i]
    a[i + 1] = b[i]

print(sum(a))

Measured memory_bytes: 38384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
#define INF 0x3f3f3f3f
const int maxn=1e5+10,mod=1e9+7;
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
int n,k,a[maxn];

long long fac[maxn],inv[maxn],finv[maxn],ans;
void init()
{
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<maxn-5;i++)
    {
        fac[i]=fac[i-1]*i%mod;
        inv[i]=(mod-mod/i)*inv[mod%i]%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
long long C(long long n,long long a)
{
    if(n<a||n<0||a<0) return 0;
    return fac[n]*(finv[a]*finv[n-a]%mod)%mod;
}

int main()
{
    #ifdef __LOCAL__
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
    cin>>n>>k;
    _rep(i,1,n)
        cin>>a[i];
    sort(a+1,a+1+n);
    init();
    _rep(i,1,n-k+1)
        ans=(ans-C(n-i,k-1)*a[i])%mod;
    _rep(i,k,n)
        ans=(ans+C(i-1,k-1)*a[i])%mod;
    cout<<(ans+mod)%mod<<endl;
    
    return 0;
}

Measured memory_bytes: 2944
using System;

namespace ABC082A
{
    class Program
    {
        static void Main(string[] args)
        {
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split(' ');
            decimal a = int.Parse(input[0]);
            decimal b = int.Parse(input[1]);

            decimal avg = (a + b) / 2;
            var ans = Math.Ceiling(avg);

            Console.Write(ans.ToString());
        }
    }
}


Measured memory_bytes: 13140
#python3 
g = [[-1 for _ in range(15)] for _ in range(15)]

n = int(input())
for i in range(n):
  m = int(input())
  for j in range(m):
    x,y = map(int, input().split())
    g[i][x-1] = y

ans = 0
for i in range(1<<n):
  honests = [0 for _ in range(n)]
  for j in range(n):
    if (i>>j) &1:
      honests[j] = 1 
  ok = True
  for j in range(n):
    if honests[j]:
      for k in range(n):
        if g[j][k] == -1: continue
        if g[j][k] != honests[k]: ok = False
  if ok:
    ans = max(ans, bin(i).count('1'))

print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {

            int T, X;
            Read2int(out  T,out   X);
            Console.WriteLine((Double)T/(Double)X);


            /*
            var s = Console.ReadLine();
            var K = Readint();
            var dpt1=Enumerable.Repeat(0, s.Length).Select(x => Enumerable.Repeat(0, K + 1).ToArray()).ToArray();
            var dpt2 = Enumerable.Repeat(0, s.Length).Select(x => Enumerable.Repeat(0, K + 1).ToArray()).ToArray();

            dpt1[0][1] = int.Parse(s[0].ToString()) - 1;
            dpt2[0][1] = 1;
            dpt1[0][0] = 1;

            foreach (var i in Enumerable.Range(1,s.Length-1))
            {
                var current = int.Parse(s[i].ToString());
                dpt1[i][0]=1;
                for(int j=1; j<=K;j++)
                {
                    if (current == 0)
                    {
                        dpt1[i][j] += dpt1[i - 1][j];
                        dpt2[i][j] += dpt2[i - 1][j];
                        dpt1[i][j] += dpt1[i - 1][j - 1] * 9;

                    }
                    else
                    {

                        dpt1[i][j] += dpt1[i - 1][j];
                        dpt2[i][j] += dpt2[i - 1][j - 1];
                        dpt1[i][j] += dpt1[i - 1][j - 1] * 9;
                        dpt1[i][j] += dpt2[i - 1][j - 1] * (current - 1);
                    }

                }
            }

            foreach(var i in dpt1)
            {
                Console.WriteLine(i.LJoin());
            }
            Console.WriteLine();
            foreach(var i in dpt2)
            {
                Console.WriteLine(i.LJoin());
            }
 

            Console.WriteLine(dpt1[s.Length-1][K] + dpt2[s.Length-1][K]);
            Console.ReadLine();
           */

        }

        static List<int> Readints()
        {
            return  Console.ReadLine().Split(' ').Select(x =>x.ToInt()).ToList();
        }
        static int Readint()
        {
            return Console.ReadLine().ToInt();
        }
        static void Read2int(out int a,out int b)
        {
            var ints = Readints();
            a = ints[0];
            b = ints[1];
        }    
        static int Max(int a,int b)
        {
            return a > b ? a : b;
        }
        



    }

    static  class extensions
    {
        public static int ToInt(this string s)
        {
            return int.Parse(s);
        }

        public static string LJoin<T>(this IEnumerable<T> list)
        {
            return string.Join(" ",list);
        }


    } 


}


Measured memory_bytes: 11220
#include <iostream>
using namespace std;
int ret[10][110];
int main(){
	ret[0][0]=1;
	for(int i=9;i>=0;i--){//add
		for(int j=8;j>=0;j--){//used
			for(int k=0;k<100;k++){
				if(i+k<=100)	ret[j+1][i+k]+=ret[j][k];
			}
		}
	}
	int n,s;
	while(true){
		cin>>n>>s;
		if(n==0)	return 0;
		cout<<ret[n][s]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define INF (1e18)
ll N,K;
ll A[2010], B[2010];
vector<ll> tree[2010];
ll ans = INF;
ll tt = 0;

void dfs1(ll cur, ll par, ll depth){
    if(depth > K/2) tt++;
    for(auto &e: tree[cur]){
        if(e == par) continue;
        dfs1(e, cur, depth+1);
    }
}

void dfs2(ll cur, ll par, ll depth){
    if(depth > (K-1)/2) tt++;
    for(auto &e: tree[cur]){
        if(e == par) continue;
        dfs1(e, cur, depth+1);
    }
}

int main(){   
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    rep(i,0,N-1){
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
        tree[A[i]].push_back(B[i]);
        tree[B[i]].push_back(A[i]);
    }
    if(K % 2 == 0){
        rep(i,0,N){
            tt = 0;
            dfs1(i, -1, 0);
            ans = min(ans, tt);
        }
        print(ans);
    }else{
        rep(i,0,N-1){
            tt = 0;
            dfs2(A[i], B[i], 0);
            dfs2(B[i], A[i], 0); 
            ans = min(ans, tt);
        }
        print(ans);
    }
}


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

bool hasThree(int x) {
    while (x) {
        if (x % 10 == 3) {
            return true;
        }
        x /= 10;
    }
    return false;
}

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

    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0 || hasThree(i)) {
            cout << " " << i;
        }
    }

    cout << endl;
    return 0;
}



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

#define MAX(X,Y) ((X)>(Y)?(X):(Y))
#define MIN(X,Y) ((X)<(Y)?(X):(Y))
#define ABS(X) ((X)>0?(X):-(X))

int main(void){
  int n,a[128];
  int acc[128];
  int ans;
  
  cin >> n;
  acc[0]=0;
  for (int i=0; i<n; i++){
    cin >> a[i];
    acc[i+1] = acc[i]+a[i];
  }
  ans = acc[n];
  for (int i=0; i<n; i++){
    int l,r;
    l = acc[i];
    r = acc[n]-l;
    ans = MIN(ans, abs(l-r));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
  std.functional, std.container, std.typecons;

void main() {
  auto N = readln.split[0].to!int;
  auto A = readln.split.to!(int[]);
  auto B = readln.split.to!(int[]);

  ulong ans = 0;
  foreach(i; 0..N) {
    int b = B[i];
    int x;
    x = min(A[i], b);
    ans += x;
    A[i] -= x;
    b-= x;
    
    x = min(A[i+1], b);
    ans += x;
    A[i+1] -= x;
    b -= x;
  }
  ans.writeln;
}


Measured memory_bytes: 8776
N = int(input())
A = list(map(int,input().split()))

B = [A[i] for i in range(N) if A[i] >= 0]
C = [A[i]*(-1) for i in range(N) if A[i] < 0]

D = B+C
ans = sum(D)

if len(C) % 2 == 1:
    D.sort()
    ans -= 2*D[0]

print(ans)

Measured memory_bytes: 64784
import numpy as np
N = int(input())
W = [int(j) for j in input().split()]

dif = 1000
for i in range(0, N):
    S_1 = sum(W[:i])
    S_2 = sum(W[i:])
    dif = min([dif, abs(S_1- S_2)])

print(dif)


Measured memory_bytes: 19000
n,z,w = map(int, input().split())
a = list(map(int, input().split()))

dp = [[0]*2 for i in range(n)]
for i in range(n-1, -1, -1):
    # 先手番
    # 後手が持っているカード
    x = a[i-1] if i else w
    # 残りを全部取る時
    dp[i][0] = abs(a[-1] - x)
    # 1枚以上残す時
    for j in range(i+1, n):
        dp[i][0] = max(dp[i][0], dp[j][1])

    # 後手番
    # 先手が持っているカード
    x = a[i-1] if i else z
    dp[i][1] = abs(a[-1]-x)
    # 1枚以上残す時
    for j in range(i+1, n):
        dp[i][1] = min(dp[i][1], dp[j][0])
print(dp[0][0])

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

using namespace std;

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

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

mt19937 rnd(51);

const int N = 55;
vector<pair<int, pair<int, int>>> g[N];
int a[N][N * N], c[N], d[N];
vector<int> ans(N, 1e18);

void fill() {
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N * N; j++) {
			a[i][j] = 1e18;
		}
	}
}

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	fill();
	int n, m, s, mx = 0;
	cin >> n >> m >> s;
	for (int i = 0; i < m; i++) {
		int u, v, a, b;
		cin >> u >> v >> a >> b;
		g[u].pb({ v, {a, b} });
		g[v].pb({ u, {a, b} });
		mx = max(mx, a);
	}
	for (int i = 1; i <= n; i++) {
		cin >> c[i] >> d[i];
	}
	s = min(s, mx * n);
	a[1][s] = 0;
	set<pair<int, pair<int, int>>> st;
	st.insert({ 0, {1, s} });
	while (!st.empty()) {
		auto v = *st.begin();
		st.erase(st.begin());
		for (auto to : g[v.second.first]) {
			if (v.second.second >= to.second.first) {
				if (a[to.first][v.second.second - to.second.first] > v.first + to.second.second) {
					st.erase({ a[to.first][v.second.second - to.second.first], {to.first, v.second.second - to.second.first} });
					a[to.first][v.second.second - to.second.first] = v.first + to.second.second;
					st.insert({ a[to.first][v.second.second - to.second.first], {to.first, v.second.second - to.second.first} });
					ans[to.first] = min(ans[to.first], v.first + to.second.second);
				}
			}
		}
		int pl = d[v.second.first];
		for (int i = v.second.second + c[v.second.first]; i < mx * n; i += c[v.second.first]) {
			if (a[v.second.first][i] > a[v.second.first][v.second.second] + pl) {
				st.erase({ a[v.second.first][i], {v.second.first, i} });
				a[v.second.first][i] = a[v.second.first][v.second.second] + pl;
				st.insert({ a[v.second.first][i], {v.second.first, i} });
			}
			pl += d[v.second.first];
		}
	}
	for (int i = 2; i <= n; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 12596
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
#define BLACK 0
#define WHITE 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main(void) {
    ll N, K;
    cin >> N >> K;
    ll n, m;
    
    n=N/K;
    m=N/(K/2)-n;
    
    ll ans=0;
    if(K%2==0) {
        ans+=m*m*m;
    }
    
    ans+=n*n*n;
    prin(ans);
}


Measured memory_bytes: 256
want = int(input())
due = int(input())
start = int(input())
over = int(input())
e = want - due
yen = 0
if e <= 0:
    for i in range(want):
        yen += start

if e > 0:
    for i in range(due):
        yen += start
    for j in range(e):
        yen += over
print(yen)

Measured memory_bytes: 3064
/*
author: Apoorv Singh
*/

#include <bits/stdc++.h>
using namespace std;

typedef vector <long long> vi;
typedef pair <long long, long long> pii;
#define pb push_back   
#define aint(c) c.begin(), c.end()
#define watch(x) cout << (#x) << " " << (x) << endl;
#define FOR(i, a, b) for (long long i = a; i < b; ++i)
#define FORR(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define int long long
#define inf LLONG_MAX

int modulo = 1e9 + 7;

template <class X>

void printarr(X arr[], int n)
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << " ";
    cout << endl;
}

int fpow(int a, int n)
{
    int ans = 1;
    while (n)
    {
        if (n&1)
            ans = (ans * a)%modulo;
        a = (a*a)%modulo;
        n = n >> 1;
    }
    return ans;
}

/*
const int M = 1e6 + 10;
int composite[M] = {0};

void sieve()
{
    FOR(i,2,M)
    {
        if (!composite[i])
        {
            for (int j = 2*i; j < M; j += i)
                composite[j] = max(composite[j], i);
        }
    }
}
*/

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k; cin >> n >> k;
    double ans = 0;
    FOR(i,1,min(n+1,k))
    {
    	double p = 1.0/n;
    	int x = i;
    	while (x < k)
    	{
    		p /= 2.0;
    		x *= 2;
    	}
    	ans += p;
    }
    if (n >= k)
    	ans += (n-k+1)/((double)n);
   	cout << fixed << setprecision(9) << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  const double PI = acos(-1.0);
  double a,b,x;
  cin >> a >> b >> x;

  x /= a;
  auto f = [&](double t) {
    if (tan(t) <= b/a) return a*b - a*(a*tan(t))/2;
    else return b*(b/tan(t))/2;
  };

  double left = 0, right = PI/2;
  for (int iter = 0; iter < 100; ++iter) {
    double theta = (left + right) / 2;
    if (f(theta) >= x) left = theta;
    else right = theta;
  }
  cout << fixed << setprecision(10) << left*180/PI << endl;

  return 0;
}


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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("8 6");
            //Alice
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("1 1");
            //Draw
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("13 1");
            //Bob
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        int A = wkArr[0];
        int B = wkArr[1];


        var wkList = new List<int>();
        wkList.Add(2);
        wkList.Add(3);
        wkList.Add(4);
        wkList.Add(5);
        wkList.Add(6);
        wkList.Add(7);
        wkList.Add(8);
        wkList.Add(9);
        wkList.Add(10);
        wkList.Add(11);
        wkList.Add(12);
        wkList.Add(13);
        wkList.Add(1);

        int AliceInd = wkList.IndexOf(A);
        int BobInd = wkList.IndexOf(B);

        if (AliceInd < BobInd) Console.WriteLine("Bob");
        if (AliceInd == BobInd) Console.WriteLine("Draw");
        if (AliceInd > BobInd) Console.WriteLine("Alice");
    }
}


Measured memory_bytes: 13280
import java.util.Scanner;

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

        int r = nextInt(sc);
        int D = nextInt(sc);
        int x2000 = nextInt(sc);

        calc(r, D, x2000, 10);
    }

    private static void calc(int r, int D, int xi, int count) {
        if (count == 0) return;

        int xi1 = r * xi - D;
        show(xi1);
        calc(r, D, xi1, --count);
    }

    private static int nextInt(Scanner sc) {
        return Integer.parseInt(sc.next());
    }
    private static void show(Object answer) {
        System.out.println(answer);
    }
}

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

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

  int a ; 
  
  for  (a=1 ; a<=10 ; a++){
   if (a*1000 - N >= 0 && (a-1)*1000 - N < 0 ){
       cout << a*1000 - N  << endl;
   }
    
      
  }
   
  
}


Measured memory_bytes: 3612