akhauriyash/Code-Regression huggingface dataset:
print((lambda a:min([min([float("inf") if a[1]<=1 else (lambda b:b[2]-b[0])(sorted([i*a[0],(a[1]-i)*(a[0]//2),(a[1]-i)*(a[0]//2+(a[0]%2))])) for i in range(1, a[1])])]+[min([float("inf") if a[0]<=1 else (lambda b:b[2]-b[0])(sorted([i*a[1],(a[0]-i)*(a[1]//2),(a[0]-i)*(a[1]//2+(a[1]%2))])) for i in range(1, a[0])])]+[a[1] if a[0]%3 else 0]+[a[0] if a[1]%3 else 0]))(list(map(int,input().split()))))

Measured memory_bytes: 7080
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
    int money ;
    cin >> money;

    int x,y;
    x = money /500;
    y = money % 500 /5;

    int total = x * 1000 + y * 5;

    cout << total << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdint>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>

#define rep(i, n) for(ll (i) = 0;(i) < (n);(i)++)
#define mp(a, b) make_pair((a),(b))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

constexpr ll inf = INT64_MAX / 4;
constexpr double pi = asin(1) * 2;
constexpr ll mod = 1000000007;
constexpr double eps = 0.000000001;

struct node {
    int l, r, m;
    ll v;
    struct node *cl, *cr;
};

typedef struct node node_t;

node_t *mktree(int l, int r) {
    auto ret = new node_t;
    ret->l = l;
    ret->r = r;
    ret->m = (l + r) / 2;
    ret->v = ((ull) 1 << (ull) 31) - 1;
    if (r - l > 1) {
        ret->cl = mktree(l, ret->m);
        ret->cr = mktree(ret->m, r);
    }
    return ret;
}

void update(int i, ll x, node_t *t) {
    if (t->r - t->l <= 1) {
        if (t->l == i) {
            t->v = x;
        } else {
            throw;
        }
    } else {
        if (i < t->m) {
            update(i, x, t->cl);
        } else {
            update(i, x, t->cr);
        }
        t->v = min(t->cl->v, t->cr->v);
    }
}

ll find(int s, int t, node_t *r) {
    if (s <= r->l && r->r <= t) return r->v;
    ll ret = inf;
    if (s < r->m) ret = min(ret, find(s, t, r->cl));
    if (r->m < t) ret = min(ret, find(s, t, r->cr));
    return ret;
}

int main() {
    int n, q, c, x, y;
    cin >> n >> q;
    auto r = mktree(0, n);
    rep(i, q) {
        cin >> c >> x >> y;
        if (c == 0) update(x, y, r);
        else cout << find(x, y + 1, r) << endl;
    }
}



Measured memory_bytes: 12484
n = int(input())
nums = [int(i) for i in input().split()]
nums.sort(reverse=True)
turn = 0
alice = 0
bob = 0
for i in nums:
    if turn % 2 == 0:
        alice = alice + i
        turn += 1
    else:
        bob = bob + i
        turn += 1
print(alice - bob)

Measured memory_bytes: 38384
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)

	s := strconv.Itoa(n)

	for i := 0; i < len(s)/2; i++ {
		if s[i] != s[len(s)-1-i] {
			fmt.Println("No")
			return
		}

	}
	fmt.Println("Yes")
}


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

int main() {
  long long int n;
  scanf("%lld",&n);
  if (n%3 == 0) {
    printf("%lld\n",n/3);
  } else {
    printf("%lld\n",(n/3));
  }
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main() {
    char a[20];
    scanf("%s", a);
    a[5] = ' ';
    a[13] = ' ';
    printf("%s\n", a);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int n,k,x,y;
	cin >> n>> k>> x>> y;
    if(n<=k)cout << n*x << endl;
    else cout << k*x+(n-k)*y << endl;
}

Measured memory_bytes: 256
/*--------------------------------
    Anshul Gangwar
  Chandigarh University
--------------------------------*/
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

#define For(i,n)        for(int i = 0;i < n;i++)
#define fr(i,a,b)       for(int i = a;i <= b;i++)
#define Rfor(i,n)       for(int i = n-1;i >= 0;i--)
#define endl            '\n'
#define pb              push_back
#define mp              make_pair


int main()
{
  #ifdef ANSHUL
  freopen("input.txt", "r", stdin);
  #endif
  string s;
  cin>>s;
  string a,b;
  a += s[0];
  a += s[1];
  b += s[2];
  b += s[3];
  // cout<<a<<b<<endl;
  int x = stoi(a);
  int y = stoi(b);
  if(x <= 12 && x >= 1)
  {
    if(y <= 12 && y >= 1)
      cout<<"AMBIGUOUS"<<endl;
    else
      cout<<"MMYY"<<endl;
  }
  else if(y <= 12 && y >= 1)
  {
    if(x <= 12 && x >= 1)
      cout<<"AMBIGUOUS"<<endl;
    else
      cout<<"YYMM"<<endl;
  }
  else
    cout<<"NA"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  
  string s;
  cin>>s;
  vector<int>v(s.size()+1,0);
   for( int i=0;i<s.size();i++)
   {
     if(s[i]=='<')
       v[i+1]=max(v[i+1],v[i]+1);
   }
  for( int i=s.size()-1;i>=0;i--)
    if(s[i]=='>')
      v[i]=max(v[i+1]+1,v[i]);
  long long sum=0;
  for( int i=0;i<v.size();i++)
    sum+=v[i];
  cout<<sum<<"\n";
  return 0;
}


Measured memory_bytes: 2820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;



int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ///freopen("input.in", "r", stdin);
    ///freopen("output.out", "w", stdout);
    cout.precision(20);
    ll n;
    cin >> n;
    vector <ld> p(n + 1);
    for (ll i = 1; i <= n; ++i)
        cin >> p[i];
    ld dp[n + 1][n + 1]{};
    dp[0][0] = 1;
    for (ll i = 1; i <= n; ++i)
        for (ll j = 0; j <= i; ++j)
                dp[i][j] = (j ? dp[i - 1][j - 1] : 0) * p[i] + dp[i - 1][j] * (1.0 - p[i]);
    ld ans = 0;
    for (ll j = n / 2 + 1; j <= n; ++j)
        ans += dp[n][j];
    cout << ans << endl;
    return 0;
}

/**


**/


Measured memory_bytes: 140928
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

ll dp[100005];
int breaked[100005];
int main() {
	ll N,M;
	cin>>N>>M;
	int a;
	rep(i,M){
		cin>>a;
		breaked[a] = 1;
	}
	dp[0] = 1;
	rep(i,N+1){
		if(!(breaked[i+1])){
			if(i-1>=0){
				dp[i+1]+= dp[i]+dp[i-1];
				dp[i+1]%=MOD;
			}
			else{
				dp[i+1]+= dp[i];
				dp[i+1]%=MOD;
			}
		}
/*		if(!(breaked[i+2])){
			if(!(breaked[i+1])){
				dp[i+2]+= dp[i+1];
				dp[i+2]%=MOD;
			}
			if(!(breaked[i])){
				dp[i+2]+= dp[i];
				dp[i+2]%= MOD;
			}
		}*/
	}
	rep(i,N+1){
		cerr<<dp[i]<<" ";
	}
	cerr<<endl;
	ll ans = dp[N]%MOD;
	cout<<ans<<endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int l=0,r=0,ans=0;
    cin>>l;
    cin>>r;

    while(l<=r)
    {
        l*=2;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(int i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;

int main(void){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    s[k-1] = tolower(s[k-1]);
    cout << s << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
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;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;
//using namespace atcoder;

void solve(){
	int n;
	cin>>n;
	vector<ll>a(n);
	rep(i,n)cin>>a[i];
	map<int,ll>mp;
	ll ans=0;
	rep(i,n){
		ans+=mp[i-a[i]];
		mp[i+a[i]]++;
	}
	cout<<ans;
}


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


Measured memory_bytes: 27456
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int map[100][100];
char s[100];
int fx[8][2]={{0,1},{0,-1},{1,0},{1,-1},{1,1},{-1,0},{-1,1},{-1,-1}};
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".in","w",stdout);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s+1);
		for(int j=1;j<=m;j++)
		map[i][j]=s[j]=='#'?-1:0;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		if(map[i][j]==-1)
		{
			for(int k=0;k<8;k++)
			{
				int x=i+fx[k][0];
				int y=j+fx[k][1];
				if(x<1||x>n||y<1||y>m||map[x][y]==-1)continue;
				map[x][y]++;
			}
		}
	}
	for(int i=1;i<=n;i++,puts(""))
		for(int j=1;j<=m;j++)
		if(map[i][j]==-1)putchar('#');
		else cout<<map[i][j];
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAXN	505
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
bool a[MAXN][MAXN], b[MAXN][MAXN];
char s[MAXN];
int main() {
	int n, m;
	read(n), read(m);
	for (int i = 1; i <= m; i++)
		a[1][i] = b[n][i] = true;
	for (int i = 2; i <= n - 1; i++)
	for (int j = 1; j <= m; j++)
		if (j & 1) a[i][j] = true;
		else b[i][j] = true;
	for (int i = 1; i <= n; i++) {
		scanf("\n%s", s + 1);
		for (int j = 1; j <= m; j++) {
			a[i][j] |= s[j] == '#';
			b[i][j] |= s[j] == '#';
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++)
			if (a[i][j]) printf("#");
			else printf(".");
		printf("\n");
	}
	printf("\n");
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++)
			if (b[i][j]) printf("#");
			else printf(".");
		printf("\n");
	}
	return 0;
}

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

template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n;
	cin>>n;
	if(n%2!=0)n*=2;
	cout<<n<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int N,T,x,y;
	scanf("%d%d",&N,&T);
	vector<int>v(T+1);
	for(;N--;){
		scanf("%d%d",&x,&y);
		v[x+1]++,v[y+1]--;
	}
	for(x=y=0;x<T;x++)y=max(y,v[x+1]+=v[x]);
	printf("%d\n",y);
}

Measured memory_bytes: 2740
#include<cstdio>

int main(){
    int count[1201];
    for(int i = 0; i < 1201; i++){
        count[i] = 0;
 	}
    char ch;
    while(scanf("%c",&ch) != EOF){
        if(ch >= 'a' && ch <= 'z'){
            count[ch-'a']++;
        }
        else if(ch >= 'A' && ch <= 'Z'){
            count[ch-'A']++;
        }
    }
    for(int j = 0;j < 26; j++){
        printf("%c : %d\n",j + 'a',count[j]);
    }
    return 0;
}


Measured memory_bytes: 2668
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;
  
const ll INF=(1ll<<31)-1;
int a[100001];
int b[1005];
int main(){
    int n,q;
    cin>>n>>q;
    int sqn=sqrt(n);
    int bn=(n+sqn-1)/sqn;
    rep(i,n) a[i]=0;
    rep(i,bn) b[i]=0;
    int com;
    rep(i,q){
        cin>>com;
        if(com==0){
            int s,t,x;
            //[s,t)
            cin>>s>>t>>x;
            --s;
            rep(j,bn){
                int l=j*sqn,r=(j+1)*sqn;
                if(r<=s||t<=l) continue;
                if(s<=l&&r<=t) b[j]+=x;
                else{
                    FOR(k,l,r){
                        if(k>=max(s,l)&&k<min(t,r)) a[k]+=x+b[j];
                        else if(b[j]!=0) a[k]+=b[j];
                    }
                    b[j]=0;
                }
            }
        }
        if(com==1){
            int k;
            cin>>k;
            --k;
            int cur=k/sqn;
            if(b[cur]!=0){
                FOR(j,cur*sqn,(cur+1)*sqn){
                    a[j]+=b[cur];
                }
                b[cur]=0;
            }
            cout<<a[k]<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3468
#include <iostream>
using namespace std;
int n, k;
int ans;
int x;
int a[105];
int main()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++) a[i] = 0;
    for (int i = 1; i <= k; i++)
    {
        int d;
        cin >> d;
        for (int j = 1; j <= d; j++)
        {
            cin >> x;
            a[x] = 1;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        if (a[i] == 0) 
            ans++;
    }
    cout << ans;
   return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int c[3][3] = {{}};
  int a[3][3] = {{}};
  rep(i, 0, 3) rep(j, 0, 3) cin >> c[i][j];

  int max_val = max({c[0][0], c[0][1], c[0][2]});

  rep(a1, 0, max_val + 1) {
    int b1 = c[0][0] - a1;
    int b2 = c[0][1] - a1;
    int b3 = c[0][2] - a1;

    bool a2 = true, a3 = true;
    if (c[1][0] - b1 != c[1][1] - b2 || c[1][1] - b2 != c[1][2] - b3)
      a2 = false;
    if (c[2][0] - b1 != c[2][1] - b2 || c[2][1] - b2 != c[2][2] - b3)
      a2 = false;
    if (a2 && a3) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
const int MAXN=3020;
int dp[MAXN][MAXN],cnt[MAXN];
char s[MAXN];
int main(){
	int n;
	scanf("%d",&n);
	scanf("%s",s+2);
	s[1]='<';
	dp[0][n]=1;
	for(int i=1;i<=n;++i){
		cnt[0]=dp[i-1][0];
		for(int j=1;j<=n;++j){
			cnt[j]=cnt[j-1];
			(cnt[j]+=dp[i-1][j])>=MOD?cnt[j]-=MOD:cnt[j];
		}
		for(int j=0;j+i<=n;++j){
			if(s[i]=='>') dp[i][j]=cnt[j];
			else dp[i][j]=(cnt[n]-cnt[j])<0?cnt[n]-cnt[j]+MOD:cnt[n]-cnt[j];
		}
	}
	printf("%d\n",dp[n][0]);
	return 0;
}

Measured memory_bytes: 35200
#include <bits/stdc++.h>
#define LL long long
#define INF 0x7FFFFFFF//or 0x3f3f3f3f ? -Wall
using namespace std;

template<class T> inline
void read(T& x) {
	int f = 1; x = 0;
	char ch = getchar();
	while (ch < '0' || ch > '9')   {if (ch == '-') f = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}

/*============ Header Template ============*/

LL a, b, c;

int main() {
	read(a), read(b), read(c);
	LL ans;
	if ((a & 1) == 0 || (b & 1) == 0 || (c & 1) == 0) ans = 0;
	else ans = min(a * b, min(a * c, b * c));
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(x) (x.begin()),(x.end())
#define sz(x)  ((ll)x.size())
#define FAST_IO ios_base :: sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
using namespace std;
#ifdef LOCAL
#include "uj.h"
#endif

const ll oo = 1e16;
const int maxn = 1e3 + 10;
const int mod = 1e9 + 7;

char grid[maxn][maxn];
int dp[maxn][maxn];
int N,M;

bool is_valid(int x,int y){
	if(x >= N || y >= M) return false;
	if(grid[x][y] != '.') return false;
	return true;
}

int Brute(int i,int j){
	if(i == N-1&& j == M-1) return 1;
	
	int & ans = dp[i][j];
	if(ans != -1) return ans;
	ans = 0;
	if(is_valid(i+1,j)) ans+= Brute(i+1,j)%mod;
	if(is_valid(i,j+1)) ans += Brute(i,j+1)%mod;
	return ans%mod; 
}
	


void test_case(){
	memset(dp,-1,sizeof(dp));
	cin >> N >> M;
	for(int i = 0;i<N;++i)
		for(int j = 0;j<M;++j)
			cin >> grid[i][j];
		
	cout << Brute(0,0);
}





int main(){
	FAST_IO;
	int tt;
	//cin>>tt;
	tt = 1;
	while(tt--){
		test_case();
	}
#ifndef ONLINE_JUDGE
 	cerr << "Running Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 8740
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;

int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n-1);
    vector<ll> ans(n);
    rep(i,0,n-2) cin>>a[i];
    rep(i,0,n-2){
        ans[a[i]-1]++;
    }
    rep(i,0,n-1){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 6424
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int cnt = 0;
      	long ans = 0;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == 'W'){
                ans += i - cnt;
                cnt++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 26060
#include <bits/stdc++.h>
 
#define pp push_back
#define pf push_front
#define mp make_pair
#define fs first
#define sc second
#define sf scanf
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
 
const int N = (int) 2e5 + 7;
const int INF = (int) 1e9 + 7;
 
int a[N];
int ans[N];
vector<int> g[N];
multiset<int> ms;
 
void dfs(int s, int p) {
	ms.insert(a[s]);
	multiset<int>::iterator it = ms.lower_bound(a[s]);
	++it;
	int rem = -1;
	if (it != ms.end()) {
		rem = *it;
		ms.erase(it);
	}
	ans[s] = ms.size();
 
	for (int i = 0; i < g[s].size(); ++i) {
		if (g[s][i] != p)
			dfs(g[s][i], s);
	}

	ms.erase(a[s]);
	if (rem != -1) {
		ms.insert(rem);
	}
 
}
 
 
int main(int argc, char *argv[])
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);
 
	int n;
	sf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		sf("%d", &a[i]);
	}
 
	for (int i = 0; i < n - 1; ++i) {
		int x, y;
		sf("%d %d", &x, &y);
		g[x].pp(y);
		g[y].pp(x);
	}
 
	dfs(1, 0);
 
	for (int i = 1; i <= n; ++i) {
		printf("%d\n", ans[i]);
	}
 
	return 0;
}


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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find algo with array
// Find()
int findpar(int curr, int arr[])
{
  while(arr[curr] != curr) curr = arr[curr];
  return curr;
}
// Union()
void Union(int b, int spa, int arr[])
{
  while(arr[b] != b)
  {
    int c = arr[b];
    arr[b] = spa;
    b = c;
  }
  arr[b] = spa;
}

// Main Code

int main()
{
  int a,b;
  cin>>a>>b;
  string A[a];
  string B[b];
  rep(i, 0, a)
    cin>>A[i];
  rep(i, 0, b)
    cin>>B[i];
  repn(i, 0, a-b)
  {
    repn(j, 0, a-b)
    {
      bool f = true;
      rep(k, 0, b)
        rep(l, 0, b)
          if(A[i+k][j+l] != B[k][l])
          {
            f = false;
            break;
          }
      if(f)
      {
        puts("Yes");
        return 0;
      }
    }
  }
  puts("No");
  return 0;
}


Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;  // NOLINT
using LL = int64_t;
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(9);
    for (auto& i : a) {
        cin >> i;
        if (i / 400 >= 8) b[8]++;
        else b[i / 400]++;
    }
    int sum = 0;
    for (int i = 0; i < 8; i++) {
        if (b[i]) sum++;
    }
    cout << max(1, sum) << ' ' << sum + b[8] << endl;
}


Measured memory_bytes: 256
from copy import deepcopy

if __name__ == "__main__":
    num = int(input())
    base_list=[]
    tmp_list=[]
    ans=0
    base_list = input().split()
    tmp_list = deepcopy(base_list)
    for i in base_list:
        tmp_list.remove(i)
        for j in tmp_list:
            ans+=int(i)*int(j)
    print(ans)

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((abs(b-a) <= d && abs(c-b) <= d) || abs(c-a) <= d) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
  
  
using namespace std;
  
int main(void) {
  
    int n;
    cin >> n;
  
    long min = 1000000;
    long max = -1000000;
    long sum = 0;
  
    int a;
    for(int i=0;i<n;i++) {
        cin >> a;
        sum += a;
        if(min > a)  min = a;
        if(max < a)  max = a;
    }
  
    cout << min << " " << max << " " << sum << endl;
  
  
    return 0;
}

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

#define precise(n,k) fixed<<setprecision(k)<<n

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

int solve(vector<int> &v, int i) {
    int ans = 0;
    
    while (v[i] % 2 == 0) {
        v[i] /= 2;
        ans++;
    }
    
    return ans;
}
 
int main() {
    int n;
	cin >> n;
    
    int ans = 0;
    
    vector<int> data(n+1);
    
	for (int i = 1; i <= n; i++) {
		cin >> data[i];
		ans += solve(data, i);
	}
	cout << ans << endl;
    
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n , x = 0;
    cin >> n;
    int a[n];
    for( int i = 0 ; i < n ; i++ ) cin >> a[i];
    sort( a , a + n );
    int b[100005];
    for( int i = 1 ; i <= min(n, a[n - 1]) ; i++ ) b[i] = 0;
    for (int i = 0; i < n; i++) if (a[i] > n) x++;
    for( int i = 0 ; i < n ; i++ ) if (a[i] <= n) {
        b[a[i]]++;
    }
    for( int i = 1 ; i <= min(n, a[n - 1]) ; i++ ) {
        if( b[i] > 0 ) {
            if( i != b[i] ) {
                if( b[i] > i ) x += b[i] - i;
                else x += b[i];
            }
        }
    }
    cout << x;
}


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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> p2(N + 5);
	p2[0] = 1;
	for (int i = 1; i < p2.size(); i++) {
		p2[i] = (p2[i - 1] * 2) % MOD;
	}
	vector<int> A(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	for (int i = 0; i < N; i++) {
		int coef = p2[N - i];
		coef = (coef + p2[N - i - 1] * (N - i - 1)) % MOD;
		coef = (coef * p2[i]) % MOD;
		res = (res + A[i] * coef) % MOD;
	}
	res = (res * p2[N - 1]) % MOD;
	cout << res << endl;
}

Measured memory_bytes: 3456
#include <stdio.h>

int main()
{
  int n;
  int i, j, k, l;
  int ans = 0;

  while(scanf("%d", &n) != EOF){
    for(i = 0; i < 10; i++){
      for(j = 0; j < 10; j++){
        for(k = 0; k < 10; k++){
          for(l = 0; l < 10; l++){
            if(i + j + k + l == n) ans++;
          }
        }
      }
    }

    printf("%d\n",ans);

    ans = 0;
  }

  return 0;
}

Measured memory_bytes: 592
import math
import itertools
n=int(input())
XY=[list(map(int,input().split())) for _ in range(n)]


ans=0
P=list(itertools.permutations([i for i in range(n)]))
for p in P:
  for i in range(1,len(p)):
    xi,xj=XY[p[i-1]][0],XY[p[i]][0]
    yi,yj=XY[p[i-1]][1],XY[p[i]][1]
    ans+=math.sqrt((xi-xj)**2 + (yi-yj)**2)
print(ans/math.factorial(n))


Measured memory_bytes: 8052
#include <stdio.h>
#include<string.h>

int main(void) {
	char str[101] ,str1[101],input[101];
	char ans;
	gets(str);
	gets(input);	

        strcpy(str1,str);
        strcat(str,str1);
        
        ans =  strstr(str,input);
    
        if(ans == 0){
            printf("No\n");
            
        }
        else{
            printf("Yes\n");
        }
    

	return 0;
}

Measured memory_bytes: 524
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX

#include <bits/stdc++.h>
#define db(x) cout << (x) << '\n';
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;
typedef pair<double,ll> pdi;
typedef pair<ld,ld> pdd;
typedef pair<double,ll> pdi;
typedef pair<double,pii> pdp;
typedef pair<string,ll> psi;
typedef pair<ll,string> pls;
typedef pair<string,string> pss;
typedef pair<ll,pii> pip;
typedef pair<pii,pii> ppp;
typedef complex<ld> point;
typedef pair<point,int> ppi;
#define mod (int)(1e9+7)
#define eps (1e-9)
#define oo (ll)(0x3f3f3f3f)
#define pi acos(-1)
#define MAXN (ll)(1e3+5)

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

    int n;
    cin >> n;
    map<string,int> m;
    for(int i=0;i<n;i++)
    {
        string s;
        cin >> s;
        m[s]++;
    }

    cout << "AC x " << m["AC"] << '\n';
    cout << "WA x " << m["WA"] << '\n';
    cout << "TLE x " << m["TLE"] << '\n';
    cout << "RE x " << m["RE"] << '\n';

    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>

typedef long long LL;

const long long INF = 1LL << 60;

using namespace std;

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

    int len = T.size();

    for (int i = 0; i < len; i++)
    {
        if (T.at(i) == '?')
        {
            T.at(i) = 'D';
        }
    }

    cout << T << endl;

    return 0;
}

Measured memory_bytes: 3488
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

class comb{
public:    ll mod;
    ll mx;
    vector<ll> F;
    vector<ll> FR;
    

    comb(ll mod=1000000007,ll mx=100000):mod(mod),mx(mx),F(mx+1,1),FR(mx+1,1){
        mk_F();
    }
    
    ll mod_pow(ll a,ll x){
        a%=mod;
        ll ans=1;
        while(x>0){
            if(x&1){ans*=a; ans%=mod;}
            a*=a;
            a%=mod;
            x>>=1;
        }
        return ans;
    }
    
    pll Ex_gcd(ll a,ll b){
        if(b==0){return {1,0};}
        pll ret=Ex_gcd(b,a%b);
        ret.F-=a/b*ret.S;
        return {ret.S,ret.F};
    }
    
    ll prime_R(ll a){
        return mod_pow(a,mod-2);
    }
    
    ll R(ll a){
        ll ret=Ex_gcd(a,mod).F;
        ret%=mod;
        if(ret<0){ret+=mod;}
        return ret;
    }
    
    void mk_F(){
        for(ll i=1;i<=mx;i++){F[i]=F[i-1]*i%mod; FR[i]=R(F[i]);}
    }
    
    ll c(ll n,ll k){
        if(n<k){return 0;}
        if(n==k || k==0){return 1;}
        return F[n]*FR[n-k]%mod*FR[k]%mod;
    }
    
    //mod must be prime
    ll Lucas_C(ll n,ll m){
        ll ret=1;
        while(n>0 || m>0){
            ret*=c(n%mod,m%mod);
            ret%=mod;
            n/=mod; m/=mod;
        }
        return ret;
    }
    
    ll Stirling(ll n,ll k){
        ll ret=0;
        for(ll i=1;i<=k;i++){
            if((k-i)%2){ret-=c(k,i)*mod_pow(i,n)%mod;}
            else{ret+=c(k,i)*mod_pow(i,n)%mod;}
            ret%=mod;
        }
        ret*=R(F[k]);
        ret%=mod;
        if(ret<0){ret+=mod;}
        return ret;
    }
    
    ll Bell(ll n,ll k){
        ll ret=0;
        for(ll i=1;i<=k;i++){ret+=Stirling(n,i); ret%=mod;}
        return ret;
    }
};

int main(){
    comb C(MOD,1000010);
    ll n;
    cin>>n;
    ll ans=0;
    ll sum=0;
    for(int i=1;i<n;i++){
        ll cnt=C.c(i-1,n-1-i)*C.F[i]%MOD*C.F[n-1-i]%MOD-sum;
        sum+=cnt;
        sum%=MOD;
        ans+=cnt*i%MOD;
        ans%=MOD;
    }
    if(ans<0){ans+=MOD;}
    cout<<ans<<endl;
    
    return 0;
}


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

int	main() {
	int N, K;
	cin >>N >>K;
	long D=N/K;
	long S=D*D*D;
	if (0==K%2) {
		D=(K/2+N)/K;
		S += D*D*D;
	}
	cout << S << endl;
	return 0;
}




Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int n,i,x=0,y=0;
    scanf("%d",&n);
    int a[n];
    int b[n];
    for(i=0;i<n;i++){
    	scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++){
    	scanf("%d",&b[i]);
	}
	for(i=0;i<n;i++){
		if(a[i]>b[i]){
			x += a[i];
			y += b[i];
		}
	}
	printf("%d",x-y);
    return 0;
}

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

int main() {
 string S,T,U;
 int A,B;
 cin >> S >> T >> A >> B >> U;
  if(S == U){
    cout << A-1 << " " << B << endl;
  }
  else{
    cout << A << " " << B-1 << endl;
  }
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    int n;
    cin>>n;
    deque<int> dq;
    if(n%2){
        for(int i=0;i<n;++i){
            int a;cin>>a;
            if(i%2)dq.push_back(a);
            else dq.push_front(a);
        }
    }else{
        for(int i=0;i<n;++i){
            int a;cin>>a;
            if(i%2==0)dq.push_back(a);
            else dq.push_front(a);
        }
    }
    cout<<dq[0];
    for(int i=1;i<n;++i){
        cout<<" "<<dq[i];
    }
    cout<<endl;
}

Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
    long long int x;
    cin >> x;
    
    //long double tmp = (double)x / 100.0;
    /*
    long double a = std::log(1.01);
    long double b = std::log(tmp);
    int ans = b / a;
    cout << tmp << ", " << a << ", " <<b << ", " << b/a << endl;

    cout << ans << endl;
    */
    
    
    int cnt = 0;
    long long int tmp = 100;
    while(1){
        cnt++;
        tmp = (double)tmp*1.01;
        
        if(tmp >= x){
            cout << cnt << endl;
            return 0;
        }
    }
    
}


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

int main(){
    string s;
    cin >> s;
    int length = s.length();
    for(int i = length - 1; i != 0; i--){
        char match = s[i];
        s.pop_back();
        int index = s.find(match, 0);
        if( index != -1){
            cout << "no" << endl;
            return 0;
        }
    }

    cout << "yes" << endl;
}

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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int D;
    cin >> D;
    vector<int> c(26);
    for (int i=0;i<26;i++) cin >> c[i];
    vector<vector<int>> s(D,vector<int>(26));
    for (int i=0;i<D;i++){
        for (int j=0;j<26;j++){
            cin >> s[i][j];
        }
    }
    vector<int> t(D);
    //ここで日程を決定する==========
    //for (int i=0;i<D;i++){
    //    t[i] = i%26 + 1;
    //}
    //=============================
    for (int i=0;i<D;i++) cin >> t[i];
    vector<int> last(26);
    ll sum = 0;
    for (ll i=0;i<D;i++){
        sum += s[i][t[i]-1];
        last[t[i]-1] = i+1;
        for (int j=0;j<26;j++){
            sum -= c[j]*(i+1-last[j]);
        }
        cout << sum << "\n";
    }

    //for (int i=0;i<D;i++){
    //    cout << t[i] << "\n";
    //}
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
int main()
{
	/*#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif*/
ios_base::sync_with_stdio(0);
cin.tie(0);


string s,t;
cin>>s>>t;

t.pop_back();

if(s==t){
	cout<<"Yes";
}
else{
	cout<<"No";
}

return 0;
}


Measured memory_bytes: 3660
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
string t;
void swap(int i, int j)
{
	char temp=t[i];
	t[i]=t[j];
	t[j]=temp;
}
int main(void)
{
	string s;

	cin>>s;

	vi count(26, 0);

	rep(i, s.size()){
		count[s[i]-'a']++;
	}
	if((int)s.size()==26){
		string ans="zz";
		rep(i, 26){
			rep(j, 26){
				if(i!=j){
					t=s;
					swap(i, j);
					if(s<t&&ans>t) ans=t;
				}
			}
		}
		if(ans=="zz"){
			cout<<-1<<endl;
		}else{
			rep(i, 26){
				cout<<ans[i];
				if(s[i]!=ans[i]) break;
			}
			cout<<endl;
		}
	}else{
		int ans;
		rep(i, 26){
			if(!count[i]){
				ans=i; break;
			}
		}
		cout<<s<<(char)('a'+ans)<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll a,b,k;
	cin>>a>>b>>k;

	if(a>=k){
		cout<<(a-k)<<" "<<b<<endl;
	}
	else{
		cout<<"0"<<" "<<max((ll)0,(b-k+a))<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        while(true){
            n = sc.nextInt();
            if(n==0) break;
            double sum=0;
            double sum2=0;
            double ave;
            double[] data = new double[n]; 
            for(int i=0;i<n;i++){
                data[i] = sc.nextDouble();
                sum += data[i];
                sum2 += Math.pow(data[i],2);
            }
            ave = sum/(double)n;
            double bunsan=sum2/n-Math.pow(ave,2);
            double a = Math.pow(bunsan,0.5);
            System.out.println(String.format("%.8f",a));
        }
        sc.close();
    }
}


Measured memory_bytes: 39764
#include <stdio.h>

int main()
{
    int monsterHealth, attacksDone, specialAttack;
    int attackPower = 0;
    int specialAttacks[100000];
    scanf("%d %d",&monsterHealth, &attacksDone);
    
    // Reads from input specialAttack and creates an array of specialAttacks
    for (int i = 0; i < attacksDone; i++)
    {
        scanf("%d", &specialAttack);
        specialAttacks[i] = specialAttack;
        // Adds 'power' of specialAttacks to basic attackPower of the monster
        attackPower += specialAttacks[i];
    }

    if (attackPower >= monsterHealth)
    {
        printf("Yes \n");
    }
    else
    {
        printf("No \n");
    }

    return 0;
}


Measured memory_bytes: 128
n = int(input())
a = list(map(int,input().split()))
r = [0]*(n+1)
for i in range(n):
    r[i+1] = r[i]+a[i]
ans = r.count(0)-1
from collections import Counter
c = Counter(r[1:])
for i in c:
    ans += c[i]*(c[i]-1)//2
print(ans)

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

int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}, N, M, P[] = {1, 0, 3, 2}, Q[] = {3, 2, 1, 0};
int memo[100][100][11][11][4];
string G[100];
const int INF = 1e5;

bool in_range(int a, int x){ return (a >= 0 && a < x);}

int dfs(int x, int y, int d, int p, int q){
  int &val = memo[x][y][p][q][d];
  /*
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < M; ++j){
      cout << G[i][j];
    }cout <<endl;
  }cout << endl;
  */
  if(val >= 0) return val;
  if(G[x][y] == 'G'){
    return val = 0;
  }
  val = INF;
  int x_ = x + dx[d], y_ = y + dy[d];
  if(in_range(x_, N) && in_range(y_, M) && G[x_][y_] != '#'){
    char c = G[x][y];
    if(G[x][y] != 'S') G[x][y] = '#';
    val = min(val, dfs(x_, y_, d, p, q));
    G[x][y] = c;
  }
  x_ = x + dx[P[d]], y_ = y + dy[P[d]];
  if(G[x][y] != 'S' && in_range(x_, N) && in_range(y_, M) && G[x_][y_] != '#' && p > 0){
    char c = G[x][y];
    G[x][y] = '#';
    val = min(val, dfs(x_, y_, P[d], p-1, q) + 1);
    G[x][y] = c;
  }
  x_ = x + dx[Q[d]], y_ = y + dy[Q[d]];
  if(G[x][y] != 'S' && in_range(x_, N) && in_range(y_, M) && G[x_][y_] != '#' && q > 0){
    char c = G[x][y];
    G[x][y] = '#';
    val = min(val, dfs(x_, y_, Q[d], p, q-1) + 1);
    G[x][y] = c;
  }
  //printf("dp[%d][%d][%d][%d][%d] = %d\n", x, y, p, q, d, memo[x][y][p][q][d]);
  return val;
}

int main() {
  int A;
  scanf("%d %d %d", &N, &M, &A);
  int sx, sy;
  for(int i = 0; i < N; ++i){
    cin >> G[i];
    for(int j = 0; j < M; ++j){
      if(G[i][j] == 'S'){
        sx = i;
        sy = j;
      }
    }
  }
  fill(memo[0][0][0][0], memo[100][0][0][0], -1);
  int ans = dfs(sx, sy, 0, A, A);
  cout << (ans >= INF ? -1 : ans) << endl;
  return 0;
}




Measured memory_bytes: 22192
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define pii pair<int,int>
#define prec(n) fixed<<setprecision(n)
#define MOD 1000000007
#define eps 1e-8
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

vector<int> adj[200000];
int val[200000];
int ans[200000];

void dfs(int cur,int par,int tot){
    ans[cur]=tot+val[cur];
    for(int child:adj[cur]){
        if(child==par)continue;
        dfs(child,cur,ans[cur]);
    }
}

signed main(){
    FASTER;
    int n,q;cin>>n>>q;
    for(int i=0;i<n-1;i++){
        int a,b;cin>>a>>b;a--,b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for(int i=0;i<q;i++){
        int p,x;cin>>p>>x;
        val[p-1]+=x;
    }
    dfs(0,-1,0);
    for(int i=0;i<n;i++){
        cout<<ans[i]<<" ";
    }
}


Measured memory_bytes: 25600
import math

# 提出用
n = int(input())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]

# # 動作確認用
# with open('input_itp1_10_d_1.txt', mode='r')as fin:
#     n = int(next(fin))
#     x = [int(i) for i in next(fin).split()]
#     y = [int(i) for i in next(fin).split()]

tmp = 0
for i in range(n):
    tmp += abs(x[i] - y[i])
print('%f' % (tmp))

tmp = 0
for i in range(n):
    tmp += (abs(x[i] - y[i]))**2
print('%f' % (math.sqrt(tmp)))

tmp = 0
for i in range(n):
    tmp += (abs(x[i] - y[i]))**3
print('%f' % (pow(tmp, 1 / 3)))

tmp = 0
for i in range(n):
    tmp = abs(x[i] - y[i]) if tmp < abs(x[i] - y[i]) else tmp
print('%f' % (tmp))


Measured memory_bytes: 5696
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

ll T, N, A, B, C, D;
map<ll, ll> dp;

ll solve(ll n){
    if(n == 0) return 0;
    if(n == 1) return D;
    if(dp[n] > 0) return dp[n];
    ll ret = INT64_MAX / 2;
    if(n < ret / D) ret = n * D;
    ret = min(ret, min(solve(n / 2) + A + (n % 2) * D, solve((n + 1) / 2) + A + ((2 - n % 2) % 2 * D)));
    ret = min(ret, min(solve(n / 3)+ B + (n % 3) * D, solve((n + 2) / 3)  + B + ((3 - n % 3) % 3 * D)));
    ret = min(ret, min(solve(n / 5)+ C + (n % 5) * D, solve((n + 4) / 5) + C + ((5 - n % 5) % 5 * D)));
    dp[n] = ret;
    return ret;
}

signed main(){
    cin >> T;
    REP(i, T){
        cin >> N >> A >> B >> C >> D;
        PRINT(solve(N));
        dp.clear();
    }
    return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vi vector<ll>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el printf("\n")
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
#define NIL -1
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);

int main()
{
	IOS;
    cout.precision(30);
    ll n,m,k,a,b,c,x,y; string s,t;
    cin >> n; vector<ll> A(n,0);
    for (int i=0;i<n;i++)
    {
        cin >> A[i];
    }
    ll ans=0,rep=0;
    for (int i=0;i<n-1;i++)
    {
        if (A[i]>=A[i+1])
        {
            rep++;
        }
        else
        {
            ans=max(rep,ans);
            rep=0;
        }
    }
    ans=max(rep,ans);
    cout << ans;
    return 0;
}


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

int main() {
	long long n;
	cin >> n;
	vector<long long>a(n);
	for (int i = 0; i < n; i++)cin >> a.at(i);
	sort(a.begin(), a.end());
	vector<long long>sigma = a;
	for (int i = 1; i < n; i++) {
		sigma.at(i) = sigma.at(i - 1) + sigma.at(i);
	}
	reverse(sigma.begin(), sigma.end());
	for (int i = 0; i < n - 1; i++) {
		if (sigma.at(i) > sigma.at(i + 1) * 3) {
			cout << i + 1 << endl;
			return 0;
		}
	}
	cout << n << endl;

	// 100 60 30 10 3 1
}

Measured memory_bytes: 1792
#include <cstdio>
using namespace std;
int main() {
    int N; scanf("%d", &N);
    int min = 1000, max = 0;
    for(int i = 0, t; i < N; i++) {
        scanf("%d", &t);
        if(t < min) min = t;
        if(t > max) max = t;
    }
    printf("%d", max-min);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<pr> vp;
typedef vector<vp> vpp;
typedef vector<vector<ll> > graph;
#define pb push_back
#define mp make_pair
#define endl '\n'
void set_val(vector<ll>& v, ll val){for(ll i=0;i<v.size();i++) v[i]=val;}

ll mod = pow(10,9) + 7;
ll modulo = 998244353;
double pi = 3.141592653589793238;
ll i_mov[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
ll j_mov[8] = {1, 1, 1, 0, -1, -1, -1, 0};


ll power(ll a, ll n)
{
    if(n==0)
    return 1;
    ll temp = power(a,n/2);
    if(n%2==0)
    return (temp*temp)%mod;
    return (((temp*temp)%mod)*a)%mod;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout<<fixed;
    cout<<setprecision(10);
    ll n;
    cin>>n;
    vector<ll> a(n);
    map<ll,ll> m;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    ll ans = 0;
    for(auto itr = m.begin(); itr!=m.end(); itr++)
    {
        ll t = itr->second;
        ans += (t*(t-1))/2;
    }
    for(int i=1;i<=n;i++)
    {
        ll t = ans - m[a[i-1]] + 1 ;
        cout<<t<<endl;
    }
    
    
    
} 

Measured memory_bytes: 11136