akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;


int main() {
    string S; cin >> S;
    vector<int> bits;
    for (auto ch : S) {
        if (ch == 'A' || ch == 'C' || ch == 'G' || ch == 'T') {
            bits.push_back(1);
        } else {
            bits.push_back(0);
        }
    }

    vector<int> cumsum_interval;
    int prev = 0;
    for (int idx = 0; idx < S.size(); idx++) {
        if (bits[idx] == 1) {
            cumsum_interval.push_back(prev + 1);
        } else {
            cumsum_interval.push_back(0);
        }
        prev = cumsum_interval[idx];
    }

    int ans = *max_element(cumsum_interval.begin(), cumsum_interval.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	s := getNextString(scanner)
	n := len(s)
	dp := make([][13]int, n+1)

	dp[0][0] = 1

	mod := int(1e9 + 7)

	for i := 0; i < n; i++ {
		i10 := n - 1 - i
		for iii := 0; iii < 13; iii++ {
			if s[i] == '?' {
				for iiii := 0; iiii <= 9; iiii++ {
					m := (inc(iiii, i10) + iii) % 13
					dp[i+1][m] += dp[i][iii]
					dp[i+1][m] %= mod
				}

				continue
			}
			m := (inc(int(s[i]-'0'), i10) + iii) % 13
			dp[i+1][m] += dp[i][iii]
			dp[i+1][m] %= mod
		}
	}
	fmt.Fprintln(writer, dp[n][5])
	writer.Flush()
}

func inc(num, i10 int) int {
	mm := [6]int{
		1, 10, 9, 12, 3, 4,
	}
	return num * (mm[i10%6])
}


Measured memory_bytes: 11392
def agg(li):
    LEN = len(li)
    agged = [0] * 2
    if LEN % 2:
        agged[0] = (LEN + 1) // 2
        agged[1] = LEN // 2
    else:
        agged[0] = agged[1] = LEN // 2
    for i in range(LEN - 1):
        if li[i + 1] != li[i]:
            if i % 2:
                return [0] * i + agged[::-1] + [0] * (LEN - i - 2)
            else:
                return [0] * i + agged + [0] * (LEN - i - 2)
    return


S = input()
N = len(S)

ans = []
chunk = [S[0]]
for i in range(N - 1):
    if S[i] == 'L' and S[i + 1] == 'R':
        ans += agg(chunk)
        chunk = [S[i + 1]]
    else:
        chunk.append(S[i + 1])
ans += agg(chunk)
print(' '.join(map(str, ans)))


Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;

const int mod=998244353;
int qpow(int x,int y)
{
	int ret=1;
	while(y)
	{
		if(y&1)ret=(LL)ret*x%mod;
		x=(LL)x*x%mod;
		y>>=1;
	}
	return ret;
}
inline void add(int&x,int y){x+=y;if(x>=mod)x-=mod;}

const int maxn=411;
int n,a[maxn],b[maxn],dp[maxn][maxn];
int fac[maxn],inv[maxn],invf[maxn],power[maxn][maxn];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d%d",a+i,b+i);
	
	fac[0]=invf[0]=1;
	for(int i=1;i<maxn;i++)
	{
		fac[i]=(LL)i*fac[i-1]%mod;
		inv[i]=qpow(i,mod-2);
		invf[i]=(LL)invf[i-1]*inv[i]%mod;
	}
	
	for(int i=0;i<maxn;i++)
	{
		power[i][0]=1;
		for(int j=1;j<maxn;j++)power[i][j]=(LL)power[i][j-1]*i%mod;
	}
	
	int sA=0,sB=0;
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int sa=sA;sa>=0;sa--)for(int sb=sB;sb>=0;sb--)if(dp[sa][sb])
		{
			for(int nb=0;nb<b[i];nb++)
			{
				int coef=mod-dp[sa][sb];
				coef=(LL)coef*power[a[i]][nb]%mod*invf[nb]%mod;
				add(dp[sa+a[i]][sb+nb],coef);
			}
		}
		sA+=a[i];
		sB+=b[i];
	}
	
	int ans=0;
	for(int sa=0;sa<=sA;sa++)for(int sb=0;sb<=sB;sb++)if(dp[sa][sb])
	{
		int coef=mod-dp[sa][sb];
		coef=(LL)coef*fac[sb]%mod*qpow(power[sa][sb],mod-2)%mod;
		coef=(LL)coef*inv[sa]%mod*sA%mod;
		add(ans,coef);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1536
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left

def solve():
    n = int(input())
    l = [int(x) for x in input().split()]
    l.sort()
    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
            r = bisect_left(l, l[i] + l[j])
            if r > j:
                ans += r - j - 1
    print(ans)

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""


Measured memory_bytes: 10004
def main():
    ls = list(input())
    t = 0
    cnt = 0
    for i in reversed(range(len(ls))):
        if ls[i]=="T":
            t +=1
        if ls[i]=="S":
            if t==0:
                pass
            else:
                cnt +=2
                t -= 1
    print(len(ls)-cnt)
if __name__ == '__main__':
    main()

Measured memory_bytes: 61552
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

enum POSITION{ONLINE_BACK = -2, CCW = -1, ON_SEGMENT = 0,
              CW = 1, ONLINE_FRONT = 2};

struct Point{
    long x;
    long y;
    Point(long x, long y) : x(x), y(y) {}
    Point(){}
    Point operator-(Point p){
        return Point(x - p.x, y - p.y);
    }
};
typedef Point Vector;
double cross(Vector v1, Vector v2){
    return v1.x * v2.y - v1.y * v2.x;
}
double dot(Vector v1, Vector v2){
    return v1.x * v2.x + v1.y * v2.y;
}

struct Segment{
    Point p1;
    Point p2;
    Segment(Point p1, Point p2) : p1(p1), p2(p2) {}
    Segment(){}
};
typedef vector<Point> Polygon;

POSITION get_position(Segment s, Point p){
    double c = cross(s.p2 - s.p1, p - s.p1);
    if (c > 0) return CCW;
    if (c < 0) return CW;
    double d = dot(s.p2 - s.p1, p - s.p1);
    if (d < 0) return ONLINE_BACK;
    if (d > dot(s.p2 - s.p1, s.p2 - s.p1)) return ONLINE_FRONT;
    return ON_SEGMENT;
}

bool intersect(Segment s1, Segment s2){
    if (get_position(s1, s2.p1) * get_position(s1, s2.p2) != -1) {
        return false;
    }
    if (get_position(s2, s1.p1) * get_position(s2, s1.p2) != -1) {
        return false;
    }
    return true;
}

int determine_containment(Point p, Polygon poly){
    Segment s_right(p, Point(p.x + 1e5, p.y));
    int count = 0;
    for (int i = 0, n = poly.size(); i < n; i++) {
        if (get_position(Segment(poly[i], poly[(i+1)%n]), p) == ON_SEGMENT) {
            return 1;
        }
        if (intersect(s_right, Segment(poly[i], poly[(i+1)%n]))) {
            count++;
        }
        if (get_position(s_right, poly[i]) == ON_SEGMENT) {
            int i_pre = (i == 0 ? n - 1 : i - 1);
            POSITION pos_pre = get_position(s_right, poly[i_pre]);
            while (pos_pre != CCW && pos_pre != CW) {
                i_pre = (i_pre == 0 ? n - 1 : i_pre - 1);
                pos_pre = get_position(s_right, poly[i_pre]);
            }
            int i_aft = (i + 1) % n;
            POSITION pos_aft = get_position(s_right, poly[i_aft]);
            while (pos_aft != CCW && pos_aft != CW) {
                i_aft = (i_aft + 1) % n;
                pos_aft = get_position(s_right, poly[i_aft]);
            }
            if (get_position(s_right, poly[i_pre]) * get_position(s_right, poly[(i+1)%n]) == -1) {
                count++;
            }
        }
    }
    if (count % 2) return 2;
    return 0;
}
int main(){
    int q;
    cin >> q;
    Polygon poly(q);
    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> x >> y;
        poly[i].x = x;
        poly[i].y = y;
    }
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        cout << determine_containment(Point(x, y), poly) << endl;
    }
    return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n;
int main(){
	scanf("%d",&n);
	bool ok = false;
	for(int i=1;i<=n;i++){
		int a;
		scanf("%d",&a);
		if(a & 1) ok = true;
	}
	if(ok) puts("first");
	else puts("second");
	return 0;
}


Measured memory_bytes: 256
N = int(input())
h = [int(i) for i in input().split()]

INF = float('inf')
dp = [INF] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, N):
    dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))

print(dp[N-1])


Measured memory_bytes: 13980
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+7;
int n,p[N],f[N],c[N],ans[N];
inline int read(){
	int num=0; char g=getchar(); while(g<48||57<g) g=getchar();
	while(47<g&&g<58) num=(num<<1)+(num<<3)+g-48,g=getchar(); return num;
}
inline bool check(int a,int b,int c){
	return(a<b&&b<c)||(b<c&&c<a)||(c<a&&a<b);
}
int main(){
	n=read();
	for(int i=1;i<=n;i++) p[i]=read(),f[p[i]]=i;
	for(int i=n-1;i>0;i--){
		if(!ans[i+1]){
			if(f[i]>f[i+1]) ans[i]=1,c[i]=i+1;
		}
		else{
			if(check(f[i],f[i+1],f[c[i+1]])) ans[i]=ans[i+1],c[i]=c[i+1];
			else ans[i]=ans[i+1]+1,c[i]=i+1;
		}
	}
	cout<<ans[1]<<endl;
	return 0;
}

Measured memory_bytes: 13312
n = int(raw_input())
a = [int(_) for _ in raw_input().split()]
if a[0] == 0:
    ts = [1, -1]
    anss = [1, 1]
elif a[0] > 0:
    ts = [a[0], -1]
    anss = [0, a[0] + 1]
else:
    ts = [a[0], 1]
    anss = [0, -a[0] + 1]
for j in xrange(2):
    t = ts[j]
    ans = anss[j]
    for i in xrange(1, n):
        b = cmp(t, 0)
        t += a[i]
        c = cmp(t, 0)
        d = 0
        if b == c or c == 0:
            d = -t - 1 if b == 1 else -t + 1
            ans += abs(d)
            t += d
    ts[j] = t
    anss[j] = ans

print min(anss)

Measured memory_bytes: 11800
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pi = pair<int,int>;
using P = pair<pi,int>;

const int INF = 1000000001;

int main(){
    int n;
    while(cin >>n,n){
        map<int,vector<int>> m;

        // empty, filled
        set<pi> e;
        set<P> f;
        e.insert({0,INF});

        rep(i,n){
            char c;
            int x;
            cin >>c >>x;

            if(c == 'D'){
                for(int j:m[x]){
                    auto itr = f.lower_bound({{j,j},-1});
                    pi range = itr->fi;
                    e.insert(range);
                    f.erase(itr);
                }
                m[x].clear();
            }
            else if(c == 'R'){
                if(f.empty()) cout << -1 << endl;
                else{
                    auto itr = f.upper_bound({{x,INF},INF});
                    --itr;
                    pi range = itr->fi;

                    if(range.fi<=x && x<range.se) cout << itr->se << endl;
                    else cout << -1 << endl;
                }
            }
            else if(c == 'W'){
                int y;
                cin >>y;
                while(y){
                    auto itr = e.begin();
                    int l = itr->fi, r = itr->se;
                    int SZ = r-l;
                    e.erase(itr);
                    if(SZ<y){
                        m[x].pb(l);
                        f.insert({{l,r},x});
                        y -= SZ;
                    }
                    else{
                        m[x].pb(l);
                        f.insert({{l,l+y},x});
                        e.insert({l+y,r});
                        y = 0;
                   }
                }
            }
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 14640
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
int main() {
    string s;
    cin >> s;
    int s_cnt = 0;
    ll removed = 0;
    for (char c : s) {
        if (c == 'S') {
            s_cnt++;
        } else {
            if (s_cnt > 0) {
                s_cnt--;
                removed++;
            }
        }
    }
    cout << s.size() - 2 * removed << endl;
    return 0;
}


Measured memory_bytes: 832
import java.math.*;
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();

        while (a >= b) {
            b *= 2;
            k--;
        }

        while (b >= c) {
            c *= 2;
            k--;
        }

        if (0<=k) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }

    }

}



Measured memory_bytes: 35776
a, b, c, k = map(int, input().split())

kt=k
sum=0

for i,card in enumerate([a,b,c]):
    if kt == 0:
        break
    if (kt - card) >= 0:
        if i == 0:
            sum+=card*1
        elif i == 1:
            sum+=card*0
        else:
            sum+=card*-1
        kt -= card            
    else:
        if i == 0:
            sum+=kt*1
        elif i == 1:
            sum+=kt*0
        else:
            sum+=kt*-1
        kt = 0

print(sum)

Measured memory_bytes: 9212
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	W, H, N := sc.nextInt(), sc.nextInt(), sc.nextInt()
	sx, sy, gx, gy := 0, 0, W, H
	for i := 0; i < N; i++ {
		x, y, a := sc.nextInt(), sc.nextInt(), sc.nextInt()
		if a == 1 {
			if sx < x {
				sx = x
			}
		} else if a == 2 {
			if gx > x {
				gx = x
			}
		} else if a == 3 {
			if sy < y {
				sy = y
			}
		} else {
			if gy > y {
				gy = y
			}
		}
	}
	if sx > gx || sy > gy {
		fmt.Fprintln(wtr, 0)
	} else {
		fmt.Fprintln(wtr, (gx-sx)*(gy-sy))
	}

	wtr.Flush()
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define debugP int debug_point; cin>>debug_point;
const ll MOD= 1e9 + 7;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/
ll ans=0;
vec(vis,9);
vector<pair<ll,ll>> a(30);
mat(gra,30,30);

void dfs(ll d,ll now,ll ma){
    if(d==ma){
        ans++;
        //cout<<endl;
        return;
    }
    for(int i=1;i<=ma;i++){
        if(gra[now][i]>0&&vis[i]==0){
            vis[i]=1;
            //op(i);
            dfs(d+1,i,ma);
            vis[i]=0;
        }
    }
    return ;
    
}

int main(){
    ll n;
    cin>>n;
    ll ans=0;
    ans=(n/11)*2;
    if(n%11>6)ans+=2;
    else if(n%11>0)ans+=1;
    op(ans);
    return 0;
}

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

using namespace std;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;

using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;


int main() {

    int n, k; cin >> n >> k;
    vector<int> p(n);
    REP(i, n) cin >> p[i];
    sort(ALL(p));

    cout << accumulate(p.begin(), p.begin() + k, 0) << endl;

    return 0;
}



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

int main(void){
  int a, b;
  cin >> a >> b;
  if(a >= 13) cout << b << endl;
  else if(a <= 5) cout << "0" << endl;
  else cout << b / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

int main(){
    int n, k;
    cin >> n >> k;
    int p[n];
    rep(i, n) cin >> p[i];
    sort(p, p+n);

    int cum = 0;
    rep(j, k){
        cum +=p[j];
    }
    out(cum);
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}

ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 


    
     int solve()
     {      
        int n;cin>>n;
        vector<pii> v;
        rep0(n){
            int x,l;cin>>x>>l;
            v.pb({x-l,x+l});
        }
        sort(all(v));
        int ans=0;
        rep(1,n){
            if(v[i].ff<v[i-1].ss){
                ans+=1;
                // if(v[i].ss>v[i-1].ss) v[i].ss=v[i-1].ss;
                v[i].ss=min(v[i].ss,v[i-1].ss);
            }
        }
        cout<<n-ans<<endl;
        r0   
     }
    signed main()
    {   
        asdf
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

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

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
// #define int long long 

using namespace std;

int32_t main()
{
	fio;
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl;
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <iomanip>
#include <queue>
#include <set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef unordered_map<int,int> m32;
typedef map<ll,ll> m64;
typedef unordered_map<ll,set<ll> > m648;
typedef pair<ll,p64 > pp64;
ll MOD = 1e9 + 7;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF LLONG_MAX
vv64 g;
v64 ans;

void f(ll v){
	if(ans[v]!=-1) return;
	forn(i,g[v].size()){
		f(g[v][i]);
		ans[v]=max(ans[v],1+ans[g[v][i]]);
	}
	if(ans[v]==-1) ans[v]=0;
}

int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,m;
    cin >> n >> m;
    g.resize(n);
    ll a,b;
    forn(i,m){
    	cin >> a >> b;
    	g[a-1].pb(b-1);
    }
    ans.resize(n,-1);
    forn(i,n){
    	f(i);
    }
    ll fans=0;
    forn(i,n){
    	fans = max(fans,ans[i]);
    }
    cout << fans << ln;
    return 0;
}

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

int main(){
 int n;
 cin >> n;

 string taro, hanako;
 int t_point=0, h_point=0;
 while( cin >> taro >> hanako ){
  if( taro>hanako ){
    t_point += 3;
  }else if( taro<hanako ){
    h_point += 3;
  }else if( taro==hanako ){
    t_point += 1;
    h_point += 1;
  }

 //cout << t_point << " " << h_point << endl;
 }

 cout << t_point << " " << h_point << endl;

 return 0;
}


Measured memory_bytes: 3224
N, M = map(int, input().split())
X = tuple(map(int, input().split()))
Y = tuple(map(int, input().split()))
MOD = 10 ** 9 + 7

X_sum = sum((2 * i - N + 1) * x for i, x in enumerate(X)) % MOD
Y_sum = sum((2 * i - M + 1) * y for i, y in enumerate(Y)) % MOD
print(X_sum * Y_sum % MOD)


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

using LL = long long;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

double ex(LL p) { return (double)(p + 1) / 2.0; }

void solve(long long N, long long K, std::vector<long long> p) {
  // solver code

  double ans = 0;

  vector<double> sum(N + 1, 0);
  // for (int i = 0; i < N; i++) {
  //   sum[i] = ex(p[i]);
  // }

  for (int i = 0; i < N; i++) {
    sum[i + 1] = sum[i] + ex(p[i]);
  }

  double tmp = 0.0;
  for (int i = 0; i <= N - K; i++) {
    tmp = sum[i + K] - sum[i];
    ans = max(ans, tmp);
  }

  cout << fixed << setprecision(10);
  cout << ans << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> p(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &p[i]);
  }
  solve(N, K, std::move(p));
  return 0;
}


Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a%3==0||b%3==0||(a+b)%3==0){
    cout<<"Possible"<<endl;
  }else{
    cout<<"Impossible"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3616
#include<stdio.h>
long long int prime(long long int n)
{
	if (n < 2)
		return 0;
	long long int i;
	for (i = 2; i * i <= n; i++)
		if (n % i == 0)
			return i;
	return n;
}
int main()
{
	long long int n;
	scanf("%lld", &n);
	long long int p;
	long long int cnt;
	long long int v;
	long long int ans = 0;
	while (n > 1)
	{
		p = prime(n);
		cnt = 0;
		while (n % p == 0)
		{
			cnt++;
			n /= p;
		}
		v = 1;
		while (v * (v + 1) / 2 <= cnt)
			v++;
		ans += v - 1;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1728
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

n=int(input())
a=sorted([int(i) for i in input().split()])
ans=(a[0]+a[1])/2
for i in range(2,n):
    ans=(ans+a[i])/2
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>

void trace(int A[], int N){
  int i;
  for(i=0;i<N;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}

void insertionSort(int A[],int N){
  int j,i,v;
  for(i=1;i<N;i++){
    v=A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    trace(A,N);
  }
}

int main(){
  int N,i,j;
  int A[100];

  scanf("%d",&N);
  for(i=0;i<N;i++)scanf("%d",&A[i]);

  trace(A,N);
  insertionSort(A,N);

  return 0;
}



Measured memory_bytes: 2696
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll a,b,c;
    ll n;
    cin>>a>>b>>c>>n;
    // a < b < c de ok
    while(a>=b){
        b*=2;
        n--;
    }
    while(b>=c){
        c*=2;
        n--;
    }
    if(n>=0)cout << "Yes\n";
    else cout << "No\n";

}

Measured memory_bytes: 3608
#include <cstdio>

#define MAX_N 100000

int n, k;
int w[MAX_N];

int f(int p) {
  int num_of_track, sum_of_weight, i;
  num_of_track = 1;
  sum_of_weight = 0;
  for (i = 0; i < n; ++i) {
    if (sum_of_weight + w[i] <= p) {
      sum_of_weight += w[i];
    } else if (w[i] > p) {
      return 0;
    } else if (num_of_track == k) {
      return 0;
    } else {
      ++num_of_track;
      sum_of_weight = w[i];
    }
  }
  return 1;
}

int main() {
  int i, p_left, p_right, p, v;

  scanf("%d" "%d\n", &n, &k);
  for (i = 0; i < n; ++i) {
    scanf("%d\n", &w[i]);
  }

  p_left = 1;
  p_right = 10000 * MAX_N;
  while (p_left != p_right) {
    p = (p_left + p_right) / 2;
    v = f(p);
    if (v)
      p_right = p;
    else
      p_left = p + 1;
  }

  printf("%d\n", p_left);
}

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

using namespace std;

int n, arr[3][100001], dp[3][100001];

int main(void){

    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> arr[0][i] >> arr[1][i] >> arr[2][i];
    
    dp[0][0] = arr[0][0];
    dp[1][0] = arr[1][0];
    dp[2][0] = arr[2][0];

    for(int i = 1; i < n; i++){
        dp[0][i] = max(dp[1][i - 1] + arr[0][i], dp[2][i - 1] + arr[0][i]);
        dp[1][i] = max(dp[0][i - 1] + arr[1][i], dp[2][i - 1] + arr[1][i]);
        dp[2][i] = max(dp[0][i - 1] + arr[2][i], dp[1][i - 1] + arr[2][i]);
    }

    cout << max({ dp[0][n - 1], dp[1][n - 1], dp[2][n - 1] }) << endl;
    
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <bits/stdc++.h>

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> starts(M);
  vector<int> ends(M);
  vector<int> cities(N,0);
  
  for(int i = 0; i < M; i++){
    cin >> starts[i] >> ends[i];
    cities[starts[i] - 1]++, cities[ends[i] - 1]++;    
  }
  
  for(int i = 0; i < N; i++) cout << cities[i] << endl;
  
}


Measured memory_bytes: 256
import sys

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    ans = (N // K) ** 3
    if K % 2 == 0:
        halfK = 0
        for i in range(1, N + 1):
            if i % K == K // 2: halfK += 1
        ans += (halfK) ** 3
    print(ans)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector< vector<pair<int,int>> > a(N);
    for(int i=0; i<N; i++) {
        int A;
        cin >> A;
        for(int j=0; j<A; j++) {
            int x, y;
            cin >> x >> y;
            x--;
            a.at(i).emplace_back(x, y);
        }
    }

    int ans = 0;
    for(int bit=0; bit<(1<<N); bit++) {
        bool ok = true;
        int cnt = 0;
        for(int i=0; i<N; i++) {
            if((bit>>i) & 1) {
                cnt++;
                for(int j=0; j<a[i].size(); j++) {
                    if(((bit>>a[i][j].first) & 1) != a[i][j].second) {
                        ok = false;
                    }
                }
            }
        }
        if(ok) {
            ans = max(ans, cnt);
        }
    }

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

int main(){
    int32_t N;
    std::cin >> N;
    constexpr long long INF = 1LL<<60;
    long long abs_min = INF;
    long long abs_sum = 0;
    int32_t num_minus = 0;
    for(int32_t i = 0; i < N; i++){
        long long Ai;
        std::cin >> Ai;
        if(Ai < 0) num_minus++;
        abs_min = std::min(abs_min, std::abs(Ai));
        abs_sum += std::abs(Ai);
    }
    if(num_minus % 2 == 1){ 
        abs_sum -= 2 * abs_min;
    }

    std::cout << abs_sum;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int a[111111];
int main() {
	int n, q;
	cin >> n;
	rep(i, n)cin >> a[i];
	cin >> q;
	while (q--) {
		int k;
		cin >> k;
		cout << binary_search(a, a + n, k) << endl;
	}
	return 0;
}


Measured memory_bytes: 3464
import numpy as np

N=int(input())
X=np.zeros(N)
X=list(map(int,input().split()))

if np.mean(X)-int(np.mean(X))>=0.5:
    count=int(np.mean(X))+1
else:
    count=int(np.mean(X))    

result=0
for i in range(N):
    result+=(X[i]-count)*(X[i]-count)
print(result)

Measured memory_bytes: 12424
from collections import defaultdict
S,T = input(),input()
ss,ts = defaultdict(int),defaultdict(int)
for i in range(len(S)):
    ss[S[i]] += 1
    ts[T[i]] += 1
s = sorted(ss.items(),key=lambda x:x[1])
t = sorted(ts.items(),key=lambda x:x[1])
OK = True
for i in range(min(len(s),len(t))):
    if s[i][1]!=t[i][1]:
        OK = False
print('Yes' if OK else 'No')


Measured memory_bytes: 42140
#include <iostream>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

bool gt(const int &a, const int &b){
  return a > b;
}

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

  sort(a.begin(), a.end(), gt);

  long long x = 0, y = 0;
  int last = -1;
  for(int i = 0;i < n;i++){
    if(a[i] == last){
      if(x == 0){
	x = a[i];
	last = -1;
      }else{
	y = a[i];
	break;
      }
    }else{
      last = a[i];
    }
  }

  cout << x*y << endl;

  return 0;
}


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

typedef long long ll;
#define int ll
#define pb push_back
const int INF = 1e18;

signed main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n,k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];

	vector<int> dp(k+1,0);
	for(int i=0;i<k;i++){
      	if (dp[i] == 1)
          continue;
		for(int j=0;j<n;j++){
			if (arr[j] + i > k or dp[arr[j]+i] == 1)
				continue;
			dp[arr[j]+i] = dp[i]^1;
		}
	}
	if (dp[k])
		cout<<"First";
	else 
		cout<<"Second";
	return 0;
}


Measured memory_bytes: 1024
N = int(input())
ab = [tuple(map(int, input().split())) for _ in range(N)]
cd = [tuple(map(int, input().split())) for _ in range(N)]

from operator import itemgetter
ab.sort(key=itemgetter(1))
cd.sort(key=itemgetter(0))

C = [0] * N
cnt = 0
for i in range(N):
    for j in range(N):
        if C[j] == 0 and ab[- j - 1][0] < cd[i][0] and ab[ - j - 1][1] < cd[i][1]:
            C[j] = 1
            cnt += 1
            break
print(cnt)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
signed main()
{
	string s,t;
	cin>>s>>t;
	int ans=1e9;
	for (int i=0;i<=sz(s)-sz(t);i++){
		int cur=0;
		for (int j=i;j<i+sz(t);j++){
			if (s[j]!=t[j-i])
				cur++;
		}
		ans=min(ans,cur);
	}
	cout<<ans;
	re 0;
}


Measured memory_bytes: 3620
from collections import deque

def bfs(s_l, visited, sy, sx, gy, gx, h, w):
    q = deque([[sy,sx]])
    visited[0][0] = 0
    while q:
        y, x = q.popleft()
        if [y, x] == [gy, gx]:
            return visited[gy][gx]
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            n_y, n_x = y+j, x+k
            if n_y >= h or n_x >= w or n_y < 0 or n_x < 0:
                continue
            if s_l[n_y][n_x] == '.' and visited[n_y][n_x] == -1:
                visited[n_y][n_x] = visited[y][x] + 1
                q.append([n_y,n_x])
    return -1

def main():
    h, w = map(int, input().split()) 
    s_l = []
    all_dot_cnt = 0
    for i in range(h):
        row = list(input())
        s_l.append(row)
        all_dot_cnt += row.count('.')
    
    visited = [ [-1]*w for i in range(h)]
    res = bfs(s_l, visited, 0, 0, h-1, w-1, h, w)
    if res == -1:
        print(-1)
    else:
        # print(res)
        # print(all_dot_cnt)
        print(all_dot_cnt-res-1)

if __name__ == "__main__":
    main()

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

int main(){
  vector<int>a(4);
  char c;
  for(int i=0;i<4;i++){
    cin >> c;
    a.at(i)=c-'0';
  }
  for(int i=0;i<(1<<3);i++){
    bitset<3>n=i;
    int k=a.at(0);
    for(int j=0;j<3;j++){
      if(n.test(j))
        k+=a.at(j+1);
      else
        k-=a.at(j+1);
    }
    if(k==7){
      cout << a.at(0) << (n.test(0)?'+':'-') << a.at(1) << (n.test(1)?'+':'-') << a.at(2) << (n.test(2)?'+':'-') << a.at(3) << "=7\n";
      return 0;
    }
  }
}

Measured memory_bytes: 3572
#include<iostream>
using namespace std;
int main(){
  int a,b;
  bool fi=true;
  while(cin >> a >> b,a||b){
    if(!fi)cout << endl;
    fi=false;
    bool f=false;
    for(int i=a;i<=b;i++){
      if(i%400==0) {
	cout << i << endl;
	f=true;
      }else if(i%100==0) {
      }else if(i%4==0){
	cout << i << endl;
	f=true;
      }
    }
    if(!f) cout << "NA" << endl;
  }
}

Measured memory_bytes: 1160
main = do
  n <- readLn
  putStrLn . unwords . map show $ solve n

solve :: Int -> [Int]
solve n = take n qs where
  qs = filter (\p -> p `mod` 5 == 1) $ primes 55555

primes :: Int -> [Int]
primes n = sieve [2 .. n] where
  sieve (x:xs) = x:ys where
    ys = if x ^ 2 > n then xs else sieve $ filter (\y -> y `mod` x /= 0) xs


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

int main(){
string a,b;
  cin>>a>>b;
  if(a.size()>b.size()){
  for(int i=0;i<a.size()-1;i++){
  cout<<a[i];
    cout<<b[i];
  }
    cout<<a.back();
  }
else {
for(int i=0;i<b.size();i++){
cout<<a[i];
  cout<<b[i];
}
}
cout<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  char input[200001];
  int i,len;
  
  scanf("%s",input);
  len=strlen(input);
  
  for(i=0;i<len;i++){
    if(input[i]=='?'){
      input[i]='D';
    }
  }
  
  printf("%s",input);
}


Measured memory_bytes: 1916
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
        	int a = scan.nextInt();
        	int b = scan.nextInt();
        	int n = scan.nextInt();
        	double c = (double)a / (double)b;
        	String str = String.valueOf(c);
        	int tI = 0;
        	for(int i = 0;i < str.length();i++){
        		if(str.charAt(i) == '.'){
        			tI = i;
        			break;
        		}
        	}
        	int sum = 0;
        	for(int i = 0,j = tI + 1;i < n && j < str.length();i++,j++){
        		sum += Integer.parseInt(str.charAt(j)+"");
        	}
        	System.out.println(sum);
        }
    }
}

Measured memory_bytes: 20220
n = int(input())
l = []
for i in range(n):
    l.append([int(input()), i])
l.sort(reverse=True)
m1 = l[0][0]
m2 = l[1][0]
id1 = l[0][1]
for i in range(n):
    if i == id1:
        print(m2)
    else:
        print(m1)


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

const string dest[16] = {
"KIHABARA",
"KIHABAR",
"KIHABRA",
"KIHABR",
"KIHBARA",
"KIHBAR",
"KIHBRA",
"KIHBR",
"AKIHABARA",
"AKIHABAR",
"AKIHABRA",
"AKIHABR",
"AKIHBARA",
"AKIHBAR",
"AKIHBRA",
"AKIHBR"};
string src;

int main() {
	cin >> src;
	for (int i = 0; i < 16; i++) {
		if (src == dest[i]) {
			puts("YES");
			return 0;
		}
	}
	puts("NO");
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
#define string(n) to_string(n)
#define int(w) stoi(w)
#define len(l) l.size()
#define append(l,i) l.push_back(i)
int main() {
    int n,n1;
    cin>>n;
    map<int,int> d;
    rep(i,n){
        cin>>n1;
        if (d.count(n1)){
            d[n1]+=1;
        }
        else{
            d[n1]=1;
        }

    }
    int ans=0,num;
    for (pair<int,int> p:d){
        num=p.first-p.second;

        if(num<=0){
            ans+=-num;
        }
        else{
            ans+=p.second;
        }


    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 4736
#pragma GCC optimize("O2")

#include <bits/stdc++.h>
#ifdef DEBUG
    #include "debug.hpp"
#endif

using namespace std;

#define all(c) (c).begin(), (c).end()
#define traverse(c, it) for(auto it = (c).begin(); it != (c).end(); it++)
#define rep(i, N) for(int i = 0; i < (N); i++)
#define rep1(i, N) for(int i = 1; i <= (N); i++)
#define rep2(i, s, e) for(int i = (s); i <= (e); i++)
#define rep3(i, s, e, d) for(int i = (s); (d) >= 0 ? i <= (e) : i >= (e); i += (d))
#define pb push_back


#ifdef DEBUG
    #define debug(x...) {dbg::depth++; string dbg_vals = dbg::to_string(x); dbg::depth--; dbg::fprint(__func__, __LINE__, #x, dbg_vals);}
    #define light_debug(x) {dbg::light = 1; dbg::dout << __func__ << ":" << __LINE__ << "  " << #x << " = " << x << endl; dbg::light = 0;}
#else
    #define debug(x...)
    #define light_debug(x) 
#endif

template<typename T>
T& ckmin(T& a, T b){ return a = a > b ? b : a; }

template<typename T>
T& ckmax(T& a, T b){ return a = a < b ? b : a; }

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

namespace ioUtils {

    char vector_delimiter = ' ';

    template<typename T>
    istream& operator >>(istream&, vector<T>&);

    template<typename... Ts>
    istream& operator >>(istream& is, pair<Ts...>& p){
        is >> p.first >> p.second;
        return is;
    }

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

    template<typename T>
    ostream& operator <<(ostream&, vector<T>&);

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

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

using namespace ioUtils;


int N;
vector<long double> p;
long double dp[2999][2999];

signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    #ifdef DEBUG
        freopen("debug", "w", stderr);
    #endif
    cin >> N;
    p.resize(N);
    cin >> p;
    
    rep(i, N) dp[i][0] = 1;
    dp[0][1] = p[0];

    rep1(i, N - 1)
    	rep1(c, (N + 1) >> 1)
    	 	dp[i][c] = p[i] * dp[i - 1][c - 1] + (1 - p[i]) * dp[i - 1][c];

    cout << fixed << setprecision(15) << dp[N - 1][(N + 1) >> 1] << '\n';

    #ifdef DEBUG
        dbg::dout << "\nExecution time: " << clock() << "ms\n";
    #endif

    return 0;
}


Measured memory_bytes: 86116
/*
ID: Aman Raj
LANG: C++
TASK: money
*/
#include<iostream>
#include <stdio.h>
//#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<math.h>
typedef  long long int ll;
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
//Â
using namespace std;
using namespace __gnu_pbds;
//Â
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
//#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define flush fflush(stdout)
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <fstream>
// find_by_order()  // order_of_key
typedef tree<
	int,
	null_type,
	less<int>,
	rb_tree_tag,
	tree_order_statistics_node_update>
	ordered_set;
  //# define mod 1e9+7
   ll gcd(ll a,ll b)
   {
       if(a==0)return b;
       return gcd(b%a,a);
   }
//Â

ll power1(ll a, ll b)//a raised to power b
   {  if(b<=0) return 1; if(b==1) return a;
       ll c=power1(a,b/2);
        c*=c;c%=mod;if(b%2==1) c*=a;c%=mod;
        return c;
   }
   ll mi(ll a,ll m)
   { ll c= power1(a,m-2);

     return c;
   }
int main()
{    ifstream fin("money.in");
     ofstream fout("money.out");
      
     ll a;cin>>a;
      string s;cin>>s;
      if(a<3200)cout<<"red";
      else cout<<s;
      
      return 0;
}


Measured memory_bytes: 256
A, B = input().split()
li = []
for i in range(len(B)):
    if B[i] != ".":
        li.append(B[i])
li.reverse()
num = 1
num2 = 0
for i in range(len(li)):
    num2 += num * int(li[i])
    num *= 10
A = int(A)
B = num2
C = A * B
D = C % 100
C = C - D
C = C // 100
print(C)

Measured memory_bytes: 61872
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;

int gcd(int x, int y)
{
    if (x < y) { swap(x, y); }
    if (y == 0) return x;

    return gcd(y, x % y);
}

int dp[201][201][201];

int main()
{
    int k;
    cin >> k;
    int ans = 0;

    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                int g = gcd(a, b);
                if (g == 1) {
                    ans += 1;
                } else {
                    ans += gcd(g, c);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3192
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

map<ll,ll> p;
ll N,M;

int main(void){
	cin>>N;
	rep(i,N){
		ll a;
		scanf("%lld",&a);
		p[a]++;
	}
	cin>>M;
	rep(i,M){
		ll a;
		scanf("%lld",&a);
		if(p[a]>0){
			p[a]--;
		}else{
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 12800
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    n, k = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    Having = [False] * n

    for i in range(k):
        d = int(input())
        having = list(map(int, input().split()))

        for j in having:
            Having[j - 1] = True

    print(Having.count(False))


resolve()

Measured memory_bytes: 67844