akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
using namespace std;

 
int main() {
  long long x;
  cin>>x;
  long long y;
  y=100;
 
 
  for  (long long i = 0; i < 1000000000000; i++) {
     y=1.01*(y-(y%100))+y%100;
   
 
    if (y>=x) {
       cout << i+1 << endl;
      break; 
    }
 
   
  }
 
 
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int ei;
  REP(i,s.size() - 7){
    if(s.substr(i,8) == "FESTIVAL")ei = i;
  }
  cout << s.substr(0, ei) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<pair<ll, ll>> a(n);
  for (int i = 0; i < n; i++){
    cin >> a[i].second >> a[i].first;
  }

  sort(a.begin(), a.end());
  int time = 0;
  for (int i = 0; i < n; i++){
    time += a[i].second;
    if(time > a[i].first){
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}

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

const int N = 18;

using Info = std::array<int, 2>;

int n, a[(1 << N) + 1], ans[1 << N];
Info dp[1 << N];

void update(Info& x, int idx)
{
    if (x[0] == idx || x[1] == idx) {
        return;
    }
    if (a[idx] > a[x[0]]) {
        x[1] = x[0], x[0] = idx;
    } else if (a[idx] > a[x[1]]) {
        x[1] = idx;
    }
}

int main()
{
#ifdef LOCAL_JUDGE
    freopen("C.in", "r", stdin);
#endif
    scanf("%d", &n);
    a[1 << n] = 0;
    for (int i = 0; i < 1 << n; ++ i) {
        scanf("%d", a + i);
    }
    for (int msk = 0; msk < 1 << n; ++ msk) {
        dp[msk][0] = msk;
        dp[msk][1] = 1 << n;
    }
    for (int i = 0; i < n; ++ i) {
        for (int msk = (1 << n) - 1; msk >= 0; -- msk) {
            if (msk >> i & 1) {
                for (auto idx : dp[msk ^ (1 << i)]) {
                    update(dp[msk], idx);
                }
            }
        }
    }
    int res = 0;
    for (int msk = 1; msk < 1 << n; ++ msk) {
        res = std::max(res, a[dp[msk][0]] + a[dp[msk][1]]);
        printf("%d\n", res);
    }
}

Measured memory_bytes: 7168
n,m=map(int, input().split())  #複数数値入力
list1 = [0] * n

for i in range(n):
    list1[i]=list(map(int, input().split()))  #リスト入力（数値）
    list1[i].pop(0)

ans = 0

for i in range(m):
    check = 0
    for j in range(n):
        if not i+1 in list1[j]:
            check =1
            break
    
    if check == 0:
        ans += 1


print(ans)

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int N; cin >> N;
    int c = 5*(1e+4);
    VI a(N), b(N);
    REP(i,N){
        a[i] = (i+1)*c-20000;
        b[N-1-i] = (i+1)*c-20000;
    }

    VI p(N); REP(i,N) cin >> p[i];

    REP(i,N){
        a[p[i]-1] += i;
        b[p[i]-1] += i;
    }

    REP(i,N) cout << a[i] << " ";
    cout << endl;
    REP(i,N) cout << b[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int arr[200005];

int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    for (int x = 0; x<2*n; x++){
        scanf("%d",&arr[x]);
    }
    sort(arr,arr+2*n);
    int l = -1;
    int r = n;
    while (l+1<r){
        int mid = (l+r)/2;
        for (int t = mid*2; 2*n-1+2*mid-t>t; t++){
            int other = 2*n-1+2*mid-t;
            if (arr[t]+arr[other]<m){
                l = mid;
                break;
            }
        }
        if (l!=mid) r = mid;
    }
    int ans = 0;
    for (int x = 0; 2*r-1-x>x; x++){
        ans = max(ans,arr[x]+arr[2*r-1-x]);
    }
    for (int x = 2*r; 2*n-1+2*r-x>x; x++){
        ans = max(ans,arr[x]+arr[2*n-1+2*r-x]-m);
    }
    printf("%d",ans);
}


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

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

    for (int i = 0; i < 2 << 3; i++) {
        int can = abcd[0] - '0';
        stringstream ss;
        ss << abcd[0];
        for (int j = 0; j < 3; j++) {
            if (i & 1 << j) {
                can += abcd[j+1] - '0';
                ss << "+" << abcd[j+1];
            } else {
                can -= abcd[j+1] - '0';
                ss << "-" << abcd[j+1];
            }
        }
        ss << "=7";
        if (can == 7) {
            cout << ss.str() << endl;
            break;
        }
    }
}


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

int main(){
    int a,b,c;
    char op;
    
    vector<int>Ans;
    
    while(true){
        cin>>a>>op>>b;
         
        if(op == '+'){
            c = a+b;
        }
        if(op == '-'){
            c = a-b;
        }
        if(op == '*'){
            c = a*b;
        }
        if(op == '/'){
            c = a/b;
        }
        if(op == '?'){
            break;
        }
        
        Ans.push_back(c);
    
    }
    
    for(vector<int>::size_type i = 0;i<Ans.size();i++){
        cout << Ans[i] << endl;
        
    }
    return 0;
}


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


int gcd(int a, int b) {
    // a > b の確認
    if (a < b) {
        int tmp = a;
        a = b;
        b = tmp;
    }

    int r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main() {
    int n;
    cin >> n;
    ll ans=0;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 1; k <= n; k++) {
                ans += gcd(gcd(i, j), k);
            }
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std ;
#define ll long long 
#define pb push_back
#define in(x) ll x; cin>>x;
#define ln(x) long long x; cin>>x;
#define memf(a) memset(a,false,sizeof(a))
#define F first
#define S second
#define endl "\n"
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
ll dp[101][100005];
int main()
{
	fast
	ll n;
	ll W;
	cin>>n>>W;
	ll w[n],v[n];
	for(ll i=0;i<n;i++)
		cin>>w[i]>>v[i];
	
	for(ll i=0;i<=n;i++)
		for(ll j=0;j<=100000;j++)
			dp[i][j]=1e18;
	dp[0][0]=0;
	dp[0][v[0]]=w[0];
	for(ll i=1;i<n;i++)
	{
		for(ll j=0;j<=100000;j++)
		{
			dp[i][j]=dp[i-1][j];
			if(j>=v[i])
			dp[i][j]=min(dp[i][j],w[i]+dp[i-1][j-v[i]]);
		}
	}
	ll ans=0;
	for(ll i=100000;i>=0;i--)
	{
		if(dp[n-1][i]<=W)
		{
			ans=i;
			break;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 82568
s = input().rstrip().split()
a = int(s[0])
b = int(s[1])
c = int(s[2])
k = int(s[3])

ans = a - b

if(k%2==1):
  ans = -1 * ans

if(abs(ans) < 1000000000000000000):
  print(ans)
else:
  print("Unfair")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
ll H;
ll res=1,ans=0;
int main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>H;
	while(H/2){
		res*=2;
		H/=2;
	}
	cout<<res*2-1<<endl;
    return 0;
}

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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int N;
  cin >> N;

  vector<int> A(N);
  rep(i, N)
  {
    int a;
    cin >> a;

    A[i] = a - (i + 1);
  }
  std::sort(A.begin(), A.end());
  int mid = A[N / 2];

  long long sum = 0;
  rep(i, N)
  {
    sum += std::abs(A[i] - mid);
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[3];
  for(int i=0;i<3;i++) cin >> a[i];
  if(a[0]==7 && a[1]==5 && a[2]==5) cout <<"YES" << endl;
  else if(a[0]==5 && a[1]==7 && a[2]==5) cout <<"YES" << endl;
  else if(a[0]==5 && a[1]==5 && a[2]==7) cout <<"YES" << endl;
  else cout << "NO" << endl;
  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;
    }
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;
int main()
{
	// ABC042-C, 1053, 
	int n, k;
	cin >> n >> k;
	vector<int> d(k);
	rep(i, k) cin >> d[i];
	int ans = n;
	while (1) {
		int tmpans = ans;
		bool ok = true;
		while (tmpans != 0) {
			rep(i, k) {
				if (d[i] == tmpans % 10) {
					ok = false; break;
				}
			}
			if (!ok) break;
			tmpans /= 10;
		}
		if (ok) break;
		ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3600
import java.util.Scanner;

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

	int N = sc.nextInt();
	int A[] = new int[N];
	int B[] = new int[N];
	int C[] = new int[N - 1];
	for (int i = 0; i < N; i++)
	    A[i] = sc.nextInt();
	for (int i = 0; i < N; i++)
	    B[i] = sc.nextInt();
	for (int i = 0; i < N - 1; i++)
	    C[i] = sc.nextInt();

	int count = B[A[0] - 1];
	for (int i = 1; i < N; i++) {
	    count += B[A[i] - 1];
	    if (A[i - 1] + 1 == A[i])
		count += C[A[i - 1] - 1];
	}

	System.out.println(count);
    }
}

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++) 
#define reps(i, A, n) for(int (i)=(A); (i)<(n); (i)++)
#define pb emplace_back
#define all(p) (p).begin(), (p).end()
using LL = long long;

const LL MOD = 1e9+7;
 
int N;
vector<int> B[2];
vector<int> A, C;
map<int, int> rev;

int main() {
  scanf("%d", &N);
  A.resize(N);
  rep(i, N) {
    scanf("%d", &A[i]);
    C.pb(A[i]);
    rev[A[i]] = i%2;
  }
  sort(all(C));
  int prev = -1;
  LL ans = 0;
  rep(i, N) {
    ans += rev[C[i]] ^ (i%2);
  }
  printf("%lld\n", ans/2);
}


Measured memory_bytes: 6776
n = int(input())
a = list(map(int,input().split()))
X = dict()
ans = 0
for i in range(n):
    R = i + a[i]
    if not R in X:
        X[R]=1
    else: X[R]+=1

for i in range(n):
    L = i - a[i]
    if L in X:
        ans+=X[L]
print(ans)

Measured memory_bytes: 40348
//#include <tourist>
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//g++ yarudake.cpp -std=c++17 -I .
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; }
// 素集合データ構造
struct UnionFind
{
    // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
    vector<int> par;
    // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
    vector<int> sizes;

    UnionFind(int n) : par(n), sizes(n, 1)
    {
        // 最初は全てのデータiがグループiに存在するものとして初期化
        rep(i, n) par[i] = i;
    }

    // データxが属する木の根を得る
    int find(int x)
    {
        if (x == par[x])
            return x;
        return par[x] = find(par[x]); // 根を張り替えながら再帰的に根ノードを探す
    }

    // 2つのデータx, yが属する木をマージする
    void unite(int x, int y)
    {
        // データの根ノードを得る
        x = find(x);
        y = find(y);

        // 既に同じ木に属しているならマージしない
        if (x == y)
            return;

        // xの木がyの木より大きくなるようにする
        if (sizes[x] < sizes[y])
            swap(x, y);

        // xがyの親になるように連結する
        par[y] = x;
        sizes[x] += sizes[y];
        // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
    }

    // 2つのデータx, yが属する木が同じならtrueを返す
    bool same(int x, int y)
    {
        return find(x) == find(y);
    }

    // データxが含まれる木の大きさを返す
    int size(int x)
    {
        return sizes[find(x)];
    }
};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    UnionFind uf(n);
    rep(i,m){
        ll a,b;
        cin>>a>>b;
        a--;
        b--;
        uf.unite(a,b);
    }
    ll count=0;
    rep(i,n){
        if(uf.find(i)==i)count++;
    }
    cout<<count-1<<"\n";
}

Measured memory_bytes: 3992
#!/usr/bin/env python3




def main():
    # Failed to predict input format
    n = int(input())
    a = list(map(int, input().split()))

    if all([i%3 == 0 or i%5 == 0 for i in a if i%2 == 0]):
        print('APPROVED')
    else:
        print('DENIED')
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
    using namespace std;
    using namespace __gnu_pbds;
    #define ll long long
    #define int long long
    #define pb push_back
    #define For(i,n) for(ll  i=0;i<n;i++)
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;clock_t clk = clock();
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define mod 998244353
    #define ld long double
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define fi first
    #define se second
    #define pii pair<ll,ll>
    #define what_is(x) cerr << #x << " is " << x << endl;
    #define time cerr << "Time (in ms): " << double(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';
    const double pi=3.14159265358979323846264;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;

/**********************************************************************************************************************/
const ll man=3005;
ll a[man];
ll dp[man][man];
signed main()/*Check flow--------question galat mat padhna */
{
    fast;   
    ll n,s;
    cin>>n>>s;
    dp[0][0]=1;// zero select and zero banae ---1 option
    For(i,n)cin>>a[i];
    For(i,n)
    {
        For(j,s+1)
        {
            dp[i+1][j]+=2*dp[i][j];//no. of sum j if ith element added doubles
            dp[i+1][j]%=mod;
            if(j+a[i]<=s)
            {
                dp[i+1][j+a[i]]+=dp[i][j];//if this included than someone increased
                dp[i+1][j+a[i]]%=mod;
            }
        }
    }
    cout<<dp[n][s]<<endl;
}   

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

using namespace std;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef long long ll;

const ll lim = 6208;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x, a;
    cin >> x;
    map<ll,ll> p5;
    for(a = 0;a<=lim;a++){
        p5[a*a*a*a*a] = a;
    }

    ll b;
    for(b = 0;b<=lim;b++){
        ll b5 = b*b*b*b*b;
        if((x-b5 >= 0) && p5.find(x-b5) != p5.end()){
            a = p5[x-b5];
            b = -b;
            break;
        }
        if(p5.find(x+b5) != p5.end()){
            a = p5[x+b5];
            
            break;
        }
    }
    

    cout << a << " " << b << "\n";

    return 0;
}

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

const int INF = 1001001001;
struct node {
  double l;
  int fin;
  vector<int> c;
};
using P = pair<double, int>;

int main() {
  int h, w, k, a, b, c, d;
  scanf("%d %d %d", &h, &w, &k);
  scanf("%d %d %d %d", &a, &b, &c, &d);
  double st = 1.0 / k;
  --a, --b, --c, --d;
  vector<node> v(4 * h * w, {INF, 0, vector<int>()});
  v[h * a + b].l = 0;
  ios::sync_with_stdio(true);
  cin.tie(0);
  vector<string> s(h);
  int dir[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
  for(int i = 0; i < h; i++) cin >> s[i];
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      if(s[i][j] == '.') {
        for(int k = 0; k < 4; k++)
          v[w * i + j + h * w * k].c.push_back(w * i + j + (k + 1) % 4 * h * w);
        for(int k = 0; k < 4; k++) {
          int nx = i + dir[k][0], ny = j + dir[k][1];
          if(nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
          if(s[nx][ny] == '.')
            v[w * i + j + h * w * k].c.push_back(w * nx + ny + h * w * k);
        }
      }
    }
  }
  priority_queue<P, vector<P>, greater<P>> que;
  que.push(P(0, w * a + b));
  while(que.size()) {
    auto q = que.top();
    que.pop();
    if(v[q.second].fin) continue;
    v[q.second].fin = 1;
    for(int i = 0; i < v[q.second].c.size(); i++) {
      int ind = v[q.second].c[i];
      if(v[ind].fin) continue;
      if(i) {
        if(v[ind].l > q.first + st) que.push(P((v[ind].l = q.first + st), ind));
      } else {
        double l = ceil(q.first);
        if(l - q.first > 1 - 0.000001) l--;
        if(v[ind].l > l) que.push(P((v[ind].l = l), ind));
      }
    }
  }
  double l;
  if(v[w * c + d].l != INF) {
    l = ceil(v[w * c + d].l);
    if(l - v[w * c + d].l > 1 - 0.0000001) l--;
  } else
    l = -1;
  cout << (int)l << '\n';
}

Measured memory_bytes: 285016
import sys

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

a, b = MAP()
c = list(range(b-(a-1),b+(a)))
#print(c)
print(' '.join(map(str,c)))

Measured memory_bytes: 38256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

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

int n, q;

class node
{
public:
	string name;
	int start, end;

	node(string n, int a, int b):name(n), start(b-a+1), end(b){}

	bool is_in_range(int year)
	{
		return start <= year && year <= end;
	}
};

int main(void)
{
	while(cin >> n >> q, n|q) {
		vector<node> vs;
		rep(i, n) {
			string name;
			int erabased, westernyear;
			cin >> name >> erabased >> westernyear;
			vs.push_back(node(name, erabased, westernyear));
		}

		rep(i, q) {
			int year;
			cin >> year;
			int cnt = 0, idx = -1;
			rep(j, vs.size()) {
				if(vs[j].is_in_range(year)) {
					idx = j;
					cnt++;	
				}
			}
			if (cnt != 1)
				printf("Unknown\n");
			else
				printf("%s %d\n", vs[idx].name.c_str(), year-vs[idx].start+1);
		}
	}
	return 0;
}

Measured memory_bytes: 1284
//omajinai c++
#include <iostream>
#include<cmath>
#include<vector>
#include <algorithm>
#include <limits>
#include <numeric>
#include <type_traits>
#include <map>
#include <string>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
constexpr auto mod = 1000000007;
using namespace std;
int main(void) {
int n;
  cin>>n;
  cout<<(n+1)/2;
}


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

#define itf  ios_base::sync_with_stdio(false)
#define ct  cin.tie(NULL)
#define ll long long int

ll Z[1000001];

ll step(ll a[],ll n,ll i,ll k)
{
    if(i>=n || k==0) 
    return 0;
    
    ll mn=INT_MAX;
    
    if(Z[i]!=-1)
    return Z[i];
    
    for(int j=k;j>=1;j--)
    {
    	
       Z[i]=(mn=min(mn,abs(a[i]-a[i+j])+step(a,n,i+j,k)));
       // cout<<mn<<" ";
    }
    return Z[i];
}

int main() {
    
    memset(Z,-1,sizeof(Z));
    int n,k;
    cin>>n>>k;
    ll a[n+1];
    
    for(int i=1;i<=n;i++)
    cin>>a[i];
   ll dp[n+1]={0};
   memset(dp,-1,sizeof(dp));
   dp[0]=0;
   dp[1]=0;
   dp[2]=abs(a[2]-a[1]);
   
   
   
   for(int i=3;i<=n;i++)
   {

   	 for(int j=i-1;j>=max(1,i-k);j--)
   	 {
   	 	if(dp[i]==-1)
   	 	{
   	 		dp[i]=dp[j]+abs(a[j]-a[i]);
   	 	}
   	 	//cout<<j<<" "<<dp[j];
   	 	dp[i]=min(dp[i],dp[j]+abs(a[j]-a[i]));
   	 }
   	 
   	//cout<<dp[i]<<" ";
   	
   }
    cout<<dp[n]<<" ";
	return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
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;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

struct unionfind{
	vll par;
	unionfind(ll n) : par(n) {
		rep(i, 0, n) par.at(i) = i;
	}
	ll root(ll x){
		if(par.at(x) == x) return x;
		return par.at(x) = root(par.at(x));
	}
	void unite(ll x, ll y){
		ll rx = root(x), ry = root(y);
		par.at(rx) = ry;
	}
	bl same(ll x, ll y){
		ll rx = root(x), ry = root(y);
		return rx == ry;
	}
};

int main(){
	ll n, m;
	cin >> n >> m;
	vll p(n);
	vin(p);
	unionfind tree(n);
	rep(i, 0, m){
		ll x, y;
		cin >> x >> y;
		x--; y--;
		tree.unite(x, y);
	}
	ll ans = 0;
	rep(i, 0, n) if(tree.same(i, p.at(i) - 1)) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.*;
import java.io.*;

class Main {
  public static void main(String args[]) {
    try {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String w = br.readLine();
      String l;
      List<String> t = new ArrayList<String>();
      while (!(l = br.readLine()).equals("END_OF_TEXT")) {
        for (String in : l.split(" ")) {
          t.add(in);
        }  
      }
      int ans = 0;
      for (String str : t) {
        if (str.equalsIgnoreCase(w)) {
          ans++;
        }
      }
      System.out.println(ans);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}

Measured memory_bytes: 16912
#include<stdio.h>
#include<string.h>
int main(void){
  int n;
  int i;
  char str[10];
  int ac = 0;
  int wa = 0;
  int tle = 0;
  int re = 0;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",str);
    if(strcmp("AC",str)==0){
     ac++;
    }else if(strcmp("WA",str)==0){
     wa++; 
    }else if(strcmp("TLE",str)==0){
     tle++; 
    }else if(strcmp("RE",str)==0){
     re++; 
    }
  }
  
  printf("AC x %d\n",ac);
  printf("WA x %d\n",wa);
  printf("TLE x %d\n",tle);
  printf("RE x %d\n",re);
  
 return 0; 
}

Measured memory_bytes: 1728
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> h(n + 1);
    for(int i = 0; i < n; ++i){
        cin >> h[i];
    }
    h[n] = 0;
    
    int res = 0;
    int l = 0, r = 0;
    while(l < n){
        int cnt = 0;
        while(h[l] >= h[++r]){
            if(r == n)  break;
            
            ++l;
            ++cnt;
        }
        
        res = max(res, cnt);
        l = r;
    }
    
    cout << res << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

#define int long long

signed main()
{
    int n;
    vector<int> a;
    vector<int> sum;

    cin >> n;

    a.resize(n);
    sum.resize(n + 1, 0);

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

    for(int i = 1; i <= n; ++i)
    {
        sum[i] = sum[i - 1] + a[i - 1];
    }

    int ans = 200000LL * 2020202020LL; 

    for(int i = 1; i <= n; ++i)
    {
        int l = sum[i];
        int r = sum[n] - sum[i];

        ans = min(ans, abs(l - r));
    }

    cout << ans << endl;
}

Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
int n,a,b,c,i,tot,ai,bi,ci,aii,bii;
int main()
{
  //freopen("1.in","r",stdin);freopen("1.out","w",stdout)
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>n>>tot;
  tot/=1000;
  a=10,b=5,c=1;
  int no=1;
  for(ai=0;ai*10<=tot;ai++)
  {
	aii=ai;
    for(bi=0;bi*5<=tot-aii;bi++)
    {
	  bii=bi;
	  ci=tot-aii*10-bii*5;
      if(aii+bii+ci==n && ci>=0)
        {no=0;goto num1;}
	}
  } 
  if(no==1) cout<<"-1 -1 -1"<<endl; 
  num1:
    if(no==0) cout<<aii<<" "<<bii<<" "<<ci<<endl;
  return 0; 
}


Measured memory_bytes: 256
using namespace std;

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <numeric>
typedef long long ll;
typedef pair<int,int> p;

int main()
{
  ll n,m;
  cin >> n >> m;
  ll s = n*m;
  ll tmp = n*2 + m*2 - 4;
  cout << abs(s - tmp) << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void) {
  //input
  int a,b,c,count;
  cin >> a >> b >> c;
  count = 0;
  for(int i=a;i<=b;i++){
    if(c % i == 0){
      count++;
    }
  }

  cout << count << endl;
  return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    int n = (int) s.length();
    int kol = 15 - n;
    for (int i = 0; i < n; i++) kol += (s[i] == 'o');
    if (kol >= 8) cout << "YES\n";
    else cout << "NO\n";
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;

int main(){
	string n;
	cin>>n;
	int a=n.size();
	if(a==1){
		cout<<n[0]-'0'<<endl;
		return 0;
	}
	bool ok=false;
	for(int i=1;i<a;i++)if(n[i]!='9')ok=true;
	if(ok){
		int ans=(a-1)*9;
		ans+=(n[0]-'0'-1);
		cout<<ans<<endl;
	}else{
		cout<<9*(a-1)+(n[0]-'0')<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

s = S()
t = S()
for i in range(len(s)):
    tmp = s[i:] + s[:i]
    if tmp == t:
        print("Yes")
        exit()
print("No")

Measured memory_bytes: 64492
#include<cstdio>

int main(){
    while(true){
        int a,b;
        scanf("%d %d",&a,&b);
        if(a==0 & b==0)break;
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                if(0<i & i<(a-1) &
                0<j & j<(b-1)){
                    printf(".");
                }
                else{printf("#");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2600
#include<bits/stdc++.h>
#define inf 1<<29
#define linf 1e18
#define eps (1e-8)
#define mod 1000000007
#define pi M_PI
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int main()
{
  string s;
  int a,b,c,d;

  while(1){
    cin>>s;
    if(s=="#")break;
    cin>>a>>b>>c>>d;
    a--;b--;c--;d--;
    bool grid[10][10]={};
    int y=0,x=0;
    FOR(k,0,s.length()){
      if(s[k]=='b'){
        grid[y][x]=true;
        x++;
      }
      else if(s[k]=='/'){
        y++;
        x=0;
      }
      else x+=(s[k]-'0');
    }
    swap(grid[a][b],grid[c][d]);
    string ans="";
    FOR(i,0,y+1){
      int space=0;
      FOR(j,0,x+1){
        if(grid[i][j]){
          if(space!=0)ans+=space+'0';
          ans+="b";
          space=0;
        }
        else space++;
      }
      space--;
      if(0<space)ans+=space+'0';
      if(i!=y)ans+="/";
    }
    cout<<ans<<endl;
  }
        
  return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define int long long
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define out(s) freopen(s, "w", stdout);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 2e5 + 5;
int n, a[N], dp[N][5];
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	fw (i, 0, n) cin >> a[i];
//	Final array have a form of: 0s evens odds evens 0s
	memset(dp, 63, sizeof dp);
	dp[0][0] = 0;
	fw (i, 0, n) fw (j, 0, 5) if (dp[i][j] != infll) {
//		cout << "dp[" << i << "][" << j << "] = " << dp[i][j] << "\n";
		if (j < 4) dp[i][j + 1] = min(dp[i][j + 1], dp[i][j]);
		int cost = 0;
		if (j == 0 || j == 4) cost = a[i];
		else if (j == 1 || j == 3) {
			if (a[i] % 2 == 1) cost = 1;
			else {
				if (a[i] == 0) cost = 2;
				else cost = 0;
			}
		} else {
			if (a[i] % 2 == 1) cost = 0;
			else cost = 1;
		}
//		cout << "i = " << i << " j = " << j << " cost = " << cost << " dpij = " << dp[i][j] << "\n";
		dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + cost);
//		cout << "dp[" << i + 1 << "][" << j << "] = " << dp[i + 1][j] << "\n";
	}
	int ans = infll;
	fw (j, 0, 5) {
		ans = min(ans, dp[n][j]);
//		cout << "dp[" << n << "][" << j << "] = " << dp[n][j] << "\n";
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 9600
from sys import stdin

n = int(stdin.readline().rstrip())

w = stdin.readline().rstrip()
w_lst = [w]
prev = w[-1]
f = True

for _ in range(n-1):
  w = stdin.readline().rstrip()
  if(w[0] != prev or w in w_lst):
    f = False
    break
  else:
    w_lst.append(w)
    prev = w[-1]
    
if f: print('Yes')
else: print('No')

Measured memory_bytes: 3316
#include<iostream>
#include<iomanip>
#include<limits>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define big ((ll)(1e9)+7)

int main(){
  int a[3][3];
  for(int i = 0;i < 3;i++)
  {
    for(int j = 0;j < 3;j++)
    {
      cin >> a[i][j];
    }
  }
  // for(int i = 0;i < 3;i++)
  // {
  //   for(int j = 0;j < 3;j++)
  //   {
  //     cout << a[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  int n;
  cin >> n;
  vector<int> b;
  for(int i = 0;i < n;i++)
  {
    int B;
    cin >> B;
    b.push_back(B);
  }
  bool ans[3][3] = {false};
  for(int l = 0;l < n;l++)
  {
    for(int i = 0;i < 3;i++)
    {
      for(int j = 0;j < 3;j++)
      {
        if(a[i][j] == b[l])
        {
          ans[i][j] = true;
          // break;
        }

      }
    }
  }
  // for(int i = 0;i < 3;i++)
  // {
  //   for(int j = 0;j < 3;j++)
  //   {
  //     cout << ans[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  // if(ans[1][1])
  // {
  //     cout << "a" << endl;
  // }
  // if(ans[2][2])
  // {
  //     cout << "b" << endl;
  // }
  // if(ans[3][3])
  // {
  //     cout << "c" << endl;
  // }
  for(int i = 0;i < 3;i++)
  {
    if(ans[i][0] && ans[i][1] && ans[i][2])
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  for(int i = 0;i < 3;i++)
  {
    if(ans[0][i] && ans[1][i] && ans[2][i])
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if(ans[0][0] && ans[1][1] && ans[2][2])
  {
    cout << "Yes" << endl;
    return 0;
  }
  if(ans[2][0] && ans[1][1] && ans[0][2])
  {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<set>
#define ll long long
using namespace std;
double a[1000000]={0};
int main(){
    int t;
    cin>>t;
    for(int i=0;i<t;i++){
        cin >>a[i];
    }
    sort(a,a+t);
    double sum=0;
    sum = (a[0]+a[1])/2;
    for(int i=2;i<t;i++){
        sum = (sum+a[i])/2;
    }
    cout<<sum<<endl;
     return 0;
}

Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;

using ll = long long;
typedef pair<ll, ll> P_ll;
typedef pair<int, int> P;

const ll INF_ll = 1e17;
const int INF = 1e8;

int main() {
  map<string, int> mp;
  mp["AC"] = 0;
  mp["WA"] = 0;
  mp["TLE"] = 0;
  mp["RE"] = 0;
  ll N;
  cin >> N;
  string s;
  for (ll i = 0; i < N; i++) {
    cin >> s;
    mp[s]++;
  }

  printf("AC x %d", mp["AC"]);
  cout << endl;
  printf("WA x %d", mp["WA"]);
  cout << endl;
  printf("TLE x %d", mp["TLE"]);
  cout << endl;
  printf("RE x %d", mp["RE"]);
  cout << endl;

  return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
using namespace std;
using ll = unsigned long long;
using p = pair<int, int>;

int main()
{
    int N;

    cin >> N;

    int cnt = 0;
    rep(i, 0, N)
    {
        int a;
        cin >> a;
        if ((i + 1) % 2 == 0)
        {
            continue;
        }
        if (a % 2 != 0)
        {
            ++cnt;
        }
    }

    cout << cnt << endl;
    return 0;
}


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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}


int main () {
int a [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
// 配列の添字は 0 から始まるので，a [0] は 0 にしている．
int x , y ; cin >> x >> y ;
cout << ( a [ x ] == a [ y ] ? " Yes " : " No ") << endl ;
}


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

string f(ll n) {
    if (n == 0) return "";
    n--;
    return f(n / 26) + string(1, 'a' + n % 26);
}

int main() {
    ll n; cin >> n;
    cout << f(n) << endl;

    return 0;
}

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

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//template <typename T> using orderSet =
//tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long llu;
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout)
#define inf 1000000000000000018
#define mod 1000000007
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>

#define MX 200005

int main()
{
	ll a, b, c, d, x, y;
	cin>>a>>b>>c>>d;

	x = (c+b-1)/b;
	y = (a+d-1)/d;

    if(y < x) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}


Measured memory_bytes: 3624
// https://atcoder.jp/contests/dp/tasks/dp_a

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<ll>
#define loop(i,a,b) for(int i = a;i < b; i++)
#define rloop(i,a,b) for(int i = b;i >= a; i--)
void solve(){
    ll n,k;
    cin>>n>>k;
    vi v(n);
    loop(i,0,n)cin>>v[i];
    vi dp(n,INT_MAX);
    dp[0] = 0;
    loop(i,1,n){
        loop(j,1,k+1){
            if(i >= j)dp[i] = min(dp[i],dp[i-j] + abs(v[i] - v[i-j]));
        }
    }
    // loop(i,0,n)cout<<dp[i]<<" ";
    // cout<<'\n';
    cout<<dp[n-1]<<'\n';
    return ;
}
int main(){
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#define INF 0x3f3f3f3f
#define MAX_N 1001000
#define MOD 1000000007
#define ll long long
#define LL long long
using namespace std;
void optimize_cpp_stdio()
{
    std::ios::sync_with_stdio(false);
    std::cout.tie(NULL);
    std::cin.tie(NULL);
}

int n, a, b;

#define MAXSIZE 100
unsigned long answer[MAXSIZE];

unsigned long long int power(unsigned long base, unsigned long exp)
{
    unsigned long long int result = 1;
    while (exp)
    {
        if (exp & 0x01)
            result = result * base % MOD;
        base = base * base % MOD;
        exp >>= 1;
    }

    return result  % MOD;
}

unsigned long cn2(unsigned long n)
{
    unsigned long x = (1 << n) + 1;
    unsigned long mask = (1 << n) - 1;

    return (power(x, n) >> ((n >> 1) * n)) & mask;
}

unsigned long factorial(unsigned long n)
{
    unsigned long temp;

    if (n == 1)
        return 1;
    else if (n & 0x01 == 1)
        return n * factorial(n - 1);
    else
    {
        temp = factorial(n >> 1);
        return cn2(n) * temp * temp % MOD;
    }
}

long long quickpow(long long X, long long N)
{
    long long x = X, n = N;
    long long ans = 1;
    while(n > 0)
    {
        if(n & 1)
            ans = ans * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ans;
}

int inv(int a)
{
	//return fpow(a, MOD-2, MOD);
	return a==1?1:(long long)(MOD-MOD/a)*inv(MOD%a)%MOD;
}
LL C(LL n,LL m)
{
	if(m<0)return 0;
	if(n<m)return 0;
	if(m>n-m)m=n-m;
	LL up=1,down=1;
	for(LL i=0;i<m;i++)
	{
		up=up*(n-i)%MOD;
		down=down*(i+1)%MOD;
	}
	return up*inv(down)%MOD;
}

int main()
{
    scanf("%d", &n);
    scanf("%d%d", &a, &b);
    long long ans = quickpow(2, n) - 1;
    ans = (ans - C(n, a) + MOD) % MOD;
    ans = (ans - C(n, b) + MOD) % MOD;
    printf("%d\n", ans);
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> s(m);
  vector<int> c(m);
  for (int i = 0; i < m; i++){
    cin >> s.at(i) >> c.at(i);
  }
  int ans = -1;
  
  if (n == 1){
    for (int i = 0; i < 10;i++){
      string x = to_string(i);
      bool z = true;
      for (int j = 0; j < m; j++){
        if (x.at(s.at(j) - 1)-'0' != c.at(j)){
          z = false;
        }
      }
      if (z){
        ans = i;
        break;
      }
    }
  }
  
  if (n == 2){
    for (int i = 10; i < 100;i++){
      string x = to_string(i);
      bool z = true;
      for (int j = 0; j < m; j++){
        if (x.at(s.at(j) - 1)-'0' != c.at(j)){
          z = false;
        }
      }
      if (z){
        ans = i;
        break;
      }
    }
  }
  
  if (n == 3){
    for (int i = 100; i < 1000;i++){
      string x = to_string(i);
      bool z = true;
      for (int j = 0; j < m; j++){
        if (x.at(s.at(j) - 1)-'0' != c.at(j)){
          z = false;
        }
      }
      if (z){
        ans = i;
        break;
      }
    }
  }  
  cout << ans << endl;
}


Measured memory_bytes: 3700
#include <cstdio>

char S[101];
char T[101];

int main(){
  scanf("%s", S);
  scanf("%s", T);

  char *C;
  for(C=T;*C;C++) putchar(*C);
  for(C=S;*C;C++) putchar(*C);
  
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

    int n,p;
    while(true){
	cin >> n >> p;
	vector<int> part(n);
	int peb = p;
	int winner=-1,count = 0;
	if(n == 0&& p==0)  break;
	while(true){
	    count++;
	    if(count > 1e6) break;
	    for(int i=0;i<n;i++){
		if(peb>0){
		    peb--;
		    part[i]++;
		}else{
		    peb = part[i];
		    part[i] = 0;
		}
		if(part[i] == p){
		    winner = i;
		    break;
		}
	    }
	    if(winner!=-1) break;
	}
	cout << winner << endl;
    }


    return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  string s = to_string(a) + to_string(b);
  int c = stoi(s);
  if (sqrt(c) == floor(sqrt(c))) cout << "Yes";
  else cout << "No";
  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;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k;cin >>n >> k;
  ll ans= 0;
  while(n){
    n /= k;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int n;
    cin >> n;
    vector<int> arr(n, 0);
    for(auto& val: arr)
        cin >> val;
    int S = accumulate(arr.begin(), arr.end(), 0);
    S = S*S;
    for(auto& val: arr)
        S -= val*val;
    cout << S / 2 << endl;
    return 0;
}




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

int a;
bool ima[4];

int main(){
	for(int i=0;i<4;i++){
		cin>>a;
		if(a==1){
			ima[0]=true;
		}else if(a==9){
			ima[1]=true;
		}else if(a==7){
			ima[2]=true;
		}else if(a==4){
			ima[3]=true;
		}
	}	
	
	for(int i=0;i<4;i++){
		if(ima[i]==false){
			cout<<"NO";
			return 0;
		}
	}
	
	cout<<"YES";
}

Measured memory_bytes: 256
n = int(input())
x = [int(x) for x in input().split()]
inf = 10**9+7
a = 1
for i in range(n-1, 0, -1):
    a *= i
    a %= inf
b = a
key = 0
ans = 0
for i in range(n-1):
    key += a*pow((i+1), inf-2, inf)
    key %= inf
    ans += key*(x[i+1]-x[i])
    ans %= inf
    

print(ans)

Measured memory_bytes: 14252