akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,sx,sy,tx,ty;
  string s;
  cin >> n >> sx >> sy >> tx >> ty >> s;
  sx--,sy--,tx--,ty--;
  if(tx<ty) {
    swap(tx,ty);
    swap(sx,sy);
  }
  while(sx<tx) {
    if(sx+2<=tx) {
      if(s[sx+2]=='#');
      else {
        if(sx+2==sy){
          if(sy+1<=ty&&s[sy+1]=='.') {
            sy++;
            continue;
          }
          if(sy+2<=ty&&s[sy+2]=='.') {
            sy+=2;
            continue;
          }
        } else {
          sx+=2;
          continue;
        }
      }
    }
    if(sx+1<=tx) {
      if(s[sx+1]=='#');
      else {
        if(sx+1==sy){
          if(sy+1<=ty&&s[sy+1]=='.') {
            sy++;
            continue;
          }
          if(sy+2<=ty&&s[sy+2]=='.') {
            sy+=2;
            continue;
          }
        } else {
          sx++;
          continue;
        }
      }
    }
    pr("No");
    return;
  }
  while(sy<ty) {
    if(sy+2<=ty) {
      if(s[sy+2]=='#'||sy+2==sx);
      else {
        sy+=2;
        continue;
      }
    }
    if(sy+1<=ty) {
      if(s[sy+1]=='#'||sy+1==sx);
      else {
        sy++;
        continue;
      }
    }
    pr("No");
    return;
  }
  if(sx==tx&&sy==ty) pr("Yes");
  else pr("No");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 592
#include <bits/stdc++.h>
#define upd(x,y) x=(x+(y)>=mu?x+(y)-mu:x+(y))
const int mu=1000000007,N=2005;
int dp[N][N],p[N*N],inv[N*N],n,k;
int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=1ll*x*x%mu)
		if (y&1) ans=ans*1ll*x%mu;
	return ans;
}
int C(int x,int y){
	return 1ll*p[x]*inv[y]%mu*inv[x-y]%mu;
}
int main(){
	scanf("%d%d",&n,&k);
	if (k==1){
		puts("1");
		return 0;
	}
	int tot=n*k;
	dp[0][0]=1;
	p[0]=1;
	for (int i=1;i<=tot;i++) p[i]=1ll*p[i-1]*i%mu;
	inv[tot]=ksm(p[tot],mu-2);
	for (int i=tot;i;i--) inv[i-1]=inv[i]*1ll*i%mu;
	for (int i=0;i<=n;i++){//放了几个0 
		for (int j=i;j>=0;j--){//几个颜色没放完 
			upd(dp[i+1][j+1],dp[i][j]);//放一个0
			if(j) upd(dp[i][j-1],1ll*dp[i][j]*(n-(i-j))%mu*C((n-i)*k+j*(k-1)-1,k-2)%mu);//放一个颜色的第一个 
		}
	}
	printf("%d\n",dp[n][0]%mu);
}

Measured memory_bytes: 47360
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define MM (ll) 1e8
#define INF (ll) 1e18

# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)


using namespace std;


template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const pair <ll,ll> &a,const pair <ll,ll> &b){
    return a.second<b.second;
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};


struct c_h {
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        x ^= FIXED_RANDOM;
        return x ^ (x >> 16);
    }
};

ll calcpow(ll x, ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = calcpow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
    {
        if(y > 0)
            return x * temp * temp;
        else
            return (temp * temp) / x;
    }
}
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);

}
ll egcd(ll a, ll b, ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1;
    ll y1;
    ll g=egcd(b,a%b,x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return g;
}


bool isprime(ll a){
bool flag=1;
for(ll i=2;i*i<=a;i++){
    if(a%i==0) {flag=0; break;}
}
return flag;
}

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


int main(){
    IOS;
    make2(ll,n,m); make(ll,k);
    vector <string> vec(n);
    fr(i,n) cin>>vec[i];
    ll ans=0;
    for(ll i=0;i<(1<<n);i++){
        for(ll j=0;j<(1<<m);j++){
            ll c=0;
            fr(p,n){
                fr(k,m){
                    if((i&(1<<p)) && (j&(1<<k)) && (vec[p][k]=='#')) c++;
                  //  cout<<(i&(1ll<<p));
                }
            }
            if(c==k) ans++;
          //  cout<<c<<endl;
        }
    }
    cout<<ans<<endl;


    return 0;
}


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

using namespace std;

int main()
{
        string s;
        cin >> s;
        int count = 0;

        for (int i = 0; i < (int)s.size(); ++i)
        {
                if (s == "RSR")
                {
                        count = 1;
                        break;
                }
                else if (s[i] == 'R')
                {
                        count++;
                }
        }
        cout << count << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;


int main()
{
	double n, a[1000],S,m,A,x;
	while (1) {
		cin >> n;
		if (n == 0)
			break;
		for (int i = 0;i < n;i++)
			cin >> a[i];
		S = 0;
		for (int j = 0;j < n;j++)
			S = S + a[j];
		m = S / n;
		A = 0;
		for (int k = 0;k < n;k++)
			A = A + pow(a[k] - m, 2);
		x=sqrt(A / n);
		printf("%.8lf\n", x);

	}
    return 0;
}


Measured memory_bytes: 3280
#include <iostream>
#include <string>
#include <utility>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <tuple>
using namespace std;
using ll=long long;
ll gcd(ll a,ll b){return (b==0?a:gcd(b,a%b));}
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,n) for(int i=a;i<n;i++)
constexpr ll INF=1000000011;


int main (){
    ll n;
    ll k,c=0;

    cin >> n;
    c =  sqrt(n);

    while (true){
        if(n%c != 0){
            c--;
        }
        else break;
    }

    k = c-1 + n/c-1;

    cout << k << endl;

}

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

using namespace std;

const int MAXN = 1e6 + 7;

#define int long long

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22)
    {
        cout << "bust" << endl;
    }
    else
    {
        cout << "win" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import numpy as np
s = input()

n = len(s)
iters = 2 ** (n - 1)
count = 0
for i in range(iters):
    buf = s[0]
    for j in range(n - 1):
        if i & (2**j):
            count += int(buf)
            buf = s[j + 1]
        else:
            buf += s[j + 1]
    count += int(buf)
print(count)

Measured memory_bytes: 12664
from collections import Counter

n = int(input())
S = [input() for i in range(n)]

L = Counter(S)
m = 0
for v in L.values():
    m = max(m, v)
ans = []
for k, v in L.items():
    if v == m:
        ans.append(k)
ans.sort()
print(*ans, sep="\n")

Measured memory_bytes: 35948
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <time.h>
using namespace std;
typedef long long ll;
bool x[110], y[110];
int main() {
	string s;
	ll k;
	cin >> s >> k;
	for (int i = 0; i < s.size(); i++) {
		if (i + 1 == k) {
			cout << s[i] << endl;
			system("PAUSE");
			return 0;
		}
		if (s[i] != '1') {
			cout << s[i] << endl;
			system("PAUSE");
			return 0;
		}
	}
	cout << 1 << endl;
	system("PAUSE");
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()

const int MAX = 1e5+10;

ll N, M;
ll A[MAX], acc_A[MAX];

ll count_pair(ll h) {
    ll ret = 0;
    REP (n, N) {
        ll lt = -1, geq = N;
        while (geq - lt > 1) {
            ll mid = (lt + geq) / 2;
            if (A[n] + A[mid] >= h) geq = mid;
            else lt = mid;
        }

        ret += N-geq;
    }
    return ret;
}

ll sum_happy(ll h) {
    ll ret = 0;
    REP (n, N) {
        ll lt = -1, geq = N;
        while (geq - lt > 1) {
            ll mid = (lt + geq) / 2;
            if (A[n] + A[mid] >= h) geq = mid;
            else lt = mid;
        }
        ret += A[n] * (N-geq) + acc_A[N] - acc_A[geq];
    }
    return ret;
}

ll solve() {
    sort(A, A+N);
    acc_A[0] = 0;
    REP (i, N) acc_A[i+1] = acc_A[i] + A[i];

    ll over = 0, under = 1e18; // M回を超える最低幸福度
    while (under - over > 1) {
        ll mid = (over + under) / 2;
        if (count_pair(mid) <= M) under = mid;
        else over = mid;
    }
    return sum_happy(under) + (M - count_pair(under)) * over;
}

int main() {
    cin >> N >> M;
    REP (i, N) cin >> A[i];
    cout << solve() << endl;
}

Measured memory_bytes: 1920
// 以下のライブラリを使ってみる.
// JeBeK氏.
// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2033799#1
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5;
int n, m, t, h[maxn], f[maxn];
bool mark[maxn], ans[maxn];
vector<int> G[maxn];

void dfs(int v){
    mark[v] = true;
    f[v] = h[v];
    for(int i = 0; i < G[v].size(); i++){
        int u = G[v][i];
        if(!mark[u]){
            h[u] = h[v] + 1;
            dfs(u);
            if(v == 0) t++;
            if(v != 0 && f[u] >= h[v]) ans[v] = true;
            f[v] = min(f[v], f[u]);
        }
        else if(h[u] < h[v] - 1) f[v] = min(f[v], h[u]);
    }
}

int main(){
    scanf("%d %d", &n, &m);
    for(int i = 0; i < m; i++){
        int v, u;
        scanf("%d %d", &v, &u);
        G[v].push_back(u);
        G[u].push_back(v);
    }
    dfs(0);
    if(t > 1) ans[0] = true;
    for(int i = 0; i < n; i++) if(ans[i]) printf("%d\n", i);
    return 0;
}


Measured memory_bytes: 9124
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
const ll MOD=924844033;
struct Edge
{
	int to;
	int next;
}e[1000005];
int n,m,edgenum,head[200005],pa[200005],size[200005];
int limit=1,l,r[1000005];
ll A[1000005],B[1000005],fact[1000005],inv[1000005];
void add(int u,int v)
{
	e[++edgenum].to=v;
	e[edgenum].next=head[u];
	head[u]=edgenum;
}
ll quick_pow(ll x,ll a)
{
	ll ans=1;
	while(a)
	{
		if(a&1)ans=ans*x%MOD;
		x=x*x%MOD;
		a>>=1;
	}
	return ans;
}
void dfs(int node)
{
	size[node]=1;
	for(int hd=head[node];hd;hd=e[hd].next)
	{
		int to=e[hd].to;
		if(to==pa[node])continue;
		pa[to]=node;
		dfs(to);
		A[n]++;
		A[size[to]]--;
		A[n-size[to]]--;
		size[node]+=size[to];
	}
}
void NTT(ll*A,int type)
{
	for(int i=0;i<limit;i++)
	  if(i<r[i])swap(A[i],A[r[i]]);
	for(int mid=1;mid<limit;mid<<=1)
	{
		ll Wn=quick_pow(5,(MOD-1)/(mid<<1));
		for(int R=mid<<1,j=0;j<limit;j+=R)
		{
			ll w=1;
			for(int k=0;k<mid;k++,w=w*Wn%MOD)
			{
				ll x=A[j+k],y=A[j+mid+k]*w%MOD;
				A[j+k]=x+y;
				A[j+mid+k]=x-y;
				if(A[j+k]>MOD)A[j+k]-=MOD;
				if(A[j+mid+k]<0)A[j+mid+k]+=MOD;
			}
		}
	}
	if(type==-1)
	{
		ll inv=quick_pow(limit,MOD-2);
		for(int i=0;i<limit;i++)A[i]=A[i]*inv%MOD;
		for(int i=1;i<(limit>>1);i++)swap(A[i],A[limit-i]);
	}
}
ll C(ll n,ll m)
{
	return fact[n]*inv[m]%MOD*inv[n-m]%MOD;
}
int main()
{
	scanf("%d",&n);
	fact[0]=1;
	for(int i=1;i<=n;i++)fact[i]=fact[i-1]*i%MOD;
	inv[n]=quick_pow(fact[n],MOD-2);
	for(int i=n-1;i>=0;i--)inv[i]=inv[i+1]*(i+1)%MOD;
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v);
		add(v,u);
	}
	dfs(1);
	for(int i=1;i<=n;i++)
	{
		if(A[i]<0)A[i]+=MOD;
		A[i]=A[i]*fact[i]%MOD;
	}
	for(int i=0;i<=n;i++)
	  B[n-i]=inv[i];
	while(limit<=2*n)limit<<=1,l++;
	for(int i=0;i<limit;i++)
	  r[i]=(r[i>>1]>>1)|((i&1)<<l-1);
	NTT(A,1);
	NTT(B,1);
	for(int i=0;i<limit;i++)A[i]=A[i]*B[i]%MOD;
	NTT(A,-1);
	for(int i=1;i<=n;i++)A[i]=(A[n+i]*inv[i]+C(n,i))%MOD;
	for(int i=1;i<=n;i++)
	  printf("%lld\n",A[i]);
	return 0;
}

Measured memory_bytes: 38272
<?php
[$N, $K] = fscanf(STDIN, "%d%d");
$P = [0, ...fscanf(STDIN, str_repeat("%d", $N))];
$C = [0, ...fscanf(STDIN, str_repeat("%d", $N))];
$loop = [];
$lno = 0;
$visited = array_fill(1,$N,0);
for($i=1;$i<=$N;$i++){
    if($visited[$i] === 1){
        continue;
    }
    $t = $i;
    while($visited[$t] !==1){
        $loop[$lno][] = $C[$t];
        $visited[$t] = 1;
        $t = $P[$t];
    }
    $lno++;
}
$max = PHP_INT_MIN;
foreach($loop as $value){
    $sum = array_sum($value);
    $count = count($value);
    $point = 0;
    $tmp_max = PHP_INT_MIN;
    $tmpb_max = PHP_INT_MIN;
    if($sum >= 0){
        $max = max($max, 0);
        $lcount = intdiv($K, $count);
        if($lcount == 0){
            $zan = $K;
            $zanb = 0;
        }else{
            $point = ($lcount - 1) * $sum;
            $max = max($max, $point + $sum);
            $zanb = $K - $lcount * $count;
//            $max = max($point, $max);
            $zan = $count;
        }

    }else{
        $zanb = 0;
//        $point = PHP_INT_MIN;
        if($K >= $count){
            $zan = $count;
        }else{
            $zan = $K;
        }
    }
    for($i=1;$i<=$zan;$i++){
        $tmp_point = 0;
        if($i === $count){
            $tmp_point = $sum;
            $tmp_max = max($tmp_point, $tmp_max);

            if($zanb >= $i){
                $tmpb_max = max($tmp_point, $tmpb_max);
            }
            continue;
        }
        for($j=0;$j<$count;$j++){
            if($j === 0){
                for($k = 0;$k < $i; $k++){
                    $tmp_point += $value[$k];
                }
                if($zanb >= $i){
                    $tmpb_max = max($tmp_point, $tmpb_max);
                }
                $tmp_max = max($tmp_point, $tmp_max);
            }else{
                if($j + $i  > $count){
                    $newj = $j + $i - $count -1;
                }else{
                    $newj = $j + $i - 1;
                }
                $tmp_point -= $value[$j-1];
                $tmp_point += $value[$newj];
                if($zanb >= $i){
                    $tmpb_max = max($tmp_point, $tmpb_max);
                }
                $tmp_max = max($tmp_point, $tmp_max);
            }
        }


    }

    $max = max($max,  $point + $tmp_max, $point + $tmpb_max + $sum);


}
echo $max;

Measured memory_bytes: 17104
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, A: int, B: int, X: "List[int]"):
    tot = 0
    for i in range(N-1):
        sub = X[i+1]-X[i]
        if sub*A < B:
            tot += sub*A
        else:
            tot += B
    print(tot)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B, X)


if __name__ == '__main__':
    main()


Measured memory_bytes: 15148
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		int[] Xs= new int[N];
		for(int i=0;i<N;i++) {
			Xs[i] = sc.nextInt();
		}
		int ans= 1_000_000_000;
		for(int i=1;i<101;i++) {
			int total = 0;
			for(int j=0;j<N;j++) {
				total += (int)Math.pow(Xs[j]-i, 2);
			}
			ans = Integer.min(ans, total);
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 24916
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

char a[105][105];
int grid[105][105];
int iran_x[105];
int iran_y[105];

vector<int>vec;

int main() {

	int H,W;

	scanf("%d %d",&H,&W);

	int i,j;

	for(i=0;i<H;i++){
		scanf("%s",a[i]);
	}

	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if(a[i][j]=='.'){grid[i][j]=0;}
			else{grid[i][j]=1;}
		}
	}

	while(1){
		int flag=0;

		for(i=0;i<H;i++){
			if(iran_y[i]==1){continue;}
			int cnt=0;
			for(j=0;j<W;j++){
				if(a[i][j]=='.' || a[i][j]=='_'){cnt++;}
			}
			if(cnt==W){
				flag=1;
				for(j=0;j<W;j++){
					a[i][j]='_';
				}
				iran_y[i]=1;
				break;
			}
		}
		for(j=0;j<W;j++){
			if(iran_x[j]==1){continue;}
			int cnt=0;
			for(i=0;i<H;i++){
				if(a[i][j]=='.' || a[i][j]=='_'){cnt++;}
			}
			if(cnt==H){
				flag=1;
				for(i=0;i<H;i++){
					a[i][j]='_';
				}
				iran_x[j]=1;
				break;
			}
		}
		if(flag==0){break;}
	}
	int cnt_y=H;
	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
		if(iran_y[i]==1){grid[i][j]=-1;}
		}
		if(iran_y[i]==1){cnt_y--;}
	}
	int cnt_x=W;
	for(j=0;j<W;j++){
		for(i=0;i<H;i++){
		if(iran_x[j]==1){grid[i][j]=-1;}
		}
		if(iran_x[j]==1){cnt_x--;}
	}

	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if(grid[i][j]!=-1){
			vec.push_back(grid[i][j]);
			}
		}
	}
	for(i=0;i<cnt_y;i++){
		for(j=0;j<cnt_x;j++){
			if(vec[i*cnt_x+j]==0){printf(".");}
			else if(vec[i*cnt_x+j]==1){printf("#");}
	}
		printf("\n");
	}

	return 0;
}

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

int main() {
    int a,b;cin>>a>>b;
    int ans=0,c=1;

    for(int i=1;i<21;++i){
        if(c>=b)break;
        c = c+a-1;
        ans+=1;
    }

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

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cctype>
#include<queue>
using namespace std;
#define G getchar()
int read()
{
	int x=0; bool flg=false; char ch=G;
	for (;!isdigit(ch);ch=G) if (ch=='-') flg=true;
	for (;isdigit(ch);ch=G) x=(x<<3)+(x<<1)+(ch^48);
	return flg?-x:x;
}
typedef long long ll;
const ll INF=0x7fffffffffffffffLL;

int n,X,Y,Z; ll ans;
int Xres,Yres;
struct Rec{
	ll x,y;
}rec[100010];
int cond[100010];  //0 null 1 au->ag 2 ag->au
struct Node{
	ll val; int id;
};
bool operator<(const Node x,const Node y)
{
	return x.val<y.val;
}
bool cmp(const Node x,const Node y)
{
	return y<x;
}
Node que1[100010]; int hd1,tl1;
Node que2[100010]; int hd2,tl2;
priority_queue<Node> que3,que4;
int main()
{
	//freopen("data.in","r",stdin);
	//freopen("A.out","w",stdout);

	X=read(),Y=read(),Z=read(),n=X+Y+Z;
	for (int i=1,x,y,z;i<=n;i++)
	{
		x=read(),y=read(),z=read();
		ans+=z; rec[i].x=x-z,rec[i].y=y-z;
		que1[++tl1]=(Node){rec[i].x,i};
		que2[++tl2]=(Node){rec[i].y,i};
	}
	sort(que1+1,que1+tl1+1,cmp); sort(que2+1,que2+tl2+1,cmp);
	Xres=X,Yres=Y;
	for (int i=1;i<=X+Y;i++)
	{
		ll A,B,C,D;
		while (hd1<tl1&&cond[que1[hd1+1].id]!=0) hd1++;
		A=(Xres&&hd1<tl1?que1[hd1+1].val:-INF);
		
		while (hd2<tl2&&cond[que2[hd2+1].id]!=0) hd2++;
		B=(Yres&&hd2<tl2?que2[hd2+1].val:-INF);
		
		while (!que3.empty()&&cond[que3.top().id]!=1) que3.pop();
		C=(Xres&&!que3.empty()&&hd2<tl2?que3.top().val+que2[hd2+1].val:-INF);
		
		while (!que4.empty()&&cond[que4.top().id]!=2) que4.pop();
		D=(Yres&&!que4.empty()&&hd1<tl1?que4.top().val+que1[hd1+1].val:-INF);
		
		
		//puts("que1:"); for (int j=hd1+1;j<=tl1;j++) printf("%d ",que1[j].id); putchar('\n');
		//puts("que2:"); for (int j=hd2+1;j<=tl2;j++) printf("%d ",que2[j].id); putchar('\n');
		//printf("que3.empty %d  que4.empty %d\n",que3.empty(),que4.empty());
		
		//printf("A %lld B %lld C %lld D %lld\n",A,B,C,D);
		
		if (A>=B&&A>=C&&A>=D)
		{
			ans+=A; Xres--;
			int u=que1[hd1+1].id;
			cond[u]=2;
			que4.push((Node){rec[u].y-rec[u].x,u});
			//printf("%d choose gold  %lld\n",u,A);
		}
		else if (B>=A&&B>=C&&B>=D)
		{
			ans+=B; Yres--;
			int u=que2[hd2+1].id;
			cond[u]=1;
			que3.push((Node){rec[u].x-rec[u].y,u});
			//printf("%d choose silver  %lld\n",u,B);
		}
		else if (C>=A&&C>=B&&C>=D)
		{
			ans+=C; Xres--;
			int u=que3.top().id,v=que2[hd2+1].id;
			cond[u]=2,cond[v]=1;
			que4.push((Node){rec[u].y-rec[u].x,u});
			que3.push((Node){rec[v].x-rec[v].y,v});
			//printf("%d choose gold not silver\n%d choose silver  %lld\n",u,v,C);
		}
		else
		{
			ans+=D; Yres--;
			int u=que4.top().id,v=que1[hd1+1].id;
			cond[u]=1,cond[v]=2;
			que3.push((Node){rec[u].x-rec[u].y,u});
			que4.push((Node){rec[v].y-rec[v].x,v});
			//printf("%d choose silver not gold\n%d choose gold  %lld\n",u,v,D);
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 7796
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vecl = vector<ll>;
using Graph = vector<vector<int>>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll K, N;
  ll tmp = 0;
  long double ans = 0.00;
  cin >> N >> K;
  vector<ll> p(N + 1);
  REP(i, N) {
    int x;
    cin >> x;
    p.at(i + 1) = p.at(i) + (x + 1);
  }
  for (int j = K; j <= N; j++) {
    tmp = max(tmp, p.at(j) - p.at(j - K));
  }
  ans = tmp / 2.00;
  cout << ans << endl;
}

Measured memory_bytes: 1792
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import GHC.ST
-- import System.IO.Unsafe
 
-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
whenM :: Monad m => m Bool -> m () -> m ()
whenM c a = c >>= flip when a
-- templete

f a b rs = any (\[s,f] -> all (/=[a,b]) $ splitRec 2 $ sort [a,b,s,f]) rs


main = apply2 f <$> getInts <*> (getInt >>= flip replicateM getInts) >>= print . cond 1 0



Measured memory_bytes: 4116
#include <iostream>
#define int long long
using namespace std;

int seg = 1,dat[300000];

void add(int i,int x){
	i += seg - 1;
	dat[i] += x;
	while(i){
		i = (i - 1) / 2;
		dat[i] = max(dat[i * 2 + 1],dat[i * 2 + 2]);
	}
}

int get(int a,int b,int k,int l,int r){
	if(b <= l || r <= a) return 0;
	if(a <= l && r <= b) return dat[k];
	return max(get(a,b,k * 2 + 1,l,(l + r) / 2),get(a,b,k * 2 + 2,(l + r) / 2,r));
}

signed main(){
	int n,a[100000];
	cin >> n;
	while(seg < n) seg *= 2;
	for(int i = 0;i < n;i++) {
		cin >> a[i];
		add(a[i] - 1,get(0,a[i],0,0,seg) + a[i]);
	}
	cout << n * (n + 1) / 2 - dat[0] << endl;
	return 0;
}

Measured memory_bytes: 5432
import sys
# from math import log2 // New in Python 3.3, not in PyPy3 2.4 (Python 3.2.5)

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

AB = []
for _ in range(N):
    AB.append([int(s) for s in input().split()])

ans = sum([b for a, b in AB if K | a == K])
# for i in range(int(log2(K)), 0, -1):
for i in range(int.bit_length(K) - 1, 0, -1):
    if not K & (1 << i):
        continue
    km = K & ~(1 << i) | (1 << i) - 1
    anscand = sum([b for a, b in AB if km | a == km])
    ans = max(ans, anscand)
print(ans)


Measured memory_bytes: 22088
n,d = gets.chomp.split(' ').map(&:to_i)
arr = []
i = 0
while i < n
  a = gets.chomp.split(' ').map(&:to_i)
  arr << a
  i += 1
end
# p arr
answers = []
i = 0
while i < n
  j = i+1
  while j < n
    k = 0
    ans = 0
    while k < d
      ans += (arr[i][k] - arr[j][k])**2 
      k += 1
    end
    answers << Math.sqrt(ans)
    j += 1
  end
  i += 1
end
# p answers
count = 0
i = 0
while i < answers.size
  if answers[i] % 1 == 0
    count += 1
  end
  i += 1
end
puts count

Measured memory_bytes: 14284
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>

int main(){
    int n, k;
    std::cin >> n >> k;

    int val;
    std::vector<int> a(n);
    for(int i = 0; i < n; ++i){
        std::cin >> val;
        ++a.at(val - 1);
    }

    std::sort(a.begin(), a.end(), std::greater<int>());

    std::cout << std::accumulate(a.begin() + k, a.end(), 0) << std::endl;

    return 0; 
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <memory.h>
#include <list>
#include <numeric>
#include <functional>
#include <complex>
#include <unordered_set>
#include <cctype>
#include <cassert>


using namespace std;

typedef long long ll;
typedef long double ld;

const int nax = 3005;

int dp[nax][nax];
pair<int, int>par[nax][nax];

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("angle2.in", "r", stdin);
	//freopen("angle2.out", "w", stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	string s, t;
	cin >> s >> t;

	int n = (int)s.size();
	int m = (int)t.size();

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (s[i - 1] == t[j - 1]) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
				par[i][j] = { i - 1, j - 1 };
				continue;
			}

			if (dp[i - 1][j] > dp[i][j]) {
				dp[i][j] = dp[i - 1][j];
				par[i][j] = { i - 1, j };
			}

			if (dp[i][j - 1] > dp[i][j]) {
				dp[i][j] = dp[i][j - 1];
				par[i][j] = { i, j - 1 };
			}
		}
	}

	string ans = "";
	pair<int, int>cur = { n, m };
	while (ans.size() < dp[n][m]) {
		auto to = par[cur.first][cur.second];
		if (dp[cur.first][cur.second] > dp[to.first][to.second]) {
			ans += s[cur.first - 1];
		}

		cur = to;
	}

	reverse(ans.begin(), ans.end());
	cout << ans;
	return 0;
}

Measured memory_bytes: 105984
h,w = map(int, input().split())
cells = [[c for c in row] for row in [input() for i in range(h)] if '#' in row]

h = len(cells)
for i in range(w-1, -1, -1):
  has_block = False
  for j in range(h):
    if cells[j][i] == '#':
      has_block = True
      break
  if not has_block:
    for j in range(h):
      cells[j].pop(i)
  

for row in cells:
  print(''.join(row))


Measured memory_bytes: 3060
def bipartite(g):
    s = [(0, 1)]
    c = [0] * n
    while s:
        v, color = s.pop()
        c[v] = color
        for node in g[v]:
            if c[node] == c[v]:
                return False, None
            if c[node] == 0:
                s.append((node, -color))
    return True, c

n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)
b, colors = bipartite(g)
if b:
    x = colors.count(1)
    print(x * (n - x) - m)
else:
    print(n * (n - 1) // 2 - m)


Measured memory_bytes: 65132
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
    public static void main(String[] args) {
        FastReader read = new FastReader();
        int n = read.nextInt();
        int array[] = new int[n];
        long sum1 = 0;
        long sum2 = 0;
        for(int i = 0; i<n; i++){
            array[i] = read.nextInt();
                
        }
        int p1 = 0;
        int p2 = n-1;
        while(p1-1!=p2){
            if(sum1>sum2){
                sum2+=array[p2];
                p2--;
            }
            else{
                sum1+= array[p1];
                p1++;
            }
        }
        System.out.println(Math.abs(sum1-sum2));
    }
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
}


Measured memory_bytes: 58640
import java.util.*;

class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                int H = sc.nextInt();
                int W = sc.nextInt();
                int M[][] = new int[H][W];
                int dp[][] = new int[H][W];
                for (int i = 0; i < H; i++) {
                        String S = sc.next();
                        for (int j = 0; j < W; j++) {
                                M[i][j] = Integer.parseInt(""+S.charAt(j));
                                dp[i][j] = 1 << 28;
                        }
                }
                dp[0][0] = M[0][0];
                for (int i = 0; i < H; i++) {
                        for (int j = 0; j < W; j++) {
                                if (i > 0) {
                                        dp[i][j] = Math.min(dp[i][j], dp[i-1][j] + M[i][j]);
                                }
                                if (j > 0) {
                                        dp[i][j] = Math.min(dp[i][j], dp[i][j-1] + M[i][j]);
                                }
                        }
                }
                System.out.println(dp[H-1][W-1]);
        }
}

Measured memory_bytes: 27024
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int INTMAX = 2147483647;
const int INTMIN = -2147483648;
const unsigned int UINTMAX = 4294967295;
const long LONGMAX = 9223372036854775807;
const long LONGMIN = -9223372036854775808;
const unsigned long ULONGMAX = 18446744073709551615;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int dig(int n, int a) {return n/(int)pow(10,a)%10;}
int digl(long n, int a) {return n/(long)pow(10,a)%10;}
int digsum(int n) {int r=0;REP(i,10){r+=dig(n,i);}return r;}
int digsuml(long n) {int r=0;REP(i,19){r+=digl(n,i);}return r;}
int dignum(int n) {return n?to_string(n).length():0;}
int dignuml(long n) {return n?to_string(n).length():0;}

int main(){
  int n,j,k,l,m;
  cin >> n;
  l=1;
  m=0;
  cin >> j;
  REP(i,n-1){
    cin >> k;
    if (j==k) {
      l++;
    } else {
      m+=l/2;
      l=1;
    }
    j=k;
  }
  m+=l/2;
  cout << m;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int h1, h2, m1, m2, k;
  scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
  int awake = 60 * (h2 - h1) + (m2 - m1);
  printf("%d", awake - k);
}

Measured memory_bytes: 3812
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <cmath>
using namespace std;

bool evenstr(string s){
    int n = s.size();
    bool ret = true;
    for(int i = 0; i < n / 2; i++){
        if(s[i] != s[n/2+i]) ret = false;
    }
    return ret;
}

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < s.size(); i += 2){
        if(evenstr(s.substr(0,i))) ans = i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

s = inputSL()

if s[1]=="+":
  print(int(s[0])+int(s[2]))
else:
  print(int(s[0])-int(s[2]))

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

int main(){
	
	ll n, sum = 0;
	cin >> n;
	for(int i=1; i<=n; i++){
		if(i%3 == 0 or i%5 == 0) continue;
		sum += i;
	}	
	
	cout << sum << endl;
	
	
	return 0;
}


Measured memory_bytes: 3636
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String a = fs.next(), b = fs.next(), c = fs.next();
        System.out.print((char)(a.charAt(0) - 'a' + 'A'));
        System.out.print((char)(b.charAt(0) - 'a' + 'A'));
        System.out.print((char)(c.charAt(0) - 'a' + 'A'));
        System.out.println();
    }
}


Measured memory_bytes: 21332
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, L, R, H, W;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> N;
	if (N % 10 == 9 || N / 10 == 9) {
		cout << "Yes\n";
		return 0;
	}
	cout << "No\n";
	return 0;
}

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

int main(){

  int N,K;
  cin >> N >> K;

  vector<int> sunuke(N);

  for(int i=0;i<K;i++){
    int d;
    cin >> d;
    for(int j=0;j<d;j++){
      int a;
      cin >> a;a--;
      sunuke[a]++;
    }
  }

  int count = 0;
  for(int i=0;i<N;i++){
    if(sunuke[i]==0) count++;
  }

  cout << count << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;

const ll MOD_CONST = 1000000007;



int main()
{
	int n; 
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<ll> b(n);
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}


	

	ll ans = 0;
	for (int bit = 0; bit <=28; bit++) {
		ll cnt = 0;
		vector<ll> c(b);
		for (int i = 0; i < n; i++) {
			c[i] %= (1LL << (bit + 1));
		}

		sort(c.begin(), c.end());
		for (int i = 0; i < n; i++) {
			ll ai = a[i] % (1LL << (bit + 1));
			auto it1 = lower_bound(c.begin(), c.end(), (1LL << bit)-ai);
			auto it2 = lower_bound(c.begin(), c.end(), 2 * (1LL << bit)-ai);
			auto it3 = lower_bound(c.begin(), c.end(), 3 * (1LL << bit)-ai);
			auto it4 = lower_bound(c.begin(), c.end(), 4 * (1LL << bit)-ai);

			cnt += (it2 - it1);
			cnt += (it4 - it3);


		}
		//cout << cnt << endl;

		if (cnt % 2 == 1) {
			ans += (1LL << bit);
		}
		
	}

	
	cout << ans << endl;
}  



Measured memory_bytes: 4992
/*input
8 12 3 8
2 8 685087149 857180777
6 7 298270585 209942236
2 4 346080035 234079976
2 5 131857300 22507157
4 8 30723332 173476334
2 6 480845267 448565596
1 4 181424400 548830121
4 5 57429995 195056405
7 8 160277628 479932440
1 6 475692952 203530153
3 5 336869679 160714712
2 7 389775999 199123879
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k)     for(int i = j ; i < k ; ++i)
#define RREP(i,j,k)    for(int i = j ; i >=k ; --i)
#define A    first
#define B    second
#define mp   make_pair
#define pb   emplace_back
#define PII pair<int , int>
#define MEM(i,j)   memset(i , j , sizeof i)
#define ALL(i)     i.begin() , i.end()
#define DBGG(i,j)     cout << i << " " << j << endl
#define DB4(i,j,k,l)  cout << i << " " << j << " " << k << " " << l << endl
#define IOS cin.tie(0) , cout.sync_with_stdio(0)
#define endl "\n"
///------------------------------------------------------------
#define int long long
#define MAX 100900
#define INF 1000000000000000


vector<PII> v[MAX];
int dis[MAX] , n;
void dijkstra(int s){
    priority_queue<PII , vector<PII> , greater<PII> > pq;
    REP(i , 1 , n + 1) dis[i] = INF;
    dis[s] = 0 , pq.push(mp(0 , s));
    while(pq.size()){
        int step = pq.top().A , now = pq.top().B;
        pq.pop();
        if(dis[now] != step) continue;
        for(auto to : v[now]){
            if(dis[to.A] > dis[now] + to.B){
                dis[to.A] = dis[now] + to.B;
                pq.push(mp(dis[to.A] , to.A));
            }
        }
    }
}
void ADDE(int s , int t , int val){
    v[s].pb(t , val);
    v[t].pb(s , val);
}
int m , s , t , e[MAX][4] , a[MAX] , b[MAX] , ans[MAX];
int32_t main(){
    IOS;
    cin >> n >> m >> s >> t;
    REP(i , 1 , m + 1) REP(j , 0 , 4) cin >> e[i][j];

    REP(i , 1 , m + 1) ADDE(e[i][0] , e[i][1] , e[i][2]);
    dijkstra(s);
    REP(i , 1 , n + 1) a[i] = dis[i];
    REP(i , 1 , n + 1) v[i].clear();

    REP(i , 1 , m + 1) ADDE(e[i][0] , e[i][1] , e[i][3]);
    dijkstra(t);
    REP(i , 1 , n + 1) b[i] = dis[i];

    // REP(i , 1 , n + 1) cout << a[i] << " " ; cout << endl;
    // REP(i , 1 , n + 1) cout << b[i] << " " ; cout << endl;

    REP(i , 1 , n + 1) ans[i] = a[i] + b[i];
    RREP(i , n - 1 , 1) ans[i] = min(ans[i] , ans[i + 1]);
    REP(i , 1 , n + 1) cout << 1000000000000000 - ans[i] << endl;
    return 0;
}

Measured memory_bytes: 15744
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>

using namespace std;

int main()
{
    size_t n, m;
    cin >> n >> m;
    vector<pair<int, int>> ds(m);
    for(auto& p : ds) cin >> p.first >> p.second;
    
    sort(begin(ds), end(ds), [](const auto& pa, const auto& pb){ return pa.first < pb.first; });
    
    for(size_t i = 1; i < m; ++i)
    {
        auto& pa = ds[i-1];
        auto& pb = ds[i];
        if(pb.first < pa.second) // has union
        {
            pb.second = min(pb.second, pa.second);
            pa.first = pa.second = 0;
        }
    }
    
    cout << count_if(begin(ds), end(ds), [](const auto& p){ return p.first != 0; }) << '\n';
  
    return 0;
}

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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = (1 << 20);                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

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

int n, a[(1 << 18)];
int mx1[(1 << 18)], mx2[(1 << 18)];
int ans[(1 << 18)];
 
inline void upd(int mask, int x) {
    if(x >= mx1[mask]) mx2[mask] = mx1[mask], mx1[mask] = x;
    else if(x >= mx2[mask]) mx2[mask] = x;
}
 
int main() {
    cin >> n;
    for(int i = 0; i < (1 << n); ++i) {
        cin >> a[i];
        mx1[i] = a[i];
        mx2[i] = 0;
    }
    
    for(int i = 0; i < n; i ++) {
    	for(int mask = (1 << n) - 1; mask >= 0; mask --) {
    		if(mask & (1 << i)) continue;
    		upd(mask | (1 << i), mx1[mask]);
    		upd(mask | (1 << i), mx2[mask]);
    	}
    }
    int last = 0;
    for(int i = 1; i < (1 << n); ++i) {
    	last = max(last, mx1[i] + mx2[i]);
    	cout << last << '\n';
    }
 }

Measured memory_bytes: 6144
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
  double W, H, x, y;
  cin >> W >> H >> x >> y;
  printf("%.9f %d\n", W * H / 2.0, W * H / (x * y) == 4.0);
}


Measured memory_bytes: 256