akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stack>
#include<algorithm>
#include<map>
#include<string>
using namespace std;
int H,W;
//map<int,map<int,char>> m;
map<int,map<int,int>> w,h2;
string m[2000];
int main(){
    cin.tie(0);ios_base::sync_with_stdio(false);
    cin>>H>>W;
    for(int i{};i<H;++i)cin>>m[i];
    for(int i{};i<H;++i){
        if(!i){for(int j{};j<W;++j)h2[i][j]=1;continue;}
        for(int j{};j<W-1;++j){
            int k{},l{};
            if(m[i][j]=='.')++k;
            else ++l;
            if(m[i-1][j]=='.')++k;
            else ++l;
            if(m[i-1][j+1]=='.')++k;
            else ++l;
            if(m[i][j+1]=='.')++k;
            else ++l;
            if(k+l>=4&&(k==1||k==3))h2[i][j]=1;
            else h2[i][j]=h2[i-1][j]+1;
        }
        h2[i][W-1]=h2[i-1][W-1]+1;
    }
        
    int ans{H};
    for(int i{1};i<H;++i){
        stack<pair<int,int>> s;
        for(int j{};j<W;++j){
            if(s.empty())s.emplace(h2[i][j],j);
            else if(s.top().first<h2[i][j])s.emplace(h2[i][j],j);
            else if(s.top().first>h2[i][j]){
                int p{j};
                while(s.size()&&s.top().first>=h2[i][j]){
                    p=s.top().second;
                    ans=max(ans,s.top().first*(j+1-p));
                    s.pop();
                }
                s.emplace(h2[i][j],p);
            }
        }
        while(s.size()){
            ans=max(ans,s.top().first*(W-s.top().second));
            s.pop();
        }
    }
    cout<<ans<<endl;
}


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

int dp[60000];
int main() {
	int n, m; scanf("%d%d", &n, &m);
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	rep(i, m) {
		int c; scanf("%d", &c);
		for (int j = c; j <= n; j++)dp[j] = min(dp[j], dp[j - c] + 1);
	}
	printf("%d\n", dp[n]);
}

Measured memory_bytes: 3448
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <map>
#include<iomanip>
#include<vector>

using namespace std;
typedef long long ll; 


ll ans,mx,sum,mn=1e18,flag;

ll idx;
int main(){
	ll n,q;
	cin>>n>>q;
	ll a[n];
	string s;
	cin>>s;
	ll cnt=0;
	ll b[q],c[q];
	for(ll i=0; i<q; i++){
		cin>>b[i]>>c[i];
	}
	
	for(ll i=0; i<n; i++){
		if(s[i]=='A' && s[i+1]=='C' ){
			a[i]=cnt;
			cnt++;
			a[i+1]=cnt;
			i++;
		}
		else a[i]=cnt;
	}
	for(ll i=0; i<q; i++){
		cout<<a[c[i]-1]-a[b[i]-1]<<endl;
	}
}


Measured memory_bytes: 3456
#include <iostream>
#include <vector>
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < n; i++)
using namespace std;

int main(){
  ll n;
  cin >> n;
  vector<vector<ll>> a(n, vector<ll>(n));
  rep(i, n)rep(j, n) cin >> a[i][j];
  vector<vector<bool>> x(n, vector<bool>(n, false));
  bool flag = false;
  rep(i, n)rep(j, n)rep(k, n){
    if (a[i][j] > a[i][k] + a[k][j]) flag = true;
    if(i == k || j == k) continue;
    if (a[i][j] == a[i][k] + a[k][j]) x[i][j] = true;
  }
  if (flag)
    cout << -1 << endl;
  else {
    ll ans = 0;
    rep(i, n)rep(j, n){
      if (x[i][j]) continue;
      ans += a[i][j];
    }
    cout << ans/2 << endl;
  }
  return 0;
}

Measured memory_bytes: 1024
while gets
  n,s=$_.split.map(&:to_i)
  break if n==0&&s==0
  dp=Array.new(102).map{Array.new(n+1).map{Array.new(s+1,0)}}
  dp[0][0][0]=1
  for i in (1..101)
    for j in (0..n)
      for k in (0..s)
        x=k-i+1
        dp[i][j][k]=dp[i-1][j][k]+((j==0||x<0) ? 0 : dp[i-1][j-1][x])
      end
    end
  end
  puts dp[101][n][s]
end

Measured memory_bytes: 21740
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		int[] h = new int[n];
		for(int i = 0 ; i < n ; i++) h[i] = Integer.parseInt(sc.next());
		sc.close();
		Arrays.sort(h);
		int yono = (int)Math.pow(10 , 9);
		for(int i = 0 ; i <= n - k ; i++) yono = Math.min(yono , h[i + k - 1] - h[i]);
		ou.println(yono);
		ou.flush();
	}
}

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

int ans[1010][1010];
int main(){
    int h, w, a, b;
    cin >> h >> w >> a >> b;

    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            if(j < a){
                ans[i][j] = 1;
            }else{
                ans[i][j] = 0;
            }
        }
    }


    int rev[2] = {1, 0};

    for(int i = 0;i < b;i++){
        for(int j = 0;j < w;j++){
            ans[i][j] = rev[ans[i][j]];
        }
    }

    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            cout << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 5120
n = int(input())
a_i = []
for x in range(n):
    a_i.append(int(input()))
a_i_Order = []
btn = 1
for x in range(n):
    a_i_Order.append(a_i[btn - 1])
    btn = a_i[btn - 1]
if a_i_Order.count(2) == 0: print(-1)
else: print(a_i_Order.index(2) + 1)

Measured memory_bytes: 7852
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  bool flag = false ;
  for (int i = 0; i < N; i++) {
    
     string color ;
     cin >> color ; 
    
    if(color == "Y"){
 flag = true;
    }
  }
   if(flag){
      cout << "Four"<< endl;

    }
    
    else {
       cout << "Three"<< endl;
    }
  }


Measured memory_bytes: 3468
#include<stdio.h>

int main()
{
    long long int a, b, c, d, p[5], max;
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    p[1] = a*c;
    p[2] = a*d;
    p[3] = b*c;
    p[4] = b*d;

    max=p[1];
    for(int i=2; i<=4; i++)
    {
        if(p[i]>max)
            max=p[i];
    }
    printf("%lld\n", max);

    return 0;
}


Measured memory_bytes: 3236
s = input()
n = len(s)
s = s+"xxx"

def cal_subop(l):
    cum_a = [0 for i in range(len(l))] #index iより左のAの数
    tmp = 0
    for i in range(len(l)):
        tmp += (1 if l[i]=='A' else 0)
        cum_a[i] = tmp

    n_op = 0
    for i in range(len(l)):
        if l[i] == 'B':
            n_op += cum_a[i]
    return n_op

cursor = 0
ans = 0
tmp  = []

while cursor < n:
    if s[cursor] == 'A':
        tmp.append('A')
        cursor += 1
    elif s[cursor:cursor+2] == 'BC':
        tmp.append('B')
        cursor += 2
    else:
        ans += cal_subop(tmp)
        tmp = []
        cursor += 1

ans += cal_subop(tmp)
print(ans)
        
        
    
    
    
    



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

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  
  int sum = 0;
  
  if(K <= A){
    sum = K;
    cout << sum << endl;
  }
  else if(A < K && K <= A + B){
    sum = A ;
    cout << sum << endl;
  }
  else{
    sum = 2 * A + B - K;
    cout << sum << endl;
  }
  
      
  
  
}

Measured memory_bytes: 3640
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int t=n, cnt=0;
	while (t)
	{
		t/=10;
		cnt++;
	}
	int r=0;
	for (int i=1; i<=cnt; i+=2)
	{
		if (i==cnt)
		{
			r+=n-pow(10, i-1)+1;
		}
		else
		{
			r+=pow(10, i-1)*9;
		}
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 10000000005
#define NIL -1
int main(){
    string s; cin >> s;
    int a_c = -1, z_c = -1;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'A'){
            a_c = i;
            break;
        }
    }
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'Z'){
            z_c = i;
        }
    }
    cout << z_c - a_c + 1 << endl;
}

Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
            }
            int[] L = new int[N + 1];
            int[] R = new int[N + 1];
            Arrays.fill(L, 0);
            Arrays.fill(R, 0);

            for (int i = 0; i < N; i++) {
                L[i + 1] = gcd(A[i], L[i]);
            }

            for (int i = N - 1; i >= 0; i--) {
                R[i] = gcd(A[i], R[i + 1]);
            }

            int max = 0;
            for (int i = 0; i < N; i++) {
                int temp = gcd(L[i], R[i + 1]);
                if (max < temp) {
                    max = temp;
                }
            }
            out.println(max);
        }

        int gcd(int a, int b) {

            if (a < b) {
                a ^= b;
                b ^= a;
                a ^= b;
            }

            return b > 0 ? gcd(b, a % b) : a;
        }

    }
}



Measured memory_bytes: 51700
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;

int n;
vector<P> adj[100001];
ll kd[100001];
bool used[100001];

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P>> que; // (cost, point)
    // 初期化
    fill(kd, kd+n, 1LL << 50);
    fill(used, used+n, false);

    kd[s] = 0;
    que.push(make_pair(0, s));

    while(!que.empty()){
        P f = que.top();
        que.pop();
        ll c = f.first;
        ll u = f.second;

        if(used[u]) continue;
        // 最小値を取り出し、それが最短でなければ無視
        if(kd[u] < c) continue;
        used[u] = true;
        rep(i, adj[u].size()){
            ll v = adj[u][i].first;
            ll cost = adj[u][i].second;
            // d[u] = f.first
            if(kd[v] > c + cost){
                kd[v] = c + cost;
                que.push(make_pair(kd[v], v));
            }
        }
    }
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i, n-1){
        ll a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        adj[a].push_back(make_pair(b, c));
        adj[b].push_back(make_pair(a, c));;
    }
    int q, k;
    cin >> q >> k;
    k--;
    dijkstra(k);

    rep(i, q){
        int x,y;
        cin >> x >> y;
        x--; y--;
        cout << kd[x] + kd[y] << endl;
    }
    return 0;
}

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

int main(){
    long long X, t;
    bool check = false;
    cin >> X;
    for (long long i = 1; i <= pow(X, 0.5); i++) {
        if (X % i == 0) {
            for (long long j = -i/2; j <= pow(X, 0.25) - i; j++) {
                if (pow(j+i, 5) - pow(j, 5) == X) {
                    cout << j+i << ' ' << j;
                    check = true;
                    break;
                }
            }
            if (check) {
                break;
            }
            t = X / i;
            for (long long j = -t/2; j <= pow(X, 0.25) - t; j++) {
                if (pow(j+t, 5) - pow(j, 5) == X) {
                    cout << j+t << ' ' << j;
                    check = true;
                    break;
                }
            }
            if (check) {
                break;
            }
        }
    }
} 

Measured memory_bytes: 4036
import math
n=int(input())
flag=0
def sosuu(m):
    h=int(math.sqrt(m))
    lis=[1]
    for i in range(2,h+1):
        if m%i==0:
            lis.append(i)
    return lis
x=max(sosuu(n))
y=n//x
ans=x+y-2
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define  int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;
#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))
#define sz(x) (int)(x.size())
#define vl first
#define in second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p*p)%m;if(n%2) return (p*a)%m;else return p;}
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e12;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N=100005;

int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int m;
    cin>>m;
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    int dp[n+2];
    for(int i=1;i<=n+1;i++)
        dp[i]=INF;
    dp[0]=0;
    int i=0;
    while(i<n)
    {
        int last=-1;
        for(int j=i+1;j<=min(n,i+m);j++)
        {
            if(s[j]!='1')
            {dp[j]=1+dp[i];
                last=j;
            }
            else
            {
                dp[j]=INF;
                
            }
        }
        i=last;
        if(last==-1)
            break;
    }
    if(dp[n]==INF)
    {
        cout<<-1<<endl;
    }
    else
    {
        int j=n;vi ans;
        while(j>0)
        {
            for(int i=j-1;i>=max((int)0,j-m);i--)
                if(dp[j]==(1+dp[i]))
                {
                    ans.pb(i-j);
                    j=i;
                    break;
                }
        }
        for(int i=0;i<ans.size();i++)
            cout<<abs(ans[i])<<" ";
        cout<<endl;
    }
        return 0;
}


Measured memory_bytes: 2248
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
typedef long long int ll;

vector<int> G[100100];
int used[100100];

struct UnionFind{
    vector<int> par,num;
    vector<bool> done;
    UnionFind(int n):par(n),num(n,1),done(n,false){
        iota(par.begin(),par.end(),0);  //include<numeric>
    }
    int find(int v){
        return (par[v]==v)?v:(par[v]=find(par[v]));
    }
    void unite(int u,int v){
        u=find(u),v=find(v);
        if(u==v)return;
        if(num[u]<num[v])swap(u,v);
        num[u]+=num[v];
        par[v]=u;
        done[u]=done[u]|done[v];
    }
    bool same(int u,int v){
        return find(u) == find(v);
    }
    bool ispar(int v){
        return v=find(v);
    }
    int size(int v){
        return num[find(v)];
    }
};

int main(){
	ll n,m,q; cin >> n >> m >> q;
	UnionFind uf(n);
	vector<pair<int,int> > v;
	for(int i=0;i<q;i++){
		int a,b,c; cin >> a >> b >> c;
		if(c==0){
			uf.unite(a,b);
		}
		else{
			v.push_back(make_pair(a,b));
		}
	}
	for(auto p:v){
		if(m==n-1||uf.same(p.first,p.second)){
			cout << "No" << endl;
			return 0;
		}
	}
	if(m==n-1){
		cout << "Yes" << endl;
		return 0;
	}
	ll cnt=0;
	for(int i=0;i<n;i++){
		if(uf.find(i)==i)cnt++;
	}
	if(2*m<=2*n+cnt*(cnt-3)){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 4604
import sys
sys.setrecursionlimit(10 ** 6)

import functools
import operator
n = int(input())
p = list(map(float, input().split()))
half = n // 2 + 1

dp = [[None] * (n + 1) for _ in range(n + 1)]
def dfs(n=half, depth=n - 1):
    if depth < 0:
        return 0

    if dp[n][depth] is not None:
        return dp[n][depth]

    if n == 0:
        r = functools.reduce(operator.mul, map(lambda x: 1 - x, p[:depth + 1]))
    elif (n - 1) == depth:
        r = functools.reduce(operator.mul, p[:depth + 1])
    else:
        r = dfs(n - 1, depth - 1) * p[depth] + dfs(n, depth - 1) * (1 - p[depth])
    dp[n][depth] = r
    return r

print(sum(dfs(i) for i in range(half, n + 1)))


Measured memory_bytes: 219656
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

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


const ll mod = 1000000007;
ll fact[200200];
ll invfact[200200];

inline ll take_mod(ll a){
    return (a % mod + mod) % mod;
}

inline ll add(ll a, ll b){
    return take_mod(a+b);
}

inline ll sub(ll a, ll b){
    return take_mod(a-b);
}


inline ll mul(ll a, ll b){
    return take_mod(a * b);
}

inline ll pow(ll x, ll n){
    ll res = 1LL;
    while(n > 0){
        if(n & 1) res = mul(res, x);
        x = mul(x, x);
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x){
    return pow(x, mod-2);
}

// nは上限
void make_fact(ll n){
    fact[0] = 1;
    ll res = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = res;
        res = mul(res, i+1);
    }
}

// nは上限
void make_invfact(ll n){
    invfact[0] = 1;
    invfact[n] = mod_inv(fact[n]);
    for(int i = n-1; i >= 1; i--){
        invfact[i] = mul(invfact[i + 1], i + 1);
    }
}

ll perm(ll n, ll k){
    return mul(fact[n], invfact[n-k]);
}

ll comb(ll n, ll k){
    return mul(mul(fact[n], invfact[n-k]), invfact[k]);
}

ll p2[401000];
int main(){
    ll N, c[201000];  cin >> N;
    for(int i = 0; i < N; i++){
        cin >> c[i];
    }
    sort(c, c+N);

    p2[0] = 1;
    for(int i = 1; i <= 2 * N; i++){
        p2[i] = mul(p2[i-1], 2);
    }

    ll res = 0;
    for(int i = 1; i <= N; i++){
        ll xa = p2[2 * i - 2];
        ll xb = 2;
        ll xx = mul(xa, xb);
        if(N-i > 0){
            ll xc = mul(p2[N-i], add(mul(N-i, p2[N-i-1]), p2[N-i]));
            xx = mul(xx, xc);
        }
        res = add(res, mul(c[i-1], xx));
//        cout << res << endl;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 5888
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)

int main()
{
  int N, M;
  ll K;
  cin >> N >> M >> K;
  ll A[N], B[M];
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  for (int i = 0; i < M; i++)
  {
    cin >> B[i];
  }

  ll a[N + 1], b[M + 1];
  a[0] = 0;
  b[0] = 0;
  for (int i = 0; i < N; i++)
  {
    a[i + 1] = a[i] + A[i];
  }
  for (int i = 0; i < M; i++)
  {
    b[i + 1] = b[i] + B[i];
  }
  int ans = 0;
  int j = M;
  for (int i = 0; i < N + 1; i++)
  {
    if (a[i] > K)
    {
      break;
    }
    while (b[j] > K - a[i])
    {
      j--;
    }
    ans = max(ans, i + j);
  }

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

Measured memory_bytes: 9796
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;


/* range: ± 3.27 * 10^4 */
using i16 = short int;
/* range: 0 to 65535 */
using u16 = short unsigned int;
/* range: ± 2.14 * 10^9 */
using i32 = int;
/* range: 0 to 4.29 * 10^9 */
using u32 = unsigned int;
/* range: ± 9.22 * 10^18 */
using i64 = long long int;
/* range: 0 to 1.84 * 10^19 */
using u64 = long long unsigned int;

array<array<i64, 3000>, 3000> memo;
i64 dp(const vector<i32>& nums, i32 start, i32 end, i32 turn) {
    if (start == end) {
        if (turn == 1) {
            return nums[start];
        }
        return 0;
    }

    if (memo[start][end] != 0) {
        return memo[start][end];
    }

    i64 res = 0;
    if (turn == 1) {
        res = max(nums[start] + dp(nums, start + 1, end, -turn),
                  nums[end] + dp(nums, start, end - 1, -turn));
    } else {
        res = min(dp(nums, start + 1, end, -turn),
                  dp(nums, start, end - 1, -turn));
    }

    memo[start][end] = res;
    return res;
}

i32 main() {
    i32 n = 0;
    cin >> n;

    vector<i32> nums(n);
    for (i32 i = 0; i < n; i++) {
        cin >> nums[i];
    }

    i64 total = accumulate(begin(nums), end(nums), static_cast<i64>(0));
    auto p1_score = dp(nums, 0, n - 1, 1);
    auto p2_score = total - p1_score;
    cout << p1_score - p2_score << '\n';
}

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

int sell[21];
int buy[21];

int main() {
    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> sell[i];
    }
    for(int i=0; i<n; i++){
        cin >> buy[i];
    }
    int totalprofit = 0;
    for(int i=0; i<n; i++){
        int curprofit = sell[i] - buy[i];
        if(curprofit > 0)
            totalprofit += curprofit;
    }

    cout << totalprofit << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#if defined __has_include
# if __has_include(<bits/debug_aamir.h>)
#  define dbg(...) DEBUG(#__VA_ARGS__, __VA_ARGS__);
#  include<bits/debug_aamir.h>
# else
#  define dbg(...)
# endif
#endif

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef pair<ll, ll> pll;
#define sz(x) int(x.size())
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define rep(i, begin, end) for(__typeof(end) i=begin; i<end; i++)
#define per(i, begin, end) for(__typeof(end) i=begin; i>=end; i--)
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 1e18 + 1;


template<typename T>
T gcd(T a, T b){	return b ? gcd(b, a%b): a; }
template<typename T>
T lcm(T a, T b){	return a/gcd(a, b) * b;		}

const int nax=102, wax=1e5+10;
vii vw(nax);
vector<vector<ll>> dp(nax, vector<ll>(wax));

int main()
{
	fastio;
	int n, W;
	cin >> n >> W;
	rep(i, 0, n)	cin >> vw[i].se >> vw[i].fi;
	
	rep(i, 0, n){
		rep(j, 0, (int)wax){
			dp[i+1][j] = max(dp[i+1][j], dp[i][j]);			// Not selecting current element.
			if(j+vw[i].se < wax)
				dp[i+1][j+vw[i].se] = max(dp[i+1][j+vw[i].se], dp[i][j] + vw[i].fi);
		}
	}
	printf("%lld\n", dp[n][W]);
}



Measured memory_bytes: 83852
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		sc.nextLine();
		List<Integer> input=Arrays.asList(sc.nextLine().split(" "))
				.stream()
				.map(Integer::parseInt)
				.sorted()
				.collect(Collectors.toList());
		System.out.println(input.get(input.size()-1)-input.get(0));
	}
}


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

vector<vector<int>> dist;
int h, w;
string s[1000];
queue<pair<int, int>> q;

void cout_dist()
{
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << dist[i][j] << " ";
        }
        cout << endl;
    }
}

int main()
{
    cin >> h >> w;
    dist = vector<vector<int>>(h, vector<int>(w, 2100));

    for (int i = 0; i < h; i++) {
        cin >> s[i];

        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') {
                q.push({i, j});
                dist[i][j] = 0;
            }
        }
    }

    //cout_dist();

    /*
    while (!q.empty()) {
        auto p = q.front();
        q.pop();

        cout << p.first << " " << p.second << endl;
    }
    */

    while (!q.empty()) {
        auto p = q.front();
        q.pop();

        int x = p.second;
        int y = p.first;

        int d = dist[y][x];

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

        for (int i = 0; i < 4; i++) {
            int x1 = x + dx[i];
            int y1 = y + dy[i];

            if (x1 < 0 || w <= x1) continue;
            if (y1 < 0 || h <= y1) continue;
            if (dist[y1][x1] <= d + 1) continue;

            dist[y1][x1] = d + 1;
            q.push({y1, x1});
        }
    }

    //cout_dist();

    int ans = 0;
    for (int i = 0; i < h; i++) {
        int m = *max_element(dist[i].begin(), dist[i].end());
        ans = max(ans, m);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 13456
/**
 * ????????????????????? wi(i=0,1,...n???1) ??? n
??????????????????????????????????????¢????????????????????????????????????????????????????????? k
??°????????????????????????????????????????????????????????£?¶??????? 0
?????\??????????????????????????¨?????§??????????????????????????????????????????????????????????????§????????? P
????¶?????????????????????????????????§????????? P ?????????????????????????????§??±?????§??????

n???k???wi ???????????????????????§?????????????????????????????????????????????????????§????????? P
???????°????????±???????????????°????????????????????????????????????

??\???
??????????????????????????° n ??¨?????????????????° k ????????????????????§??????????????????????¶???? n ?????? n
????????´??° wi ?????????????????????????????????????????????

??????
P ???????°???????????????????????????????????????????

??¶?´?
1???n???100,000
1???k???100,000
1???wi???10,000
??\?????? 1
5 3
8
1
7
3
9
????????? 1
10
?????°???????????????????????????????????? {8,1},?????°????????????????????????????????????
{7,3}????????°???????????????????????????????????? {9} ???????????§????????§????????????????°??????? 10
??¨???????????????


??\?????? 2
4 2
1
2
2
6
????????? 2
6
?????°???????????????????????????????????? {1,2,2},?????°???????????????????????????????????? {6}
????????§????????§????????????????°??????? 6 ??¨???????????????
 */

#include <algorithm>
#include <stack>
#include <iostream>
#include <numeric>
#include <sstream>
#include <vector>

bool isAllocated(std::vector<unsigned short> W, unsigned int P, unsigned int k) {
  std::stack<unsigned int> Trucks;
  Trucks.push(0);
  for (const auto &e : W) {
    unsigned int Packet = Trucks.top();
    if (Packet + e > P) {
      Trucks.push(e);
    } else {
      Trucks.pop();
      Trucks.push(Packet + e);
    }
  }
  if (Trucks.size() <= k) {
    return true;
  } else {
    return false;
  }

}

int main(int argc, char const *argv[]) {
  std::string Param;
  std::istringstream Stream;
  unsigned int n = 0;
  unsigned int k = 0;
  std::vector<unsigned short> W;

  getline(std::cin, Param);
  Stream.str(Param);
  Stream >> n >> k;
  Stream.clear();
  for (size_t i = 0; i < n; i++) {
    getline(std::cin, Param);
    Stream.str(Param);
    unsigned short Wi = 0;
    Stream >> Wi;
    Stream.clear();
    W.push_back(Wi);
  }

  std::deque<unsigned int> Trucks {0};

  unsigned int Left = *(std::max_element(W.begin(), W.end()));
  unsigned int Right = std::accumulate(W.begin(), W.end(), 0);

  while (Left < Right) {
    unsigned int P = (Left + Right) / 2;
    if (isAllocated(W, P, k)) {
      Right = P;
    } else {
      Left = P + 1;
    }
  }

  std::cout << Left << std::endl;

  return 0;
}

Measured memory_bytes: 3528
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int v[40];
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        int t,x;
        cin>>t;
        while(t--)cin>>x,v[x]++;
    }
    int ans=0;
   	for(int i=1;i<=m;i++)if(v[i]==n)ans++;
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;

int main() {
  int N,K;
  cin >>N>>K;
int ans=1,n=0;
while(n<N&&ans<K){
ans*=2;
n++;
}
while(n<N){
ans+=K;
n++;
}
ce(ans);
}

Measured memory_bytes: 384
use std::io;
//use std::collections::HashMap;
//use std::collections::BinaryHeap;
//use std::collections::HashSet;
//use std::mem; // mem::swap(&mut x,&mut y);
use std::cmp; // cmp::max,cmp::min

// Rust memo: https://hackmd.io/i0lQY1OKTDW1t66TECOmiw?both

#[allow(dead_code)]
fn read_line() -> String{
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read_charvec() -> Vec<char>{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn read_ints() -> Vec<i64>{
    let s = read_line();
    let split:Vec<&str> = s.split(" ").collect();
    split.iter().map(|&x| x.to_string().parse().unwrap()).collect()
}

#[allow(dead_code)]
fn read_int() -> i64{
    read_ints()[0]
}

#[allow(dead_code)]
fn reverse(s: &String) -> String{
    s.chars().rev().collect::<String>()
}

#[allow(dead_code)]
fn read_lines(n:i64) -> Vec<String>{
    let mut xs = Vec::new();

    for _i in 0..n{
        xs.push(read_line());
    }

    xs
}

#[allow(dead_code)]
fn read_ints2(n:i64) -> Vec<i64>{
    read_lines(n).iter().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn arange(start:i64,end:i64,step:i64) -> Vec<i64>{
    let mut ret = Vec::new();
    let mut i = start;

    while i < end{
        ret.push(i);
        i += step;
    }

    ret
}

#[allow(dead_code)]
const DXS : [i64; 4] = [0,0,1,-1];
#[allow(dead_code)]
const DYS : [i64; 4]  = [1,-1,0,0];
#[allow(dead_code)]
const INF : i64 = 999999999;
#[allow(dead_code)]
const N_PRIME : i64 = 1000000007;

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

fn main(){
    let inputs = read_ints();
    let (n,m,x,y) = (inputs[0] as usize,inputs[1] as usize,inputs[2],inputs[3]);
    let mut xs = read_ints();
    let mut ys = read_ints();
    
    xs.sort();
    ys.sort();
    
    let x_max = xs[n-1];
    let y_min = ys[0];
    
    if x < x_max && x_max < y_min && y_min < y{
        println!("No War");
    }else{
        println!("War");
    }
}


Measured memory_bytes: 4352
import numpy as np
N = int(input())
A, B = map(int,input().split())
p = np.array(list(map(int,input().split())))
a = p[p<=A].shape[0]
b = p[np.logical_and(p>A,p<=B)].shape[0]
c = p[p>B].shape[0]
print(np.min(np.array([a,b,c])))

Measured memory_bytes: 21544
//GCD FREQUENCY COUNTER WITH INC-EXC BY ADANCITO

//WHAT DOES THIS ALGORITHM DO?
/*
 
 imagine that for every ordered pair (i, j), 0 <= i, j <= maxN, we did
 res[gcd(i, j)] += one[i] * two[j]
 
 this algorithm calculates the final value of res in O(nlgn)
 
 remember to call precalculations() at the beginning of the program
 
 */

#include <iostream>
#include <string.h>
#include <ctime>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>
#include <vector>
#define se second
#define fi first

using namespace std;
const int maxN = 3e5 + 8, MOD = 1e9 + 7;

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

int n, k;

ll arr[maxN];

ll gg(ll le, ll ri){
    if(le * ri >= 0){
        return max(abs(le), abs(ri));
    }
    
    return min(abs(ri), abs(le)) * 2 + max(abs(ri), abs(le));
    
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    
    cin >> n >> k;
    
    for(int i = 0; i < n; i++){
        cin >> arr[i];
    }
    
    ll mi = LLONG_MAX;
    
    for(int i = 0; i + k <= n; i++){
        mi = min(gg(arr[i], arr[i + k - 1]), mi);
    }
    
    cout << mi << '\n';
}

//99999000001
//00000999999


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

int main()
{
  int N;
  cin >> N;
  int c[100003] = {};
  for(int i = 0; i < N; i++){
    int a, b;
    cin >> a >> b;
    c[a]++;
    c[b+1]--;
  }
  int ans = 0;
  int sum = 1;
  for(int i = 0; i < 100003; i++){
    sum += c[i];
    ans = (i <= sum) ? i : ans;
  }
  cout << ans - 1 << endl;
}

Measured memory_bytes: 3480
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=9;i++)
		for(int j=1;j<=9;j++)
			if(i*j==a)
			{
				printf("Yes");
				return 0;
			}
	printf("No");
		return 0;
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define EREP(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define RREP(i, a, b) for (int i = (int)(a)-1; i >= (int)(b); --i)
#define rep(i, n) REP(i, 0, n)
#define erep(i, n) EREP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define ALL(r) r.begin(), r.end()
#define YES cout << "YES\n"
#define Yes cout << "Yes\n"
#define NO cout << "NO\n"
#define No cout << "No\n"
#define IMP cout << "IMPOSSIBLE\n"
#define Imp cout << "Impossible\n"
#define imp cout << "impossible\n"
#define M1 cout << "-1\n"
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &p) { return (os << "(" << p.first << ", " << p.second << ")"); }
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &m)
{
    bool first = true;
    os << "{";
    for (auto e : m)
    {
        if (!first)
            os << ", ";
        os << "{" << e.first << ": " << e.second << "}";
        first = false;
    }
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y) { return (x + y - 1) / y; };
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            x = in();
        return ret;
    }
    template <typename T, typename U>
    operator pair<T, U>()
    {
        pair<T, U> ret;
        ret.first = in();
        ret.second = in();
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n = in();
    vint l = in(n * 2);
    sort(ALL(l));
    int ans = 0;
    rep(i, n * 2) if (!(i % 2)) ans += l[i];
    cout << ans << endl;
}

signed main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

int main(void){
    string s, result = "Good";
    
    cin >> s;
    
    rep(i, 3){
        if(s[i] == s[i+1]){
            result = "Bad";
        }
    }
    
    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

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

int main()
{
    int N;
    cin >> N;
    vector<int> v(N);
    for(int i = 0; i < N; ++i) cin >> v[i];
    sort(v.begin(), v.end(), greater<int>());
    ll edge1 = 0;
    ll edge2 = 0;
    int tmp = 0;
    for(auto itr = v.begin(); itr != v.end(); ++itr){
        if(tmp == *itr){
            if(edge1 != 0){
                edge2 = *itr;
                break;
            }else{
                edge1 = *itr;
                tmp = 0;
                continue;
            }
        }
        tmp = *itr;
    }
    cout << edge1*edge2 << endl;

    return 0;
}

Measured memory_bytes: 640
//
//  main.cpp
//  Fairness
//
//  Created by Uttam Datta on 03/06/19.
//  Copyright © 2019 Uttam Datta. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

/*
 0__x,y,z, ans = x-y
 1__y+z,x+z,x+y, ans = -x+y
 2__2x+y+z, x+2y+z,x+y+2z, ans = x-y
 3__2x+3y+3z, 3x+2y+3z, ans = -x+y
 */

//taka-naka
long long int taka,naka,hiku;
long long int k;
long long int d = pow(10,18);
long long int ans(){
    if(k%2 ==0){
        return taka-naka;
    }
    else{
        return (taka*-1)+naka;
        
    }
}

int main(){
    
    cin >> taka >> naka >> hiku >> k;
    long long int res = ans();
    if(abs(taka-naka) <= d){
        cout << res << endl;
    }
    else{
        cout << "Unfair" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>

using namespace std;
using ll = long long;

int main(){
    int N,K,Q;cin >> N  >> K >> Q;
    vector<int> vec(N, 0);
    for(int i = 0;i < Q;i++){
        int b;cin >> b;
        vec[b-1]++;
    }
    for(int i = 0;i < N;i++){
        if(Q - vec[i] >= K){
            cout<<"No"<<endl;
        }else{
            cout<<"Yes"<<endl;
        }
    }
}


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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    double a,b;
    cin >> a >> b;
    cout << ceil((a+b)/2) << endl;

    return 0;
}

Measured memory_bytes: 256
S = input()
while len(S) > 0:
    if S[-5:] == 'dream' or S[-5:] == 'erase':
        S = S[:-5]
    elif S[-6:] == 'eraser':
        S = S[:-6]
    elif S[-7:] == 'dreamer':
        S = S[:-7]
    else:
        break
if len(S) == 0:
    print('YES')
else:
    print('NO')


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

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

int main()
{
    int N;
    cin >> N;
    if(N == 1){
        cout << "Hello World" << endl;
    }else{
        int A, B;
        cin >> A >> B;
        cout << A + B << endl;
    }
}

Measured memory_bytes: 256
s=list(input())
#sのi番目の次に＋かーを入れる。それまでの文字列char,合計sum
def dfs(i,char,sum):
  if i==3:
    if sum==7:
      print(char+"=7")
      exit()
  else:
    dfs(i+1,char+"+"+s[i+1],sum+int(s[i+1]))  
    dfs(i+1,char+"-"+s[i+1],sum-int(s[i+1]))
        
    
      
    
      
dfs(0,s[0],int(s[0]))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  long a,b,k;
  cin >> a>>b>>k;
  for(long i=a;i<min(b,a+k-1)+1;i++){
    cout << i <<endl;
    
  }
for(long j=max(b-k+1,a+k);j<b+1;j++){
cout << j <<endl;}  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    int k, x; cin >> k >> x;
    int begin = max(-1000000, x-k+1);
    int end = min(1000000, x+k-1);
    for(int i=begin; i<end; i++) {
        cout << i << " ";
    }
    cout << end << endl;
}

Measured memory_bytes: 256
n,t=map(int,input().split())
l=list(map(int,input().split()))
m=l[-1]
ma=[m]*n
for i in range(n):
    m=max(m,l[n-1-i])
    ma[n-1-i]=m
for i in range(n):
    l[i]=ma[i]-l[i]
k=max(l)
ans=0
for i in l:
    if i==k:
        ans+=1
print(ans)

Measured memory_bytes: 14252
//*******Abhijit Burman***********//
//Jalpaiguri Government Engineering College//

// Taken From Striver_79
// Never open a ranklist untill and unless you are done with solving problems, wastes 3/4 minuts 
// Donot treat CP as a placement thing, love it and enjoy it, you will succeed for sure. 


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define MAXX (1000000000000000000+7)
#define mod 1000000007
#define endl "\n"
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
void input(ll a[], ll sz) {for(ll i=0;i<sz;i++) cin >> a[i];}
void print(ll a[], ll sz) {for(ll i=0;i<sz;i++) {if (i == sz - 1) cout << a[i] << "\n"; else cout << a[i] << " ";}}
ll dx1[] = {1, 1, 0, -1, -1, -1, 0, 1};
ll dy1[] = {0, 1, 1, 1, 0, -1, -1, -1};

ll dx2[] = {1, 0, -1, 0};
ll dy2[] = {0, 1, 0, -1};

ll mul(ll a, ll b, ll p = mod) {return ((a % p) * (b % p)) % p;}
ll add(ll a, ll b, ll p = mod) {return (a % p + b % p) % p;}
ll power(ll x,ll y,ll p = mod) 
{ 
    ll res = 1;
    x = x % p;
    while (y > 0) 
    {
        if (y & 1) 
            res = (res*x) % p;
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p = mod)
{
    return power(n, p - 2, p);
}
ll ncrMod(ll n, ll r, ll p = mod)
{
    if (r == 0)
        return 1;
    ll fac[n + 1];
    fac[0] = 1;
    for (ll i = 1 ; i <= n; i++)
        fac[i] = fac[i - 1] * i % p;
    return (fac[n] * modInverse(fac[r], p) % p *
            modInverse(fac[n - r], p) % p) % p;
}
// a+b=xor(a,b)+2*(a&b)//

bool isPrime(ll n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}


void solve()
{
    double d,t,s;
    cin>>d>>t>>s;
    
    double temp = d/s;
    
    cout<<(temp<=t?"Yes":"No")<<endl;
}


int main()
{
	fio;
// 	#ifndef ONLINE_JUDGE
//     // for getting input from input.txt
//     freopen("input.txt", "r", stdin);
//     // for writing output to output.txt
//     freopen("output.txt", "w", stdout);
// 	#endif
 

	ll t=1;
// 	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3740
import java.util.Scanner;

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

        int N = scanner.nextInt();
        String S = scanner.next();
        char[] s = S.toCharArray();

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

        System.out.println(count);
    }
}


Measured memory_bytes: 36064
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))
q1 = []
q2 = []
q3 = []
for i in range(len(p)):
    if(p[i]<=a):
        q1.append(p[i])
    elif(p[i]>a and p[i]<=b):
        q2.append(p[i])
    else:
        q3.append(p[i])
print(min(len(q1), len(q2), len(q3)))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int w, h, n;
    cin >> w >> h >> n;
    int xmin = 0, xmax = w, ymin = 0, ymax = h;
    REP(i, n){
        int x, y, a;
        cin >> x >> y >> a;
        switch(a){
            case 1:
                xmin = max(xmin, x);
                break;
            case 2:
                xmax = min(xmax, x);
                break;
            case 3:
                ymin = max(ymin, y);
                break;
            case 4:
                ymax = min(ymax, y);
                break;
        }
    }
    cout << max(0, xmax - xmin) * max(0, ymax - ymin) << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int,input().split())
AB = []
for _ in range(M):
    a,b = map(int,input().split())
    if  a == 1 or b== N:
        AB.append((a,b))
set1 = set()
set2 = set()
for ab in AB:
    if ab[0] == 1:
        set1.add(ab[1])
    if ab[1] == N:
        set2.add(ab[0])
if set1 & set2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

typedef long long int ll;

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    vector<int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    
    int res = 0;
    for (int i = 1; i < n - 1; ++i)
    {
        if (a[i] > a[i - 1] && a[i] < a[i + 1])
            ++res;
        else if (a[i] < a[i - 1] && a[i] > a[i + 1])
            ++res;
    }
    
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <cstdio>
#define INF 1000000000000
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
  int h, w;
  cin >> h >> w;
  bool b[h][w];
  int t = 0;
  REP(i, h){
    string s;
    cin >> s;
    REP(j, w){
      b[i][j] = (s[j] == '.');
      if(s[j] == '#') t++;
    }
  }
  int md[h][w] = { };
  REP(i, h){
    REP(j, w){
      md[i][j] = 100000;
    }
  }
  md[0][0] = 1;
  queue<P> q;
  q.push({0, 0});
  int dx[4] = {0, 0, 1, -1};
  int dy[4] = {1, -1, 0, 0};
  while(q.size()){
    P p = q.front();
    q.pop();
    REP(i, 4){
      int nx = p.first + dx[i];
      int ny = p.second + dy[i];
      if(0 <= nx && nx < h && 0 <= ny && ny < w && md[nx][ny] > md[p.first][p.second]+1 && b[nx][ny]){
        md[nx][ny] = md[p.first][p.second]+1;
        q.push({nx, ny});
      }
    }
  }
  if(md[h-1][w-1] == 100000) cout << -1 << endl;
  else cout << h*w-t-md[h-1][w-1] << endl;
	return 0;
}

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

#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(int i=a; i<b; i++)
#define vector<int> vi
#define pb push_back
#define ll long long

int main()
{
    FASTIO
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(ceil((double)c/b) <= ceil((double)a/d)) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}

Measured memory_bytes: 3648