akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int p,q,r;
  cin >> p >> q >> r;
  cout << min(p+q,min(q+r,r+p)) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int partition(int *,int,int);

int main(){
  int n,i,le,ri,arr[100000],basei,base,tmp;

  scanf("%d",&n);
  if(n>100000) exit(2);
  for(i=0;i<n;i++){
    scanf("%d",&arr[i]);
  }
  basei = partition(arr,0,n-1);
  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    if(basei==i) printf("[");
    printf("%d",arr[i]);
    if(i==basei) printf("]");
  }
  printf("\n");
  return 0;
}

int partition(int arr[],int left,int right){
  int i,le=0,ri=0,tmp;
  for(i=left;i<right;i++){
    if(arr[i]<=arr[right]){
      tmp=arr[le];
      arr[le]=arr[i];
      arr[i]=tmp;
      ri++;
      le++;
    }else{
      ri++;
    }
  }
  tmp=arr[le];
  arr[le]=arr[right];
  arr[right]=tmp;
  return le;
}



Measured memory_bytes: 2132
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, a[100000], min=0, max=0, cnt[101]={0}, i;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    for(i=0;i<n;i++){
        if(a[i]<=399) cnt[0]++;
        else if(a[i]<=799) cnt[1]++;
        else if(a[i]<=1199) cnt[3]++;
        else if(a[i]<=1599) cnt[4]++;
        else if(a[i]<=1999) cnt[5]++;
        else if(a[i]<=2399) cnt[6]++;
        else if(a[i]<=2799) cnt[7]++;
        else if(a[i]<=3199) cnt[8]++;
        else cnt[9]++;
    }
    for(i=0;i<9;i++){
        if(cnt[i]>0){
            min++;
            max++;
        }
    }
    if(cnt[9]>0){
        max+=cnt[9];
        if(min==0) min=1; 
    }
    cout << min << " " << max <<endl;
    return 0;
}

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

int main(){
  int N,A;
  cin >> N >> A;
  if(N%500 <= A) cout << "Yes"  << endl;
  else	cout << "No"  << endl;
}

Measured memory_bytes: 256
/*
author: Apoorv Singh
*/
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define For(i, a, b) for (long long i = a; i < b; ++i)
#define Forr(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define ll long long 
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;  
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

template <class X>
void printarr(X arr[], int n) 
{
	for (int i = 0; i < n; ++i)
		cout << arr[i] << ' ';
	cout << endl;
}
 
template <class T, class cmp = less<T>> using ordered_set = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
 
ll modulo = 1e9 + 7;

ll fpow(ll a, ll n) 
{
	ll ans = 1;
	while (n) 
	{
		if (n&1) ans = (ans*a)%modulo;
		a = (a*a)%modulo; n = n >> 1;
	}
	return ans;
}

void solve() 
{
	string s; cin >> s;
	int cnt = 0, ans = 0;
	For(i,0,s.size())	
	{
		if (s[i] == 'R') ++cnt;
		else
		{
			ans = max(ans, cnt);
			cnt = 0;
		}
	}		
	cout << max(ans, cnt) << endl;
}

int main() 
{
	fast_io();
	int t = 1;
	// cin >> t;
	while (t--) solve();
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back
#define ll long long
#define rep(i,n) for (i = 0; i < n; ++i) 
#define REP(i,k,n) for (i = k; i <= n; ++i) 
#define REPR(i,k,n) for (i = k; i >= n; --i)
using namespace std;
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  ll arr[3];
  for(int i = 0;i<3;i++)
  {
      cin>>arr[i];
  }
  sort(arr,arr+3);
  cout<<arr[0]+arr[1] ;	

	return 0;
}

Measured memory_bytes: 3592
# AOJ GRL_7_A "Bipartite Matching"
# O(VE)

class BipartiteMatching():
    def __init__(self, V1, V2):
        self.V1 = V1
        self.V2 = V2
        self.V = V1 + V2
        self.graph = [[] for _ in range(V1+V2)]
    
    def add_edge(self, v1, v2):
        v2 += self.V1
        self.graph[v1].append(v2)
        self.graph[v2].append(v1)

    # search increasing path
    def dfs(self, s):
        self.par = [None]*self.V
        self.used = [False]*self.V
        self.used[s] = True
        self.stack = [s]
        while self.stack:
            v = self.stack.pop()
            for nv in self.graph[v]:
                w = self.match[nv]
                if w < 0:
                    while True:
                        self.match[v] = nv
                        self.match[nv] = v
                        if v == s: return True
                        v, nv = self.par[v]
                elif not self.used[w]:
                    self.par[w] = (v, nv)
                    self.used[w] = True
                    self.stack.append(w)
        return False

    def bipartite_matching(self):
        res = 0
        self.match = [-1]*self.V
        for v in range(self.V):
            if self.match[v] < 0:
                if self.dfs(v):
                    res += 1
        return res


if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    V1, V2, E = map(int, input().split())
    bm = BipartiteMatching(V1, V2)
    for _ in range(E):
        a, b = map(int, input().split())
        bm.add_edge(a, b)
    print(bm.bipartite_matching())


Measured memory_bytes: 5856
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

ll N, K, mod = 1e9+7;


ll xPy(ll x, ll y) {
    if(x<y) return 0;
    if(y==0) return 1;
    ll tmp = 1;
    
    for(ll i=0; i<y; i++) {
        tmp *= (x-i);
        tmp %= mod;
    }
    return tmp;
}

ll dfs(int s, map<int, vector<int>>& edges, vector<bool>& visited, vector<ll>& num_colors, ll depth) {
    cerr << "s: " << s << endl;
    if(visited[s]==true) return 1;
    visited[s] = true;
    ll num_children = ll(edges[s].size());
    bool is_leaf = true;
    for(auto v: edges[s]){
        if(!visited[v]) is_leaf = false;
        if(visited[v]) num_children--;
    }
    if(is_leaf) return 1;

    ll res = 1;
    if(depth == 0) {
        num_colors[s] = xPy(K-1, num_children);
        num_children--;
        res = num_colors[s];
    } else if(depth >= 1) {
        num_colors[s] = xPy(K-2, num_children);
        num_children--;
        res = num_colors[s];
    }

    for(auto v: edges[s]) {
        if(visited[v]) continue;
        res *= dfs(v, edges, visited, num_colors, depth+1);
        res %= mod;
    }
    return res;
}

int main() {
    cin >> N >> K;
    vector<int> a(N), b(N);
    map<int, vector<int>> edges;

    int tmp1, tmp2;
    for(int i=0; i<N-1; i++){
        cin >> tmp1 >> tmp2;
        edges[tmp1-1].push_back(tmp2-1);
        edges[tmp2-1].push_back(tmp1-1);
    }

    vector<bool> visited(N, false);
    vector<ll> num_colors(N, 1);
    num_colors[0] = K;
    dfs(0, edges, visited, num_colors, 0);

    cerr << "debug" << endl;
    for(auto x: num_colors) cerr << x << " "; cerr << endl;

    cerr << "debug visited" << endl;
    for(auto x: visited) cerr << x << " "; cerr << endl;

    ll ans = K;
    if(N>1) for(int i=0; i<N;i ++) (ans *= num_colors[i]) %= mod;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 22144
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include <cmath>
#include<utility>
#include<algorithm>
//#include <bits/stdc++.h>
#define rep(i,n) for (long int i = 0; i < (n); ++i)
using namespace std;
 
 
int main(){
    typedef  pair<long int,char> P;
    long int N;
    cin>>N;
    vector<long int> X(N),Y(N),a(N),b(N);
    vector<char> U(N);
    vector<vector<P> > aa(400005),bb(400005),cc(200005),dd(200005);
    rep(i,N){
        cin>>X[i]>>Y[i]>>U[i];
        a[i]=Y[i]-X[i]+200000;
        b[i]=X[i]+Y[i];
        aa[a[i]].push_back(P(X[i],U[i]));
        bb[b[i]].push_back(P(X[i],U[i]));
        cc[X[i]].push_back(P(Y[i],U[i]));
        dd[Y[i]].push_back(P(X[i],U[i]));
    }
    rep(i,400005){
        if (!aa[i].empty()) sort(aa[i].begin(),aa[i].end());
        if (!bb[i].empty()) sort(bb[i].begin(),bb[i].end());
    }
    long int ans=1000000000;
    rep(i,400005){
      	long int l=aa[i].size();
        rep(j,l-1){
            if (aa[i][j].second=='U' && aa[i][j+1].second=='L') ans=min(ans,10*(aa[i][j+1].first-aa[i][j].first));
            if (aa[i][j].second=='R' && aa[i][j+1].second=='D') ans=min(ans,10*(aa[i][j+1].first-aa[i][j].first));
        }
       l=bb[i].size();
       rep(j,l-1){
            if (bb[i][j].second=='R' && bb[i][j+1].second=='U') ans=min(ans,10*(bb[i][j+1].first-bb[i][j].first));
            if (bb[i][j].second=='D' && bb[i][j+1].second=='L') ans=min(ans,10*(bb[i][j+1].first-bb[i][j].first));
        }
    }
    rep(i,200005){
        if (!cc[i].empty()) sort(cc[i].begin(),cc[i].end());
        if (!dd[i].empty()) sort(dd[i].begin(),dd[i].end());
    }
    rep(i,200005){
      	long int l=cc[i].size();
        rep(j,l-1){
            if (cc[i][j].second=='U' && cc[i][j+1].second=='D') ans=min(ans,5*(cc[i][j+1].first-cc[i][j].first));
        }
      	l=dd[i].size();
        rep(j,l-1){
            if (dd[i][j].second=='R' && dd[i][j+1].second=='L') ans=min(ans,5*(dd[i][j+1].first-dd[i][j].first));
        }
    }
    if (ans==1000000000) cout<<"SAFE"<<endl;
    else cout<<ans<<endl;
 
return 0;
}

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  ll T[N],A[N];
  rep(i,N) cin >> T[i];
  rep(i,N) cin >> A[i];
  pair<ll, ll> h[N];//高さ、決定:0 それ以下:1
  h[0] = mp(T[0],0);
  rep1(i,N-1){
    if(T[i] > T[i-1]){
      h[i] = mp(T[i],0);
    }else{
      h[i] = mp(T[i],1);
    }
  }
  if(h[N-1].first < A[0]){
    cout << 0 << endl;
    return 0;
  }
  else if(h[N-1].first > A[0] && h[N-1].second==0){
    cout << 0 << endl;
    return 0;
  }
  h[N-1].first = A[0];
  ll ans=1LL;
  for(int i=N-2; i>=0; i--){
    if(A[i] > A[i+1]){//決定      
      if(h[i].first < A[i]){
	cout << 0 << endl;
	return 0;
      }
      else if(h[i].first > A[i] && h[i].second==0){
	cout << 0 << endl;
	return 0;
      }
      h[i].first = A[0];      
    }
    else{ //未定
      if(h[i].second==0){
	if(A[i] < h[i].first){
	  cout << 0 << endl;
	  return 0;
	}	
      }
      else{
	ans = (ans * min(h[i].first, A[i]))%((ll)1e9+7);
      }
    }

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

}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int main()
    {
        string s[3];
        for(int i=0;i<3;i++){
            cin>>s[i];
        }
        char top{},ans{};
        while(true){
            if(s[top].empty()){
                ans=top;
                break;
            }
            int next;
            if(s[top][0] == 'a'){
                next = 0;
            }else if(s[top][0] == 'b'){
                next = 1;
            }else if(s[top][0]=='c'){
                next = 2;
            }
            s[top] = s[top].substr(1);
            top = next;
        }
            if(ans==0)cout<<"A"<<endl;
        else if(ans==1)cout<<"B"<<endl;
        else cout<<"C"<<endl;
        return 0;
    }

Measured memory_bytes: 3548
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean[][] trumps = new boolean[4][13];
		int n = sc.nextInt();
		String character;
		int number;
		int trumpsIndex = 0;
		for (int i = 0; i < n; i++) {
			character = sc.next();
			number = sc.nextInt() - 1;
			switch (character) {
			case "S":
				trumpsIndex = 0;
				break;
			case "H":
				trumpsIndex = 1;
				break;
			case "C":
				trumpsIndex = 2;
				break;
			case "D":
				trumpsIndex = 3;
				break;
			}
			trumps[trumpsIndex][number] = true;
		}
		character = "";
		for (int i = 0; i < trumps.length; i++) {
			for (int j = 0; j < trumps[i].length; j++) {
				if (trumps[i][j] == false) {
					switch (i) {
					case 0:
						character = "S";
						break;
					case 1:
						character = "H";
						break;
					case 2:
						character = "C";
						break;
					case 3:
						character = "D";
						break;
					}
					System.out.println(character + " " + (j + 1));
				}
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 26452
#include <cstdio>
#include <algorithm>
#include <cmath>
#define INF 200005
using namespace std;
int n,X[INF],Y[INF],a[INF],top,Q[INF],f[INF],cnt[INF],Min[INF];

bool cmp(int x,int y){return Y[x]<Y[y];}

int Fa(int x){
	if (f[x]==x) return x;
	f[x]=Fa(f[x]);
	return f[x];
}

int main()
{
	scanf("%d",&n);
	top=0;
	for (int i=1; i<=n; i++)
	{
		scanf("%d%d",&X[i],&Y[i]);
		a[i]=i;
	}
	sort(a+1,a+n+1,cmp);
	for (int i=1; i<=n; i++){
		Min[a[i]]=X[a[i]];
		while (top>0 && Min[Q[top]]<X[a[i]])
		{
			f[Q[top]]=a[i];
			cnt[a[i]]+=cnt[Q[top]];
			Min[a[i]]=min(Min[Q[top]],Min[a[i]]);
			top--;
		}
		Q[++top]=a[i];
		f[a[i]]=a[i];
		cnt[a[i]]++;
	}
	for (int i=1; i<=n; i++)
	{
		//int fff=Fa(i);
		printf("%d\n",cnt[Fa(i)]);
		//printf("\n[%d]\t%d\t%d",i,f[i],cnt[i]);
	}
}

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

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

    std::vector<int> ps(n);
    for (auto& p : ps) {
        std::cin >> p;
    }

    int ans = 0;
    for (int i = 1; i < n - 1; ++i) {
        if (std::min(ps[i - 1], ps[i + 1]) < ps[i] &&
            ps[i] < std::max(ps[i - 1], ps[i + 1])) {
            ++ans;
        }
    }

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


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint a(n), sum(n+1);
  rep(i, n) cin >> a[i];
  rep(i, n) sum[i+1] = sum[i]+a[i];
  int ans = inf;
  reps(i, 1, n) {
    chmin(ans, llabs(sum[i]-(sum[n]-sum[i])));
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;

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


int main(){
    ll A, B;
    cin >> A >> B;
    cout << A * B / gcd(A, B) << endl;


	return 0;
}



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

int main()
{
  ll n;
  string x;
  cin>>n;
  vector<string>s(n);
  vector<ll>a(n);
  for(ll i=0;i<n;i++)
    cin>>s[i]>>a[i];
  cin>>x;
  bool f=false;
  ll res=0;
  for(ll i=0;i<n;i++)
  {
    if(f)
      res+=a[i];
    if(s[i]==x)
      f=true;
  }
  cout<<res;
  return 0;
}

Measured memory_bytes: 256
#include <sstream>
#include <fstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

bool used[10];
int S;

int dfs( int s, int n ){

	if( n == 0 ){
		if( s == S ){
			return 1;
		}else{
			return 0;
		}
	}

	int res = 0;
	for( int i = 0; i <= 9; i++ ){
		if( used[i] ) continue;
		used[i] = true;
		res += dfs( s + i, n - 1 );
		used[i] = false;
	}

	return res;
}

int main() {
	int n;

	while( true ){

		cin >> n >> S;

		if( n == 0 && S == 0 ) break;

		memset( used, false, sizeof( used ) );
		int res = dfs( 0, n );
		int d = 1;
		for( int i = n; i >= 2; i-- ){
			d *= i;
		}
		cout << (res / d) << endl;

	}
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;

public class Main {

  Node[] tree;
  boolean[] visited ;
  int[] colors;

  public static void main(String[] args) {

    new Main().run();
  }
  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out)) {

      int n = Integer.parseInt(in.readLine());
      tree = new Node[n];
      for (int i = 0; i < n; i++) {
        tree[i] = new Node();
      }
      String[] lines;
      for (int i = 0; i < n-1; i++) {
        lines = in.readLine().split(" ");
        int v = Integer.parseInt(lines[0]) - 1;
        int u = Integer.parseInt(lines[1]) - 1;
        int d = Integer.parseInt(lines[2]);
        tree[v].edge.add(new Edge(u, d));
        tree[u].edge.add(new Edge(v, d));
      }

      visited = new boolean[n];
      colors  = new int[n];
      Arrays.fill(colors, -1);

      bfs(0, 0);

      for (int c : colors) {
        out.println(c);
      }
      out.flush();
    }
    catch(IOException e) {

      System.err.println(e);
    }
  }

  void bfs(int fv, int fd) {
    Deque<Edge> stuck = new ArrayDeque<>();

    stuck.push(new Edge(fv, fd));

    while(!stuck.isEmpty()) {
      Edge v = stuck.pop();

      if(!visited[v.u]) {
        visited[v.u] = true;
        int d = colors[v.u] = v.d % 2 == 0 ? 0 : 1;
        for (Edge e : tree[v.u].edge) {
          if(!visited[e.u]) {
            stuck.push(new Edge(e.u, d + e.d));
          }
        }
      }
    }
  }

  private class Node {
    List<Edge> edge;

    public Node() {
      edge = new LinkedList<>();
    }
  }

  private class Edge {
    int u, d = -1;

    public Edge(int u, int d) {
      this.u = u;
      this.d = d;
    }
  }
}

Measured memory_bytes: 73596
using System;
using System.Linq;
using System.Collections.Generic;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string[] str=Console.ReadLine().Split(' ');
      int A=int.Parse(str[0]);
      int B=int.Parse(str[1]);
      int K=int.Parse(str[2]);
      
      if(K>B){
       for(int i=A;i<=B;i++){
         Console.WriteLine(i);
      }
      }
      else{
        int[] ans=new int[2*(K+1)];
        for(int i=0;i<K;i++){
          ans[i]=A+i;
          ans[ans.Length-1-i]=B-i;
        
      }
        int[] dis=ans.Distinct().ToArray();
        for(int i=0;i<dis.Length;i++){
          if((A<=dis[i])&&(dis[i]<=B)){
          Console.WriteLine(dis[i]);
          }
        }
      }
    }
    
  }

}


Measured memory_bytes: 28276
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int s[10][10];
int main(){
    int n,m; cin>>n>>m;
    rep(i,m){
        int k; cin>>k;
        rep(j,k){
            int ss; cin>>ss;
            s[i][ss-1]=1;
        }
    }
    int p[m]; rep(i,m) cin>>p[i];
    int ans=0;
    for(int i=0;i<(1<<n);i++){
        int cnt[m]={};
        for(int j=0;j<n;j++){
            if((i>>j)&1){
                for(int k=0;k<m;k++){
                    if(s[k][j]){
                        cnt[k]++;
                    }
                }
            }
        }
        int on=0;
        for(int j=0;j<m;j++){
            if(cnt[j]%2==p[j]) on++;
        }
        if(on==m) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	string s, t;
	cin >>  s>> t;
	// s の何文字目から始めるかを全探索
	int ans = 10000;
	rep(i,s.size()){
		int last = i + t.size()-1;
		int now = 0;
		if(last >= s.size()){
			break;
		} else {
			int n = t.size();
			rep(j,n){
				if(s[i+j] != t[j]){
					now++;
				}
			}
			ans = min(now,ans);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3596
*A, = map(int, list(input()))
op = {
  '1': lambda x,y: x+y,
  '0': lambda x,y: x-y
}

for i in range(8):
  B = format(i, '03b')
  result = A[0]
  for j,bi in enumerate(B,1):
    result = op[bi](result,A[j])
  if result == 7:
    ope = B.replace('0','-').replace('1','+')+'='
    print(''.join([str(a)+o for a,o in zip(A,ope)])+'7')
    exit()


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>

using namespace std;

string str;

int main() {
    cin >> str;

    int N = str.size();
    vector<int> nums(N);
    for (int i = 0; i < N; i++)
        nums[i] = str[i] - '0';

    long long sum = 0;
    for (int i = 1<<(N-1); i < (1 << N); i++) {
        long long ans = 0;
        for (int j = 0; j < N; j++) {
            ans = ans * 10 + nums[j];
            if(i&(1<<j)) {
                sum += ans;
                ans = 0;
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3576
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#define INF 1e9
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
  s << vv[i] << endl;
  }
  return s;
}

string S,T;
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> S >> T;
  bool ok = true;
  map<char,char> ma, ima;
  for(int i = 0 ; i < S.size() ; i++){
    char s = S[i];
    char t = T[i];
    if(ma.count(s)){
      if(ma[s] != t){
        ok = false;
      }
    }
    if(ima.count(t)){
      if(ima[t] != s){
        ok = false;
      }
    }
    ma[s] = t;
    ima[t] = s;
  }
  if(ok){
    puts("Yes");
  }
  else{
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
int n,m;
set<int> E[100010];
vector<int> G[100010];
bool used[100010];
void dfs(int v, int pre){
    used[v]=1;
    for(auto &to:G[v]){
        if(to!=pre&&!used[to]){
            dfs(to,v);
        }
    }
    if(sz(E[v])%2){
        if(E[pre].count(v)){
            E[pre].erase(v);
            E[v].insert(pre);
        }
        else{
            E[pre].insert(v);
            E[v].erase(pre);
        }
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    if(m%2){
        cout <<-1<<"\n";
        return 0;
    }
    rep(i,0,m){
        int a,b;
        cin>>a>>b;
        a--; b--;
        G[a].pb(b); G[b].pb(a);
        E[a].insert(b);
    }
    dfs(0,-1);
    rep(i,0,n){
        for(auto &e: E[i]){
            cout <<i+1<<" "<<e+1<<"\n";
        }
    }
}

Measured memory_bytes: 20992
s=input()
arr=[0]*(len(s)+1)
x=0
while x<len(s):
	i=x
	j=x+1
	if s[i]=='<':
		if arr[i] >= arr[j]:
			arr[j] = arr[i]+1
	else:
		if arr[i] <= arr[j]:
			arr[i] = arr[j]+1
	x+=1
# print(arr)
x=len(s)-1
while x>=0:
	i=x
	j=x+1
	if s[i]=='<':
		if arr[i] >= arr[j]:
			arr[j]=arr[i]+1
	else:
		if arr[i] <= arr[j]:
			arr[i]=arr[j]+1
	x-=1
# print(arr)
print(sum(arr))

Measured memory_bytes: 23336
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let x = read::<usize>();
    println!(
        "{}",
        if x == 3 || x == 5 || x == 7 {
            "YES"
        } else {
            "NO"
        }
    );
}


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

typedef long long ll; 
#define sz(a) ((int)(a.size()))

const int mod=1e9+7; 
int mul(int a, int b){
  return (ll)a*b%mod; 
}
void add_self(int &a, int b){
  a+=b; 
  if(a>= mod) a-=mod; 
}
void mul_self(int &a, int b){
  a=(ll)a*b%mod; 
}
void sub_self(int &a, int b){
  a-=b; 
  if(a<0) a+=mod;
}
int exp(int a, int b){
  int ret=1; 
  while(b){
    if(b%2){
      mul_self(ret,a); 
    }
    mul_self(a,a); 
    b/=2; 
  }
  return ret; 
}
//--------------------------------------------------
const int nax=42;

void solve(){
  string s; cin>>s; 
  for(int i=0;i<sz(s)-1;i++){
    if(s[i]==s[i+1]){
      cout<<i+1<<" " <<i+2<<endl; 
      return; 
    }
    else if(i+2<sz(s) && s[i]==s[i+2]){
      cout<<i+1<<" " <<i+3<<endl; 
      return; 
    }
  }
  cout<<"-1 -1"<<endl; 
}

int main(){
  clock_t beg=clock(); 
  solve(); 
  clock_t end=clock(); 
  fprintf(stderr,"%.2lf sec\n",(double)(end-beg)/CLOCKS_PER_SEC); 
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  string s, t; cin >> s >> t;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  ll ans = INF;

  for(ll i = 0; i < s.size() - t.size() + 1; i++) {
    ll cnt = 0;
    for(ll j = 0; j < t.size(); j++) {
      if(s[i+j] != t[j]) cnt++;
    }
    ans = min(ans, cnt);
  }
  


  
  cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3728
#include <cstdio>
#include <cstdlib>

int n, cnt[100001], ans=1;
const int mod = 1e9+7;

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

	if(n&1){
		if(cnt[0]!=1) ans=0;
		for(int i=1; i<=n; i++){
			if((i&1) && cnt[i]) ans=0;
			if(!(i&1) && cnt[i]!=2) ans=0;
			if(!(i&1)) ans=ans*2%mod;
		}
	}
	else{
		if(cnt[0]) ans=0;
		for(int i=1; i<=n; i++){
			if(!(i&1) && cnt[i]) ans=0;
			if((i&1) && cnt[i]!=2) ans=0;
			if(i&1) ans=ans*2%mod;
		}
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void){
    int a,b,c;
    scanf("%d",&a);
    scanf("%d",&b);
    c = a+b;
    if(c <= 16){
        if(a <= 8 && b <= 8){
            printf("Yay!");
        }else{
            printf(":(");
        }
        }else{
            printf(":(");
    }
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
using namespace std;
 
#define iter(i, n) for (int i = 1; i <= n; ++i)
#define NR 510
 
int n, a[NR], tp[NR], ans[NR * NR];
 
bool cmp(int i, int j) {
	return a[i] < a[j];
}
 
int main() {
	scanf("%d", &n);
	iter(i, n) {
		scanf("%d", &a[i]);
		tp[i] = i;
	}
 
	sort(tp + 1, tp + n + 1, cmp);
 
	int tot = 0;
	int p = 0;
	iter(k, n) {
		int i = tp[k];
		if (tot + i > a[i]) {
			puts("No");
			return 0;
		}
		tot += i;
		iter(j, i - 1) {
			for (++p; ans[p] != 0; ++p);
			ans[p] = i;
		}
		ans[a[i]] = i;
	}
 
	iter(k, n) {
int i = tp[k];
		iter(j, n - i) {
			for (++p; ans[p] != 0; ++p);
			if (p < a[i]) {
				puts("No");
				return 0;
			}
			ans[p] = i;
		}
	}
 
	puts("Yes");
	iter(i, n * n) printf("%d ", ans[i]); puts("");
	return 0;
}

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

int main()
{
  ll n,k,s;
  cin>>n>>k>>s;
  for(ll i=0;i<n;i++)
  {
    if(i<k)
      cout<<s<<" ";
    else
      cout<<"43233423 ";
  }
  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const int N=2e5+5;
const int MOD=1e9+7;
int a[N];

int b[N];

char s[N];
char t[N];
ll f[N];
int used[15];


multiset<int> ss;
map<int,int>mp;
typedef pair<double,int> P;//first是值，second是index
struct cmp
{
    bool operator()(const P p1, const P p2)
    {
        if(p1.first < p2.first)
            return 1;
        if(p1.first==p2.first){
            return p1.second>p2.second;
        }
        return 0;
    }
};

int main()
{

    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>a[i];
    int l=1;
    int r=1e9;
    int ans=1e9;
    while(l<r){
        int mid=(l+r)/2;
        int sum=0;
        for(int i=1;i<=n;i++){
            if(mid>a[i]){
                continue;
            }
            sum+= ceil((double)a[i]/mid)-1;
        }
        //cout<<sum<<endl;
        if(sum>k){
           l=mid+1;
        }
        else{
           r=mid;
        }
    }
    cout<<l<<endl;
}



Measured memory_bytes: 4400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0; i<n; i++)
int main()
{
	ll N,x,y;
	cin >> N;
	cin >> x >> y;
	ll maxA = x+y;
	ll minA = x+y;
	ll maxB = x+1000000000-y;
	ll minB = x+1000000000-y;
	for(int i = 1; i<N; i++){
		cin >> x >> y;
		if(maxA < x+y)
			maxA = x+y;
		if(minA > x+y)
			minA = x+y;
		if(maxB < x+1000000000-y)
			maxB = x+1000000000-y;
		if(minB > x+1000000000-y)
			minB = x+1000000000-y;
	}

	ll max1 = maxA - minA;
	ll max2 = maxB - minB;
	
	if(max1>max2)
		cout << max1;
	else
		cout << max2;

	cin >> N;
	return 0;	
}


Measured memory_bytes: 3564
from itertools import combinations

n = int(input())
r = range(n)
a = [(set(), set()) for _ in r]
for i in r:
  for _ in range(int(input())):
    x, y = map(int, input().split())
    a[i][y].add(x - 1)

fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1].issubset(x) for i in x)

while all(map(fail, combinations(r, n))):
  n -= 1
print(n)


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

struct unionFind{

    vector<int> par, rank;

    void init(int n){
        par.resize(n);
        rank.resize(n, 0);
        for(int i = 0 ; i < n ; ++i){
            par[i] = i;
        }
        return;
    }

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

    bool unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry){
            return false;
        }
        if(rank[rx] < rank[ry]){
            par[rx] = ry;
        }else if(rank[rx] == rank[ry]){
            par[rx] = ry;
            rank[ry]++;
        }else{
            par[ry] = rx;
        }
        return true;
    }

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

};

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

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

    vector< vector<int> > g(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    deque<int> ans = {0, g[0][0]};

    unionFind uf;
    uf.init(n);
    uf.unite(0, g[0][0]);

    bool flag = true;
    while(flag){
        flag = false;
        for(auto x : g[ans.front()]){
            if(uf.unite(ans.front(), x)){
                flag = true;
                ans.push_front(x);
                break;
            }
        }
        for(auto x : g[ans.back()]){
            if(uf.unite(ans.back(), x)){
                flag = true;
                ans.push_back(x);
                break;
            }
        }
    }

    cout << ans.size() << endl;

    rep(i, ans.size()){
        cout << ans[i] + 1;
        if(i < i_len - 1){
            cout << " ";
        }else{
            cout << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 7552
#include<bits/stdc++.h>
using namespace std;
int n,q,L[200050],R[200050],c[200050];
vector<int>v[200050];
void dfs(int x,int f)
{
	L[x]=++L[0];
	for(int i=0;i<v[x].size();i++)
		if(v[x][i]!=f)dfs(v[x][i],x);
	R[x]=L[0];
}
int main()
{
	cin>>n>>q;
	for(int i=1,x,y;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		v[x].push_back(y);
		v[y].push_back(x);
	}
	dfs(1,0);
	for(int i=1,x,co;i<=q;i++)
	{
		scanf("%d%d",&x,&co);
		c[L[x]]+=co;
		c[R[x]+1]-=co;
	}
	for(int i=1;i<=n;i++)c[i]+=c[i-1];
	for(int i=1;i<=n;i++)printf("%d ",c[L[i]]);
}


Measured memory_bytes: 28160
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    # S = [x for x in sys.stdin.readline().split()][0]  # 文字列 一つ
    # N = [int(x) for x in sys.stdin.readline().split()][0]  # int 一つ
    H, A = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)]  # 文字列grid
    # grid = [[int(x) for x in sys.stdin.readline().split()]
    #         for _ in range(N)]  # int grid

    logger.debug('{}'.format([]))

    print(math.ceil(H / A))


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """10 4"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """1 10000"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """10000 1"""
        output = """10000"""
        self.assertIO(input, output)


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

use std::cmp::Reverse;
use std::collections::BinaryHeap;

#[fastout]
fn main() {
    input! {
        (n, m): (usize, usize),
        abs: [(usize, usize); m]
    };

    let mut edges = vec![vec![]; n + 1];

    for (a, b) in abs {
        edges[a].push(b);
        edges[b].push(a);
    }

    let mut dp = vec![std::usize::MAX; n + 1];
    let mut arrow = vec![0; n + 1];

    let mut heap = BinaryHeap::new();

    heap.push(Reverse((0, 1, 0)));

    while let Some(Reverse((cost, pos, pre))) = heap.pop() {
        if dp[pos] <= cost {
            continue;
        }

        dp[pos] = cost;
        arrow[pos] = pre;

        for &n in edges[pos].iter() {
            heap.push(Reverse((cost + 1, n, pos)));
        }
    }

    for i in 1..=n {
        if dp[i] == std::usize::MAX {
            println!("No");
            return;
        }
    }

    println!("Yes");

    for i in 2..=n {
        println!("{}", arrow[i]);
    }
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define PRINT(a)   cout << (a) << endl
#define RALL(v) rbegin(v), rend(v)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  int H,W,K;
  cin >> H >> W >> K;
  vector<vector<char>> c(H, vector<char>(W));
  REP(i,H)REP(j,W)cin >> c[i][j];

  int ans=0;
  // i 縦、j 横
  REP(i,(1<<H))REP(j,(1<<W)){
    int cnt=0;
    REP(k,H){
      if((i>>k)&1)continue;
      REP(l,W){
        if((j>>l)&1)continue;
        if(c[k][l]=='#')cnt++;

      }
    }
    if(cnt==K)ans++;
  }
  PRINT(ans);
}



Measured memory_bytes: 3628
A,B,K = (int(i) for i in input().split())

if (2*K) >= (B-A+1):
    for i in range(A,B+1):
        print(i)
else:
    for i in range(K):
        print(A+i)
    for i in range(K):
        print(B-(K-i)+1)
    

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;

signed _main(){
  string S; cin >> S;
  string s1="dream",s2="dreamer",s3="erase",s4="eraser";
  rep(i,S.size()){
    bool flag=true;
    for(int j=i;j<i+5;j++){
      if(j<S.size() && S[j]==s1[j-i]);
      else{
        flag=false;
        break;
      }
    }
    if(flag){
      if((i+6<S.size() && S[i+5]=='e' && S[i+6]=='r') && (i+7>=S.size() || S[i+7]!='a')){
        i+=6;
        continue;
      }
      else{
        i+=4;
        continue;
      }
    }
    flag=true;
    for(int j=i;j<i+5;j++){
      if(j<S.size() && S[j]==s3[j-i]);
      else{
        flag=false;
        break;
      }
    }
    if(flag){
      if(i+5<S.size() && S[i+5]=='r'){
        i+=5;
        continue;
      }
      else{
        i+=4;
        continue;
      }
    }
    if(!flag){
      cout << "NO" << endl;
      return 0;
    }

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


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

int main()
{
	int N, K, Q;

	cin >> N >> K >> Q;
	vector<int> pts(N, K);
	unordered_map<int, int> m;

	for (int i = 0; i < Q; i++)
	{
		int num;
		cin >> num;
		m[num]++;
	}

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

Measured memory_bytes: 5156
#include <bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define S second
const int INF = 987654321;
const int MOD = (int)1e9+7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dy[4] = {-1, 0, 1, 1};
int dx[4] = {0, 1, 0, 1};

int main(void) {
	//freopen("in.txt", "r", stdin);
	int n;
	cin >> n;
	rep(i,1,10) {
		if(n%i==0) {
			if(n/i >= 1 && n/i <= 9) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int main() {
  int n,i,f;
  while(cin >> n) {
      f=0;
	  for (i=1; i<513; i*=2) if ((n & i) !=0) {
		  if (f==1) cout << ' '; else f=1;
		  cout << i ;
	  }
	  cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
int ans = 0;
int main (){
	string a;
	cin >> a;
	for (int i = 0; i < 3; i++) {
		char m = a.at(i);
		if (m == '1') ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
ans=[]
count=[]
n=0
for i in range(1,N+1):
    n+=i
    count.append(n)
num=0
for i in range(N):
    if count[i]>N:
        num=i
        break
if N==1:
    print(1)
    exit()
sa=count[num]-N
#print(sa)
for i in range(1,num+2):
    if sa==i:
        continue
    ans.append(i)
for i in range(len(ans)):
    print(ans[i])

Measured memory_bytes: 187296
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#define FOR(i, a, b)  for(int i=a; i<b; ++i)
#define rFOR(i, a, b) for(int i=a-1; i>=b; --i)
#define REP(i, n) for(int i=0; i<n; ++i)
#define rREP(i, n) for(int i=n-1; i>=0; --i)
#define all(a)  a.begin(), a.end()
using namespace std;

struct POINT{
  int x, y;

  bool operator<(const POINT& right) const {
    return x < right.x;
  }
};

int main(){
  int n, p;
  while(true){
    cin >> n >> p;
    int ans = p;
    bool flag = false;
    if(n == 0 && p == 0) break;
    int have[n];
    REP(i, n) have[i] = 0;

    while(true){
      REP(i, n){
        if(p > 0){
          have[i]++;
          p--;
          if((p == 0) && (have[i] == ans)){
            cout << i << endl;
            flag = true;
          }
        }else if(p == 0){
          p += have[i];
          have[i] = 0;
        }
      }
      if(flag == true)  break;
    }
  }

  return 0;
}



Measured memory_bytes: 3008