akhauriyash/Code-Regression huggingface dataset:
use std::io::Read;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut z: Vec<Vec<(usize, usize)>> = vec![Vec::new(); n];
    for i in 0..n {
        let a: usize = itr.next().unwrap().parse().unwrap();
        for _ in 0..a {
            let x: usize = itr.next().unwrap().parse().unwrap();
            let y: usize = itr.next().unwrap().parse().unwrap();
            z[i].push((x - 1, y));
        }
    }

    let mut ans = 0;
    for bit in 0..1 << n {
        let mut ok: bool = true;
        'soto: for i in 0..n {
            if bit >> i & 1 == 1 {
                for &(x, y) in z[i].iter() {
                    if bit >> x & 1 != y {
                        ok = false;
                        break 'soto;
                    }
                }
            }
        }
        if ok {
            ans = std::cmp::max(ans, (bit as u32).count_ones());
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
import collections
import sys

def solve(n, A, B):
  Ac = collections.defaultdict(int)
  ABc = collections.defaultdict(int)
  Bc = collections.defaultdict(int)
  for a in A:
    Ac[a] = 1 + Ac.get(a, 0)
    ABc[a] = 1 + ABc.get(a, 0)
    #Bc[a] = Bc.get(a, 0)
  for b in B:
    #Ac[b] = Ac.get(b, 0)
    Bc[b]  = 1 + Bc.get(b, 0)
    ABc[b] = 1 + ABc.get(b, 0)
  cAB = sorted([(c, ab) for ab, c in ABc.items()])
  #print(cAB)
  pool = collections.deque()  #[bbbb]   # [(b, count)], FIFO to match at the end

  matched = {}  # {a: bbbb}    # {a: {b, count}
  current = n   # how many are not matched yet
  for c, ab in cAB[::-1]:
    if c > current + len(pool):
      print('No')
      return
    matched[ab] = []
    while c > current:
      # take c - current from pool, add to matched
      c -= 1
      matched[ab].append(pool.popleft())
    # add (ab, Bc[ab]) to pool
    current -= Bc[ab]
    for _ in range(Bc[ab]):
      pool.append(ab)
  #print(pool, matched)
  skipped = []
  for c, ab in cAB:
    # take c - matched[ab] from pool, add to matched
    nn = Ac[ab]-len(matched[ab])
    while skipped and  Ac[ab]-len(matched[ab]) > 0:
      matched[ab].append(skipped.pop())
    while Ac[ab]-len(matched[ab]) > 0:
      p = pool.popleft()
      if p == ab:
        skipped.append(p)
      else:
        matched[ab].append(p)
      #print(ab, pool, matched, skipped)

  ans = []
  for a, bb in sorted(matched.items()):
    ans += [str(b) for b in bb]
  print('Yes')
  print(' '.join(ans))


def main():
  input = sys.stdin.readline
  n = int(input())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  solve(n, A, B)

main()


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

struct YM{
  int y;
  int m;
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M, y;
  cin >> N >> M;
  int P[M], X[M];
  vector<YM> ym[N];
  for(int m=0; m<M; m++){
    cin >> P[m] >> y;
    ym[P[m]-1].push_back({y, m});
  }
  for(int n=0; n<N; n++){
    sort(
      ym[n].begin(), ym[n].end(),
      [](const YM& ym0, const YM& ym1) {return ym0.y < ym1.y;}
    );
    for(int i=0; i<ym[n].size(); i++){
      X[ym[n][i].m] = i+1;
    }
  }
  for(int m=0; m<M; m++)printf("%06d%06d\n", P[m], X[m]);
  return 0;
}

Measured memory_bytes: 7808
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll A,B,C;
    cin >> A >> B >> C;
    if(A % 2 == 0 && B % 2 == 0 && C % 2 == 0){
        if(A == B && B == C){
            cout << -1 << endl;
        }else{
            ll count = 0;
            while(A % 2 == 0 && B % 2 == 0 && C % 2 == 0){
                ll tmpA,tmpB,tmpC;
                tmpA = (B + C)/2;
                tmpB = (A + C)/2;
                tmpC = (A + B)/2;
                A = tmpA;
                B = tmpB;
                C = tmpC;
                count++;
            }
            cout << count << endl;
        }
    }else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	N := nextInt()
	A := make([]int, N)
	
	

	for i := 0; i < N; i++ {
		A = append(A, nextInt())
	}
	sort.Sort(sort.Reverse(sort.IntSlice(A)))

	Alice := 0
	Bob := 0
	n := 0
	for len(A) > 0 {
	
		if len(A) > 0 {
			n = A[0]
			A = A[1:]
			Alice += n
		}
		
		if len(A) > 0 {
			n = A[0]
			A = A[1:]
			Bob += n
		}
	}
	
	fmt.Println(Alice - Bob)

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

const int MAX_N = 200010;
using TYPE = ll; // 距離の型を入れる
vector<pair<int, TYPE> > G[MAX_N];
vector<TYPE> dijkstra(int start){
	vector<TYPE> dist(MAX_N, INFF);
	dist[start] = 0;//dist[i] :=　start->iまでの最短距離
	priority_queue<pair<TYPE, int>, vector<pair<TYPE, int> >, greater<pair<TYPE, int> > >  que;
	que.push(make_pair(0, start));
	while(!que.empty()){
		TYPE cost; int u;//今までにかかった時間 現在の頂点
		cost = que.top().first, u = que.top().second;
		que.pop();
		if(dist[u] < cost) continue;
		for (auto tmp : G[u]){
			int v = tmp.first; TYPE time = tmp.second;//隣接する頂点 その頂点まで行く時間
			if(dist[v] > dist[u] + time){//u->v
				dist[v] = dist[u] + time;
				que.push(make_pair(dist[v], v));
			}
		}
	}
	return dist;
}


int K;

int main(void) {
	cin >> K;
	reps(i, 1, K) {
		reps(j, 1, 10) {
			G[i].pb(mp((i + j) % K, j));
			// printf("%d %d %d\n", i, (i + j) % K, j);
		}
		G[i].pb(mp((i * 10) % K, 0));
	}
	auto dist = dijkstra(1);
	printf("%lld\n", dist[0] + 1);
	return 0;
}

Measured memory_bytes: 39156
#include<stdio.h>

int main(void) {
  int n, p[10], max = 0, sum = 0;
  scanf("%d", &n);

  for ( int i = 0; i < n; i++ ) {
    scanf("%d", &p[i]);
    sum = sum + p[i];
    if ( p[i] > max ) max = p[i];
  }

  sum = sum - max/2;
  printf("%d", sum);

  return 0;
}


Measured memory_bytes: 128
#include "iostream"
#include "string"
#include <stdio.h>

int main()
{

	std::string num;
	int i = 0;
	int s;
	int sum = 0;

	while (1) {
		std::cin >> num;
		if (num == "0")
			break;

		s = num.size();

		while (i < s) {
			sum += (num[i] - '0');
			i++;
		}
		std::cout << sum << std::endl;
		sum = i = 0;
	}
	return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(int)n;i++)
typedef long long ll;
using namespace std;
long long modpow(long long a, long long n,ll mod){
  long long r = 1;
  while (n) {
    r = r * ( (n%2)?a:1 ) %mod;
    a = a * a % mod;
    n >>= 1;
  }
  return r;
}

int main(void){
    ll n,mod;cin>>n>>mod;
    string s;cin>>s;
    reverse(s.begin(),s.end());
    ll res=0,now=0;
    if(mod==2||mod==5){
        reverse(s.begin(),s.end());
        rep(i,n){
            ll d=s[i]-'0';
            if(d%mod==0)res+=(i+1);
        }
        cout<<res<<endl;
        return 0;
    }
    map<ll,ll> mp;
    rep(i,n){
        ll t=modpow(10,i,mod);
        ll d=s[i]-'0';
        d*=t;
        d+=now;
        d%=mod;
        mp[d]++;
        now=d;
    }
    for(auto& p:mp){
        ll x=p.first,y=p.second;
        //cout<<x<<" "<<y<<endl;
        if(x==0){
            res+=(y+1)*y/2;
        }else{
            y--;
            res+=(y+1)*y/2;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1028
n=int(input())

def eratosthenes(n):
    table = [0] * (n + 1)
    prime_list = []
    
    for i in range(2, n + 1):
        if table[i] == 0:
            prime_list.append(i)
            for j in range(i + i, n + 1, i):
                table[j] = 1
                
    return prime_list
p=eratosthenes(55555)
ans=[]

c=0
for i in p:
    if i%5==1:
        print(i,end=" ")
        c+=1
    if c==n:
        break

print("")

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

int main(){
  int n;
  long long int t, sum = 0;
  vector<long long int> input;
  cin >> n;
  for( int i = 0; i < n; i++){
    cin >> t;
    sum += t;
    input.push_back(t);
  }
  sort(input.begin(), input.end());
  cout << input[0] << " " << input[n-1] << " " << sum << endl;
}

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

int N, C;
int s[100000], t[100000], c[100000];
int sm[200002];
int tt[200002];

int main () {

    scanf("%d %d", &N, &C);
    
    for (int i = 0; i < N; i++) {
        scanf("%d %d %d", &s[i], &t[i], &c[i]);
    }

    for (int i = 1; i <= C; i++) {
        for (int j = 0; j < 200002; j++) {
            tt[j] = 0;
        }
        for (int j = 0; j < N; j++) {
            if (c[j] == i) {
                tt[s[j] * 2 - 1]++;
                tt[t[j] * 2]--;
            }
        }
        for (int j = 1; j < 200002; j++) {
            tt[j] += tt[j-1];
        }
        for (int j = 0; j < 200002; j++) {
            if (tt[j] > 0) {
                sm[j]++;
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < 200002; i++) {
        if (ans < sm[i]) {
            ans = sm[i];
        }
    }
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 2944
#include <iostream>

using namespace std;

int main()
{
    int c1, c5, c10, c50, c100, c500;
    cin>>c1>>c5>>c10>>c50>>c100>>c500;
    cout<<int(c1+c5*5+c10*10+c50*50+c100*100+c500*500 >= 1000)<<endl;
}

Measured memory_bytes: 1160
"""
C - Base -2 Number
-2進数を出力する
"""

N = int(input())

num = []
while True:
    quotient = N // (-2)
    mod = N % -2
    
    if mod < 0:
        quotient += 1
        mod = 1
    
    num.append(mod)
    N = quotient

    if quotient == 0:
        break
        
num.reverse()
for n in num:
    print(n, end="")

Measured memory_bytes: 3064
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
local str2tbl = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
--
local N = read.n()
local A = read.N(N)
local function a(x)
    return x < 400 and 1
           or x < 800 and 2
           or x < 1200 and 3
           or x < 1600 and 4
           or x < 2000 and 5
           or x < 2400 and 6
           or x < 2800 and 7
end
local lt3200 = {}
local ge3200 = 0
for i=1,N do
    if A[i] < 3200 then
        lt3200[a(A[i])] = true
    else
        ge3200 = ge3200 + 1
    end
end

local count = 0
for _ in pairs(lt3200) do
    count = count + 1
end
local min = count
if min == 0 and ge3200 > 0 then
    min = 1
end
local max = count + ge3200
print(min .. " " .. max)

Measured memory_bytes: 508
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
set<int>s;
int main(){
    //~ freopen("file.in", "r", stdin);
    int n;
    scanf("%d",&n);
    while(n--){
		int x;
		scanf("%d",&x);
		if(s.count(x))
			s.erase(x);
		else
			s.insert(x);
	}
	printf("%d\n",int(s	.size()));
	return 0;
}


Measured memory_bytes: 4864
import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

n = int(readline())
a = int(readline())
b = int(readline())
c = int(readline())
d = int(readline())
e = int(readline())

def kiriage(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1
		
x = np.array([a, b, c, d, e])
print(kiriage(n, np.min(x)) + 4)

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

int main() {
  string s;
  cin >> s;
  int result=0;
  
  for (int i=0; i<3; ++i) {
    if (s.at(i)=='o'){
      ++result;
    }
  }
  
  cout << 700+100*result;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;
string rezero(int a){
    string len = to_string(a);
    string rezero = "";
    for(int i = 0; i < 6-len.length();i++){
        rezero+='0';
    }
    return rezero;
}
bool cmp(vector<ll> l,vector<ll> r){
    return l[3] <= r[3] ? true:false;
}


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

    vector<vector<ll> > y_p;
    ll n ,m;
    cin >> n >> m;
    vector<ll> np(n+1,1);
    ll p,y;
    for(int i = 0; i < m;i++){
        cin >> p >> y;
        vector<ll> tmp;
        tmp.push_back(y);
        tmp.push_back(p);
        tmp.push_back(0);
        tmp.push_back(i);
        y_p.push_back(tmp);
    }
    VSORT(y_p);
    for(int i = 0; i < m;i++){
        y_p[i][2] = np[y_p[i][1]];
        np[y_p[i][1]]++;
    }
    sort(ALL(y_p),cmp);
    for(ll i = 0; i < m;i++) cout << rezero(y_p[i][1]) << y_p[i][1] << rezero(y_p[i][2]) << y_p[i][2] << endl;



    

    return 0;
}

Measured memory_bytes: 9776
#include "bits/stdc++.h"
#define int long long int
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vvi vector<vector<int>>
#define vi vector<int>
#define f first
#define s second
using namespace std;
const int mod = 1e9 + 7;
int logi(int n) {int p = 0; while (n / 2) {n = n / 2; p++;} return p;}
int poww(int x, int y) {int pro = 1; while (y) {if (y & 1)pro = ((pro % mod) * (x % mod) % mod); y = y >> 1; x = ((x % mod) * (x % mod) % mod);} return pro;}
int poww2(int x, int y) {int pro = 1; while (y) {if (y & 1)pro = pro * x; y = y >> 1; x = x * x;} return pro;}
bool isprime(int n) { if (n == 1) return false; for (int i = 2; i <= sqrt(n); i++) if (n % i == 0) return false; return true;}
vector<vector<int>> adj(2e5);
vi dist(2e5, INT_MAX);
/*

*/

int solve() {
	int n;
	cin >> n;
	vector<int> v(n);
	int sum = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
		sum += v[i];
	}
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		sum -= v[i];
		ans = ((ans % mod) + (((v[i]%mod) * (sum%mod)) % mod))%mod;
	}
	cout << ans;
	return 0;
}
int32_t main() {
	/*#ifndef ONLINE_JUDGE
	    //for getting input from input.txt
	    freopen("input.txt","r",stdin);
	    //for writing output to output.txt
	    freopen("output.txt","w",stdout);
	#endif*/
	fast;
	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 11140
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX_D = 10;
static const int MAX_P = 100;

int D, G;
int p[MAX_D], c[MAX_D];

int main(){
	cin >> D >> G;
	for(int i = 0; i < D; i++) cin >> p[i] >> c[i];

	int res = MAX_D * MAX_P;
	for(int i = 0; i < (1 << D); i++){
		int rest = G;
		int cnt = 0;
		for(int j = 0; j < D; j++){
			if(i & (1 << j)){
				rest -= p[j] * 100 * (j + 1) + c[j];
				cnt += p[j];
			}
		}
		for(int j = D - 1; j >= 0; j--){
			if(rest <= 0) break;
			if(i & (1 << j)) continue;
			int num;
			num = ((rest % (100 * (j + 1)) == 0) ? (rest / (100 * (j + 1))) : (rest / (100 * (j + 1)) + 1));
			rest -= min(num, p[j] - 1) * 100 * (j + 1);
			cnt += min(num, p[j] - 1);
		}
		if(rest <= 0) res = min(res, cnt);
	}

	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
[n,m]=list(map(int,input().split()))
ab=[]
for i in range(m):
    ab.append(list(map(int,input().split())))

chizu=[[] for i in range(n+1)]
ans=[0]*(n+1)
ans[1]=-1

for i in range(m):
    chizu[ab[i][0]].append(ab[i][1])
    chizu[ab[i][1]].append(ab[i][0])

kaisu=[chizu[1]]
for i in chizu[1]:
    ans[i]=1

error=0
j=-1
counter=len(chizu[1])
while True:
    j+=1
    if len(kaisu)<=j:
        error=0
        break
    for now in kaisu[j]:#スタートからj+1距離の点たちについて操作
        kari=[]
        for i in chizu[now]:#ある点から隣り合う点決めていく
           if ans[i]==0:#未到達であれば
                ans[i]=now
                kari.append(i)
                counter+=1
        kaisu.append(kari)
    if counter==n-1:
        break

if error==0:
    print("Yes")
    for i in range(2,n+1):
        print(ans[i])
    

elif error==1:
    print("No")

Measured memory_bytes: 64760
<?php
fscanf(STDIN, '%d %d', $N, $M);
$sum = array_pad(array(), $N + 1, 0);
$AC = $WA = 0;
for ($i = 0; $i < $M; $i++) {
    fscanf(STDIN, '%d %s', $p, $S);
    if ($S === 'WA' && $sum[$p] <= 0) {
        $sum[$p]--;
    }
    if ($S === 'AC' && $sum[$p] <= 0) {
        $WA -= $sum[$p];
        $sum[$p] = 1;
		$AC++;
    }
}
printf('%d %d', $AC, $WA);


Measured memory_bytes: 8696
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();

            double ta = Math.Ceiling( n / 1.08);
            var nn = Math.Floor( ta * 1.08);

            if(n != nn)
            {
                Console.WriteLine(":(");
            }
            else
            {
                Console.WriteLine(ta);
            }            
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N+ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }   

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  int A[N]={};

  for(int i =0; i<N;i++){
      cin >> A[i];
  }

  sort(A,A+N);

  cout << A[N-1]-A[0]<<endl;




}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int Sx,Sy,Tx,Ty;
    cin >> Sx >> Sy >> Tx >> Ty;
    string s = "";
    while(Sy < Ty)
    {
        s += "U";
        Sy++;
    }
    while(Sx < Tx)
    {
        s += "R";
        Sx++;
    }
    string s2 = "";
    for(int i = 0;i < s.size();i++)
    {
        if(s[i] == 'U')
        {
            s2 += "D";
        }
        else
        {
            s2 += "L";
        }
    }
    cout << s << s2;
    cout << "LU" << s << "RDRD" << s2 << "LU\n";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long unsigned int;

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

    int n; cin>>n; int a[n]; for (int i = 0; i < n; i++)cin>>a[i];
    Int dp[n][21]={},ans=0; dp[1][a[0]]=1;
    for (int i = 1; i < n-1; i++){
        for (int j = 0; j <= 20; j++){
            if(j>=a[i])dp[i+1][j]+=dp[i][j-a[i]];
            if(j+a[i]<=20)dp[i+1][j]+=dp[i][j+a[i]];
        }
    }
    cout<<dp[n-1][a[n-1]]<<'\n';
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S,abc = "abcdefghijklmnopqrstuvwxyz";
  cin >> S;
  for(int i = 0;i < S.size();i++){
    for(int j = 0;j < abc.size();j++){
      if(S[i] == abc[j])abc.erase(abc.begin()+j);
    }
  }
  if(abc.size())cout << abc[0] << endl;
  else cout << "None" << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  string op;
  cin >> a >> b;
  c= a%500;
  
  if (c <= b) {
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
n, m = map(int, input().split())

A = []
B = []

for i in range(n) :
    A.append([int(a) for a in input().split()])
    
for j in range(m) :
    B.append(int(input()))

C = []

for i in range(n) :
    c = 0
    
    for j in range(m) :
        c += A[i][j] * B[j]
        
    C.append(c)
        
for i in range(n) :
    print(C[i])


Measured memory_bytes: 5980
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int n,m;
	while(cin>>n>>m,n||m){
		vector<int> po;
		for(int i= 1;i <= n;i++){
			po.push_back(i);
		}
		int pos = -1;
		while(po.size()!=1){
			po.erase(po.begin()+(pos =(pos+m)%po.size()));
			pos--;
		}
		cout <<po[0]<<endl;
	}
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  
  int ans = 0;
  for(int i=0;i<s.size();++i){
    if(i%2 == 0 && s[i] == 'p') --ans;
    if(i%2 == 1 && s[i] == 'g') ++ans;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
n, m = map(int, input().split())

array = []
for i in range(m):
    temp = list(map(int, input().split()))
    temp.append(i)
    array.append(temp)

array = sorted(array, key=lambda x: (x[0], x[1]))

count = 1
eq = True

for i in range(m):
    if eq is False:
        count = 1
    array[i][1] = count
    count += 1
    if i != m - 1:
        if array[i][0] == array[i + 1][0]:
            eq = True
        else:
            eq = False

array = sorted(array, key=lambda x: x[2])

for i in range(m):
    out = '%06d' % array[i][0] + '%06d' % array[i][1]
    print(out)


Measured memory_bytes: 39444
#include <stdio.h>

void sha(int k, int n);
void ri(int n);

int cards[201];
int cpy[201];

int main(void)
{
	int i, j;
	int k;
	int n, m;
	
	scanf("%d", &n);
	scanf("%d", &m);
	
	for (i = 1; i <= n * 2; i++){
		cards[i] = i;
		//printf("cards[%d] = %d\n", i, cards[i]);
		cpy[i] = i;
		//printf("cpy[%d] = %d\n", i, cpy[i]);
	}
	
	for (i = 0; i < m; i++){
		scanf("%d", &k);
		
		if (k == 0){
			ri(n);
		}
		else {
			sha(k, n);
		}
	}
	
	for (i = 1; i <= 2 * n; i++){
		printf("%d\n", cards[i]);
	}
	
	return (0);
}
void sha(int k, int n)
{
	int i, j = 2 * n;
	
	for (i = 1; i <= n * 2 - k; i++){
		cards[i] = cards[i + k];
	}
	for (i = k; i >= 1; i--){
		cards[j] = cpy[i];
		j--;
	}
		
	for (i = 1; i <= 2 * n; i++){
		cpy[i] = cards[i];
	}
}

void ri(int n)
{
	int i, j = 2;
	
	for (i = 1; i <= n - 1; i++){
		cards[j] = cpy[n + i];
		cards[j + 1] = cpy[i + 1];
		j += 2;
	}
	for (i = 1; i <=  2 * n; i++){
		cpy[i] = cards[i];
		//printf("cpy[%d] = %d\n", i, cpy[i]);
	}
}

Measured memory_bytes: 600
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            int H=sc.nextInt();
            int W=sc.nextInt();

            if(H==0&&W==0){
                break;
            }

            for ( int h = 0; h < H; h++ ){
                for ( int w = 0; w < W; w++ ){
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


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

int main(){
	int n;
	cin >> n;
	int a[n],b[n],c[n];
	for(int i=0;i<n;i++) cin >> a[i];
	for(int i=0;i<n;i++) cin >> b[i];
	for(int i=0;i<n;i++) cin >> c[i];
	sort(a,a+n);
	sort(b,b+n);
	sort(c,c+n);
	long long ans=0;
	for(int i=0;i<n;i++){
		int lo=0,hi=n-1,mid;
		while(hi>lo){
			mid=(lo+hi+1)/2;
			if(a[mid]<b[i]) lo=mid;
			else hi=mid-1;
		}
		if(a[lo]>=b[i]) continue;
		int n1=lo+1;
		lo=0,hi=n-1;
		while(hi>lo){
			mid=(lo+hi)/2;
			if(c[mid]>b[i]) hi=mid;
			else lo=mid+1;
		}
		if(c[lo]<=b[i])	continue;
		int n2=n-lo;
		ans+=1LL*n1*n2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;

struct segtree {
public:
	const int SIZE = 1 << 18;
	VI seg, lazy;
	//seg:区間の合計値 lazy:区間に対して、加える値でまだ遅延しているもの

	segtree() :seg(SIZE * 2), lazy(SIZE * 2) {}
	void lazy_evaluate(int k, int l, int r) {
		if (lazy[k] != 0) {
			seg[k] += lazy[k];
			//区間[l,r)にすべて同じ値を追加することになっていて、
			//segには合計値が入っているので、加える値を足す
			if (r - l > 1) {
				lazy[k * 2 + 1] += lazy[k];
				lazy[k * 2 + 2] += lazy[k];
			}
			lazy[k] = 0;
		}
	}

	void update(int a, int b, int k, int l, int r, int x) {
		lazy_evaluate(k, l, r);
		if (r <= a || b <= l)return;
		if (a <= l && r <= b) {
			lazy[k] += x;
			lazy_evaluate(k, l, r);
		}
		else {
			update(a, b, k * 2 + 1, l, (l + r) / 2, x);
			update(a, b, k * 2 + 2, (l + r) / 2, r, x);
			seg[k] = seg[k * 2 + 1] + seg[k * 2 + 2];
		}
	}
	int query(int a, int b, int k, int l, int r) {
		lazy_evaluate(k, l, r);
		if (r <= a || b <= l)return 0;
		if (a <= l && r <= b)return seg[k];
		int x = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int y = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return x + y;
	}

	void update(int a, int b, int x) { update(a, b, 0, 0, SIZE, x); }
	//update(a,b,x) := [a,b)を全てxを加える
	int query(int a, int b) { return query(a, b, 0, 0, SIZE); }
	//query(a,b) := [a,b)に対する合計値を求める

};

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

	int N, D, X; cin >> N >> D >> X;
	int ans = 0;
	REP(i, N) {
		int a; cin >> a;
		int cnt = 1;
		while (cnt <= D) {
			//cout << cnt << endl;
			ans++;
			cnt += a;
		}
	}
	cout << X + ans << endl;
	return 0;
}

Measured memory_bytes: 256
x = gets.to_i
l = 0
i = []
while x != 0
  # i[l - 1] : x[l - 1]
  i[l] = l + 1

  puts "Case" + " " + i[l].to_s + ":" + " " + x.to_s

  unless (i.length <= 10000) || (1 <= x || x <= 10000  )
    return
  end

  l += 1
  x = gets.to_i
end



Measured memory_bytes: 6940
#include <bits/stdc++.h>
using namespace std;
int n, x, c[4];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		c[x % 4]++;
	}
	c[1] += c[3];
	printf("%s\n", c[0] >= c[1] || c[2] == 0 && c[0] >= c[1] - 1 ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	long int s;
	int a,b,c;
	for(;;){
		if(scanf("%d",&a)==EOF){break;}
		s=0;
		b=600/a;
		for(c=0;c<b;c++){
			s+=a*a*a*c*c;
		}
		printf("%ld\n",s);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    ll x;
    cin >> x;
    if(x <= 6){
        cout << 1 << endl;
        return 0;
    }
    ll ans = (x + 10) / 11;
    if (ans*11 - x >= 5)
    {
        cout << ans*2 - 1 << endl;
    }else{
        cout << ans*2 << endl;
    }
}

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

namespace ABC086A
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var N = int.Parse(input[0]);
            var D = int.Parse(input[1]);
            var count = 0;

            for (int i = 0; i < N; i++)
            {
                var xy = Console.ReadLine().Split(' ');
                var x = int.Parse(xy[0]);
                var y = int.Parse(xy[1]);
                var d = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
                if (d <= D)
                    count++;
            }

            System.Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 40664
/*
Author: Babin Dutta
*/

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define endl "\n"
#define inf 1e18

void solve(){
	int n; cin>>n;
	cout<<(n*n*n)<<endl;
}

int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdint.h>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

struct Point {
  int x;
  int y;
};

struct Element {
  int max;
  Point pre_index;
};

void solve(std::string s, std::string t) {
  vector<vector<Element>> dp(s.size() + 1,
                             vector<Element>(t.size() + 1, {0, {-1, -1}}));

  dp[0][0] = {0, {-1, -1}};
  REP(i, s.size() + 1) {
    REP(j, t.size() + 1) {
      Element e = dp[i][j];
      if (i > 0) {
        if (e.max < dp[i - 1][j].max) {
          e = dp[i - 1][j];
        }
      }
      if (j > 0) {
        if (e.max < dp[i][j - 1].max) {
          e = dp[i][j - 1];
        }
      }
      dp[i][j] = e;
      if (i < s.size() && j < t.size() && s[i] == t[j]) {
        e.max++;
        e.pre_index = {i, j};
        dp[i + 1][j + 1] = e;
      }
    }
  }
  Point index = dp[s.size()][t.size()].pre_index;
  string ans;
  while (index.x != -1) {
    ans = s[index.x] + ans;
    index = dp[index.x][index.y].pre_index;
  }
  std::cout << ans << std::endl;
}

int main() {
  std::string s;
  std::cin >> s;
  std::string t;
  std::cin >> t;
  solve(s, t);
  return 0;
}


Measured memory_bytes: 105984
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	bool flag = false;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (4 * i + 7 * j == n) flag = true;
		}
	}
	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(void){
    ll N, H; cin >> N >> H;
    vector<ll> a(N), b(N);
    ll Ma = 0, MaId;
    for(int i=0; i<N; i++) {
        cin >> a[i] >> b[i];
        if(Ma < a[i]) {
            Ma = a[i];
            MaId = i;
        }
    }

    vector<ll> stB;
    for(int i=0; i<N; i++) if(b[i] > Ma) stB.push_back(b[i]);
    sort(stB.begin(), stB.end(), greater<ll>());

    int ans = 0;
    for(int i=0; i<stB.size(); i++){
        H -= stB[i];
        ans++;
        if(H <= 0){
            cout << ans << endl;
            return 0;
        }
    }

    ans += (H+Ma-1)/Ma;
    cout << ans << endl;
    
}

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


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

vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>> res;
    for(ll i = 2;i * i <= n;i++){
        if(n%i) continue;
        res.emplace_back(i,0);
        while(n%i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n!=1)res.emplace_back(n,1);
    return res;
}

int main(){
    ll a,b;
    cin >> a >> b;
    ll g = gcd(a,b);
    auto f = factorize(g);
    ll ans = f.size() + 1;
    cout << ans << endl;
    // set<ll> s;
    // s.insert(1);
    // for(ll i = 2;i * i <= g;i++){
    //     if(g == 1) break;
    //     while(g % i == 0){
    //         g /= i;
    //         s.insert(i);
    //     }
    // }
    // if(g!=1)s.insert(g);
    // cout << s.size() << endl;
    
}

Measured memory_bytes: 3604
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
const int MAX_N =100010;
int dp[MAX_N];//i番目のつららが折れる時刻。つまりi!=0ならば既に折れている
int len[MAX_N];
int n,L;
int main(){
	cin>>n>>L;
	for(int i =1;i <=n;i++){
		cin>>len[i];
	}
	memset(dp,0,sizeof(dp));
	int ans = 0;
	int cnt =0;
	while(true){
		if(cnt>=n)break;
		/*cout <<" cnt ="<<cnt<<endl;*/
		for(int i =1;i <=n;i++){
			int k =i-1;
			int l =i+1;
			/*
			cout <<"test"<<endl;
			cout <<"k = "<<k<<endl;
			cout <<"i = "<<i<<endl;
			cout <<"l = "<<l<<endl;
			 */
			if(dp[i]==0&&(len[k]<len[i]||dp[k]!=0)&&(len[l]<len[i]||dp[l]!=0)){
				dp[i] =(L-len[i])+max(dp[k],dp[l]);
				//cout <<"i = "<<i<<" dp[k] = "<<dp[k]<<"dp[l] = "<<dp[l]<<endl;
				cnt++;
				ans=max(ans,dp[i]);
				//cout<<ans<<endl;
				//cout<<endl;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1948
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <cctype>
 
using namespace std;
 
#define Int int64_t
 
void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}
 
int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
 
#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}
 
 
 
int main() {
	int x, y; cin >> x>> y;
	cout << x + y / 2;
 
 
	cout << endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
#define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using p_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-8;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    int n;
    cin >> n;
    int ans = 0;
    if (n < 600)
        ans = 8;
    else if (n < 800)
        ans = 7;
    else if (n < 1000)
        ans = 6;
    else if (n < 1200)
        ans = 5;
    else if (n < 1400)
        ans = 4;
    else if (n < 1600)
        ans = 3;
    else if (n < 1800)
        ans = 2;
    else
        ans = 1;
    cout << ans << endl;
}

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

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

typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N, A, ans = 1e9;
    cin >> N;
    rep(i, N) {
        cin >> A;
        int c = 0;
        while (A % 2 == 0) {
            A /= 2;
            c++;
        }
        ans = min(ans, c);
    }
    cout << ans << "\n";
}

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

int main(){
  string S; cin >> S;
  int64_t ans = 0;
 
  
  for(int i=0; i < (1<<S.size()-1); i++){
    bitset<9> plus(i);
    int64_t tmp = S.at(0)-'0';
    
    for (int j=0; j < S.size()-1; j++){
      if(plus.test(j)){
        ans += tmp;
        tmp = 0;
      }
      tmp = tmp*10 + (S.at(j+1) -'0');
    }
    ans += tmp;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3616
<?php
$line = trim(fgets(STDIN));
if(strlen($line) % 2){
	echo "No";
	exit;
}
for($i = 0; $i < strlen($line); $i += 2){
	if(substr($line, $i, 2) != "hi"){
		echo "No";
		exit;
	}
}
echo "Yes";
?>


Measured memory_bytes: 4728
#include<stdio.h>
#define LEN 100
#define INF 100000000

int Q[LEN];
int G[LEN][LEN];
int head,tail;
int d[LEN];
int n;

void enqueue(int x){
  Q[tail] = x;
  tail = (tail+1) % LEN;
}
int dequeue(){
  int  x = Q[head];
  head = (head+1)%LEN;
  return x;
}

int enpty(){
  if(tail == head)return 1;
  else return 0;
}

void bfs(int s){
  int i;
  int u,v;
  enqueue(s);

  for(i=0;i<n;i++){
    d[i] = INF;
  }

  d[s] = 0;

  while(!enpty()){
    u = dequeue();
    for(v=0;v<n;v++){
      if(G[u][v] == 0)continue;
      if(d[v] != INF)continue;
      d[v] = d[u] + 1;
      enqueue(v);
    }
  }

  for(i=0;i<n;i++){
    printf("%d %d\n",i+1,((d[i] == INF)? -1 : d[i]));
  }
}

int main(){
  int k,u,v;
  int i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      G[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      G[u][v]=1;
    }
  }

  bfs(0);

  return 0;
}



Measured memory_bytes: 2096