akhauriyash/Code-Regression huggingface dataset:
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, a, n) for(int i=(a);i<(int)(n);i++)
#define repc(i, a, n) for(int i=(a);i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
#define DBG(str) cerr<<(str)<<endl;
int main() {
	int a, b;
	cin >> a >> b;
	if (a + b == 15)cout << '+';
	else if (a * b == 15)cout << '*';
	else cout << 'x';
	return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define fastio  cin.sync_with_stdio(0); cin.tie(0);cin.exceptions(cin.failbit);
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
   
    fastio;
    int T=1;
    // cin>>T;
    while(T--){
        ll n;cin>>n;
        ll ans=0;
        for(ll i=2;i<=sqrt(n);i++){
            if(n%i==0){
                ll cnt=0;
                while(n%i==0){
                    n=n/i;cnt++;
                }
                ll r=0;
                ll j=1;
                while((r+j)<=cnt){
                    r=r+j;
                    j++;
                }
                j--;
                ans+=j;
                // dbg(cnt,j);
            }
        }
        if(n>1){
            ans++;
        }
        cout<<ans;
    }   
    timecalculater();
    return 0;   
} 

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x) ((x) * (x))
#define bit(n) (1LL<<(n))
#define pcnt(x) __builtin_popcountll(x)
#define PB push_back
#define MP make_pair
#define endl "\n"
using Edge = pair<int,int>;
using Graph = vector<vector<Edge>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
// ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main() {
  std::cout<<std::fixed<<std::setprecision(20);
  double l; cin >> l;
  l = l*l*l;
  l = l/27.0;
  cout << l << endl;

}


Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let split = buf.split("\n");
    let mut counter: u32 = 1;

    for s in split {
        if s == "0" {
            break
        }
        println!("Case {}: {}", counter, s);
        counter += 1;
    }
}



Measured memory_bytes: 5036
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
flag = 0
for i in range(H):
    for j in range(W):
        if S[i][j]=="#":
            if j+1<W and S[i][j+1]=="." and i-1>=0 and S[i-1][j]=="." and j-1>=0 and S[i][j-1]=="." \
            and i+1<H and S[i+1][j]==".":
                flag = 1
                break
    if flag==1:break
if flag==0:
    print("Yes")
else:
    print("No")

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll A;
  scanf("%lld",&A);
  ll B;
  scanf("%lld",&B);
  ll C;
  scanf("%lld",&C);
  ll D;
  scanf("%lld",&D);
  cout << min(A,B)+min(C,D) << endl;
}

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


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main (void){
    
    int x,y;
    while(true){
        cin >> x;
        cin >> y;
        if(x==0 && y==0){
            break;
        }
        if(x < y){
            cout << x << " " << y << endl;
        }
        else {
            cout << y << " " << x << endl;
        }
    }
}



Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  int n = s.size();
  vector<int> dp(n+1);
  dp[0] = 1;
  string t[] = {"dream", "dreamer", "erase", "eraser"};
  rep(i, n) rep(j, 4) {
    if(i+(int)t[j].size()<=n && s.substr(i, (int)t[j].size())==t[j]) {
      dp[i+(int)t[j].size()] = dp[i];
    }
  }
  cout << (dp[n] ? "YES" : "NO") << "\n";
  return 0;
}


Measured memory_bytes: 3860
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n, m;
    cin >> n >> m;
    auto d = initVec2<int>(n + 1, n + 1, INF);
    rep(i, n + 1) d[i][i] = 0;
    vector<tuple<int, int, int>> e(m);
    rep(i, m){
        int a, b, c;
        cin >> a >> b >> c;
        d[a][b] = d[b][a] = c;
        e[i] = make_tuple(a, b, c);
    }

    for(int k = 1; k <= n; k++){
        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= n; j++){
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    int ans = 0;
    rep(i, m){
        int a, b, c;
        tie(a, b, c) = e[i];
        if(d[a][b] != c){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
s = input()
r = "R","U","D"
l = "L","U","D"


yes = True
for i in range(len(s)):
    if i%2==0 and s[i] not in r: # 奇数番目でrに無い
        yes = False
        break
    if i%2==1 and s[i] not in l: # 偶数番目でlに無い
        yes = False
        break
        
print("YNeos"[not yes::2])

Measured memory_bytes: 3060
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
int p[110000];
int q[110000];
vector<int>v[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%d%d",q+i,p+i);
		v[q[i]].push_back(i);
	}

	int cur=0;
	long long ret=0;
	priority_queue<pair<int,int> >Q;
	for(int i=b-1;i>=0;i--){
		for(int j=0;j<v[b-i].size();j++)Q.push(make_pair(p[v[b-i][j]],j));
		if(Q.size()){
			ret+=Q.top().first;
			Q.pop();
		}
	}

	printf("%lld\n",ret);
}

Measured memory_bytes: 7424
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string s;
    cin >> s;
    int w;
    cin >> w;
    for (int i = 0; i < s.size(); i += w) cout << s[i];
    cout << endl;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
int U;
int dp[15][(1<<15)][2];
int f[15][(1<<15)];
int n;
int c[15][15];

int dfs(int x,int mask,int st)
{
	if(dp[x][mask][st]!=-1) return dp[x][mask][st];
	int& res=dp[x][mask][st];
	if(x==0 && st==0) return res=(mask==1?0:-inf);
	res=-inf;
	if(st==1)
	{
		for(int tmask=mask;tmask;tmask--,tmask&=mask)
		{
			if((1<<x) & (mask^tmask)) continue;//tmaskÐÂ¼ÓÈë 
//			if(x==0 && mask==1+2+4 && st==1) cout<<tmask<<'f'<<endl;
			res=max(res,dfs(x,tmask,0)+f[x][mask^tmask]);
		}
		return res;
	}
	else
	{
		for(int i=0;i<n;i++)
		{
			if(!((1<<i) & mask)) continue;
			if(c[x][i]==0) continue;
			res=max(res,dfs(i,mask^(1<<x),1)+c[i][x]);
		}
		return res;
	}
}

int main()
{
//	freopen("input.txt","r",stdin);
	int m;
	cin>>n>>m;
	int x,y,z;
	int tot=0;
	for(int i=0;i<m;i++)
	{
		cin>>x>>y>>z;
		x--;
		y--;
		c[x][y]=c[y][x]=z;
		tot+=z;
	}
	
	for(int i=0;i<n;i++)
	{
		for(int mask=0;mask<(1<<n);mask++)
		{
			int tmask=mask;
			mask|=(1<<i);
			for(int x=0;x<n;x++)
			{
				if(!((1<<x) & mask)) continue;
				for(int y=x+1;y<n;y++)
				{
					if(!((1<<y) & mask)) continue;
					f[i][tmask]+=c[x][y];
				}
			}
			mask=tmask;
		}
	}
	
	U=(1<<n)-1;
	memset(dp,-1,sizeof(dp));
	int res=0;
	for(int mask=0;mask<(1<<n);mask++)
	{
		if(!((1<<(n-1)) & mask)) continue;
		if(!(1 & mask)) continue;
		res=max(res,dfs(n-1,mask,1));
	}
//	cout<<dfs(3,1+2+4+8,1)<<endl;
	cout<<tot-res<<endl;
//	cout<<dfs(0,1+2+4,1)<<endl;
//	cout<<f[0][2+4]<<endl;
//	cout<<dfs(0,1,0)<<endl;
//	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 6016
int G(x,y){return y?G(y,x%y):x;}
n[3],a[3],m[3];main(i,x){for(;scanf("%d%d%d%d%d%d",a,m,a+1,m+1,a+2,m+2),*m;n[0]*=n[1]/G(n[0],n[1]),printf("%lld\n",(long long)n[2]/G(n[0],n[2])*n[0]))for(i=3;i--;)for(x=n[i]=1;(x=a[i]*x%m[i])>1;n[i]++);}

Measured memory_bytes: 600
N, K = map(int, input().split())

def dif(n, k):
    if abs(n - k) <= n:
        return dif(abs(n-k), k)
    else:
        return n

if N % K == 0:
    print(0)
else:
    N = N % K
    print(dif(N,K))

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

int N;

int main(){
	cin >> N;
	map<int,int> m;
	for(int i=2;i<=N;i++){
		int s = i;
		for(int j=2;j*j<=N;j++){
			while(s%j==0){
				m[j]++;
				s /= j;
			}
		}
		if(s!=1) m[s]++;	
	}
	int ans = 0;
	int c2 = 0,c4 = 0,c14 = 0,c24 = 0,c74 = 0;
	for(auto x:m){
		int s = x.second;
		if(s>=2) c2++;
		if(s>=4) c4++;
		if(s>=24) c24++;
		if(s>=14) c14++;
		if(s>=74) c74++;
	}
	cout << (c2-2)*c4*(c4-1)/2 + (c2-1)*c24 + (c4-1)*c14 + c74 << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//ll dx[4] = {1, 0, -1, 0};
//ll dy[4] = {0, 1, 0, -1};

int main() {
	IOS();
	ll n;
	ll a[3], b[3];
	cin >> n;
	for (int i = 0; i < 3; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < 3; i++) {
		cin >> b[i];
	}
	vector<ll> dp(n + 1, 0);
	for (int i = 1; i <= n; i++) {
		dp[i] = dp[i - 1];
		for (int j = 0; j < 3; j++) {
			if (i >= a[j]) dp[i] = max(dp[i - a[j]] + (b[j] - a[j]), dp[i]);
		}
	}
	n = dp[n] + n;
	vector<ll> dp2(n + 1, 0);
	for (int i = 1; i <= n; i++) {
		dp2[i] = dp2[i - 1];
		for (int j = 0; j < 3; j++) {
			if (i >= b[j]) dp2[i] = max(dp2[i - b[j]] + (a[j] - b[j]), dp2[i]);
		}
	}
	dump(dp2[n] + n);
	return 0;
}

Measured memory_bytes: 195584
//FIRST THINK THEN CODE.

  #include <bits/stdc++.h>


  using namespace std;

  typedef long long ll;

  #define rep(i,a,b) for(ll i=a;i<b;++i)
  #define rrep(i,a,b) for(ll i=a;i>b;--i)
  #define FOR(i,n)  for(ll i=0;i<n;i++)
  #define vi vector<int>
  #define vl vector<ll>
  #define ld long double
  #define vld vector<ld>
  #define vvi vector<vector<int>>
  #define vvl vector<vector<long long>>
  #define vvld vector<vector<ld>>
  #define pii pair<int,int>
  #define pll pair<long,long>
  #define vpii vector<pii>
  #define vpll vector<pll>
  #define ff first
  #define ss second
  #define pb push_back
  #define pf push_front
  #define mp make_pair
  #define lb lower_bound
  #define ub upper_bound
  #define bs binary_search
  #define d1(x) cout<<(x)<<endl
  #define d2(x,y) cout<<(x)<<" "<<(y)<<endl
  #define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
  #define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
  #define PI 3.1415926535897932384626433832795
  #define fix(f,n) fixed<<setprecision(n)<<f
  #define all(x) x.begin(),x.end()
  #define rev(p) reverse(p.begin(),p.end());
  #define endl "\n"
  #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  #define popcount(x) __builtin_popcountll(x)
  #define sz(x) ((ll)x.size())
  const ll M=1000000007;
  const ll MM=998244353;
  ll begtime = clock();
  #define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
  //#define _Find_next 
  //#define _Find_first 

//#define trace(...)
#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...);
}

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

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



  ll powM(ll a,ll b,ll m)
  { 
  if(a<=0)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
  if(b&1)ans=ans*a%m;
  a=a*a%m;
  b>>=1;
  }

  return ans;
  }



  ll poww(ll a,ll b)
  { 

  ll ans=1;
  while(b)
  {
  if(b&1)ans=ans*a;
  a=a*a;
  b>>=1;
  }

  return ans;

  }


string tostring(ll x){
  stringstream sss;
  sss<<x;
  string ans=sss.str();
  return ans;
}



  const ll N=1e5+5;


  int main(){

      IOS;
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif


ll d,t,s;
cin>>d>>t>>s;

if(s*t<d){
  cout<<"No"<<endl;
}
else cout<<"Yes"<<endl;

return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define int long long
using namespace std;
int c,N,a;

int solve(int A){
  if(A%2==0){
    c++;
    solve(A/2);
  }
  else return c;
}
signed main(){
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> a;
    solve(a);
  }
  cout << c << endl;
  return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
mod = 10 ** 9 + 7
g1 = [1,1]
### g1[i]はiの階乗の逆数
g2 = [0,1]
###g2[i]はiの逆数
for i in range(2,m + 1):
    g2.append((-g2[mod % i] * (mod//i))% mod)
    g1.append(g1[-1] * g2[-1] % mod)
g3 = [1,m - n + 1]
for i in range(n - 1):
    g3.append((g3[-1] * (m - n + i + 2))%mod)
x = 1
for i in range(2,n + 1):
    x = (x*i)%mod
k = 0
for i in range(1,n + 1):
    k = (k + (-1)**i * x * g1[i] * g1[n - i] * g3[n - i])%mod
k = (k + g3[n])%mod
k = (k * g3[n])%mod
print(k)

Measured memory_bytes: 68268
#include<stdio.h>
#define MOD 100000
struct DP{
  int up, right, tup, tright, way;
} dp[101][101];

int main(){
  int i, j = 0;
  for(i = 0;i <= 100;i++){
    for(j = 0;j <= 100;j++){
      if(i == 0 || j == 0){
	dp[i][j].up = 0;
	dp[i][j].right = 0;
	dp[i][j].tup = 0;
	dp[i][j].tright = 0;
	dp[i][j].way = 0;
      }
      else if(i == 1 && j == 1){
	dp[i][j].up = 1;
	dp[i][j].right = 1;
	dp[i][j].tup = 0;
	dp[i][j].tright = 0;
	dp[i][j].way = 1;
      }
      else{
	dp[i][j].right = (dp[i - 1][j].tright + dp[i - 1][j].right) % MOD;
	dp[i][j].up = (dp[i][j - 1].tup + dp[i][j - 1].up) % MOD;
	dp[i][j].tright = (dp[i][j - 1].up) % MOD;
	dp[i][j].tup = (dp[i - 1][j].right) % MOD;
	dp[i][j].way = (dp[i][j].right + dp[i][j].up) % MOD;
      }
    }
  }
  while(1){
    scanf("%d%d",&i,&j);
    if(i == 0 && j == 0)return 0;
    printf("%d\n", dp[i][j].way);
  }
}

Measured memory_bytes: 796
# coding: utf-8
# Your code here!

line= list(map(int,input().split()))
N = line[0]
K = line[1]
#0~Nの連続した整数から
#kこ以上選ぶ
answer = 0
for i in range (K,N+2):
    minit = i*(i-1)/2
    maximum = (2*N-i+1)*i/2
    
    num = maximum-minit+1
    answer += num

if answer >(10**9+7):
    print(int(answer%(10**9+7)))
    
else:
    print(int(answer))

Measured memory_bytes: 9140
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	long long n, i, j, k, ans, a, b;
	cin >> n >> a >> b;
	vector<long long> x(n);
	for (i = 0; i < n; i++) cin >> x[i];
	ans = 0;
	for (i = 1; i < n; i++) ans += min(a * (x[i] - x[i - 1]), b);
	cout << ans << "\n";

	return 0;
}



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

int main() {
	int N,M,s=0,r=0;

	cin >> N >> M;
	vector<int> A(N);

	rep(i,N) {
		cin >> A.at(i);
		s += A.at(i);
	}

	rep(i,N)
		if(A.at(i) >= (double)s/(4*M))
			++r;

	cout << ((r>=M) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long x; cin >> x;
	long long sum = 100;
	for (int i = 1; i < INT_MAX; i++) {
		sum += sum / 100;
		if (sum >= x) {
			cout << i << "\n";
			return 0;
		}
	}
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <utility>
#include <cstdio>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    int n,k;
    LL ans = 1e10;
    LL h[100005]={};
    cin>>n>>k;
    rep(i,n){
        cin>>h[i];
    }
    sort(h,h+n);
    // cout<<endl;
    // rep(i,n)cout<<h[i]<<endl;
    // cout << endl;
    rep(i,n-k+1){
        // cout<<ans<<endl;
        ans = min(ans, h[i+k-1]-h[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
#define INF 100000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;
vector<P> to[N];
int colour[N];
void dfs(int no,int p){
	for(auto s:to[no]){
		if(s.first==p)continue;
		colour[s.first]=(colour[no]+s.second)%2;
		dfs(s.first,no);
	}
}
int main(){
    int n;
    cin>>n;
    REP(i,n-1){
        int a,b,w;
        cin>>a>>b>>w;
        a--;b--;
        to[a].push_back({b,w});
        to[b].push_back({a,w});
    }
    dfs(0,-1);
    REP(i,n)OUT(colour[i]);
    return 0;
}

Measured memory_bytes: 8320
#include<iostream>

using namespace std;

int main(){
  int A,B,C,X; cin >> A >> B >> C >> X;
  
  int s = X / 500;  int cnt = 0;
  for(int i = 0; i <= min(s,A); i++){
    int t = X - 500*i;
    t /= 100;
    for(int j = 0; j <= min(t,B); j++){
      int u = ( X - 500* i - 100*j ) / 50;
      if( 500 * i + 100 * j + 50 * u == X && u <= C){
       cnt++;}}}
  
  cout << cnt << endl; 
  return 0;}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

const (
	MAX   = 100000
	INFTY = 1 << 29
)

var (
	out   []int
	V     []bool
	indeg [MAX]int
)

type Graph [][]int

func (g *Graph) bfs(s int) {
	var q []int
	q = append(q, s)
	V[s] = true
	for len(q) != 0 {
		u := q[0]
		q = q[1:]
		out = append(out, u)
		for i := 0; i < len((*g)[u]); i++ {
			v := (*g)[u][i]
			indeg[v]--
			if indeg[v] == 0 && !V[v] {
				V[v] = true
				q = append(q, v)
			}
		}
	}
}

func (g *Graph) tsort(n int) string {
	for i := 0; i < n; i++ {
		indeg[i] = 0
	}

	for u := 0; u < n; u++ {
		for i := 0; i < len((*g)[u]); i++ {
			v := (*g)[u][i]
			indeg[v]++
		}
	}

	for u := 0; u < n; u++ {
		if indeg[u] == 0 && !V[u] {
			g.bfs(u)
		}
	}

	var buf bytes.Buffer
	for _, o := range out {
		buf.WriteString(fmt.Sprintln(o))
	}

	return strings.TrimRight(buf.String(), "\n")
}

func answer(reader io.Reader) string {
	sc := bufio.NewScanner(reader)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	m, _ := strconv.Atoi(sc.Text())

	V = make([]bool, n)
	g := make(Graph, n)

	for i := 0; i < m; i++ {
		sc.Scan()
		s, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		t, _ := strconv.Atoi(sc.Text())
		g[s] = append(g[s], t)
	}

	return g.tsort(n)
}

func main() {
	fmt.Println(answer(os.Stdin))
}



Measured memory_bytes: 3700
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define p_f(a) printf("%d ",a)
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;
int h,n,x;
int main()
{
    cin>>h>>n;
	int ans=0;
	rep(i,1,n)cin>>x,ans+=x;
	if(ans>=h)puts("Yes");
	else puts("No");
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

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

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        a: i64, b: i64, c: i64,
        x: i64, y: i64,
    }
    let mut mi = 1i64 << 50;
    for ab in 0..100001 {
        let aa = max(0, x - ab);
        let bb = max(0, y - ab);
        mi = min(mi, aa * a + bb * b + 2 * ab * c);
    }
    puts!("{}\n", mi);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000
using ll = long long;
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-10; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);

}

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

//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	llint ans = 0, n = 0, m = 0, count = 0, sum = 0;
	llint k, a, b=100;
	bool check = false;
	string ss;
	vector<llint> array;
	vector<char> ch;
	cin >> a;
	while (1) {
		ans++;
		b += b / 100;
		if (b >= a)break;
	}
	cout << ans << endl;

	please AC;
}


Measured memory_bytes: 3640
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, A: "List[int]", B: "List[int]"):

    ma = INF
    mb = INF
    for a, b in zip(A, B):
        if a > b:
            if mb > b:
                ma = a
                mb = b
    if ma == INF:
        print(0)
    else:
        print(sum(A)-mb)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int()] * (N)  # type: "List[int]"
    B = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, A, B)


if __name__ == '__main__':
    main()


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

#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed fixed<<setprecision(14)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
const lol Mod=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
lol n,m,k,r;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>n>>m;
  map<int,int> ma;
  lol o=m;
  while(o%2==0){
    ma[2]++;
    o/=2;
  }
  for(lol i=3;i<=sqrt(m);i+=2){
    while(o%i==0){
      o/=i;
      ma[i]++;
    }
  }
  lol ans=1;
  for(auto l=ma.begin();l!=ma.end();l++){
    if(n<=l->se){
      ans*=pow(l->fi,(l->se/n));
    }
  }
  if(n==1) cout <<m<<'\n';
  else cout <<ans<<'\n';
  return (0);
}


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

using namespace std;

int main()
{
    string s;
    cin >> s;
    vector<int> cnt(26, 0);
    for (char c : s)
        ++cnt[c - 'a'];
    for (int value : cnt)
    {
        if (value % 2 != 0)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
def a_ice_tea_store(Q, H, S, D, N):
    record_low_1liter = min(4 * Q, 2 * H, S)  # 1リットル買うための最小の値段
    if record_low_1liter * 2 <= D:  # 2リットルサイズは買わなくていい
        ans = N * record_low_1liter
    else:
        buy_2liter = N // 2
        buy_1liter = N % 2
        ans = buy_1liter * record_low_1liter + buy_2liter * D
    return ans

Q, H, S, D = [int(i) for i in input().split()]
N = int(input())
print(a_ice_tea_store(Q, H, S, D, N))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	int d;
	cin>>d;
	if(d==25){
		cout<<"Christmas";
	}
	if(d==24){
		cout<<"Christmas Eve";
	}
	if(d==23){
		cout<<"Christmas Eve Eve";
	}
	if(d==22){
		cout<<"Christmas Eve Eve Eve";
	}
}

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

vector<int> cumsum(vector<int> vec)
{
    vector<int> res;
    res.push_back(vec[0]);
    for(int i=1; i<vec.size(); ++i)
    {
        res.push_back(res[i-1]+vec[i]);
    }
    return res;
} 

int main()
{
    int N;
    string S;
    cin >> N;
    cin >> S;
    vector<int> east,west;
    for(int i=0; i<S.size(); ++i)
    {
        if(S[i]=='E')
        {
            east.push_back(1);
            west.push_back(0);
        }
        else
        {
            east.push_back(0);
            west.push_back(1);      
        }
    }

    vector<int> cumEast = cumsum(east);
    vector<int> cumWest = cumsum(west);

    int sum = 300000;
    for(int i=1;i<N; ++i)
    {
        int candidate = cumWest[i-1] + cumEast[N-1] - cumEast[i];
        if(sum>candidate) sum = candidate;
    }
    if(sum>cumEast[N-1]-cumEast[0]) sum = cumEast[N-1]-cumEast[0]; //端点処理

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 8420
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define F first
#define S second
#define maxn 100005
#define mod 1000000007
int a[205];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin>>n;

	for(int i=0;i<2*n;i++)cin>>a[i];

	sort(a,a+2*n);

	int ans=0;
	for(int i=0;i<2*n;i+=2)ans+=a[i];

	cout<<ans;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<int> B = A;
  sort(B.begin(), B.end());
  int res = 0;
  for (int i = 0; i < N; i += 2) {
    int j = lower_bound(B.begin(), B.end(), A[i]) - B.begin();
    if (j % 2 == 1) {
      ++res;
    }
  }
  cout << res << endl;
  return 0;
}


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

int main() {
    int64_t N, D, A;
    cin >> N >> D >> A;
    struct Monster {
        int64_t X, H;
    };
    vector<Monster> monsters(N);
    for (Monster& m : monsters) {
        cin >> m.X >> m.H;
    }

    //爆弾の切れ目 or モンスター
    struct Query {
        Query(int64_t x, int64_t h, bool m) : X(x), H(h), is_monster(m) {}
        int64_t X, H;
        bool is_monster;
        bool operator<(const Query& rhs) const {
            //モンスターが同じ位置にいることはないのでこれで良い
            return (X != rhs.X ? X < rhs.X : is_monster);
        }
        bool operator>(const Query& rhs) const {
            return !(*this < rhs);
        }
    };

    priority_queue<Query, vector<Query>, greater<Query>> query;
    for (Monster& m : monsters) {
        query.push(Query(m.X, m.H, true));
    }

    int64_t ans = 0;
    int64_t attack = 0;
    while (!query.empty()) {
        Query q = query.top();
        query.pop();

        if (q.is_monster) {
            //爆弾投下
            q.H -= attack;
            q.H = max(q.H, (int64_t)0);
            int64_t num = (q.H + A - 1) / A;
            ans += num;
            attack += num * A;
            query.push(Query(q.X + 2 * D, num * A, false));
        } else {
            //爆弾範囲の途切れ
            attack -= q.H;
        }
    }

    cout << ans << endl;
}

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

a = [int(x) for x in input().split(" ")]
ans = 1
fail = False
zero = False
for i in range(N):
	if(not fail):
		ans*=a[i]
	if(not fail and ans>1000000000000000000 or ans<0) :
		fail = True
	elif(a[i]==0) :
		zero = True
		ans=0
		break

if(fail and not zero) :
	print("-1")
else:
	print(ans)

Measured memory_bytes: 21796
# 2019-11-28 02:28:10(JST)
import sys

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

def main():
    n, m = map(int, sys.stdin.readline().split())
    s, t = sys.stdin.read().split()

    g = gcd(n, m)
    l = lcm(n, m)

    for i in range(g):
        if s[i * n // g] == t[i * m // g]:
            continue
        ans = -1
        break
    else:
        ans = l
    
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    string op;

    cin >> a >> op >> b;
    if (op == "+")
    {
        cout << (a + b) << endl;
    }
    else if (op == "-")
    {
        cout << (a - b) << endl;
    }
    return 0;
}

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

int main()
{
    int a,b,c,d,e,f,g,h,i;
    cin>>a>>b>>c;
    if(a<b) {
        d=a;
        e=b;
    } else {
        d=b;
        e=a;
    }
    if(e<c) {
        f=e;
        g=c;
    } else {
        f=c;
        g=e;
    }
    if(d<f) {
        h=d;
        i=f;
    } else {
        h=f;
        i=d;
    }
    cout<<h<<" "<<i<<" "<<g<<endl;
    return 0;
}


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

int main()
{

    int N;
    cin >> N;
    vector<ll> S;
    rep(i, N)
    {
        ll s;
        cin >> s;
        S.push_back(s);
    }
    sort(S.begin(), S.end());

    int q;
    cin >> q;
    vector<ll> T;
    rep(i, q)
    {
        ll t;
        cin >> t;
        T.push_back(t);
    }

    int ans = 0;
    for (ll t : T)
    {
        ll ng = -1;
        ll ok = N;
        while (abs(ng - ok) > 1)
        {
            ll mid = (ng + ok) / 2;
            if (S[mid] < t)
            {
                ng = mid;
            }
            else
            {
                ok = mid;
            }
        }

        if (t == S[ok])
            ans++;
    }
    cout << ans << endl;

    return 0;
}


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

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

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

    long long int ans = 0;
    for(int i = 1; i < K+1; i++)
        for(int j = 1; j < K+1; j++)
            for(int k = 1; k < K+1; k++)
            {
                ans += gcd(i, gcd(j,k));
            }

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


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define all(var) var.begin(), var.end()
#define input freopen("input", "r", stdin)
#define output freopen("output", "w", stdout)
#define Fast ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
typedef long long ll;
using namespace std;

int dr[] = {0, 0, -1, +1, -1, -1, +1, +1};
int dc[] = {-1, +1, 0, 0, -1, +1, -1, +1};


int main(){
    int n; cin >> n;
    cout << (n >= 30 ? "Yes" : "No") << endl;
}




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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;

struct edge {
    int i, j;
    ll c, v;
};

int n, m;
ll x;
const ll INF = 1LL<<60;
int par[1010];
vector<edge> edg;
vector<pll> lis[1010];
vector<pll> tre[1010];

void init() {
    int i;
    for (i=0;i<n;i++)par[i]=i;
}

int fin(int a) {
    return (par[a]==a)?a:(par[a]=fin(par[a]));
}

bool uni(int a, int b) {
    a = fin(a); b = fin(b);
    if (a==b) return false;
    par[a] = b;
    return true;
}

ll dfs(int here, int p, int tar, ll d) {
    if (here==tar) return d;
    for (pll &there : tre[here]) {
        if (there.second==p)continue;
        ll v = dfs(there.second,here,tar,max(d,there.first));
        if (~v) return v;
    }
    return -1;
}

const ll MOD = 1e9+7;
ll power(ll a, ll n) {
    if (!n)return 1;
    ll t = power(a,n/2);
    return t*t%MOD*((n&1)?a:1)%MOD;
}

int main() {
    int i;

    scanf("%d%d",&n,&m);
    scanf("%lld",&x);
    for (i=0;i<m;i++) {
        int a, b; ll c;
        scanf("%d%d%lld",&a,&b,&c); a--; b--;
        lis[a].push_back(pll(c,b));
        lis[b].push_back(pll(c,a));
        edg.push_back(edge{a,b,c,0});
    }
    sort(edg.begin(),edg.end(),[](edge a, edge b){return a.c<b.c;});
    ll res = 0;
    init();
    for (edge &v:edg) {
        if (uni(v.i,v.j)) {
            res += v.c;
            tre[v.i].push_back(pll(v.c,v.j));
            tre[v.j].push_back(pll(v.c,v.i));
            v.v = -1;
        }
    }
    if (x<res) {
        printf("0\n");
        return 0;
    }
    for (edge &v: edg) {
        if (v.v<0) continue;
        ll val = dfs(v.i,-1,v.j,0);
        v.v = v.c-val;
    }
    ll ans = 0;
    if (x==res) {
        ans = power(2,m);
        int cnt = 0;
        for (edge &v:edg) if (v.v>0) cnt++;
        ans = (ans+2*(MOD-power(2,cnt)))%MOD;
    }
    else {
        int c1 = 0, c2 = 0;
        for (edge &v:edg) {
            if (v.v==x-res) c1++;
            else if (v.v>x-res) c2++;
        }
        ans = 2*(power(2,c1)+MOD-1)%MOD*power(2,c2)%MOD;
    }
    printf("%lld\n",ans);

    return 0;
}


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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

int n;
string s;

void process()
{
    int dem=0;
    for (int i=1;i<=n-2;++i)
    {
        string t;
        for (int j=0;j<3;++j)
            t+=s[i+j];
        dem+=(t=="ABC");
    }
    cout<<dem;
}

int main()
{
    cin>>n>>s;
    s="1"+s;
    process();
    return 0;
}


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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MC = 10010;
int N;
LL a[MC],b[MC];
LL s;

int main(){
	cin >> N;
	repp(i,0,N){
		cin >> a[i];
		s -= a[i];
	}
	repp(i,0,N){
		cin >> b[i];
		s += b[i];
	}
	if(s<0) return cout << "No" << endl , 0;
	LL x = s , y = s;
	repp(i,0,N){
		if(a[i] < b[i]){
			x -= (b[i]-a[i]+1)/2;
			if((b[i]-a[i])%2==1) --y;
		} else {
			y -= a[i] - b[i];
		}
	}
	if(x<0 || y<0 || x*2 != y) cout << "No" << endl , 0;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 384