akhauriyash/Code-Regression huggingface dataset:
N = int(input())

x = []

for i in range(N):
    x.append(list(map(int,input().split()))) 


def dist2(a,b):
    return ((a[0]-b[0])**2 + (a[1]-b[1])**2)**0.5

D = [[dist2(x[i],x[j]) for i in range(N)] for j in range(N)]

def dist3(i,j,k):
    a,b,c = D[i][j],D[j][k],D[k][i]
    cosA = (b**2 + c**2 - a**2)/(2*b*c)
    sinA = (1 - cosA**2)**0.5

    if sinA>1e-7:
        ans =(a/sinA)/2
        return ans
    else:
        return 0

def mid(a,b):
    return [(a[0]+b[0])/2,(a[1]+b[1])/2]

ans = 0

for i in range(N):
    for j in range(i+1,N):
        ans = max(D[i][j]/2,ans)
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            flag = True
            if dist2(x[k],mid(x[i],x[j])) <= D[i][j]/2 or dist2(x[j],mid(x[i],x[k])) <= D[i][k]/2 or dist2(x[i],mid(x[j],x[k])) <= D[j][k]/2:
                flag=False
            ans = max(D[i][j]/2,D[j][k]/2,D[k][i]/2,ans)
            if flag:
                ans = max(dist3(i,j,k),ans)

print(ans)

Measured memory_bytes: 48236
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
 
 
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'



signed main() {
  fio();
  ll n, k;
  cin >> n >> k;
  vl a(n);
  rep (i, n) cin >> a[i];
  sort(all(a));
  vl f(n);
  rep (i, n) {
    cin >> f[i];
  }
  sort(all(f));

  //DEBUG_VEC(a);
  //DEBUG_VEC(f);

  ll ng = -1, ok = INF;
  while (ng + 1 < ok) {
    //DEBUG(pll(ng, ok));
    ll mid = (ng + ok) / 2;
    int i = 0;
    ll kk = k;
    bool flag = true;
    while (i < n and k >= 0) {
      if (a[i] * f[n - 1 - i] > mid) {
        ll need = a[i] * f[n - 1 - i] - mid;
        need = (need - 1) / f[n - 1 - i] + 1;
        if (kk >= need) {
          kk -= need;
        }
        else {
          flag = false;
          break;
        }
      }
      i++;
    }
    if (flag) ok = mid;
    else ng = mid;
  }

  cout << ok << endl;
}


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

#define rep(i, n) for(int i=0; i < (n); ++i)
#define ll long long

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

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

    int n, k; cin >> n >> k;
    set<int> st;
    rep(i,k) {
        int d; cin >> d;
        rep(j,d) {
            int a; cin >> a;
            st.insert(a);
        }
    }

    int ans = 0;
    rep(i,n) {
        if (st.count(i+1) == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3656
#include <cmath>
#include <iomanip>
#include <iostream>

using namespace std;

int main()
{
    int q; double x;
    
    while(true)
    {
        cin >> q;
        
        if(q == -1) { break; }
        
        x = q / 2.0;
        
        while(abs(x * x * x - q) >= 0.00001 * q)
        {
            x = x - (x * x * x - q) / (3 * x * x);
        }
        
        cout << fixed << setprecision(12) << x << endl;
    }
    
    return 0;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n;
int x, y;
int sum;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    INIT;

    cin >> n >> s;
    rep(i, n)
    {
        if (s[i] == 'I')
            x++;
        else
            x--;

        ans = max(ans, x);
    }

    pr(ans);
    return 0;
}


Measured memory_bytes: 3652
// comb(n,r)でrを固定すればnが大きいほど大きい（分母が同じなので明らか）、同じ数列からa(i)>a(j)でcomb(a(i),a(j))を選ぶので、
// あるnを選んだときのrの候補は、このnよりも大きい数を選んだときの候補にすべて含まれる。
// 以上よりnについては与えられた数列より最大のものを選んでよい。
// また、nを固定したときcomb(n,r)を最大化するにはn/2に最も近いものを選べばよい（これはパスカルの三角形を考えれば明らか）。
// これは二分探索でlog(N)で求まる。C++ではlower_boundで簡単に実装できる。
// メモ→rは0~nをとりうる、n=2: 1 2 1 , n=3: 1 3 3 1 , n=4: 1 4 6 4 1, .. ← nが偶数ならn/2, nが奇数ならceil(n/2)=floor(n/2)←これに一番近い数

#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

ll n, a[MAX_10p5], maxa, ansr;
ll *pos, idx;

int main() {
	cin >> n;
	repi(i, 0, n) rd(a[i]);

	sort(a, a + n);
	maxa = a[n - 1];

	if (maxa % 2 == 0) {
		ll key = maxa / 2;
		pos = lower_bound(a, a + n, key);
		idx = distance(a, pos);
		if (idx == 0) {
			ansr = a[idx];
		}
		else if (idx == n - 1) {
			ansr = a[idx - 1];
		}
		else {
			if (abs(key - a[idx]) < abs(key - a[idx - 1])) ansr = a[idx];
			else ansr = a[idx - 1];
		}
	}
	else {
		ll keys[2] = {};
		keys[0] = maxa / 2;
		keys[1] = (maxa + 1) / 2;
		ll mindiff = MAX_10p18;
		repi(i, 0, 2) {
			pos = lower_bound(a, a + n, keys[i]);
			idx = distance(a, pos);
			if (idx == 0) {
				if (mindiff > abs(a[idx] - keys[i])) {
					mindiff = abs(a[idx] - keys[i]);
					ansr = a[idx];
				}
			}
			else if (idx == n - 1)  {
				if (mindiff > abs(a[idx - 1] - keys[i])) {
					mindiff = abs(a[idx - 1] - keys[i]);
					ansr = a[idx - 1];
				}
			}
			else {
				if (abs(keys[i] - a[idx]) < abs(keys[i] - a[idx - 1])) {
					if (mindiff > abs(a[idx] - keys[i])) {
						mindiff = abs(a[idx] - keys[i]);
						ansr = a[idx];
					}
				}
				else
					if (mindiff > abs(a[idx - 1] - keys[i])) {
						mindiff = abs(a[idx - 1] - keys[i]);
						ansr = a[idx - 1];
					}
			}
		}
	}
	
	cout << maxa << " " << ansr << endl;

	return 0;
}


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

using namespace std;

int n;
vector<int> graf[100010];
ll dp[100010][2]; //0 belo, 1 crno
bool mark[100010];
ll mod=1e9+7;

void dfs(int cvor)
{
    mark[cvor]=true;
    dp[cvor][0]=dp[cvor][1]=1;
    for(int i=0;i<graf[cvor].size();i++)
        if(!mark[graf[cvor][i]])
        {
            int tekc=graf[cvor][i];
            dfs(tekc);
            dp[cvor][0]=(dp[cvor][0]*(dp[tekc][0]+dp[tekc][1]))%mod;
            dp[cvor][1]=(dp[cvor][1]*dp[tekc][0])%mod;
        }
}

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

	cin>>n;
	int a, b;
	for(int i=0;i<n-1;i++)
    {
        cin>>a>>b;
        a--;
        b--;
        graf[a].push_back(b);
        graf[b].push_back(a);
    }

    dfs(0);

	cout<<(dp[0][0]+dp[0][1])%mod;

	return 0;
}


Measured memory_bytes: 11520
#include <bits/stdc++.h>
using namespace std;
bool is_prime(long long n) {
  if (n < 2 or n > 2 and n % 2 == 0) return false;
  for (long long i = 3; i * i <= n; i += 2) if(n % i == 0) return false;
  return true;
}
signed main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i];
  int res = 0;
  for (auto&& i : a) res += is_prime(i);
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
 
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define rep(i,n,z) for(int i=z;i<n;i++)
#define rrep(i,z) for(int i=z;i>=0;i--)
#define nl cout<<endl
#define vi vector<int>
#define vlli vector<long long int>
#define umap unordered_map
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define ipair pair <int,int>
#define llipair pair <lli,lli>
#define pq priority_queue
#define displaymatrix(a,m,n) for(int i=0;i<m;i++){for(int j=0;j<n;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define printarray(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}nl;
#define vinput(a,n) vlli a(n);rep(i,n,0)cin>>a[i]
#define ainput(a,n) rep(i,n,0)cin>>a[i]
#define SO(a) sort(a.begin(),a.end())
#define all(x) (x).begin(),(x).end()
#define SOP(a,comp) sort(a.begin(),a.end(),comp)
#define inf INT_MAX
#define endl '\n'
 
int main()
{
    fastio;
    int n;
    cin>>n;
    vinput(a,n);

    lli gcd = 0;

    rep(i,n,0)gcd = __gcd(gcd,a[i]);

    if(gcd != 1)return cout<<"not coprime"<<endl,0;

    vi ps(1e6 + 5,true),pc(1e6+5,0);
    ps[0] = ps[1] = false;
    vi primes;
    
    rep(i,ps.size(),2){
        if(!ps[i])continue;
        primes.pb(i);
        for(int j = i*i;j < ps.size();j += i)ps[i] = false;
    }

    for(int i = 0;i < n;i++){
        int val = sqrt(a[i]);

        for(auto x: primes){
            if(val < x)break;
            if(a[i]%x)continue;
            // cout<<x<<" ";
            if(pc[x])return cout<<"setwise coprime"<<endl,0;
            pc[x]++;

            while(a[i]%x == 0)a[i] /= x;
        }

        if(a[i] > 1){
            if(pc[a[i]])return cout<<"setwise coprime"<<endl,0;
            pc[a[i]]++;
        }
    }

    cout<<"pairwise coprime"<<endl;
}

Measured memory_bytes: 22940
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
using namespace std;

template <typename T>
T set_oparate(T &sorted_a, T &sorted_b, char op) {
#define abc(a, b, c) begin(a), end(a), begin(b), end(b), inserter(c, end(c))
    T ret;
    switch (op) {
    case 'u':   // 和集合（A ∪ B）
        set_union(abc(sorted_a, sorted_b, ret)); break;
    case 'i':   // 積集合（A ∩ B）
        set_intersection(abc(sorted_a, sorted_b, ret)); break;
    case 'd':   // 差集合（A \ B, A ∩ B^c）
        set_difference(abc(sorted_a, sorted_b, ret)); break;
    case 's':   // 対称差（A Δ B, (A\B) ∪ (B\A)）
        set_symmetric_difference(abc(sorted_a, sorted_b, ret)); break;
    }
    return ret;
#undef abc
}

int main() {
    int n; cin >> n;
    set<int> a;
    while (n--) { int x; cin >> x; a.emplace(x); }
    int m; cin >> m;
    set<int> b;
    while (m--) { int x; cin >> x; b.emplace(x); }
    for (int x: set_oparate(a, b, 'u')) cout << x << endl;
    return 0;
}



Measured memory_bytes: 40576
ar = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(ar[k-1])


Measured memory_bytes: 2940
import sys
def input():
    return sys.stdin.readline()[:-1]


def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse = True)
    '''
    niko = (len(A) - 2) // 2
    conft = A[0] + sum(A[1:niko + 1]) * 2
    if (len(A) - 2) % 2 == 1:
        conft += A[niko + 2]
    print(conft)
    '''
    ans=0
    for i in range(1, N): #sum[i=2 to n](a(i+1)//2)を求める
        ans += A[i//2]
    print(ans)

    
if __name__ == "__main__":
    main()

Measured memory_bytes: 30916
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

int main() {
	ll N,M,A;
	cin >> N >> M;
	map<ll,ll> mp;
  	mp[0]++;
  	cin >> A;
  	ll S = A;
  	mp[S%M]++;
	REP(i,N-1){
		cin >> A;
      	S+=A;
		mp[S%M]++;
	}
	ll sum=0;
  	map<ll,ll>::iterator itr;
  	for(itr = mp.begin(); itr != mp.end(); itr++){
      	ll sec = itr->second;
      	sum += sec*(sec-1)/2;
    }
	cout << fixed << sum << endl;
	return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

ll inf = 1000003;

ll pw(ll x, ll y) {
    if (y == 0) return 1;
    else if (y == 1) return x % inf;
    else if (y % 2 == 0) return pw(x, y / 2) * pw(x, y / 2) % inf;
    else return pw(x, y / 2) * pw(x, y / 2) % inf * x % inf;
}

ll dv(ll x, ll y) {
    return x * pw(y, inf - 2) % inf;
}

int main(void){
    int q;
    ll pile[3000010];
    cin >> q;
    
    for (int i = 1; i < 2 * inf; i++) {
        if (i == 1) pile[i] = 1;
        else pile[i] = pile[i - 1] * i % inf;
    }
    
    for (int i = 0; i< q; i++) {
        ll x, d, n;
        cin >> x >> d >> n;
        
        if (d == 0) cout << pw(x, n) << endl;
        else {
            if (dv(x, d) + n - 1 >= inf) cout << 0 << endl;
            else cout << pw(d, n) * pile[dv(x, d) + n - 1] % inf * dv(1, pile[dv(x, d) - 1]) % inf << endl;
        }
    }
    
}


Measured memory_bytes: 18304
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <utility>
#include <map>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;


int main()
{
    int m,d;
    cin>>m>>d;
    int cnt=0;
    for(int i=1;i<=m;i++)
        for(int j=1;j<=d;j++)
        {
            if(j<20)
                continue;
            if(j%10<2)
                continue;
            int a=j%10;
            int b=j/10;
            if(a*b==i)
                cnt++;
        }
    cout<<cnt<<endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int N; cin >> N;
  vector<int> x(N), y(N), h(N); REP(i, N) cin >> x[i] >> y[i] >> h[i];

  int MAX = 100;
  for (int posy = 0; posy <= MAX; ++posy) {
    for (int posx = 0; posx <= MAX; ++posx) {
      int ans_h = -1;

      for (int k = 0; k < N; ++k) {
        if (h[k] == 0) continue;
        int tmp_h = h[k]+abs(posy-y[k])+abs(posx-x[k]);

        if (ans_h == -1) {
          ans_h = tmp_h;
        } else if (ans_h != tmp_h) {
          ans_h = -2;
          break;
        }
      }

      if (ans_h == -2) continue;

      for (int k = 0; k < N; ++k) {
        if (h[k] != 0) continue;
        int tmp_h = abs(posy-y[k])+abs(posx-x[k]);

        if (ans_h > tmp_h) {
          ans_h = -2;
          break;
        }
      }

      if (ans_h == -2) continue;

      printf("%d %d %d\n", posx, posy, ans_h);
      return 0;
    }
  }

}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

int N;
int main(int argc, char const *argv[]) {
  cin >> N;
  vector<int> l(N);
  vector<int> r(N);
  int sum=0;
  for (size_t i = 0; i < r.size(); i++) {
    cin >>l[i]>>r[i];
    sum+=r[i]-l[i]+1;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int64_t n, m; cin >> n >> m;

    if (n * 2 > m) {
        cout << m / 2 << endl;
    } else {
        int64_t rest_m = m - 2 * n;
        cout << n + rest_m / 4 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 10000000000000000
#define endl '\n'
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; }
using namespace std;

int V;
struct edge{int f,t,c;};
vector<edge> G[100100];
int dist[100100];

signed main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>V;
    rep(i,V-1){
        edge e; cin>>e.f>>e.t>>e.c;
        e.f--; e.t--;
        edge f=e; swap(f.f,f.t);
        G[e.f].push_back(e);
        G[f.f].push_back(f);
    }
    fill(dist,dist+100100,INF);
    dist[0]=0;
    queue<int> que;
    que.push(0);
    while(que.size()){
        int v=que.front(); que.pop();
        rep(i,G[v].size()){
            if(dist[G[v].at(i).t]>dist[v]+G[v].at(i).c){
                dist[G[v].at(i).t]=dist[v]+G[v].at(i).c;
                que.push(G[v].at(i).t);
            }
        }
    }
    rep(i,V){
        if(dist[i]%2==0)cout<<0<<endl;
        else cout<<1<<endl;
    }

}


Measured memory_bytes: 10112
N = int(input())
S = input()

e_acc, w_acc = 0, 0
e_acc_list = [0]
w_acc_list = [0]
acc = {'E': 0, 'W': 0}
acc_list = {'E': [0], 'W': [0]}
for s in S:
    if s == 'E':
        acc['E'] += 1
    else:
        acc['W'] += 1
    acc_list['E'].append(acc['E'])
    acc_list['W'].append(acc['W'])

def count(l_ind, r_ind, symbol):
    # assert l_ind < r_ind
    if r_ind < 0 or l_ind > N - 1:
        return 0
    else:
        if symbol == 'E':
            return acc_list['E'][r_ind] - acc_list['E'][l_ind]
        else:
            return acc_list['W'][r_ind] - acc_list['W'][l_ind]

cost = 1e10

for i in range(N):  # ind of leader
    tmp = count(0, i, 'W') + count(i + 1, N, 'E')
    if tmp < cost:
        cost = tmp
print(cost)


Measured memory_bytes: 18084
#include <cstdio>
#include <cmath>

using namespace std;

int main()
{
	int n, k, a, i, sum = 0;

	scanf("%d %d", &n, &k);
	for (i = 0; i < n; i++) {
		scanf("%d", &a);
		if (a < abs(a - k)) {
			sum += 2 * a;
		}
		else {
			sum += 2 * abs(a - k);
		}
	}

	printf("%d\n", sum);

	return 0;
}

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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



int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n, k; cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i]--;
    }

    vector<ll> s(n+1, 0);
    for(int i = 0; i < n; i++){
        s[i+1] = s[i] + a[i];
        s[i+1] %= k;
    }

    map<ll, ll> mp;
    ll ans = 0;

    for(int i = 0; i < n+1; i++){
        if(mp.count(s[i]) != 0) ans += mp[s[i]];
        mp[s[i]]++;
        if(i - k + 1 >= 0) mp[s[i-k+1]]--;
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
    int x,n;
    cin >> x >> n;
    int p[n];
    int ans = 10000;
    bool num[1000] = {};
    int tmp = 0;
    for(int i = 0; i < n; i++){
        cin >> p[i];
        num[p[i]-1] = 1;
    }

    if(n == 0){
        cout << x << endl;
        return 0;
    }

    for(int i = -1000; i <= 0; i++){
        if(abs(x-i) < ans){
            ans = abs(x-i);
            tmp = i;
        }
    }

    for(int i = 0; i < 1000; i++){
        if(num[i] == 0){
            if(ans > abs(i+1-x)){
                ans = abs(i+1-x);
                tmp = i+1;
            }
        }
    }
    cout << tmp << endl;

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  string S;
  bool P = false, W = false, G = false, Y = false;

  for (int i = 0; i < N; i++) {
    cin >> S;
    if (S == "P")
      P = true;
    else if (S == "W")
      W = true;
    else if (S == "G")
      G = true;
    else if (S == "Y")
      Y = true;
    
    if (P && W && G && Y) {
      break;
    }
  }
  if (P && W && G && Y)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<int> Div(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int h, w;
    cin >> h >> w;
    int mp[105][105] = {};
    for(int i = 1; i <= h; ++i) {
        for(int j = 1; j <= w; ++j) {
            char c;
            cin >> c;
            if(c == '#') mp[i][j] = 1;

        }
    }

    for(int i = 1; i <= h; ++i) {
        for(int j = 1; j <= w; ++j) {
            if(mp[i][j] != 1) continue;
            int t = mp[i - 1][j] + mp[i][j - 1] + mp[i][j + 1] + mp[i + 1][j];
            if(t < 1) {
                cout << "No" << endl;
                return 0;

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



Measured memory_bytes: 256
#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);
  int N, K;
  cin >> N >> K;
  set<int> se;
  rep(i, 10) se.insert(i);
  rep(i, K) {
    int d;
    cin >> d;
    se.erase(d);
  }
  auto check = [&](int n) {
    while(n > 0) {
      if(!se.count(n%10)) return false;
      n /= 10;
    }
    return true;
  };
  while(true) {
    if(check(N)) {
      cout << N << "\n";
      return 0;
    }
    N++;
  }
  return 0;
}


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

const int Maxd = 3;

int A[Maxd][Maxd];

int main()
{
	for (int i = 0; i < Maxd; i++)
		for (int j = 0; j < Maxd; j++)
			scanf("%d", &A[i][j]);
	int got = A[1][0] - A[0][0];
	for (int j = 1; j < Maxd; j++)
		if (A[1][j] - A[0][j] != got) { printf("No\n"); return 0; }
	got = A[2][0] - A[0][0];
	for (int j = 1; j < Maxd; j++)
		if (A[2][j] - A[0][j] != got) { printf("No\n"); return 0; }
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
/**
 * A - A?C
 * https://atcoder.jp/contests/abc166/tasks/abc166_a
 */
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    // コンテストには ABC と ARC の 2 つの種類があり、毎週どちらか一方が開催されます。
    // ABC が開催された次の週には ARC が開催され、ARC が行われた次の週には ABC が開催されます。
    // 先週開催されたコンテストを表す文字列 S が与えられるので、今週開催されるコンテストを表す文字列を出力してください。
    string S;
    cin >> S;

    // S は ABC または ARC
    cout << (S == "ABC" ? "ARC" : "ABC") << endl;
}
 

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;int flag=0;
  for(int i=0;i<s.size()-1;i++){
    for(int j=i+1;j<s.size();j++){
      if(s.at(i)==s.at(j)){
        flag++;break;
      }
    }
    if(flag>0)break;
  }
  if(flag>0)cout<<"no"<<endl;
  else cout<<"yes"<<endl;
}

Measured memory_bytes: 256
while True:
    n=int(input())
    list=[]
    if n==0:
        break
    else:
        for i in range (n):
            c=int(input())
            list.append(c)
        for i in range (0,10):
            x=list.count(i)
            if x==0:
                print("-")
            else:
                print("*"*x)


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

int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  for (int i=0; i<N; i++){
    cin >> V.at(i);
  }
  sort(V.begin(),V.end());
  int A=0,B=0;
  for (int i=0; i<N; i++){
    A += V.at(N-1-2*i);
    if(N-1-2*i==0){
    break;
    }

    B += V.at(N-2-2*i);
    if(N-2-2*i==0){
    break;
    }
  }
  cout << A-B <<endl;
    
}


Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace arc068_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(a);
            // for (int i = 0; i < n; i++) { Console.Write(a[i] + " "); }
            int ans = 0;
            int bef=0;
            HashSet < int >hash=new HashSet<int>{ };
            
            for (int i = 0; i < a.Length; i++)
            {
                hash.Add(a[i]);
            }
            Console.WriteLine( hash.Count() % 2 == 1 ? hash.Count() :hash.Count() - 1);
            Console.ReadLine();
        }
    }
}


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    int a,b,c,d;
    int tab[102]={};
    cin >> a >> b >> c >> d;
    tab[a]++;
    tab[c]++;
    tab[b]--;
    tab[d]--;
    int res=0,sum=0;
    REP(i,102){
        sum+=tab[i];
        if(sum==2){
            res++;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
/*
  Vivek Rathi
  CSE 2nd Year
  MNNIT
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 1e17
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
ll n,k;
ll a[101];
ll dp[101][100001];
ll dp2[101][100001];
int main()
{
	boost
	cin>>n>>k;
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(ll i=0;i<=a[0];i++)
	{
		dp[0][i]=1;
		
	}
	for(ll i=0;i<=k;i++)
	{
		if(i==0)dp2[0][i]=dp[0][i];
		else dp2[0][i]=(dp[0][i]+dp2[0][i-1])%M;
	}
	for(ll i=1;i<n;i++)
	{
		dp[i][0]=1;
		for(ll j=1;j<=k;j++)
		{
			if(j-a[i]-1>=0)dp[i][j]=(-dp2[i-1][max(0LL,j-a[i]-1)]+dp2[i-1][j]+M)%M;
			else dp[i][j]=dp2[i-1][j];
			//debug3(i,j,dp[i][j]);
		}
		for(ll j=0;j<=k;j++)
		{
			if(j==0)dp2[i][j]=dp[i][j];
			else dp2[i][j]=(dp[i][j]+dp2[i][j-1])%M;
		}
	}
	
	cout<<dp[n-1][k]<<endl;
	return 0;
}

Measured memory_bytes: 157952
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  int n,m;cin>>n>>m;
  ll a[n+10],b[n+10];rep(i,0,n)cin>>a[i]>>b[i];
  ll c[m+10],d[m+10];rep(i,0,m)cin>>c[i]>>d[i];

  rep(i,0,n){
    int num=0;ll mi=4e8+1;
    rep(j,0,m){
      ll dis=abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(mi>dis){
        mi=dis;
        num=j+1;
      }
    }
    out(num);
  }

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()

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

const int mod = 1e9+7;
const ll INF = 1e18;
const int MAX = 1e6;

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

struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visit[MAX]; // 訪問の有無

int n, m; // 変数
string s, t;
int dp[3001][3001];
string ans;

void res(int i, int j) { // LCSの復元
    if (i == 0 || j == 0) return;
    if (s[i] == t[j]) {
        ans.push_back(s[i]);
        res(i-1, j-1);
    } else if (dp[i][j] == dp[i-1][j]) {
        res(i-1, j);
    } else if (dp[i][j] == dp[i][j-1]) {
        res(i, j-1);
    }
}

void dp_solve() { // DP
    rep(i, n) {
        rep(j, m) {
            if (i == 0 || j == 0) {
                dp[i][j] = 0;
            } else {
                if (s[i] == t[j]) {
                    dp[i][j] = dp[i-1][j-1] + 1;
                } else {
                    int x = dp[i-1][j];
                    int y = dp[i][j-1];
                    dp[i][j] = max(x, y);
                }
            }
        }
    }
}

int rec(int i, int j) { // メモ化再帰
    if (dp[i][j] != -1) return dp[i][j];
    if (i == 0 || j == 0) return dp[i][j] = 0;
    if (s[i] == t[j]) return dp[i][j] = rec(i-1, j-1) + 1;
    int x = rec(i-1, j);
    int y = rec(i, j-1);
    return dp[i][j] = max(x, y);
}

int main() {
// input
    cin >> s;
    cin >> t;
    s = ' ' + s;
    t = ' ' + t;
    n = s.size();
    m = t.size();
// solve
    dp_solve();
    // rec(n-1, m-1);
    res(n-1, m-1);
    reverse(ALL(ans));
// output
    cout << ans << "\n";
}

Measured memory_bytes: 38796
// ABC 153-C
// 2020.1.26 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long ll;

#define gc() getchar_unlocked()

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

#define INCmode   1  // 昇順ソート
typedef int Int;
void Usort(Int *a, int n) {
	int i, k;
#define B 8
#define BMSK 255 // (1<<8)-1
	Int t1[1 << B], t2[1 << B];
	
	Int *tmp = malloc(n * sizeof(Int));	
	for (k = 0; k < 4; ++k) {  // for 32ビット
		memset(t1, 0, sizeof(t1)), memset(t2, 0, sizeof(t2));
		for (i = 0; i < n; ++i)	t1[(a[i] >> k*B) & BMSK]++;
#if INCmode
		for (i = 0; i < BMSK; ++i) t1[i+1] += t1[i];
#else
		i = BMSK+1; while (--i) t1[i-1] += t1[i];
#endif
		i = n; while (i--) tmp[--t1[(a[i] >> k*B) & BMSK]] = a[i];
		k++;
		for (i = 0; i < n; ++i) t2[(tmp[i] >> k*B) & BMSK]++;
#if INCmode
		for (i = 0; i < BMSK; ++i) t2[i+1] += t2[i];
#else
		i = BMSK+1; while (--i) t2[i-1] += t2[i];
#endif
		i = n; while (i--) a[--t2[(tmp[i] >> k*B) & BMSK]] = tmp[i];
	}
	free(tmp);
//  for (i = 0; i < n; ++i) printf("[%d] %lld\n", i, a[i]);
}


int N;
int H[200005];

int main()
{
	int i, K, N;
	ll s;
	
	N = in(), K = in();
	for (i = 0; i < N; ++i) H[i] = in();
	Usort(H, N);
	s = 0, N -= K;
	for (i = 0; i < N; ++i) s += H[i];
	printf("%lld\n", s);
	return 0;
}


Measured memory_bytes: 1664
resultss = []
while True:
    N = int(input())
    if N == 0:
        break
       
    B = [list(map(str, input().split())) for _ in range(N)]
    results = []
    for i in range(N):
        A = []
        name = B[i][0]
        B[i][0] = B[i][1]
        for j in range(10):
            A.append(int(B[i][j]))
            
        if A[-1] == 1:
            time = A[2] + A[3] + A[4] + A[5] + A[6]
            money = A[7] * A[8]
            res = money - A[1]
            res /= time
            
        else:
            time = A[2] + A[3] + A[4] + A[5] + A[6] + (A[5] + A[6]) * (A[-1] - 1)
            money = A[7] * A[8] * A[-1]
            res = money - A[1]
            res /= time
            
        results.append([res, name])
        
      
    results = sorted(results, key=lambda x: x[1], reverse = True)
    
    results = sorted(results, key=lambda x: x[0])
        
    resultss.append(results)
    
for i in range(len(resultss)):
    for j in range(len(resultss[i])):
        print(resultss[i][-j-1][1])
    print('#')


Measured memory_bytes: 6060
N = int(input())
job_list = list()
for i in range(N):
    job_list.append(tuple(map(int, str(input()).split())))

job_list = sorted(job_list, key=lambda x: (x[1], x[0]))

time = 0
for i in range(N):
    time += job_list[i][0]
    if time > job_list[i][1]:
        print('No')
        exit()

print('Yes')


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

using namespace std;

#define INF 6001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination topcoder lcm

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

    int2(n, K);
    vp data(n);
    rep(i, n) {
        cin >> data[i].fir >> data[i].sec;
    }

    int ans = INF;
    rep(i, n) {
        rep(j, n) {
            rep(k, n) {
                rep(l, n) {
                    int sx = data[i].fir, sy = data[j].sec,
                        ex = data[k].fir, ey = data[l].sec;
                    int cnt = 0;
                    if (sx > ex || sy > ey) continue;
                    rep(y, n) {
                        if (sx <= data[y].fir && data[y].fir <= ex &&
                                sy <= data[y].sec && data[y].sec <= ey) {
                            cnt++;
                        }
                    }
                    if (cnt >= K) {
                        ans = min(ans, max(0LL, ((ex - sx)*(ey - sy))));
                    }
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
fn main(){
    let n:i32 = getline().trim().parse().unwrap();
    let l:Vec<_> = getline().trim().split(' ').map(|a| a.parse().unwrap()).collect();
    
    let long:i32 = *l.iter().max().unwrap();
    let total:i32 = l.iter().sum();
    
    if long < total - long{
        println!("Yes");
    }
    else{
        println!("No");
    }
}

fn getline() -> String{
   let mut __ret=String::new();
   std::io::stdin().read_line(&mut __ret).ok();
   return __ret;
}

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

int main() {
  ll n; cin >> n; 
  if(n%1000==0) cout << 0 << endl;
  else cout << 1000-(n%1000) << endl;
    
  return 0;
}



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

const int N = 7e2 + 5;
const int K = 7e2 + 5;

int dp[N][K] , n , m , C[N][N] , mod , k , S[N][K];

void Add(int &x , int y) {
	if((x += y) >= mod)
	x -= mod;
}

bool vis[N][K] , vis2[N][K];

int solve(int x , int y);

int sum(int x , int y) {
	if(vis2[x][y])
	return S[x][y];
	if(!x || y > k)
	return 0;
	vis2[x][y] = 1;
	for(int i = y;i <= k;++ i) 
	Add(S[x][y] , solve(x , i));
	return S[x][y];
}

int solve(int x , int y) {
	if(!x) {
		return 0;
	}
	if(x == 1) {
		return dp[x][y] = 1;
	}
	if(vis[x][y])
	return dp[x][y];
	vis[x][y] = 1;
	dp[x][y] = 0;
	for(int i = 1;i < x;++ i) {
		Add(dp[x][y]  , 1LL * C[x - 2][i - 1] * solve(x - i , y) % mod * sum(i , y + 1) % mod);
	}
	return dp[x][y];
}

int main() {
	scanf("%d%d%d" , &n , &k , &mod);
	
	for(int i = 0;i <= n;++ i) 
	for(int j = 0;j <= i;++ j) 
	C[i][j] = ((!j) ? 1 : ((C[i - 1][j - 1] + C[i - 1][j]) % mod));
	
	printf("%d\n" , solve(n + 1 , 0));
}

Measured memory_bytes: 5632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] dice = new int[6];
		String W;

		for (int i = 0; i < dice.length; i++) {
			dice[i] = sc.nextInt();
		}

		W = sc.next();
		String[] w = W.split("");
		for (int i = 0; i < w.length; i++) {
			if (w[i].equals("S")) {
				int num = dice[4];
				dice[4] = dice[5];
				dice[5] = dice[1];
				dice[1] = dice[0];
				dice[0] = num;
			} else if (w[i].equals("W")) {
				int num = dice[2];
				dice[2] = dice[5];
				dice[5] = dice[3];
				dice[3] = dice[0];
				dice[0] = num;
			} else if (w[i].equals("N")) {
				int num = dice[1];
				dice[1] = dice[5];
				dice[5] = dice[4];
				dice[4] = dice[0];
				dice[0] = num;

			} else if (w[i].equals("E")) {
				int num = dice[3];
				dice[3] = dice[5];
				dice[5] = dice[2];
				dice[2] = dice[0];
				dice[0] = num;

			}
		}
		System.out.println(dice[0]);
		sc.close();
	}
}



Measured memory_bytes: 26432
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	ll  a, b, c;
	cin >> a >> b >> c;
	if (a == 0) cout << b / c + 1 << endl;
	else cout << (b / c + 1) - ((a - 1) / c + 1) << endl;
}

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

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    int Min;
    if(A + B <= N) Min = 0;
    else Min = A + B - N;
    int Max = min(A, B);
    cout << " " << Max << " " << Min << endl;
}

Measured memory_bytes: 256
a,b,k = map(int,input().split())

ans1=0
ans2=0
if k>=a:
    ans1=0
    if a+b<=k:
        ans2=0
    else:
        ans2=b-(k-a)
else:
    ans1=a-k
    ans2=b
print(ans1,ans2)

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

inline void ioThings() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#endif
}

#define debug(x)    cerr << #x << ": <" << (x) << ">\n"
#define dotc()      int tcs; if (cin >> tcs) for (int tc = 0; tc < tcs; tc++)
#define sz(x)       (int)x.size()
#define eb          emplace_back
#define pb          push_back
#define all(x)      x.begin(), x.end()
#define rall(x)     x.rbegin(), x.rend()
#define fi          first
#define se          second
#define mod         1000000007

using ll = long long;
using vi = vector<int>;

int main() {
  ioThings();

  int h, a; cin >> h >> a;
  cout << (h + a - 1) / a;

  return 0;
}


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

int main() {
  char c;
  cin >> c;
  if (c =='a' || c=='e' || c=='i' || c=='o' || c=='u'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}


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

using namespace std;

const int MOD = 1e9+7;

void solve()
{
	int N;
	cin >> N;
	vector<vector<int>> ok(N, vector<int>(N));
	for (int i = 0; i < N; i++)
		for (int j = 0; j < N; j++)
	{
		cin >> ok[i][j];
	}
	vector<vector<int>> dp(N+1, vector<int>(1<<N));
	dp[0][0] = 1;
	for (int bit = 0; bit < 1<<N; bit++)
	{
		int i = __builtin_popcount(bit);
		for (int j = 0; j < N; j++)
		{
			if (bit>>j&1 || !ok[i][j]) continue;
			dp[i+1][bit|1<<j] += dp[i][bit];
			dp[i+1][bit|1<<j] %= MOD;
		}
	}
	cout << dp[N].back() << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 188800
#include <bits/stdc++.h>
using namespace std;
 
int main()
{   
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int x=c-a,y=d-b;
    cout<<c-y<<" "<<d+x<<" "<<a-y<<" "<<b+x<<endl;
}

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

int main(void){
    int n;
    cin >> n;
    bool win = false;
    rep(i,n) {
        int a;
        cin >> a;
        if (a&1) win = true;
    }
    cout<<((win) ? "first" : "second")<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int i, count_a = 0, count_b = 0, answer;
    char temp;
    String number = sc.next();
    for(i = 0; i < number.length(); i++) {
      temp = number.charAt(i);
      if(i % 2 == 0) {
        if(temp == '0') count_a++;
        else count_b++;
      } else {
        if(temp == '1') count_a++;
        else count_b++;
      }
    }
    answer = (count_a < count_b)? count_a : count_b;
    System.out.println(answer);
  }
}


Measured memory_bytes: 25712
#include <stdio.h>
int main(){
	int a,b,c;
	int count;
	scanf("%d %d %d",&a,&b,&c);
	if(a==b&&b==c){
    	count=1;
    }else if(a==b||b==c||a==c){
    	count=2;
    }else{
    	count=3;
    }
	printf("%d",count);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int X, Y;
	cin >> X >> Y;
	for (int i = 0; i <= X; ++ i) {
		if (2*i + 4*(X-i) == Y) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int n;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	int sum = 0;
	for(int i = 1; i <= n; i++){
		string str = to_string(i);
		if((int)str.length() % 2) sum++;
	}
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 256