akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
struct node{int siz,mn,mx;};
node operator + (node a,node b){
	node ans={a.siz+b.siz,0,a.mx+b.mx};
	if(a.mn>b.mn) swap(a,b);
	if(a.mx>b.mn) ans.mn=ans.mx&1;
	else ans.mn=b.mn-a.mx;
	return ans;
}
const int inf = 1e9;
int n,val[2010];
node f[2010];
char s[2010];
vector<int> e[2010];
void dp(int x,int dad){
	f[x]={val[x],0,0};
	for(int v:e[x]) if(v!=dad){
		dp(v,x);
		f[v].mx+=f[v].siz;
		f[v].mn+=f[v].siz;
		f[x]=f[x]+f[v];
	}
}
int main(){
	read(n);
	cin>>s+1;
	for(int i=1;i<n;i++){
		int x,y;read(x);read(y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	for(int i=1;i<=n;i++) val[i]=s[i]-'0';
	int ans=inf;
	for(int i=1;i<=n;i++){
		dp(i,0);
		if(f[i].mn==0) ans=min(ans,f[i].mx>>1);
	}
	if(ans==inf) cout<<-1<<'\n';
	else cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 512
class Stack():
    def __init__(self):
        self.l = []

    def push(self, item):
        self.l.append(item)

    def pop(self):
        return self.l.pop(-1)



stack = Stack()
for s in input().split():
    if s in ('+', '-', '*'):
        a = stack.pop()
        b = stack.pop()
        if s == '+':
            stack.push(a+b)
        elif s == '-':
            stack.push(b-a)
        elif s=='*':
            stack.push(a*b)
    else:
        stack.push(int(s))

print(stack.pop())


Measured memory_bytes: 5596
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

ll calc(ll n) {
  if (n == 1) return 1;
  return 2ll * calc(n / 2) + 1;
}

int main() {
  ll h;
  cin >> h;
  cout << calc(h) << endl;
  return 0;
}

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

using ll = long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int A, B; cin >>A>>B;

    cout << max(0, A - B * 2) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define f first
long long const mod = 1000000007; 
#define inf 1000000000000000000
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod)+mod)%mod;}
inline ll mul(ll a, ll b){ return (((a%mod)*(b%mod))%mod+mod)%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<pair<ll,ll>, null_type,less<pair<ll,ll> >, rb_tree_tag,tree_order_statistics_node_update> */

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

ll power(ll x,ll y,ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
}

ll modInv(ll x)
{
    return power(x,mod-2,mod)%mod;
}

bool possible(ll mid,ll a[],ll n,ll k)
{
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        ans=ans+(a[i]/mid)+(a[i]%mid!=0);
        ans--;
    }
    if(ans>k)
        return false;
    return true;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
	
    ll n,k;
    cin>>n>>k;
    ll a[n];
    ll mn=1;
    ll mx=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        mx=max(mx,a[i]);
    }
    ll ans=0;
    while(mn<=mx)
    {
        ll mid=(mn+mx)/2;
        //cout<<mid<<endl;
        if(possible(mid,a,n,k))
        {
            ans=mid;
            mx=mid-1;
        }
        else
            mn=mid+1;
    } 
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5228
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n;
struct node{
	double x,y;
}k[102];
double dis(double a,double b){return sqrt(a*a+b*b);}
bool cmp(node a,node b){return a.x>b.x;}
bool cmp2(node a,node b){return a.x<b.x;}
bool cmp3(node a,node b){return a.y>b.y;}
bool cmp4(node a,node b){return a.y<b.y;}
bool cmp5(node a,node b){return dis(a.x,a.y)>dis(b.x,b.y);}
bool cmp6(node a,node b){return dis(a.x,a.y)<dis(b.x,b.y);}
double ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>k[i].x>>k[i].y;
	sort(k+1,k+n+1,cmp);
	for(int i=1;i<=n;i++){
		double xx=k[i].x,yy=k[i].y;
		for(int j=1;j<=n;j++)
			if(i!=j&&dis(xx+k[j].x,yy+k[j].y)>dis(xx,yy))
				xx+=k[j].x,yy+=k[j].y;
		ans=max(ans,dis(xx,yy));
	}
	sort(k+1,k+n+1,cmp2);
	for(int i=1;i<=n;i++){
		double xx=k[i].x,yy=k[i].y;
		for(int j=1;j<=n;j++)
			if(i!=j&&dis(xx+k[j].x,yy+k[j].y)>dis(xx,yy))
				xx+=k[j].x,yy+=k[j].y;
		ans=max(ans,dis(xx,yy));
	}
	sort(k+1,k+n+1,cmp3);
	for(int i=1;i<=n;i++){
		double xx=k[i].x,yy=k[i].y;
		for(int j=1;j<=n;j++)
			if(i!=j&&dis(xx+k[j].x,yy+k[j].y)>dis(xx,yy))
				xx+=k[j].x,yy+=k[j].y;
		ans=max(ans,dis(xx,yy));
	}
	sort(k+1,k+n+1,cmp4);
	for(int i=1;i<=n;i++){
		double xx=k[i].x,yy=k[i].y;
		for(int j=1;j<=n;j++)
			if(i!=j&&dis(xx+k[j].x,yy+k[j].y)>dis(xx,yy))
				xx+=k[j].x,yy+=k[j].y;
		ans=max(ans,dis(xx,yy));
	}
	sort(k+1,k+n+1,cmp5);
	for(int i=1;i<=n;i++){
		double xx=k[i].x,yy=k[i].y;
		for(int j=1;j<=n;j++)
			if(i!=j&&dis(xx+k[j].x,yy+k[j].y)>dis(xx,yy))
				xx+=k[j].x,yy+=k[j].y;
		ans=max(ans,dis(xx,yy));
	}
	sort(k+1,k+n+1,cmp6);
	for(int i=1;i<=n;i++){
		double xx=k[i].x,yy=k[i].y;
		for(int j=1;j<=n;j++)
			if(i!=j&&dis(xx+k[j].x,yy+k[j].y)>dis(xx,yy))
				xx+=k[j].x,yy+=k[j].y;
		ans=max(ans,dis(xx,yy));
	}
	srand(time(0));
	for(int i=1;i<=1000;i++){
		int pd[102],num=0;
		double xx=0,yy=0;
		memset(pd,0,sizeof(pd));
		for(int j=1;j<=n;j++){
			int op=rand()%n+1;
			while(pd[op])op=rand()%n+1;
			if(dis(xx+k[op].x,yy+k[op].y)>dis(xx,yy)) 
				xx+=k[op].x,yy+=k[op].y;
			pd[op]=1;
		}
		ans=max(ans,dis(xx,yy));
	}
	printf("%.15lf",ans);
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s int
	fmt.Scan(&s)

	m := map[int]bool{}
	for i := 1; i <= 1000000; i++ {
		if m[s] {
			fmt.Println(i)
			return
		}
		m[s] = true
		s = f(s)
	}
}

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


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

using namespace std ;
	
	
int main () {
	ios_base::sync_with_stdio; 
	cin.tie(0) ; 
	cout.tie(0)  ; 
	int k ; 
	int n ; 
	cin  >> k >> n ;
	vector <int> circle(n) ;   
	for ( int i = 0 ; i < n ; i ++ ) 
		cin >> circle[i] ;
	circle.push_back(circle[0] + k ) ; 
	
	int max = 0 ; 
	int idx ;  
	for ( int i = 0 ; i < n ; i ++ ) {
			if ( abs (circle[i] - circle[i+1]) > max ){
				max = abs (circle[i] - circle[i+1] ) ; 
				idx = i+1 ; 
			}
	}
	int sum = 0  ; 
	for( int i = 0 ; i < idx-1 ; i ++ )  {
		sum += abs(circle[i] - circle[i+1] ) ; 
	}
	//for (auto & r : circle )
	//	cout << r << endl ; 
	//cout << idx << endl ; 
	for ( int i = idx ; i < n ; i ++  ){
		sum+= abs(circle[i] - circle[i+1] ) ; 
	}
	cout << sum << endl ; 
	
}



Measured memory_bytes: 1792
num_of_songs = int(input())
all_list = [input().split() for _ in range(num_of_songs)]

song_name = input()
ind = 0

for i, tmp_list in enumerate(all_list):
  if tmp_list[0] == song_name:
    ind = i

if ind != len(all_list) - 1:
  print(sum([int(tmp_list[1]) for tmp_list in all_list[ind+1:]]))
else:
  print(0)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] X = new int[M];
        for (int i = 0; i < M; i++) {
            X[i] = sc.nextInt();
        }
        sc.close();

        if (N >= M) {
            System.out.println(0);
            System.exit(0);
        } else {
            Arrays.sort(X);
            int[] dist = new int[M - 1];
            for (int i = 0; i < M - 1; i++) {
                dist[i] = X[i + 1] - X[i];
            }
            Arrays.sort(dist);
            int sum = 0;
            for (int i = 0; i < M - N; i++) {
                sum += dist[i];
            }
            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 50948
#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(long i=0;i<(n);i++)
long gcd(long a,long b){
    return b?gcd(b,a%b):a;
}

long n,k,ans=-10000000000;
int main(){
    cin>>n>>k;
    if(k!=1){cout<<n-k<<endl;}
    else{cout<<0<<endl;}
    
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a[10000] = { 0 };
	int b[10000] = { 0 };
	int A = 0;
	for (int i = 0; i < 10000; i++){
		cin >> a[i];
		cin >> b[i];
		if (a[i] == 0 && b[i] == 0){
			for (int i = 0; i < 10000; i++){
				if (a[i]>b[i]){
					A = a[i];
					a[i] = b[i];
					b[i] = A;
				}
				if (a[i] == 0 && b[i] ==0){
					return 0;
				}
				else{
					cout << a[i] << " " << b[i] << endl;
				}
			}
		}
	}
}

Measured memory_bytes: 3064
#include <stdio.h>

int a[100001];
int pos[100000];

void swap(int *x, int *y) {
  int tmp = *x;
  *x = *y;
  *y = tmp;
}

int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[i]--;
    pos[a[i]] = i;
  }
  int k = n;
  while (q--) {
    int b;
    scanf("%d", &b);
    b--;
    a[k] = b;
    int tmp = pos[b];
    pos[b] = k;
    k = tmp;
  }
  for (int i = 0; i < n; i++) {
    if (i) putchar(' ');
    printf("%d", a[(i + k + 1) % (n + 1)] + 1);
  }
  putchar('\n');
}



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


int main(){
  vector<int> a(3);
  for(int i=0;i<3;i++){
    cin >> a.at(i);
  }
   int n ;
   cin >> n;
  if(abs(a.at(0)-a.at(2))<=n){
    cout <<"Yes" << endl;
  }
  else if(abs(a.at(0)-a.at(1))<=n&&abs(a.at(1)-a.at(2))<=n){
    cout <<"Yes" << endl;
  }
  else{
    cout <<"No" << endl;
  }
  }


Measured memory_bytes: 256
import math
N=math.factorial(int(input()))
i=2
ans=1
M=10**9+7
while i*i<=N:
    cnt=1
    while N%i==0:
        cnt+=1
        N//=i
    ans*=cnt
    i+=1
if N!=1:ans*=2
print(int(ans%M))

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<ll> V(N);
    for (int n = 0; n < N; ++n) {
        cin >> V[n];
    }
    ll Res = 0;
    for (int L = 0; L <= min(N, K); ++L) {
        for (int R = 0; R <= min(N-L, K-L); ++R) {
            ll Tmp = 0;
            priority_queue<ll> pq;
            for (int l = 0; l < L; ++l) {
                Tmp += V[l];
                pq.push(-V[l]);
            }
            for (int r = 0; r < R; ++r) {
                Tmp += V[N-1-r];
                pq.push(-V[N-1-r]);
            }
            for (int p = 0; p < K-L-R; ++p) {
                if (pq.empty()) break;
                ll v = pq.top(); pq.pop();
                if (v <= 0) break;
                Tmp += v;
            }
            if (Tmp > Res) Res = Tmp;
        }
    }
    cout << Res << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
	double w,h,x,y;
	cin>>w>>h>>x>>y;
	int s = 0;
	if(w == 2*x && h==2*y) s = 1;

	printf("%0.10lf %d\n",w*h/2,s);


	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		for(int i = 0; i < str.length(); i+=2) {
			System.out.print(str.charAt(i));
		}
		System.out.println();
	}

}


Measured memory_bytes: 29476
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
    int n, wcount = 0, bcount = 0, bbuf = 0, pre = 0;
    scanf("%d\n", &n);
    for (int i=0; i<n; i++) {
        int c = getchar();
        if (c == '.') {
            bcount += bbuf;
            bbuf = 0;
            if (bcount) wcount++;
            if (bcount < wcount) {
                pre += bcount;
                bcount = 0;
                wcount = 0;
            }
        } else {
            bbuf++;
        }
    }
    printf("%d\n", pre + min(bcount, wcount));
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
using namespace std;
vector<vector<int> > v(101);
int dp[101][2] = { 0 };
int n, t = 0;

void dfs(int a) {
	if (dp[a][0] == 0) { t++; dp[a][0] = t; }
	else { return; }
	for (int i = 0;i < v[a].size();i++) {
		if (dp[v[a][i]][0] == 0) {
			dfs(v[a][i]);
		}
	}
	if (dp[a][1] == 0) { t++; dp[a][1] = t; }
}

int main() {
	cin >> n;
	for (int i = 0; i < n;i++) {
		int u,k; cin >> u >> k;
		for (int j = 0; j < k;j++) {
			int x; cin >> x;
			v[u].push_back(x);
		}
	}
	for (int i = 1; i <= n;i++) {
		dfs(i);
	}
	for (int i = 1; i <= n;i++) {
		cout << i << ' ' << dp[i][0] << ' ' << dp[i][1] << endl;
	}
}

Measured memory_bytes: 3140
#include<stdio.h>

int main(){
  int a[10];
  int i,j,temp;
  for(i=0;i<10;i++)
    scanf("%d",&a[i]);
  for(i=0;i<10;i++){
    for(j=i+1;j<10;j++)
      if(a[j]>a[i]){
	temp = a[i];
	a[i] = a[j];
	a[j] = temp;
      }
  }
  for(i=0;i<3;i++)
    printf("%d\n",a[i]);

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath> 
#include <queue>
#include <functional>

using namespace std;
typedef long long ll;
//typedef pair<int, int> P;
//static const int dx[4] = {1, -1, 0, 0};
//static const int dy[4] = {0, 0, 1, -1};

//static const ll MOD = 1e+9 + 7;
//static const int MAX = 10001;


int main() {
    int N; cin >> N;
    int cnt = 0;
    int a;
    for (int i = 1; i <= N; i++) {
        cin >> a;
        if (a != i) 
            cnt++;
    }
    if (cnt <= 2) 
        cout << "YES\n";
    else 
        cout << "NO\n";

    
}


Measured memory_bytes: 256
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)*}
    };
}

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)*}
    };

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

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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        s: chars,
        t: chars
    }
    println!("{}", t.iter().chain(s.iter()).cloned().collect::<String>());
}


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

using namespace std;

typedef long long ll;

ll A[101010];
ll n, s, k, c;

void die() { cout << "NO" << endl; exit(0); }

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll i, t;
	
	cin >> n;
	
	for(i=0; i<n; i++){
		cin >> A[i];
		s += A[i];
	}
	
	k = s / (n * (n + 1) / 2);
	
	if(!k || s % k != 0) die();
	
	for(i=0; i<n; i++){
		t = A[i] + k - A[(i + 1) % n];
		if(t < 0 || t % n != 0) die();
		c += t / n;
	}
	
	if(c != k) die();
	
	cout << "YES" << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main (void){
    int n,a,b,c;
    scanf("%d",&n);

    a=n/100;
    n=n-(a*100);
    b=n/10;
    n=n-(b*10);
    c=n/1;

    if(a==7 || b==7 || c==7){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

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

int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    int ans=0;
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            ans=max(ans,abs(A[i]-A[j]));
        }
    }
    cout<<ans<<endl;
}


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

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

    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    
    int counter = 0;
    bool flg = true;
    while(flg){
        for(int i = 0; i < n; i++){
            if(0 == v[i] % 2){
                v[i] = v[i] / 2;
            }else{
                flg = false;
                break;
            }
        }
        if(flg) ++counter;
    }

    cout << counter << endl; 
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#include<iomanip>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<double,double>P;

ll gcd(ll a,ll b)
{
    if(a!=0 && b==0)
    {
        return a;
    }
    if(a%b==0)
    {
        return b;
    }
    else
    {
        return(gcd(b,a%b));
    }
    
}

ll lcm(ll a,ll b)
{
    return a*b/gcd(a,b);
}
int main()
{
    int n,m;
    cin>>n>>m;
    string s,t;
    cin>>s;
    cin>>t;
    ll d=gcd(n,m);
    ll l=lcm(n,m);
    ll nx=l/n;
    ll mx=l/m;
    bool flag=true;
    ll x=lcm(nx,mx);
    ll j=0;
    while(j<l)
    {
       // cout<<j<<" "<<j/nx<<" "<<j/mx<<endl;
        if(s[j/nx]!=t[j/mx])flag=false;
        j+=x;
    }
    if(flag)cout<<l;else cout<<-1;

    

        
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		if(a<b){
			System.out.println("a < b");
		}else if(a>b){
			System.out.println("a > b");
		}else{
			System.out.println("a == b");
		}

	}

}

Measured memory_bytes: 26076
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll i, n;
    cin >> n;
    ll a[n + 3];
    for (i = 0; i < n; i++)
        cin >> a[i];
    ll sum[n + 5];
    for (i = 0; i < n+2; i++)
        sum[i] = 0;

    for (i = 0; i < n; i++)
    {
        sum[a[i]]++;
    }
    ll ans = 0;

    for (i = 0; i < n+2; i++)
    { 
        ans =  ans + (sum[i]*(sum[i] - 1))/2;
    } 


    for(i=0; i<n; i++)
     { 
         ll ans1 = ans; 
         ans1 = ans1  - sum[a[i]]+ 1; 
         cout<<ans1<<"\n";
     }
    return (0);
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  ll a[n+1];
  REP(i,1,n+1) R a[i];
  ll b[n+1];
  mem(b);
  rrep(i,n+1) {
    if(!i) break;
    ll c=0;
    for(int j=i*2; j<=n; j+=i) c^=b[j];
    b[i]=c!=a[i];
  }
  REP(i,1,n+1) {
    ll c=0;
    for(int j=i; j<=n; j+=i) c^=b[j];
    if(a[i]!=c) {
      pr(-1);
      return;
    }
  }
  vector<ll> v;
  REP(i,1,n+1) if(b[i]) v.pb(i);
  pr(v.size());
  if(v.size()) PR(v,v.size());
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

typedef long long ll;
int main(){
	ll n,q;
	string S;
	cin>>n>>q>>S;

	ll array[n] = {0};
	ll acum[n] = {0};
	for (int i = 1; i < n; ++i)
		if(S[i]== 'C' && S[i-1] == 'A')
			array[i] = 1;
	
	for (int i = 1; i < n; ++i)
		acum[i] = acum[i-1] + array[i];

	while(q--){
		ll l,r;
		ll cont;
		cin>>l>>r;
		cont = acum[r-1] - acum[l-1];


		cout<<cont<<endl;
	}
}

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

typedef vector<int> vi;

int main()
{
	int n, i;
	double ans;
	scanf("%d", &n);
	vi nums(n);
	for (i = 0; i < n; i++)
		scanf("%d ", &nums[i]);
	sort(nums.begin(), nums.end());
	ans = nums[0];
	for (i = 1; i < n; i++) {
		ans = (ans + nums[i]) / 2.0;
	}
	printf("%.6lf\n", ans);
	return 0;
}

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

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

    map<int,bool> mp;
    for(int i=0;i<=1000;i++){
        mp[i] = false;
    }

    for(int i=0;i<N;i++){
        int start,end;
        cin>>start>>end;
        for(int j=start;j<end;j++){
            mp[j] = true;

        }
    }
    
    bool overlapp = false;

    for(int i=a;i<b;i++){
        if(mp[i] == true){
            overlapp = true;
        }
    }

    cout<<overlapp<<endl;
    
    


}


Measured memory_bytes: 3144
<?php

[$N, $K] = fscanf(STDIN, "%d%d");
const MOD = 1000000007;
$list = fscanf(STDIN, str_repeat("%d", $N));

$zero = 0;
$neg = [];
$pos = [];
foreach($list as $value){
    if($value < 0){
        $neg[] = $value;
    }elseif($value > 0){
        $pos[] = $value;
    }else{
        $zero++;
    }
}
$count_neg = count($neg);
$count_pos = count($pos);
sort($neg);
rsort($pos);
if($count_neg + $count_pos < $K){
    echo 0;
    exit;
}
$ans = 1;
if($count_pos === 0){
    if($K % 2 === 1){
        if($zero > 0){
            echo 0;
            exit;
        }
        for($i=$count_neg-1;$i>=($count_neg-$K);$i--){
            $ans *= $neg[$i];
            $ans %= MOD;
        }
    }else{
        for($i=0;$i<$K;$i++){
            $ans *= $neg[$i];
            $ans %= MOD;
        }
    }
}else{
    $neg_now = 0;
    $pos_now = 0;

    while($K > $pos){
        $ans *= $neg[$neg_now];
        $ans %= MOD;
        $neg_now++;
        $ans *= $neg[$neg_now];
        $ans %= MOD;
        $neg_now++;
        $K-=2;
    }
    while($K>0){
        if($K > 1 && isset($neg[$neg_now+1])){

            $tmp_neg = $neg[$neg_now] * $neg[$neg_now+1];
            if(isset($pos[$pos_now + 1])){
                $tmp_pos = $pos[$pos_now] * $pos[$pos_now + 1];
            }else{
                $tmp_pos = 0;
            }

            if($tmp_neg > $tmp_pos){

                $ans *= $neg[$neg_now];
                $ans %= MOD;
                $neg_now++;
                $ans *= $neg[$neg_now];
                $ans %= MOD;
                $neg_now++;
                $K-=2;
            }else{

                $ans *= $pos[$pos_now];
                $ans %= MOD;
                $pos_now++;
                $K--;
            }
        }else{
            if(isset($pos[$pos_now])){
                $ans *= $pos[$pos_now];
                $ans %= MOD;
                $pos_now++;
                $K--;
            }else{
                $ans *= $neg[$neg_now];
                $ans %= MOD;
                $neg_now++;
                $K--;
            }


        }


    }



}
if($ans >= MOD){
    $ans %= MOD;
}elseif($ans < 0){
    if($zero > 0){
        echo 0;
        exit;
    }
    while($ans < 0){
        $ans += MOD;
    }

}
echo $ans;


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

#define REP(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ALL(c) c.begin(), c.end()
#define SZ(c) (int) c.size()
#define DBG1(x) cout<<#x<<" = "<<x<<"\n"
#if USE_CP_REDIR
#define CP \
    freopen("input.txt","r", stdin); \
    freopen("output.txt","w", stdout);
#endif

using ll = long long;
const ll MOD = 1'000'000'007;
const int MN = 200'000;
int DP[MN+1];

ll mod_add(ll a, ll b)
{
    return (((a % MOD) + (b % MOD)) % MOD);
} 

ll go(ll n){
    if(n < 3) return 0;
    if(DP[n] != -1) return DP[n];
    ll ans = 1;
    for(ll i = n-3; i >= 3; i--){
        ans = mod_add(ans, go(i));
    }
    DP[n] = ans;
    return ans;
}

int main()
{
ios::sync_with_stdio(false);
#ifdef CP
    CP;
#endif
    int S;
    cin >> S;
    memset(DP, -1, sizeof DP);
    ll ans;
    ans = go(S);
    cout << ans << endl;
}

Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
typedef long long lint;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef unsigned long long ulint;
#define endl '\n'
#define fst first
#define sed second
#define pb push_back
#define mp make_pair
#define rint register int
#define SZ(x) (int((x).size()))
#define all(x) (x).begin(), (x).end()
#define reveal(x) cerr << #x << " = " << (x) << endl
#define rep(it, f, e) for (rint it = (f); it <= (e); ++it)
#define per(it, f, e) for (rint it = (f); it >= (e); --it)
#define repe(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)
const int MAXN = 2e5 + 20;
string s;
int dp[MAXN][2];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	cin >> s;
	int n = SZ(s);
	s = ' ' + s;
	memset(dp, -1, sizeof(dp));
	dp[0][0] = 0;
	rep (i, 0, n - 1) {
		rep (j, 0, 1) if (~dp[i][j]) {
			if (j == 0) {
				dp[i + 2][1] = max(dp[i + 2][1], dp[i][j] + 1);
				if (s[i] != s[i + 1]) dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + 1);
			} else {
				dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + 1);
				if (i + 2 <= n && (s[i - 1] != s[i + 1] || s[i] != s[i + 2])) {
					dp[i + 2][1] = max(dp[i + 2][1], dp[i][j] + 1);
				}
			}
		}
	}
	cout << max(dp[n][0], dp[n][1]) << endl;
	return 0;
}

Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll N; cin >> N;
    vector<ll> v(N); 
    ll minus_count = 0;
    ll abs_min = MOD;
    ll ans = 0;
    for (int i = 0; i < N; ++i) {
        cin >> v[i];
        if (abs_min > abs(v[i])) abs_min = abs(v[i]);
        if (v[i] < 0) ++minus_count;
        ans += abs(v[i]);
    }
    if (minus_count % 2 == 1) ans -= 2 * abs_min;
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdlib>
#include <iomanip>

using namespace std;
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;

// 入力
int N;
long long h[110000][3];

// DP テーブル
long long dp[110000][3];

int main() 
{
	int N, Q;
	long K;
	int A[110000];
	for (int i = 0; i < 110000; ++i) {
		A[i] = 0;
	}

	cin >> N >> K >> Q;
	int aIndex;
	for (int i = 0; i < Q; ++i) {
		cin >> aIndex;
		A[aIndex] = A[aIndex] + 1;
	}
	 
	// monndaisuugatokuttenyorimohikuiaabaaisubeteyes
	if (K > Q) {
		for (int i = 0; i < N; ++i) {
			cout << "Yes" << endl;
		}
		exit(0);
	}

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


Measured memory_bytes: 1024
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

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

        public void Solve(ConsoleInput cin)
        {

            var r = cin.Read;
            var g = cin.Read;
            var b = cin.Read;

            if (int.Parse(r + g + b) % 4 == 0)
            {
                Console.WriteLine("YES");
            }
            else { 
                Console.WriteLine("NO"); 
            }

        }
    }

    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: 11220
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    int n;cin>>n;
    vector<string>a(n);
    rep(i,n)cin>>a[i];
    sort(all(a));
    a.erase(unique(all(a)),a.end());
    cout<<a.size()<<endl;
}

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


int main() {
	string X;
	cin >> X;
	int ans = 100000;
	
	for (int i = 0; i <= X.size() - 3;i++) {
	
		int MIN=min(ans,abs(753-stoi(X.substr(i,3))));
		ans = abs(MIN);
	}
	cout<<ans<<endl;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rgi register int
#define ll long long
class fastin{
	private: int _ch,_f;
	public: inline fastin& operator>>(char&c) {c=getchar(); return *this;}
		template<typename _Tp> inline fastin& operator>>(_Tp&_x){
		_x=0; while(!isdigit(_ch)) _f|=(_ch==45),_ch=getchar();
		while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),_ch=getchar();
		_f&&(_x=-_x,_f=0); return *this;}
	fastin() {_ch=_f=0;}
}fin;
class fastout{
#define endl '\n'
	private: int _num[32],_head;
	public: inline fastout& operator<<(char c) {putchar(c); return *this;}
		template<typename _Tp> inline fastout& operator<<(_Tp _x){
		_Tp _k; if(_x==0) {putchar('0'); return *this;} if(_x<0) putchar('-'),_x=-_x;
		while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
		while(_head>0) putchar(_num[_head]),--_head; return *this;}
	fastout() {_head=0;}
}fout;
// ----------------------------
// #define int ll
using namespace std;
const int maxn=200004;
const int mod=998244353,inf=1000000007;

signed main()
{
	string s;
	cin>>s;
	for(rgi i=0;i<s.length();++i) if(s[i]=='?') s[i]='D';
	cout<<s;
	return 0;
}
// ----------------------------
// by imzzy


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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int d = Integer.parseInt(str[0]);
    int n = Integer.parseInt(str[1]);
    System.out.println(n==100?(int)Math.pow(100,d)*101:(int)Math.pow(100,d)*n);
  }
}

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

unsigned long long calc(unsigned long long n) {
	unsigned long long sunuke = 0;
	while (n) {
		sunuke += n % 10;
		n /= 10;
	}
	return sunuke;
}

bool check(unsigned long long n, unsigned long long base) {
	return n*calc(n+base) <= calc(n)*(n+base);
}

int main() {
	unsigned long long k;
	cin >> k;
	unsigned long long n = 0;
	unsigned long long base = 1;
	unsigned long long cnt = 0;
	while (1) {
		if (cnt >= k)return 0;
		if (!check(n + base, base))base *= 10;
		n += base;
		cout << n << endl;
		++cnt;
	}
	return 0;
}

Measured memory_bytes: 256
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
X=get_nsp.map(&:to_i)
def modinv(a,m)
    b=m
    u=1
    v=0
    while(b>0)
        t=a/b
        a-=t*b
        a,b=b,a
        u-=t*v
        u,v=v,u
    end
    u%=m
    u+=m if u<0
    return u
end
def f(a,x)
    a%=x
    return 1 if a.zero?
    return f(a,a.to_s(2).count("1"))+1
end
M=X.count(1)
x1=0
x2=0
b1=1
b2=1
beki1=array(N)
beki2=array(N)
r=0
k=0
X.reverse.each_with_index do|x_,i|
    x1+=x_*b1
    x1%=M+1
    beki1[i]=b1
    b1*=2
    b1%=M+1
    if (M-1).nonzero?
      x2+=x_*b2
      x2%=M-1
      beki2[i]=b2
      b2*=2
      b2%=M-1
    end
end
N.times do|i|
    if X[i]==1
        if (M-1).zero?
            puts 0
        else
          t=x2
          t-=beki2[N-1-i]
          t+=M-1 if t<0
          puts f(t,M-1)
        end
    else
      t=x1
      t+=beki1[N-1-i]
      t-=M+1 if t>M+1
      puts f(t,M+1)
    end
    #puts  "t:#{t*modinv(t,M)}"
end

Measured memory_bytes: 36860
N = int(input())
tc, xc, yc = 0, 0, 0
ans = 'Yes'
for i in range(N):
  t, x, y = map(int, input().split())
  if (t - tc - abs(x-xc) - abs(y-yc)) % 2 == 1 or t - tc - abs(x-xc) - abs(y-yc) < 0:
    ans = 'No'
    break
  tc, xc, yc = t, x, y
print(ans)

Measured memory_bytes: 9204
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int h, a;


signed main(){
    cin >> h >> a;
    cout << CEIL(h/a) << endl;
    return 0;
}

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

using namespace std;

class Prime {
// n以下の素数を列挙する
public:
  const int n;
  vector<bool> is_prime;
  vector<int> primes;
  Prime(int size) : n(size), is_prime(n, true) {
    is_prime[0] = false;
    is_prime[1] = false;
    for (int i = 2; i <= n; ++i) {
      if (!is_prime[i]) continue;
      primes.push_back(i);
      int tmp = 2*i;
      while (tmp <= n) {
        is_prime[tmp] = false;
        tmp += i;
      }
    }
  }

  bool check(int x) { return is_prime[x]; }
};

int dp[100001];

int main() {
  memset(dp, 0, sizeof(dp));
  Prime prime(100001);
  for (int i = 1; i <= 100000; ++i) {
    dp[i] = dp[i-1];
    if (i % 2 == 0) continue;
    if (!prime.check(i)) continue;
    if (!prime.check((i+1)/2)) continue;
    dp[i] += 1;
  }

  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int l, r;
    cin >> l >> r;
    cout << dp[r] - dp[l-1] << endl;
  }
}



Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>


#define REP(i,N) for(auto i = 0; i <N; i++)

using namespace std;
typedef long long ll;


int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}



int main() {
    
    ll N = lin();
    
    vector<ll> A,B,C;
    
    for(auto i = 0; i <N; i++){
        A.push_back(in());
    }
    for(auto i = 0; i <N; i++){
        B.push_back(in());
    }
    for(auto i = 0; i <N; i++){
        C.push_back(in());
    }
    
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    
    
    
    ll ans = 0;
    
    auto itc = upper_bound(B.begin(),B.end(),A[0]);
    
    for(auto b = itc; b != B.end();b++){
        
        ans += distance(upper_bound(C.begin(),C.end(),*b), C.end());
        
    }
    
    auto pre = itc;
    
    ll out = ans;

    for(auto i = 1; i<N; i++){
        ll a = A[i];
        auto itc = upper_bound(pre,B.end(),a);
        ll temp = 0;
        
        for(auto b = pre; b != itc;b++){
            
            temp += distance(upper_bound(C.begin(),C.end(),*b), C.end());
            
        }
        
        out += ans - temp;
        ans -=temp;
        pre = itc;
        
    }
    
    cout << out << endl;

    
    return 0;
    
    
}






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

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

    int n, k, q;
    cin >> n >> k >> q;

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

    for(int i = 0; i < n; i++){
        int t = k - q + Point[i];
        if(t <= 0){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }

    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> bosses(n + 1, 0);
    for (int i = 2; i <= n; i++) {
        int a;
        cin >> a;
        bosses[a]++;
    }
    for (int i = 1; i <= n; i++) {
        cout << bosses[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3976
n,k=map(int,input().split())
s=list(input())
l,tmpl,cnt0,tmp,flag1,flag2=[],0,0,s[0],0,0
if tmp=="0":cnt0+=1;flag1=1
for i in s:
    if i==tmp:tmpl+=1
    else:
        if i=="0":cnt0+=1
        tmp=i
        l.append(tmpl)
        tmpl=1
if tmp=="0":flag2=1
l.append(tmpl)
if cnt0<=k:print(n);exit()
ans=max(sum(l[:2*k]),sum(l[::-1][:2*k]))
suml,tmp=[0],0
if flag1==1:l=l[1:]
if flag2==1:l=l[:len(l)-1]
for i in l:
    tmp+=i
    suml.append(tmp)
for i in range((len(suml)-2*k-1)//2+1):
    tmp=suml[2*k+2*i+1]-suml[2*i]
    if tmp>ans:ans=tmp
print(ans)

Measured memory_bytes: 9040
n,y=map(int,input().split())
Y=y//1000
a,b,c=0,0,0
for i in range(Y//10+1):
    rest=n-i
    for j in range(rest+1):
        k=rest-j
        if 10*i+5*j+k==Y:
            print(i,j,k)
            exit()
            
print('-1 '*3) 


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

int main() {
  vector<int> s(3);
  for (int i = 0; i < 3; i++) {
    cin >> s[i];
  }
  sort(s.begin(), s.end(), greater<int>());
  cout << s[0] * 10 + s[1] + s[2] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char a[200005];
    int n,i,s,l,r;
    scanf("%s",a);
    n=strlen(a);
    for(i=0;i<n;i++)
    {
        if(a[i]=='A')
        {
            l=i;
            break;
        }
    }
    for(i=n-1;i>=0;i--)
    {
        if(a[i]=='Z')
        {
            r=i;
            break;
        }
    }
    printf("%d\n",r-l+1);
    return 0;
}


Measured memory_bytes: 384
'''
Created on 2020/08/20

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  S=list(pin().split())
  T="".join(S)
  if T.count("1")==1 and T.count("9")==1 and T.count("7")==1 and T.count("4")==1:
    print("YES")
    return 
  print("NO")
  return 

main()

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

int main(){
  int N;
  cin >> N;
  string S,T;
  cin >> S >> T;
  
  for(int i=0;i<N*2;i++){
    if(i%2==0){
      cout << S.at(i/2);
    }
    else if(i%2==1){
      cout << T.at(i/2);
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}


/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



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

	int temp;
	bool ans = true;

	for (int i = 0; i <= N; i++)
	{
		for (int j = 0; j <= N-i; j++)
		{
			temp = 10000 * i + 5000 * j + 1000 * (N - i - j);
			if (temp == Y)
			{
				ans = false;
				cout << i << " " << j << " " << N - i - j << endl;
				break;
			}
		}
		if (temp == Y) break;
	}

	if (ans) cout << "-1 -1 -1" << endl;

	return 0;
}


Measured memory_bytes: 256
//問３ 2717 佐久間　翼
import java.util.Scanner;
public class Main{
    
    public void solve(){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        for(int cnt=0;cnt<N;cnt++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            int b = sc.nextInt();
            int p = sc.nextInt();
            int gokei=x*b+y*p;
            if(b<5){
                b=5;
            }
            if(p<2){
                p=2;
            }
            int waribikigo=(x*b+y*p)*8/10;
            if(gokei>=waribikigo){
                System.out.println(waribikigo);
            }else{
                System.out.println(gokei);
            }
        }
    }
    public static void main(String[]args){
        Main obj = new Main();
        obj.solve();
    }
}

Measured memory_bytes: 23436
n , k = map(int, input().split())
a = list(map(int, input().split()))

# dp[k+1]=False
dp = [False]*(k+1)

for i in range(1,k+1):
  for j in range(n):
    if i-a[j]<0:
      break
    if dp[i-a[j]]==False:
      dp[i]=True
      break
if dp[k]==True:
  print("First")
else:
  print("Second")
      

Measured memory_bytes: 43116