akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

using namespace std;

int main() {
  
    int N,K;
    cin >> N >> K ;
    vector<int> heights(N);
    for(int i = 0; i < N;i++)
        cin >> heights[i];
    
    vector<long> dp(N,0);
    
    for(int i = 1;i < N;i++){
        dp[i] = dp[i-1] + abs(heights[i] - heights[i-1]);
        // i - k >= 0 i >= k
        for(int k = 2; k <= min(i,K);k++){
           dp[i] = min( dp[i],abs(heights[i] - heights[i-k]) + dp[i-k]);
        }
    }
    cout << dp[N-1] << endl;
    return 0;
    // EDABC
}




Measured memory_bytes: 3908
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int count = scanner.nextInt();
        int[] arr = new int[count];
        for (int i = 0; i < count; ++i) {
            arr[i] = scanner.nextInt();
        }

        long[][] dp = new long[count][count];
        for (int size = 1; size < count; ++size) {
            for (int i = 0; i + size < count; ++i) {
                long minCost = Long.MAX_VALUE;
                long sum = 0;

                for (int j = 0; j < size; ++j) {
                    minCost = Math.min(minCost, dp[i][i + j] + dp[i + j + 1][i + size]);
                }

                for (int j = 0; j <= size; ++j) {
                    sum += arr[i + j];
                }
                dp[i][i + size] = minCost + sum;
            }
        }
        System.out.println(dp[0][count - 1]);
    }
}


Measured memory_bytes: 25172
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <ctime>
#include <unordered_map>
#include <iomanip>
#include <complex>
#include <cassert>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define deb(a) cerr<< #a << "= " << (a)<<"\n";

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef complex<double> base;
typedef vector<int> vi;
typedef pair<int,int> pii;

template<class T> ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream; }
ll fpow(ll x, ll p, ll m){ll r=1; for (;p;p>>=1){ if (p&1) r=r*x%m; x=x*x%m; } return r;}
ll inv(ll a, ll b){ return a<2 ? a : ((a-inv(b%a,a))*b+1)/a%b; }
int gcd(int a, int b){ if (!b) return a; return gcd(b,a%b);}
ll gcd(ll a, ll b){ if (!b) return a; return gcd(b,a%b);}


ll N,M;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> M;
	
	if (N==1 && M==1) cout << 1 << "\n";
	else if (N==1 || M==1) cout << (N==1 ? M-2 : N-2) << "\n";
	else cout << (N-2)*(M-2) << "\n";
	
	return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


bool ans[81][81][13000];



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll h,w;
    cin>>h>>w;
    ll a[100][100],b[100][100];
    rep(i,h)rep(j,w) cin>>a[i][j];
    rep(i,h)rep(j,w) cin>>b[i][j];
    ll c[100][100];
    rep(i,h){
        rep(j,w){
            ll s=abs(a[i][j]-b[i][j]);
            c[i][j]=s;
        }
    }
    ans[0][0][c[0][0]]=true;
    rep(i,h){
        rep(j,w){
            rep(k,13000){
                if(ans[i][j][k]==true){
                    ll u=k+c[i+1][j];
                    ll t=abs(k-c[i+1][j]);
                    ans[i+1][j][u]=true;
                    ans[i+1][j][t]=true;
                    u=k+c[i][j+1];
                    t=abs(k-c[i][j+1]);
                    ans[i][j+1][u]=true;
                    ans[i][j+1][t]=true;
                }
            }

        }
    }
    rep(i,13000){
        if(ans[h-1][w-1][i]==true){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N;
ll T;

int main()
{
	scanf("%d%lld",&N,&T);
	vector<ll> A(N);
	FOR(i,0,N){
		scanf("%lld",&A [i]);
	}

	ll ans = 0;
	FOR(i,0,N){
		if(i == N - 1){
			ans += T;
		}
		else{
			ans += min(T,A [i + 1] - A [i]);
		}
	}

	printf("%lld\n",ans);

	return 0;
}


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

#define bug(x) cout << #x << " = " << x << endl;
#define fr(a) freopen(a,"r",stdin);
#define fw(a) freopen(a,"w",stdout);
#define tc() int tc;cin >> tc; for (int _tc=1;_tc<=tc;_tc++)
#define up(i,l,r) for (int i=l;i<=r;i++)
#define down(i,r,l) for (int i=r;i>=l;i--)
#define rep(i,l,r) for (int i=l;i<r;i++)
#define pb push_back
#define mp make_pair
#define ins insert
#define fi first
#define se second
using namespace std;
typedef long long int ll;
typedef unsigned long long int llu;
typedef pair<int,int> ii;

/****************************************************/
void printArr(int a[], int l, int r)
{
    up(i,l,r) {
        cout << a[i] << " ";
    }
    cout << endl;
}

void printMtx(int a[][110],int n, int m)
{
    up(i,1,n) {
        up(j,1,m) {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
}
/****************************************************/

int cnt, a[10010], b[110][110], h, w, n, curr,curc;
bool ok;

void flood(int color, int r,int c)
{
    if (cnt == 0) {
        if ((!b[r][c]) && (!ok)) {
            curr = r;
            curc = c;
            ok = true;
        }
        return;
    }
    if (b[r][c] == 0) {
        b[r][c] = color;
        cnt--;
        flood(color,r,c+1);
        flood(color,r+1,c);
        flood(color,r,c-1);
        flood(color,r-1,c);
    }
}

void run()
{
    curr = 1;
    curc = 1;
    up(i,1,n) {
        ok = false;
        cnt = a[i];
        flood(i,curr,curc);
    }
}

void Init()
{
    up(i,0,h+1) {
        b[i][0] = -1;
        b[i][w+1] = -1;
    }
    up(i,0,w+1) {
        b[0][i] = -1;
        b[h+1][i] = -1;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> h >> w;
    Init();
    cin >> n;
    up(i,1,n) {
        cin >> a[i];
    }
    run();
    up(i,1,h) {
        up(j,1,w) cout << b[i][j] << " ";
        cout << endl;
    }
}


Measured memory_bytes: 896
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
ll dp[2001];
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n;
    cin >> n;
    dp[0] = 1;
    for (ll i = 1; i <= n; i++)
        for (ll j = 3; j <= i; j++)
            dp[i] = (dp[i] + dp[i - j]) % M;
    cout << dp[n];
}

Measured memory_bytes: 3660
def main():
    [n, a, b] = list(map(int,input().split()))
    m = list(map(int,input().split()))
    cost = 0
    for i in range(1, n):
        cost += min([a*(m[i]-m[i-1]), b])
    print(cost)


if __name__ == "__main__":
    import sys
    import os
    if len(sys.argv) > 1:
        if sys.argv[1] == "-d":
            filename = "input1.txt"
            fd = os.open(filename, os.O_RDONLY)
            os.dup2(fd, sys.stdin.fileno())
            main()
    else:
        main()

Measured memory_bytes: 14224
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
//using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX
 





void solve()
{
  int x,k,d;
  cin >> x >> k >> d;
  x = abs(x);
  if(x/d >= k)
  {
    cout << x-d*k << endl;
    return;
  } 

  k -= x/d;
  x %= d;
  if(k%2)
  {
    cout << d-x << endl;
  }
  else
    cout <<  x << endl;
}

 
signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 3568
fun main(args: Array<String>) {
    abc117b()
}

fun abc117b() {
    val n = readLine()!!.toInt()
    val lList = readLine()!!.split(" ").map { it.toInt() }

    val answer = lList.all {
        val exceptItList = lList.toMutableList()
        exceptItList.remove(it)

        it < exceptItList.sum()
    }

    println(if (answer) "Yes" else "No")
}


Measured memory_bytes: 37436
#include<iostream>

using namespace std;

int main(){
  int n, p;

  while(cin >> n >> p){
    if(n == 0 && p == 0) break;
    int max = p;
    int num = 0;
    int data[n];
    for(int i = 0; i < n; i++) data[i] = 0;

    while(1){
      if(p == 0){
	p = data[num];
	data[num] = 0;
      }else{
	data[num]++;
	p--;
	if(data[num] == max){
	  cout << num << endl;
	  break;
	}
      }
      num++;
      if(num == n)num = 0;
    }
  }
  return 0;
}

Measured memory_bytes: 868
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;


	public class Main {
		
		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			
			int n = sc.nextInt();
			long[] a = new long[n];
			long[] b = new long[n];
			long suma = 0;
			long sumb = 0;
			long minus = 0;
			ArrayList<Long> list = new ArrayList<Long>();
			
			
			for(int i=0;i<n;i++) {
				a[i] = sc.nextLong();
				suma += a[i];
			}
			for(int i=0;i<n;i++) {
				b[i] = sc.nextLong();
				sumb += b[i];
			}
			
			if(suma<sumb) {
				System.out.println(-1);
				return;
			}
			
			long ret = 0;
			
			for(int i=0;i<n;i++) {
				if(a[i]<b[i]) {
					minus += b[i]-a[i];
					ret++;
				}else {
					list.add((a[i]-b[i]));
				}
			}
			
			if(list.size()==n) {
				System.out.println(0);
				return;
			}
			
			
			Collections.sort(list, Collections.reverseOrder());
			
			for(int i=0;i<n;i++) {
				ret++;
				if(list.get(i)>=minus) {
					break;
				}
				minus -= list.get(i);
			}
			
			System.out.println(ret);
	    }
		
	}
	


Measured memory_bytes: 61472
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int n, q; cin >> n >> q;
    string s; cin >> s;
    vector<int> rui(n+1,0);
    repp(i,n,1){
        if (s[i-1] == 'A' && s[i] == 'C'){
            rui[i+1] = rui[i] + 1;
        }
        else rui[i+1] = rui[i];
    }
    vector<int> ans(q);
    rep(i,q){
        int a, b; cin >> a >> b;
        ans[i] = rui[b] - rui[a];
    }
    rep(i,q) cout << ans[i] << endl;
}

Measured memory_bytes: 4232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e4+10;
vector<int> G[maxn];
int deg[maxn],vis[maxn],c[maxn],ans[maxn];
queue<int> q;
int main(){
    int n;scanf("%d",&n);
    for(int i=1;i<n;i++){
        int a,b;scanf("%d%d",&a,&b);
        G[a].push_back(b);G[b].push_back(a);
        deg[a]++;deg[b]++;
    }
    for(int i=1;i<=n;i++) scanf("%d",c+i);
    if(n==1){
        puts("0");
        printf("%d",c[1]);
        return 0;
    }
    sort(c+1,c+n+1);
    for(int i=1;i<=n;i++) if(deg[i]==1) q.push(i);
    int idx=0,tot=0;
    while(!q.empty()){
        int x=q.front();
        q.pop();
        vis[x]=1;
        ans[x]=c[++idx];
        for(auto& u:G[x]){
            if(vis[u]) continue;
            deg[u]--;deg[x]--;
            if(deg[u]==1) q.push(u);
        }
    }
    for(int i=1;i<n;i++) tot+=c[i];
    printf("%d\n",tot);
    for(int i=1;i<=n;i++) printf("%d ",ans[i]);
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		
		for(int i = 0; i < S.length(); i++) {
			if(i % 2 == 0) {
				if(S.charAt(i) == 'L') {
					System.out.println("No");
					return;
				}
			} else {
				if(S.charAt(i) == 'R') {
					System.out.println("No");
					return;
				}
			}
		}
		System.out.println("Yes");
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define llong long long
#define IFY 2000000000
#define MAX 100005
#define NIL -1
using namespace std;
struct Node {int p,l,r;};
Node T[MAX];
int D[MAX];
void print(int u){
  int j,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);
  if(T[u].p==NIL)printf("root, ");
  else if(T[u].l==NIL)printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  for(j=0,c=T[u].l;c!=NIL;j++,c=T[c].r){
    if(j) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}
int rec(int u,int p){
  D[u]=p;
  if(T[u].l!=NIL) rec(T[u].l,p+1);
  if(T[u].r!=NIL) rec(T[u].r,p);
}
int main(){
  int n,v,d,c,l,r,j;
  scanf("%d",&n);
  REP(i,n) T[i].p=T[i].l=T[i].r=NIL;
  REP(i,n){
    scanf("%d %d",&v,&d);
    REP(j,d){
      scanf("%d",&c);
      if(j==0) T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  REP(i,n) if(T[i].p==NIL) r=i;
  rec(r,0);
  REP(i,n) print(i);
  return 0;
}

Measured memory_bytes: 4716
s=[[int(j) for j in input().split()] for i in range (1)]
N=s[0][0]
Y=s[0][1]
ans=[-1,-1,-1]
for x in range(0,N+1):
    for y in range(0,N+1):
        z=N-x-y
        if 10000*x+5000*y+1000*z==Y and z>=0:
            ans=[x,y,z]
print(ans[0],ans[1],ans[2])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-5;
const ll MOD=1000000007LL;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int n;cin>>n;
    vector<ll> a(n),b(n);
    vector<pair<ll,P>> v;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        v.push_back(mp(a[i]+b[i],P(a[i],b[i])));
    }
    sort(all(v));
    reverse(all(v));
    ll ans=0;
    for(int i=0;i<n;i++){
        if(i%2){
            ans-=v[i].second.second;
        }else{
            ans+=v[i].second.first;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6532
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

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

    int cnt = 0;
    if (S == "SSS") cnt = 0;
    else if (S == "SSR") cnt = 1;
    else if (S == "SRS") cnt = 1;
    else if (S == "RSS") cnt = 1;
    else if (S == "RSR") cnt = 1;
    else if (S == "SRR") cnt = 2;
    else if (S == "RRS") cnt = 2;
    else if (S == "RRR") cnt = 3;

    cout << cnt << endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;

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

    int ans =  0 * 2 * c + max(0, x - 0) * a + max(0, y - 0) * b;

    for(int i = 1; i <= 100000; ++i){
        int tmp = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b;
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import copy


def BubbleSort(C, N):
    for i in range(N):
        for j in range(N - 1, i, -1):
            if int(C[j][1]) < int(C[j - 1][1]):
                C[j], C[j - 1] = C[j - 1], C[j]
    return C


def SelectionSort(C, N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if int(C[j][1]) < int(C[minj][1]):
                minj = j
        C[i], C[minj] = C[minj], C[i]
    return C


n = int(input())
c = input().split()
b = BubbleSort(copy.deepcopy(c), n)
print(" ".join(b))
print("Stable")
s = SelectionSort(copy.deepcopy(c), n)
print(" ".join(s))
if b == s:
    print("Stable")
else:
    print("Not stable")




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

int main()
{
  int64_t N, s;
  cin >> N;
  for (int i = 1; i <= N; i++)
  {
    s = (i * (i + 1)) / 2;
    if (s < N)
    {
      continue;
    }
    else
    {
      int n = N;
      for (int j = i; j >= 1; j--)
      {
        if (n - j == 0)
        {
          cout << j << endl;
          return 0;
        }
        else if (n - j > 0)
        {
          n -= j;
          cout << j << endl;
        }
      }
    }
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
using static System.Console;

namespace testConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            ReadLine();
            var h = Array.ConvertAll(ReadLine().Split(), int.Parse);
            var count = 0;

            while (true)
            {
                bool foundNumber = false;
                bool contZero = false;
                for (var i = 0; i < h.Count(); i++)
                {
                    if (h[i] != 0)
                    {
                        h[i]--;
                        foundNumber = true;
                        contZero = false;
                        if (i == h.Count() - 1) count++;
                    }
                    else if (foundNumber && !contZero)
                    {
                        count++;
                        contZero = true;
                    }
                }
                if (!foundNumber) break;
            }
            WriteLine(count);
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<cstdio>
#include<vector>
#define MN 300000
#define ll long long
#define pa pair<int,ll>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
vector<pair<int,int> >v[MN+5];
int n,m,top;pa q[MN+5];
ll t[MN+5],f[MN+5],g[MN+5],F[MN+5],Ans[MN+5];
inline double Calc(pa a,pa b){return (double)(a.second-b.second)/(a.first-b.first);}
void Ins(pa x)
{
    while(top>1&&Calc(x,q[top])>Calc(q[top],q[top-1])) --top;
    q[++top]=x;
}
ll Calc(int x,ll v)
{
    while(top>1&&Calc(q[top],q[top-1])<=x) --top;
    return q[top].second-1LL*x*q[top].first+1LL*x*(x+1)/2+v;
}
void Solve(int l,int r)
{
    if(l==r) return;
    int mid=l+r>>1;Solve(l,mid);Solve(mid+1,r);
    top=0;
    for(int i=l-1;i<=mid;++i)
    {
        int j=i-l+1;
        Ins(make_pair(j,f[i]+1LL*j*(j-1)/2+t[i]));
    }
    for(int i=mid+1;i<=r;++i) F[i]=g[i+1]+Calc(i-l+1,-t[i]);
    for(int i=r;i>mid;--i)
    {
        if(i<r) F[i]=max(F[i],F[i+1]);
        Ans[i]=max(Ans[i],F[i]+t[i]-t[i-1]);
    }
    top=0;
    for(int i=r+1;i>mid;--i)
    {
        int j=r-i+1;
        Ins(make_pair(j,g[i]+1LL*j*(j-1)/2+t[n]-t[i-1]));
    }
    for(int i=mid;i>=l;--i) F[i]=f[i-1]+Calc(r-i+1,-(t[n]-t[i-1]));
    for(int i=l;i<=mid;++i)
    {
        if(i>l) F[i]=max(F[i],F[i-1]);
        Ans[i]=max(Ans[i],F[i]+t[i]-t[i-1]);
    }
}
int main()
{
    n=read();
    for(int i=1;i<=n;++i) t[i]=t[i-1]+read();
    top=0;Ins(make_pair(0,0LL));
    for(int i=1;i<=n;++i)
    {
        f[i]=max(f[i-1],Calc(i,-t[i]));
        Ins(make_pair(i,f[i]+1LL*i*(i-1)/2+t[i]));
    }
    top=0;Ins(make_pair(0,0LL));
    for(int i=n;i;--i)
    {
        int j=n+1-i;
        g[i]=max(g[i+1],Calc(j,-(t[n]-t[i-1])));
        Ins(make_pair(j,g[i]+1LL*j*(j-1)/2+t[n]-t[i-1]));
    }
    Solve(1,n);m=read();
    for(int i=1;i<=m;++i)
    {
        int p=read(),x=read();
        printf("%lld\n",max(f[p-1]+g[p+1],Ans[p]-x));
    }
    return 0;
}


Measured memory_bytes: 21888
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <string.h>
#include <stdio.h>
#include <queue>
#include <limits.h>
#include <stack>
#include <set>
#include <map>

#define P pair
#define MP make_pair

typedef long long int llint ;

using namespace std;

const int maxn=1e6;
const llint inf=LLONG_MAX;

int n,m,x,y,d;
vector<pair<int,int> > niz[maxn];
pair<pair<int,int>,int> unos[maxn];
llint poz[maxn];

void bfs(int num)
{
	queue<pair<llint,int> > q;
	q.push(MP(0,num));
	while(!q.empty())
	{
		int k=q.front().second;
		llint d=q.front().first;
		q.pop();
		poz[k]=d;
		for(int i=0;i<niz[k].size();i++)
		{
			if(poz[niz[k][i].second]==inf)
			{
				poz[niz[k][i].second]=inf-1;
				q.push(MP(d+niz[k][i].first,niz[k][i].second));
			}
		}
	}
}

int main()
{
	for(int i=0;i<maxn;i++)
	poz[i]=inf;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>x>>y>>d;
		unos[i]=MP(MP(x,y),d);
		niz[x].push_back(MP(d,y));
		niz[y].push_back(MP(-d,x));
	}
	for(int i=0;i<n;i++)
	{
		if(poz[i+1]==inf)
		bfs(i+1);
	}
	llint mi=1e18;
	for(int i=1;i<=n;i++)
	mi=min(mi,poz[i]);
	for(int i=1;i<=n;i++)
	poz[i]-=mi;
	for(int i=0;i<m;i++)
	{
		int num1=unos[i].first.first;
		int num2=unos[i].first.second;
		int dist=unos[i].second;
		if(poz[num2]-poz[num1]!=dist || poz[num1]>1e9 || poz[num2]>1e9)
		{
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
    return 0;
}


Measured memory_bytes: 42484
#include<iostream>
using namespace std;
int main() {
	long long n, m, l, i, j, k, sum = 0, A[100][100] = {}, B[100][100] = {}, C[100][100] = {};
	cin >> n >> m >> l;
	for (i = 0; i < n; i++) {
		for (k = 0; k < m; k++) {
			cin >> A[i][k];
		}
	}
	for (k = 0; k < m; k++) {
		for (j = 0; j < l; j++) {
			cin >> B[k][j];
		}
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < l; j++) {
			for (k = 0; k < m; k++) {
				sum += A[i][k] * B[k][j];
			}
			C[i][j] = sum;
			sum = 0;
		}
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < l; j++) {
			
			if( j!=l-1) {
				cout << C[i][j] << " ";
			}
			else {
				cout << C[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3320
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};
vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i];
  ll lim=1000005;
  vector<ll>t(lim);
  vector<bool>p(lim);
  rep(i,0,n)t[a[i]]++;
  rep(i,1,lim){
    if(t[i]==0||p[i])continue;
    if(t[i]==1)res++;
    for(ll j=i+i;j<lim;j+=i){
      p[j]=true;
    }
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 12932
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  int n,d; cin>>n>>d;
  int cnt = 1;
  while (n > (cnt*(2*d) + cnt)) {
    cnt += 1;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
w,h,n = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(n)]
left = 0
right = w
down = 0
up = h
for i in xya:
    if i[2]==1:
        left = max(i[0], left)
    elif i[2]==2:
        right = min(i[0], right)
    elif i[2]==3:
        down = max(i[1], down)
    else:
        up = min(i[1], up)

print(max(up-down, 0) * max(right-left, 0))

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <algorithm>
#include <map>
#include <numeric>
#include <iomanip>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int MAX = 100;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */

/* function */

/* main */
int main() {

    int n; cin >> n;
    vector< vector<int> > v(n, vector<int>());
    int q; cin >> q;
    while (q--) {

        int op; cin >> op;
        int t; cin >> t;

        if (op == 1) {
            int i = 0;
            // cout << "size : " << v[t].size() << '\n';
            int len = v[t].size();
            if (len == 0) {
                cout << '\n';
                continue;
            }
            else {
                for (; i < len-1; i++) {
                    cout << v[t][i] << ' ';
                } cout << v[t][len-1] << '\n';
            }
        }
        else if (op == 2) {
            v[t].clear();
        }
        else {
            int x; cin >> x;
            v[t].push_back(x);
        }
    }

    /*
    cout << "==========" << '\n';
    for (int i = 0; i < n; i++) {
        int len = v[i].size();
        
        if (len == 0) {
            cout << '\n';
        }
        else {
            for (int j = 0; j < len-1; j++) {
                cout << v[i][j] << ' ' ;
            } cout << v[i][len-1] << '\n';
        }
    }
    */

}



Measured memory_bytes: 5844
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

char dp[2][1 << 24];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    // vector<vector<char>> dp(n + 1, vector<char>(1 << 23));
    dp[0][1] = true;
    for(int i = 1; i <= n; i++){
        int d; cin >> d;
        for(int bits = 0; bits < (1 << 24); bits++){
            dp[i & 1][bits] = false;
        }
        for(int bits = 0; bits < (1 << 24); bits++){
            if(dp[(i - 1) & 1][bits]){
                if((bits >> d & 1) == 0){
                    dp[i & 1][bits | (1 << d)] = true;
                }
                if(d && (bits >> (24 - d) & 1) == 0){
                    dp[i & 1][bits | (1 << (24 - d))] = true;
                }
            }
        }
    }
    int ans = 0;
    vector<int> ts;
    ts.reserve(24);
    for(int bits = 0; bits < (1 << 24); bits++){
        if(dp[n & 1][bits]){
            ts.clear();
            ts.push_back(0);
            for(int j = 1; j <= 24; j++){
                if((bits >> j) & 1){
                    ts.push_back(j);
                }
            }
            printb(bits);
            prints(ts);
            if(ts.size() <= 1){ continue ;}
            int mini = M;
            for(size_t i = 1; i < ts.size(); i++){
                mini = min(mini, ts[i] - ts[i - 1]);
                printd(mini, ts[i], ts[i - 1]);
            }
            mini = min(mini, ts[0] + 24 - ts.back());
            printd(ans, mini, ts[0], ts.back());
            ans = max(ans, mini);
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 33024
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;

const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
//const long long int pl=1000000;
long long int N,D,X,Y,res=0;

int main(){

    cout << fixed << setprecision(18);
    cin>>N>>D;
    for(long long int i = 0; i < N; i++){
        cin>>X>>Y;
        if(X*X+Y*Y<=D*D){res++;}
    }
    cout<<res<<endl;
}



Measured memory_bytes: 3632
s = open(0).read().rstrip()

from itertools import cycle

count1 = 0
for c,d in zip(s,cycle('10')):
#     print(c,d)
    if c!= d:
        count1 += 1
        
count2 = 0
for c,d in zip(s,cycle('01')):
#     print(c,d)
    if c!= d:
        count2 += 1

print(min(count1,count2))

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

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

#############
# Main Code #
#############

A,B,C = inputIL()

print(A+B+C+max(A,B,C)*9)

Measured memory_bytes: 63980
#include <bits/stdc++.h>
 
using namespace std;
 
// numbers
const int N = 1e5 + 7;
#define MOD 1000000007
#define BMOD 1000000000000000007
#define primemod 998244353
//shortforms
#define ff first
#define ss second 
#define ll long long int
#define pb(a) push_back((a))
#define pob() pop_back()
//max and min and sum
#define maxv(all,A) *max_element(A.begin(),A.end())
#define maxa(a,i,j,m,p) fof(k,i,j+1){if(a[k]>m){m=a[k];p=k;}}
#define mina(a,i,j,m,p) fof(k,i,j+1){if(a[k]<m){m=a[k];p=k;}}
#define minv(all,A) *min_element(A.begin(),A.end())
#define sumv(all,A,a) accumulate(A.begin(), A.end(),a)
//for loops
#define fof(i,a,n) for(auto i=a;i<(n);i++)
#define fob(i,n,a) for(auto i=n-1;i>=a;i--)
#define fom(i,a,n) for(auto i=a;i!=(n);i++)
//sorting
#define as(all,A) sort((A).begin(),(A).end())
#define ds(all,A,x) sort((A).begin(),(A).end(),greater<x>())
//input
#define input(A,n) fof(i,0,n){cin>>A[i];}
#define mai(n,M) fof(i,0,n){ll  a; cin>>a;  if(M.find(a)==M.end()){ M.mk_pair(ll,ll,a,1); } else { M[a]++;} }
#define mk_pair(x,y,a,b) insert(pair<x,y >(a,b))
//output
#define in(a) emplace(A.begin(),a)
#define debug(a) cerr<<a<<" ";
#define dispve(A,a,n) fof(i,a,n){cout<<A[i]<<" ";}
#define dismp(m) for(auto x : m){ cout<<x.ff<<" "<<x.ss<<"\n"; }
//code begins
void solve()
{
	ll d,t,s;
	cin>>d>>t>>s;
	if(ceil((d*1.0)/s)<=t)
	cout<<"Yes";
	else
	cout<<"No";
	
	
}
//code ends
void template1 ()
{
	ll t;
	cin>>t;
	while(t--)
	{
		solve();
		cout<<"\n";
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//template1();
	solve();cout<<"\n";
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{   speed_up;
    ll a, b, w, n, m;
    cin>>w;
    cin>>n>>m;
    b = max(m, n);
    a = min(m, n);
    if(b>a+w)
    {
        cout<<b-a-w<<endl;
        return 0;
    }
    else
    {
        cout<<0<<endl;
        return 0;
    }

    return 0;

}







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

//コピペ
struct union_find{//rank,経路圧縮で高速化
    vector<int> par;//parは添字の親（または自分が根の時自身）を示す。
    vector<int> rank;//rankは木の高さ（根についてのみ実装,0-indexed）
    union_find(int sz){//コンストラクタ,sz個のノードを作成し、自分を親につける
        par.resize(sz);
        rank.assign(sz,0); //rankは最初0
        for(int i = 0;i < sz;++i) par[i]=i;
    }
    int find(int a){//根を探す
        if(par[a]==a) return a; //親が自身を指す時、根である
        else return par[a] = find(par[a]);//根に直接つける
    }
    void unite(int a,int b){//小さい方の木の根に大きい方の根を上書きする
        int root_a,root_b;
        root_a = find(a),root_b = find(b);
        if(rank[root_a]>rank[root_b]){ //rankの高い方の根に低い方の根をつける
            par[root_b] = root_a;
        }else if(rank[root_a]<rank[root_b]){
            par[root_a] = root_b;
        }else{ //rankが同じ時、適当な方につけ、つけられた方のrankを1増やす
            rank[root_a]++;
            par[root_b] = root_a;
        }
    }
    bool same(int a,int b){return find(a)==find(b);}
};

struct command{
  int typ;
  int x;
  int y;
};

int main(){
  int n,q;
  cin >> n >> q;
  vector<command> coms;
  union_find S(n);
  for (int i=0;i<q;i++){
    int aaaa, x, y;
    cin >> aaaa >> x >> y;
    coms.push_back(command{aaaa,x,y});
  }

  for(int i=0;i<q;i++){
    if (coms[i].typ){
      bool ssame =S.same(coms[i].x, coms[i].y);
      cout << ((ssame) ? 1:0) << endl;
    }else  S.unite(coms[i].x, coms[i].y);
  }


}


Measured memory_bytes: 4476
#include<bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
    int i,j,k,n;cin>>n;
    vector<vector<int>> num_table(10,vector<int>(10,0));
    //(i,j)成分には、最高桁の数がi　最低桁の数がj　の数の個数が入る


    int ans=0;
    for(i=1;i<=n;i++){
        if(i%10==0){continue;}

        int ins=i,head,tail;
        tail=ins%10;//最低桁
        while(ins>=10){
            ins/=10;
        }
        head=ins;//最高桁
        num_table[head][tail]++;
    }    

    for(i=1;i<=9;i++){
        for(j=1;j<=9;j++){
            ans+=(num_table[i][j]*num_table[j][i]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,x,y) for(int i=(x),i##END=(y);i<=i##END;++i)
#define DOR(i,x,y) for(int i=(x),i##END=(y);i>=i##END;--i)
template<typename T,typename _T>inline bool chk_min(T &x,const _T y){return y<x?x=y,1:0;}
template<typename T,typename _T>inline bool chk_max(T &x,const _T y){return x<y?x=y,1:0;}
typedef long long ll;

int main()
{
	int A,B,C;
	scanf("%d%d%d",&A,&B,&C);
	if(A<=C&&C<=B||A>=C&&C>=B)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,m = mi()

wa = [0] * n
ac  = [0] * n
for i in range(m):
    a = input().split()
    p,s = int(a[0]), a[1] 
    if s == 'AC':
       ac[p-1] = 1
    else: 
        if ac[p-1] == 0:
            wa[p-1] += 1

for i in range(n):
    if ac[i] == 0:
        wa[i] = 0
        
print(sum(ac), sum(wa))




Measured memory_bytes: 4596
from sys import stdin
import math

def is_prime(num):
  if num % 2 == 0 and num != 2:
    return False
  else:
    for i in range(2, math.floor(math.sqrt(num))+1):
      if num % i == 0:
        return False
  return True

x = int(stdin.readline().strip())
while(True):
  if is_prime(x):
    break
  x += 1
  
print(x)

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

int main() {
  int H, W;
  char input[256][256];
  int output[256][256];
  int x = 0;
  int a,b;
  int i,j;
  
  cin >> H >> W;
  
  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
  	  cin >> input[i][j];
    }
  }
  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
    x = 0;
      if (input[i][j] == '#') {
      	x = 99999;
      } else {
        if ((i-1) >= 0 && (j-1) >= 0) {
          if (input[i-1][j-1] == '#') {
            x++;
          }
        }
        if ((i-1) >= 0 ) {
          if (input[i-1][j] == '#') {
            x++;
          }    
        }
        if ((i-1) >= 0 && (j+1) <= W) {
          if (input[i-1][j+1] == '#') {
            x++;
          }
        }
        if ((j-1) >= 0) {
          if (input[i][j-1] == '#') {
            x++;
          }
        }
        if ((j+1) <= W) {
          if (input[i][j+1] == '#') {
            x++;
          }
        }
        if ((i+1) <= H && (j-1) >= 0) {
          if (input[i+1][j-1] == '#') {
            x++;
          }
        }
        if ((i+1) <= H) {
          if (input[i+1][j] == '#') {
            x++;
          }
        }
        if ((i+1) <= H && (j+1) <= W) {
          if (input[i+1][j+1] == '#') {
            x++;
          }
        }
      }
	  output[i][j] = x;
    }
  }
  
  for (a = 0; a < H; a++) {
    for (b = 0; b < W; b++) {
   	  if (output[a][b] == 99999) {
        cout << input[a][b];
      } else {
      	cout << output[a][b];
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>

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

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
const ll INF = LONG_LONG_MAX;
const int MAX_P = 55555+1;



int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    
    int H,W,N;
    cin >> H >> W >> N;
    map<Pii,int> area;
    repeat(i, N){
        int a,b;
        cin >> a >> b;
        repeat(k, 3){
            repeat(l, 3){
                int aa = a-k;
                int bb = b-l;
                if(aa <= 0 ||H < aa+2 ||bb <= 0 || W < bb+2)
                    continue;
                area[make_pair(aa, bb)]++;
            }
        }
    }
    ll sum[10];
    fill(sum,sum+10,0);
    sum[0]=(ll)(W-2)*(H-2);
    for(auto itr=area.begin();itr!=area.end();itr++){
        sum[itr->second]++;
        sum[0]--;
    }
    repeat(i, 10){
        cout << sum[i] << endl;
    }
    return 0;
}



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

int main() {
    int n;
    cin>>n;
    vector<double>v(n);
    
    for (int i=0; i<n; i++){
        cin>>v[i];
    }
    
    sort(v.begin(),v.end());
    double ans;
    ans=(v[0]+v[1])/2;
    
    for(int i=2;i<n;i++){
        ans=(ans+v[i])/2;
    }
    cout<<ans<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = 10 ** 9
for i in range(b-1, a):
    e = abs(c[i] - c[i-b+1])
    e += min(abs(c[i]), abs(c[i-b+1]))
    d = min(d, e)
print(d)


Measured memory_bytes: 14224