akhauriyash/Code-Regression huggingface dataset:
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define NL << endl

using namespace std;
using ll = long long;
using ull = unsigned long long;
const int INTMAX = numeric_limits<int>::max();
const int INTMIN = numeric_limits<int>::min();
const ll LLMAX = numeric_limits<long long>::max();
const ll LLMIN = numeric_limits<long long>::min();
const int MOD = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

using namespace std;

signed main() {
	string s, t;
	cin >> s >> t;
	int rep[300] = { 0 };
	bool b[300] = { 0 };
	for (int i = 0; i < s.size(); i++) {
		rep[s[i]] = t[i];
	}
	for (int i = 0; i < s.size(); i++) {
		if (rep[s[i]] != t[i]) goto fail;
	}
	for (int i = 'a'; i <= 'z'; i++) {
		if (rep[i]) {
			if (b[rep[i]]) goto fail;
			else b[rep[i]] = true;
		}
	}


	cout << "Yes" NL;
	return 0;

fail:
	cout << "No" NL;

	return 0;

}



Measured memory_bytes: 776
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
signed main(){
  int a;
  cin>>a;
  vector<string> b(a);
  vector<int> c(a);
  rep(i,a)
    cin>>b[i]>>c[i];
  string d;
  cin>>d;
  int e=0;
  bool f=false;
  rep(i,a){
    if(f)
      e+=c[i];
    if(d==b[i])
      f=true;
  }
  cout<<e<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstdio>
template<int BUFSIZE>
struct ans_buf {
  char buf[BUFSIZE];
  int i;
  ans_buf(): i(0) {}
  void putZ(unsigned int v, char delim='\n') {
    unsigned int k = 1;
    while(k <= v/10) k*=10;
    for(; k>0; v%=k, k/=10) buf[i++] = (v/k)+'0';
    buf[i++] = delim;
  }
  void out() { std::fwrite(buf, 1, i, stdout); }
};
char inbuf[1<<17];
unsigned int getZ() {
  unsigned int v = 0; int c;
  while((c = getchar_unlocked()) >= '0') v=v*10+c-'0';
  return v;
}

int const MAXN = 3e5;
int const MAXA = 6.4e5;
int N, m[MAXN], d[MAXN+1];

int main() {
  std::setvbuf(stdin, inbuf, _IOFBF, sizeof inbuf);
  N = getZ();
  std::fill_n(m, N, 0);
  for(int i = 0; i < N; ++i) ++m[getZ()-1];
  std::fill_n(d, N+1, 0);
  for(int i = 0; i < N; ++i) ++d[m[i]];
 
  ans_buf<MAXA> buf;
  int sum_D = 0, sum_iD = N, k = 1;
  for(int ans = N; ans >= 1; --ans) {
    sum_D += d[ans];
    sum_iD -= d[ans]*ans;
    int next_k = sum_iD/ans + sum_D + 1;
    for(int i = k; i < next_k; ++i) buf.putZ(ans);
    k = next_k;
  }
  while(k <= N) { buf.putZ(0); ++k; }
  buf.out();
  return 0;
}



Measured memory_bytes: 3968
#include<stdio.h>

int main(){
  int a, b, c;
  int temp;
  
  scanf("%d %d %d", &a, &b, &c);

  if(a > b){
    temp = a;
    a = b;
    b = temp;
  }

  if(b > c){
    temp = b;
    b = c;
    c = temp;
  }

  if(a > b){
    temp = a;
    a = b;
    b = temp;
  }

  printf("%d %d %d\n", a, b, c);

  return 0;
}


Measured memory_bytes: 2048
#include <stdio.h>
int main (){
  int a[11],i,sum=0,k,kw=0;
  scanf ("%d",&k);
  for (i=0;i<k;i++){
  scanf ("%d",&a[i]);
  sum=sum+a[i];
  }
   for (i=0;i<k;i++){
  if(a[i]+1 > sum-a[i]){
  kw++;
    break;
  }
  } 
  if (kw==0){
  printf ("Yes");
  }
  else {
  printf ("No");
  }
return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <typeinfo>

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REP1(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREP1(i, x) for (int i = ((int)(x)); i > 0; i--)
/*
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

#define all(x) (x).begin(),(x).end()
*/

using namespace std;

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

    stack<int> s;

    string x;
    while (cin >> x)
    {
        if (x[0] == '+')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(b + a);
        }
        else if (x[0] == '-')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(b - a);
        }
        else if (x[0] == '*')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(b * a);
        }
        else
        {
            s.push(stoi(x));
        }
    }
    cout << s.top() << endl;
}


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

bool check( vector<int> hai, int cnt ) {

  if ( cnt == 0 ) return true;

  for ( int i = 0; i < 9; i++ ) {
    if ( hai[i] >= 3 ) {
      hai[i]-=3;
      if ( check( hai, cnt-1 ) ) return true;
      hai[i]+=3;
    }
  }

  for ( int i = 0; i < 7; i++ ) {
    if ( hai[i] * hai[i+1] * hai[i+2] != 0 ) {
      hai[i]--;
      hai[i+1]--;
      hai[i+2]--;
      if ( check( hai, cnt-1 ) ) return true;
      hai[i]++;
      hai[i+1]++;
      hai[i+2]++;
    }
  }

  return false;

}

int main() {

  while(true) {

  vector<int> hai;
  for ( int i = 0; i < 9; i++ ) {
    hai.push_back(0);
  }

  for ( int i = 0; i < 13; i++ ) {
    char input;
    cin >> input;
    if ( cin.eof() ) return 0;
    hai[input-'1']++;
  }

  bool flag = true;
  for ( int i = 0; i < 9; i++ ) {

    if ( hai[i] < 4 ) {
      hai[i]++;

      for ( int j = 0; j < 9; j++ ) {

	if ( hai[j] >= 2 ) {
	  hai[j] -= 2;

	  if ( check( hai, 4 ) ) {
	    if ( flag == false ) {
	      cout << " ";
	    }
	    cout << i+1;
	    flag = false;
	    hai[j] += 2;
	    break;
	  }

	  hai[j] += 2;

	}

      }

      hai[i]--;

    }

  }

  if ( flag ) cout << "0";
  cout << endl;

  }

  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int D;
vector<vector<int>> s(366,vector<int>(26));
vector<int> c(26);
vector<int> last(26,0);
vector<int> t(366,-1);

int calc_down(int d){
  int ans=0;
  for(int i=0;i<26;i++){
    ans+=c.at(i)*(d-last.at(i));
  }
  return ans;
}

int calc(int d,int now){
  int ans=s.at(d).at(now);
  int tmp=last.at(now);
  last.at(now)=d;
  ans-=calc_down(d);
  last.at(now)=tmp;
  return ans;
}

int calc_change(int d,int q){
  int old=t.at(d);
  int ans=s.at(d).at(q)-s.at(d).at(old);

  int old_l=0;
  int old_r=D+1;
  for(int i=1;i<d;i++)  if(t.at(i)==old)  old_l=i;
  for(int i=D;i>d;i--)  if(t.at(i)==old)  old_r=i;
  int now_l=0;
  int now_r=D+1;
  for(int i=1;i<d;i++)  if(t.at(i)==q)  now_l=i;
  for(int i=D;i>d;i--)  if(t.at(i)==q)  now_r=i;
  //cout << "old  " << old_l << " " << old_r << endl;
  //cout << "now  " << now_l << " " << now_r << endl;
  ans+=c.at(q)*(d-now_l)*(now_r-d);
  ans-=c.at(old)*(d-old_l)*(old_r-d);
  return ans;
}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  cin >> D;
  for(int i=0;i<26;i++) cin >> c.at(i);
  for(int i=1;i<D+1;i++){
    for(int j=0;j<26;j++) cin >> s.at(i).at(j);
  }

  int total_v=0;
  for(int i=1;i<D+1;i++){
    int tmp_ma=-1e9;
    int tmp_t=-1;
    for(int j=0;j<26;j++){
      int tmp=calc(i,j);
      if(tmp>tmp_ma){
        tmp_ma=tmp;
        tmp_t=j;
      }
    }
    t.at(i)=tmp_t;
    last.at(t.at(i))=i;
    total_v+=s.at(i).at(t.at(i));
    total_v-=calc_down(i);
  }
  //for(int i=1;i<D+1;i++)  cout << t.at(i)+1 << endl;
  //cout << total_v << endl;

  clock_t start=clock();
  while(1){
    clock_t end=clock();
    double time=(double)(end-start)/CLOCKS_PER_SEC;
    //cout << time << endl;
    if(time>1.5)  break;

    int d=rand()%D+1;
    int q=rand()%26;

    int tmp=calc_change(d,q);
    //cout << tmp << endl;
    if(tmp<=0)  continue;
    t.at(d)=q;
    total_v+=tmp;
    //cout << total_v << endl;
  }
  for(int i=1;i<D+1;i++)  cout << t.at(i)+1 << endl;

  return 0;
}


Measured memory_bytes: 3732
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
a = [_[0] for _ in ab]

inf = float('inf')
dp = [inf] * (h + max(a) + 1)

for i in range(1, len(dp)):
    for x, y in ab:
        if i - x > 0:
            dp[i] = min(dp[i], dp[i - x] + y)
        else:
            dp[i] = min(dp[i], y)

print(dp[h])


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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  ll ans = 0;
  char prev = s[0];
  for (ll i = 1; i < s.size(); ++i) {
    if (prev != s[i]) {
      ans++;
    }
    prev = s[i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e3+3;
vector<int>v[N];
map<pi,bool>mp;
queue<int>q;
int vis[N],ans[N];
void BFS(int ss)
{
    vis[ss]=0;
    q.push(ss);
    while(!q.empty())
    {
        int f=q.front();
        q.pop();
        for(int c:v[f])
        {
            if(vis[c]==-1)
            {
                vis[c]=vis[f]+1;
                q.push(c);
                int l=min(ss,c);
                int r=max(ss,c);
                pi ch={l,r};
                if(mp[ch]==false)
                {
                    ans[vis[c]]++;
                    mp[ch]=true;
                }
            }
        }
    }
}
int main()
{
    ft
    int t,i,j,n,m,l,r,c;
    cin>>n>>l>>r;
    v[l].pb(r);
    v[r].pb(l);
    for(i=1;i<n;i++)
    {
        v[i].pb(i+1);
        v[i+1].pb(i);
    }
    for(i=1;i<=n;i++)
    {
        memset(vis,-1,sizeof(vis));
        BFS(i);
    }
    for(i=1;i<n;i++)
    {
        cout<<ans[i]<<"\n";
    }
    return 0;
}

Measured memory_bytes: 125696
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 220000
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define sp ' '
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
ll power(ll x,ll y){
    ll ret=1;
    while(y>0){
        if(y&1)
            ret=(ret*x);
        y/=2;
        x=(x*x);
    }
    return ret;
}
vector<ll> divs(ll n){
	vector<ll>ret;
	for(int i=1;i*i<=n;i++){
		if(n%i==0){
			if(i*i==n){
				ret.push_back(i);
			}
			else{
				ret.push_back(i);
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}
void solve(){
	ll n,i,j;
	cin>>n;
	map<string,ll>mp;
	string arr[4]={"AC","WA","TLE","RE"};
	nfl(i,n){
		string s;
		cin>>s;
		mp[s]++;
	}
	nfl(i,4){
		cout<<arr[i]<<" x "<<mp[arr[i]]<<endl;
	}
}	
int main(){
	gear_change;
	ll test=1;
	// in(test);
	while(test--){
		solve();
	}
}	

Measured memory_bytes: 3652
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long int ll;
void swap(ll *x,ll *y){ll temp;temp=*x;*x=*y;*y=temp;}
ll asc(const void *a,const void *b){return *(ll*)a-*(ll*)b;}
ll desc(const void *a,const void *b){return *(ll*)b-*(ll*)a;}
ll max(ll x,ll y){return x>y?x:y;}
ll min(ll x,ll y){return x>y?y:x;}

int main(){
    int a,b;
    char str[100];
    int cnt=0,flg=0;

    scanf("%d %d",&a,&b);
    for(int i=a;i<=b;i++){
        flg=0;
        sprintf(str,"%d",i);
        //printf("%s\n",str);
        for(int j=0;j<2;j++){
            if(str[j]!=str[4-j]){
                flg=1;
                break;
            }
        }
        if(!flg)cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#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 INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

#define ARRAY_MAX 300005
#define MOD 1000000007


int main(){

    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> a(ARRAY_MAX,0);
    REP(i,s.length()){
        if(s[i] == 'E'){
            a[i+1] = 1;
        }
    }
    REP(i,n){
        a[i+1] += a[i];
    }
    /*REP(i,n+1){
        cout << a[i] << " ";
    }
    cout << endl;
    */
    int ans = INF;
    for(int i = 1;i <= n;i++){
        //cout << i << endl;
        int tmp = 0;
        if(i != n){
            tmp += a[n]-a[i];
            //cout << tmp << " a " << endl;
        }
        if(i != 1){
            tmp += i-1- ( a[i-1]-a[0]);
            //cout << tmp << " b " << endl;
        }
        //cout << tmp << endl;
        ans = min(ans,tmp);
        //cout << endl;
    }
    cout << ans << endl;




    return 0;
}

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

int main(void) {
    int N;
    while (cin >> N, N) {
        vector<vector<int>> p(N);
        int M, tmp;
        for (int i = 0; i < N; i++) {
            cin >> M;
            for (int j = 0; j < M; j++) {
                cin >> tmp;
                p[i].push_back(tmp);
            }
        }
        int K;
        cin >> K;
        vector<int> l(K);
        for (int i = 0; i < K; i++) cin >> l[i];

        bool flag = false;
        int ans = -1;
        for (int i = 0; i < N; i++) {
            for (int k = 0; k < K; k++) {
                flag = false;
                for (int j = 0; j < p[i].size(); j++) {
                    if (l[k] == p[i][j]) flag = true;
                }
                if (!flag) break;
            }
            if (flag) {
                if (ans == -1) {
                    ans = i+1;
                } else {
                    ans = -1;
                    break;
                }
            }
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}



//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;

int main(){
  ll N;cin>>N;vl A(N);
  rep(i,N){
    cin>>A[i];
    A[i] -= (ll)(i+1);
  }
  sort(all(A));
   ll ans=0;
  if(N%2==0){
    ll cnt1=0,cnt2=0;
    rep(i,N){
      cnt1 += abs(A[i]-A[N/2-1]);
      cnt2 +=  abs(A[i]-A[N/2]);
    }
    ans =min(cnt1,cnt2);
  }
  else{
    rep(i,N){
      
      ans +=  abs(A[i]-A[N/2]);
    }
  }
  cout<<ans<<endl;
}






Measured memory_bytes: 1792
n,m=map(int,raw_input().split())

a=[]

a=map(int,raw_input().split())
a.sort()
b=[map(int,raw_input().split() )for i in range(m)]
b=sorted(b,key=lambda x: -x[1])
k=0
l=0
for i in range(m):
    if a[k]>b[i][1]:
        break
    for j in range(k,min(n,k+b[i][0])):
        if a[j] < b[i][1]:
                a[j] = b[i][1]
                l=j+1
        else:
           break
    k=l
    if k==n:
        k=n-1
print(sum(a))

Measured memory_bytes: 28768
#include <bits/stdc++.h>
#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 INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> V;

#define _ cin.tie(0);ios::sync_with_stdio(false);

int main(){ _;
  V a(3);
  REP(i,3) cin>>a[i];
  llong ans=0;
  VSORT(a);
  ans=a[1]-a[0]+a[2]-a[1];
  cout<<ans<<endl;

  return 0;
}


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

using namespace std;

struct Num{
        int a;
        int b;
        bool operator<(const Num &another) const
        {
        return a < another.a;
        };
};

int main(){
        long long int n,k;
        vector<Num> num;
        int a,b;

        cin>>n>>k;
        for(int i=0; i<n; ++i) {
                cin >>a>>b;
                num.push_back((Num){a,b});
        }

        sort(num.begin(),num.end());

        int ans=0;


        for(int i=0; (i<n)&&(k>0); i++){
                k-=num.at(i).b;
                ans=num.at(i).a;
        }

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


Measured memory_bytes: 1400
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int n,a,b;
cin>>n>>a>>b;
if((b-a)%2)ol("Borys");
else ol("Alice");
return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    long long N, A, B;
    while(cin >> N >> A >> B){
        if((B-A)%2 == 0){
            cout << (B-A)/2 << endl;
        } else {
            cout << min(A-1, N-B) + (B-A+1)/2 << endl;
        }
    }
}

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

namespace AtCoder_068
{
    class Program
    {
        static void Main(string[] args)
        {
			int n = int.Parse(Console.ReadLine());
			int ans = 1;
			int max_count = 0;
			int num;
			for (int i = 1; i <= n; i++)
			{
				num = i;
				int count = 0;
				while (true)
				{
					if (num % 2 != 0) break;
					num = num / 2;
					count++;
				}
				if (count >= max_count)
				{
					ans = i;
					max_count = count;
				}
			}
			Console.WriteLine(ans);
		}
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mset(s,_) memset(s,_,sizeof s)
#define fi first
#define se second
#define pb push_back

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

ll dp[4010][4];
ll a[4010][4010];
bool vis[4010];
map<char,int>mp;

char sol(char ch1,char ch2){
	if(ch1!='R'&&ch2!='R') return 'R';
	if(ch1!='G'&&ch2!='G') return 'G';
	 return 'B';
}

int main(){
	int n;
	char s[10010];
	mp['R']=1;
	mp['G']=2;
	mp['B']=3;
	cin>>n>>s+1;
	per(i,n,1){
	 rep(j,1,3)
		dp[i][j]=dp[i+1][j];
		dp[i][mp[s[i]]]+=1;
	}
	ll ans=0;
	rep(i,1,n-1){
		rep(j,i+1,n){
			if(s[i]==s[j]||j+1>n) continue;
			char ch=sol(s[i],s[j]);
			int cnt=dp[j+1][mp[ch]];
			if(j+j-i<=n&&s[j+j-i]==ch) cnt-=1;
			ans+=cnt;
	 }
 }
 cout<<ans<<'\n';
}



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

typedef long long  LL;
LL n;
int m;
deque <int> a,b;

void solve(LL n)
{
	if (n==0)  return;
	if (n&1)  solve(n/2),m++,a.push_back(m),b.push_back(m);
	else  solve(n-1),m++,a.push_back(m),b.push_front(m);
}

void work()
{
	scanf("%lld",&n);
	solve(n);
	printf("%d\n",a.size()+b.size());
	for (int i=0; i<a.size(); i++)  printf("%d ",a[i]);
	for (int i=0; i<b.size(); i++)  printf("%d ",b[i]);
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    string a,b;
    cin >> a >> b;
    rep(i,a.size()-b.size()+1){
        bool c = true;
        rep(j,b.size())if(a[i+j] != b[j] && b[j] != '_')c = false;
        if(c){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}



Measured memory_bytes: 3216
#include<bits/stdc++.h>
#define ll long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define MAX 1000000007
using namespace std;
int main()
{
 	speed_up
 	ll a,b,c;
 	cin>>a>>b>>c;
 	if(b+c<=a) cout<<0;
 	else cout<<(b+c-a);
	
	
	
	
	
 return 0;
}

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

int main(){

	int H, W;

	cin >> H >> W;

	while( H != 0 && W != 0){			//W=0とH=0になるまで繰り返す
		for(int i = 0; i < H; i++){		//縦軸に[＊]を増やして行く
			for(int j = 0; j < W; j++){	//横軸に[＊]を増やして行く
				cout << ".#"[(i+j)%2 == 0];	// [#]のマークがあるときの条件を　[ この中に条件を入れる ]　※下記見て！！！
			}
			cout << endl ;
		}
		cout << endl;
		cin >> H >> W;
	}

	return 0;
}

// ※「,」と「#」が来る条件を考える。どちらか来たらどちらか来ない。「#」が来てるときは「i+j=偶数のとき」に気が付くのがポイント


Measured memory_bytes: 3076
#include <iostream>
#include <vector>
int main(int argc, char const *argv[]) {
  int N;
  std::vector<int> V,C;
  std::cin >> N;
  for (int i = 0; i < N; i++) {
    int v;
    std::cin >> v;
    V.push_back(v);

  }
  for (int i = 0; i < N; i++) {
    int c;
    std::cin >> c;
    C.push_back(c);
  }
  int max = 0;
  for (size_t i = 0; i < N; i++) {
    if(V[i] > C[i])
      max += V[i] - C[i];
  }
  std::cout<<max<<std::endl;

  return 0;
}


Measured memory_bytes: 256
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N, K = map(int, input().split())
A = list(map(int, input().split()))

print(math.ceil((N-1)/(K-1)))


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

int	main()
{
	int	M, N;
	cin >> N >> M;
	vector<int>	A_vec(N);
	double total = 0;
	for (int i = 0; i < N; ++i) {
		cin >> A_vec.at(i);
		total += A_vec.at(i);
	}
	sort(A_vec.begin(), A_vec.end(), greater<int>());
	if (A_vec.at(M - 1) < total / (4 * M))
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define MMAX 100000
#define NMAX 100000
using namespace std;
int N,M,P[MMAX] = {},money[NMAX][3] = {};
long long st[NMAX] = {},street[NMAX] = {},ans = 0;
int main(){
	scanf("%d%d",&N,&M);
	for (int i = 0; i < M; ++i) {
		scanf("%d",&P[i]);
		if(i > 0){
			int ii = min(P[i],P[i-1])-1,jj = max(P[i],P[i-1])-1;
			st[ii]++;
			st[jj]--;
		}
	}
	for (int i = 0; i < N-1; ++i) {
		for (int j = 0; j < 3; ++j) {
			scanf("%d",&money[i][j]);
		}
	}
	for (int i = 0; i < N;++i){
		if(i > 0){
			street[i] = street[i-1] + st[i];
		}else{
			street[i] = st[i];
		}
	}
//	for (int i = 0; i < N-1; ++i) {
//		printf("%d\n",street[i]);
//	}
	for (int i = 0; i < N-1; ++i) {
		ans += min(money[i][0]*street[i],money[i][1]*street[i]+money[i][2]);
//		printf("%lld\n ",ans);
	}
	printf("%lld\n",ans);
	return 0;
}

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

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

    int n;
    cin>>n;

    int ar[n];
    for(int i=0;i<n;i++)cin>>ar[i];
    
    unordered_map<int,int> m;
    int sum = 0;

    for(int i=0;i<n;i++){
        m[ar[i]]++;
        sum += ar[i];
    }

    int q;
    cin>>q;
    int res = sum;
    while(q--){
        int a,b;
        cin>>a>>b;

        int cnt = m[a];

        m[a] = 0;
        m[b]+= cnt;

        res -= (a)*(cnt);
        res += (b)*(cnt);

        cout<<res<<endl;
    }
}

Measured memory_bytes: 7928
/**
 *    author: tanishq_code_c
**/
#include <bits/stdc++.h>
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 dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif


#define int                                         long long
#define setbits(x)                                     __builtin_popcountll(x)
#define zerobits(x)                                 __builtin_ctzll(x)
#define mod                                         1000000007
#define inf                                            1e18
#define endl                                        '\n'
#define pb                                          push_back
#define all(x)                                      x.begin(),x.end()
#define ff                                          first
#define ss                                          second
#define rep(i,n)                                      for(int i = 0; i < n; i++)
#define set(n)                                      fixed << setprecision(n)

int powmod(int a, int b) {int res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) {if (b & 1)res = res * a % mod; a = a * a % mod;} return res;}
int fast_pow(int a, int b) {if (b == 1) return a; if (b == 0) return 1; int x = fast_pow(a, b / 2); x *= x; if (b & 1) x *= a; return x;}

void t_c_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("inp.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif*/
    string s; cin >> s;
    int n = (int)s.size();
    int ss = 0;
    for (int i = 0; i < n; i++) {
        ss += (s[i] - '0');
    }
    cout << (ss % 9 == 0 ? "Yes" : "No") << endl;
}

int32_t main()
{
    t_c_c();
    return 0;
}


Measured memory_bytes: 3740
N = int(input())
Ds = [int(s) for s in input().split(' ')]
MOD = 998244353
if Ds[0] != 0:
  print('0')
  exit(0)
for d in Ds[1:]:
  if d == 0:
    print('0')
    exit(0)

counts = [0] * (max(Ds) + 1)
for d in Ds:
  counts[d] += 1
  
ans = 1
for c1, c2 in zip(counts[:-1], counts[1:]):
  ans *= c1 ** c2
  ans %= MOD
  
print(ans)



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

int n;
ll a, b, h[100000];

int can(ll k){
	ll s = 0;
	for(int i = 0; i < n; i++){
		s += max(0LL, ((h[i] - a * k) + b - 1) / b);
		if(s > k) return 0;
	}
	return 1;
}

int main(){
	scanf("%d%lld%lld", &n, &b, &a); b -= a;
	for(int i = 0; i < n; i++) scanf("%lld", h + i);
	ll s = 1, e = int(1e9) + 5;
	while(s <= e){
		ll m = (s + e) / 2;
		if(can(m)) e = m - 1;
		else s = m + 1;
	}
	printf("%lld\n", s);
}

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

typedef long long ll;

ll n;

ll getInversePair(vector<ll>& nums, int start, int end, vector<ll>& copy) {
    if (start >= end) {
        return 0;
    }
    int mid = (end - start) / 2 + start;
    ll leftCnt = getInversePair(nums, start, mid, copy);
    ll rightCnt = getInversePair(nums, mid + 1, end, copy);
    int p = start;
    int q = mid + 1;
    int index = start;
    ll cnt = 0;
    while (p <= mid && q <= end) {
        if (nums[p] <= nums[q]) {
            copy[index++] = nums[p++];
            cnt += end - q + 1;
        } else {
            copy[index++] = nums[q++];
        }
    }
    while (p <= mid) copy[index++] = nums[p++];
    while (q <= end) copy[index++] = nums[q++];
    for (int i = start; i <= end; ++i) {
        nums[i] = copy[i];
    }
    return (leftCnt + rightCnt + cnt);
}

bool check(ll m, ll lim, const vector<ll> &nums, vector<ll> &sums, vector<ll> &copy) {
    sums[0] = 0;
    for (int i = 1; i <= n; ++i) {
        sums[i] = sums[i - 1];
        if (nums[i] >= m) {
            sums[i]++;
        } else {
            sums[i]--;
        }
    }
    ll res = getInversePair(sums, 0, n, copy);
    return res >= lim;
}

int main() {
    cin >> n;
    vector<ll> nums(n + 10);
    vector<ll> copy(n + 10);
    ll l = LONG_LONG_MAX;
    ll r = LONG_LONG_MIN;
    for (int i = 1; i <= n; ++i) {
        cin >> nums[i];
        l = min(l, nums[i]);
        r = max(r, nums[i]);
    }
    vector<ll> sums(n + 10);
    ll lim = (n * (n + 1) / 2 + 1) / 2;
    ll m;
    ll ans;
    while (l <= r) {
        m = (r - l) / 2 + l;
        if (check(m, lim, nums, sums, copy)) {
            ans = m;
            l = m + 1;
        } else {
            r = m - 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------

int K, S;

int main() {
  cin >> K >> S;
  int ans = 0;
  repe(i, 0, K) {
    repe(j, 0, K) {
      int z = S - i - j;
      if (z < 0 || K < z) continue;

      ++ans;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3604
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE OverloadedStrings #-}

import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as MP
import qualified Data.Set as ST
import qualified Data.Sequence as SQ
import Data.Array
import Data.Array.Unboxed
import Data.Array.ST
import Data.Array.IO
import Data.Maybe
import Data.Ratio
import Data.Char
import Data.Bits
import Data.List
import Data.Tuple
import Data.Functor
import Data.IORef
import Data.STRef
import Control.Applicative
import Control.Monad

step acc x
  | x < 2 = 0 + acc
  | otherwise = (x * (x-1) `div` 2) + acc

main = do
  n <- readLn :: IO Int
  xs <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
  let mp = VU.foldl' (\m x -> MP.insertWith (+) x 1 m) MP.empty xs
  let total = MP.foldl step 0 mp
  VU.forM_ xs $ \x -> do
    let Just a = MP.lookup x mp
    if a < 2
       then print total
       else print $ total - (a-1)
    
  


Measured memory_bytes: 36152
N = int(input())

L = [0] * (N+1)
L[0], L[1] = 2, 1

for i in range(2,N+1):
  x = L[i-2] + L[i-1]
  L[i] = x
print(L[-1])

"""
L = [0] * (N+1)
L[0], L[1] = 2, 1
def luka(n):
  for i in range(2,n+1):
    x = L[i-2] + L[i-1]
    L[i] = x
  return L[-1]
luka(N)
"""

Measured memory_bytes: 3060
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

W, H, x, y = nl()

area = W*H/2
if W / 2 == x and H / 2 == y:
    print(str(area) + ' 1')
else:
    print(str(area) + ' 0')


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

string s, t;
int l[4000][4000];
int m;

void list(string s,string t){
    for(int i = 0; i < s.length(); i++){
        for(int j = 0; j < t.length(); j++){
            if(s[i]==t[j]){
                if(i==0||j==0){
                    l[i][j]=1;
                }else{
                    l[i][j]=l[i-1][j-1]+1;
                }
            }
        }
    }
}

int search(){
    m = 0;
    for(int i = 0; i < s.length(); i++){
        for(int j = 0; j < t.length(); j++){
            if(l[i][j] >= m){
                m=l[i][j];
                l[i][j]=0;
            }else{
                l[i][j]=0;
            }
        }
    }
    return m;
}

int main(){
    for(;;){
        m = 0;
        if(cin >> s >> t){
            m = 0;
            list(s,t);
            m = 0;
            cout << search() << endl;
        }else{
            break;
        }
        m = 0;
    }
    return 0;
}

Measured memory_bytes: 63720
a = input()
g = 0
p = 0
s = 0
for i in range(len(a)):
    if a[i] == "g":
        g += 1
    else:
        p += 1
c = abs((g-p)//2)
if g < p:
    g += c
    p -= c
elif g > p:
    p += c
    g -= c
d = "p" * p + "g" * g
for i in range(len(a)):
    if a[i] != d[i]:
        if a[i] == "p" and d[i] == "g":
            s -= 1
        elif a[i] == "g" and d[i] == "p":
            s += 1
print(s)


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

int main(void) {
  string S;
  bool flag=false;
  cin >> S;
  
  for(int i=0; i<S.size(); i++){
    
    if(i%2 == 0){
      if(S[i]=='R' || S[i]=='U' || S[i]=='D')
        flag=true;
      else{
        flag=false;
        break;
      }
    }
    else{
      if(S[i]=='L' || S[i]=='U' || S[i]=='D')
        flag=true;
      else{
        flag=false;
        break;
      }
    }
  }
  
  if(flag==true) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
# ABC066c
from collections import deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


n = int(input())
a = list(map(int, input().split()))
b = deque()
for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
        continue
    b.appendleft(a[i])
if n % 2 == 1:
    b.reverse()
print(*b)


Measured memory_bytes: 91064
using System;
using System.Linq;

namespace Abc096b
{
    class Abc096b
    {
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine().Split().ToList().ConvertAll(double.Parse);
            var k = double.Parse(Console.ReadLine());
            Console.WriteLine(numbers.Sum() - numbers.Max() + numbers.Max() * Math.Pow(2.0, k));
        }
    }
}


Measured memory_bytes: 13140
#create date: 2020-04-26 21:01

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    a, b, c, d = na()
    while True:
        c -= b
        if c <= 0:
            print("Yes")
            quit()
        a -= d
        if a <= 0:
            print("No")
            quit()

if __name__ == "__main__":
    main()

Measured memory_bytes: 9228
/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
LL mypow(LL x,LL y){
    x%=MOD;
    LL res=1%MOD;
    while(y){
        if(y&1)res=res*x%MOD;
        y>>=1;
        x=x*x%MOD;
    }
    return res;
}
LL inv(LL x){
    return mypow(x,MOD-2);
}
LL dp[5001][5001],dp2[5001][5001];
LL mul[5001],tmp[5001],two[5001];
int main(){
    int N,M;
    R(M,N);
    mul[0]=1;
    two[0]=1;
    FOR(i,1,5000){
        mul[i]=mul[i-1]*(N+1)%MOD;
        two[i]=two[i-1]*2%MOD;
    }
    dp[0][N]=1;
    FOR(i,1,M){
        FOR(j,1,N){
            ADD(dp[i][j],dp[i-1][j]*(j+1));
        }
        for(int j=N-1;j>0;j--)ADD(dp[i-1][j],dp[i-1][j+1]*2);
        FOR(j,1,N){
            ADD(dp[i][j],dp[i-1][j+1]*j);
        }
    }
    LL an=0;
    FOR(i,1,N)ADD(an,dp[M][i]);
    W(an);
    return 0;
}


Measured memory_bytes: 199132
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;
long long modpow(long long x,long long n,long long mod)
{
  if(n==0)return 1;
  long long res=modpow(x*x%mod,n/2,mod);
  if(n&1)res=res*x%mod;
  return res;
}
long long modinv(long long a,long long mod)//extgcdの方がいいらしい
{
  return modpow(a,mod-2,mod);
}
vector<int>inv;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,x;
  int mod=1e9+7;
  cin>>n>>x;
  vector<int>s(n);
  rep(i,n)cin>>s[i];
  sort(all(s),greater<int>());
  inv.resize(n+1);
  repi(i,1,n+1)inv[i]=modinv(i,mod);
  vector<vector<int>>dp(n+1,vector<int>(x+1,0));
  dp[0][x]=1;
  rep(i,n)
  {
    rep(j,x+1)
    {
      if(dp[i][j]==0)continue;
      dp[i+1][j%s[i]]+=(ll)dp[i][j]*inv[n-i]%mod;
      dp[i+1][j]+=(ll)dp[i][j]*inv[n-i]%mod*(n-i-1)%mod;
      dp[i+1][j%s[i]]%=mod;
      dp[i+1][j]%=mod;
    }
  }
  ll res=0;
  int kai=1;
  rep(i,n)kai=(ll)kai*(i+1)%mod;
  rep(i,x+1)
  {
    res+=(ll)kai*dp[n][i]%mod*i%mod;
  }
  cout<<res%mod<<endl;


  return 0;

}


Measured memory_bytes: 79488
#include<cstdio>

int main() {
    int S;
    scanf("%d",&S);
    int h,m,s;
    h = S / 3600;
    S %= 3600;
    m = S / 60;
    s = S % 60;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


Measured memory_bytes: 2736
#include <iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
typedef pair<long, long> P;

int main(void){
    long n,m;
    cin >>n>>m;
    long sw[m][n];
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            sw[i][j]=0;
        }
    }
    
    for(int i=0;i<m;i++){
        long a; 
        cin >>a;
        for(int j=0;j<a;j++){
            cin >>sw[i][j];
        }
    }
    
    // for(int i=0;i<m;i++){
    //     for(int j=0;j<n;j++){
    //         cout <<sw[i][j] << " ";
    //     }
    //     cout <<endl;
    // }
    
    long p[m];
    for(int i=0;i<m;i++){
        cin >> p[i];
        // cout << p[i];
    }
    
    
    long cnt=0;
    for(int i=0;i<pow(2,n);i++){
        bool flag = false;
        for(int j=0;j<m;j++){
            long sum=0;
            for(int k=0;k<n;k++){
                
                if(sw[j][k]==0){
                    break;
                }
                // cout <<i<<" "<<sw[j][k]<<" "<< ((i>(sw[j][k]-1))&1)<<endl;
                sum += ((i>>(sw[j][k]-1))&1);
            }
            if(sum%2==p[j]){
                flag = true;
            }else{
                flag = false;
                break;
            }
            
        }
        if(flag==true){
            // cout << i <<endl;
            cnt++;
        }
    }
    cout <<cnt<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
ll power(ll p,ll k)
{
ll a=1;
while(k)
{
if(k&1)
a=(a*p);
p=(p*p);
k>>=1;
}
return a;
}
int main()
{
ll n,i,j,k,ans=0,sum=1;
cin>>n;
string s[n+1];
for(i=0;i<n;i++)
cin>>s[i];
for(i=0;i<n;i++)
sort(s[i].begin(),s[i].end());
sort(s,s+n);
for(i=0;i<=n;i++)
{
if(s[i]==s[i+1])
sum++;
else
{
ans+=sum*(sum-1)/2;
sum=1;
}
}
cout<<ans;
return 0;
}

Measured memory_bytes: 7296
N,K=gets.chomp.split(" ").map(&:to_i)
ret=0
if K==0
    puts N*N
    exit
end
((K+1)..N).each do |b|
    n=(N+1)/b
    ret+=(b-K)*n
    rest=N-n*b
    if rest-K+1 > 0
        ret+= rest-K+1
    end
end
puts ret


Measured memory_bytes: 14256