akhauriyash/Code-Regression huggingface dataset:
#pragma region

#ifdef LOCAL
#define debug cout
#else
#define debug \
    if (0) cout
#endif

#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using ll = long long;

template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[ ";
    for (auto e : v) os << e << " ";
    return os << "]";
}

template <typename T, typename V>
ostream& operator<<(ostream& os, set<T, V> v) {
    os << "{ ";
    for (auto e : v) os << e << " ";
    return os << "}";
}

template <typename T, typename V, typename S>
ostream& operator<<(ostream& os, map<T, V, S> v) {
    os << "{ ";
    for (auto e : v) os << e << " ";
    return os << "}";
}

template <typename T, typename V>
ostream& operator<<(ostream& os, pair<T, V> x) {
    return os << "( " << x.first << ", " << x.second << " )";
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (auto& e : v) is >> e;
    return is;
}

template <typename T, typename V>
istream& operator>>(istream& is, pair<T, V>& x) {
    return is >> x.first >> x.second;
}

void solve();

int main() {
#ifdef LOCAL
    freopen("data.txt", "r", stdin);
#else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    solve();
}

#pragma endregion

void solve() {
    int n;
    cin >> n;
    vector<vector<int>> x(n, vector<int>(3));
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < 3; ++j)
            cin >> x[i][j];
    vector<vector<int>> dp(n, vector<int>(3));
    for (int j = 0; j < 3; ++j) dp[0][j] = x[0][j];
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j != k) {
                    dp[i][j] = max(dp[i][j], dp[i - 1][k] + x[i][j]);
                }
            }
        }
    }
    cout << *max_element(dp[n - 1].begin(), dp[n - 1].end()) << "\n";
}

Measured memory_bytes: 11264
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2020 Bjarni Dagur Thor Karason

#include <bits/stdc++.h>

using namespace std;

#define rep(i,a,b) for (__typeof(a) i=(a); i<(b); i++)
#define MP make_pair
#define PB push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000
#define PI 3.14159265359

int n, m, x, ans = INF;
vi cost, vals[13], cur;

bool valid()
{
    for (auto u : cur) {
        if (u < x) return false;
    }
    return true;
}

void dp(int at, int spent)
{
    if (valid()) {
        ans = min(ans, spent);
        return;
    }
    if (at == n) return;
    for (int i = 0; i < m; i++) {
        cur[i] += vals[at][i];
    }
    dp(at + 1, spent + cost[at]);
    for (int i = 0; i < m; i++) {
        cur[i] -= vals[at][i];
    }
    dp(at + 1, spent);
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    cin >> n >> m >> x;
    cost.resize(n);
    cur.resize(m, 0);
    for (int i = 0; i < n; i++) {
        cin >> cost[i];
        for (int j = 0; j < m; j++) {
            int in;
            cin >> in;
            vals[i].PB(in);
        }
    }
    dp(0, 0);
    cout << (ans == INF ? -1 : ans) << endl;

    return 0;
}

Measured memory_bytes: 3664
#include <queue>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };
int main() {
	int H, W;
	cin >> H >> W;
	vector<string> S(H);
	for (int i = 0; i < H; ++i) cin >> S[i];
	queue<pair<int, int> > que;
	vector<vector<int> > dist(H, vector<int>(W, -1));
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (S[i][j] == '#') {
				que.push(make_pair(i, j));
				dist[i][j] = 0;
			}
		}
	}
	while (!que.empty()) {
		pair<int, int> u = que.front(); que.pop();
		for (int i = 0; i < 4; ++i) {
			int tx = u.first + dx[i], ty = u.second + dy[i];
			if (0 <= tx && tx < H && 0 <= ty && ty < W && dist[tx][ty] == -1) {
				dist[tx][ty] = dist[u.first][u.second] + 1;
				que.push(make_pair(tx, ty));
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			ans = max(ans, dist[i][j]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 13456
x,k=map(int,input().split())
arr=list(map(int,input().split()))
dp=[float('inf')]*len(arr)
dp[0]=0
dp[1]=abs(arr[1]-arr[0])
for i in range(2,len(arr)):
    for j in range(1,k+1):
        if i-j>=0:
            dp[i]=min(dp[i],dp[i-j]+abs(arr[i-j]-arr[i]))
print(dp[len(arr)-1])
        

Measured memory_bytes: 84988
#include <iostream>
#include <algorithm>
const int maxn=1e6+100;
using namespace std;
long long a[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i=1;i<=n;i++) cin >> a[i];
	sort(a+1,a+1+n);
	int l=1,r=n,cnt=0;
	bool flag=n%2==1?1:0;
	for (int i=1;i<=n;i++)
		if (a[i]<0) cnt++;
	long long ans;
//cout << cnt;
	if(a[1]>=0){
		long long sum=-a[1];
		for(int i=2;i<=n;i++)sum+=a[i];
			cout<<sum<<endl;
		int tot=a[1];
		for(int i=n-1;i>1;i--){
			cout << tot << ' '<<a[i] <<endl;
			tot-=a[i];
		}
		
		cout << a[n]<<' '<<tot <<endl;
		return 0;
	}
	long long sum=a[n]-a[1];
	for(int i=2;i<n;i++)sum+= a[i]>=0?a[i]:-a[i];
	cout<<sum<<endl;
	long long tot=a[1];
	int i;
	for(i=n-1;i>1;i--){
			if(a[i]<0)break;
			cout << tot << ' '<<a[i] <<endl;
			tot-=a[i];
	}
	cout << a[n]<<' '<<tot<<endl;
	tot=a[n]-tot;
	
	while (i>1){
		//printf("%d %d\n",tot,a[i]);
		cout << tot << ' '<< a[i]<<endl;
		tot-=a[i];
		i--;
	}
	if (1) return 0;

	if (cnt<=n/2){
		ans=0;
		for (int i=1;i<=n;i++)
			ans+=i<=n/2?-a[i]:a[i];
		cout << ans << endl;
	// }
		for (;l<r;){
		if (flag){
			flag = 0;
			cout << a[l] << ' ' << a[r]<<endl;
			a[l] = a[l]-a[r--];
		}else{
			flag = 1;
			cout << a[r] << ' ' << a[l]<<endl;
			a[r] = a[r] - a[l++];
		}
	}

	}else{
		if (cnt == n) cnt--;
		ans=0;//puts("fuck");
		for (int i=1;i<=n;i++)
			ans+=i<=cnt?-a[i]:a[i];
		cout << ans << endl;
	// }
		flag=0;
		for (;l<r && l<n-cnt+1;){
		if (flag){
			flag = 0;
			cout << a[l] << ' ' << a[r]<<endl;
			a[l] = a[l]-a[r--];
		}else{
			flag = 1;
			cout << a[r] << ' ' << a[l]<<endl;
			a[r] = a[r] - a[l++];
	}
}
	int tot=flag?a[r]:a[l];
	for (int i=n-cnt+1;i<=cnt;i++){
		cout << tot <<' '<<a[i]<<endl;
		tot-=a[i];
		//cout << "fuck";
	}
}

	
		ans=0;
		for (int i=1;i<=n;i++)
			ans+=i<=n/2?-a[i]:a[i];
		cout << ans << endl;
	// }
	for (;l<r;){
		if (flag){
			flag = 0;
			cout << a[l] << ' ' << a[r]<<endl;
			a[l] = a[l]-a[r--];
		}else{
			flag = 1;
			cout << a[r] << ' ' << a[l]<<endl;
			a[r] = a[r] - a[l++];
		}
	}
}

Measured memory_bytes: 2688
N,M=map(int,input().split())
a = "a"+input()+"q"
k = []
for i in range(M):
  ta,tb=map(str,input().split())
  k.append([ta,tb])
k = k[::-1]
s = 1
t = N
c=0
for i, j in k:
  if j == "R" and i == a[t]:
    t-=1
    c+=1
  if j == "L" and i == a[s]:
    s+=1
  if j == "R" and i == a[s-1] and s> 1:
    s-=1
  if j == "L" and i == a[t+1] and t< N:
    t+=1
  if s==t+1 and N!=0:break
if N>1:print(t-s+1)
else: 
  if s+c+1>1:print(1)
  else:print(0)


Measured memory_bytes: 25276
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

void solve()
{
    int x;cin>>x;
     REP(i,9)REP(j,9)if((i+1)*(j+1)==x){cout<<"Yes"<<endl;return;}

     cout<<"No"<<endl;
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)
    cin>>a[i];
    int max=0;
    for(int i=0;i<n;i++){
        if(max<a[i])
        max=a[i];
    }
    int min=max;
    for(int i=0;i<n;i++){
        if(min>a[i])
        min=a[i];
    }
    cout<<max-min<<endl;
} 

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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

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

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int k, n;
    ll x[52], y[52], ox[52], oy[52];

    cin >> n >> k;
    REP(i, n)
    {
        cin >> x[i] >> y[i];
        ox[i] = x[i];
        oy[i] = y[i];
    }

    sort(x, x + n);
    sort(y, y + n);

    ll res = LLONG_MAX;

    REP(i, n)
    REP(j, n)
    REP(l, n)
    REP(m, n)
    {
        if (i > j)
            continue;
        if (l > m)
            continue;

        int cnt = 0;

        REP(o, n)
        {
            if (x[i] <= ox[o] && ox[o] <= x[j] && y[l] <= oy[o] && oy[o] <= y[m])
                cnt++;
        }

        if (cnt >= k)
        {
            res = min(res, (x[j] - x[i]) * (y[m] - y[l]));
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
def f_simplified_reversi():
    N, Q = [int(i) for i in input().split()]
    Queries = [[int(i) for i in input().split()] for j in range(Q)]

    a, b = [N] * N, [N] * N  # editorial に準じる
    black_stone = (N - 2)**2
    row, col = N, N

    for type, x in Queries:
        if type == 1:
            if x < col:
                for i in range(x, col):
                    b[i] = row
                col = x
            black_stone -= b[x] - 2
        else:
            if x < row:
                for i in range(x, row):
                    a[i] = col
                row = x
            black_stone -= a[x] - 2
    return black_stone

print(f_simplified_reversi())

Measured memory_bytes: 38836
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    map<char, ll> mp;
    rep(i, n) mp[s[i][0]]++;
    string str = "MARCH";
    ll ans = 0LL;
    rep(i, str.size()) rep(j, i) rep(k, j) {
        ans += mp[str[i]] * mp[str[j]] * mp[str[k]];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    long double n, k; cin >> n >> k;
    long double res = 0;
    long double good = (long double) (n - k + 1) / (long double) n;
    res = max(res, good);
    long double one = (long double) 1.0 / n;
    for (long double i = 1; i <= min(n, k - 1); i++) {
        auto j = i;
        long double div = 1;
        while (j < k) {
            div *= (long double) 2.0;
            j *= (long double) 2.0;
        }
        assert((div * (long double) (n)) >= 1);
        res += (long double) 1.0 / (div * (long double) (n));
    }
    cout << res << "\n";
}


Measured memory_bytes: 256
"use strict";
main(require("fs").readFileSync("/dev/stdin", "utf8").replace(/\r?\n$/, "").split(/\r?\n/));

function main(lines){
	function Dice(labels){
		this.t = labels[0];
		this.s = labels[1];
		this.e = labels[2];
		this.w = labels[3];
		this.n = labels[4];
		this.b = labels[5];
	}
	Dice.prototype.roll = function(dir){
		var temp;
		if(dir == "N"){
			temp = this.t;
			this.t = this.s;
			this.s = this.b;
			this.b = this.n;
			this.n = temp;
		}
		else if(dir == "S"){
			temp = this.t;
			this.t = this.n;
			this.n = this.b;
			this.b = this.s;
			this.s = temp;
		}
		else if(dir == "W"){
			temp = this.t;
			this.t = this.e;
			this.e = this.b;
			this.b = this.w;
			this.w = temp;
		}
		else if(dir == "E"){
			temp = this.t;
			this.t = this.w;
			this.w = this.b;
			this.b = this.e;
			this.e = temp;
		}
	};
	Dice.prototype.isSame = function(other){
		var dice1 = new Dice([this.t, this.s, this.e, this.w, this.n, this.b]);
		var dice2 = new Dice([other.t, other.s, other.e, other.w, other.n, other.b]);
		var dirs = "EEEENEEEENEEEENEEENEEEENNEEEE";
		for(var i=0;i<dirs.length;i++){
			if(dice1.t == dice2.t && dice1.s == dice2.s && dice1.e == dice2.e && dice1.w == dice2.w && dice1.n == dice2.n && dice1.b == dice2.b){
				return true;
			}
			dice2.roll(dirs[i]);
		}
		return false;
	};

	var dices = [];
	var times = +lines.shift();
	var i, j;
	for(i=0;i<times;i++) dices.push(new Dice(lines.shift().split(" ")));
	var found = false;
	loop: for(i=0;i<dices.length;i++) for(j=i+1;j<dices.length;j++){
		if(dices[i].isSame(dices[j])){
			found = true;
			break loop;
		}
	}
	console.log(found ? "No" : "Yes");
}

Measured memory_bytes: 17656
n,a,b=map(int,input().split())
HP=[int(input()) for i in range(n)]
ng=0
ok=10**10
for i in range(40):
    check=(ok+ng)//2
    c=a-b
    cnt=0
    d=list(map(lambda x: x-check*b,HP))
    for j in d:
        cnt+=max(0,(j+c-1)//c)
    if check < cnt:
        ng=check
    else:
        ok=check
print(ok)


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

int a[101];

int main(){
	int n;
	cin>>n;
	int mn=1e9;
	for (int i=0;i<n;i++) cin>>a[i];
	for (int i=1;i<=n;i++){
		int sum1=0,sum2=0;
		for (int j=0;j<i;j++) sum1+=a[j];
		for (int j=i;j<n;j++) sum2+=a[j];
		mn=min(abs(sum1-sum2),mn);
	}
	cout<<mn<<endl;
	return 0;
}

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

using namespace std;

struct kraw
{
    int a, b;
};

int main()
{
    ios_base::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    vector< vector<kraw> > K(1000001);
    for (int i = 0; i < m; ++i)
    {
        int a, b, c;
        cin >> a >> b >> c;
        K[c - 1].push_back({a - 1, b - 1});
    }
    vector< vector<int> > Spo;
    vector< vector<int> > G(n);
    vector<int> u;
    vector<bool> odw(n, false);
    queue<int> Q;
    int akt;
    for (int i = 0; i < 1000001; ++i)
    {
        if (K[i].size() == 0)
            continue;
        for (int j = 0; j < K[i].size(); ++j)
        {
            G[K[i][j].a].push_back(K[i][j].b);
            G[K[i][j].b].push_back(K[i][j].a);
            u.push_back(K[i][j].a);
            u.push_back(K[i][j].b);
        }
        for (int j = 0; j < u.size(); ++j)
        {
            if (!odw[u[j]])
            {
                odw[u[j]] = true;
                Q.push(u[j]);
                vector<int> s;
                while (!Q.empty())
                {
                    akt = Q.front();
                    Q.pop();
                    s.push_back(akt);
                    for (int k = 0; k < G[akt].size(); ++k)
                    {
                        if (!odw[G[akt][k]])
                        {
                            odw[G[akt][k]] = true;
                            Q.push(G[akt][k]);
                        }
                    }
                }
                Spo.push_back(s);
            }
        }
        for (int j = 0; j < u.size(); ++j)
        {
            G[u[j]].clear();
            odw[u[j]] = false;
        }
        u.clear();
    }
    vector< vector<int> > W(1000001);
    for (int i = 0; i < Spo.size(); ++i)
        for (int j = 0; j < Spo[i].size(); ++j)
            W[Spo[i][j]].push_back(i);
    vector<bool> odw_w(n, false);
    vector<bool> odw_s(1000001, false);
    vector<int> D(n, -1);
    Q.push(0);
    D[0] = 0;
    odw_w[0] = true;
    while (!Q.empty())
    {
        akt = Q.front();
        Q.pop();
        for (int i = 0; i < W[akt].size(); ++i)
        {
            int nr = W[akt][i];
            if (!odw_s[nr])
            {
                odw_s[nr] = true;
                for (int j = 0; j < Spo[nr].size(); ++j)
                {
                    if (!odw_w[Spo[nr][j]])
                    {
                        odw_w[Spo[nr][j]] = true;
                        Q.push(Spo[nr][j]);
                        D[Spo[nr][j]] = D[akt] + 1;
                    }
                }
            }
        }
    }
    cout << D[n - 1];
    return 0;
}


Measured memory_bytes: 75436
#include <bits/stdc++.h>
using namespace std;
const int mod = 1'000'000'007, maxn = 200000, maxk = 101;
int mul(long long a, long long b){
	return a * b % mod;
}
vector<pair<int,int> > opt;
int f[maxk][maxn];
int solve(int k, int n){
	if(n < 0) return 0;
	if(k == 0) return 1;
	if(~f[k][n]) return f[k][n];
	int ans = solve(k, n - 1);
	ans += mul(opt[n].first, solve(k - 1, opt[n].second));
	if(ans >= mod) ans -= mod;
	return f[k][n] = ans;
}
int main(){
	int n, k; cin >> n >> k;
	set<tuple<int,int,int>> can;
	vector<int> split_at;
	for(int i = 1; i <= n; ){
		int lo = i + 1, hi = n, ans = i;
		int desire = n / i;
		while(lo <= hi){
			int mid = (lo+hi)>>1;
			if(n / mid == desire) ans = mid, lo = mid + 1;
			else hi = mid - 1;
		}
		can.insert(make_tuple(i, ans, desire));
		split_at.push_back(desire);
		i = ans + 1;
	}
	for(int v : split_at){
		auto it = can.lower_bound(make_tuple(v + 1, -1, -1));
		if(it != can.begin()){
			it--;
			int x, y, z; tie(x, y, z) = *it;
			if(y != v){
				can.erase(it);
				can.insert(make_tuple(x, v, z));
				can.insert(make_tuple(v + 1, y, z));
			}	
		}
	}
	vector<tuple<int,int,int> > conv;
	for(auto e : can) conv.push_back(e);
	for(int i = 0; i < conv.size(); i++){
		int x, y, z; tie(x, y, z) = conv[i];
		int pt = lower_bound(conv.begin(), conv.end(), make_tuple(z + 1, -1, -1)) - conv.begin(); pt--;
		if(get<1>(conv[pt]) != z){
			cout << get<1>(conv[pt]) << " " << pt << " " << z << endl;
		}
		assert(y - x + 1 >= 1);
		assert(get<1>(conv[pt]) == z);
		opt.push_back({y - x + 1, pt});
	}
	memset(f, -1, sizeof(f));
	cout << solve(k, opt.size() - 1) << endl;
	return 0;
}


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

ll modpow(ll a, ll n, ll mod){
    if(n == 0) return 1;
    ll y = modpow(a, n / 2, mod);
    if(n % 2 == 1){
        y = y * y % mod;
        y = y * a % mod;
    }else{
        y = y * y % mod;
    }
    return y;
}

ll modinv(ll a, ll mod){
    return modpow(a, mod - 2, mod);
}

ll nCr(ll  n, ll r, ll mod){
    ll y = 1; //分子
    ll x = 1; //分母
    rep(i,r){
        y = y * (n - i) % mod;
        x = x * (i + 1) % mod;
    }
    x = modinv(x, mod);
    return y * x % mod;
}

int main(){
    ll n, a, b;
    cin >> n >> a >> b;

    ll ans = modpow(2, n, MOD);
    ans -= 1;

    ll nCa = nCr(n,a,MOD);
    ll nCb = nCr(n,b,MOD);

    ans = ans - nCa - nCb;
    ans %= MOD;
    if(ans < 0) ans += MOD;
    
    cout << ans << endl;

    

    return 0;

}

Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int m=sc.nextInt();
        int d[]=new int[n];
        int ac=0,pe=0;
        for (int i = 0; i < m; i++) {
			int a=sc.nextInt()-1;
			char c=sc.nextString().toCharArray()[0];
			db(a,c);
			if(c=='W' && d[a]>=0)d[a]++;
			else if(d[a]>=0){
				pe+=d[a];
				ac++;
				d[a]=-1;
			}
		}

        
        out.println(ac+" "+pe);
     	out.flush();
    }
    
    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x,y; double d;
//	P(int  x, int y, double d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}

//
//class P implements Comparable<P>{
//    int id,ds,p;
//    P(int id, int ds, int p) {
//    	this.id=id;
//    	this.ds=ds;
//    	this.p=p;
//    }
//
//    public int compareTo(P p){
//        return ds-p.ds;
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 55240
words = list(input())
binary_list = []
for word in words:
  if word == "A" or word == "T" or word == "C" or word == "G":
      binary_list.append(1)
  else:
      binary_list.append(0)
max_counter = 0
for first in range(len(binary_list)):
    counter = 0
    multi = 1
    if binary_list[first] == 1:
        while(multi):
            multi *= binary_list[first]
            if multi == 0:
                break
            counter += 1
            if counter >= max_counter:
                max_counter = counter
            if first == len(binary_list) - 1:
                break
            else:
                first += 1
print(max_counter)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
#define MAX(a,b) a > b ? a : b

typedef long long int ll;

using namespace std;
pair<int,int> tree[3000001];
int n,q;

pair<int,int> pmax(pair<int,int> a,pair<int,int> b){
    pair<int,int> ret = MAX(a,b);
    if(a.first == b.first){
	ret.second = min(a.second,b.second);
    }
    return ret;
}

void init(int k,int l,int r){
    if (r-l==1) tree[k] = tree[l];
    else{
	int chl = 2 * k + 1,chr = 2 * k + 2;
	int m = (int)( (l+r) / 2);
	init(chl,l,m);
	init(chr,m,r);
	tree[k] = pmax(tree[chl],tree[chr]);
    }
}

void update(int k ,int a){
    k += n;
    tree[k].first += a;
    while(k > 0){
	k = (k-1)/2;
	tree[k] = pmax(tree[2 * k + 1],tree[2* k + 2]);
    }
}


int main(){
    //pair<int,int> ma(-100000000,-1);
    cin >> n >> q;
    REP(i,2*n) tree[n+i] = pair<int,int>(0,0);
    REP(i,n){
    	tree[n+i].second = i + 1;
    }
    vector< pair<int,int> > ar(n);
    vector<bool> u(q,false);
    REP(i,q){
	int a,v;
	cin >> a >> v;
	update(a-1,v);
	cout << tree[0].second << " " << tree[0].first << endl;
    }
    return 0;
}

Measured memory_bytes: 32456
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

struct edge{int to, cost;};

class Graph
{
public:
    int V;
    vector<vector<edge>> G;

    vec gen, par;
    mat chi, genlist;
    int depth;

    Graph(int V): V(V){
        G = vector<vector<edge>>(V, vector<edge>(0));
    }

    void add_edge(int from, int to, int cost){
        G[from].push_back(edge({to, cost}));
    }

    void add_edge2(int v1, int v2, int cost){
        add_edge(v1, v2, cost);
        add_edge(v2, v1, cost);
    }

    void dfs(int v, int d){
        gen[v] = d;
        depth = max(depth, d + 1);
        REP(k, G[v].size()){
            if(G[v][k].to == par[v]) continue;
            par[G[v][k].to] = v;
            chi[v].push_back(G[v][k].to);
            dfs(G[v][k].to, d + 1);
        }
    }

    mat makegenlist(){
        REP(v, V) genlist[gen[v]].push_back(v);
        return genlist;
    }

    void analyzeTree(int root){
        gen = vec(V); par = vec(V);
        chi = mat(V, vec(0));
        depth = 0;
        par[root] = -1;
        dfs(root, 0);

        genlist = mat(depth, vec(0));
        makegenlist();
    }

};

signed main(){

    int N; cin >> N;
    vec A(N); readv(A);
    int a, b;
    Graph T(N);
    REP(i, N - 1){
        cin >> a >> b;
        T.add_edge2(a - 1, b - 1, 0);
    }

    if(N == 2){
        if(A[0] == A[1]) cout << "YES";
        else cout << "NO";
        return 0;
    }

    int root;
    REP(v, N) if(T.G[v].size() > 1) root = v;
    T.analyzeTree(root);

    bool ans = true;
    IREP(d, T.depth){
        for(int v: T.genlist[d]){
            if(T.chi[v].size() == 0){
                continue;
            }else if(T.chi[v].size() == 1){
                if(A[v] != A[T.chi[v][0]]){
                    ans = false;
                    break;
                }
            }else{
                int s = 0, m = -1;
                for(int chi: T.chi[v]){
                    s += A[chi];
                    m = max(m, A[chi]);
                }
                int n;
                if(2 * m <= s) n = s / 2;
                else n = s - m;
                int dif = s - A[v];
                if(0 <= dif && dif <= n){
                    A[v] -= dif;
                }else{
                    ans = false;
                    break;
                }
            }
        }
        if(!ans) break;
    }
    if(ans && A[root] == 0) cout << "YES";
    else cout << "NO";
    
    return 0;
}

Measured memory_bytes: 29056
a,b,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
mina = min(a)
minb = min(b)
ans = mina + minb
for i in range(m):
    x,y,c = map(int,input().split())
    ans = min(ans,a[x-1]+b[y-1]-c)
print(ans)



Measured memory_bytes: 18736
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
using namespace std;

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

  for(int i=0;i<s.size();i++){
    if(s[i]=='1') cout<<'9';
    else cout<<'1';
  }
  cout<<endl;
  
  return 0;
}


Measured memory_bytes: 256
N = gets.to_i
d = gets.chomp.split.map(&:to_i).sort

ans = 0
(d.min).upto(d.max) do |k|
  idx = d.bsearch_index{|x| x >= k}
  if idx == N / 2
    ans += 1
  elsif idx > N / 2
    break
  end
end
puts ans

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))
#define endl '\n'

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <ll, ll> pll;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
//g++ -std=c++11 your_file.cpp -o your_program

ll mypow(ll a, ll b){
	ll ans=1;
	while(b){
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ifstream in("");
	ofstream out("");
	clock_t begin = clock();
	ll n;
	cin >> n;
	cout << (n * (n - 1)) / 2 << endl;
	clock_t end = clock();
    double esecs = double(end - begin) / CLOCKS_PER_SEC;
    //cout << esecs << " seconds" << endl;
	return 0;	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    vector<int> ans(s.size(), 0);
    int rcnt = 0, lcnt = 0, pos = -1;
    for(int i=0;i<s.size();){
        while(s[i] == 'R'){
            rcnt++;
            i++;
        }
        pos = i;
        while(s[i] == 'L' && i < s.size()){
            lcnt++;
            i++;
        }        
        ans[pos-1] = (rcnt+1)/2 + lcnt/2;
        ans[pos] = rcnt/2 + (lcnt+1)/2;
        rcnt = 0;
        lcnt = 0;
    }

    for(auto x : ans){
        cout << x << " ";
    }
    cout << endl;
}

// LRの並びで区切れる
// RLの並びに集合する

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

using namespace std;

#define mod 1000000007LL
#define pi 3.141592653589793238462643383279;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define pic pair<char,long long >


void scan(vector<ll> & v)
{
    for(int i=0;i<v.size();i++)
        scanf("%lld",&v[i]);
}

void print(vector<int> & v)
{
    for(int i=0;i<v.size();i++)
        printf("%d ",v[i]);
}

int main()
{
    ll n,m;
    cin>>n>>m;
    if(n>=m/2)
    {
        cout<<m/2<<endl;
    }
    else
    {
        cout<<n+(m-2*n)/4<<endl;
    }
    ll acc;cin>>acc;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
char a[10000];
int times[10];
int main()
{
    int i,j,len;
    int digit;
    scanf("%s",a);
    if( (a[0] == a[1] && a[1] == a[2]) || (a[1] == a[2] && a[2] == a[3]))
    {
        printf("Yes\n");
    }
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	String s = sc.next();
      	if(a<3200){
        	System.out.println("red");
        }else{
        	System.out.println(s);
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include<chrono>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  priority_queue<ll> A;
  for (int i = 0; i < 3*N; i++) {
    ll a;
    cin >> a;
    A.push(a);
  }
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    A.pop();
    sum += A.top();
    A.pop();
  }
  cout << sum << endl;
}


Measured memory_bytes: 6128
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}
const int MOD = 1000000007;

int main(){
    ll n;
    cin >> n;
    ll a, b, z = 0;
    map<pair<ll, ll>, pair<ll, ll>> m;
    rep(i, n) {
        cin >> a >> b;
        if(a == 0 && b == 0) {
            z++;
        }
        else if(a == 0) {
            m[{0, 0}].first++;
        }
        else if(b == 0) {
            m[{0, 0}].second++;
        }
        else {
            ll g = gcd(abs(a), abs(b));
            if(b < 0) {
                a = -a;
                b = -b;
            }
            a /= g;
            b /= g;
            if(a > 0) m[{a,b}].first++;
            else m[{b, -a}].second++;
        }
    }
    ll ans = 1;
    ll p[n+1];
    p[0] = 1;
    rep(i, n-z) {
        p[i+1] = 2*p[i];
        p[i+1] %= MOD;
    }
    ans = 1;
    for(auto a : m) {
            ans *= (p[a.second.first]+p[a.second.second]-1);
            ans %= MOD;
    }
    cout << ((ans+z+MOD-1)%MOD) << endl;
    return 0;
}

Measured memory_bytes: 20784
import math


def read():
    X = int(input())
    return X,

def solve(X):
    a = 100
    t = 0
    while a < X:
        a = math.floor(a * 1.01)
        t += 1
    return t
    

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))


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

int main(){
  int n;
  cin >> n;
  int sum=0;
  sum = n + n*n + n*n*n;
  cout << sum;
  return 0;
}

Measured memory_bytes: 3620
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N = int(input())
    L = list(map(int, input().split()))

    i1 = 0
    i2 = 1
    i3 = 2

    c = 0
    while i1 < N-2:
        if L[i1] != L[i2] and L[i2] != L[i3] and L[i3] != L[i1] and \
            L[i1]+L[i2] > L[i3] and \
            L[i2]+L[i3] > L[i1] and \
        L[i3]+L[i1] > L[i2]:
            c += 1
        if i3 < N-1:
            i3 += 1
        elif i2 < N-2:
            i2 += 1
            i3 = i2 + 1
        else:
            i1 += 1
            i2 = i1 + 1
            i3 = i2 + 1

    print(c)

main()


Measured memory_bytes: 9224
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N,X,sum=0,a=1000;
  cin>>N>>X;
  for(int i=0;i<N;i++){
    int m;
    cin>>m;
    sum+=m;
    a=min(a,m);
}
cout<<N+(X-sum)/a<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long int
#define M 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
const double pi = acos(-1.0);
#define F  first
#define S  second
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
const int INF = 1e18L+5;
const int LG = 20;
const int N = 1e5+9;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int power(int x,int y){if(x==0)return 0;int res=1;while(y>0){if(y%2==1)res=(res*x)%M;x=(x*x)%M;y=y/2;}return res;}
bool isvowel(char c){if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U')return true;return false;}
int32_t main()
{
	cout.precision(20);
	cout.setf(ios::fixed,ios::floatfield);
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int T=1;
	//cin>>T;
	while(T--)
	{
		double a,b,h,m;
		cin>>a>>b>>h>>m;
		double o;
		o=(double)abs(60*h-11*m)/2;
		cout<<(double)sqrt((double)a*a+(double)b*b-(double)2*a*b*cos((double)(pi*o)/180))<<endl;
	}
}



Measured memory_bytes: 4244
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 準備
            List<ClsInp> lstInp = new List<ClsInp>();

            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            sS = System.Console.ReadLine().Trim().Split(' ');

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iMins = 0;      // マイナスの数
            int iZero = 0;      // 0の数
            for (int i = 0; i < sS.Length; i++)
            {
                ClsInp oneUsr = new ClsInp();
                oneUsr.iX = int.Parse(sS[i]);                           // 値
                oneUsr.iA = Math.Abs(oneUsr.iX);                        // 絶対値
                lstInp.Add(oneUsr);
                if (oneUsr.iX == 0) { iZero += 1; }                     // 0の数
                else if (oneUsr.iX != oneUsr.iA) { iMins += 1; }        // マイナスの数
            }
            long iOut = 0;
            if (iMins == 0) { iOut = lstInp.Sum(x => x.iA); }           // マイナスの数がない                →全部プラス
            else if (iMins % 2 == 0) { iOut = lstInp.Sum(x => x.iA); }  // マイナスの数が偶数                →全部プラス
            else if (iZero > 0) { iOut = lstInp.Sum(x => x.iA); }       // マイナスの数が奇数&0が1個でもある →全部プラス
            else                                                        // マイナスの数が奇数&0が1個もない   →絶対値の最小の1つだけマイナス
            {
                lstInp.Sort(delegate (ClsInp mca1, ClsInp mca2) { return (int)(mca1.iA - mca2.iA); });        // 絶対値の昇順
                iOut = lstInp.Sum(x => x.iA);                           // とりあえず全部プラス
                iOut -= lstInp[0].iA * 2;                               // そこから最小の1個だけマイナスとして考慮
            }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

        private class ClsInp
        {
            public long iX { get; set; } = 0;    // 値
            public long iA { get; set; } = 0;    // 絶対値
        }

}


Measured memory_bytes: 30428
# coding: utf-8

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

money = 1000
stock = 0

for i in range(N-1):
    
    if A[i] < A[i+1]:
        stock = money // A[i]
        money += stock * (A[i+1] - A[i])
        # print(money, stock) 
        
print(money)

Measured memory_bytes: 9132
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

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

  int n;
  string s; cin >> s;

  bool f = true;
  REP(i, s.size()){
    if(i%2 == 0){
      if(s[i] != 'R' && s[i] != 'U' && s[i] != 'D'){
        f = false;
      }
    }else{
      if(s[i] != 'L' && s[i] != 'U' && s[i] != 'D'){
        f = false;
      }      
    }
  }
  
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

int main(){
  int x;
  for(int i=1;i<=10000;i++){
    cin >> x;
    if(x != 0){
      cout << "Case " << i << ": " << x << endl;
    }else{
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 2984
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end() 
#define mod 1000000007
//#define maxx 200006
#define ll long long 
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long > 
#define listi vector< int> 
#define pii   pair<int , int> 
#define pll pair<long long , long long > 
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;


// end of #define 

// define globals ...
const int maxx = 2e5+26;

//write function from here ...







int Main(){

 
 string s;
 cin>>s;
 if( s== "SAT")
 cout<<1;
 else if(s=="SUN")
 cout<<7;
 else if(s=="MON")
 cout<<6;
 else if(s=="TUE")
 cout<<5;
 else if(s=="WED")
 cout<<4;
 else if( s=="THU")
 cout<<3;
 else 
 cout<<2;   



return 0;

}






int main(){
 quick;
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;


}


Measured memory_bytes: 3652
#include <stdio.h>
#include <stdlib.h>
#define int long long

int max(int a, int b){
	return a >= b ? a : b;
}

int min(int a, int b){
	return a <= b ? a : b;
}

signed main(){
	int N, i, j;
	scanf("%lld", &N);
	int *a = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%lld", &a[i]);
	}
	int **dp = (int **)malloc(sizeof(int *) * N);
	for(i = 0; i < N; i++){
		dp[i] = (int *)malloc(sizeof(int) * N);
		if(N % 2 == 1){
			dp[i][i] = a[i];
		}
		else{
			dp[i][i] = -a[i];
		}
	}
	for(i = 1; i < N; i++){
		for(j = 0; i + j < N; j++){
//			printf("(i, j) = (%lld, %lld)\n", i, j);
			if((N - i) % 2 == 1){
				dp[j][i + j] = max(dp[j + 1][i + j] + a[j], dp[j][i + j - 1] + a[i + j]);
			}
			else{
				dp[j][i + j] = min(dp[j + 1][i + j] - a[j], dp[j][i + j - 1] - a[i + j]);
			}
		}
	}
	printf("%lld\n", dp[0][N - 1]);
	return 0;
}

Measured memory_bytes: 46348
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

int gcd(int a, int b) {
	if (a % b == 0) {
		return b;
	} else {
		return gcd(b, a % b);
	}
}

int calc(vector <int> &v) {
	int c = -1, g = 0, i;
	long long sum = 0;
	
	sort(v.begin(), v.end());
	
	for (i = 0; i < v.size(); i++) sum += v[i] - 1;
	
	if (v[0] == 1) return sum % 2;
	if (sum % 2 == 1) return 1;
	
	for (i = 0; i < v.size(); i++) {
		if (v[i] % 2 == 1) {
			if (c != -1) return 0;
			
			c = i;
		}
	}
	
	v[c]--;
	
	for (i = 0; i < v.size(); i++) g = gcd(g, v[i]);
	
	for (i = 0; i < v.size(); i++) v[i] /= g;
	
	return 1 - calc(v);
}

int main() {
	int n, i;
	vector <int> v;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++) {
		int x;
		
		scanf("%d", &x);
		
		v.push_back(x);
	}
	
	if (calc(v) == 1) {
		puts("First");
	} else {
		puts("Second");
	}
	
	return 0;
}


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


int a, b, m, n;

int main(){
  cin >> a >> b;
  m = max(a,b);
  n = min(a,b);
  
  rep(i,m) cout << n;
  
  cout << endl;
  
  }

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

long
gcd(long a, long b)
{
	if (b == 0)
		return a;

	return gcd(b, a % b);
}

long
lcm(long a, long b)
{
	return (a * b / gcd(a, b));
}

int
main(int argc, char **argv)
{
	while (true)
	{
		int a1, a2, a3;
		int m1, m2, m3;
		int x, y, z;
		long c1, c2, c3;

		scanf("%d %d %d %d %d %d", &a1, &m1, &a2, &m2, &a3, &m3);

		if (a1 == 0 && m1 == 0 && a2 == 0 && m2 == 0 && a3 == 0 && m3 == 0)
			break;

		x = 1;
		c1 = 0;
		do
		{
			x = (a1 * x) % m1;
			c1++;
		} while (x != 1);

		y = 1;
		c2 = 0;
		do
		{
			y = (a2 * y) % m2;
			c2++;
		} while (y != 1);

		z = 1;
		c3 = 0;
		do
		{
			z = (a3 * z) % m3;
			c3++;
		} while (z != 1);

		printf("%ld\n", lcm(lcm(c1, c2), c3));
	}

	return 0;
}

Measured memory_bytes: 600
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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 a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	int a, b; cin >> a >> b;
	for (int i = 1; i <= 3; ++i) {
		if (i != a && i != b) {
			cout << i << endl;
			return 0;
		}
	}
}

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

int main(){
//srandom((unsigned long)time(NULL));
long long n;
cin>>n;
vector<tuple<long long,long long>> a;
for(long long i=0;i<n;i++){
    long long x;
    cin>>x;
    a.emplace_back(x,i+1);
}
sort(a.begin(),a.end());
for(auto v:a){
    long long s,t;
    tie(s,t)=v;
    cout<<t<<" ";
}
cout<<endl;
//1 4, 2 3, 3 1, 4 2
//


return 0;
}

Measured memory_bytes: 2544
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<math.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < n; i++)

const ll INF = 1LL << 60;


signed main() {

	ll n,k;
	cin >> n >> k;

	vector<ll>h(n + 1 , -1);

	rep(i, n)cin >> h[i];

	sort(h.rbegin(), h.rend());
	ll ans = 0;
	for (int i = k; i < n; i++) {
		ans += h[i];
	}
	cout << ans;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	int x;
	cin >> x;
	int n = x / 100;
	int rem = x - 100 * n;
	if (rem <= 5 * n) cout << 1 << endl;
	else cout << 0 << endl;
}

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

	solve();
}


Measured memory_bytes: 256