akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    ll n;
    ll a[5];
    cin >> n;
    ll m = 1000000000000000;
    rep(i,5){
        cin >> a[i];
        m = min(m,a[i]);
    }


    ll ans = n/m + 4;
    if(n%m!=0)ans++;


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


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void)
{
	int i, n, s[1000];
	double sum, ave, squ, sig, bun;
	while(1) {
    	scanf("%d", &n);
    	if (n == 0)
    		break;
    	sum = 0, ave = 0, squ = 0, sig = 0, bun = 0;
    	for (i = 0; i < n; i++) {
    		scanf("%d", &s[i]);
    		sum += s[i];
    	}
    	ave = sum / n;
    	
    	for (i = 0; i < n; i++) {
		squ = (s[i] - ave) * (s[i] - ave);
		sig += squ;
    	}
    	bun = sig / n;
    	
    	printf("%f\n", sqrt(bun));
	}
	return 0;
}



Measured memory_bytes: 2052
H,W = list(map(int,input().split()))
histo = {}
for i in range(H):
    for c in input():
        histo[c] = histo.get(c,0) + 1
ls = [0,0,0]
for v in histo.values():
    ls[0] += v//4
    ls[1] += (v%4)//2
    ls[2] += v%2
ans = [(H//2)*(W//2), (H//2)*(W%2)+(H%2)*(W//2), (H%2)*(W%2)]
a = "No"
if ls[0]>=ans[0]:
    ls[1] += (ls[0]-ans[0])*2
    ls[0] = ans[0]
    if ls==ans:
        a = "Yes"
print(a)

Measured memory_bytes: 3064
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		String[] s = new String[k];
		Arrays.setAll(s, i -> sc.next());
		loop:
		for(int i=n; ; i++){
			for(int j=0; j<s.length; j++){
				if(String.valueOf(i).contains(s[j])){
					continue loop;
				}
			}
			System.out.println(i);
			break;
		}
	}
}


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

int sfind(string s, string t) {
    int a = s.find(t);
    if (a >= 0) return 1;
    else return -1;
}

int main() {
    string s;
    cin >> s;
    string ans = "No";
    int nf = sfind(s, "N");
    int sf = sfind(s, "S");
    int ef = sfind(s, "E");
    int wf = sfind(s, "W");
    if (nf * sf > 0 && ef * wf > 0) ans = "Yes";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define rep(x, a, b) for(int x = (a); x <= (b); ++x)
#define rop(x, a, b) for(int x = (a); x < (b); ++x)
#define per(x, a, b) for(int x = (a); x >= (b); --x)
using namespace std;
typedef long long LL;
typedef double DB;
int ft[100005][20], as;
struct node {
	int vs[100005];
	int hd[100005], vr[200005], nt[200005], tt, rt;
	void push(int x, int y) {
		vr[++tt] = y; nt[tt] = hd[x]; hd[x] = tt;
	}
	void dfs(int nw, int en) {
		for(int i = hd[nw]; i; i = nt[i]) {
			if(vr[i] == en) continue;
			dfs(vr[i], nw);
			rop(j, 0, 20) ft[nw][j] += ft[vr[i]][j];
		}
		int x = 0;
		per(j, 19, 0) {
			if(ft[nw][j] > 1) break;
			if(!ft[nw][j]) x = j;
		}
		as = max(as, x);
		rep(j, 0, x) ft[nw][j] = 0;
		ft[nw][x] = 1;
		return;
	}
}T;
int n, x, y;
int main() {
	scanf("%d", &n);
	rop(i, 1, n) {
		scanf("%d%d", &x, &y);
		T.push(x, y);
		T.push(y, x);
	}
	T.dfs(1, 0);
	cout << as << endl; 
	return 0;
}


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

template <typename T>
class BIT{
public:
    vector<T> data;
    int n;
    BIT(){}
    BIT(int n_){
        n = n_;
        data.assign(n, T(0));
    }
    // v[a] += w
    void add(int a, T w){
        for (int x = a; x < n; x |= x + 1) data[x] = (data[x] + w + MOD) % MOD;
    }
    // sum of v[i] for i in [0, a)
    T sum(int a){
        T ret = 0;
        for (int x = a - 1; x >= 0; x = (x & (x + 1)) - 1) {
            ret = (ret + data[x]) % MOD;
        }
        return ret;
    }
};

#define MAX_N 100010
ll S[MAX_N];
int N;

int main(){
    ll A, B;
    cin >> N >> A >> B;
    if(B < A) swap(A, B);

    S[0] = -B;
    for(int i=1;i<=N;i++){
        cin >> S[i];
    }

    for(int i=1;i+2<=N;i++){
        if (S[i+2] < S[i] + A){
            cout << 0 << endl;
            return 0;
        }
    }

    BIT<ll> bit(N+1);
    bit.add(0, 1);

    int l = 0, r = 1;
    for(int i=1;i<=N;i++){
        while(S[r] + B <= S[i]) r++;
        bit.add(i, bit.sum(r));
        if(S[i] < S[i-1] + A){
            while(l < i - 1){
                bit.add(l, -bit.sum(l+1));
                l++;
            }
            // assert(i - 2 >= 0);
            // bit.add(i-2, -bit.sum(i-1));
        }
    }

    cout << bit.sum(N+1) << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
int main(void){
	int n,m;
	scanf("%d %d",&n,&m);
	int a[51],b[51],i,j;
	for(i=0;i<m;i++){scanf("%d %d",&a[i],&b[i]);}
	int idx[51];
	for(i=0;i<n;i++){
		idx[i]=0;
		for(j=0;j<m;j++){
			if(a[j]==i+1){idx[i]++;}
			if(b[j]==i+1){idx[i]++;}
		}
		printf("%d\n",idx[i]);
	}
	return 0;
}

Measured memory_bytes: 128
def main():
    n,m,l = map(int,input().split())
    A = []
    B = []
    for _ in range(n):
        A.append(list(map(int,input().split())))
    for _ in range(m):
        B.append(list(map(int,input().split())))
    for i in range(n):
        C = []
        for j in range(l):
            ij = 0
            for k in range(m):
                ij += A[i][k]*B[k][j]
            C.append(ij)
        print (' '.join(map(str,C)))

if __name__ == '__main__':
    main()




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

int main() {
	int n, pre, pl = 0;
	cin >> n >> pre;
	if (pre) {
		cout << "-1\n";
		return 0;
	}
	ll ans = 0;
	for (int i = 1; i < n; i++) {
		int temp;
		scanf("%d",&temp);
		if (temp > pre + 1) {
			cout << "-1\n";
			return 0;
		} else if (temp > pre) {
			ans++;
		} else {
			ans += temp;
		}
		pre = temp;
	}
	cout << ans << endl;
	return 0;
}

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

signed main()
{
 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 string s,t;
 cin>>s>>t;
 int n = t.size();
 int res = 0;
 for(int i = 0;i < n;i++)
 {
   if(t[i] != s[i])
   {
     res++;
   }
 }
 cout<<res<<"\n";



  return 0;
}


Measured memory_bytes: 3780
def dfs(i, cost, skill):
    if i == n:
        if min(skill) >= x:
            return cost
        else:
            return INF
    updated_skill = [0] * m
    updated_cost = cost + C[i]
    for j in range(m):
        updated_skill[j] = skill[j] + A[i][j]
    return min(dfs(i + 1, cost, skill), dfs(i + 1, updated_cost, updated_skill))
    # return dfs(i + 1, updated_cost, updated_skill)
    # return dfs(i + 1, cost, skill)

    # skill1 = A[1][0] + A[2][0] + A[3][0]
    # skill2 = A[1][1] + A[2][1] + A[3][1]


    # return xxxxxxxxxxxxx


INF = float('inf')

n, m, x = map(int, input().split())
C = []
A = []

# n = 3
# m = 3
# x = 10
# C = [60, 70, 50]
# A = [
#     [2, 2, 4], [8, 7, 9], [2, 3, 9]
# ]

for _ in range(n):
    li = list(map(int, input().split()))
    C.append(li[0])
    A.append(li[1:])
# print(C)
# print(A)

min_cost = dfs(0, 0, [0] * m)
if min_cost == INF:
    print('-1')
else:
    print(min_cost)


Measured memory_bytes: 68680
using System;

namespace abc162
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var total = 0L;
            for (int i = 1; i <= n; ++i)
            {
                if (i % 3 > 0 && i % 5 > 0)
                {
                    total += i;
                }
            }
            Console.WriteLine(total);
        }
    }
}


Measured memory_bytes: 27468
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using P = pair<int,int>;
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 main()
{
    int K,A,B;
    cin >> K >> A >> B;

    string str = "NG";   
    for(int i = A; i < B+1 ; i++){
        if(i%K == 0){
            str = "OK";
            break;
        }
    }


    cout << str << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;

template <class T>
class LazySegmentTree{
private:
    int n;
    vector<T> dat;
    vector<pair<T, bool>> lazy;
    T def;

    void _eval(int k, int l, int r){
        if(lazy[k].second){
            dat[k] = lazy[k].first;
            if(1<r-l){
                lazy[2*k+1] = lazy[k];
                lazy[2*k+2] = lazy[k];
            }
            lazy[k].second = false;
        }
    }

    T _query(int a, int b, int k, int l, int r){
        // [a, b), [l, r)
        if(r<=a or b<=l) return def;
        _eval(k, l, r);
        if(a<=l and r<=b) return dat[k];
        else{
            T c1 = _query(a, b, 2*k+1, l, (l+r)/2);
            T c2 = _query(a, b, 2*k+2, (l+r)/2, r);
            return min(c1, c2);
        }
    }

    void _change(int a, int b, T x, int k, int l, int r){
        _eval(k, l, r);
        if(b<=l or r<=a) return;
        else if(a<=l and r<=b){
            lazy[k].first = x;
            lazy[k].second = true;
            _eval(k, l, r);
        } else {
            _change(a, b, x, 2*k+1, l, (l+r)/2);
            _change(a, b, x, 2*k+2, (l+r)/2, r);
            dat[k] = min(dat[2*k+1], dat[2*k+2]);
        }
    }

public:
    // [a, b)
    T query(int a, int b){
        return _query(a, b, 0, 0, n);
    }

    void change(int a, int b, T x){
        _change(a, b, x, 0, 0, n);
    }

    T operator[](int i){
        return dat[i+n-1];
    }

    LazySegmentTree(size_t _n, T _def)
            : def(_def){
        n = 1;
        while(n < _n){
            n *= 2;
        }
        dat.assign(2*n-1, def);
        lazy.assign(2*n-1, {def, false});
    }

    LazySegmentTree(size_t _n, T _def, vector<T>& _v)
            : def(_def){
        n = 1;
        while(n < _n){
            n *= 2;
        }
        dat.assign(2*n-1, def);
        lazy.assign(2*n-1, {def, false});
        for(int i=0;i<_n;++i) dat[n-1+i] = _v[i];
        for(int i=n-2;0<=i;--i) dat[i] = min(dat[2*i+1], dat[2*i+2]);
    }
};

class Task{
public:
    void solve(istream& in, ostream& out){
        int N, tt;
        in>>N>>tt;
        LazySegmentTree<int> ldat(N, INT_MAX);
        while(tt--){
            int t;
            in>>t;
            if(t){
                int l, r;
                in>>l>>r;
                out<<ldat.query(l, r+1)<<'\n';
            }else{
                int l, r, x;
                in>>l>>r>>x;
                ldat.change(l, r+1, x);
            }
        }
    }
};

int main(){
    Task solver;
    istream& in(cin);
    ostream& out(cout);
    ios::sync_with_stdio(false);
    in.tie(nullptr), out.tie(nullptr);
    solver.solve(in, out);
    return 0;
}



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

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

#define fst first
#define snd second
#define pb push_back

const int maxn=300005,maxm=106;
const double pi=acos(-1.0);
const ll mod=1000000007;
const double eps=1e-6;

int n,T;

char c[55];

int main()
{
	int i,j,k,l;
	scanf("%s",c);
	if(c[1]=='R') c[1]='B';
	else c[1]='R';
	printf("%s",c);
    return 0;
}


Measured memory_bytes: 3824
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll X, Y;
    cin >> X >> Y;

    cout << X + Y / 2 << endl;

    return 0;
}

Measured memory_bytes: 3544
#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 >= 0 && y+r <= H){


printf("Yes\n");


}
else{

printf("No\n");

}

return 0;


}

Measured memory_bytes: 584
#include<bits/stdc++.h>
#define ff(i,x,y) for(int i=x;i<=y;i++)
#define fs(i,x,y) for(int i=x;i>=y;i--)
using namespace std;
typedef long long ll;
int n,mes[200010];
ll ans;
int main()
{
    scanf("%d",&n);
    ff(i,1,n)
    scanf("%d",&mes[i]);
    int pan=1,now=mes[n];
    fs(i,n,2)
    {
        if(mes[i]==mes[i-1]+1);
        else if(mes[i]<=mes[i-1])
        {
            ans+=now;
            now=mes[i-1];
        }
        else
        pan=0;
        if(mes[i]>=i)
            pan=0;
    }
    ans+=now;
    if(mes[1]!=0)
        pan=0;
    if(pan==0)
        printf("-1");
    else
        printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 1152
import java.util.*;

public class Main {
    public static void main(String[] args) {
        solve(new Scanner(System.in));
//        solve(new Scanner(ex));
    }

//    private static final String ex = "gpg";
    private static final String ex = "ggppgggpgg";

    private static void solve(Scanner scanner) {
        char[] s = scanner.nextLine().toCharArray();

        int parCount = 0;
        for (char value : s) {
            if (value == 'p') parCount++;
        }

        int result = -parCount + s.length / 2;

        System.out.println(result);
    }
}

Measured memory_bytes: 27604
n = int(input())

hanako_score, taro_score = 0, 0

for i in range(n):
    card_list = [x for x in input().split()]
    sorted_card_list = sorted(card_list)
    
    if card_list[0] == card_list[1]:
        hanako_score += 1
        taro_score += 1
    
    elif card_list[0] == sorted_card_list[0]:
        hanako_score += 3
    
    else:
        taro_score += 3
        
print('{} {}'.format(taro_score, hanako_score))


Measured memory_bytes: 5600
#include<iostream>
#include<vector>
#include<string>
#include<utility>
#include<algorithm>
#include<stack>
#include<queue>

using namespace std;

typedef pair<int, int> P;

int R, G, B, N;

int main() {
	cin >> R >> G >> B >> N;
	int ans = 0;
	int k;
	for (int i = 0; i <= N / R; i++) {
		for (int j = 0; j <= N / G; j++) {
			k = N - (R * i + G * j);
			if (k >= 0 && k % B == 0) { ans++; }
		}
	}

	cout << ans << endl;
}

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

LL sum[200002]={0};


int main(void){
    int N;
    LL t;
    cin>>N;
    for(int i=1; i<=N; i++){
        scanf("%lld",&t);
        sum[i]=sum[i-1]+t;
    }
    LL d=LONG_LONG_MAX;
    for(int i=1; i<N; i++)
        d=min(d, abs(sum[i] -( sum[N]-sum[i]) ));
    printf("%lld\n",d);
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int s[1234][1234];

int main(void){
	int n,p,k,i,j,b=0,d=1;
	bool flag = false;
	cin >> n;
	for(i=1; i<=n; ++i){
		if(i*(i+1)==2*n){
			cout << "Yes" << endl;
			p = i;
			flag = true;
			break;
		}
	}
	k = p+1;
	if(!flag){
		cout << "No" << endl;
		return 0;
	}
	while(p){
		for(i=0; i<p; ++i){
			s[b][b+i] = d+i;
			s[b+i+1][b] = d+i;
		}
		d += p;
		--p;
		++b;
	}
	cout << k << endl;
	for(i=0; i<k; ++i){
		cout << k-1;
		for(j=1; j<k; ++j){
			cout << " " << s[i][j-1];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 5504
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int h, w, a[88][88], b[88][88];

bool dp[88][88][25600];

int main(){
    cin >> h >> w;
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            cin >> a[i][j];
        }
    }
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            cin >> b[i][j];
            a[i][j] -= b[i][j];
        }
    }
    dp[0][0][a[0][0] + 12800] = true;
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            for(int k = 0;k < 25600;k++){
                if(!dp[i][j][k])continue;
                if(i+1 < h){
                    dp[i+1][j][k+a[i+1][j]] = true;
                    dp[i+1][j][k-a[i+1][j]] = true;
                }
                if(j+1 < w){
                    dp[i][j+1][k+a[i][j+1]] = true;
                    dp[i][j+1][k-a[i][j+1]] = true;
                }
            }
        }
    }
    int ans = 2560000;
    for(int i = 0;i < 25600;i++){
        if(dp[h-1][w-1][i]){
            ans = min(ans, abs(i - 12800));
        }
    }
    cout << ans << endl;
    
    return 0;
}


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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    FOREACH(x, v) { cout << x << " "; }                                        \
    cout << "\n";

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll r, D, x;

int main() {
    cin >> r >> D >> x;
    REP(i, 10) {
        x = r * x - D;
        cout << x << "\n";
    }
}

Measured memory_bytes: 256
n=int(input())
#d = [list(map(int,input().split())) for _ in range(s)]

def p(val):
    print(val)

count = 0

#cは1以上で、問題文からN-1 a*b <=N-1のものをもとめる
#aを1からふやしてく、cはaとbが決まれば自動歴に決まるので、
for i in range(1,n):
    count +=(n-1)//i

    

        
p(count)

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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

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

    string s;
    cin >> s;

    int cnt = 0;
    repall (c, s) { cnt += (c == 'x'); }
    YN(cnt <= 7);

    return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

typedef vector<ll> V;
typedef vector<V> VV;

vector<string> ans[11];
vector<VV> p[11];

signed main() {
  p[1].push_back({{1}});

  for (ll i=2; i<=10; i++) {
    for (auto vv : p[i - 1]) {
      auto nvv = vv;
      rep(j, nvv.size()) {
        nvv[j].push_back(i);
        p[i].push_back(nvv);
        nvv[j].pop_back();
      }
      nvv.push_back({i});
      p[i].push_back(nvv);
      nvv.pop_back();
    }
  }

  for (ll i=1; i<=10; i++) {
    for (auto vv : p[i]) {
      string s(i, '#');
      rep(k, vv.size()) {
        auto v = vv[k];
        char c = 'a' + k;
        for (auto j : v) {
          s[j-1] = c;
        }
      }
      ans[i].push_back(s);
    }
    sort(begin(ans[i]),end(ans[i]));
  }

  // dump #1
  #if 0
  for (ll i=1; i<=10; i++) {
    printf("p[%ld]: \n", i);
    for (auto vv : p[i]) {
      cout << "- ";
      for (auto v : vv){
        cout << "{";
        rep(j, v.size()) {
          cout << v[j];
          if (j < v.size()-1) {
            cout << " ";
          }
        }
        cout << "} ";
      }
      cout << endl;
    }
    cout << endl << endl;
  }
  #endif

  // dump #2
  ll N;
  cin >> N;
  for (auto s : ans[N]) {
    cout << s << endl;
  }

  return 0;
}


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

int main() {
	while(1){
		int h,w;
		cin >> h >>w;
		if(h==0 && w==0) break;
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				if((i+j)%2 == 0) cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


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


int main()
{
    //freopen("A-small-practice.in","r",stdin);
    //freopen("A-large-practice.in","r",stdin);
    //freopen("output.out","w",stdout);

    /*int n;
    cin>>n;
    int A[n];

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

    int dp[(1<<n)-1][n];

    for(int mask = 0;mask < (1<<n);mask++) {
      for(int j = 0;j < n;j++) {


        if(((1<<j)&(mask)) == 0) {
          dp[mask][j] = 0;
        }

        else if(((~(1<<j))&(mask)) == 0) {
            dp[mask][j] = A[j]*2;
        }

        else {
          int t = (~(1<<j))&(mask);
          int ans = 0;
          for(int i=0;i<n;i++) {

            if((1<<i)&(t))
              ans = max(ans, (A[j] > A[i]) ? 2*(A[j]-A[i]) + dp[t][i] : dp[t][i]);
          }

          dp[mask][j] = ans;
          cout<<"hello";
        }



      }
    }

    for(int i=0;i<(1<<n);i++) {
      for(int j=0;j<n;j++) {
        cout<<dp[i][j]<<" ";
      }cout<<endl;
    }*/

  long long n,x;
  cin>>n>>x;

  long long u = x, v = n-x, ans = 0;

  while(u!=0 and v != 0) {
    if(u < v) {
        ans += (v/u)*u;
        v = v%u;
    } else {
        swap(u,v);
        ans += (v/u)*u;
        v = v%u;
    }
  }

    cout<<2*ans+n-max(u,v);


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=998244353;
const ll inf=1e17;
const ll ms=(2e5)+5;


vector<ll> vv;


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

    ll s=0;
    ll e;
    int i;
    for(i=1;i<=n;i++)
    {
        cin>>e;
        s+=e;
        vv.pb(e);
    }
    sort(vv.begin(),vv.end());
    int ans=1;
    s-=vv[n-1];
    for(i=n-2;i>=0;i--)
    {
        e=vv[i+1];
        if((s*2)>=e)
        {
            ans++;
            s-=vv[i];
        }
        else break;
    }
    cout<<ans;
    return 0;
}

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

int main() {
	double a;
	a=0;
	int N;
	cin >>N;
	vector<int> A(N);
	for(int i=0;i<N;i++){
		cin >>A.at(i);
		a=a+(1.0/A.at(i));
	}
	cout << 1.0/a<<endl;

}

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

using namespace std;
int main(void){
    int X,ans = 0;
    
    cin >> X;
    if( X <= 3){
        cout << 1 << endl;
    }
    else{
    for(int i = 2;pow(i,2) <= X;i++){
        for(int j = 2;pow(i,j) <= X;j++){
            if(pow(i,j) > ans){
                ans = pow(i,j);
            }
        }
    }
    cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    if (S.charAt(S.length()-1) == 's') {
      System.out.println(S + "es");
    } else {
      System.out.println(S + "s");
    }
  }
}


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

#define INF 1e9
using namespace std;
using ll = long long;

int main() {

    int a, b, c, x; cin >> a >> b >> c >> x;

    ll ans = 0;

    for (int i = 0; i <= a; ++i) {
        for (int j = 0; j <= b; ++j) {
            for (int k = 0; k <= c; ++k) {
                if (500 * i + 100 * j + 50 * k == x) {
                    ++ans;
                }
            }
        }
    }

    cout << ans << endl;
}

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

using ll = long long;

class union_find {
public:
    union_find(int n) : par(n, -1) {}

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

    void unite(int x, int y) {
        x = root(x), y = root(y);
        if(x == y) return;
        if(par[x] < par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
    }

    int size(int x) {
        return -par[x];
    }

private:
    vector<int> par;
};

struct edge {
    int r, c, cost;
    bool operator<(edge const& e) const {
        return cost < e.cost;
    };
};

int main() {
    int n, h, w; cin >> n >> h >> w;
    vector<edge> es(n);
    for(int i = 0; i < n; ++i) {
        cin >> es[i].r >> es[i].c >> es[i].cost;
        es[i].r--, es[i].c--;
    }
    sort(rbegin(es), rend(es));

    union_find uf(h + w);
    vector<int> esz(h + w);
    ll ans = 0;
    for(auto const& e : es) {
        const int u = uf.root(e.r), v = uf.root(e.c + h);
        if(u == v) {
            if(esz[u] < uf.size(u)) {
                ans += e.cost;
                esz[u] += 1;
            }
        } else {
            if(esz[u] + esz[v] < uf.size(u) + uf.size(v)) {
                ans += e.cost;
                uf.unite(u, v);
                const int nsz = esz[u] + esz[v] + 1;
                esz[u] = esz[v] = nsz;
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using ll = long long; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
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; }
template<class T>T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }

void _main() {
  vector<pair<int,int>> p(5);
  rep(i, 0, 5) {
    int t;
    cin >> t;
    p[i] = {t%10, t};
  }

  sort(all(p));
  int i_del = 0;
  rep(i, 0, 5) {
    if (p[i].second % 10 != 0) {
      i_del = i;
      break;
    }
  }
  int last = p[i_del].second;
  p.erase(p.begin() + i_del);

  int ans = last;
  fore(x, p) {
    if (x.second % 10 == 0) ans += x.second;
    else                    ans += 10 * (x.second / 10 + 1);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string> 
#include <set>
typedef long long ll;
using namespace std;

int arr[1007];
int main() {
    int n, k; cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    sort(arr, arr + n);
    int res = 0;
    for (int i = 0; i < k; ++i) {
        res += arr[i];
    }
    cout << res << endl;



    return 0;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
                    
                    
int main(){
    int N;
    cin >> N;
    int A[N-1];
    int ans[N];
    ans[N-1] = 0;
   
    for(int i = 0; i < N-1; i++){
        cin >> A[i];
        ans[i] = 0;
    }
    

    for(int i = 0; i < N-1; i++){
        ans[A[i]-1] += 1;
    }

    for(int i = 0; i < N; i++){
        cout << ans[i] << endl;
    }

    return 0;
            
}

Measured memory_bytes: 5144
<?php
  $tmp = explode(" ", trim(fgets(STDIN)));
  $a = $tmp[0];
  $b = $tmp[1];
  $k = $tmp[2];

  if($a >= $k){
  	$a2 = $a - $k;
  	$b2 = $b;
  }else{
  	$a2 = 0;
  	$b2 = $b - ($k - $a);
  }

  if($b2 >= 0){
  	echo $a2." ".$b2;
  }else{
  	echo $a2." 0";
  }

Measured memory_bytes: 4728
//In the name of Allah

#include <bits/stdc++.h>

using namespace std;

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

const int N = 1e5+10 , mod = 1e9+7;

vector < pair <int , char> > v , tmp;
vector <char> g1[N] , g2[N];

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n , cnt=0;
    cin >> n;
    string s;
    cin >> s;
    for(int i=0 ; i<n ; i++)
        v.push_back({i , s[i]});
    while(v.size()){
        int t = 0;
        for(int i=0 ; i<v.size() ; i++)
            if(i != v.size() - 1 && (v[i].second != v[i + 1].second && v[i].second == '(')){
                i++;
                t++;
            }
            else
                tmp.push_back(v[i]);
        v = tmp;
        tmp.clear();
        if(!t){
            for(int i=0 ; i<v.size() ; i++)
                if(v[i].second == ')')
                    cout << "(";
                else
                    cnt++;
            break;
        }
    }
    cout << s;
    for(int i=0 ; i<cnt ; i++)
        cout << ")";
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(){
  vector<int> abc(3);
  cin >> abc.at(0) >> abc.at(1) >> abc.at(2);
  sort(abc.begin(), abc.end());
  if(abc.at(0)+abc.at(1) == abc.at(2)){cout << "Yes" << endl;}
  else{cout << "No" << endl;}
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
bool comp(vector<ll> a, vector<ll> b)
{
   return *max_element(a.begin(), a.end())>*max_element(b.begin(), b.end());
}
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0; i<n;i++)
    {
        cin>>a[i];
        if(a[i]%2==0)
        {
            if(a[i]%3!=0 && a[i]%5!=0)
            {
                cout<<"DENIED";
                exit(0);
            }
        }
    }
    cout<<"APPROVED";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;

#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))
#define LLONG_MAX numeric_limits<long long>::max()
#define INT_MAX numeric_limits<int>::max()

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

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

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

template <typename T>
void say(vector<T>& vec, string pad = " ") {
	for (const T& elem : vec)
		cout << elem << pad;
}


/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	int a, b;
	cin >> a >> b;
	cout << (a + b) % 24 << endl;

	return 0;
}

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

using namespace std;

int main()
{int N; cin >> N;
 vector<int> A(N);
 
 for(int i = 0; i < N; i++)
 {cin >> A[i];}
 
 bool flag = true;
 int cnt = 0;
 
 while(flag)
 { for(int j = 0; j < N; j++)
   {if(A[j] % 2 != 0){ flag = false;}}
  //奇数が紛れていないかを確認
  if(flag)
  {cnt++;
   for(int j = 0; j < N; j++){ A[j] = A[j] / 2;}}
  else if(flag ==false){break;}}
 
 cout << cnt <<endl;
 return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		StringTokenizer st;
		StringBuilder sb = new StringBuilder();

		next: while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = Integer.parseInt(line.substring(0, line.indexOf(' ')));
			int k = Integer.parseInt(line.substring(line.indexOf(' ') + 1));
			if (n == 0 && k == 0) {
				break;
			}
			int[] stock = new int[k];
			int[] needs = new int[k];

			st = new StringTokenizer(br.readLine());
			for (int i = 0; i < k; i++) {
				stock[i] = Integer.parseInt(st.nextToken());
			}
			for (int i = 0; i < n; i++) {
				st = new StringTokenizer(br.readLine());
				for (int j = 0; j < k; j++) {
					needs[j] += Integer.parseInt(st.nextToken());
				}
			}
			for (int i = 0; i < k; i++) {
				if (stock[i] < needs[i]) {
					sb.append("No" + '\n');
					continue next;
				}
			}
			sb.append("Yes" + '\n');
		}
		System.out.print(sb.toString());
	}
}

Measured memory_bytes: 41048
#include<iostream>
#include<cstdio>
#include<set>
using namespace std;
long long n,a[222222],sum,ans;
set<long long> s;
int main()
{
	scanf("%lld",&n);
	for (long long i=1;i<=n;i++) scanf("%lld",&a[i]);
	for (long long i=n;i>=1;i--)
	{
		while(!s.empty())
		{
			if ((*s.begin())-sum<=0) s.erase(s.begin());
			else break;
		}
		if (!s.empty() && (*s.rbegin())-sum>a[i])
		{
			printf("-1\n");
			return 0;
		}
		if (!a[i]) 
		{
			sum++;
			continue;
		}
		if (s.empty()) ans++;
		else 
		{
			if (s.find(a[i]+sum)==s.end()) ans+=(s.size()+1);
			else ans+=s.size();
		}
		if (a[i]>1)
		{
			s.insert(a[i]+sum); 
		}
		sum++;
	}
	if (a[1]>0 || !s.empty())
	{
		printf("-1\n");
		return 0;
	} 
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 6528
while True:
    H,W=map(int,input().split())
    if H==W==0:
        break
    else:
        for i in range(H):
            for k in range(W):
                if (i+k)%2 == 0:
                    print("#",end = "")
                else:
                    print(".",end = "")
            print()
    print()



Measured memory_bytes: 7000
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>

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 ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;


int main() {


	int N, M;

	cin >> N >> M;

	cout << (N%M==0?N/M:N/M+1) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#define FOR(x, u) for (int x = 0; x < u; x++)
typedef long long ll;
using namespace std;
void solve()
{     
    int n,r;
    cin>>n;
    while(n!=0)
    {
        r=n%10;
        if(r==7)
        {
            cout<<"Yes";
            break;
        }
        n/=10;
    }
    if(!n)
        cout<<"No";
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    //cin>>t;
    while (t--)
    {
        solve();
        cout << "\n";
    }
    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
    return 0;
}

Measured memory_bytes: 3752
#include <stdio.h>
int a[50];
int main()
{
	int n,m,i,j,k,s,t;
	while(~scanf("%d",&n))
	{
		for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
		m=0;
		for(i=2;i<=n-1;i++)
		{
			if(((a[i-1]-a[i])*(a[i+1]-a[i]))<=0)
			m++;
		}
		printf("%d\n",m);
	}
	return 0;
} 

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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find algo with array
// Find()
int findpar(int curr, int arr[])
{
  while(arr[curr] != curr) curr = arr[curr];
  return curr;
}
// Union()
void Union(int b, int spa, int arr[])
{
  while(arr[b] != b)
  {
    int c = arr[b];
    arr[b] = spa;
    b = c;
  }
  arr[b] = spa;
}

// Main Code

int main()
{
  int w, a, b;
  cin>>w>>a>>b;
  if(a < b)
  {
    int ans = b - a - w;
    if(ans < 0) ans = 0;
    cout<<ans<<endl;
  }
  else
  {
    int ans = a - w - b;
    if(ans < 0) ans = 0;
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 12288
import fractions 
a,b,c,d=map(int,input().split())
cd=fractions.gcd(c,d)
lcm=c*d//cd
bac=b//c-a//c
bad=b//d-a//d
balcm=b//lcm-a//lcm
if a%c==0:
    bac+=1
if a%d==0:
    bad+=1
if a%lcm==0:
    balcm+=1
print(b-a+1-(bac+bad-balcm))

Measured memory_bytes: 5044
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;


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

    vector<string> v;

    for (int i = 0; i < s.size(); i++) {
        for (int j = s.size()-i; j > 0; j--) {
            if (j > k) {}
            else 
                v.push_back(s.substr(i,j));
        }
    }

    sort(v.begin(), v.end());

    for (int i = 0; i < v.size()-1; i++) {
        if (v[i] == v[i+1]) {
            v.erase(v.begin()+i);
            i--;
        }
    }

    cout << v[k-1] << endl;
    return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#include <unordered_set>
#include <string>
#include <algorithm>

using ll = long long;

using namespace std;

int main()
{
	int x, y, z, k;
	cin >> x >> y >> z >> k;

	vector<ll> as(x), bs(y), cs(z);

	for (int i = 0; i < x; i++)
		cin >> as[i];
	for (int i = 0; i < y; i++)
		cin >> bs[i];
	for (int i = 0; i < z; i++)
		cin >> cs[i];

	sort(as.begin(), as.end());
	reverse(as.begin(), as.end());
	sort(bs.begin(), bs.end());
	reverse(bs.begin(), bs.end());
	sort(cs.begin(), cs.end());
	reverse(cs.begin(), cs.end());

	vector<ll> ab, abc;
	for (int i = 0; i < x; i++)
	{
		for (int j = 0; j < y; j++)
		{
			ab.push_back(as[i] + bs[j]);
		}
	}

	sort(ab.begin(), ab.end());
	reverse(ab.begin(), ab.end());

	for (int i = 0; i < min(k, (int)ab.size()); i++)
	{
		for (int j = 0; j < cs.size(); j++)
		{
			abc.push_back(ab[i] + cs[j]);
		}
	}

	sort(abc.begin(), abc.end());
	reverse(abc.begin(), abc.end());

	for (int i = 0; i < k; i++)
	{
		cout << abc[i] << endl;
	}
}

Measured memory_bytes: 43368
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int n;
vector< vector<int> > graph(110, vector<int>());
vector<int> fst(110, -1);
vector<int> snd(110, -1);

int abstime = 0;
void dfs(int now) {
    // cout << "ok" << endl;
    if(fst.at(now) != -1) return;
    abstime++;
    fst.at(now) = abstime;
    for(int i = 0; i < graph.at(now).size(); ++i) {
        dfs(graph.at(now).at(i));
    }
    abstime++;
    snd.at(now) = abstime;
}

int main() {
    cin >> n;
    for(int i = 0; i < n; ++i) {
        int u, k;
        cin >> u >> k;
        u--;
        for(int j = 0; j < k; ++j) {
            int v;
            cin >> v;
            v--;
            graph.at(u).push_back(v);
        }
    }

    for(int i = 0; i < n; ++i) {
        dfs(i);
    }

    for(int i = 0; i < n; ++i) {
        cout << i+1 << " " << fst.at(i) << " " << snd.at(i) << endl;
    }
}


Measured memory_bytes: 3164