akhauriyash/Code-Regression huggingface dataset:
n = gets.to_i
ds = Hash.new(0)
gets.split.map(&:to_i).each do |d|
  ds[d] += 1
end
m = gets.to_i
ts = Hash.new(0)
gets.split.map(&:to_i).each do |t|
  ts[t] += 1
end
ans = 'YES'
ts.each do |k, c|
  if ds[k] >= c
  else
    ans = 'NO'
    break
  end
end
puts ans

Measured memory_bytes: 55032
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		scanner.close();

		boolean flag = false;

		for (int n = 0; n <= 25; n++) {
			for (int m = 0; m <= 14; m++) {
				if (n * 4 + m * 7 == N) {
					flag = true;
					break;
				}
			}
			if (flag) {
				break;
			}
		}
		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 505


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	ll a[n], sum = 0, min = MOD, in;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		sum += abs(a[i]);
		if(abs(a[i]) < min)
		{
			min = abs(a[i]);
			in = i;
		}
	}
	sum -= abs(a[in]);
	int le = 0, ri = 0;
	for (int i = 0; i < in; ++i)
	{
		if(a[i] < 0)
			le++;
	}
	for(int i = in + 1; i < n; ++i)
		if(a[i] < 0)
			ri++;
	if(le & 1)
		a[in] *= -1;
	if(ri & 1)
		a[in] *= -1;
	sum += a[in];
	cout << sum << "\n";
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  
  vector<int> ticket(4);
  rep(i, 4) {
    ticket.at(i) = s.at(i) - '0';
  }
  
  for (int i = 0; i < (1 << 3); i++) {
    bitset<3> i_bit(i);
    int sum = ticket.at(0);
    rep(j, 3) {
      if (i_bit.test(j))
        sum += ticket.at(j + 1);
      else
        sum -= ticket.at(j + 1);
    }
    
    if (sum == 7) {
      string a = "";
      a.push_back(s.at(0));
      rep(j, 3) {
        if (i_bit.test(j)) {
          a.push_back('+');
          a.push_back(s.at(j + 1));
        }
        else {
          a.push_back('-');
          a.push_back(s.at(j + 1));
        }
      }
      
      a.push_back('=');
      a.push_back('7');
      cout << a << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0] * (n+1)
        self.cnt = 0

    
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    def groupsize(self):
        self.cnt = 0
        for i, x in enumerate(self.par):
            if x == i:
                self.cnt += 1
        return self.cnt
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

N, M = map(int,input().split())
A = [list(map(int,input().split())) for i in range(M)]
uf = UnionFind(N)

for i in range(M):
    uf.union(A[i][0]-1, A[i][1]-1)

print(uf.groupsize())


Measured memory_bytes: 32284
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int A, B, C, D; cin >> A >> B >> C >> D;
    cout << max(0, (min(B, D) - max(A, C))) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int _(int n);

int main()
{
    int n;

    scanf("%d", &n);

    while (!_(n)) {
        n++;
    }

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

    return 0;
}

int _(int n)
{
    const int table[] = {111, 222, 333, 444, 555, 666, 777, 888, 999};
    int i;
    int f = 0;

    for (i = 0; i < 9; i++) {
        if (table[i] == n) {
            f = 1;
        }
    }

    return f;
}


Measured memory_bytes: 256
from collections import deque

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

q = deque()
q.append((0, 0, 0))
check = [[0]*w for _ in range(h)]

flag = False
while q:
    y, x, d = q.popleft()
    if y == h-1 and x == w-1:
        g = d
        flag = True
        break
    if check[y][x] == 0:
        check[y][x] = 1
        for xdx, ydy in zip((x, x, x+1, x-1), (y+1, y-1, y, y)):
            if (0 <= xdx < w) and (0 <= ydy < h):
                if check[ydy][xdx] == 0 and s[ydy][xdx] == '.':
                    q.append((ydy, xdx, d+1))
ss = 0
for i in s:
    ss += i.count('#')
print(h*w-ss-d-1 if flag else -1)

Measured memory_bytes: 9480
#[allow(unused_imports)]
use std::io::Write;

// {{{
#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
// }}}

fn main() {
    input! {
        a: usize,
        b: usize
    }

    let d = gcd(a, b);
    println!("{}", a * b / d);
}

fn gcd(a: usize, b: usize) -> usize {
    let c = a % b;
    if c == 0 {
        b
    } else {
        gcd(b, c)
    }
}


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

using namespace std;

int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    
    for (; !(a < b) && k > 0; k--) {
        b *= 2;
    }
    for (; !(b < c) && k > 0; k--) {
        c *= 2;
    }
    if (a < b && b < c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    string S;
    cin >> S;
    for(int i = 0;i < (1 << 3);i++){
        int sum = S[0] - '0';
        for(int j = 0;j < 3;j++){
            int num = S[j+1] - '0';
            sum += (i&(1<<j))?num:-num;
        }
        if(sum == 7){
            string op = "-+";
            cout << S[0] << op[i&1] << S[1] << op[(i&2)/2] << S[2] << op[(i&4)/4] << 
            S[3] << "=7" <<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
n, m, l = map(int, raw_input().split())
A = [map(int, raw_input().split()) for i in xrange(n)]
B = [map(int, raw_input().split()) for i in xrange(m)]
C = [[0] * l for i in xrange(n)]

for i in xrange(n):
    for j in xrange(l):
        C[i][j] = sum(A[i][k] * B[k][j] for k in xrange(m))
for c in C:
    print " ".join(map(str, c))

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

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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Library

struct UnionFind {
    vector<int> par, rank;

    UnionFind(int n) : par(n , -1), rank(n, 0) { }
    void init(int n) { par.assign(n, -1), rank.assign(n, 0); }

    int root(int x) {
        if (par[x] == -1) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

//

int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int N, K, L; cin >> N >> K >> L;
    UnionFind ufk(N);
    for(int i = 0; i < K; ++i){
        int x, y; cin >> x >> y;
        --x; --y;
        ufk.merge(x, y);
    }

    UnionFind ufl(N);
    for(int i = 0; i < L; ++i){
        int x, y; cin >> x >> y;
        --x; --y;
        ufl.merge(x, y);
    }
    map<P, int> mp;
    for(int i = 0; i < N; i++){
        int a = ufk.root(i);
        int b = ufl.root(i);
        mp[make_pair(a, b)]++;
    }

    for (int i = 0; i < N; ++i) {
        int a = ufk.root(i);
        int b = ufl.root(i);
        cout << mp[{a,b}];
        if(i == N - 1){
            cout << endl;
        }
        else{
            cout << " ";
        }
    }
    return 0;
}



Measured memory_bytes: 15104
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <cstdio>

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;(i)>=0;(i)--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())

typedef long long ll;

int main(){
    
    
    while(true){
        int N;
        cin>>N;
        if(N==0)break;
    
        map<pair<int,int>,bool> p;
        REP(i,N){
            int a,b;
            cin>>a>>b;
            p[make_pair(a,b)]=false;
        }
        
        int M;
        cin>>M;
        int x=10,y=10;
        REP(i,M){
            char dire;
            int dist;
            cin>>dire>>dist;
            REP(j,dist){
                if(dire=='N')y++;
                if(dire=='S')y--;
                if(dire=='E')x++;
                if(dire=='W')x--;
                if(p.find(make_pair(x,y))!=p.end()){
                    p[make_pair(x,y)]=true;
                }
            }
        }
        
        bool flag=false;
        for(auto itr=p.begin();itr!=p.end();itr++){
            if(!itr->second)flag=true;
        }
        
        if(flag)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
        
    }
    
    return 0;
}

Measured memory_bytes: 3092
#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()
void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(100);
}
#define int ll
int ans[3000000];
void solve() {
	int n;
	cin >> n;
	vector<pair<int, int>> inputs;
	inputs.push_back(mp(1e18, 0));
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		inputs.push_back(mp(a - b, a + b));
	}
	sort(ALL(inputs));
	for (int i = 1; i < inputs.size(); ++i) {
		if (inputs[i - 1].first == inputs[i].first) {
			inputs[i].second = inputs[i - 1].second;
		}
	}
	for (int i = 0; i < n; ++i) {
		ans[i + 1] = max(ans[i], ans[i + 1]);
		int next = inputs[i].second;
		int bot = inputs.size() - 1;
		int top = i;
		while (abs(top - bot) > 1) {
			int mid = (top + bot) / 2;
			if (inputs[mid].first >= next) {
				bot = mid;
			}
			else {
				top = mid;
			}
		}
		ans[bot] = max(ans[i] + 1, ans[bot]);
	}
	cout << ans[n] << endl;
}

#undef int

int main() {
	init();
	solve();
}


Measured memory_bytes: 2672
def fc(c, x):
    if(x > c * 50):
        return 0;
    return 1;

def fb(b, c, x):
    ans = 0;
    if(b > 0 and x >= 100):
        ans += fb(b-1, c, x-100);
    ans += fc(c, x);
    return ans;

def fa(a, b, c, x):
    ans = 0;
    if(a > 0 and x >= 500):
        ans += fa(a-1, b, c, x-500);
    ans += fb(b, c, x);
    return ans;


a = int(input())
b = int(input())
c = int(input())
x = int(input())
    
print(fa(a, b, c, x))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;


int main() {
	int flag = 0;
	int count = 0;
	int n, m;
	int nedan[1001] = {};
	int saidai = 0;
	int result[1000];
	cin >> n;
	int a = 0;
	int b = 0;
	string str = "";
	for (int i = 0; i < n; i++) {
		cin >> str;
		if (str == "A") {
			a++;
		}
		else if (str == "Un") {
			if (a > 0) {
				a--;
			}
			else {
				b = 1;
			}
		}
	}
	if (b == 0 && a == 0) {
		cout << "YES" << endl;
	}else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 3152
# /usr/bin/python
# -*- coding: utf-8 -*-
import sys


n,m,x = map(int, input().split())
An = list(map(int, input().split()))
cost = [0] * (n+1)
for a in An:
  cost[a] = 1

print(min(sum(cost[:x+1]),sum(cost[x:])))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;

struct DSU
{
	int par[N], sz[N];

	void init(int n) 
	{
		for(int i=1;i<=n;i++)
		{
			par[i]=i;
			sz[i]=1;
		}
	}

	int getPar(int k)
	{
		while(k!=par[k])
		{
			par[k]=par[par[k]];
			k=par[k];
		}
		return k;
	}

	int getSize(int k)
	{
		return sz[getPar(k)];
	}

	void unite(int u, int v)
	{
		int par1=getPar(u), par2=getPar(v);

		if(par1==par2)
			return;


		if(sz[par1]>sz[par2])
			swap(par1, par2);

		sz[par2]+=sz[par1];
		sz[par1]=0;
		par[par1]=par[par2];
	}
};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    DSU dsu;
    int n,m;
    cin >> n >> m;
    int ans = 0;
    dsu.init(n);
    while(m--)
    {
        int x,y,z;
        cin >> x >> y >> z;

            dsu.unite(x,y);
        
    }
    set<int> done;
    int now;
    for(int i=1;i<=n;++i)
    {
        now = dsu.getPar(i);
        if(done.count(now)==0)
        {
            ans++;
            done.insert(now);
        }
    }
    cout << ans;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int H[404];
ll mo=998244353;

ll comb(ll N_, ll C_) {
	const int NUM_=400001;
	static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}
ll p2[2020];

struct res {
	ll V[2][404];
};


res hoge(int L,int R,int B) {
	while(L<R&&H[L]<=B) L++;
	res ret={};
	if(L==R) {
		ret.V[0][0]=ret.V[1][0]=1;
		return ret;
	}
	int i;
	int add=0;
	for(i=L;i<R;i++) {
		if(H[i]<=B) {
			res X=hoge(L,i,B);
			res Y=hoge(i+1,R,B);
			int a1,a2;
			int W=R-L-1;
			for(a1=0;a1<=i-L;a1++) for(a2=0;a1+a2<=W;a2++) {
				(ret.V[0][a1+a2]+=1LL*X.V[0][a1]*Y.V[0][a2])%=mo;
				(ret.V[1][a1+a2]+=1LL*X.V[1][a1]*Y.V[1][a2])%=mo;
			}
			return ret;
		}
		if(H[i]==B+1) add++;
	}
	res X = hoge(L,R,B+1);
	int a1,a2,u1,u2;
	int W=R-L;
	// no rook
	FOR(u1,W-add+1) ret.V[0][u1+add]=ret.V[1][u1+add]=X.V[0][u1];
	
	FOR(u1,W+1) if(X.V[0][u1] || X.V[1][u1]) {
		int x,y;
		if(X.V[0][u1]) {
			FOR(x,u1+add+1) {
				if(x+y==0) (ret.V[0][u1+add]+=X.V[0][u1]*(p2[W-(u1+add)]-1))%=mo;
				else (ret.V[0][u1+add-x-y]+=X.V[0][u1]*comb(u1+add,x)%mo*p2[W-(u1+add)])%=mo;
			}
		}
		if(X.V[1][u1]) {
			FOR(x,u1+1) {
				if(x==0) (ret.V[1][u1]+=X.V[1][u1]*(p2[W-u1]-1))%=mo;
				else (ret.V[1][u1-x]+=X.V[1][u1]*comb(u1,x)%mo*p2[W-u1])%=mo;
			}
		}
	}
		
	return ret;
	
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	p2[0]=1;
	FOR(i,2010) p2[i+1]=p2[i]*2%mo;
	
	cin>>N;
	FOR(i,N) cin>>H[i];
	
	auto X=hoge(0,N,0);
	cout<<X.V[1][0]<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 18944
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 1002
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

int main(){
	int a[5], t1, t2, ans = 0;
	rep(i,5)scanf("%d", &a[i]);
	t1 = a[0]*a[4];
	if(a[2] >= a[4])t2 = a[1];
	else t2 = a[1]+(a[4]-a[2])*a[3];
	printf("%d\n", min(t1, t2));
	return 0;
}

Measured memory_bytes: 3208
#include <stdio.h>


int main(){

  int i,j,k;
  int N;
  int M;
  int A[10];
  int sum=0;
  int dig;
  scanf("%d",&N );
  M = N;
  while(N){
    dig = N % 10;
    sum = sum + dig;
    N = N / 10;
    if(N==0)break;
  }

  k = M%sum;
  

  if(k==0)printf("Yes");
  if(k!=0)printf("No");
  return 0;
}

Measured memory_bytes: 128
#include <cstdio>

using namespace std;

int cnt[200'009];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    cnt[i] = 0;
  }
  for (int i = 0; i < n - 1; ++i) {
    int x;
    scanf("%d", &x);
    --x;
    ++cnt[x];
  }
  for (int i = 0; i < n; ++i) {
    printf("%d\n", cnt[i]);
  }
}


Measured memory_bytes: 2516
// Author : Nachiket Kanore
// Institute : PICT, Pune

#include <stdexcept>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cassert>
#include <cstring>
#include <cstdarg>
#include <cstdio>
#include <memory>
#include <random>
#include <cmath>
#include <ctime>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <algorithm>
#include <complex>
#include <numeric>
#include <limits>
#include <bitset>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <array>
#include <list>
#include <map>
#include <set>

using namespace std;

#define int long long
#define endl '\n'
#define rep(x,s,e) for(int x=s;x<=(e);x++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define precise(x) cout << fixed << setprecision(x)
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
 
 
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
 
const int mod = 1e9+7;
const int inf = 1e18;
const int N = 2e5+20;


int32_t main(){
    FAST;

    int n , k;  cin >> n >> k;
    int ans = 0;
    for(int x=0;x<n;x++){
        int t;  cin >> t;
        ans += t >= k;
    }

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

Measured memory_bytes: 256
#include<cstdio>

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

using namespace std;

int main(){
	int n,T,H,L; scanf("%d%d%d%d",&n,&T,&H,&L);
	int t[100],h[100];
	rep(i,n) scanf("%d%d",t+i,h+i);

	int yen=0;
	while(1){
		rep(i,n){
			if(t[i]>0){
				t[i]--;
				T++;
				yen+=10;
				if(T>L){ printf("%d\n",i+1); return 0; }
			}
			else if(h[i]>0){
				h[i]--;
				H++;
				yen+=100;
			}
			else{
				printf("%d\n",i+1);
				return 0;
			}

			if(yen>=90){
				int back=yen-90;
				if(T<back/10){ printf("%d\n",i+1); return 0; }
				T-=back/10;
				t[i]+=back/10;
				yen=0;
			}
		}
	}
}

Measured memory_bytes: 1028
import java.util.*;

public class Main {
  private static boolean verify(int[][] c) {
    return (
      c[1][1] - c[1][0] == c[0][1] - c[0][0] &&
      c[2][1] - c[2][0] == c[0][1] - c[0][0] &&
      c[1][2] - c[1][1] == c[0][2] - c[0][1] &&
      c[2][2] - c[2][1] == c[0][2] - c[0][1] &&
      c[1][1] - c[0][1] == c[1][0] - c[0][0] &&
      c[1][2] - c[0][2] == c[1][0] - c[0][0] &&
      c[2][1] - c[1][1] == c[2][0] - c[1][0] &&
      c[2][2] - c[1][2] == c[2][0] - c[1][0]);
  }

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int[][] c = new int[3][3];
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        c[i][j] = in.nextInt();
      }
    }
    System.out.println(verify(c) ? "Yes" : "No");
  }
}


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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  int mainasu = 0;
  rep(i, N-1) {
    if (S[i] == S[i+1]) mainasu++;
  }
  
  cout << (N-mainasu);
  
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <memory>
#include <memory.h>
#include <cmath>
#include <fstream>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>
#define USE_MATH_DEFINES
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

typedef pair<xy_t, bool> dat;

namespace std{
	bool operator < (const xy_t &a, const xy_t &b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a)*b);
}

int ccw(xy_t a, xy_t b, xy_t c){
	b -= a; c -= a;
	if(cross(b, c) > 0) return 1;
	if(cross(b, c) < 0) return -1;
	if(dot(b, c) < 0) return +2;
	if(norm(b) < norm(c) ) return -2;
	return 0;
}

bool intersectSS(const line &s, const line &t){
	return ccw(s.first, s.second, t.first) * ccw(s.first, s.second, t.second) <= 0 &&
		ccw(t.first, t.second, s.first) * ccw(t.first, t.second, s.second) <= 0;
}

xy_t crosspoint(const line &l, const line &m){
	double a = cross(l.second - l.first, m.second - m.first);
	double b = cross(l.second - l.first, l.second - m.first);
	if(abs(a) < EPS && abs(b) < EPS) return m.first;
	if(abs(a) < EPS) assert(false);
	return m.first + b / a * (m.second - m.first);
}

int nums[] = {
	1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
};

int main(){
	string s;
	while(cin >> s && s != "#"){
		int n = s.size();
		int res = 0;
		for(int i = 0; i < n - 1; i++){
			if(nums[s[i]-'a'] != nums[s[i+1] - 'a']) res++;
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <utility>
using namespace std;
using P = pair<int,int>;


int h, w;
bool is_wall[21][21];

int dist(int sy, int sx) {
	int dx[] = { 0,0,1,-1};
	int dy[] = { 1,-1,0,0};
	if (is_wall[sy][sx]) {
		return -1;
	}

	vector<vector<int> > dist(h, vector<int>(w, -1));

	queue< P > que;
	que.push(make_pair(sy,sx));
	dist[sy][sx] = 0;

	int ld = 0;

	while (!que.empty()) {
		auto p = que.front();
		que.pop();
		
		int y = p.first;
		int x = p.second;



		for (int i = 0; i < 4; i++) {
			int nx = x + dx[i];
			int ny = y + dy[i];
			if (nx < 0 || nx >= w || ny < 0 || ny >= h) {
				continue;
			}

			if (dist[ny][nx] != -1 || is_wall[ny][nx]) {
				continue;
			}

			dist[ny][nx] = dist[y][x] + 1;
			ld = dist[ny][nx];
			que.push(make_pair(ny, nx));
		}
	}
	return ld;

} 


int main() {
	cin >> h >> w;

	for (int y = 0; y < h; y++) {
		string s;
		cin >> s;
		for (int x = 0; x < w; x++) {
			is_wall[y][x] = (s.at(x) == '#');
		}	
	}
	int max_d = 0;
	for (int y = 0; y < h; y++) {
		for (int x = 0; x < w; x++) {
			int cur = dist(y , x);
			//cout << "y:" << y << " x:" << x << " cur:" << cur << endl;
			if (max_d < cur) {
				max_d = cur;
			}
		}
	}
	cout << max_d << endl;
	return 0;
}

Measured memory_bytes: 888
// I need some holiday
// But I don't wish that everyday is holiday
// Because I didn't bear the pain
// Because it wasn't a true freedom
//         ——『イヤホンと蝉時雨』·Orangestar

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef pair<int, int> pii;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define MP make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }
template<typename T> inline T sqr(const T &val) { return val * val; }

namespace fastIO
{
	const int MAX_BUFFER_SIZE = 1 << 16;

	char buffer[MAX_BUFFER_SIZE], *cur = buffer, *ed = buffer;

	inline char getc() { return cur == ed && (ed = (cur = buffer) + fread(buffer, 1, MAX_BUFFER_SIZE, stdin), cur == ed) ? EOF : *cur++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

inline char *read_str(char *s)
{
	register char ch(getc());
	while(!isgraph(ch)) ch = getc();
	for(; isgraph(ch); ch = getc()) *s++ = ch;
	*s = '\0';
	return s;
}

// END tpl.

const int MAXN = (int) 5e3, MAXM = 200;

int n, m;

int a[MAXN + 5];

int b[MAXM + 5][MAXN + 5];

inline void input()
{
	n = read<int>(), m = read<int>();
	for(int i = 1; i < n; ++i) a[i] = read<int>();
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= m; ++j)
			b[j][i] = read<int>();
}

LL s[MAXN + 5][MAXN + 5];

inline void add_matrix(int x0, int x1, int y0, int y1, int val)
{
	if(x0 > x1 || y0 > y1) return;
	s[x0][y0] += val;
	s[x0][y1 + 1] -= val;
	s[x1 + 1][y0] -= val;
	s[x1 + 1][y1 + 1] += val;
}

inline void calc_ctb(int k)
{
	int *val = b[k];
	static int lst[MAXN + 5], nxt[MAXN + 5];
	static vector<int> stk;

	stk.clear();
	stk.push_back(0);
	for(int i = 1; i <= n; ++i)
	{
		while(SZ(stk) > 1 && val[i] > val[stk.back()]) stk.pop_back();
		lst[i] = stk.back();
		stk.push_back(i);
	}

	stk.clear();
	stk.push_back(n + 1);
	for(int i = n; i >= 1; --i)
	{
		while(SZ(stk) > 1 && val[i] >= val[stk.back()]) stk.pop_back();
		nxt[i] = stk.back();
		stk.push_back(i);
	}

	for(int i = 1; i <= n; ++i) add_matrix(lst[i] + 1, i, i, nxt[i] - 1, val[i]);
}

inline void solve_ctb()
{
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= n; ++j)
			s[i][j] += s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1];
}

inline void solve()
{
	for(int i = 1; i <= m; ++i) calc_ctb(i);
	solve_ctb();

	LL ans = 0;
	for(int i = 1; i <= n; ++i)
	{
		LL res = 0;
		for(int j = i; j <= n; ++j)
			chkmax(ans, s[i][j] - res), res += a[j];
	}
	printf("%lld\n", ans);
}

int main()
{
#ifdef K_ON
	freopen("F.in", "r", stdin);
	freopen("F.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}




Measured memory_bytes: 199936
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    vector<ld> p(n);
    rep(i,n)cin >> p[i];
    vector<vector<ld>> dp(n+1, vector<ld>(n + 1));

    dp[0][0] = 1.0;
    rep(i,n)rep(j,i+1){
        dp[i+1][j] += (1.0 - p[i]) * dp[i][j];
        dp[i+1][j+1] += p[i] * dp[i][j];
    }

    ld ans = 0.0;
    rep(i,n+1){
        if(i * 2 <= n)continue;
        ans += dp[n][i];
    }
    cout << fixed << setprecision(15);
    cout << ans << endl;
}

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

using namespace std;
typedef pair<int,int> P;
vector<P> V;
const int MAX_N=100000;
int C[MAX_N];
bool b[MAX_N];

int main(){
    int N,Q;
    cin>>N>>Q;
    for(int i=0;i<Q;i++){
        int A,B;
        cin>>A>>B;
        A--;B--;
        V.emplace_back(A,B);
    }
    for(int i=0;i<N;i++){
        C[i]=i;
    }
    for(int i=Q-1;i>=0;i--){
        int A=V[i].first, B=V[i].second;
        swap(C[A],C[B]);
    }
    int p=0;
    b[C[p]]=true;
    b[C[p+1]]=true;
    for(int i=0;i<Q;i++){
        int A=V[i].first, B=V[i].second;
        if(A==p){
            p=B;
        }else if(B==p){
            p=A;
        }
        swap(C[A],C[B]);
        if(p>0){
            b[C[p-1]]=true;
        }
        if(p<N-1){
            b[C[p+1]]=true;
        }
    }
    int ans=0;
    for(int i=0;i<N;i++){
        if(b[i]) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1524
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  ll N;
  cin >> N;
  string ans="";
  while(N>0) {
    N--;
    ll k = N%26;
    ans += 'a'+k;
    N /= 26;
  }
  reverse(rng(ans));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
	int N, M;

	cin >> N >> M;

	vector<pair<int, int>> islands;
	int ans = 0;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		islands.push_back(make_pair(a, b));
	}

	sort(islands.begin(), islands.end(),
		[](const pair<int, int> a, const pair<int, int> b) {return a.second < b.second; });

	int last = -1;
	for (int i = 0; i < islands.size(); i++) {
		if (islands[i].first > last) {
			ans++;
			last = islands[i].second - 1;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1400
from collections import defaultdict

N = int(input())
res = 0
d = len(str(N))
same = defaultdict(int)
odd1 = defaultdict(int)
odd2 = defaultdict(int)

for i in range(1, N+1):
    if i % 10 == 0:
        continue

    left = str(i)[0]
    right = str(i)[-1]
    if left == right:
        same[left] += 1
    elif int(left) < int(right):
        odd1[left + right] += 1
        odd2[left + right] += 0
    else:
        odd2[right + left] += 1

for n in same.values():
    res += n**2

for x, y in zip(odd1.values(), odd2.values()):
    res += x*y*2

print(res)


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

int main (){
  int A,N;
  A=0;
  cin >> N;
  for (int i = 0; i < N; i++) {
   
   int p,q;
    cin >> p >> q;
    A = A + q - p + 1;
  }
  cout << A << endl;
}


Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.root = list(range(n + 1))
        self.size = [1] * (n + 1)

    def __getitem__(self, x):
        root = self.root
        while root[x] != x:
            root[x] = root[root[x]]
            x = root[x]
        return x

    def merge(self, x, y):
        x = self[x]
        y = self[y]
        if x == y:
            return
        sx, sy = self.size[x], self.size[y]
        if sx < sy:
            x, y = y, x
            sx, sy = sy, sx
        self.root[y] = x
        self.size[x] += sy


n, q = map(int, input().split())
uni = UnionFind(n)

for i in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        uni.merge(x, y)
    else:
        print(int(uni[x] == uni[y]))


Measured memory_bytes: 6028
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

#define INF (1LL << 63)
struct edge{
    size_t to;
    size_t weight;
};

vector<size_t> dijkstra(vector<vector<edge>>& Graph, int& startPoint, int& vertexNum){
    vector<size_t> minimumWeight(vertexNum,INF);

    priority_queue<vector<pair<size_t,size_t>>, vector<pair<size_t,size_t>>, greater<pair<size_t,size_t>>> priorityQueue;
    priorityQueue.push({0,startPoint});
    minimumWeight[startPoint] = 0;

    while(!priorityQueue.empty()){
        pair<size_t,size_t> tmp = priorityQueue.top();

        edge Edge;
        Edge.to = tmp.second;
        Edge.weight = tmp.first;

        priorityQueue.pop();

        if(minimumWeight[Edge.to] < Edge.weight) continue;
        for(edge& edge : Graph[Edge.to]){
            if(minimumWeight[edge.to] < minimumWeight[Edge.to] + edge.weight) continue;
            minimumWeight[edge.to] = minimumWeight[Edge.to] + edge.weight;
            priorityQueue.push({minimumWeight[edge.to],edge.to});
        }
    }
    return minimumWeight;
}

int main(){
    int vertexNum, edgeNum, startPoint;
    cin >> vertexNum >> edgeNum >> startPoint;

    vector<vector<edge>> Graph(vertexNum);
    for(int i=0;i<edgeNum;i++){
        size_t from,to,weight;
        cin >> from >> to >> weight;
        Graph[from].push_back({to, weight});
    }

    vector<size_t> minimumWeight = dijkstra(Graph,startPoint,vertexNum);

    for(int i=0;i<vertexNum;i++){
        if(minimumWeight[i] == INF) cout << "INF" << '\n';
        else cout << minimumWeight[i] << '\n';
    }

}


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

int main() {
  int N;
  cin>>N;
  vector<int> x(N);
  vector<int> y(N);
  for(int i=0;i<N;i++){
    cin >> x[i]>>y[i];
  }
  int cnt=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(i==j)continue;
      int dd=0;
      int t=x[j]-x[i];
      int s=y[j]-y[i];
      for(int a=0;a<N;a++){
        for(int b=0;b<N;b++){
          if(a==b)continue;
          if(t==x[b]-x[a]&&s==y[b]-y[a])dd++;
        }
      }
      cnt=max(cnt,dd);
    }
  }
  cout<<N-cnt;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <vector>
#include <queue>

using namespace std;

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

  vector<int> r;
  vector<int> g;
  vector<int> b;
  for(int i = 0; i < n; ++i) {
    if (s[i] == 'R') r.push_back(i);
    else if (s[i] == 'G') g.push_back(i);
    else b.push_back(i);
  }

  long long ans = r.size() * b.size() * g.size();
  for(int i = 0; i < n-1; ++i) {
    for(int j = i; j < n; ++j) {
      int k = j+j-i;
      if (k >= n) continue;
      if(s[i] != s[j] && s[j] != s[k] && s[i] != s[k]) --ans;
    }
  }

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

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define maxn 100005

#define ll long long
#define mod 1000000007

typedef pair<int, int> P;

int n, m;
priority_queue<ll> pq;

int main()
{
    cin >> n >> m;
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        ll x;
        scanf("%lld", &x);
        pq.push(x);
        ans += x;
    }
    while (m)
    {
        ll now = pq.top();
        pq.pop();
        ans -= now - (now / 2);
        pq.push(now / 2);
        m--;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1400
// ===========================================
// 20.02.26 atcoder 第6回 ドワンゴからの挑戦状 予選. A - Falling Asleep 
// 
// 
// ===========================================

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ET "\n"
#define CLR(arr) memset(arr, 0, sizeof(arr))
#define PAIR pair<int, int>
const ll INF = 1LL << 50;

int n;
const int MAX = 101;
int t[4*MAX];

void build_tree(){
    for(int i = n-1; i > 0; i--) t[i] = t[i<<1] + t[i<<1|1];
}

void modify_tree(int p, int value){
    for(t[p += n] = value; p > 1; p>>=1) t[p>>1] = t[p] + t[p^1];
}

int segment_tree(int l, int r){
    int res = 0; r++;
    for(l += n, r += n; l<r; l>>=1, r>>=1){
        if(l&1) res += t[l++];
        if(r&1) res += t[--r];
    }
    return res;
}



int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    
    int m;
    cin >> m;
    n = 2*m;
    
    for(int i = 0; i < m; i++)
        cin >> t[n+i];
    for(int i = 0; i < m; i++)
        cin >> t[n+m+i];
    
    build_tree();
    
    int ans = 0;
    for(int i = 0; i < m; i++){
        ans = max(
            ans,
            segment_tree(0,i) + segment_tree(i+m,n-1)
            );
        //cout << segment_tree(0,i) << " " << segment_tree(i+m,n-1) << ET;
    }
    cout << ans;
}



Measured memory_bytes: 256
mem = {}
def f(n):
	if n in mem:
		return mem[n]
	ans,b = 0, 1
	while(b <= n):
		k = n / b
		ans += b *k * (k + 1) / 2  
		b +=1
	mem[n] = ans
	return ans
print f(int(raw_input()))

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

int main() {
 int n,sum=0,ans=0;
 cin >> n;
 vector<int> s(n);
  for(int i=0;i<n;i++){
   cin >> s[i];
   sum+=s[i];
  }
  sort(s.begin(),s.end());
  if(sum%10!=0){
  cout << sum << endl;
  }
  else{
   for(int i=0;i<n;i++){
     if((sum-s[i])%10!=0){
       ans=max(ans,sum-s[i]);
     }


     }
      cout << ans << endl;
   }
  }

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    
    char[] c = s.toCharArray();
    
    int cnt = 0;
    if(c[0] == 'o') cnt++;
    if(c[1] == 'o') cnt++;
    if(c[2] == 'o') cnt++;
    
    System.out.println(700 + cnt*100);
  }
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int S, W; cin >> S >> W;
  string result = S>W ? "safe" : "unsafe";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define int long
main(){
  int n,a;
  double b=0.0;
  cin>>n;
  for(int i=0;i<n;++i){
    cin>>a;
    b+=1.0/a;
  }
  cout<<1.0/b;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static final int SIZE = 40;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int q = sc.nextInt();
		TreeSet<Long> shrines = new TreeSet<>();
		TreeSet<Long> temples = new TreeSet<>();
		for (int i = 0; i < a; i++) {
		    shrines.add(sc.nextLong());
		}
		for (int j = 0; j < b; j++) {
		    temples.add(sc.nextLong());
		}
		shrines.add(Long.MIN_VALUE / 10);
		shrines.add(Long.MAX_VALUE / 10);
		temples.add(Long.MIN_VALUE / 10);
		temples.add(Long.MAX_VALUE / 10);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < q; i++) {
		    long x = sc.nextLong();
		    long leftShrine = x - shrines.lower(x);
		    long leftTemple = x - temples.lower(x);
		    long rightShrine = shrines.higher(x) - x;
		    long rightTemple = temples.higher(x) - x;
		    long min = Long.MAX_VALUE;
		    min = Math.min(min, Math.max(leftShrine, leftTemple));
		    min = Math.min(min, Math.max(rightShrine, rightTemple));
		    min = Math.min(min, Math.min(leftShrine, rightTemple) * 2 + Math.max(leftShrine, rightTemple));
		    min = Math.min(min, Math.min(rightShrine, leftTemple) * 2 + Math.max(rightShrine, leftTemple));
		    sb.append(min).append("\n");
		}
		System.out.print(sb);
    }
}



Measured memory_bytes: 110352
package main

import (
	"fmt"
)

func main() {
	var h,w,n int
	fmt.Scan(&h,&w,&n)
	
	cnt := 0
	if h >= w {
		cnt = n / h
		if n % h != 0 {
			cnt++
		}
		fmt.Println(cnt)
	} else {
		cnt = n / w
		if n % w != 0 {
			cnt++
		}
		fmt.Println(cnt)
	}
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var raw = ReadLine().Split().Select(int.Parse).ToArray();
            var H = raw[0];
            var W = raw[1];

            raw = ReadLine().Split().Select(int.Parse).ToArray();
            var h = raw[0];
            var w = raw[1];

            WriteLine((H - h) * (W - w));
        }
    }
}


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

int main(){
    ll a,b;
    cin >> a >> b;
    if(a==1||b==1){
        cout << 1 << endl;
        return 0;
    }
    cout << (a*b+1)/2 << endl;
    
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
 using namespace std;
 int main(){
   int n,c,k,ans=0;bool t=true;
   scanf("%d %d %d", &n, &c,&k);
   vector<int>v(n);
   for(int i=0;i<n;++i)scanf("%d",&v[i]);
   sort(v.begin(),v.end());
   for(auto it=v.cbegin();it!=v.cend();++ans){
     const int x=*it+k;
     for(int i=0;*it<=x&&i<c&&it!=v.cend();++i,++it);
   }
   printf("%d\n",ans);
   return 0;
 }

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
typedef long long int ll;
#define rep(i,n) for(int i = 0;i<n;++i)
#define repi(itr,vec) for(auto itr = vec.begin();itr!=vec.end();++itr)

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
  ll n;
  string s;
  cin >> n>> s;
  ll pos = 0;
  ll ans = 0;
  while(pos<n-2){
    if(s[pos]=='A'){
      if(s.substr(pos,3)=="ABC"){
        pos+=3;
        ans+=1;
        continue;
      }
    }
    pos+=1;
  }
  cout << ans << endl;

	return 0;
}


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

int main(){
    int n; cin >> n;
    map<string,int> mp;
    rep(i,n) {
        string s; cin >> s;
        mp[s]++;
    }
    int cnt = 0;
    for(auto x : mp){
        cnt = max(cnt,x.second);
    }
    for(auto x :mp){
        if(x.second == cnt) cout << x.first << endl;
    }
}

Measured memory_bytes: 25216
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>

uint64_t xor(uint64_t n)
{
  return n % 4 == 0 ? n : n ^ xor(n - 1);
}

int main(void)
{
  uint64_t a, b;
  scanf("%" SCNu64 "%" SCNu64, &a, &b);
  printf("%" PRIu64 "\n", xor(a - 1) ^ xor(b));
}


Measured memory_bytes: 128
sub f{my$i=$_;
	return$m[$i]if$m[$i];
	$m[$i]+=$-=&f+1-$m[$i],$-?$z[$i]=$_:0for@$_;
	$m[$i]
}
map{/ /,push@{$'+0},$`for<>;f,print$z[$_]+0,$/}1..<>


Measured memory_bytes: 143616
N=int(input())
H=list(map(int,input().split()))

ok=True
d=0
for i in range(N):
#    print(str(i)+','+str(d)+','+str(H[i]))
    if i == 0:
        d=H[0]-1
    else:
        if H[i]-1 >= d:
            d=max(H[i]-1,d)
        elif H[i] >= d:
            d=d
        else:
            ok=False
            break

if ok:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14396
import numpy as np

d = np.array([[0, 0, 0, 0, 0, 0],
            [2, 0, 9, 0, 0, 0],
            [0, 3, 0, 0, 0, 0],
            [0, 0, 4, 0, 0, 0],
            [0, 0, 0, 5, 0, 0],
            [0, 0, 0, 0, 6, 0],
            [2, 0, 7, 0, 0, 0],
            [0, 8, 0, 0, 0, 0],
            [2, 0, 9, 11, 0, 0],
            [0, 10, 0, 0, 0, 0],
            [0, 0, 0, 11, 0, 0],
            [0, 0, 0, 0, 0, 12],
            [0, 0, 13, 0, 0, 0],
            [2, 1, 9, 0, 0, 0]], dtype = 'int32')
s = 1
S = input()
N = len(S)
id = {'d': 0, 'r': 1, 'e': 2, 'a': 3, 'm': 4, 's': 5}
for c in S:
    s = d[s][id[c]] if c in id else 0
    if s == 0:
        break

print("YES" if s in {1, 6, 8, 13} else "NO")


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

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

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

    long long ans = 0;
    for (auto itr = m.rbegin(); itr != m.rend(); itr++)
    {
        long long x = itr->first;
        long long target = 1;
        long long exp = 0;
        while (x > 0)
        {
            if (~x & 1)
            {
                target += (1 << exp);
            }
            exp++;
            x >>= 1;
        }
        while (itr->second > 0)
        {
            itr->second--;
            if (m[target] > 0)
            {
                m[target]--;
                ans++;
            }
            else
            {
                itr->second++;
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 25216
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

n=int(input())
P=list(map(int,input().split()))
for i in range(1,n-1):
    if P[i-1] <= P[i] <= P[i+1] or P[i-1] >= P[i] >= P[i+1]:
        count+=1
print(count)


Measured memory_bytes: 39028
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong(),k = sc.nextLong();
		long ans = k;
		for(long i = 0; i < n-1; i++) {
			ans = ans * (k-1);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21972