akhauriyash/Code-Regression huggingface dataset:
/**Author:Sagor*/

#include<bits/stdc++.h>

using namespace std;
#define pri(n)          printf("%d\n",n)
#define prll(n)         printf("%lld\n",n)
#define prd(n)          printf("%lf\n",n)
#define scll(n)         scanf("%lld",&n)
#define sci(n)          scanf("%d",&n)
#define scd(n)          scanf("%lf",&n)
#define pi              acos(-1)
#define ll              long long
#define pb              push_back
#define vsort(v)        sort(v.begin(),v.end())
#define asort(n)        sort(ar,ar+n)
#define for1(i,n)       for(i=1;i<=n;i++)
#define for0(i,n)       for(i=0;i<n;i++)
#define mod             1000000007

void SieveOfEratosthenes(ll n)
{
	bool prime[n+1];
	ll i,p;
	memset(prime, true, sizeof(prime));
	for(i=4;i<=n;i+=2) prime[i]=false;

	for (p=3; p*p<=n; p+=2)
	{
		if (prime[p] == true)
		{
			for (i=p*p; i<=n; i += (2*p))
				prime[i] = false;
		}
	}
	cout<<"2\n3\n";
	ll cnt=2;
	for (p=5; p<=n; p+=6){
        if(prime[p]){
            cnt++;
            cout<<p<<"\n";
        }
        if(prime[p+2]){
            cnt++;
            cout<<p+2<<"\n";
        }

	}
}

int main()
{
    /**ios_base::sync_with_stdio(false);
    cin.tie(NULL);/**Dont't use scanf of printf*/
    ll t,a,b,x,n,i,j,len,m;
    string st;
    cin>>st;
    len=st.size();
    a=len/2;
    for(i=0,j=a+1;i<a;i++,j++){
        if(st[i]!=st[j]){
            cout<<"No\n";
            return 0;
        }
    }
    cout<<"Yes\n";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
        int W,H,x,y,r;
        scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

        if(x-r>=0 && x+r<=W && y+r<=H && y-r>=0){
                puts("Yes");
        } else {
                puts("No");
        }

        return 0;
}


Measured memory_bytes: 2100
import sys
import itertools
x, y = map(int, input().split())

turtle = [i for i in range(x+1)]
crane = [i for i in range(x+1)]

for t, c in itertools.product(turtle, crane):
    if (4*t + 2*c == y) and (t + c == x):
        print('Yes')
        sys.exit()

print('No')

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    int A, B, C;
    cin >> A >> B >> C;
    PRINT(max(0, C - (A - B)));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

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

	for (int j = 0; j < n; j++) {
		if (j == n - 1) {
			cout << a[0];
		}
		else {


			cout << a[n - j - 1] << " ";
		}
		
	}
	cout << endl;


			
	return 0;
}




Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define OK { cout << "OK" << endl; return 0; }
#define NG { cout << "NG" << endl; return 0; }
#define sz(v) ((int)(v).size())
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
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; }
template<class T>void out(T a){cout << a << endl;}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

#define SIZE 200005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}
ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}



ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,K;cin>>N>>K;
	vl A(N); vin(A);

	for(int i = K - 1; i < N - 1; i++){
		if(A[i - K + 1] >= A[i + 1]) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	
	

}

Measured memory_bytes: 4784
N = int(input())
A = list(map(int, input().split()))

num_of_minus = sum([a < 0 for a in A])
abs_A = [abs(a) for a in A]
ans = sum(abs_A)

if num_of_minus % 2 == 0:
    print(ans)
else:
    print(ans - 2 * min(abs_A))


Measured memory_bytes: 66464
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
const int INF = (int) 1e9;
#define MP make_pair

template <typename T> class dijkstra {
public:

    struct edge {
        T to;
        ll cost;
    };

    typedef pair<ll, T> P;
    map<T, vector<edge> > E;
    map<T, ll> d;

    void calc(T s) {
        priority_queue <P, vector<P>, greater<P> > que; 
        que.emplace(0LL, s);
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            T v = p.second;
            if (d[v] == 0 && v != s) d[v] = INF;
            if (d[v] < p.first) continue;

            for (auto& e : E[v]) {
                if (d[e.to] == 0 && e.to != s) d[e.to] = INF;
                if (d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.emplace(d[e.to], e.to);
                }
            }
        }
    }
};

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

    int n, m;
    cin >> n >> m;

    dijkstra<pii> ds;

    for (int i = 0; i < m; i++) {
        int p, q, c;
        cin >> p >> q >> c;
        ds.E[MP(p, c)].push_back({MP(q, c), 0});
        ds.E[MP(q, c)].push_back({MP(p, c), 0});
        ds.E[MP(p, c)].push_back({MP(p, -1), 0});
        ds.E[MP(q, c)].push_back({MP(q, -1), 0});
        ds.E[MP(p, -1)].push_back({MP(p, c), 1});
        ds.E[MP(q, -1)].push_back({MP(q, c), 1});
    }

    ds.calc(MP(1, -1));
    cout << (ds.d[MP(n, -1)] == 0 ? -1 : ds.d[MP(n, -1)]) << endl;
    return 0;
}



Measured memory_bytes: 101232
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


int main() {


	int X,a, b;

	cin >>X>> a >> b;

	cout << (X-a)%b << endl;

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


A = "dream"
B = "dreamer"
C = "erase"
D = "eraser"


def main():
    S = input()
    T = []
    i = 0
    while i <= len(S)-1:
        target = S[i:i+5]
        if target == A:
            i += len(A)
            T.append("A")
            continue
        if target == C:
            i += len(C)
            T.append("C")
            continue
        T.append(target[0])
        i += 1

    if T[0] != "A" and T[0] != "C":
        print("NO")
        return

    for i in range(1, len(T)):
        if T[i] == 'r':
            if T[i-1] == "e":
                if i >= 2 and T[i-2] == "A":
                    continue
                print('NO')
                return
            if T[i-1] == "C":
                continue
            print('NO')
            return

    print('YES')


main()


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

int main()
{
	int n;
	cin>>n;
	
	int c=0;
	for(int i=1;i<=n;i+=2){
		int v=0;
		for(int j=1;j<=i;j+=2){
			if(i%j==0) v++;
		}
		if(v==8) c++;
	}
	
	cout<<c<<endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.regex.Pattern;

// Java8
public class Main {
	Scanner sc = new Scanner(System.in);

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

	void run() throws Exception {
		sc.useDelimiter(Pattern.compile("(\\s|,)+"));
		while(true) {
			int n = sc.nextInt();
			if(n==0) break;
			int m = sc.nextInt();
			Edge[] es = new Edge[m];
			for(int i=0; i<m; i++) {
				int a = sc.nextInt();
				int b = sc.nextInt();
				int d = sc.nextInt() / 100 - 1;
				es[i] = new Edge(a, b, d);
			}
			Arrays.sort(es);
			UnionFind uf = new UnionFind(n);
			int cost = 0;
			for(Edge e : es) {
				if(!uf.same(e.a, e.b)) {
					uf.unite(e.a, e.b);
					cost += e.d;
				}
			}
			System.out.println(cost);
		}
	}
}
class Edge implements Comparable<Edge> {
	int a;
	int b;
	int d;
	Edge(int _a, int _b, int _d) {
		a = _a;
		b = _b;
		d = _d;
	}

	@Override
	public int compareTo(Edge o)
	{
		return Integer.compare(this.d, o.d);
	}
}
class UnionFind {
	int size;
	int[] pars;

	UnionFind(int n) {
		size = n;
		pars = new int[n];
		Arrays.fill(pars, -1);
	}

	int root(int x) {
		return pars[x]<0 ? x : (pars[x] = root(pars[x]));
	}

	boolean same(int x, int y) {
		return root(x) == root(y);
	}

	void unite(int x, int y) {
		pars[root(x)] = root(y);
	}
}


Measured memory_bytes: 43872
import sys
sys.setrecursionlimit(100000)
n = int(input())
ans = [[0 for _ in range(n)] for _ in range(n)]

def search(level, cand):
	if len(cand) == 1:
		return
	elif len(cand) == 2:
		ans[cand[0]][cand[1]] = level
		return
	even = [cand[i] for i in range(0, len(cand), 2)]
	odd = [cand[i] for i in range(1, len(cand), 2)]
	for e in even:
		for o in odd:
			ans[min(e, o)][max(e, o)] = level
	search(level+1, even)
	search(level+1, odd)
	return

search(1, list(range(n)))
for i in range(n-1):
	print(*ans[i][i+1:])

Measured memory_bytes: 6000
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数


//ライブラリ挿入


int main(){
    int N,T;
    cin>>N>>T;
    vector<int> A(N);
    REP(i,N) cin >> A[i];
    T/=T;
    int a_min=INF;
    int a_max=-INF;

    vector<int> A_MAX(N,0);
    REP(i,N){
        if(A[i]<a_min){
            a_min=A[i];
        }else if(A[i]==a_min){
        }
        A_MAX[i]=A[i]-a_min;
        a_max=max(a_max,A_MAX[i]);
    }
    int ans=0;
    REP(i,N){
        if(A_MAX[i]==a_max) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
string s[111]={"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
int main(){
    int n;
    string c;
    while(cin>>c){
        ll ans=0;
        int tmp1;
        for(int i=0; i<100; ++i){
            if(s[i]==c){
                tmp1=i;
                break;
            }
        }
        cout<<7-tmp1<<endl;
    }
  return 0;
}




Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn enum_primes(n: u64) -> Vec<u64>{
    let mut primes = vec![];
    let mut is_prime = vec![true; n as usize + 1];

    is_prime[0] = false;
    is_prime[1] = false;

    for i in 2..n as usize {
        if is_prime[i] == true {
            primes.push(i as u64);
            let mut j = 2;
            while (i*j) as u64 <= n {
                is_prime[i*j] = false;
                j += 1;
            }
        }
    }
    return primes;
}

fn main() {
    input!{
      n: usize,
    }
    let primes = enum_primes(55556);
    let mut ans = vec![];
    for i in 0..primes.len() {
        if primes[i] % 5 == 1 {
            ans.push(primes[i]);
        }
        if ans.len() == n {
            break;
        }
    }
    println!("{}", ans.iter().map(|v| v.to_string()).collect::<Vec<_>>().join(" "));
}


Measured memory_bytes: 4352
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
    int a, b;
    char op;
    while(1)
    {
        cin>>a>>op>>b;
        if(op=='+') cout<<a+b<<endl;
        else if(op=='-') cout<<a-b<<endl;
        else if(op=='*') cout<<a*b<<endl;
        else if(op=='/') cout<<a/b<<endl;
        else if(op=='?') break;
    }
    return 0;
}



Measured memory_bytes: 3112
N = int(input())

p = []
t = []

for n in range(N):
  a = int(input())
  p.append(a)

  t.append([list(map(int, input().split())) for k in range(a)])

ans = 0

for bit in range(1 << N):
  flag = True

  for i in range(N):
    if not (bit & (1 << i)):
      continue
    
    for x in t[i]:
      if x[1] == 1 and not (bit & (1 << (x[0] - 1))):
        flag = False
      if x[1] == 0 and (bit & (1 << (x[0] - 1))):
        flag = False

  if flag:
    count = 0
    for s in range(N):
      if bit & (1 << s):
        count += 1

    if count > ans:
      ans = count

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
    #include<chrono>
                
    using namespace std;
    using namespace std::chrono;
    typedef long long ll;
    typedef vector<int> vi;
    typedef pair<int,int> pi;
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
    #define F first
    #define S second
    #define PB push_back
    #define EB emplace_back
    #define MP make_pair
    #define REP(i,a,b) for(i=a;i<=b;i++)
    #define RAP(i,a,b) for(i=a;i>=b;i--)
    #define all(x) (x).begin(), (x).end()
    ll mod=1000000007;
    const int MX=0x3f3f3f3f;
    
    int main(){
        IOS;
        string s;
        cin>>s;
        int q,i;
        cin>>q;
        string b,e;
        int num=0,flag=0;
        while(q--){
            int t;
            cin>>t;
            if(t==1) num++,flag=(flag+1)%2;
            else{
                int f;
                char ch;
                cin>>f>>ch;
                if(f==1){
                    if(flag) e+=ch;
                    else b+=ch;
                }else{
                    if(flag) b+=ch;
                    else e+=ch;
                }
            }
        }
        if(flag) {
                reverse(all(e));
                reverse(all(s));
                cout<<e<<s<<b;
            }else{
                reverse(all(b));
                cout<<b<<s<<e;
            }
        return 0;
    }

 

Measured memory_bytes: 1040
#include <cstdio>
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <algorithm>
#define rep(i,n) for(int i=0; i<n; ++i)

using namespace std;
struct Doll{
    int H,R,L;
    bool operator<(const Doll& right)const {
        return H<right.H;
    }
    Doll(){
      H=0; R=0; L=0;
    }
};
int N, M;
int main(){
  while(cin >> N && N){
      vector<Doll> D;
      D.resize(200);
      rep(i,N){
        cin >> D[i+1].H >> D[i+1].R;
      }
      cin >> M;
      rep(i,M){
        cin >> D[N+i+1].H >> D[N+i+1].R;
      }
      sort(D.begin()+1, D.begin()+(N+M)+1);
      int ans = 0;
      for(int i=1; i<N+M+1; ++i){
        int m = 0;
        rep(j,i){
            if(D[j].R<D[i].R && D[j].H<D[i].H && m<D[j].L){
                m = D[j].L;
            }
        }
        D[i].L = m+1;
        ans = max(ans,D[i].L);
      }
      cout << ans << endl;
  }
}

Measured memory_bytes: 1200
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define MOD_Q 998244353
#define PI 3.14159265358979
#define ll long long
using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	int min = n > m ? m : n;

	for (int i = 0; i < n + m - min; i++) {
		printf("%d", min);
	}

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,zx,xc,i,j,ii,jj,C,f[200009],dp[200009],za,K,B,x;
bool bo[2200009];
pair <long long, long long> seg[2200009];
void upd(long long q, long long w, long long rr){
	if(bo[rr]==0){
		seg[rr].first=K;seg[rr].second=B;
		bo[rr]=1;
		return;
	}
	if(q==w){
		if(seg[rr].first*q+seg[rr].second>K*q+B){
			seg[rr].first=K;seg[rr].second=B;
		}
		return;
	}
	long long mid=(q+w)/2;
	bool qw=0,we=0;
	if(K*q+B<seg[rr].first*q+seg[rr].second) qw=1; else qw=0;
	if(K*mid+B<seg[rr].first*mid+seg[rr].second) we=1; else we=0;
	if(qw!=we){
		if(we==1){
			swap(seg[rr].first,K);
			swap(seg[rr].second,B);
		}
		upd(q,mid,rr*2);
	}else{
		if(we==1){
			swap(seg[rr].first,K);
			swap(seg[rr].second,B);
		}
		upd(mid+1,w,rr*2+1);
	}
}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>C;
	for(i=1; i<=a; i++) cin>>f[i];
	za=1;
	while(za<1000000) za*=2;
	dp[1]=0;
	K=-f[1]*2;
	B=f[1]*f[1]+dp[1];
	upd(1,za,1);
	for(i=2; i<=a; i++){
		dp[i]=999999999999999999LL;
		x=f[i];
		zx=za+x-1;
		while(zx!=0){
			if(bo[zx]!=0&&dp[i]>seg[zx].first*x+seg[zx].second) dp[i]=seg[zx].first*x+seg[zx].second;
			zx/=2;
		}
		dp[i]+=C+f[i]*f[i];
		K=-f[i]*2;
		B=f[i]*f[i]+dp[i];
		upd(1,za,1);
	}
	cout<<dp[a];
	return 0;
}

Measured memory_bytes: 20300
#include<stdio.h>
#define n 1000000
#define q 50000
int s[n],t[q];
int search(int,int);


int main(){

  int i;
  int num = 0;
  int slength,tlength;

  scanf("%d",&slength);//input
  for(i = 0 ; i < slength ; i++)
    {
      scanf("%d",&s[i]);
    }


  scanf("%d",&tlength);
  for(i = 0 ; i < tlength ; i++)
    {
      scanf("%d",&t[i]);
    }

  for(i = 0 ; i < tlength ; i++)
    {
      num += search(t[i],slength);


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

  return 0;

}

int search(int key,int length)
{
  int left = 0;
  int right = length;
  int mid;

  while(left < right)
    {
      mid = (left + right) / 2;
      if(key == s[mid])return 1;
      if(key > s[mid])left = mid +1;
      else if(key < s[mid])right = mid;
    }
  return 0;
}

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

A,B,C,X,Y = list(map(int,input().split()))
cost = A*X+B*Y
if X >= Y:
    maxXY = X
    maxAB = A
else:
    maxXY = Y
    maxAB = B
ans = cost
for xy in range(1,maxXY+1):
    nc =  2*C*xy +max(0,(X-xy))*A+max(0,(Y-xy))*B
    #print(nc,cost)
    if nc < cost: 
        ans = min(ans,nc)
print(ans)
    


Measured memory_bytes: 9184
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main()
{
	double tmp;
	while(cin >> tmp)
	{
		if(tmp<=48)cout << "light fly" << endl;
		else if(tmp<=51)cout << "fly" << endl;
		else if(tmp<=54)cout << "bantam" << endl;
		else if(tmp<=57)cout << "feather" << endl;
		else if(tmp<=60)cout << "light" << endl;
		else if(tmp<=64)cout << "light welter" << endl;
		else if(tmp<=69)cout << "welter" << endl;
		else if(tmp<=75)cout << "light middle" << endl;
		else if(tmp<=81)cout << "middle" << endl;
		else if(tmp<=91)cout << "light heavy" << endl;
		else cout << "heavy" << endl;
	}
	return 0;
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= (j);i--)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

int main()
{
    LL r,D,x;
    cin >> r >> D >> x;
    _for(i,0,10){
        x = x*r-D;
        x = max((LL)0,x);
        cout << x << endl;
    }

    return 0;
}


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

public class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in));
		String str = br.readLine();
		String z[] = str.split(" ",0);
		int a = (int)Integer.parseInt(z[0]);
		int b = (int)Integer.parseInt(z[1]);
		if(a <= 0 && b >=0){
			System.out.println("Zero");
		} else if(a > 0){
			System.out.println("Positive");
		}else if(b > 0){
			if(a < 0 && Math.abs(a)%2 == 1){
				System.out.println("Negative");
			} else if(a < 0 && Math.abs(a)%2 == 0){
				System.out.println("Positive");
			}
		} else {
			if(a < 0 && Math.abs(b-a)%2 == 0){
				System.out.println("Negative");
			} else if(a < 0 && Math.abs(b-a)%2 == 1){
				System.out.println("Positive");
			}
		}
	}
}

Measured memory_bytes: 7892
N, D = map(int, input().split())

points=[]

counts=0

for i in range(N):
    points.append(list(map(int, input().split())))


for i in range(N):
    for j in range(i+1, N):
        sum= 0
        for k in range(D):
            sum+= (points[i][k] - points[j][k])**2
        sum= pow(sum, (1/2))
        if(sum.is_integer()):
            counts+= 1

print(counts)


Measured memory_bytes: 3064
def find(n, y):
  for i in range(n+1):
    for j in range(n+1-i):
      if 10000 * i + 5000 * j + 1000 * (n - i - j) == y:
        return i, j, n-i-j
  return -1, -1, -1
N, Y = map(int, input().split())
i, j, k = find(N, Y)
print("{} {} {}".format(i, j, k))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
using namespace std;



int main()
{
	int n,hPre=0,h,ans=0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> h;
		if (hPre <= h)ans++;
		hPre = max(hPre, h);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
using namespace std;

int main ()
{
	long long a, b, c;
	cin >> a >> b >> c;
	int k;
	cin >> k;

	if (a < b) swap(a, b);
	if (a < c) swap(a, c);

	a <<= k;
	
	cout << a + b + c << endl;
	return 0;
}

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

int main(){
	// sengen
	int n,d;
	// nyuryoku
	cin >> n >> d;
	LL x[n],y[n];
	int count = 0;
	for(int i=0;i<n;i++){
		cin >> x[i] >> y[i];
		double dist;
		dist = sqrt(x[i]*x[i]+y[i]*y[i]);
		if(dist <= d){
			count++;
		}
	}
	// keisan
	cout << count << endl;
	// syutsuryoku
}

Measured memory_bytes: 6768
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 2019;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

ll PowMod(ll a, ll n){
	if(n < 0) return PowMod(PowMod(a, -n), MOD-2);
	if(n == 0) return 1;
	if(n == 1) return a;
	if(n%2 == 0) return PowMod(a*a%MOD, n/2);
	return a*PowMod(a*a%MOD, n/2)%MOD;
}

int main(void){
	string s;
	cin >> s;
	ll n = s.size();
	Vec cnt(MOD);
	Vec memo(n);

	ll r = 0;
	repr(i, n){
		ll k = s[i] - '0';
		r = (r + k * PowMod(10, n - 1 - i)) % MOD;
		cnt[r]++;
		memo[i] = r;
	}

	ll ans = 0;
	repr(i, n){
		if(i < n - 1) ans += cnt[memo[i + 1]];
		else ans += cnt[0];
		cnt[memo[i]]--;
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 5088
# coding: utf-8

def partition(A, p, r):
    x = A[r]
    i = p-1
    for j in range(p,r):
        if A[j] <= x:
            i += 1
            A[i],A[j] = A[j],A[i]
    A[i+1],A[r] = A[r],A[i+1]
    return i+1

def printA(A, pos):
    for i in range(len(A)):
        if i == pos:
            print("["+str(A[i])+"]",end="")
        else:
            print(str(A[i]),end="")
        if i == len(A)-1:
            print()
        else:
            print(" ",end="")

n = int(input().rstrip())
A = list(map(int,input().rstrip().split()))
ret = partition(A, 0, len(A)-1)
printA(A, ret)


Measured memory_bytes: 16400
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.function.BiFunction;

public class Main {
  Scanner sc = new Scanner(System.in);

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

  void run() {
    char[] str = sc.next().toCharArray();
    int n = str.length;
    int g = 0;
    int p = 0;
    for (int i = 0; i < n; ++i) {
      if (str[i] == 'g') {
        ++g;
      } else {
        ++p;
      }
    }
    int v = (g + p) / 2 - p;
    System.out.println(v);
  }

  int ni() {
    return Integer.parseInt(sc.next());
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }

  class BIT<T> {
    int n;
    ArrayList<T> bit;
    BiFunction<T, T, T> bif;

    BIT(int n, BiFunction<T, T, T> bif, T defaultValue) {
      this.n = n;
      bit = new ArrayList<>(n + 1);
      for (int i = 0; i < n + 1; ++i) {
        bit.add(defaultValue);
      }
      this.bif = bif;
    }

    void update(int i, T v) {
      for (int x = i; x <= n; x += x & -x) {
        bit.set(x, bif.apply(bit.get(x), v));
      }
    }

    T reduce(int i, T defaultValue) {
      T ret = defaultValue;
      for (int x = i; x > 0; x -= x & -x) {
        ret = bif.apply(ret, bit.get(x));
      }
      return ret;
    }
  }

}

Measured memory_bytes: 14108
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main(void){
	VI v(10);
	REP(i,10)cin>>v[i];
	SORT(v);
	REP(i,3)cout << v[9-i] << endl;
	return 0;
}

Measured memory_bytes: 0
N =int(input())
AB=[[str(j) for j in input().split()] for i in range(N)]
M=int(input())
CD=[[str(j) for j in input().split()] for i in range(M)]
ans = 0
for i in AB:
    if ans < AB.count(i) -CD.count(i) :
        ans = AB.count(i) -CD.count(i)
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main()
{
    int i,n,x;
    scanf(" %d",&n);
    for(i=1;i<=n;i++)
    {
        x=i;
        if(x%3==0){
             printf(" %d",i);
        }else if(x%10==3){
            printf(" %d",i);
        }else{ 
          while(x!=0) {
            x/=10;
           if(x%10 == 3) {
           printf(" %d",i);
           break;
           }
          }
    }
    }
    printf("\n");
    return 0;
}



Measured memory_bytes: 2764
#include <bits/stdc++.h>
#define int ll
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 199999;
const int MAX = 2e5 + 10;

void solve() {
    string s,t;
    cin>>s>>t;
    int ans=INF;
    for(int i=0;i<s.size();i++){
        int ji=0;
        if(i+t.size()>s.size()){
            break;
        }
        for(int j=0;j<t.size();j++){
            if(s[j+i]!=t[j]){
                ji++;
            }
        }
        ans=min(ans,ji);
    }
    cout<<ans;
}

signed main() {
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int _ = 1;
    //cin>>_;
    while (_--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3636
#include <cctype>
#include <string>
#include <iostream>

using namespace std;

int main()
{
	bool ok1 = false, ok2 = false, ok3 = false, ok4 = false; string S;

	cin >> S;

	ok1 = (S.size() >= 6);

	for (int i = 0; i < S.size(); i++)
	{
		ok2 = ok2 | isdigit(S[i]);
		ok3 = ok3 | isupper(S[i]);
		ok4 = ok4 | islower(S[i]);
	}

	cout << (ok1 & ok2 & ok3 & ok4 ? "VALID" : "INVALID") << endl;

	return 0;
}

Measured memory_bytes: 3224
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
#include <bitset>
using namespace std;

#define INF 1e9
#define LLINF 1e18
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

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


int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    vector<string> b(m);
    rep(i, m) {
        cin >> a.at(i) >> b.at(i);
    }
    vector<bool> acb(n, false);
    vector<int> c(n);
    int ac = 0, wa = 0;
    rep(i, m) {
        if (!acb.at(a.at(i) - 1) && b.at(i) == "AC") {
            acb.at(a.at(i) - 1) = true;
            ac++;
        }
        else if (!acb.at(a.at(i) - 1) && b.at(i) == "WA") {
            wa++;
        }
        if (b.at(i) == "WA") {
            c.at(a.at(i) - 1)++;
        }
    }
    rep(i, n) {
        if (!acb.at(i)) {
            wa -= c.at(i);
        }
    }
    cout << ac << " " << wa << endl;
}

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

int main()
{    
    int a,b;
    cin >> a >> b;

    int count = 0;
    int data = 0;

    if(a > b) {
        count = a;
        data = b;
    }else{
        count = b;
        data = a;
    }

    rep(i,count) cout << data;
    cout << endl;
}

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

int main()
{
	int X, Y;
	
	cin >> X >> Y;
	
	if((Y>=2*X)&&(Y<=4*X))
	{
		if(Y%2 == 0)
		{
			cout << "Yes";
		}
		else
		{
			cout << "No";
		}
	}
	else
	{
		cout << "No";
	}
	
	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define int long long
#define all(x) x.begin(),x.end()
using namespace std;
#define mod 1000000007
const int maxn=1000000;
void solve() {
    int x;
    cin >> x;
    int sum = 0;
    for (int j = 1; j <= x - 1; ++j) {
        map<int,int> mp;
        int n = j;
        while (n % 2 == 0) {
            mp[2]++;
            n /= 2;
        }
        for (int i = 3; i <= sqrt(n); i += 2) {
            while (n % i == 0) {
                mp[i]++;
                n /= i;
            }
        }
        if(n>2){
            mp[n]++;
        }
        int pd=1;
        for(auto i:mp){
            pd*=i.second+1;
        }
        sum+=pd;
    }
    cout << sum;

}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    vector<int> vec(3);
    cin>>vec.at(0)>>vec.at(1)>>vec.at(2);
    sort(vec.begin(),vec.end());
    cout<<vec.at(0)+vec.at(1)+10*vec.at(2)<<endl;;
}

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

int main()
{
	ull n;
	ull a[2][100];
	cin >> n;
	for(int i=0;i<n;i++) cin >> a[0][i];
	for(int i=0;i<n;i++) cin >> a[1][i];
	ull sum[2][100];
	sum[0][0] = a[0][0];
	sum[1][n-1] = a[1][n-1];
	for(int i=1;i<n;i++){
		sum[0][i] = sum[0][i-1] + a[0][i];
		sum[1][n-1-i] = sum[1][n-i] + a[1][n-1-i];
	}
	ull ans = 0;
	for(int i=0;i<n;i++)
		if(ans<sum[0][i]+sum[1][i])
			ans = sum[0][i]+sum[1][i];
	cout << ans << endl;
	return 0;
}

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

template<typename T, typename K> struct P{
    T a;
    K b;
};

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	string a, b;
	cin >> a >> b;
	if (a>b){
		cout << ">\n";
	}
	else if (a<b){
		cout << "<\n";
	}
	else{
		cout <<"=\n";
	}
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 256
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)	

int max(int a, int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main(void) {
	ll n, a, b;
	cin >> n >> a >> b;
	ll sum = a + b;

	ll ans = 0;

	ans = n / (a + b) * a;
	ll ren = n % (a + b);
	ans += min(ren, a);

	cout << ans << endl;
}


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

using namespace std;

int main(){
    int X;
    int Y;
    int j,k,sum,count;

    cin >> X >> Y;

    j = X;
    k = 0;

    for(int i = 0 ; i <= X ; i++){
        sum = j*2 + k*4;
        if(sum == Y){
            cout << "Yes" << endl;
            return 0;
        }
        j = j - 1;
        k = k + 1;
    }

    cout << "No" << endl;
    return 0;
}

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



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


	int A, B, C, D, N, M;
	string S, T;

	cin >> A >> B;

	cout << (A -1)/ B +1<< endl;
	return 0;
}



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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var S = cin.Read;
            var chars = S.ToCharArray();
            var a = (int)'A';
            var _chars = new char[S.Length];
            for (int i = 0; i < chars.Length; i++)
            {
                var c = chars[i];
                _chars[i] = (char)((((int)c - a) + N) % 26 + a);
            }
            var ans = new string(_chars);
            Console.WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

using namespace std;

int W, H;
int f[55][55];
const int dx[] = {-1, -1, -1, +0, +0, +1, +1, +1};
const int dy[] = {-1, +0, +1, -1, +1, -1, +0, +1};

void dfs(int x, int y)
{
    f[y][x] = 0;
    for (int i = 0; i < 8; i++) {
        int nx = x + dx[i];
        int ny = y + dy[i];
        if (0 <= nx && nx < W && 0 <= ny && ny < H &&
            f[ny][nx] == 1) {
            dfs(nx, ny);
        }
    }
}

int main()
{
    while (cin >> W >> H, W) {
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                cin >> f[i][j];
            }
        }

        int res = 0;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (f[i][j] == 1) {
                    res++;
                    dfs(j, i);
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}

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

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

int main() {

	int n;
	cin >> n;
	int arr[n];
	for (int i=0; i<n; i++) cin >> arr[i];
	
	int gc = gcd(arr[0], arr[1]);
	
	for (int i=2; i<n; i++) {
		gc = gcd(gc, arr[i]);
	}
	
	cout << gc << endl;
	
}


Measured memory_bytes: 640
# coding: utf-8
count = {}
while line = gets
  n = line.to_i
  if count.key?(n)
    count[n] +=  1
  else
    count[n] = 1
  end
end

# 最大値操作
max_array = []
max_value = 0
count.each do |k,v|
  if max_value < v
    max_value = v
    max_array.clear
    max_array << k
  elsif max_value == v
    max_array << k
  end
end

puts max_array.sort.join("\n")

Measured memory_bytes: 6084
n=int(input())
vlis=[int(i) for i in input().split()]

# 始点から5(6-1)番目の要素を2個ごとに取り出す
# a[:6:2] #[0, 2, 4]
# 7番目から終点までの要素を2個ごとに取り出す
# a[7::2] #[7, 9]
odd=vlis[0::2]
even=vlis[1::2]



import collections
odd_max=collections.Counter(odd).most_common(2)
even_max=collections.Counter(even).most_common(2)

# 一番多い数の数字が偶奇で同じ場合
if odd_max[0][0]==even_max[0][0]:
    # 全てが同じ数字の場合
    if len(odd_max)==1 and len(even_max)==1:
        print(int(len(vlis)/2))
    # 偶数列が全部同じ値だった時は奇数列は２番目多い数の数字に合わせる
    elif len(even_max)==1:
        print(len(vlis)-even_max[0][1]-odd_max[1][1])
    # 奇数列が全部同じ値だった時は偶数列は２番目多い数の数字に合わせる
    elif len(odd_max)==1:
        print(len(vlis)-odd_max[0][1]-even_max[1][1])
    else:

        if odd_max[0][1]+even_max[1][1]>=odd_max[1][1]+even_max[0][1]:
            print(len(vlis)-odd_max[0][1]-even_max[1][1])
        else:
            print(len(vlis)-odd_max[1][1]-even_max[0][1])
else:
    print(len(vlis)-odd_max[0][1]-even_max[0][1])

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

int main() {
int H, W;
while (true) {
cin >> H >> W;
if (H == 0 && W == 0) break;
for (int u = 0; u < H; u++) {
for (int i = 0; i < W; i++) {
cout << "#";
}
cout << endl;
}
cout << "\n";
}
return 0;
}

Measured memory_bytes: 3012
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
	public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		String S = sc.next();

		String regex = "A|T|C|G";
		Pattern p = Pattern.compile(regex);
		Matcher m = p.matcher(S);

		S = m.replaceAll("1");

		String regex2 = "[^1]";
		Pattern p2 = Pattern.compile(regex2);
		Matcher m2 = p2.matcher(S);

		S = m2.replaceAll("0");

		String[] ss = S.split("0");

		int res = 0;
		for (String sss : ss) {
			res = Math.max(sss.length(), res);
		}

		System.out.println(res);

	}
}


Measured memory_bytes: 21588
#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++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}

long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }



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

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

    if(R<1200)cout << "ABC" << endl;
    else if (R>=1200 && R<2800)cout << "ARC" << endl;
    else cout << "AGC" << endl;

}



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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K; cin >> N >> K;
    int ans = 0;
    rep(i, N){
        int x; cin >> x;
        ans += min(x, abs(K-x))*2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256