akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	int pn = 1;
	if (*ci == '-') {
		pn = -1;
		ci++;
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return pn * tmp;
}

void pakuri_sort(int N, ll A[]) {
	const int b = 8;
	ll tmp[200001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N = getint();
	ll A[200001];
	A[0] = 0;
	rep1(i, N) {
		A[i] = getint() + A[i - 1];
	}

	pakuri_sort(N + 1, A);

	ll kotae = 0;
	int kazu = 1;
	rep(i, N) {
		if (A[i + 1] != A[i]) kazu = 1;
		else kotae += kazu++;
	}

	printf("%lld\n", kotae);

	Would you please return 0;
}

Measured memory_bytes: 6416
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int N, M, K, H, W, L, R, X;
//string S, T;

signed main(){
  cin >> N >> M;
  int ans = 0;
  int amari;
  if(2*N >= M) ans = M/2;
  else ans = (M-2*N)/4+N;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    t = LI()
    a = LI()[::-1]
    dt = [None] * n
    da = [None] * n
    ba = 0
    bt = 0
    for i in range(n):
        if bt < t[i]:
            dt[i] = (1, t[i])
            bt = t[i]
        else:
            dt[i] = (bt, bt)
    for i in range(n):
        if ba < a[i]:
            da[i] = (1, a[i])
            ba = a[i]
        else:
            da[i] = (ba, ba)
    da = da[::-1]
    ans = 1
    for i in range(n):
        f = True
        if da[i][0] == 1:
            if da[i][1] > dt[i][1]:
                print(0)
                return
            f &= 0
        if dt[i][0] == 1:
            if da[i][1] < dt[i][1]:
                print(0)
                return
            f &= 0
        if f:
            ans *= min(da[i][1], dt[i][1])
            ans %= mod
    print(ans)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 80868
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 

*/
// clang-format off
/* }}} */

#include <bits/stdc++.h>
using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

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

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {
  REP(i, v.size()) print(v[i]);
}
template <typename T> inline void print(const vector<T>& v, string s = " ") {
  REP(i, v.size()) {
    if (i != 0) cout << s;
    cout << v[i];
  }
  cout << '\n';
}
// clang-format on
/* }}} */

int n, t;

signed main() {
  cin >> n >> t;
  int mi = INF, d = 0;
  int cnt = 0;
  REP(_, n) {
    int a = in();
    chmin(mi, a);
    if (a - mi > d) {
      cnt = 0;
      d = a - mi;
    }
    if (a - mi == d) ++cnt;
  }
  print(cnt);

  return 0;
}


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

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

  bool s_exists = false;
  bool n_exists = false;
  bool e_exists = false;
  bool w_exists = false;
  for (auto c: s) {
    s_exists |= c == 'S';
    n_exists |= c == 'N';
    e_exists |= c == 'E';
    w_exists |= c == 'W';
  }

  if (s_exists ^ n_exists) {
    cout<<"No"<<endl;
  } else if (e_exists ^ w_exists) {
    cout<<"No"<<endl;
  } else {
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
#define pii pair < int , int >
#define vi vector < int >
#define pb push_back
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define init(x, a) memset(x, a, sizeof(x))
#define vll vector < long long int >
#define sll set < long long int >
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
struct city
{
	ll yen, snook;
}dp[100001];
ll n,ini;
vector < pair < ll , pair < ll , ll > > > graph[100001];

void bfs(ll st,ll currency)
{
	queue < ll > q;
	ll i,vis[100001];
	Fo(i,1,n+1)vis[i]=0;
	q.push(st);
	while(!q.empty())
	{
		ll x = q.front();
		q.pop();
		for(auto y:graph[x])
		{
			if(currency==0)
			{
				if(dp[y.F].yen>dp[x].yen+y.S.F)
				{
					dp[y.F].yen = dp[x].yen+y.S.F;
					q.push(y.F);
				}
			}
			else
			{
				if(dp[y.F].snook>dp[x].snook+y.S.S)
				{
					dp[y.F].snook = dp[x].snook+y.S.S;
					q.push(y.F);
				}
			}
		}
	}
}

int main()
{
	fastIO;
	ini = 1e15;
	ll m,s,t,i,j,k,p,q;
	multiset < ll > mst;
	multiset < ll >::iterator it;
	ll broad[100001];
	cin>>n>>m>>s>>t;
	fo(i,m)
	{
		cin>>j>>k>>p>>q;
		graph[j].pb({k,{p,q}});
		graph[k].pb({j,{p,q}});
	}
	Fo(i,1,n+1)dp[i].yen = dp[i].snook = 1e17;
	dp[s].yen = 0;
	dp[t].snook = 0;
	bfs(s,0);
	bfs(t,1);

	//Fo(i,1,n+1)cout<<dp[i].yen<<" "<<dp[i].snook<<endl;

	Fo(i,1,n+1)
	{
		broad[i] = ini - dp[i].yen - dp[i].snook;
		mst.insert(broad[i]);
	}

	Fo(i,1,n+1)
	{
		cout<<(*mst.rbegin())<<endl;
		mst.erase(mst.find(broad[i]));
	}

	return(0);
}

Measured memory_bytes: 17792
#include <bits/stdc++.h>
#define rep(i, e, n) for (int i = e; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,ll>;
const ll inf=1000000000007;
const int mod=1000000007;


int main() {
  int n,m; cin >> n >> m;
  vector<int> a(m);

  rep(i,0,n){
    int k;
    cin >> k;
    rep(j,0,k){
      int ak;
      cin >> ak;
      ak--;
      a[ak]++;
    }
  }
  int ans=0;
  rep(i,0,m){
    if(a[i]==n) ans++;
  }
  cout << ans << endl;


  return 0;

}


Measured memory_bytes: 3580
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
const int N = 2e5 + 10;
 
int main(){
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n - 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n - 1; i++) {
    cin >> c[i];
  }
  int ans = b[a[0]];
  for (int i = 1; i < n; i++) {
    ans += b[a[i]];
    if (a[i] - a[i - 1] == 1) {
      ans += c[a[i - 1]];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
int N;
int A[100];
void Calc(){
	N = rei();
	int sum = 0;
	for(int i=0;i<N;i++){
		A[i] = rei();
		sum += A[i];
	}
	pair<int,int> ans = {10000000,0};
	for(int i=0;i<N;i++){
		if(max(sum-A[i]*N,A[i]*N-sum) < ans.first){
			ans = {max(sum-A[i]*N,A[i]*N-sum),i};
		}
	}
	cout << ans.second << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<int>;
const int maxn = 1<<18, rt = 1<<10;
int f[maxn];
void add(int x) {
	for(x += maxn/2; x < maxn; x += x&-x) f[x]++;
}
int get(int x) {
	int res = 0;
	for(x += maxn/2; x; x -= x&-x) res += f[x];
	return res;
}
int n, a[maxn];
ll all = 0;
void read() {
	cin >> n;
	all = n * 1ll * (n+1) / 2;
	for(int i = 1; i <= n; i++) cin >> a[i];
}
bool check(int x) {
	memset(f, 0, sizeof f);
	ll cnt = 0;
	add(0);
	for(int p = 0, i = 1; i <= n; i++) {
		int t = a[i] < x ? -1 : 1;
		//cout << t << " ";
		p += t;
		add(p);
		cnt += i+1-get(p);
	}
	//cout << '\n';
	//cout << x << " " << cnt << '\n';
	//cout << "Verdict: " << (cnt >= all-cnt) << '\n';
	return cnt > all-cnt;
}
void solve() {
	int ans = 0;
	for(int i = 1<<30; i >>= 1;) {
		if(!check(ans + i)) ans += i;
	}
	cout << ans << '\n';
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	read();
	solve();
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>

using namespace std;

long long gcd(long long a, long long b)
{
	if (b) {
		return gcd(b, a % b);
	}
	else {
		return a;
	}
}

int main()
{
	long long n, m;
	string s, t;

	long long dn, dm;
	long long gcd_nm, lcm_nm;

	cin >> n >> m;
	cin >> s >> t;

	gcd_nm = gcd(n, m);
	lcm_nm = n * m / gcd_nm;
	dn = n / gcd_nm;
	dm = m / gcd_nm;

	int i = 0, j = 0;

	do {
		if (s[i] != t[j]) {
			break;
		}
		i += dn;
		j += dm;
	} while (i < n);

	if (i == n) {
		cout << lcm_nm << endl;
	}
	else {
		cout << -1 << endl;
	}


}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

int main() {
  char c;
  cin >> c;
  if(std::tolower(c) != c) {
    cout << "A" << endl;
  }
  else {
    cout << "a" << endl;
  }
}


Measured memory_bytes: 3596
#include "bits/stdc++.h"
 
using namespace std;
 
#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009
#define pi 3.141592653589793238
 
typedef pair<int, int> P;
 

void solve(long long N, long long K, std::vector<long long> h){
    int ans = 0;
    REP(i,N){
        if(h[i]>=K) ans++;
    }
    cout<<ans<<endl;
}
 
signed main(){
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> h(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&h[i]);
    }
    solve(N, K, std::move(h));
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll N;
  int h, n, w;
  cin >> N;

  for (h = 1; h < 3501; h++) {
    for (n = 1; n < 3501; n++) {
      if ((4*h*n-N*n-N*h) > 0 && (N*h*n)%(4*h*n-N*n-N*h) == 0) {
        w = int((N * h * n) / (4 * h * n - N * n - N * h));
        printf("%d %d %d\n", h, n, w);
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3776
class UnionFind():
    def __init__(self,n):
        self.n=n
        self.parents=[-1]*n

    def find(self,x): #根を見つける、繋ぎ直す
        if self.parents[x]<0:
            return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]
    
    def unite(self,x,y): #x,yの含むグループを併合する
        x=self.find(x)
        y=self.find(y)

        if x==y:
            return
        
        if self.parents[x]>self.parents[y]:
            x,y=y,x

        self.parents[x]+=self.parents[y]
        self.parents[y]=x
        
    def same(self,x,y):
        return self.find(x)==self.find(y)
      
    def members(self,x):
        return -self.parents[self.find(x)]
   
def main():
    import sys
    input=sys.stdin.readline
    n,m=map(int,input().split())
    bridges=[tuple(map(int,input().split())) for i in range(m)]
    
    uf=UnionFind(n)
    inco=[n*(n-1)//2]
    for i in range(m-1):
        a,b=bridges[m-i-1]
        a,b=a-1,b-1
        if uf.same(a,b):
          t=inco[i]
        else:
          t=inco[i]-uf.members(a)*uf.members(b)
        if uf.members(a)==n:
          t=0
        uf.unite(a,b)
        inco.append(t)
    print(*inco[::-1],sep='\n')

if __name__=='__main__':
    main()


Measured memory_bytes: 25236
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];
ll a[N];

int main() {
    FAST;
    ll t, i, j, k, p, q, r, x, y, u, v, n, m;
    string s;
    cin>>s;
    if(s[0]=='A' && s[1]=='A' && s[2]=='A')
    {
      cout<<"No";
      return 0;
    }
    if(s[0]=='B' && s[1]=='B' && s[2]=='B')
    {
      cout<<"No";
      return 0;
    } 
    cout<<"Yes";
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 7552
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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 dp[105][4][2];

signed main() {
  init();
  string s;
  cin >> s;
  ll n = s.size();
  ll K;
  cin >> K;
  dp[0][0][0] = 1;
  rep(i, n) {
    rep(j, 4) {
      rep(k, 2) {
        ll nd = s[i] - '0';
        rep(d, 10) {
          ll ni = i + 1;
          ll nj = j;
          ll nk = k;
          if (d != 0) nj++;
          if (nj > K) continue;
          if (k == 0) {
            if (d > nd) continue;
            if (d < nd) nk = 1;
          }
          dp[ni][nj][nk] += dp[i][j][k];
        }
      }
    }
  }
  ll ans = dp[n][K][0] + dp[n][K][1];
  COUT(ans);
  return 0;
}

Measured memory_bytes: 3668
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<stack>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#include<time.h>
#include<cmath>
#include<functional>
#include<cassert>
#define rep(a,b) for(ll a=0;a<b;++a)
#define REP(a,b,c,d) for(ll a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_i = pair<int, int>;
int main() {
    int A,B,C;cin>>A>>B>>C;
    if(A+B>=C){
        cout<<B+C<<endl;
        return 0;
    }
    cout<<A+2*B+1<<endl;
}

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 x, t;
  cin >> x >> t;
  if (x>=t) {
    cout << x-t << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

const char* ans[7] = {
	"Monday",
	"Tuesday",
	"Wednesday",
	"Thursday",
	"Friday",
	"Saturday",
	"Sunday"
};

int main(){

	int month, date;

	while (std::cin >> month >> date, month || date){
		int day = 2;

		for (int i = 1; i < month; i++){
			int numdate = 31;
			if (i == 4 || i == 6 || i == 9 || i == 11)numdate = 30;
			else if (i == 2)numdate = 29;

			day = (day + numdate) % 7;
		}

		day = (day + date) % 7;

		std::cout << ans[day] << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N;
  cin >> N;
  string S;
  cin >> S;
  vector<long> ws(N), es(N);
  rep (i, N) {
    if (i > 0) {
      ws[i] = ws[i-1];
      es[i] = es[i-1];
    }
    if (S[i] == 'E') es[i]++;
    else ws[i]++;
  }
  long ans = min(es[N-1]-es[0], ws[N-2]);
  for (long i = 1; i < N-1; i++) {
    ans = min(ans, ws[i-1] + es[N-1] - es[i]);
  }
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N;
  map<string, int> S;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    S[s] += 1;
  }
  cin >> M;
  map<string, int> T;
  for (int i = 0; i < M; i++) {
    string t;
    cin >> t;
    T[t] += 1;
  }
  int res = 0;
  for (auto itr = S.begin(); itr != S.end(); itr++)
    res = max({res, 0, S[itr->first] - T[itr->first]});
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
i, j = map(int, input().split())
a = []
b = []
result = []
for _ in range(i):
	a.append(list(map(int, input().split())))
for _ in range(j):
	b.append(int(input()))
for x in range(i):
	sum = 0
	for y in range(j):
		sum += a[x][y]*b[y]
	result.append(sum)
print (*result, sep="\n")

Measured memory_bytes: 8052
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>

template<typename T>
void fin(T const& v){ std::cout << v << std::endl; exit(0); }
int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  std::vector<int> tsum(N+1), vmax(N);

  // unit = 0.5
  tsum[0] = 0;
  for(int i = 0; i < N; ++i) {
    int t; std::cin >> t; tsum[i+1] = tsum[i] + t + t;
  }
  for(auto& vi: vmax) { std::cin >> vi; vi += vi; }

  std::vector<int> v(tsum[N]+1, 200);
  v[0] = 0;
  for(int i = 0; i < N; ++i) {
    int tb = tsum[i], te = tsum[i+1];
    for(int t = tb; t < te; ++t) {
      v[t+1] = std::min(v[t]+1, vmax[i]);
    }
  }
  v[tsum[N]] = 0;
  for(int i = N; i > 0; --i) {
    int tb = tsum[i], te = tsum[i-1];
    for(int t = tb; t > te; --t) {
      int nv = std::min(v[t]+1, vmax[i-1]);
      v[t-1] = std::min(v[t-1], nv);
    }
  }
  int ans = 0;
  for(int i = 0; i < tsum[N]; ++i) ans += v[i] + v[i+1];
  char const *points[] = { "", ".125", ".25", ".375", ".5", ".625", ".75", ".875" };
  std::cout << ans/8 << points[ans%8] << std::endl;
  return 0;
}


Measured memory_bytes: 384
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

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

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class BCommonRaccoonVsMonster {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int h, n; cin >> h >> n;
      vector<int> a(n);
      rep(i, n){
        cin >> a[i];
        h -= a[i];
      }
      if (h <= 0) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }


    }
};

signed main() {
  BCommonRaccoonVsMonster solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000007
#define loo 10000000000000007

#define prime 1000000007

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int v[100100];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n; cin >> n;
    for (int i = 0; i < n; ++i){
        cin >> v[i];
    }
    sort(v, v+n);
    reverse(v, v+n);
    int a = 0, b = 0;
    for (int i = 0; i < n; ++i){
        if(i%2) b+=v[i];
        else a+=v[i];
    }
    cout << a-b << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#define LEN 100005
using namespace std;

struct Process {
    char name[10];
    int t;
};

Process ps[LEN];
int head, tail;

void enq(Process p) {
    ps[(tail++)%LEN] = p;
}

Process deq() {
    return ps[(head++)%LEN];
}

int main(void){
    // Your code here!
    int n, q, elaps=0, consumed;
    scanf("%d %d", &n, &q);
    head = 1;
    tail = n+1;
    Process u;

    for (int i = 1; i <= n; i++) {
        scanf("%s", ps[i].name);
        scanf("%d", &ps[i].t);
    }
    while (head != tail) {
        u = deq();
        consumed = min(u.t, q);
        u.t -= consumed;
        elaps += consumed;
        if (u.t > 0) {
            enq(u);
        }
        else {
            printf("%s %d\n", u.name, elaps);
        }
    }
    return 0;
}



Measured memory_bytes: 4156
# AtCoder Beginner Contest 176
# C - Step

N=int(input())
Als=list(map(int,input().split()))

ans=0

for i in range (1,N):
    if Als[i]>=Als[i-1]:
        pass
    else :
        step=abs(Als[i]-Als[i-1])
        ans+=step
        Als[i]+=step
print(ans)

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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

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

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
int n, k, q;
     
int a[Sz];

int b[Sz];

bool check (int l, int r) {
  int rem = 0;
  int cnt = 0, len = 0;
  for (int i = 1; i <= n; i++) {
    if (l <= a[i]) {
      len++;
      cnt += (a[i] <= r);
    }
    if (a[i] < l || i == n) {
      rem += min (max (0, len - k + 1), cnt);
      len = cnt = 0;
    }
  }
  return rem >= q;
}
             
int solve (int id) { 
  int mn = b[id];
  int l = id, r = n, mx = -1;
  while (l <= r) {
    int mid = (l+r) >> 1;
    if (check (mn, b[mid])) {
      r = mid-1;
      mx = b[mid];
    }
    else
      l = mid+1;
  }
  if (~mx)
    return mx - mn;
  else
    return MX;                           
}     
                     
int main()
{                                  
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  cin >> n;
  cin >> k >> q;
  for (int i = 1; i <= n; i++)  
    cin >> a[i];     
                              
  for (int i = 1; i <= n; i++)
    b[i] = a[i];
  sort (b + 1, b + n + 1);
       
  int ans = MX;
  for (int i = 1; i <= n; i++)
    ans = min (ans, solve (i));
  cout << ans;

  return 0;
}






// Coded by Z..



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

void ModuloSummation()
{
  int n;
  cin >> n;
  int res = 0;
  for (int i = 0; i < n; i++)
  {
    int a;
    cin >> a;
    res += a - 1;
  }
  
  cout << res << endl;
  return;
}

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

Measured memory_bytes: 256
N=int(input())
X=[0 for i in range(N)]
if N%2==0:
    for i in range(N//2):
        X[i]=i+1
        X[-i-1]=i+1
else:
    for i in range(N//2):
        X[i]=i+1
        X[-i-2]=i+1
    X[-1]=N//2+1
edge=[]
for i in range(N):
    for j in range(N):
        if i<=j:
            continue
        if X[i]!=X[j]:
            edge.append((i+1,j+1))
print(len(edge))
for line in edge:
    x,y=line
    print(x,y)


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

int main() {
  int H = 0, W = 0;
  cin >> H >> W;
  
  vector< vector<bool> > grids(H,vector<bool>(W));
  
  for (int h = 0; h < H; h++) {
    for (int w = 0; w < W; w++) {
      char tmp;
      cin >> tmp;
      
      if (tmp == '.') grids[h][w] = false;
      else grids[h][w] = true;
    }
  }
  
  for (int h = 0; h < H; h++) {
    for (int w = 0; w < W; w++) {
      if (grids[h][w]) {
        cout << "#";
        continue;
      }
      // 各マスに対して、その周囲の爆弾マスを数える
      int bombs = 0;
      for (int n = -1; n < 2; n++) {
        for (int m = -1; m < 2; m++) {
          bool h_is_valid = h + n >= 0 and h + n < H;
          bool w_is_valid = w + m >= 0 and w + m < W;
          if (h_is_valid and w_is_valid) {
            // もし、参照可能範囲内なら
            bombs += grids[h + n][w + m];
          }
        }
      }
      cout << bombs;
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;

int main(){
    int N,K;
    cin >> N >>K;
    int h[N];

    for (int i=0;i<N;i++){
        cin >> h[i];
    }
    int count=0;
    for (int i=0;i<N;i++){
        if(h[i]>=K){
            count++;
        }
    }

    cout << count;
}

Measured memory_bytes: 640
package main

import "fmt"

func main() {
    var a, b int
    fmt.Scan(&a, &b)

    if a+b == 15 {
        fmt.Println("+")
    } else if a * b == 15 {
        fmt.Println("*")
    } else {
        fmt.Println("x")
    }
}

Measured memory_bytes: 512
'use strict'

const Main = (input) => {
  const N = parseInt(input.trim())

  const divisors = []

  for (let i = 1; i <= Math.sqrt(N); i++) {
    if ((N % i) === 0) {
      divisors.push(i)
    }
  }

  const result = (N / Math.max.apply(null, divisors)) + Math.max.apply(null, divisors) - 2

  console.log(result)
  return result
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 12108
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)
var mod int64
func main() {
	scan_init()
	n := scanInt()
	mod = int64(math.Pow(10,9)+7)
	a := make([]int64, n)
	for i:= 0; i<n; i++ {
		a[i] = int64(scanInt())
	}
	var sum int64
	sum = 0
	rusekiOne := make([]int64, n)
	for i:= 0; i<n-1; i++ {
		rusekiOne[i+1] = ((rusekiOne[i] + a[i+1]))%mod
	}
	sum += (rusekiOne[n-1]*a[0])%mod
	for i:=1; i<n-1; i++ {

		get := ((rusekiOne[n-1]%mod+mod) - (rusekiOne[i])%mod)%mod
		// fmt.Println(get,"確認")
		sum += a[i]*get % mod
	}
	fmt.Println(sum%mod)


}

var sc = bufio.NewScanner(os.Stdin)

func scan_init() {
	sc.Split(bufio.ScanWords)
}
func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func scan() string {
	sc.Scan()
	return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 200000)

func readLine() string {
	buf := make([]byte, 0, 200000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}
func readLineToNumber() int {
	S := readLine()
	number, _ := strconv.Atoi(S)
	return number
}
func readLineToSlice() []string {
	S := readLine()
	list := strings.Split(S, "")
	return list
}
func readLineToNumberSlice(memo map[string]int) []int {
	// err時は-1を代入
	S := readLine()
	intList := make([]int, len(S))
	for i := 0; i < len(S); i++ {
		if val, ok := memo[string(S[i])]; ok {
			intList[i] = val
		} else {
			intList[i] = -1
		}
	}
	return intList
}

Measured memory_bytes: 7564
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define pi 3.141592653589793238

int main()
{
    int t=1;
    //cin>>t;


    while( t-- )
    {
        int n;
        cin>>n;

        int ctr=0;
        bool chk=0;
        for( int i=0 ; i<n ; i++ )
        {
            int d1,d2;
            cin>>d1>>d2;

            if( d1==d2 )
            {
                ctr++;
                if( ctr==3 )
                    chk=1;
            }
            else
                ctr=0;

        }

        if(chk)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;

    }
    return 0;
}


Measured memory_bytes: 3632
a, b = map(int, input().split())
ans = ''
if a > 0 and b > 0:
  ans = 'Positive'
elif a <= 0 and b >= 0:
  ans = 'Zero'
elif a < 0 and  b < 0:
  if (b - a) % 2 == 0:
    ans = 'Negative'
  else:
    ans = 'Positive'
print(ans)

Measured memory_bytes: 9096
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define ll long long
#define bit(x,i) (x&(1<<i))
#define pi 3.1415926535897932384626
#define pb push_back
#define pf push_front
#define mt make_tuple
#define ff first
#define ss second
#define debug(x) cout << #x " = " << (x) << endl
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define endl '\n'
#define EPS 1e-9
#define INF 1e18
#define ALL(x) for(int i=0; i<x; i++)
#define fori(a,b,c) for(int a=b; a<c; a++)
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define m0(x) memset((x), 0, sizeof(x))
#define m1(x) memset((x), -1, sizeof(x))

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef __gnu_pbds::tree<int, __gnu_pbds::null_type, std::less<int>, __gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update> indexed_set;

inline int mod(int n){ return (n%1000000007); }

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

int fpow(int x, unsigned int y, int p){ 
    int res = 1;
    x = x % p;
    while (y > 0){
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
} 
const int maxn = 1e5+10;

int32_t main(){
	DESYNC;
    int x, y;
    cin>>x>>y;
    
    for(int i=0; i<=x; i++)
        if(2*i + 4*(x-i) == y){
            return cout<<"Yes\n", 0;
        }

    puts("No");
}

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

long long mod = 1000000007;
long long N, A, B;
long long dp[6009][6009][2];
long long ru[6009][6009];
long long power[6009];
long long Answer;

void init() {
	power[0] = 1;
	for (int i = 1; i <= 5000; i++) power[i] = (2LL * power[i - 1]) % mod;
}

void solve(int pos) {
	// 累積和を取る
	for (int i = 0; i <= N; i++) {
		ru[pos][i] = ru[pos - 1][i];
		ru[pos][i] += dp[pos - 1][i][0];
		ru[pos][i] %= mod;
	}

	// 長い方を使う場合
	for (int i = 0; i <= N; i++) {
		dp[pos][i][0] += dp[pos - 1][i][1];
		dp[pos][i][0] += dp[pos - 1][i][0];
		dp[pos][i][0] %= mod;
		if ((pos - i) >= A) {
			Answer += dp[pos][i][0] * power[N - pos];
			Answer %= mod;
			dp[pos][i][0] = 0;
		}
	}

	// 短い方を使う場合（そして失敗する場合）
	long long rem = 0;
	for (int i = 0; i <= N; i++) {
		int cl = max(0LL, pos - B + 1), cr = max(-1, pos - 1);
		rem += (ru[cr + 1][i] - ru[cl][i] + mod) % mod;
		rem %= mod;
	}
	dp[pos][pos][1] = rem;

	// 短い方を使う場合（そして成功する場合）
	for (int i = 0; i <= N; i++) {
		int cr = max(-1LL, pos - B);
		long long val = ru[cr + 1][i];
		dp[pos][i][1] += val;
		if ((pos - i) >= A) {
			Answer += dp[pos][i][1] * power[max(0LL, N - pos - 1)];
			Answer %= mod;
			dp[pos][i][1] = 0;
		}
	}
}

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

	dp[0][0][0] = 1;
	for (int i = 1; i <= N; i++) solve(i);
	cout << Answer << endl;
	return 0;
}

Measured memory_bytes: 629616
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
#include <atcoder/math>
typedef long long ll;
using namespace std;
using namespace atcoder;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll t,n,m,a,b;
    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> n >> m >> a >> b;
        cout << floor_sum(n, m, a, b) << endl;
    }
    return 0;
}


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

using namespace std;



int main() {
	string s;
	cin >> s;
	int n = 0;
	for (auto& itr : s) {
		if (itr == '0') {
			n++;
		}
	}
	cout << 2 * min(n,(int) s.size() - n);
	return 0;
}


Measured memory_bytes: 512
using System;
using static System.Console;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Diagnostics;

namespace ConsoleApplication1
{
    internal class Program
    {

        public static void Main(string[] args)
        {
            var nums = ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();
            long A = nums[0];
            long B = nums[1];
            WriteLine(factorize(gcd(A, B)).Count);
        }

        static long gcd(long x, long y)
        {
            return (y == 0) ? x : gcd(y, x % y);
        }

        static List<ValueTuple<long, int>> factorize(long n)
        {
            var list = new List<ValueTuple<long, int>>();
            list.Add(new ValueTuple<long, int>(1, 1));
            for (long i = 2; i * i < n; i++)
            {
                if (n%i != 0) continue;
                int divideCount = 0;
                while (n%i == 0)
                {
                    n /= i;
                    divideCount++;
                }
                list.Add(new ValueTuple<long, int>(i, divideCount));
            }
            if (n != 1) list.Add(new ValueTuple<long, int>(n, 1));
            return list;
        }
      
        public struct ValueTuple<T1, T2>{
          public T1 item1;
          public T2 item2;
          public ValueTuple(T1 a, T2 b){
            item1 = a;
            item2 = b;
          }
        }
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main (){
        long long N;
        long long Ans;
        long long tmp;
        long long arr[200005] = {};
        long long Max = 0;
        cin >> N;

        for (long long i = 1; i <= N; i++) {
                cin >> tmp;
                arr[tmp] = arr[tmp-1] +1;
        }

        for (long long i = 1; i <= N; i++) {
                Max = max(Max,arr[i]);
        }

        Ans = N - Max;
        cout << Ans<< endl;
}


Measured memory_bytes: 1792
import sys
input = sys.stdin.readline
  
def solve():
  n = int(input())
  a = list(int(i) for i in input().split())
  b = list(int(i) for i in input().split())
  
  if sum(a) < sum(b):
    print(-1)
    exit()
  else:
    sabun = [0]*n
    for i in range(n):
      sabun[i] = a[i]-b[i]
    sabun = sorted(sabun,reverse = False)
    sabun2 = sabun[::-1]
    cnt = 0
    husai = 0
    for i in range(n):
      if sabun[i] <0:
        cnt += 1
        husai += sabun[i]
      else:
        break
    j = 0
    while husai<0:
      husai += sabun2[j]
      cnt += 1
      j+=1
    print(cnt)
solve()

Measured memory_bytes: 18644
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();
		sc.close();

		int cnt = 0;
		while (B <= A) {
			B *= 2;
			cnt++;
		}

		while (C <= B) {
			C *= 2;
			cnt++;
		}

		if (cnt <= K) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 35736
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)

int main() {
  int A,B;
  cin >> A >> B;
  int ans = 1;
  int i = 0;
  while(1) {
    if(ans >= B) {
      break;
    }
    ans += A-1;
    i++;
  }
  cout << i << endl;

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        long N = cin.nextLong();

        long tmp = N;
        long sum = 0;
        while (true)
        {
            if (tmp == 0)
            {
                break;
            }
            sum += tmp % 10;
            tmp = tmp / 10;
        }

        if (N % sum == 0)
        {
            Console.WriteLine("Yes");
            return;
        }
        Console.WriteLine("No");
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define fr(i,n) for (int i=0;i<n;i++)
#define ll long long int
using namespace std;
int main()
{
   ll n,m;cin>>n>>m;
   int grid[n][m];
   ll mod = 1000000000 + 7;
   ll dp[n][m];
   fr(i,n)
   {
       string s;
       cin>>s;
       fr(j,m)
       {
           if(s[j]=='.')grid[i][j]=1;
           else grid[i][j]=0;
       }
   }
   fr(i,n)fr(j,m)dp[i][j]=0;
   dp[n-1][m-1]=1;
   for(int i=n-2;i>=0;i--)
   {
       if(grid[i][m-1]==1)dp[i][m-1]=1;
       else
           break;
   }
   for(int j=m-2;j>=0;j--)
   {
       if(grid[n-1][j]==1)dp[n-1][j]=1;
       else
           break;
       
   }
   for(int i=n-2;i>=0;i--)
   {
       for(int j=m-2;j>=0;j--)
       { 
           if(grid[i+1][j]==1)
           dp[i][j] = (dp[i][j]%mod + dp[i+1][j]%mod)%mod;
           if(grid[i][j+1]==1)
           dp[i][j] = (dp[i][j]%mod + dp[i][j+1]%mod)%mod;
       }
   }
//    fr(i,n)
//    {
//        fr(j,m)cout<<dp[i][j]<<" ";
//        cout<<endl;
//    }
   cout<<dp[0][0]<<endl;

}

Measured memory_bytes: 11904