akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>
#include <stack>
#include <iomanip>
#include <sstream>

using namespace std;

template <typename T>
inline bool sign(T A) {
    return (A>0)-(A<0);
}
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SREP(i,s,n) for(int i=s; (n-i)*sign(n-s)>0; i+=sign(n-s))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

bool _less(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}

template <template<class,class,class...> class C, typename K, typename V, typename... Args>
V map_get(const C<K,V,Args...>& m, K const& key, const V & defval)
{
    typename C<K,V,Args...>::const_iterator it = m.find( key );
    if (it == m.end())
        return defval;
    return it->second;
}

#define MOD (1'000'000'000+7)


int cdp[200001];

int main(void)
{
    ll N;
    cin >> N;
    vector<ll> C(N);
    cin >> C[0];
    ll sum = 1;
    cdp[C[0]] = 1;
    SREP(i, 1, N) {
        cin >> C[i];
        if (C[i-1] != C[i]) {
            ll tmp = sum;
            sum = (sum+cdp[C[i]])%MOD;
            cdp[C[i]] = (cdp[C[i]] + tmp)%MOD;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3200
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var n = sc.nextInt();
		var b = IntStream.range(0, n - 1).map(i -> sc.nextInt()).toArray();
		sc.close();

		var result = b[0] + b[n - 2] + IntStream.range(0, n - 2).map(i -> Math.min(b[i], b[i + 1])).sum();
		System.out.println(result);
	}
}


Measured memory_bytes: 36692
// Author : Mohamed sameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
using namespace std ;
const int N = 1e3+5;
int R, C;
int dist[N][N];
string grid[N];
pair<int,int> St, En;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1}; 
int main()
{
	cin >> R >> C;
	cin >> St.f >> St.s >> En.f >> En.s;
	St.f--;St.s--;En.f--;En.s--;
	for (int i = 0; i < R; i++)cin >> grid[i];
	
	dist[St.f][St.s] = 0;
	deque<pair<int,int>> dq;
	dq.pb(St);
	for (int i = 0; i < R; i++)
		for (int j = 0; j < C; j++)
			dist[i][j] = 1e9;
	dist[St.f][St.s] = 0;
	
	while(!dq.empty())
	{
		auto cur = dq.front();
		dq.pop_front();
		for (int i = 0; i < 4; i++)
		{
			int nx = dx[i] + cur.f;
			int ny = dy[i] + cur.s;
			if (min(nx, ny) < 0 || nx == R || ny == C || grid[nx][ny] != '.' || dist[nx][ny] <= dist[cur.f][cur.s])continue;
			dist[nx][ny] = dist[cur.f][cur.s];
			dq.push_front({nx, ny});
		}
		for (int i = -2; i <= 2; i++)
			for (int j = -2; j <= 2; j++)
			{
				int nx = i + cur.f;
				int ny = j + cur.s;
				if (min(nx, ny) < 0 || nx >= R || ny >= C || grid[nx][ny] != '.' || dist[nx][ny] <= dist[cur.f][cur.s] + 1)continue;
				dist[nx][ny] = dist[cur.f][cur.s] + 1;
				dq.push_back({nx, ny});
			}
		
	}
	if (dist[En.f][En.s] == 1e9)dist[En.f][En.s] = -1;
	cout << dist[En.f][En.s] << '\n';
	
}


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

typedef pair<long long int, long long int> p;
map<p, long long int> mem;

long long int solve(long long int S, long long int X) {
    long long int mod = 1000000007;
    if(mem.find(p(S, X)) != mem.end()) {
        return mem[p(S, X)];
    }
    if(S == 0)  return 1;
    if(S == 1)  return 2;
    long long int ans;
    ans = solve(S/2, X/2) % mod + solve((S-1)/2, X/2) % mod + solve((S-2)/2, X/2) % mod;
    return mem[p(S, X)] = ans % mod;
}

int main(void) {
    long long int n;
    cin >> n;
    cout << solve(n, n) << endl;
    
    return 0;
}

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

int n, d, q;
long a[500000];
long b[500001];
long p[500001];

bool sub(int k) {
  return b[k] >= p[k + 1];
}

void pre() {
  int dist = d;
  for (int i = 0; i < n; ++i) {
    b[i] = dist;
    if (a[i] < 2 * dist) {
      dist = abs(dist - a[i]);
    }
  }
  b[n] = dist;
  
  long curr = 1;
  p[n] = curr;
  for (int i = n - 1; i >= 0; --i) {
    if (a[i] < curr * 2) {
      curr += a[i];
    }
    p[i] = curr;
  }
}

int input() {
  int sum = 0;
  char c;
  while (c = getchar(), isdigit(c)) {
    sum *= 10;
    sum += c - '0';
  }
  return sum;
}

int main() {
  n = input();
  d = input();
  for (int i = 0; i < n; ++i) a[i] = input();
  pre();
  q = input();
  for (int j = 0; j < q; ++j) {
    int b;
    b = input();
    --b;
    cout << (sub(b) ? "YES" : "NO") << endl;
  }
}

Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,k,sum=0;
  cin>>a>>b>>c>>k;
  if(a>=k){
    sum=k;
    k=0;
  }
  else{
    sum=a;
    if(k-a-b>0) sum-=(k-a-b);
  }
  cout<<sum<<"\n";
}

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

int main() {
    string w;
    cin >> w;
    int flag = 0;

    int counter = 0;
    for(char c = 'a'; c <= 'z'; c++) {
        
        for(int i = 0; i < w.size(); i++) {
            
            if(w[i] == c) {
                counter++;
            }
        }

        if(counter % 2 == 1) {
            flag = 1;
            break;
        }
    }

    if(flag == 0) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
s = list(input())
ans = len(s)
for c in set(s):
    dist = 0
    dists = []
    for d in s:
        if c != d:
            dist += 1
        else:
            dists.append(dist)
            dist = 0
    ans = min(ans, max(dists + [dist]))
print(ans)

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

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

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

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

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



int main(int argc, char **argv)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll N; cin >> N;
	map<ll, ll> m;
	REP(i, N)
	{
		ll a; cin >> a;
		m[a]++;
	}

	ll res{0};
	for (auto [a, b] : m)
	{
		if (a > b)
		{
			res += b;
		}
		else
		{
			res += b - a;
		}
	}

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


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	
	VI su(n+4);
	int sq = (int)sqrt(n);
	//dbg(sq);
	repr(i, n, 1){
		for(int j=i; j<=n; j+=i) su[j]++;
	}
	ll ans =0;
	rep2(i, 1, n+1) ans += 1LL*i*su[i];
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 42156
#include <iostream>
using namespace std;
      
int main() {
 int A, B, x, y, z;
  cin >> A >> B;
  if (A == 0 && B == 0) {
   cout << "0" << endl; 
    return 0;
  }
  x = A + B;
  y = A - B;
  z = A * B;
  
 for (int i = 0; i < 6; i++) {
   if (x <= y) {
     swap (x, y);
   }
   if (y <= z) {
     swap (y, z); 
   }
 }
  
  cout << x << endl;
}

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

int main(){
  vector<vector<int>> A(3, vector<int>(3));
  rep(i,3){
    rep(j,3){
      cin >> A.at(i).at(j);
    }
  }

  int N;
  cin >> N;

  vector<int> B(N);
  rep(i,N){
    cin >> B.at(i);
  }
  rep(i,3){
    rep(j,3){
      rep(k,N){
      if(A.at(i).at(j)==B.at(k)){
        A.at(i).at(j) = -1;
        }
      }
    }
  }
  string ans = "No";
  rep(i, 3)
  {
    if(A.at(i).at(0)==-1&&A.at(i).at(1)==-1&&A.at(i).at(2)==-1){
      ans="Yes";
      break;
    }
    if(A.at(0).at(i)==-1&&A.at(1).at(i)==-1&&A.at(2).at(i)==-1){
      ans="Yes";
      break;
    }
    if(A.at(1).at(1)==-1&&A.at(2).at(2)==-1&&A.at(0).at(0)==-1){
      ans="Yes";
      break;
    }
    if(A.at(0).at(2)==-1&&A.at(1).at(1)==-1&&A.at(2).at(0)==-1){
      ans="Yes";
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int r, q, qs, qe, qm;
	while(scanf("%*d%*d%d", &r) == 1){
		vector<int> t(r), m(r), s(r);
		for(int i = 0; i < r; ++i){
			scanf("%d%*d%d%d", &t[i], &m[i], &s[i]);
		}

		scanf("%d", &q);
		for(int i = 0; i < q; ++i){
			scanf("%d%d%d", &qs, &qe, &qm);
			int ans = 0;
			int cnt = 0;
			int prv = qs;
			for(int i = 0; i < t.size(); ++i){
				int u = min(t[i], qe);
				if(cnt){ ans += max(u - prv, 0); }
				if(m[i] == qm){
					if(s[i]){ ++cnt; }
					else{ --cnt; }
				}
				prv = max(prv, u);
			}
			printf("%d\n", ans);
		}
	}
}

Measured memory_bytes: 1040
#include <iostream>
#include <string>
#include <cstdint>
#include <vector>
#include <set>

using namespace std;

enum Character {
	A = 0,
	C,
	G,
	T,
	CHARACTER_MAX
};

class Dictionary
{
private:
	set<string> words;

public:
	Dictionary() {}

	void insert(string input) {
		words.insert(input);
	}

	void find(string input) {
		cout << ((words.end() != words.find(input)) ? "yes" : "no") << endl;
	}
};

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

	string op, word;
	uint32_t num;
	Dictionary dictionary;

	cin >> num;
	for(uint32_t i = 0; i < num; i++) {
		cin >> op >> word;
		if("insert" == op) {
			dictionary.insert(word);
		} else if("find" == op) {
			dictionary.find(word);
		}
	}

	return 0;
}


Measured memory_bytes: 29816
#include <string>
#include <iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	bool turn = false;
	string curtop, curbottom;
	for (int i = 0; i < N; ++i) {
		if (!turn) {
			bool found = false;
			for (int j = 0; j < 4; ++j) {
				cout << (j & 2 ? "#" : ".") + curtop << endl;
				cout << (j & 1 ? "#" : ".") + curbottom << endl;
				string res;
				cin >> res;
				if (res == "T") {
					found = true;
					curtop = (j & 2 ? "#" : ".") + curtop;
					curbottom = (j & 1 ? "#" : ".") + curbottom;
					break;
				}
			}
			if (!found) {
				turn = true;
			}
		}
		if (turn) {
			for (int j = 0; j < 4; ++j) {
				cout << curtop + (j & 2 ? "#" : ".") << endl;
				cout << curbottom + (j & 1 ? "#" : ".") << endl;
				string res;
				cin >> res;
				if (res == "T") {
					curtop += (j & 2 ? "#" : ".");
					curbottom += (j & 1 ? "#" : ".");
					break;
				}
			}
		}
	}
	return 0;
}

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

using namespace std;
#define FOR(i,a,b) for(int (i) = (a); (i) < (b); (i)++)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)

int main(){
  int k,n;
  const int max_n = 2e5;
  int a[max_n + 1];
  const int INF = 1e7;

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

  int ans = 0;
  for(int i = 1; i < n; i++){
    ans = max(ans, a[i] - a[i-1]);
    // cout << ans << endl;
  }
  // for(int i = 0; i < n; i++){
  //   printf("a[%d] = %d\r\n", i, a[i]);
  // }
  ans = max(ans, k - a[n-1] + a[0]);
  // cout << ans << endl;
  ans = k - ans;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxN = (1 << 16) + 5;
ll dp[18][maxN], inv[maxN], fac[maxN];
int N, a[maxN], sz[maxN], M;

ll qpow(ll num, ll k) {
	ll ans = 1;
	while(k) {
		if(k & 1) ans = (ans * num) % mod;
		k = k >> 1; num = (num * num) % mod; 
	}
	return ans;
}

ll F(int n, int m) {
	if(n < m) return 0;
	return fac[n] * inv[n - m] % mod * inv[m] % mod;
}

int main() {
	//cout <<qpow(2,3)<<endl; 
	scanf("%d%d", &N, &M);	
	fac[0] = 1;
	for(int i = 1; i <= (1 << N); ++i) fac[i] = (fac[i - 1] * i) % mod;
	for(int i = 0; i <= (1 << N); ++i) inv[i] = qpow(fac[i], mod - 2);
	//for(int i = 1; i <= 5; ++i) cout <<fac[i]<<endl;
	//cout<<fac[5]*inv[5]%mod<<endl;
	//cout<<F(5,2)<<endl; 
	for(int i = 1; i <= M; ++i) scanf("%d", &a[i]);
	for(int i = 1; i * 2 <= M; ++i) swap(a[i], a[M - i + 1]);
	dp[0][0] = 1;
	for(int i = 0; i < M; ++i) {
		for(int j = 0; j < (1 << N); ++j) {
			if(dp[i][j] == 0) continue;
			//cout<<i<<' '<<j<<' '<<dp[i][j]<<endl;
			dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % mod;
			for(int k = 0; k < N; ++k) {
				if(j & (1 << k)) continue;
				ll& t = dp[i + 1][j | (1 << k)];
				t = (t + (F((1 << N) - a[i + 1] - j, (1 << k) - 1) * dp[i][j] % mod * fac[1 << k] % mod)) % mod;
			}
		}
	}
	
	ll ans = 0;
	for(int i = 0; i < (1 << N); ++i) {
		//cout << i << ' '<<dp[M][i]<<endl; 
		if(i) sz[i] = sz[i >> 1] + (i & 1);
		ll t = (sz[i] % 2 == 0) ? 1 : -1;
		ans = (ans + (t * dp[M][i] % mod * fac[(1 << N) - 1 - i] % mod)) % mod;
	}	
	ans = (ans + mod) % mod;
	printf("%lld\n", (ans * (1 << N)) % mod);
	return 0;
} 

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

typedef long long ll;

#define REP(i,m,n) for(int i=(int)m; i < (int) n; ++i)
#define rep(i,n) REP(i,0,n)
#define all(a) (a).begin(), (a).end()

int tmp = 1;
void func(int d) {
    if(d == 0) return;
    tmp *= 100;
    func(d-1);
}

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

    int d, n; cin >> d >> n;
    func(d);
    int ans = 0;
    while(n > 0) {
        if(n == 100) ans += tmp;
        ans += tmp;
        n--;
    }
    cout << ans << '\n';
    return 0;
}

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

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long int 
typedef pair<int,int> pii;
vector<int>v;
map<int,int>op;
#define MAX 100005
bool visited[MAX];
vector<int>adj[MAX];
const int M=1e9+7;
int n,m;
const ll INF = 1LL << 60;
int dp[MAX];
void dfs(int i)
{
	visited[i]=true;
	for(int j=0;j<adj[i].size();j++)
	{
		if(!visited[adj[i][j]])
			dfs(adj[i][j]);
		dp[i]=max(dp[i],dp[adj[i][j]]+1);
	}
}
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL); 
	cin>>n;
	int m;
	cin>>m;
	while(m--)
	{
		int x,y;
		cin>>x>>y;
		adj[x].pb(y);
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(!visited[i])
			dfs(i);
	}
	for(int i=1;i<=n;i++)
		ans=max(ans,dp[i]);
	cout<<ans<<endl;
	return 0;	
}


Measured memory_bytes: 8320
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC return 0;
using namespace std;
unordered_map<int, bool> M;
int n, k, p, x;
int main() {
    DAU
    cin >> n >> k;
    for (int i = 1; i <= k; ++i) {
        cin >> p;
        for (int j = 1; j <= p; ++j)
            cin >> x, M[x] = true;
    }
    cout << n - M.size();
    PLEC
}


Measured memory_bytes: 3644
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

#n,k,*a = map(int,read().split())

n, = map(int,readline().split())
vw = [[0,0]]+[list(map(int,readline().split())) for _ in range(n)]

def merge(av,aw,bv,bw):
    la,lb = len(aw),len(bw)
    rv = [0]*(la+lb)
    rw = [0]*(la+lb)
    ia = ib = 0
    for i in range(la+lb):
        if ib==lb or (ia < la and aw[ia] < bw[ib]):
            rv[i] = av[ia]
            rw[i] = aw[ia]
            ia += 1
        else:
            rv[i] = bv[ib]
            rw[i] = bw[ib]
            ib += 1
    return rv,rw

A = 12
N = min(1<<A,n+1)
memov = [[] for _ in range(N)]
memow = [[] for _ in range(N)]

memov[0] = [0]
memow[0] = [0]

#from itertools import acumulate
for i in range(1,N):
    v,w = vw[i]
    m2v = [v+v1 for v1 in memov[i>>1]]
    m2w = [w+w1 for w1 in memow[i>>1]]
    memov[i],memow[i] = merge(memov[i>>1],memow[i>>1],m2v,m2w)

    #memov[i] = list(accumulate(memov[i],max))
    for j in range(1,len(memov[i])):
        memov[i][j] = max(memov[i][j-1],memov[i][j])
    
def solve(lstv,lstw,dv,dw,l):
    ans = 0
    idx = len(lstw)-1
    #print(lstv,lstw,dv,dw,l)
    for v,w in zip(dv,dw):
        while idx >= 0 and lstw[idx] + w > l:
            idx -= 1
        if idx >= 0 and v+lstv[idx] > ans:
            ans = v+lstv[idx]
    print(ans)        
 
 

q, = map(int,readline().split())
for _ in range(q):
    u,l = map(int,readline().split())

    dv = [0]
    dw = [0]
    while u >= N:
        v,w = vw[u]
        m2v = [v+v1 for v1 in dv]
        m2w = [w+w1 for w1 in dw]
        dv,dw = merge(dv,dw,m2v,m2w)
        u >>= 1
    
    #for j in range(1,len(dv)):
    #    dv[j] = max(dv[j-1],dv[j])
    
    solve(memov[u],memow[u],dv,dw,l)

#print(memov)
#print(memow)



Measured memory_bytes: 285492
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: u64,
    }
    let ans = match n % 10 {
        2 | 4 | 5 | 7 | 9 => "hon",
        0 | 1 | 6 | 8 => "pon",
        3 => "bon",
        _ => unreachable!(),
    };
    println!("{}", ans);
}


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

int main(){
  string s,t;
  cin >> s >> t;
  int a, b;
  cin >> a >> b;
  string u;
  cin >> u;
  if (s==u) --a;
  else --b;
  printf("%d %d\n", a, b);
  return 0;
}

Measured memory_bytes: 256
/*

This Submission is to determine how many 120/240 min const. delivery point there are.

//info
120 req. steps <= 5
*/
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define MOD 998244353LL
#define seg_size 262144*4
#define REP(a,b) for(long long a = 0;a < b;++a)

unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(min((double)1.0, max((double)-1.0, cosine)));
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		double now_length = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa - now_min >= eps || (abs(goa - now_min) <= eps && (abs(a[i] - a[starter]) - now_length) >= eps)) {
					now_min = goa;
					now_go = i;
					now_length = abs(a[i] - a[starter]);
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
int main() {
	int n;
	cin >> n;
	long long ans = 0;
	long long back = 1e9;
	REP(i, n-1) {
		long long a;
		cin >> a;
		ans += min(a, back);
		back = a;
	}
	ans += back;
	cout << ans << endl;
}

Measured memory_bytes: 256
using System;

namespace AOJ
{
    class Program
    {
        static void Main()
        {
            string[] line = Console.ReadLine().Split(' ');
            int x = int.Parse(line[0]);
            int y = int.Parse(line[1]);

            int area = x * y;
            int leng = 2 * (x + y);

            Console.WriteLine(area.ToString() + " " + leng.ToString());
        }
    }
}

Measured memory_bytes: 5600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define F first
#define S second
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
using ll = long long;
using pi = pair<int,int>;
int main()
{
  string s; cin >> s;
  int cnt = 0;
  int res = 0;
  rep(i,3) {
    if(s[i] == 'R') cnt++;
    else cnt = 0;
    chmax(res, cnt);
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define maxN 200005

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

}



int main()
{

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	{
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
#endif
	int n, x, t;
	cin >> n >> x >> t;
	cout << (((n + (x - 1)) / x)*t) << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
#define INF 2000000000
#define REP(i,b,n) for(int i = (b); i < n; i++)
#define rREP(i,b,n) for(int i = n; i >= b; i--)
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const string lowercase = "abcdefghijklmnopqrstuvwxyz";
const string uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int gcd(int a, int b){return b ? gcd(b, a % b): a;}

int main()
{
    int n, m;
    cin >> n >> m;
    ll a = pow(2,32)-1;
    REP(i,0,n){
        int k;
        cin >> k;

        ll ak = 0;
        REP(j,0,k){
            int ai;
            cin >> ai;
            ak |= (1 << (ai-1));
        }
        a &= ak;
    }
    int ans = 0;
    REP(i,0,m){
        if((a >> i) & 1) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;

int main(){
    ll N, cnt = 0; cin >> N;
    vector<ll> V(N); for(int i = 0; i < N; i++) cin >> V[i];
    for(int i = 0; i < N; i++)
        if((i+1)%2==1 && V[i]%2==1) cnt++;
    cout << cnt << endl;
} 

Measured memory_bytes: 3544
using System;
class Program
{    static void Main(String[] args){
  
    string[] str = Console.ReadLine().Split(' ');
    int a = int.Parse(str[0]);
    
    int b = int.Parse(str[1]);
    int c = int.Parse(str[2]);
    int ab = System.Math.Abs(a-b);
    int bc = System.Math.Abs(b-c);
    int ac = System.Math.Abs(a-c);
    int kara =0;
    if (ab<ac){
        kara =ab;
        ab = ac ;
        ac = kara;
        }
    if(ab<bc){
        kara  = ab;
        ab = bc;
        bc= kara ;
    }
    Console.WriteLine(bc + ac);
  }
}


Measured memory_bytes: 11092
import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Main {
	public static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int par1, int par2) {
			x = par1;
			y = par2;
		}

		@Override
		public int compareTo(pair p) {
			return x - p.x;
		}

		@Override
		public String toString() {
			return +x + " " + y;
		}

	}

	static long mod = (long) (1e9 + 7);

	public static long facn(long n, long x) {
		long ans = 1;
		for (int i = 1; i <= x; i++) {
			ans *= n;
			ans %= mod;
			n--;
		}
		long k = 1;
		long t = x;
		for (int i = 1; i <= t; i++) {
			k *= x;
			k %= mod;
			x--;
		}
//		BigInteger b = BigInteger.valueOf((k)).modInverse(BigInteger.valueOf((mod)));
		long b = modPow(k, mod - 2, mod);
		return ((b % mod) * ans) % mod;

	}

	public static long modInverse(long a, long m) {
		a = a % m;
		for (int x = 1; x < m; x++)
			if ((a * x) % m == 1)
				return x;
		return 1;
	}

	static long modPow(long a, long e, long mod) // O(log e)
	{
		a %= mod;
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res = (res * a) % mod;
			a = (a * a) % mod;
			e >>= 1;
		}
		return res % mod;
	}

	public static void bb(Serializable s) {
		System.out.println(55);
	}

	public static int dfs(int u) {
		vis[u] = true;
		rank[u] = rnk;
		int ans = 1;
		for (int v : adj[u])
			if (!vis[v])
				ans += dfs(v);

		return ans;
	}

	public static void dfsD(int u) {
		dist[u] = dst;
		for (int v : adj[u])
			if (dist[v] == -1)
				dfsD(v);
	}

	static ArrayList<Integer>[] adj, adj2;
	static int n, m, k, rnk, dst;
	static boolean[] vis;
	static int[] dist, rank;

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		n = sc.nextInt();
		pw.println((n+1)/2);
		pw.close();
	}

	public static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException, IOException {
			return br.ready();
		}

	}
}

Measured memory_bytes: 22484
h, w = map(int, input().split())

array = ["".join(list(input())) for x in range(h)]

array2 = list(map(list, zip(*array)))
array3 = []
for i in array2:
    array3.append("".join(i))

flag = True
for h_i in range(len(array)):
    for w_i in range(len(array[h_i]) - 2):
        if array[h_i][w_i:w_i + 3] == ".#.":
            if array3[w_i + 1][h_i:h_i + 3] == ".#." or array3[w_i + 1][h_i - 3:h_i] == ".#.":
                flag = False
                break
    if not flag:
        break

print("Yes" if flag else "No")


Measured memory_bytes: 3064
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

#ifdef __GNUC__
#define popcount __builtin_popcount
#elif _MSC_VER >= 1400
#include <intrin.h>
#define popcount __popcnt
#else
static inline int popcount(unsigned int b) {
	b = (b & 0x55555555) + (b >> 1 & 0x55555555);
	b = (b & 0x33333333) + (b >> 2 & 0x33333333);
	b = (b & 0x0F0F0F0F) + (b >> 4 & 0x0F0F0F0F);
	b += b >> 8;
	return (b + (b >> 16)) & 0x3F;
}
#endif

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		static const unsigned int INF = -1;
		int n = 0;
		cin >> n;
		if (n <= 0) return 0;
		vector<int> a[2];
		for (int j = 0; j < 2; ++j) {
			a[j] = vector<int>(n);
			for (int i = 0; i < n; ++i) {
				cin >> a[j][i];
			}
		}
		unsigned int dp[1 << 18][18];
		memset(dp, -1, sizeof(dp));
		for (int c = 0; c < n; ++c) {
			dp[1 << c][c] = 0;
		}
		for (int b = 1; b < (1 << n); ++b) {
			int digits = popcount(b);
			for (int c = 0; c < n; ++c) {
				if (dp[b][c] >= INF) continue;
				int p = a[(digits + c - 1) & 1][c];
				for (int d = 0; d < n; ++d) {
					int q = a[(digits + d) & 1][d];
					if (p > q) continue;
					if (b & (1 << d)) continue;
					unsigned int cost = dp[b][c] + popcount(b & ~((1 << d) - 1));
					int e = b | (1 << d);
					dp[e][d] = min(dp[e][d], cost);
				}
			}
		}
		unsigned int ans = INF;
		for (int c = 0; c < n; ++c) {
			ans = min(ans, dp[(1 << n) - 1][c]);
		}
		cout << (int)ans << endl;
	}
	return 0;
}


Measured memory_bytes: 18816
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

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

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 100005;

int n;
int a[N];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		a[x]++;
	}
	int res = 0;
	for (int i = 1; i < N - 1; i++) {
		res = max(res, a[i - 1] + a[i] + a[i + 1]);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

int N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
    cin>>N;
    vec x(N),y(N);
    rep(i,N) cin>>x[i]>>y[i];
    typedef pair<ll,ll> pa;
    vector<pa> dist(0);
    if(N==1||N==2){
        cout<<1<<endl;
        return 0;
    }
    rep(i,N){
        rep(j,i){ //j<iで十分
            if(x[i]<x[j]){
                dist.emplace_back(x[j]-x[i],y[j]-y[i]);
            }else if(x[i]>x[j]){
                dist.emplace_back(x[i]-x[j],y[i]-y[j]);
            }else{
                dist.emplace_back(0,abs(y[i]-y[j]));
            }
        }
    }
    sort(dist.begin(),dist.end());
    ll temp = 1,ans=1;
    pa lastp={-1,-1};
    for(auto p:dist){
        if(lastp == p){
            ++temp;
        }else{
            ans = max(ans,temp);
            temp = 1;
        }
        lastp = p;
    }
    cout<<N-ans<<endl;
}

Measured memory_bytes: 256
program main
	implicit none
	integer(8):: X,Y,A,B,C,N,i,j,t,k,D,E
	read *, X,Y
	
   	if(mod(Y,2)==1)then
   	print'(a)',"No"
   	stop
   	end if
   	if((2*X-Y/2)>=0.and.(Y/2-X)>=0)then
  	print'(a)',"Yes"
  	stop
  	else 
  	print'(a)',"No"
	stop
    end if
	
end program main

Measured memory_bytes: 2872
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s,t;cin>>s>>t;
    int i,j,k=INT_MAX,m=0,n;
    n = s.size()-t.size();
    for(i=0;i<=n;i++){
        m=0;
        for(j=0;j<t.size();j++){
            if(s[i+j]!=t[j]){
                m++;
            }
        }
        if(m<k)
            k=m;
    }
    cout<<k<<"\n";
  	return 0;
}


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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

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

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int l = input();
    vector< int > as(l);
    cin >> as;

    vector< int > dp(5);
    range(i, 0, l) {
        vector< int > ndp(5, inf);
        range(nxt, 0, 5) range(cur, 0, nxt + 1) {
            int cnt;
            if (nxt == 0 || nxt == 4) cnt = as[i];
            if (nxt == 1 || nxt == 3) cnt = (as[i] ? as[i] & 1 : 2);
            if (nxt == 2) cnt = ~as[i] & 1;

            chmin(ndp[nxt], dp[cur] + cnt);
        }

        dp = ndp;
    }

    cout << *whole(min_element, dp) << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


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

string s;
long long a, z;

int main(){
    cin >> s;
    a = s.find("A");

    while(s.find("Z", z)!=-1){
        z = s.find("Z", z)+1;
    }
    cout << (z-a);
    return 0;
}

Measured memory_bytes: 640
def main():
    inp = list(map(int, input().split()))
    n = inp[0]
    a = inp[1]
    b = inp[2]
    n_sum = 0
    res = 0
    for i in range(1, n+1):
        n_list = list(map(int, list(str(i))))
        n_sum = sum(n_list)
        if a <= n_sum and n_sum <= b:
            res += i
    print(res)
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt(), m = cin.nextInt();
        System.out.println(((n - m) * 100 + 1900 * m) * pow(2, m));
    }

    private static int pow(int a, int b) {
        int res = 1;
        for (int i = 0; i < b; ++i) {
            res *= a;
        }
        return res;
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    int K; cin >> K;
    int out=0;
    for(int i=0;i<N;i++){
        int h; cin >> h;
        if(h>=K) out++;
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x[5];
  	cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];
  	for (int i=0; i <5; i++)
      if (x[i] == 0){
        cout << i+1 << endl;
        break;
      }
  	return 0;
}

Measured memory_bytes: 3576
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

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

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

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

	for (int i = 0; i < N; i++)
	{
		int key = A[i];
		int j = i - 1;
		while (j >= 0 && A[j]>key)
		{
			A[j + 1] = A[j];
			j--;
			A[j + 1] = key;
		}
		for (int a = 0; a < N; a++)
		{
			if (a != N - 1) cout << A[a] << " ";
			else if (a == N - 1) cout << A[a] << endl;
		}
		
	}
}


Measured memory_bytes: 3092
N,M = map(int, input().split())
a = []
for i in range(N):
    a.append([int(j) for j in input().split()])
a = sorted(a)

num = 0
val = 0
for i in range(N):
    num += a[i][1]
    if num >= M:
        val += a[i][0] * (M - num + a[i][1])
        break
    else:
        val += a[i][0] * a[i][1]
print(val)

Measured memory_bytes: 22384
#include <iostream>
using namespace std;
int main(void){
    long long int a = 0;
    long long int b = 0;
    long long int c = 0;
    cin >> a >> b >> c;
    
    if (c - a - b < 0) {
        cout << "No" << endl;
        return 0;
    }
    
    if (4 * a * b < (c - a - b) * (c - a - b)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

const int M = 1e9+7, maxn = 2e5+5;
int mult(int a, int b) {
    return (1LL*a*b) % M;
}
void madd(int& a, int b) {
    a += b;
    if (a >= M) a -= M;
}
int modexp(int a, int b) {
    int res = 1;
    while (b) {
        if (b&1) res = mult(res,a);
        a = mult(a,a);
        b >>= 1;
    }
    return res;
}
int inverse(int x) {
    return modexp(x,M-2);
}
int n, m, k; 
int fac[maxn], ifac[maxn];

int comb(int n, int r) {
    assert(0 <= r && r <= n);
    int res = fac[n];
    res = mult(res,ifac[r]);
    res = mult(res,ifac[n-r]);
    return res;
}

int main() 
{
    cin >> n >> m >> k; 
    fac[0] = ifac[0] = 1;
    for (int i = 1; i < maxn; i++) {
        fac[i] = mult(fac[i-1],i);
        ifac[i] = inverse(fac[i]);
    }
    int ans = 0;
    for (int d = 1; d < m; d++) {
        int add = mult(d,mult(m-d,mult(n,n)));
        madd(ans,add);
    }
    for (int d = 1; d < n; d++) {
        int add = mult(d,mult(n-d,mult(m,m)));
        madd(ans,add);
    }
    ans = mult(ans,comb(m*n-2,k-2));
    cout << ans << '\n';
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
    ll x;
    cin >> x;
    
    for(ll a=200; a>-200; a--){
        for(ll b=-200; b<200; b++){
        	if((a*a*a*a*a-b*b*b*b*b) == x){
              cout << a << " " << b;
              return 0;
            }
        }
    }
    
    return 0;
}

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

int N;

void solve() {
    cin >> N;
    rep2(i, 10) {
        rep2(j, 10) {
            if(i*j == N) {
                cout << "Yes" << endl;
                return;
            }
        }
    }
    cout << "No" << endl;
    return; 
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
  int H,W;
  cin >> H >> W;
  vector<string> S(H);
  vector<string> A(H);


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

      int count = 0;
  for(int i=0;i<H;i++)
  {
    for(int j=0;j<W;j++)
    {
//      A[i] = '0';
      if(S[i][j] == '.')
      {
      count = 0;
      for(int p=-1;p<2;p++)
      {
      for(int q=-1;q<2;q++)
      {
        if(p==0 && q==0)
        {
        continue;
        }
      int ip = i+p;
      int jq = j+q;
      string str;
      if(ip < 0 ||jq < 0 || ip >= H || jq >= W)
      {
      continue;
      }
      if(S[ip][jq] == '#')
      {
      count += 1;
      }
      }
      }
      char hoge[10];
      hoge[0] = 48 + count;
      hoge[1] = 0;
      A[i] += hoge;
      }else{
      A[i] += '#';
      }
    }
  }

  for(int i=0;i<H;i++){
  cout << A[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)

int main(){
    ll n; cin >> n;
    ll fact = 1;
    rep1(i,n+1){
        fact *= i;
        fact = fact % mod;
    }
    cout << fact << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
    cin >> a.at(i);
  }
  int ans = 0;
  while(1){
    bool odd = false;
    rep(i,n){
      if(a.at(i)%2==1){
        odd = true;
      }
    }
    if(odd) break;
    ans++;
    rep(i,n){
      a.at(i) /= 2;
    }
  }

      
  cout << ans << endl;

}


Measured memory_bytes: 256
# Field
module Field
  def self.num_islands(grid)
    count = 0

    for i in 0...grid.size
      for j in 0...grid[i].size
        if grid[i][j] == 1
          count += 1
          dfs(grid, i, j)
        end
      end
    end

    count
  end

  def self.dfs(grid, i, j)
    return if grid[i][j] == 0
    grid[i][j] = 0

    search = [[1, 0], [0, 1], [-1, 0], [0, -1]]

    for k in 0...search.size
      l = i + search[k][0]
      m = j + search[k][1]
      dfs(grid, l, m) if 0 <= l && l < grid.size && 0 <= m && m < grid[l].size
    end
  end

  def self.graph(grid)
    grid.each do |row|
      puts row.join
    end
  end
end

loop do
  grid = []
  12.times do
    grid << gets.chomp.split('').map(&:to_i)
  end

  puts Field.num_islands(grid)

  break if gets.nil?
end

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

int main()
{
  vector<int> a(2);

  while(cin >> a[0] >> a[1]){
    if(a[0] == 0 && a[1] == 0) break;
    sort(a.begin(), a.end());
    cout << a[0] << " " << a[1] << endl;
  }

  return 0;

}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N,K;
    cin>>N>>K;
    string S;
    cin>>S;
    if(S.at(K-1)=='A')
    {
        S.at(K-1)='a';
    }else 
    if(S.at(K-1)=='B')
    {
        S.at(K-1)='b';
    }else 
    if(S.at(K-1)=='C')
    {
        S.at(K-1)='c';
    }
    cout<<S;
}

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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    string T; cin >> T;
    for(int i=0;i<T.size();i++){
        if(T[i]=='?'){
            T[i]='D';
        }
    }
    cout << T << endl;
}


Measured memory_bytes: 3724