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

int main()
{
    int h, w, k;
    cin >> h >> w >> k;

    vector<vector<char>> tile;
    tile.assign(h, vector<char>(w));

    rep(i, h) rep(j, w) cin >> tile[i][j];

    int ans = 0;

    for (int hbit = 0; hbit < (1 << h); ++hbit)
    {
        vector<vector<char>> ref = tile;
        for (int i = 0; i < h; ++i)
        {
            if (hbit & (1 << i))
                rep(j, w) ref[i][j] = '.';
        }

        for (int wbit = 0; wbit < (1 << w); ++wbit)
        {
            vector<vector<char>> ref2 = ref;
            for (int i = 0; i < w; ++i)
            {
                if (wbit & (1 << i))
                    rep(j, h) ref2[j][i] = '.';
            }
            int count = 0;
            rep(i, h) rep(j, w) if (ref2[i][j] == '#')++ count;

            if (count == k)
                ++ans;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for p1, p2, p3 in zip(p, p[1:], p[2:]):
    if p2 != max(p1, p2, p3) and p2 != min(p1, p2, p3):
        cnt += 1
print(cnt)


Measured memory_bytes: 2940
from collections import defaultdict


def main():
    A, B = map(int, input().split())
    if A == 1:
        A = 14
    if B == 1:
        B = 14
    if A == B:
        print("Draw")
    elif A > B:
        print("Alice")
    else:
        print("Bob")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    int x[N], y[N];
    int t[N], u[N];
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
        t[i] = x[i] + y[i];
        u[i] = x[i] - y[i];
    }
    sort(t, t + N);
    sort(u, u + N);
    int v1 = max(t[N - 1] - t[0], u[N - 1] - u[0]);
    int v2 = max(t[N- 1] - u[0], u[N- 1] - t[0]);
    int ans = max(v1, 0);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6692
from itertools import product
def main():
    INF = 10**9
    N, M = map(int, input().split())
    E = [[INF]*N for i in range(N)]
    G = [set() for i in range(N)]
    D = [0]*N
    for i in range(M):
        u, v, f = map(int, input().split()); u -= 1; v -= 1
        E[u][v] = E[v][u] = f
        G[u].add(v)
        G[v].add(u)
        D[u] += 1; D[v] += 1

    def calc(vs):
        if len(vs) == 1:
            return 0
        res = 0
        for ps in product([0, 1], repeat=len(vs)):
            R = [v for p, v in zip(ps, vs) if p]
            if len(R) == 1:
                continue
            rs = 0
            for v in R:
                r = INF
                for w in R:
                    if v == w:
                        continue
                    r = min(r, E[v][w])
                rs += r
            res = max(res, rs)
        return res

    def dfs(V, P, X):
        if not P and not X:
            return calc(V)
        u = next(iter(X or P))
        r = 0
        for v in P - G[u]:
            r = max(r, dfs(V | {v}, P & G[v], X & G[v]))
            P.remove(v)
            X.add(v)
        return r

    *I, = range(N)
    I.sort(key = D.__getitem__, reverse=1)

    ans = 0
    P = set(range(N))
    X = set()
    for v in I:
        ans = max(ans,  dfs({v}, P & G[v], X & G[v]))
        P.remove(v)
        X.add(v)
    print(ans)
main()



Measured memory_bytes: 5808
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
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 Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

int main(){
    int H, W, D;
    cin >> H >> W >> D;

    //vector<vector<int>> A(H, vector<int>(W));
    //rep(i,H) rep(j,W) cin >> A[i][j];
    map<int, pair<int, int>> positions;
    rep(i,H){
        rep(j,W){
            int a; cin >> a;
            pair<int, int> p = make_pair(i,j);
            positions[a] = p;
        }
    }    
    vector<int> C(H*W+1,0);
    rep(i,D){
        int index = i + D;
        while(index <= H*W){
            int x = abs(positions[index].first-positions[index-D].first);
            int y = abs(positions[index].second-positions[index-D].second);   
            C[index] = x + y + C[index-D];             
            index += D;
        }
    }

    int Q; cin >> Q;
    vector<int> L(Q), R(Q);
    rep(i,Q) cin >> L[i] >> R[i];

    rep(i,Q){
        printf("%d\n", C[R[i]] - C[L[i]]);
    }


}

Measured memory_bytes: 10124
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class AC>void r(AC &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
string s,c;
int main(){
	cin>>s>>c;
	if(s>c)cout<<">"<<endl;
	else if(s<c)cout<<"<"<<endl;
	else cout<<"="<<endl; 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll MOD = 1e9 + 7;

//M^N modMOD
ll modpow(ll M, ll N) {
  if(N==0) return 1;
  else if(N%2==0) return modpow(M, N/2)*modpow(M, N/2)%MOD;
  else return M*modpow(M, N-1)%MOD;
}

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

  vector<ll> num(K+1);
  for(ll i=1; i<=K; ++i) num[i] = modpow(K/i, N);
  
  for(ll i=K; i>0; --i) {
    set<ll> divisor_sqrt, divisor;
    for(ll j=1; j*j<=i; ++j) if(i%j==0) divisor_sqrt.insert(i/j);
    for(ll j: divisor_sqrt) {
      divisor.insert(j);
      divisor.insert(i/j);
    }
    divisor.erase(i);
    
    for(ll j: divisor) num[j] -= num[i];
  }
  
  ll ans=0;
  for(ll i=1; i<=K; ++i) ans += i*num[i];
  
  cout << ans%MOD << '\n';
  return 0;
}


Measured memory_bytes: 3992
#include<stdio.h>
#include<string.h>
int main()
{
    int n,m,i,j,sum,x,y;
    char a[100][100];
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        memset(a,0,sizeof(a));
        getchar();
        for(i=1;i<=n;i++)
            {
                for(j=1;j<=m;j++)
                    scanf("%c",&a[i][j]);
                getchar();
            }
        for(i=1;i<=n;i++)
            for(j=1;j<=m;j++)  {sum=0;
    if(a[i][j]=='#')
   continue;
 for(x=-1;x<2;x++)
  for(y=-1;y<2;y++)
  {if(a[i+x][j+y]=='#')
   sum++;
     }
 a[i][j]=sum;
            }
 for(i=1;i<=n;i++)
    {
       for(j=1;j<=m;j++)
        if(a[i][j]=='#')
             printf("#");
         else
             printf("%d",a[i][j]);
             printf("\n");
   }
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define int long
using namespace std;
signed main(void){
    // Here your code !
    string o, e;
    cin >> o >> e;
    REP(i, o.size()) {
        cout << o[i];
        if(i!=o.size()-1) {
            cout << e[i];
        } else if(o.size() == e.size()) {
            cout << e[i] << endl;
        } else {
            cout << endl;
        }
    }
}


Measured memory_bytes: 256
#include<string>
#include<iostream>
using namespace std;
#include<algorithm>
#include<vector>
#include<cstdio>
#include<random>
#include<functional>


 
int main(){
int A, B, M;



int i, amin=100000, bmin=100000;

cin >> A >> B >> M;

int a[A]; //配列だから0からじゃじまってる
int b[B];
int x[M], y[M], c[M]; //元の数字

for(i=0; i<A; i++){
    cin >> a[i];
    if(amin>a[i]){
        amin = a[i];
    }
    
}

for(i=0; i<B; i++){
 cin >> b[i];
    if(bmin > b[i]){
        bmin = b[i];
    }
}

for(i=0; i<M; i++){
    cin >> x[i] >> y[i] >> c[i];
}


int MIN = amin + bmin;
int score;

for(i=0; i<M; i++){
score = a[(x[i]-1)] + b[(y[i]-1)] - c[i];
if(score < MIN){
    MIN = score;
}
}

cout << MIN << endl;
return 0;


}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus>=201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}
void update(map<ll,ll>& mp,ll a,ll b){
  if(mp.count(a)){
    mp[a]=max(mp[a],b);
  }else{
    mp[a]=b;
  }
}
ll dp[3001][3001];
void solve(long long N, long long T, std::vector<long long> A, std::vector<long long> B){
  vector<pll> AB(N);
  REP(N){
    AB[i]=pll(A[i],B[i]);
  }
  sort(AB.begin(),AB.end());
  REP(N){
    A[i]=AB[i].first;
    B[i]=AB[i].second;
  }
  dp[0][T]=0;
  For(i,N){
    For(j,T+1){
      if(j==0){
        dp[i+1][0]=max(dp[i][A[i]]+B[i],max(dp[i][0],dp[i][1]+B[i]));
      }else if(j+A[i]>T){
        dp[i+1][j]=dp[i][j];
      }else{
        dp[i+1][j]=max(dp[i][j],dp[i][j+A[i]]+B[i]);
      }
    }
  }
  ll mx=0;
  For(i,T+1){
    mx=max(mx,dp[N][i]);
  }
  cout<<mx<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long T;
    scanf("%lld",&T);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(N, T, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 70656
#include <cstdio>
#include <iostream>

using namespace std;

int n;
int A[20];

bool check(int i, int m) {
	if (m == 0) {
		return true;
	} else if (m < 0 || i == n) {
		return false;
	}
	return check(i + 1, m) || check(i + 1, m - A[i]);
}

int main() {

	scanf("%d", &n);

	for (int i = 0; i < n; ++i) {
		scanf("%d", &A[i]);
	}

	int q;
	scanf("%d", &q);

	for (int i = 0; i < q; ++i) {
		int m;
		scanf("%d", &m);
		if (check(0, m)) {
			cout << "yes" << endl;
		} else {
			cout << "no" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3212
#include<bits/stdc++.h>
#define maxn 100005
#define mod 1000000007
#define int long long
using namespace std;




int n,m;
int vis[maxn];

struct mat
{
	int l,r;
	int a[6][6];
	mat(){memset(a,0,sizeof(a));}
};

mat dp;

mat mul(mat a,mat b)
{
	mat d;
	d.l=a.l,d.r=b.r;
	for(int i=1;i<=a.l;i++)
		for(int j=1;j<=b.r;j++)
			for(int k=1;k<=a.r;k++)
				(d.a[i][j]+=a.a[i][k]*b.a[k][j]%mod)%=mod;
	return d;
}

mat ksm(mat a,int t)
{
	mat b;
	b.l=a.l,b.r=a.r;
	b.a[1][1]=b.a[2][2]=b.a[3][3]=b.a[4][4]=1;
	while(t)
	{
		if(t&1)	
		{
			b=mul(b,a);
		}
		a=mul(a,a);
		t/=2;
	}
	return b;
}
 
mat t1,t2;

signed main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>vis[i];
	}
	t1.l=t2.l=t1.r=t2.r=4;
	t1.a[1][1]=t1.a[1][2]=t1.a[1][3]=t1.a[1][4]=t1.a[2][2]=t1.a[2][4]=t1.a[3][3]=t1.a[3][4]=t1.a[4][4]=1;
	t2.a[1][1]=t2.a[1][2]=t2.a[1][3]=t2.a[1][4]=t2.a[2][2]=t2.a[2][4]=t2.a[3][3]=t2.a[3][4]=t2.a[4][1]=t2.a[4][2]=t2.a[4][3]=1;
	t2.a[4][4]=2;
	
	dp.l=1,dp.r=4;
	dp.a[1][1]=1;
	int pos=0;
	
	for(int i=1;i<=m;i++)
	{
		if(vis[i]==n)	continue;
		mat t=ksm(t2,vis[i]-pos);
//		cout<<vis[i]-pos<<endl;
		dp=mul(dp,t);
		dp=mul(dp,t1);
		pos=vis[i]+1;
	}
//	cout<<n-pos<<endl;
	mat t=ksm(t2,max(0ll,n-pos));
//	cout<<n-pos-1<<endl;
//	dp=mul(mul(mul(mul(dp,t2),t2),t1),t2);
	dp=mul(dp,t);
	cout<<dp.a[1][4]<<endl;
	
}





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

int main() {
  set<string> se;
  int N;
  cin >> N;
  bool ok = true;
  string prev; cin >> prev; se.insert(prev);
  for (int i = 1; i < N; ++i) {
    string cur;
    cin >> cur;
    if (prev.back() != cur[0]) ok = false;
    if (se.count(cur)) ok = false;
    se.insert(cur);
    prev = cur;
  }
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3620
def main():
  import fractions
  n,X=map(int,input().split())
  x=sorted(list(map(int,input().split())))
  ans=abs(x[0]-X)
  for i in range(n):
    ans=fractions.gcd(ans,abs(x[i]-X))
  print(ans)
if __name__=='__main__':
  main()

Measured memory_bytes: 16296
n = gets.to_i
a = gets.split.map(&:to_i)

cnt = []
(0...n-1).each do |i|
  if a[i] <= a[i+1]
    cnt << 0
  else
    cnt << (a[i] - a[i+1])
    a[i+1] += (a[i] - a[i+1])
  end
end
puts cnt.sum

Measured memory_bytes: 29824
#include <iostream>
#include <cstdio>

int n, m, k;
char s[4] = {'R', 'Y', 'G', 'B'};

int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      int x = i + j + m, y = i - j + m;
      putchar(s[((x / k) & 1) * 2 + ((y / k) & 1)]); 
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-

def main():
    dictionary = {}
    input_num = int(raw_input())
    counter = 0
    while counter < input_num:
        command, key = raw_input().split(' ')
        if command[0] == 'i':
            dictionary[key] = True
        else:
            if key in dictionary:
                print 'yes'
            else:
              print 'no'

        counter += 1


if __name__ == '__main__':
    main()

Measured memory_bytes: 32960
#include<iostream>
using namespace std;
#define NIL -1
struct Node{int parent,left,right;};
struct Node T[41];
int n,P[41],I[41];
int search(int x[],int target,int size){
    for(int i=0;i<size;i++){
        if(x[i]==target) return i;
    }
    return 0;
}
bool tansaku(int target,int x[],int size){
    for(int i=0;i<size;i++){
        if(x[i]==target) return true;
    }
    return false;
}
void Postorder(int x){
    if(x!=NIL){
        Postorder(T[x].left);
        Postorder(T[x].right);
        if(x==P[0]) cout<<x;
        else cout<<x<<" ";
    }
}
void saisei(int x[],int s,int p,int size){
    int l=0,r=0,mid=search(x,s,size);
    int L[40],R[40];
    
    for(int i=0;i<size;i++){
        if(i<mid){L[l]=x[i];l++;}
        else if(i>mid){R[r]=x[i];r++;}
    }
    if(l!=0){
        if(tansaku(P[p+1],L,l)){
            T[P[p]].left=P[p+1];
            T[P[p+1]].parent=P[p];
            saisei(L,P[p+1],p+1,l);
        }
    }
    if(r!=0){
        if(tansaku(P[p+l+1],R,r)){
            T[P[p]].right=P[p+l+1];
            T[P[p+l+1]].parent=P[p];
            saisei(R,P[p+l+1],p+l+1,r);
        }
    }
    
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++) cin>>P[i];
    for(int i=0;i<n;i++) {
        cin>>I[i];
        T[i+1].parent=T[i+1].left=T[i+1].right=NIL;
    }
    saisei(I,P[0],0,n);
    Postorder(P[0]); cout<<endl;
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define nl cout<<"\n"
#define db(x) cout<<x<<" "
#define fi(a,b) for(int i=a;i<b;i++)
#define fj(a,b) for(int j=a;j<b;j++)
#define fk(a,b) for(int k=a;k<b;k++)
#define F first
#define S second
#define UM unordered_map<int,int>
#define MP map<int,int>
#define mxsize (int)1e6
void fun(){
    int n;
    cin>>n;
    ll a[n];
    fi(0,n) cin>>a[i];
    ll ans=0;
    ll suf[n+2];
    suf[n]=0;
    for(int i=n-1;i>=0;i--){
        suf[i]=(suf[i+1]+a[i])%mod;
    }
    fi(0,n-1){
        ans=(ans+(a[i]*suf[i+1])%mod)%mod;
    }
    cout<<ans<<"\n";

}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("/ATOM/input.txt", "r", stdin);
        freopen("/ATOM/output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;
    while(t--){
        fun();
    }
}

Measured memory_bytes: 6768
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define sz(x) ((int) x.size())
#define fo(i, n) for( int i = 0; i < n; i++ )

const int INF = 1e9;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;

int n, w;
int peso[105], val[105];
ll table[105][100005];


ll knap( int at, int alo ) {
    if ( table[at][alo] != -1 ) return table[at][alo];

    if ( at == n or alo == 0 ) return table[at][alo] = 0;

    if ( peso[at] <= alo ) return table[at][alo] = max(val[at] + knap(at + 1, alo - peso[at]),
                                                       knap(at + 1, alo));

    return table[at][alo] = knap(at + 1, alo);
}


int main() {sws;

    cin >> n >> w;
    fo(i, n) cin >> peso[i] >> val[i];

    memset(table, -1, sizeof(table));
    cout << knap(0, w) << endl;

    return 0;
}

Measured memory_bytes: 85684
#include<stdio.h>
#include<string.h>
#include<vector>
#include<queue>
#include<algorithm>

using namespace std;

const int N = 200005;
vector<int> roads[N],railways[N],vertex[N];
bool vis[N];
int index_road[N],index_railway[N],number[N],answer[N];
int num_road,num_railway;
int bfs(vector<int> edge[],int n,int index[])
{
    memset(vis,false,sizeof(vis));
    int cnt = 0;
    for(int i=1;i<=n;i++) if(!vis[i])
    {
        queue<int> q;
        q.push(i);
        vis[i]=true;
        while(!q.empty())
        {
            int now=q.front();
            q.pop();
            index[now]=cnt;
            for(int j=0;j<edge[now].size();j++) if(!vis[edge[now][j]]) q.push(edge[now][j]),vis[edge[now][j]]=true;
        }
        cnt++;
    }
    return cnt;
}

int main()
{
    int n,k,l;
    while(scanf("%d%d%d",&n,&k,&l)+1)
    {
        for(int i=1;i<=n;i++) roads[i].clear(),railways[i].clear();
        for(int i=0;i<k;i++)
        {
            int u,v;
            scanf("%d%d",&u,&v);
            roads[u].push_back(v);
            roads[v].push_back(u);
        }
        for(int i=0;i<l;i++)
        {
            int u,v;
            scanf("%d%d",&u,&v);
            railways[u].push_back(v);
            railways[v].push_back(u);
        }
        num_road = bfs(roads,n,index_road);
        num_railway = bfs(railways,n,index_railway);
//        printf("%d  %d==\n",num_road,num_railway);
//        for(int i=1;i<=n;i++) printf("%d  ",index_road[i]);
//        printf("\n");
//        for(int i=1;i<=n;i++) printf("%d  ",index_railway[i]);
//        puts("");
        for(int i=0;i<N;i++) vertex[i].clear();
        for(int i=1;i<=n;i++) vertex[index_road[i]].push_back(i);
        for(int i=0;i<num_road;i++)
        {
            for(int j=0;j<vertex[i].size();j++)
                number[index_railway[vertex[i][j]]]++;
            for(int j=0;j<vertex[i].size();j++)
                answer[vertex[i][j]]=number[index_railway[vertex[i][j]]];
            for(int j=0;j<vertex[i].size();j++)
                number[index_railway[vertex[i][j]]]--;
        }
        for(int i=1;i<=n;i++) printf("%d%c",answer[i],i==n?'\n':' ');
    }
    return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

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

#define isout(x,y) (x<0||H<=x||y<0||W<=y)
#define vv vector

ll H, W, K;
ll X[10], Y[10];
vv<string> C;
ll A[202020];
ll ymk[202020];
set<pll> est[202020], clcst;

const ll gx[] = {1, 0, -1, 0};
const ll gy[] = {0, 1, 0, -1};

ll i, j, k;


pll fnd(ll x,ll y,const ll& d,vv<vv<vv<pll>>> &mk){
    //cout << x << y << endl;
    if(isout(x,y)){
        return {x, y};
    }
    if(d%2==0){
        if(mk[x][y][d].first==x)
            return {x, y};
        return {(mk[x][y][d] = fnd(mk[x][y][d].first, y, d, mk)).first, y};
    }
    if(mk[x][y][d].second==y)
        return {x, y};
    return {x, (mk[x][y][d] = fnd(x, mk[x][y][d].second, d, mk)).second};
}


int main(){
    scanf("%lld%lld%lld", &H, &W, &K);
    fornum(i,0,2){
        scanf("%lld%lld", &X[i], &Y[i]);
        --X[i];
        --Y[i];
    }
    C.resize(H+10);
    fornum(i,0,H){
        cin >> C[i];
    }

    vv<vv<vv<ll>>> mk(H, vv<vv<ll>>(W,vv<ll>(2,1e9)));
    vv<vv<vv<pll>>> gmk(H, vv<vv<pll>>(W, vv<pll>(4)));
    fornum(i,0,H){
        fornum(j,0,W){
            fornum(k,0,4){
                gmk[i][j][k] = {i, j};
            }
        }
    }
    
    mk[X[0]][Y[0]][0] = 1;
    mk[X[0]][Y[0]][1] = 1;
    queue<pair<pll, ll>> q;
    fornum(i,0,4){
        q.push({{X[0], Y[0]}, i});
    }
    
    while(q.size()){
        //cout << q.size() << endl;
        auto qa = q.front();
        q.pop();
        ll px = qa.first.first;
        ll py = qa.first.second;
        ll d = qa.second % 4;
        ll d2 = d % 2;
        ll c = min(mk[px][py][0], mk[px][py][1]);
        
        gmk[px][py][d] = {px + gx[d], py + gy[d]};
        pll r = fnd(px, py, d, gmk);
        i = max(abs(r.first - px), abs(r.second - py)) - 1;
        px = r.first - gx[d];
        py = r.second - gy[d];
        
        fornum(i, i, K)
        {
            px += gx[d];
            py += gy[d];
            if(isout(px,py)||C[px][py]=='@'||mk[px][py][d2]!=(ll)1e9)
                break;
            mk[px][py][d2] = c + 1;
            gmk[px][py][d] = {px + gx[d], py + gy[d]};
            q.push({{px, py}, d + 1});
            q.push({{px, py}, d + 3});
        }

        if(i==K){
            q.push({{px, py}, d});
        }
    }
    /*
    fornum(i,0,H){
        fornum(j,0,W){
            printf("%lld ", min(mk[i][j][0], mk[i][j][1]));
        }
        printf("\n");
    }
    */
    ll ans = min(mk[X[1]][Y[1]][0], mk[X[1]][Y[1]][1]);
    if(ans==(ll)1e9){
        printf("-1\n");
    }else{
        printf("%lld\n", ans-1);
    }

        return 0;
}

Measured memory_bytes: 271708
N, K = map(int, input().split())
A = list(map(int, input().split()))

minv = min(A)
minis = []
for i, a in enumerate(A):
    if a == minv:
        minis.append(i)

ans = 1e100
for mini in minis:
    l = mini // K + 1
    rd = K * l - l
    r = (N - 1 - rd - 1) // (K - 1) + 1
    ans = min(ans, l + r)
print(ans)


Measured memory_bytes: 14008
#define X r+=(m*p+n*q)%(m*m+n*n)==0&&(m*q-n*p)%(m*m+n*n)==0
#define Z if(X,n=-n)X,n=-n
main(T,p,q,m,n,r){for(scanf("%d",&T);T--;puts(r==8?"P":"C"))for(scanf("%d%d",&p,&q),r=m=0;m*m<=p*p+q*q;m++)for(n=m?0:1;m*m+n*n<=p*p+q*q;n++){Z;if(m=-m){Z;m=-m;}}exit(0);}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    ll sum = 0;
    vector<int> A(M);
    REP(i,M){
        cin >> A[i];
        sum += A[i];
    }
    if(sum > N) cout << -1 << endl;
    else cout << N - sum << endl;
}


Measured memory_bytes: 3684
#include <iostream>

int main() {
    int a, b, c;    

    std::cin >> a;
    std::cin >> b;
    std::cin >> c;

    for (int i = 0; i < b; i++) {
        if ( (i * b + c) % a == 0 ) {
            std::cout << "YES" << std::endl;
            return 0;
        }
    }

    std::cout << "NO" << std::endl;
    return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#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 pb push_back
#define MP(a, b) make_pair((a), (b))
template <class T> vector<T> make_vec(size_t a, T val) {
    return vector<T>(a, val);
}
template <class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec(ts...))>(a, make_vec(ts...));
}
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
template <typename T> struct edge {
    int to;
    T cost;
    edge(int t, T c) : to(t), cost(c) {}
};
template <typename T> using WGraph = vector<vector<edge<T>>>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<ll> f(N), g(N);
    rep(i, N) {
        ll a, b;
        cin >> a >> b;
        f[i] = a + b;
        g[i] = a - b;
    }
    sort(All(f));
    sort(All(g));
    cout << max(f[N - 1] - f[0], g[N - 1] - g[0]) << endl;
}

Measured memory_bytes: 6368
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

struct union_find{
  vector<int> par,r;

  union_find(int n){
  	par.resize(n);
  	r.resize(n);
  	init(n);
  }

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

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

  void unite(int x,int y){
    x = find(x);
    y = find(y);
    if(r[x] < r[y]){
      par[x] = y;
    }else{
      par[y] = x;
      if(r[x] == r[y]) r[x]++;
    }
  }

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

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

	vector<pair<int,int> > e(m);

	for(int i = 0; i < m; i++){
		cin >> e[i].first >> e[i].second;
		e[i].first--;
		e[i].second--;
	}

	int ans = 0;
	for(int i = 0; i < m; i++){
		union_find uf(n);

		for(int j = 0; j < m; j++){
			if(i!=j && !uf.same(e[j].first,e[j].second)){
				uf.unite(e[j].first,e[j].second);
			}
		}
		set<int> s;
		for(int j = 0; j < n; j++){
			if(uf.par[j]==j) s.insert(uf.par[j]);
		}
		if(s.size()>1) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;
const int maxn=3e5+5,maxm=1e5+5;
int m,n;
struct Pair{
    int l,r;
}p[maxn];
bool Cmp(Pair a,Pair b){return a.r-a.l<b.r-b.l;}
    int a[maxn],s[maxn*4],tag[maxn*4];
    void build(int node,int begin,int end){
        tag[node]=0;
        if(begin==end){
            s[node]=a[begin];
        }else{
            build(2*node,begin,(begin+end)/2);
            build(2*node+1,(begin+end)/2+1,end);
            s[node]=s[2*node]+s[2*node+1];
        }
    }
    void pushdown(int node,int begin,int end){
        if(begin==end){
            s[node]+=tag[node];
            a[begin]=s[node];
        }else{
            tag[2*node]+=tag[node];
            tag[2*node+1]+=tag[node];
            s[node]+=tag[node]*(end-begin+1);
        }
        tag[node]=0;
    }
    void Change(int node,int begin,int end,int left,int right,int add){
        if(begin>=left&&end<=right){
            tag[node]+=add;
        }else{
            pushdown(node,begin,end);
            int m=(begin+end)/2;
            if(!(right<begin||left>m)){
                Change(2*node,begin,m,left,right,add);
            }
            if(!(right<m+1||left>end)){
                Change(2*node+1,m+1,end,left,right,add);
            }
        }
    }
    int query(int node,int begin,int end,int idx){
        pushdown(node,begin,end);
        if(begin==end)return a[begin];
        int m=(begin+end)/2;
        if(idx<=m)return query(2*node,begin,m,idx);
        return query(2*node+1,m+1,end,idx);
    }
int main(){
    scanf("%d%d",&n,&m);
    build(1,1,m);
    for(int i=0;i<n;i++)
        scanf("%d%d",&p[i].l,&p[i].r);
    sort(p,p+n,Cmp);
    int i=0;
    for(int d=1;d<=m;d++){
        while(i<n&&p[i].r-p[i].l<d){
            Change(1,1,m,p[i].l,p[i].r,1);
            i++;
        }
        int ans=n-i;
        for(int k=d;k<=m;k+=d){
            ans+=query(1,1,m,k);
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 8704
#include <iostream>
#include <string>
using namespace std;
int main(){
	string str = "";
	char input;
	cin >> input;
	char old = input;
	str += input;
	while(cin >> input){
		if(input != old){
			str += input;
			old = input;
		}
	}
	cout << str.length() - 1 << endl;
	return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cctype>
#include <utility>
#include <deque>
#include <numeric>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;
	while (isspace(c)) {c = gcu();}
	if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int n, m; n = in(), m = in(), n || m;) {
		deque<int> q(n);
		iota(q.begin(), q.end(), 1);
		m--;
		for (int i = 0, p = 0; q.size() > 1; i++) {
			p = (p + m) % (n - i);
			q.erase(q.begin() + p);
		}
		outl(q[0]);
	}
}


Measured memory_bytes: 2460
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
using namespace std;
#define vel vector<long long>
#define vvel vector<vel>
#define int long long
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
long long p = 1000000007;
vel kai(20001, 1);
vel ink(20001, 1);
int le = (1 << 20) + 1;
vel BIT(le, 0);
vel uni(vel &list) {
	if (list.size() == 0) { return list; }
	sort(list.begin(), list.end());
	vel ql(1, list[0]);
	rep(i, list.size() - 1) {
		if (list[i] != list[i + 1]) { ql.push_back(list[i + 1]); }
	}
	list = ql;
	return ql;
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, 20000) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, 20001) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
int per(int n, int r) {
	int ans = kai[n] * ink[n-r];
	ans %= p;
	return ans;
}
signed main() {
	int n; cin >> n;
	priority_queue<int> q0;
	priority_queue<int> q1;
	int s0 = 0, s1 = 0;
	int sm0 = 0, sm1 = 0;
	int all_sum = 0;
	rep(i, n) {
		int s; cin >> s;
		if (s == 1) {
			int a, b; cin >> a >> b;
			all_sum += b;
			if (s1 == 0 or a < -q1.top()) {
				q0.push(a); sm0 += a; s0++;
			}
			else{
				q1.push(-a); sm1 += a; s1++;
			}
			if (s0 > s1 + 1) {
				s0--; s1++;
				int tp = q0.top(); q0.pop();
				q1.push(-tp);
				sm0 -= tp; sm1 += tp;
			}
			if (s0 < s1) {
				s0++; s1--;
				int tp = -q1.top(); q1.pop();
				q0.push(tp);
				sm0 += tp; sm1 -= tp;
			}
		}
		else {
			int tp = q0.top();
			cout << tp << " ";
			int ans = all_sum;
			ans += tp * s0 - sm0;
			ans += sm1 - tp * s1;
			cout << ans << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 12404
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int P=1e9+7;
const int M=2e5+5;
int n,m;
int a[M],col[M];
bool mark[M];
vector<int>vec[M];
int id[M],nxt[M],pre[M];
#define lowbit(x) (x&-x)
int C[M];
void Add(int x,int k){
	while(x<=m+1){
		(C[x]+=k)%=P;
		x+=lowbit(x);
	}
}
int sum(int x){
	ll res=0;
	while(x){
		(res+=C[x])%=P;
		x-=lowbit(x);
	}
	return res;
}
ll ss[M];
void solve(){
	Add(1,1);
	for(int i=2;i<=m;i++){
		int s;
		if(pre[i]){
			s=sum(pre[i]-1);
			(ss[a[i]]+=s)%=P;
			Add(i,ss[a[i]]);
		}
	}
	int res=sum(m+1);
	printf("%d\n",res);
}
void Init(){
	for(int i=2;i<=m;i++){
		if(id[a[i]])nxt[id[a[i]]]=i,pre[i]=id[a[i]];
		id[a[i]]=i;
	}
}
int main(){
	scanf("%d",&n);m=1;
	for(int i=1;i<=n;i++)scanf("%d",col+i);
	for(int i=1;i<=n;i++)if(col[i]!=col[i-1])a[++m]=col[i];
	Init();solve();
	return 0;
}

Measured memory_bytes: 11392
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
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; }

int n, a[200010];

int main() {
    cin >> n;
    rep(i, n) cin >> a[i];

    int num = 1;
    rep(i, n) {
        if (a[i] == num) num++;
    }
    int ans;
    if (num == 1) ans = -1;
    else ans = n - num + 1;
    cout << ans << endl;
}


Measured memory_bytes: 1024
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut h: Vec<usize> = sc.vec(n);
    h.reverse();
    let mut pre_x = h[0];
    let mut cnt = 0;
    let mut result = 0;
    for i in (1..n) {
        let x = h[i];
        if x >= pre_x {
            cnt += 1;
        } else {
            cnt = 0;
        }
        pre_x = x;
        result = std::cmp::max(result, cnt);
    }
    println!("{}", result);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;

int main() {
   int a,b;
   long long int p;
    cin>>a>>b;
    p=a*b;
    if(p%2==0)
    {
        cout<<"Even";
    }
    else
        cout<<"Odd";
    return 0;
}



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

#define IS_DEBUG true

#define DEBUG_OUTPUT(X) if (IS_DEBUG) cout << X << endl
#define RESULT_OUTPUT(X) cout << X << endl

int main()
{
  int N, K;
  cin >> N >> K;
  
  long X = K;
  if (N != 1)
  {
  for (int i = 1; i < N; i++)
  {
    X *= (K - 1);
  }
  }
  
  RESULT_OUTPUT(X);


	if (IS_DEBUG)
	{
		int end;
		cin >> end;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int N;
    cin >> N;

    int time = 0, current_x = 0, current_y = 0;
    for (int i = 0; i < N; ++i) {
        int t, y, x;
        cin >> t >> x >> y;

        if (t - time < abs(x - current_x) + abs(y - current_y) ||
            (t - time - abs(x - current_x) - abs(y - current_y)) % 2 == 1) {
            cout << "No" << endl;
            return 0;
        }
        current_x = x;
        current_y = y;
        time = t;
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
h = list(map(int,input().split()))
H = [0] * n
for _ in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    H[a] = max(H[a], h[b])
    H[b] = max(H[b], h[a])
ans = 0
for i in range(n):
    if H[i] < h[i]:
        ans += 1
print(ans)

Measured memory_bytes: 20112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(cnt,e) for(ll cnt=0;cnt<e;cnt++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;
long long ruijou(long long x, long long y){
    if(x>1000000000LL)return -1;
    if(x<0)return -1;
    if(y==0) return 1;
    else if(y%2==0) return ruijou(x*x,y/2);
    else return x*ruijou(x,y-1);
}





ll i,j,k;


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

Measured memory_bytes: 3592
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

#define xx first
#define yy second
#define $1 first
#define $2 second

typedef struct _schedule {
	int s, t;
	int idx;
	char c;
} schedule;

bool operator < (const schedule& a, const schedule& b) {
	return a.t < b.t;
}

bool cmp(schedule& a, schedule& b) {
	return a.idx < b.idx;
}

void solveCase() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	ll a, b, c, d; cin >> a >> b >> c >> d;
	bool taka = true;
	while(true) {
		if (taka) {
			c -= b;
		}
		else {
			a -= d;
		}
		taka = !taka;
		if (a <= 0) {
			cout << "No";
			break;
		}
		else if(c<=0) {
			cout << "Yes";
			break;
		}
	}

}

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	solveCase();
}

Measured memory_bytes: 3652
//
//  main.cpp
//  Test
//
//  Created by Nag on 2017/08/18.
//  Copyright ?? 2017??´ Nag. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>

using namespace std;

const string SUITS = "SHCD"; //?????????????????????????????????????????????????????????????????????????????????????????? 01234 ??¨ SHCD ??????????????????

int suit2int(char);
char int2suit(int);

int main(void) {
    int n;
    cin >> n;

    string card[4][13]; //?????????????????¨????????????????°???????????????§???????????????????????????????????????????????£?????????
    bool ck[4][13]; //?????????????????????????????¨?????????
    
    char suit;
    int rank;
    
    //Definition of card, ck
    for(int i=0; i<4; i++) {
        for(int j=0; j<13; j++) {
            ck[i][j] = false; //ck?????¨??¨false = '?????£????????????' ?????¨??¨?????????????????????????????£?????????????????????true?????????????????????????????¨?????????
            string blank = " ";
            card[i][j] = int2suit(i) + blank + to_string(j+1);
        }
    }

    //?¨??????\?????????1????????????????????????????????????????????????????????????????????£??????????????????????????\??????????????????ck[][]???true?????????
    for(int i=0; i<n; i++) {
        cin >> suit >> rank;
        ck[ suit2int(suit) ][ rank - 1 ] = true; //ck[i][j]???j???rank???1??¨?????????????????¨?????¨???
        
        //???????????°??¨??????????????¨???
        //cout << "i = " << setw(2) << i << ", suit = " << suit << ", rank = " << setw(2) << rank << ", ck[" << suit2int(suit) << "][" << setw(2) << (rank-1) << "] = true" << endl;
    }

    
//    //Test Display
//    for(int i=0; i<4; i++) {
//        for(int j=0; j<13; j++) {
//            cout << card[i][j] << " " << ck[i][j]<< " / ";
//        }
//        cout << endl;
//    }
    
    //??????
    for(int i=0; i<4; i++) {
        for(int j=0; j<13; j++) {
            if( !ck[i][j] ) {
                cout << card[i][j] << endl;
            }
        }
    }



    return 0;
}


int suit2int(char suit) {
    return (int)SUITS.find(suit);
}

char int2suit(int i) {
    return SUITS[i];
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
typedef pair<int, int> P;

signed main(){
  int n, m; cin >> n >> m;
  vector<vector<int> > G(n);
  for(int i = 0; i < m; i++){
    int u, v; cin >> u >> v;
    G[u - 1].push_back(v - 1);
  }
  vector<vector<int> > dist(n, vector<int> (3, INF));
  int s, t; cin >> s >> t; --s; --t;
  dist[s][0] = 0;
  queue<P> que;
  que.push(P(s, 0));
  while(que.size()){
    P p = que.front(); que.pop();
    int now = p.first, step = p.second;
    for(auto next : G[now]){
      int next_step = step + 1;
      if(next_step == 3) next_step = 0;
      if(dist[next][next_step] > dist[now][step] + 1){
        dist[next][next_step] = dist[now][step] + 1;
        que.push(P(next, next_step));
      }
    }
  }
  int ans = dist[t][0];
  if(ans == INF) cout << -1 << endl;
  else cout << ans / 3 << endl;
}




Measured memory_bytes: 11136
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		
		String ans = null;
		for(int i=0; i<H; i++)
			for(int j=0; j<W; j++)
				if(sc.next().equals("snuke"))
					ans = String.valueOf((char)('A'+j))+(i+1);
		
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 10308
// dile a la jardinera que traigo flores

#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(x) int(x.size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define IFR(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;


int main(){	
	fastio;
	int ans=0;
	vector<int>vec;
	FER(i,0,5){
		int k;cin>>k;
		vec.pb(k);
	}
	sort(vec.begin(),vec.end());
	int ret=1000000000;
	do{
		ans=0;
		FER(i,0,5){
			if(i<4)ans+=(vec[i]+9)/10*10;
			else ans+=vec[i];
		}
		ret=min(ret,ans);
	}while(next_permutation(all(vec)));
	cout<<ret<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
            out.flush();
        }
    }

    void solve(InputReader in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();

        out.println((a < c && c < b || b < c && c < a) ? "Yes" : "No");
    }
}

class InputReader implements AutoCloseable {
    private final Scanner sc = new Scanner(System.in);

    String next() {
        return this.sc.next();
    }

    int nextInt() {
        return Integer.parseInt(this.sc.next());
    }

    long nextLong() {
        return Long.parseLong(this.sc.next());
    }

    double nextDouble() {
        return Double.parseDouble(this.sc.next());
    }

    @Override
    public void close() {
        this.sc.close();
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define REP(i,  n) for (int i  =  0; i < (int)(n); ++i)
#define REPR(i,  n) for (int i  =  n - 1; i >= 0; --i)
using namespace std;
#define int long long int
//------------ATCODER TEMPLATE-------------

signed main() {
  double N; cin >> N;
  int X, T; cin >> X >> T;
  int ans = ceil(N/X) * T;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3716
gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
c = gets.split.map(&:to_i)
old = nil
sum = 0
a.each do |i|
  i -= 1
  sum += b[i]
  sum += c[i -1] if old == (i - 1)
  old = i
end
puts sum

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  string s;
  cin >> s;
  ll n = s.size();
  ll l, r;
  for (ll i = 0; i < n; i++) {
    if (s[i] == 'A') {
      l = i;
      break;
    }
  }
  for (ll i = 0; i < n; i++) {
    if (s[n - 1 - i] == 'Z') {
      r = n - 1 - i;
      break;
    }
  }
  cout << r - l + 1 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
using namespace std;

int main ()
{
	int a, b, c;
	cin >> a >> b >> c;

	cout << min({a, b, c}) << " ";
	cout << (a + b + c) - min({a, b, c}) - max({a, b, c}) << " ";
	cout << max({a, b, c}) << endl;
	
	return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll M=1e2+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n,a,b;
	cin>>n>>a>>b;
	cout<<min(n*a,b)<<endl;
}

Measured memory_bytes: 256