akhauriyash/Code-Regression huggingface dataset:
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
void sleep( double sec = 1021 ){
  clock_t s = clock();
  while( clock() - s < CLOCKS_PER_SEC * sec );
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/

void build(){

}
char c[ 20 ];
int len;
int sum(){
  int ret = 0;
  for( int i = 0 ; i < len ; i ++ )
    ret += c[ i ] - '0';
  return ret;
}
void init(){
  scanf( "%s" , c );
  len = strlen( c );
}
void solve(){
  int ans = sum();
  for( int i = len - 1 ; i >= 0 ; i -- ){
    if( c[ i ] > '0' ){
      c[ i ] --;
      for( int j = i + 1 ; j < len ; j ++ )
        c[ j ] = '9';
      ans = max( ans , sum() );
    }
  }
  cout << ans << endl;
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 764
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        double r = sc.nextDouble();
        double pi = Math.PI;
        double area = pi * r * r;
        double length = 2 * pi * r;

        System.out.printf("%f %f",area,length);
        sc.close();

    }
}


Measured memory_bytes: 28420
#include<bits/stdc++.h>
using namespace std;
const int N=5050;
const int M=10050;
char str[N];
int K;

int ch[M][26],step[M],sum[M],val[M],pre[M],root,cnt,last;
void SAM(int inde,int id)
{
	int u=last;last=++cnt;int now=last;
	step[now]=id;val[now]=1;
	while(u&&!ch[u][inde]) ch[u][inde]=now,u=pre[u];
	if(!u) pre[now]=root;
	else 
	{
		int v=ch[u][inde];
		if(step[u]+1==step[v]) pre[now]=v;
		else 
		{
			int av=++cnt;
			step[av]=step[u]+1;
			memcpy(ch[av],ch[v],sizeof(ch[v]));
			pre[av]=pre[v];pre[v]=pre[now]=av;
			while(u&&ch[u][inde]==v) ch[u][inde]=av,u=pre[u];
		}
	}
}
int buc[M],sa[M];
void prepare()
{
	for(int i=1;i<=cnt;i++) buc[step[i]]++;
	for(int i=1;i<=cnt;i++) buc[i]+=buc[i-1];
	for(int i=1;i<=cnt;i++) sa[buc[step[i]]--]=i;
	
	for(int i=cnt;i>=1;i--) 
	{
		int t=sa[i];
		val[pre[t]]=1;
	}
	val[1]=0;
	for(int i=cnt;i>=1;i--) 
	{
		int t=sa[i];
		sum[t]=val[t];
		for(int j=0;j<26;j++) sum[t]+=sum[ch[t][j]];
	}
}
void solve(int now,int k)
{
	if(k<=val[now]) return ;
	k-=val[now];
	for(int i=0;i<26;i++) 
	{
		if(sum[ch[now][i]]<k) k-=sum[ch[now][i]];
		else 
		{
			printf("%c",'a'+i);
			solve(ch[now][i],k);
			return ;
		}
	}
}
int main()
{
	scanf("%s",&str[1]);
	scanf("%d",&K);
	int len=strlen(&str[1]);
	last=root=cnt=1;
	for(int i=1;i<=len;i++) SAM(str[i]-'a',i);
	prepare();
	solve(1,K);
	return 0;
}

Measured memory_bytes: 1024
from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from bisect import bisect_left,bisect_right
from math import sqrt,gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode
import sys
sys.setrecursionlimit(10 ** 6)

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

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse=False):
    data.sort(key=lambda x:x[col],reverse=revese)
    return data

def mymax(data):
    M = -1*float('inf')
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float('inf')
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def mydictvaluesort(dictionary):
    return sorted( dictionary.items(), key=lambda x:x[1] )

def mydictkeysort(dictionary):
    return sorted( dictionary.items(), key=lambda x:x[0] )

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(' ')
        elif type(ls[0])==str:
            print(' '.join(ls))
        elif type(ls[0])==int:
            print(' '.join(map(str,ls)))
        else:
            print('Output Error')
    else:
        if len(ls)==0:
            print('')
        elif type(ls[0])==str:
            print(''.join(ls))
        elif type(ls[0])==int:
            print(''.join(map(str,ls)))
        else:
            print('Output Error')

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())


w,h,n = MI()
xya = LI(n)

xs,xe = 0,w
ys,ye = 0,h

for i in xya:
    x,y,a = i
    if a==1:
        xs = max(xs,x)
    elif a==2:
        xe = min(xe,x)
    elif a==3:
        ys = max(ys,y)
    elif a==4:
        ye = min(ye,y)


if xe<=xs or ye<=ys:
    print(0)
else:
    s = abs(xe-xs)*abs(ye-ys)
    print(s)

Measured memory_bytes: 72408
#include <bits/stdc++.h>
using namespace std; inline void fileio(const char* in, const char* out) { freopen(in, "r", stdin); freopen(out, "w", stdout); } 
#define TD typedef
#define forx(i,n) for(int i = 0; i < (n); ++i)
#define forxr(i,n) for(int i = (n)-1; i >= 0; --i)
TD long long ll; TD long double ld; TD pair<int,int> pii; TD pair<ll,ll> pll; TD vector<int> VI; TD vector<bool> VB; TD vector<ll> VL;
const char nl = '\n'; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; const ld EPS = 1e-9, PI = acos(-1);
#define ff first
#define ss second
#define all(c) c.begin(),c.end()

int main() {
  atexit([](){ cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl; });
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout << fixed << setprecision(12);
  // Emily <3
  int n; cin >> n;
  cout << (n-1)/2+1 << nl;
  return 0;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

var words [4]string = [4]string{"dream", "dreamer", "erase", "eraser"}

func main() {
	var s string
	fmt.Scanln(&s)

	if canConstruct(s) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func canConstruct(str string) bool {
	if len(str) == 0 {
		return true
	}
	for _, word := range words {
		if isPrefix(str, word) {
			can := canConstruct(str[len(word):])
			if can {
				return true
			}
		}
	}
	return false
}

func isPrefix(str, word string) bool {
	if len(str) < len(word) {
		return false
	}
	for i := 0; i < len(word); i++ {
		if str[i] != word[i] {
			return false
		}
	}
	return true
}


Measured memory_bytes: 10368
#define MAX 100000
#define SENTINEL 2000000000

struct Card {
  char suit;
  int value;
};

struct Card L[MAX/2+2], R[MAX/2+2];

void merge(struct Card A[], int n, int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i=0;i<n2;i++) R[i] = A[mid  + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for(k=left; k<right; k++) {
    if(L[i].value <= R[j].value) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(struct Card A[], int n, int left, int right) {
  if(left+1 < right) {
    int mid = (left+right) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid, right);
    merge(A,n,left,mid,right);
  }
}

int partition(struct Card A[], int n, int p, int r) {
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j].value <= x.value) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

void quickSort(struct Card A[], int n, int p, int r) {
  int q;
  if(p<r) {
    q = partition(A,n,p,r);
    quickSort(A,n,p,q-1);
    quickSort(A,n,q+1,r);
  }
}

int main() {
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;

  scanf("%d", &n);

  for(i=0;i<n;i++) {
    scanf("%s %d",S,&v);
    A[i].suit =  B[i].suit  = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A,n,0,n);
  quickSort(B,n,0,n-1);

  for(i=0;i<n;i++) {
    // ????????????????????¨??????????????????????????????????????????
    if(A[i].suit != B[i].suit) stable = 0;
  }

  if(stable==1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++) {
    printf("%c %d\n",B[i].suit,B[i].value);
  }

  return 0;
}

Measured memory_bytes: 4168
using System;
    using System.Text;
    using System.Collections.Generic;
    using static System.Math;
    using System.Linq;
    using static System.Array;
    
    namespace ConsoleApp2
    {
    class Program
    {
        static string S;
        static void Main(string[] args)
        {
            //var NK = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            S = Console.ReadLine();

            var ans = 0;

            for (int i = S.Length - 1; i >= 0; i--)
            {
                if (check(i))
                {
                    ans = i;
                    break;
                }
            }

            Console.WriteLine(ans);
        }

        static bool check(int i)
        {
            var ans = true;
            if (i % 2 != 0) return false;
            for (int j = 0; j < i/2; j++)
            {
                if (S[j] != S[j+(i / 2)])
                {
                    return false;
                }
            }

            return ans;
        }
    }
}


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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

template <class Monoid> struct LazySegmentTree {
  using F = std::function<Monoid(Monoid, Monoid)>;

  int n;
  std::vector<Monoid> node, lazy;
  std::vector<bool> lazyFlag;

  const F f;
  const Monoid M1;

  LazySegmentTree(int sz, const F f, const Monoid M1) : f(f), M1(M1) {
    n = 1;
    while(n < sz) n *= 2;
    node.resize(2 * n - 1, M1);
    lazy.resize(2 * n - 1, 0);
    lazyFlag.resize(2 * n - 1, false);
  }

  LazySegmentTree(std::vector<Monoid> v, const F f) : f(f) {
    int sz = v.size();
    n = 1;
    while(n < sz) n *= 2;
    node.resize(2 * n - 1);
    lazy.resize(2 * n - 1);
    lazyFlag.resize(2 * n - 1, false);

    for(int i = 0; i < sz; ++i) node[i + n - 1] = v[i];
    for(int i = n - 2; i >= 0; --i) node[i] = f(node[i * 2 + 1], node[i * 2 + 2]);
  }

  void lazyEvaluate(int k, int l, int r) {
    if(!lazyFlag[k]) return;

    node[k] = lazy[k];
    if(r - l > 1) {
      lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
      lazyFlag[k * 2 + 1] = lazyFlag[k * 2 + 2] = true;
    }
    lazyFlag[k] = false;
  }

  void update(int a, int b, Monoid x, int k = 0, int l = 0, int r = -1) {
    if(r < 0) r = n;

    lazyEvaluate(k, l, r);

    if(b <= l || r <= a) return;

    if(a <= l && r <= b) {
      lazy[k] = x;
      lazyFlag[k] = true;
      lazyEvaluate(k, l, r);
    }
    else {
      update(a, b, x, 2 * k + 1, l, (l + r) / 2);
      update(a, b, x, 2 * k + 2, (l + r) / 2, r);
      node[k] = f(node[k * 2 + 1], node[k * 2 + 2]);
    }
  }

  Monoid query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if(r < 0) r = n;

    lazyEvaluate(k, l, r);

    if(b <= l || r <= a) return INT_MAX;
    if(a <= l && r <= b) return node[k];
    Monoid vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
    Monoid vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return f(vl, vr);
  }
};

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

  int n, q;
  cin >> n >> q;
  vt<pair<int, pi>> v(n);
  rep(i, 0, n) {
    int s, t, x;
    cin >> s >> t >> x;
    v[i] = {x, {s, t}};
  }
  vt<int> d(q);
  rep(i, 0, q) cin >> d[i];

  sort(rall(v));
  LazySegmentTree<int> seg(q, [](int a, int b){ return min(a, b); }, -1);
  rep(i, 0, n) {
    int l = lower_bound(all(d), v[i].second.first - v[i].first) - d.begin();
    int r = lower_bound(all(d), v[i].second.second - v[i].first) - d.begin();
    seg.update(l, r, v[i].first);
  }

  rep(i, 0, q) cout << seg.query(i, i + 1) << endl;
}

Measured memory_bytes: 9216
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
int n,k,ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>k;
    while(n!=0){
        n/=k;
        ans++;
    }
    cout<<ans<<endl;
}

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

const ll INF = 1LL << 60;

ll Q, H, S, D, N;
int main() {
    cin >> Q >> H >> S >> D >> N;
    vector<P> calc(4);
    calc[0] = P(8 * Q, 0); 
    calc[1] = P(4 * H, 1); 
    calc[2] = P(2 * S, 2); 
    calc[3] = P(D, 3); 

    ll ans = INF;
    // for (int i = 1; i < 1 << 4; i++) {
    for (int i = 15; i < 1 << 4; i++) {
        vector<ll> target;
        for (int j = 0; j < 4; j++) {
            if (i >> j & 1) {
                target.push_back(j);
                // cout << j << " ";
            }
        }
        // 2l の時のみ、偶数しか作れない
        if (target.size() == 1 && target[0] == 3 && N % 2 == 1) continue;

        // 1l あたりの金額を計算
        vector<P> tmp;
        ll tmp_ans = 0;
        rep(k, target.size()) {
            tmp.push_back(calc[target[k]]);
        }
        sort(tmp.begin(), tmp.end());

        // 2lの場合 0こめを使う
        if (N % 2 == 0) {
            tmp_ans += (N / 2) * tmp[0].first;
        } else {
            tmp_ans += ((N - 1) / 2) * tmp[0].first;

            // 最後の1lをどうするか
            if (tmp[0].second == 3) {
                if (tmp.size() == 1) continue;
                tmp_ans += tmp[1].first / 2;
            } else {
                tmp_ans += tmp[0].first / 2;
            }
        }
        ans = min(ans, tmp_ans);
        // rep(k2, tmp.size()) {
        //     cout << tmp[k2].first << " " << tmp[k2].second << endl;
        // }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "stdio.h"

int main(){
  int i, p, a[5] = {};

  for(p = 0; p < 4; p++){
    scanf("%1d", &a[p]);
  }
  for(i = 0; i < 3; i++){
    if(a[i] == a[i + 1]){
      printf("Bad");
      return 0;
    }
  }
  printf("Good");
  return 0;
}


Measured memory_bytes: 128
from copy import copy

n,q = map(int,input().split())
pro = [input().split()+[0,i] for i in range(n)]
#0:name 1:time 2:endtime 3:index
for i in range(n):
    pro[i][1] = int(pro[i][1])
queue = copy(pro)
head = 0
tail = n-1
time = 0
while head <= tail:
    task = queue[head]
    head += 1
    if task[1] <= q:
        time += task[1]
        pro[task[3]][2] = time
    else:
        time += q
        task[1] -= q
        queue.append(task)
        tail += 1

for i in sorted(pro,key=lambda x: x[2]):
    print(i[0],i[2])    


Measured memory_bytes: 19760
#include <stdio.h>

int main(void)
{
	int n, rn, wn, lp, rp;
	char str[200005];
	int i, j, ans;

	scanf("%d", &n);
	scanf("%s", str);

	rn = wn = 0;
	for (i = 0; i < n; i++)
	{
		if (str[i] == 'R') rn++;
		else wn++;
	}

	if (rn == 0 || wn == 0) printf("0\n");
	else if (rn == 1 || wn == 1) printf("1\n");
	else
	{
		ans = 0;
		lp = 0;
		rp = n - 1;
		while (1)
		{
			for (; ; lp++)
			{
				if (str[lp] == 'W') break;
			}
			for (; ; rp--)
			{
				if (str[rp] == 'R') break;
			}
			if (lp > rp) break;
			str[lp] = 'R';
			str[rp] = 'W';
			ans++;
		}
		printf("%d\n", ans);
	}

	return 0;
}


Measured memory_bytes: 1920
import sys
input = sys.stdin.readline

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

UP=(N+1)//2
DOWN=N-UP

ANS=1<<31

def ten(A):
    LEN=len(A)
    MAX=max(A)
    MIN=min(A)

    BIT=[0]*(MAX-MIN+2)# 出現回数をbit indexed treeの形でもっておく.

    def update(v,w):# index vにwを加える
        while v<=MAX-MIN+1:
            BIT[v]+=w
            v+=(v&(-v))# 自分を含む大きなノードへ. たとえばv=3→v=4

    def getvalue(v):# MIN～vの区間の和を求める
        ANS=0
        while v!=0:
            ANS+=BIT[v]
            v-=(v&(-v))# たとえばv=3→v=2へ
        return ANS

    ANS=0        
    for i in range(LEN):# A[0],A[1],...とBITを更新しながら,各A[i]について転倒数を求める.
        bit_ai=A[i]-MIN+1# A[i]がBITの中で何番目か

        ANS+=i# 今まで出現した個数.
        ANS-=getvalue(bit_ai)# 今まで出現した中で,MIN～bit_aiの個数を減らす.
        # bit_ai～MAXの出現個数が転倒数

        update(bit_ai,1)

    return ANS
    

for i in range(1<<N):
    UD=[0,0]
    S0=[]
    S1=[]

    for j in range(N):
        if (1<<j) & i !=0:
            if j%2==0:
                S0.append((A[j],j))
            else:
                S1.append((A[j],j))
            UD[j%2]+=1

        else:
            if (j+1)%2==0:
                S0.append((B[j],j))
            else:
                S1.append((B[j],j))
                
            UD[(j+1)%2]+=1

    if UD[0]==UP and UD[1]==DOWN:
        S0.sort()
        S1.sort()
        #print(UD,S0,S1)

        for i in range(1,N):
            if i%2==0:
                if S0[i//2][0]>=S1[(i-1)//2][0]:
                    True
                else:
                    break
            else:
                if S1[i//2][0]>=S0[(i-1)//2][0]:
                    True
                else:
                    break
        else:
            K=[]
            for i in range(N):
                if i%2==0:
                    K.append(S0[i//2][1])
                else:
                    K.append(S1[i//2][1])

            #print(K)
            #print(ten(K))

            ANS=min(ANS,ten(K))

if ANS==1<<31:
    print(-1)
else:
    print(ANS)
                    
            
                        
            
    
    


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

int main(){
    int w,h,x,y,r;
    cin>>w>>h>>x>>y>>r;

    if ((x - r) < 0 || (x + r) > w){
        cout<<"No"<<endl;
    }else if ((y - r) < 0 || (y + r) > h){
        cout<<"No"<<endl;
    }else
    {
        cout<<"Yes"<<endl;
    }
      
}


Measured memory_bytes: 3108
#include<iostream>
#include<cmath>
using namespace std;
int main() {
    int k, s; cin >> k >> s;
    int cnt = 0;
    for (int i = 0; i <= k; ++i) {
        for (int j = 0; j <= k; ++j) {
            if (s - i - j >= 0 && s - i - j <= k) cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#ifdef LOCAL_BUILD
#include "pch.h"
#define DLOG(msg) cout << "#" << __LINE__ << ":" << msg << endl;
#define DLOG_V(var) \
  cout << "#" << __LINE__ << ":" << #var << " : " << var << endl;
#else
#include <bits/stdc++.h>
#define DLOG(msg)
#define DLOG_V(var)
#endif
using namespace std;

struct Solver {
  explicit Solver(const vector<vector<int>>& graph_)
      : graph(graph_), dist(graph.size(), -1) {}

  void solve() {
    q.push(make_pair(0, 0));
    while (!q.empty()) {
      auto p = q.front();
      q.pop();
      auto v = p.first;
      auto d = p.second;
      if (dist[v] != -1 && dist[v] <= d) {
        continue;
      }
      dist[v] = d;
      for (auto& v2 : graph[v]) {
        if (dist[v2] == -1 || dist[v2] > d + 1) {
          q.push(make_pair(v2, d + 1));
        }
      }
    }
  }

  const vector<vector<int>>& graph;
  vector<int> dist;
  queue<pair<int, int>> q;
};

int main() {
  int n;
  cin >> n;
  vector<vector<int>> graph(n, vector<int>());
  for (int i = 0; i < n; ++i) {
    int u;
    int k;
    cin >> u >> k;
    graph[u - 1].reserve(k);
    for (int j = 0; j < k; ++j) {
      int v;
      cin >> v;
      graph[u - 1].push_back(v - 1);
    }
  }

  Solver s(graph);
  s.solve();
  for (size_t i = 0; i < s.dist.size(); ++i) {
    cout << (i + 1) << " " << s.dist[i] << endl;
  }
}

Measured memory_bytes: 3080
#include<iostream>
#include<queue>
using namespace std;
int a[101010];
int f[101010],g[101010];
struct Node{
	int num,val;
	Node(int _num,int _val)
	{
		num=_num;
		val=_val;
	}
	bool operator < (const Node &A)const
	{
		return val>A.val;
	}
};
priority_queue<Node> Q;
int main()
{
	ios::sync_with_stdio(false);
	int n,T;
	cin>>n>>T;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	Q.push(Node(1,a[1]));
	int sum=0;
	for(int i=2;i<=n;i++)
	{
		sum=max(sum,a[i]-Q.top().val);
		f[i]=a[i]-Q.top().val;
		g[Q.top().num]=max(g[Q.top().num],a[i]-Q.top().val);
		Q.push(Node(i,a[i]));
	}
	int cnt1=0,cnt2=0;
	for(int i=1;i<=n;i++)
	{
		if(f[i]==sum)
			cnt1++;
		if(g[i]==sum)
			cnt2++;
	}
	cout<<min(cnt1,cnt2)<<endl;
	return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define pb push_back
#define mp make_pair
#define f first
#define s second
int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    vector<ll>vec;
    vec.pb(a*c);
    vec.pb(a*d);
    vec.pb(b*c);
    vec.pb(b*d);
    cout<<*max_element(vec.begin(), vec.end())<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int main()
{
	int n;
	while( scanf( "%d", &n ), n )
	{
		rep( i, n )
		{
			int x1, y1, z1, w1, x2, y2, z2, w2;
			scanf( "%d%d%d%d%d%d%d%d", &x1, &y1, &z1, &w1, &x2, &y2, &z2, &w2 );
			printf( "%d %d %d %d\n", x1*x2-y1*y2-z1*z2-w1*w2,
									 x1*y2+x2*y1+z1*w2-z2*w1,
									 x1*z2-y1*w2+x2*z1+y2*w1,
									 x1*w2+y1*z2-y2*z1+x2*w1 );
		}
	}

	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

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

    bool flag = false;
    int cnt1=0,cnt2=0;

    if(s[0]==s[1] && s[2]==s[3] && s[0]!=s[2]) flag = true;
    if(s[0]==s[2] && s[1]==s[3] && s[0]!=s[1]) flag = true;
    if(s[0]==s[3] && s[1]==s[2] && s[0]!=s[1]) flag = true;
    
    if(flag) cout << "Yes" <<endl;
    else cout << "No" <<endl;

}

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

ans = 0
# 各ビット独立で考える
for i in range(60):
    bit = 1 << i
    cnt1 = 0
    for a in A:
        # このビットが立っている場所を数える
        if a & bit:
            cnt1 += 1
    cnt0 = N - cnt1
    # 0ビットの数 * 1ビットの数 で1になるペア数
    cnt = cnt0 * cnt1 % MOD
    ans += cnt * bit % MOD
print(ans%MOD)


Measured memory_bytes: 124304
#include <stdio.h>
int main(void){
  int N, X, T;
scanf("%d %d %d", &N, &X, &T);
  if(N % X == 0){
  printf("%d", N / X * T);
  }else{
    printf("%d", (N / X + 1) * T);
  }
  return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int dice[7];
	char c;
	for(int i=1;i<=6;i++){
		cin>>dice[i];
	}
	while(cin>>c){
		switch(c){
		case'E':
			swap(dice[1],dice[4]);
			swap(dice[3],dice[6]);
			swap(dice[3],dice[4]);
			break;
		case'W':
			swap(dice[1],dice[3]);
			swap(dice[4],dice[6]);
			swap(dice[3],dice[4]);
			break;
		case'N':
			swap(dice[1],dice[2]);
			swap(dice[6],dice[5]);
			swap(dice[2],dice[5]);
			break;
		case'S':
			swap(dice[1],dice[5]);
			swap(dice[2],dice[6]);
			swap(dice[2],dice[5]);
			break;
		}
	}
	cout<<dice[1]<<endl;
	return 0;
}

Measured memory_bytes: 3056
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include <cstdint>
using namespace std;
#define rep(N) for(int i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)
#define For(i,N) for(int i=0;i<N;i++)
#define ll long long int
void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int ctoi(char c) {
	return c - '0';
}

ll kai(ll x) {
	ll a = 1;
	if (x <= 0)
		return 1;
	else {
		for (ll i = 0; i < x; i++)
			a = a * (i + 1);
		return a;
	}
}

ll rui(ll x, ll y) {
	ll a = 1;
	for (ll i = 0; i < y; i++)
		a = a * x;
	return a;
}
const int nmax = 150;
int cccc[nmax][nmax];
ll comb(ll n, ll k) {
	if (n < k) {
		cout << "error n<k" << endl;
		return -1;
	}
	if (cccc[n][k] > 0)return cccc[n][k];
	if (k == 0 || n == k)return 1;
	return cccc[n][k] = comb(n - 1, k - 1) + comb(n - 1, k);
}


int main() {
	//cout.precision(16);
	string S, T;
	int flag = 1;
	cin >> S >> T;
	rep(S.size()) {
		if (S[i] != T[i])
			flag = 0;
	}
	Yn(flag);
	return 0;
}

Measured memory_bytes: 3632
fun main(args: Array<String>) {
    val sc = if (args.size > 1) java.util.Scanner(java.io.File(args[1])) else java.util.Scanner(System.`in`)
    solve(sc)
}

fun solve(sc: java.util.Scanner) {
    val c = arrayOf(sc.nextLine().toCharArray(), sc.nextLine().toCharArray(), sc.nextLine().toCharArray())
    println("${c[0][0]}${c[1][1]}${c[2][2]}")
}


Measured memory_bytes: 31260
package main

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

func main() {
	var N, ans int
	N = nextInt()
	a := make([]int, N)
	b := make([]int, N)
	for i := 0; i < N; i++ {
		// fmt.Scan(&a[i], &b[i])
		// fmt.Println(a[i], b[i])
		a[i] = nextInt()
		b[i] = nextInt()
	}
	for i := N - 1; i >= 0; i-- {
		ans += (b[i] - (ans+a[i])%b[i]) % b[i]
	}
	fmt.Println(ans)
}

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

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


Measured memory_bytes: 5248
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		int A[] = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = 0;
		}
		for (int i = 0; i < K; i++) {
			int loop = Integer.parseInt(sc.next());
			for (int j = 0; j < loop; j++) {
				A[Integer.parseInt(sc.next()) - 1] = 1;
			}
		}

		//ここまでinput
		int count = 0;
		for (int i = 0; i < N; i++) {
			if (A[i] == 0) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}
}


Measured memory_bytes: 32716
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fr(i,n) for(i=0;i<n;i++)

typedef long long ll;
typedef pair<int,int> pii;
const int N = 100010;
ll mod = 1e9+7;
int dig(int n){
    int ans =0;
    while(n){
        ans+=(n%10);
        n/=10;
    }
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int t=1,n,i,j;
    cin>>n;
    int mn = 100;
    for(int i=1;i<=n/2;i++){
        mn = min(mn,dig(i)+dig(n-i));
    }
    cout<<mn<<"\n";


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int n, a;
    cin >> n >> a;
    cout << ((n % 500) <= a ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
N = int(input())
S1 = input()
S2 = input()
code = []
mod = 10**9+7
index = 0
while index < N:
    if S1[index] == S2[index]:
        code.append("A")
        index += 1
    else:
        code.append("B")
        index += 2

if code[0] == "A":
    ans = 3
else:
    ans = 6

for i in range(1, len(code)):
    if code[i-1] == "A" and code[i] == "A":
        ans = ans*2 % mod
    elif code[i-1] == "A" and code[i] == "B":
        ans = ans*2 % mod
    elif code[i-1] == "B" and code[i] == "A":
        continue
    else:
        ans = ans*3 % mod

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cstring>
#include <string>
#include <cmath>
#include <functional>
#include <queue>
#include <map>
using namespace std;

typedef long long ll;
const int M = 1e9 + 7;
const int N = 1e5 + 100;
const int MAX = 1e9 + 1;
//int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};

int main() {
    int i, j;
    string s;
    cin >> s;
    int ans = 0;
    for (i = 0; i < s.size(); ++i) {
        if (i == 0) {
            ans = 1;
        }
        else {
            if (s[i] != s[i - 1])
                ++ans;
        }
    }
    cout << ans - 1 << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define il inline
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define rep0(i, n) for(int i = 0; i < (n); i ++)
#define per0(i, n) for(int i = (n) - 1; i >= 0; i --)
#define ept 1e-9
#define INF 0x3f3f3f3f
#define sz(x) (x).size()
#define All(x) (x).begin(), (x).end()
#define lowbit(x) ((x) & -(x))
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
inline ll read1()
{
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const ll mod = 1e9 + 7;
const int N = 4e6 + 10;
const db pi = acos(-1);
queue<int> a[1010];
int main()
{
	int n = read();
	int Q = read();
	
	while(Q --)
	{
		int op = read();
		if(op == 0) {int x = read();a[x].push(read());}
		if(op == 1) 
		{
			int x = read();
			if(a[x].size() != 0) printf("%d\n", a[x].front());
		}
		if(op == 2) 
		{
			int x = read();
			if(a[x].size() != 0) a[x].pop();
		}
	}
	return 0;
}



Measured memory_bytes: 4124
l = list(input())
l2 = []
for i in l[::-1]:
    l2.append(int(i))

l2.append(0)
count = 0

for i in range(len(l2)):
    if l2[i] <= 4:
        count += l2[i]
    elif l2[i] == 5:
        if l2[i+1] <=4:
            count += 5
        else:
            count += 5
            l2[i+1] += 1
    else:
        count += 10-l2[i]
        l2[i+1] += 1
print(count)

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

int main(){
  ll n,q;
  cin >> n >> q;
  string s;
  cin >> s;
  
  vector<ll> array(n);
  for(ll i=1;i<n;++i){
    if( s.at(i-1) == 'A' && s.at(i) == 'C' ) ++array.at(i);
    array.at(i) += array.at(i-1);
  }
  rep(i,q){
    ll l,r;
    cin >> l >> r;
    --l;
    --r;
    cout << array.at(r) - array.at(l) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 4312
#include <bits/stdc++.h>
using namespace std;
int main(void){
    vector<int> A(3);
    cin >> A[0] >> A[1] >> A[2];
    sort(A.begin(),A.end());
    if((A[1]-A[0])%2 == 0) cout << (A[2] - A[1]) + (A[2] - (A[0] +(A[2] - A[1])))/2 << endl;
    else cout << 1 + (A[2]+1 - A[1]) + (A[2]+1 - (A[0]+1 +(A[2]+1 - A[1])))/2;
}

Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

template<unsigned long N>
struct precalc{
    unsigned long sz, val[N + 1];
    constexpr precalc() : sz(N), val() {
        for(unsigned long i{1}; i <= N; ++i)val[i] = i;
        for(unsigned long i{2}; i <= N; ++i)if(val[i] == i)for(unsigned long j{i}; j <= N; j += i)(val[j] /= i) *= (i - 1);
        for(unsigned long i{1}; i <= N; ++i)val[i] = (val[i] + val[i - 1]) % 1000000007;
    }
};

constexpr auto v = precalc<100000>{};

int main(){
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    unsigned long N, K;
    cin >> N >> K;
    const auto& modpow = [](unsigned long a, unsigned long n, unsigned long b = 1) -> unsigned long {
        unsigned long r{b % MOD};
        while(n){
            if(n & 1)(r *= a) %= MOD;
            (a *= a) %= MOD;
            n >>= 1;
        }
        return r;
    };
    unsigned long ans{0};
    for(unsigned long i{K}, p{0}; i; ){
        auto t = K / i;
        auto k = modpow(t, N);
        ans += (k + p) * v.val[i];
        i = K / (t + 1);
        p = MOD - k;
    }
    cout << ans % MOD << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

ll func(ll v) {
	ll t2 = 0;
	while (v % 2 == 0) {
		v /= 2;
		t2++;
	}

	return t2;
}

void solve_abc150_d() {
	ll N, M, ans;
	cin >> N >> M;

	vector<ll> a(N);
	rep(i, N) {
		cin >> a[i];
	}

	rep(i, N) {
		if (a[i] % 2 != 0) {
			ans = 0;
			cout << ans << "\n";
			return;
		}
		a[i] /= 2;
	}

	ll t2;
	t2 = func(a[0]);

	ll v = INF;
	v = a[0];
	rep(i, N) {
		if (func(a[i]) != t2) {
			ans = 0;
			cout << ans << "\n";
			return;
		}

		v = lcm(v, a[i]);
		if (v > M) {
			ans = 0;
			cout << ans << "\n";
			return;
		}
	}

	ans = M / v - M / (2 * v);

	cout << ans << "\n";
}

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

	solve_abc150_d();

	return 0;
}


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

int main(int argc, const char * argv[]) {
    
    int N, A, B, C, D;
    string S;
    int i;
    bool noFlag = false;
    
    cin >> N >> A >> B >> C >> D;
    cin >> S;
    
    if(C < D){
        for(i=B; i<D; i++){
            if(S[i]=='#' && S[i+1]=='#') noFlag = true;
        }
        
        for(i=A; i<C; i++){
            if(S[i]=='#' && S[i+1]=='#') noFlag = true;
        }
     }
    
    else{
        A--; B--; C--; D--;
        S[B] = '#';
        for(i=A+1; i<C-1; i++){
            if(S[i]=='#' && S[i+1]=='#') noFlag = true;
        }
        if(noFlag){
            S[B] = '.';
            for(i=B; i<D; i++){
                if(S[i]=='.' && S[i+1]=='.' && S[i+2] == '.') noFlag = false;
            }
        }
    }
    
    if(noFlag) cout << "No";
    else cout << "Yes";
    
    return 0;
}






Measured memory_bytes: 640
// AOJ 2585 1 Day Passport
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2585
#include <bits/stdc++.h>
using namespace std;

#define INF (1 << 28)

struct Edge{ int to, cost, time, corp;};

//      tuple < ?????????, ??????, ?????? >
typedef tuple < int , int , int > Tuple;

int N, M, H, K;
int S, T, P;
vector < Edge > edge[128];
int dp[1 << 8];
int min_cost[128][24]; // ?§???°, ??????

int Dijkstra(int passport)
{
	fill_n(*min_cost, 128*24, INF);

	priority_queue < Tuple , vector < Tuple > , greater < Tuple > > que;
	que.push(make_tuple(dp[passport], 0, S));

	while (!que.empty()){
		Tuple top = que.top(); que.pop();
		int cost, time, v;
		tie(cost, time, v) = top;
		if (v == T)return cost;

		for (auto e: edge[v])
		{
			int n_time = time + e.time;
			if (n_time > H)continue;
			int n_cost = (passport & (1 << e.corp)) ? cost : cost + e.cost;
			if (n_cost < min_cost[e.to][n_time])
			{
				min_cost[e.to][n_time] = n_cost;
				que.push(make_tuple(n_cost, n_time, e.to));	
			}
		}
	}
	return INF;
}

int main(int argc, char const *argv[])
{
	while (cin >> N >> M >> H >> K && N){
		fill_n(dp, 1 << 8, INF);
		for (auto &e: edge)e.clear();

		for (int i = 0; i < M; ++i)
		{
			int a, b, cost, time, corp;
			cin >> a >> b >> cost >> time >> corp;
			--a;--b;--corp;
			edge[a].push_back({b, cost, time, corp});
			edge[b].push_back({a, cost, time, corp});
		}

		cin >> S >> T;
		cin >> P;
		S--;T--;

		for (int i = 0; i < P; ++i)
		{
			int corp_num, corp_cost, b = 0;
			cin >> corp_num >> corp_cost;
			for (int j = 0; j < corp_num; ++j)
			{
				int corp_pos;
				cin >> corp_pos; 
				--corp_pos;
				b |= 1 << corp_pos;
			}
			dp[b] = min(dp[b], corp_cost);
		}

		dp[0] = 0;

		for (int i = 0; i < 1 << K; ++i)
		{
			if (dp[i] != INF)
			{
				for (int j = 0; j < 1 << K; ++j)
				{
					dp[i|j] = min(dp[i|j], dp[i] + dp[j]);
				}				
			}
		}

		int ret = INF;
		for (int i = 0; i < 1 << K; ++i)
		{
			if (dp[i] != INF) ret = min(ret, Dijkstra(i));
		}

		cout << (ret != INF ? ret : -1) << endl;
	}
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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

// 無限大の値
const ll INF = 1LL << 60;


int main(void){
  int n,k;
  cin >> n >> k;
  vi p(n);
  rep(i,n) cin >> p[i];
  sort(p.begin(), p.end());

  int ans = 0;
  rep(i,k)ans+=p[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
#include <string>
#include <stdio.h>
#include <iomanip>
 
using namespace std;
 
int main(){
  float L;
  cin >> L;
  cout << fixed << setprecision(15) << L * L * L / 27;
  return 0;  
}

Measured memory_bytes: 888
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br =	new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] number = line.split(" ");	//半角スペースで分割

		int n = Integer.parseInt(number[1]+number[2]);

		if(n % 4 == 0){
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 21204
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        long[] h = new long[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
        }
        boolean ok = true;
        for (int i = n - 1; i > 0; i--) {
            if (h[i - 1] - 1 > h[i]) {
                ok = false;
                break;
            }
            if (h[i - 1] > h[i]) {
                h[i - 1]--;
            }
        }
        if (!ok) {
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }
}

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

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

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

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

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

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

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

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

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


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

namespace abc153_e
{
  class Program
  {
    static void Main(string[] args)
    {
      var H = CIn.ReadInt();
      var N = CIn.ReadInt();
      var A = new int[N];
      var B = new int[N];

      for (int i = 0; i < N; i++)
      {
        A[i] = CIn.ReadInt();
        B[i] = CIn.ReadInt();
      }

      var dp = new int[N + 1, H + 1];

      for (int i = 1; i <= H; i++)
      {
        dp[0, i] = int.MaxValue;
      }

      for (int i = 1; i <= N; i++)
      {
        for (int j = 1; j <= H; j++)
        {
          dp[i, j] = Math.Min(dp[i - 1, j], dp[i, Math.Max(0, j - A[i - 1])] + B[i - 1]);
        }
      }

      Console.WriteLine(dp[N, H]);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(long n)
    {
      var array = new string[n];
      for (var i = 0L; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(long n)
    {
      var array = new int[n];
      for (var i = 0L; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(long n)
    {
      var array = new long[n];
      for (var i = 0L; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(long n)
    {
      var array = new double[n];
      for (var i = 0L; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(long h, long w)
    {
      var array = new char[h, w];
      for (var i = 0L; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0L; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


Measured memory_bytes: 50144
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
typedef long long ll;
using namespace std;
//#define int long long

//素数判定
inline bool IsPrime(int p) {
	if (p == 1) return false;
	for (int i = 2; i <= sqrt(p); i++) {
		if (p%i == 0) return false;
	}
	return true;
}

//10進数の自然数の桁数を返す
inline int GetDigit(int num) {
	return (int)log10(num) + 1;
}

//各位の和を返す
int GetDigitsSum(int num) {
	int N = 0;
	while (num > 0) {
		N += num % 10;
		num /= 10;
	}
	return N;
}

//互除法
ll gcd(ll a, ll b) {
	if (a < b) {
		return gcd(b, a);
	}
	else if (a%b) {
		return gcd(b, a%b);
	}
	else {
		return b;
	}
}

//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b; // Be careful not to overflow

}


//異なるn個からr個の整数を取り出す組合せの数を求める
int combination(int n, int r) {
	if (r == 0 || n == r) {
		return 1;
	}
	else if (r == 1) {
		return n;
	}
	else {
		return combination(n - 1, r - 1) + combination(n - 1, r);
	}

}

//Ｏ(√n)
//素因数分解
map<int, int> prime_factor(int n) {
	map<int, int> res; // map[i]:=ｎを素因数分解したときiは何乗か。
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) {
				res[i]++;
				n /= i;
			}
		}
	}
	if (n != 1)
		res[n] = 1;
	return res;
}

int F(int n) {
	if (n % 2 == 0) {
		return (n / 2);
	}
	else {
		return (3 * n + 1);
	}
}

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

	int s;
	cin >> s;

	int i = 1;
	int a = s;
	int ap = 0;
	map<int, int> mp;

	while (1) {
		ap = F(a);
		//cout << ap << endl;
		
		mp[a]++;
		if (mp[a] >= 2) {
			break;
		}
		i++;
		a = ap;


	}

	cout << i << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<unordered_set>
#include<string>
#define MAX 200010
int mem[MAX]={0};
using namespace std;
int main(){
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	for(int i=1;i<n;i++){
		int temp;
		cin>>temp;
		mem[temp]+=1;
	}
	for(int i=1;i<=n;i++){
		cout<<mem[i]<<endl;
	}
	return 0;
} 

Measured memory_bytes: 4364