akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string& s, char c) { vector<string> v; stringstream ss(s); string x; while(getline(ss,x,c)) v.emplace_back(x); return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n,a,b;
  cin>>n>>a>>b;
  vector<int> x(n);
  rep(i,n) cin>>x[i];
  ll re=0;
  reps(i,1,n) re+=min<ll>(b,1ll*(x[i]-x[i-1])*a);
  cout<<re<<endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define rvc(i,S) for(int i=0;i<(int)S.size();++i)
#define fore(i,x) for(int i = head[x] ; i ; i = e[i].next)
#define mp make_pair
#define pb push_back
#define maxn 200005
#define ll long long 
#define fi first
#define se second
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
int fa[maxn];
int getfa(int x)
{if(fa[x]==x) return x;
 fa[x]=getfa(fa[x]);
 return fa[x];
}
struct Edge
{ int x,y,len;
};vector<Edge> g;
ll val[maxn];
int cut[maxn];
bool cmp(Edge A,Edge B)
{return A.len<B.len;}
int n,m;
int main()
{cin>>n>>m;rep(i,1,n) cin>>val[i];
 rep(i,1,n) fa[i]=i;
 rep(i,1,m)
  {int x,y,len; scanf("%d%d%d",&x,&y,&len);
   g.pb((Edge){x,y,len});
  }
  sort(g.begin(),g.end(),cmp);
  rep(i,0,m-1)
  {int x=g[i].x,y=g[i].y,len=g[i].len;
   x=getfa(x);y=getfa(y);
   if(x!=y) 
     {val[y]+=val[x];
      fa[x]=y;
      cut[y]+=cut[x];
	 }
   cut[y]++;
     if(val[y]>=len) cut[y]=0;
  }
  int ans=0;
  rep(i,1,n) if(getfa(i)==i) ans+=cut[i];
  cout<<ans<<endl;
return 0;	
}

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

int main(){
  int n;
  cin>>n;
  int i=1;
  while(1){
    int x=i;
      if(x%3==0){
	cout<<" "<<i;
      }
      else{
	while(1){
	  if(x%10==3){
	    cout<<" "<<i;
	    break;
	  }
	  x /= 10;
	  if(x==0) break;
	}
      }
    if(++i > n) break;
  }

  cout<<endl;
  return 0;
}


Measured memory_bytes: 3084
#include<stdio.h>
int main(void)
{
    int n,m,i,j,k,A[1001]={0},B[1001]={0},ans[1001]={0},ANS=0,aans;
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    for(i=0;i<m;i++){
        scanf("%d",&B[i]);
    }
    for(i=0;i<m;i++){
        for(j=0;j<n;j++){
            if(A[j]<=B[i]){
                ans[j]++;
                break;
            }
        }
    }
    for(i=0;i<1000;i++){
        if(ans[i]>ANS){
            ANS=ans[i];
            aans=i;
        }
    }
    printf("%d\n",aans+1);
    return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b+c==17 && a*b*c == 175)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;	
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  int n2 = 0;
  int n4 = 0;
  int a;
  for (int i=0; i<N; i++) {
    cin >> a;
    if (a%2 == 0) {
      if (a%4 == 0) {
        n4++;
        continue;
      }
      n2++;
    }
  }
  if (n2 == 0) {
    if (n4 * 2 + 1 >= N) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else {
    if (n4 * 2 + n2 >= N) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 256
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

a=gets.to_i
puts a+a**2+a**3

Measured memory_bytes: 14216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repe(i, n) for(int (i) = 0; i <= (n); (i)++)
#define repr(i, n) for(int (i) = (n); (i) > 0; --(i))
#define repre(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define elm1(pair) (pair).first
#define elm2(pair) (pair)).second
typedef long long ll;
typedef unsigned long long ull;
const ull MOD = 1000000007;
ull mpow(ull a, ull n);
ull inv_mod(ull a){return mpow(a, MOD-2);}

ull mpow(ull a, ull n)
{
    ull ans = 1;
    while(n>>=1){
        if(n & 1)(ans *= a)%= MOD;
        (a*=a)%=MOD;
    }
    return ans;
}

ull nCr(ull n, ull r)
{
    vector<ull> factorial(n+1);
    factorial[0]=1;
    rep(i, n)factorial[i+1] = factorial[i]*(i+1)%MOD;
    return factorial[n]*(inv_mod(factorial[n-r])%MOD*inv_mod(factorial[r])%MOD) % MOD;
}

int main()
{
    string s, t;
    cin >> s >> t;
    ///vector<vector<string>> dp(t.size()+1, vector<string>(s.size()+1));
    vector<vector<int>> dp(t.size()+1, vector<int>(s.size()+1, 0));
    vector<string> dps(max(t.size(), s.size()));
    int flag = 0;

    for(int i = 1; i <= t.size(); i++){
        for(int j = 1; j <= s.size(); j++){
            int up = dp[i-1][j], side = dp[i][j-1];
            if(s[j-1] == t[i-1]){
                dp[i][j] = dp[i-1][j-1] + 1;
            }
            if(up > side){
                if(up > dp[i][j])dp[i][j] = dp[i-1][j];
            }
            else{
                if(side > dp[i][j])dp[i][j] = dp[i][j-1];
            }
        }
    }
    string ans;
    /*for(int i = 0; i < s.size(); i++){
        if(dp[t.size()-1][i] != ans_num){
            ans.push_back(s[i]);ans_num++;
        }
    }*/

    int ans_num = dp[t.size()-1][s.size()-1];
    int x = s.size(), y = t.size();
    while(y > 0 && x > 0){
        if(dp[y][x] == dp[y-1][x])y--;
        else if(dp[y][x] == dp[y][x-1])x--;
        else{
            ans.push_back(t[y-1]);
            y--;x--;
        }
    }

    reverse(ans.begin(), ans.end());

    cout << ans << endl;

    return 0;
}


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

namespace ABC080A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, a, b, x;

            var word = Console.ReadLine().Split(' ');

            n = int.Parse(word[0]);
            a = int.Parse(word[1]);
            b = int.Parse(word[2]);

            if (n * a < b)
                x = n * a;
            else
                x = b;
            Console.WriteLine(x);
            Console.ReadKey();

        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;
ll h,w;
ll ok(ll y, ll x){
    if(0<=y && y<h && 0<=x && x<w){
        return 1;
    }
    return 0;
}

int main(void){
    // char ;
    scanf("%lld%lld",&h,&w);
    // ll [n];
    char s[h][w];
    rep(i,0,h){
        scanf("%s",s[i]);
    }
    ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
    ll mk;
    rep(i,0,h){
        rep(j,0,w){
            if(s[i][j]=='#'){
                mk=0;
                rep(k,0,4){
                    if( ok(i+dy[k],j+dx[k]) ){
                        // printf()
                        if(s[i+dy[k]][j+dx[k]] == '#' ){
                            mk=1;
                            break;
                        }
                    }
                }
                if(mk==0){
                    // printf("%lld %lld",i,j);
                    printf("No\n");
                    return 0;
                }
            }
        }
    }
    printf("Yes\n");
    return 0;
}


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

using namespace std;

int main() {

	long n,m;
	cin >> n >> m;

	vector<long> a(n + 1);

	long t1, t2;
	for (long i = 1; i <= m; i++) {
		cin >> t1 >> t2;
		a[t1]++;
		a[t2]++;
	}

	for (long i = 1; i <= n; i++) {
		cout << a[i] << endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int f[1010][5000];
int minn(int a,int b){return a<b?a:b;}
int main()
{
    int n,m;scanf("%d%d",&n,&m);
    int tot=1<<n;tot--;
    for (int j=0;j<=m;j++)
    for (int i=1;i<(1<<n) ; i++ )
        f[j][i]=1e9+7;
    //f[0][0]=0;
    for (int i=1;i<=m;i++)
    {
        int a,b;scanf("%d%d",&a,&b);
        int tmp=tot;
        for (int j=0;j<b;j++){
            int c;scanf("%d",&c);c--;
            tmp-= (1<<c);
        }
        //printf("%d\n",tmp);
        for (int j=0;j<(1<<n);j++)
        {
           // printf("%d ",f[i][j]);
            f[i][j]=minn(f[i-1][j],f[i-1][j&tmp]+a);
        }

    }
    //printf("%d %d %d\n",m,tot,f[m][tot]);
    if (f[m][tot]==1e9+7)printf("-1\n");
    else printf("%d",f[m][tot]);

}


Measured memory_bytes: 19712
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    int mm = m;
    for( int i=0; i<n; ++i ) {
        int in, out;
        cin >> in >> out;
        m += in - out;
        if ( m < 0 ) {
            mm = 0;
            break;
        }
        mm = max( m, mm );
    }
    cout << mm << endl;
}

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

using namespace std;

typedef long long ll;
const ll INFTY=1ll<<61;

int main()
{
	for(int n,m,l;cin>>n>>m>>l;){
		vector<int> ks(n),ss(m);
		for(int i=0;i<n;i++) cin>>ks[i];
		for(int i=0;i<m;i++) cin>>ss[i];
		
		for(int& k:ks) k--;
		sort(begin(ks),end(ks));
		
		vector<ll> sum(m+1);
		for(int i=0;i<m;i++) sum[i+1]=sum[i]+ss[i];
		
		vector<vector<ll>> dp(n,vector<ll>(n,INFTY));
		dp[0][0]=0;
		for(int i=1;i<n-1;i++)
			for(int j=0;j<i;j++){
				dp[i][j]=min(dp[i][j],dp[i-1][j]+(sum[ks[i]+1]-sum[ks[i-1]])/l);
				dp[i][i-1]=min(dp[i][i-1],dp[i-1][j]+(sum[ks[i]+1]-sum[ks[j]])/l);
			}
		ll res=INFTY;
		for(int i=0;i<n-1;i++)
			res=min(res,dp[n-2][i]+(sum[ks[n-1]+1]-sum[ks[n-2]])/l+(sum[ks[n-1]+1]-sum[ks[i]])/l);
		cout<<res<<endl;
	}
}

Measured memory_bytes: 33468
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>

using namespace std;

using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;

i64 dsum(i64 k)
{
	i64 res = 0;

	while (k > 0)
	{
		res += k % 10;
		k /= 10;
	}

	return res;
}

i64 f(i64 now)
{
	i64 ans = now;
	i64 d = 10;

	while (now > 0)
	{
		now /= 10;
		i64 cand = now * d + (d - 1);

		if (cand * dsum(ans) < ans * dsum(cand))
			ans = cand;

		d *= 10;
	}

	return ans;
}

int main()
{
	int k;
	scanf("%d", &k);

	i64 now = 1;

	for (int i = 0; i < k; i++)
	{
		printf("%lld\n", now);
		now = f(now + 1);
	}

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
ll n;
string A;
ll M[26];

int main() {
  INCANT;
  cin >> A;
  n = A.size();
  rep(i, n) M[A[i]-'a']++;
  
  ll SUM = n*(n-1)/2+1;
  rep(i, 26) SUM-=M[i]*(M[i]-1)/2;
  cout << SUM << "\n";
  return 0;
}

Measured memory_bytes: 720
N,M=map(int,input().split())
L=[]
for _ in range(N):
  L.append(list(map(int,input().split())))
L.sort()
ans=0
for l in L:
  if M>0:
    ans+=l[0]*min(M,l[1])
    M-=l[1]
  else:
    break
print(ans)

Measured memory_bytes: 27760
H, W = [int(_) for _ in input().split()]
S = [input() + "#" for i in range(H)] + ["#" * (W + 1)]

from itertools import accumulate

rxs = []

for row in S:
    si = -1
    xs = [0] * (W + 1)
    for i in range(W + 1):
        if row[i] == "#":
            xs[si + 1] += (i - si - 1)
            xs[i] -= (i - si - 1)
            si = i
    rxs.append(list(accumulate(xs)))

sxs = []


for row in zip(*S):
    si = -1
    xs = [0] * (H + 1)
    for i in range(H + 1):
        if row[i] == "#":
            xs[si + 1] += (i - si - 1)
            xs[i] -= (i - si - 1)
            si = i
    sxs.append(list(accumulate(xs)))

result = 0

for r1, r2 in zip(rxs, zip(*sxs)):
    r = max(c1 + c2 for c1, c2 in zip(r1, r2)) - 1
    result = max(result, r)

print(result)


Measured memory_bytes: 127492
def combination(n,r):
    n_=1
    r_=1
    for i in range(n,n-r,-1):
        n_*=i
    for i in range(1,r+1):
        r_*=i

    return n_//r_

def main():
    N=int(input())
    A=list(map(int,input().split()))

    ball_dic={}

    for a in A:
        if a in ball_dic.keys():
            ball_dic[a]+=1
        else:
            ball_dic[a]=1


    all_patern=0

    combination_dic={}

    for key in ball_dic.keys():
        if ball_dic[key]>=2:
            if (ball_dic[key] in combination_dic.keys()) is False:
                combination_dic[ball_dic[key]] = combination(ball_dic[key], 2)
            all_patern += combination_dic[ball_dic[key]]

    for a in A:
        if ball_dic[a]-1<2:
            if ball_dic[a] in combination_dic.keys():
                res=all_patern-combination_dic[ball_dic[a]]
            else:
                res=all_patern
        else:
            com=combination_dic[ball_dic[a]]
            res=all_patern-com+(com*(ball_dic[a]-2)//ball_dic[a])

        print(res)

if __name__=="__main__":
    main()

Measured memory_bytes: 106828
import java.util.*;

public class Main{
        public static void main(String[] args){
                try(Scanner sc = new Scanner(System.in)){
                        while(true){
                                long R0 = sc.nextLong(), W0 = sc.nextLong(), C = sc.nextLong(), R = sc.nextLong();
                                if(R0==0&&W0==0&&C==0&&R==0){
                                        break;
                                }
                                System.out.println(Math.max(0L,(W0*C-R0+R-1)/R));
                        }
                }
        }
}

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

#define rep(i, n) for (long i = 0; i < (long)(n); i++)
 
int main() {
  unsigned long long A, B, K;
  
  cin >> A >> B >> K;
  
  cout << (K>A ? 0 : A-K) << " " << (K>A ? ((K-A)<B ? B-(K-A) : 0) : B) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main() {
	string s; cin >> s;
	rep(i, 0, s.size() - 1) {
		if (s[i] == s[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			return 0;
		}
		else if (i != s.size() - 2 && s[i] == s[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
const double EPS = 1e-10;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

int N, K;
vector<ll>A(202020);
int check(int mid){
	ll cur = 0;
	for (int i = 0; i < N; i++) {
		cur += (A[i]/mid) + (A[i]%mid != 0) - 1;
	}
	return cur <= K;
}

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

	cin >> N >> K;
	for (int i = 0; i < N; i++)cin >> A[i];
	int ng = 0, ok = 2e9;
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		if (check(mid))ok = mid;
		else ng = mid;
	}
	puts(ok);


	return 0;
}

Measured memory_bytes: 4208
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll x;
	cin >> x;
	ll ans = (x / 500) * 1000;
	x %= 500;
	ans += (x / 5) * 5;
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
s = input()
s = '0' + s[::-1]
dp = [[0, 0] for _ in range(len(s) + 1)]
for i in range(len(s)):
    for j in range(2):
        if j == 0: #ぴったり
            dp[i + 1][j] = min(dp[i]) + int(s[i])
        else: #1枚多めに払う
            dp[i + 1][j] = min(dp[i][1] + 9 - int(s[i]), dp[i][0] + 11 - int(s[i]))

print(min(dp[-1]))

Measured memory_bytes: 138328
#include <iostream>
#include <vector>
#include <cmath>

int gcd(int x, int y) {
  return y == 0 ? x : gcd(y, x % y);
}

int main(int argc, char *argv[]) {
  int n, x;
  std::cin >> n >> x;
  std::vector<int> v_int;

  for (int i = 0; i < n; i++) {
    int tmp;
    std::cin >> tmp;
    v_int.push_back(abs(x - tmp));
  }

  int result = v_int[0];
  for (int i = 1; i < n; i++) {
    result = gcd(result, v_int[i]);
  }
  std::cout << result << "\n";
  return 0;
}


Measured memory_bytes: 892
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ff               first
#define ss               second
#define pb               push_back
#define all(x)           (x).begin(), (x).end()
#define mem0(x)          memset(x, 0, sizeof (x))
#define mem1(x)          memset(x, -1, sizeof (x))

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector <ii> vii;
typedef vector<vii> vvii;
typedef vector <ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> s;
    int ans = 0;
    s += "S";
    s += "S";
    s += "S";
    for (int i = 0; i < 3; ++i) {
        int aux = 0;
        if (s[i] == 'R'){
            aux = 1;
            if (s[i+1] == 'R') {
                aux++;
                if (s[i+2] == 'R') aux++;
            }
        }
        ans = max(ans, aux);
    }
    cout << ans << "\n";
}

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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll n, k; cin >> n >> k;
	vector<ll> hp;
	for (ll i = 0; i < n; ++i) {
		ll h; cin >> h; 
		hp.push_back(h);
	}
	sort(hp.begin(), hp.end());
	ll result = 0;
	if (n - k >= 0) {
		for (ll i = 0; i < n - k; ++i) {
			result += hp[i];
		}
	}
	cout << result;
}



Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    ll l,r; cin >> l >> r;
    ll res = INF;
    if (r-l >= 2019) res = 0;
    else {
        for (ll i = l;i <= r-1;i++){
            for (ll j = i+1;j <= r;j++){
                res = min(res,i*j%2019);
            }
        }
    }
    cout << res << endl;
}


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

int a[200100];

int main(){
	int n;
	cin >> n;
	int j = 0;
	for(int i = 1; i <= n; i++){
		scanf("%d",&a[i]);
		if(j+1 == a[i]) j++;
	}
	if(j == 0)
		printf("-1\n");
	else 
		printf("%d\n",n - j);	
	return 0;	
} 

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

void fun(long long n=10000){
     for(int x=1;x<=100;x++){
     for(int y=1;y<=100;y++){
     for(int z=1;z<=100;z++){
     m[(pow(x,2)+pow(y,2)+pow(z,2)+x*y + y*z + x*z)]++;

     }}}
}

int main(){
   fun();
  long long n;
  cin >>n;
 for(long long i=1;i<=n;i++)cout << m[i] << endl;




}


Measured memory_bytes: 5988
#include <bits/stdc++.h>
using namespace std;
#define N 4444
#define mod 998244353
int n,k,C[N][N],pw2[N];
int c(int n,int m){
    if (m>n||m<0)
        return 0;
    return C[n][m];
}
int calc(int m,int n){return c(n+m-1,m-1);}
int Get(int v,int n,int k){
    int ans=0;
    int lim=max(0,v/2-max(0,v-1-k));
    for (int i=0;i<=lim;i++)
        ans=(1LL*pw2[i]*C[lim][i]%mod*calc(k-lim*2+i,n-i)+ans)%mod;
    return ans;
}
int main(){
    pw2[0]=1;
    for (int i=1;i<N;i++)
        pw2[i]=pw2[i-1]*2%mod;
    for (int i=0;i<N;i++)
        C[i][0]=C[i][i]=1;
    for (int i=1;i<N;i++)
        for (int j=1;j<i;j++)
            C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
    scanf("%d%d",&k,&n);
    for (int i=2;i<=2*k;i++)
        if (i&1)
            printf("%d\n",Get(i,n,k));
        else
            printf("%d\n",(Get(i-1,n,k-1)+Get(i-1,n-1,k-1))%mod);
    return 0;
}

Measured memory_bytes: 75904
#include <stdio.h>
#include <stdlib.h>

#define LEN 100005

typedef struct {
  char name[100];
  int t;
} P;

P Q[LEN+1];
int head, tail, n;

int isEmpty() {
    return head == tail;    
}

int isFull() {
    return head == (tail + 1) % (LEN + 1);
}

void enqueue(P x) {
    if (isFull()) {
        printf("Queue is full");
        exit(0);
    }
    Q[tail] = x;
    if (tail + 1 > LEN) {
        tail = 0;
    } else {
        tail++;
    }
}

P dequeue() {
    int prehead = head;
    if (isEmpty()) {
        printf("Queue is empty");
        exit(0);
    }
    if (head + 1 > LEN) {
        head = 0;
    } else {
        head++;
    }
    return Q[prehead];
}

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  head = 1;
  tail = (n + 1) % (LEN + 1);

  while (!isEmpty()) {
      u = dequeue();
      if (u.t <= q) {
          elaps += u.t;
          printf("%s %d\n", u.name, elaps);
      } else {
          u.t -= q;
          elaps += q;
          enqueue(u);
      }
  }
  
  return 0;
}



Measured memory_bytes: 11996
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
int a[100]; 
int main() {
	int k, t;
	cin >> k >> t;
	int all = 0;
	rep(i,t) {
		cin >> a[i];
		all += a[i];
	}
	sort(a,a+t);
	
	int ans = k;
	int l = 0, r = all;
	rep(i,t) {
		l += a[i];
		r -= a[i];
		ans = min(ans, abs(l-r));
	}
	
	if (ans == 0) cout << 0 << endl;
	else cout << ans-1 << endl;

	return 0;
}

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

int main() {
    int N;
    cin>>N;
    vector<vector<int>> G(N);
    int cnt = 0;
    REP(i, 1, N+1) REP(j, i, N+1){
        if(i == j) continue;
        if(i+j != N + (N+1)%2){
            G[i-1].emplace_back(j);
            cnt++;
        }
    }
    cout << cnt << endl;
    REP(i, 0, N) {
        REP(j, 0, G[i].size()){
            cout << i+1 << " " << G[i][j] << endl;
        }
    }
}

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

 
int main() {
	int  n;
	cin >> n;
	vector<int> h(n);
	for(int i=0; i<n; i++){
		cin >> h.at(i);
	}
	int ans = 0;
	int left = 0;
	int right = 0;
	for(int i=0; i<n-1; i++){
		left = i;
		while(right <n-1 && h.at(right+1) <= h.at(right)){
			right++;
		}
		ans = max(ans, right-left);
		if(right == left){
			right++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define MOD 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 100005
#define M 1e6+9
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
#define int long long
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};  
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
ll lcm(ll a, ll b) { return (a*b)/ gcd(a,b);}

// ll n,k,a,b,c,d,x,y,z,m,l;
// ll ans;
// vecl arr(N);
// ll dp[509][509];
// ll pre[N];




void test_case() {
	
    int n,k;
    cin>>n>>k;

    vec arr(n);
    rep(i,n) {
        cin>>arr[i];
    }

    sort(all(arr),greater<int>());

    int ans = 0;

    for(int i=k; i<n; i++) {
        ans+= arr[i];
    }

    cout<<ans<<endl;



}


signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


    int t = 1;
    // cin >> t;
    while(t--)
    {   
        test_case();
    }
}

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

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	string t, p;
	cin >> t >> p;

	for (int i = 0; i < t.size(); i++) {
		if (t.substr(i, p.size()) == p) {
			cout << i << endl;
		}
	}
	return 0;
}

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

int main(void){
    int n;
    string s;
    cin>>n>>s;
    vector<int> W(n+1),R(n+1);
    W[0]=0,R[0]=0;
    rep(i,n){
        W[i+1]=W[i];
        R[i+1]=R[i];
        if(s[i]=='W') W[i+1]++;
        else R[i+1]++;
    }
    int w=W[n],r=R[n];
    //最終状態がR...RW...Wのみなのでこの時のRの個数で全探索
    int ans=200000;
    for(int i=0;i<=n;++i){
        int nw=W[i];//Rがあるべき場所のWの数
        int nr=r-R[i];//Wがあるべき場所のRの数
        //nw,nrのうち小さい分だけ入れ替え、余りの色を変えるから
        //合計の操作は大きいほうの個数
        //cout<<nw<<" "<<nr<<endl;
        ans=min(ans,max(nw,nr));
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
	string s;
	cin >> s;
	char l = s[s.length() - 1];

	if( l == '2' || l =='4' || l == '5'|| l == '7'|| l == '9' ){
		cout << "hon" << endl;
	}
	else if(l == '0'  || l == '1'  || l == '6'  || l == '8'){
		cout << "pon" << endl;

	}else if(l == '3'){
		cout << "bon" << endl;
	}
	return 0;
}

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

const int N = 2e5+7;
int dp[N];

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

    int n;
    cin>>n;

    vector<int> vv;
    vector<pair<int, int>> ranges;

    for (int i=1; i<=n; i++) {
        int x, d;
        cin>>x>>d;
        int l = x-d, r = x+d;
        vv.push_back(l);
        vv.push_back(r);
        ranges.emplace_back(l, r);
    }

    sort(vv.begin(), vv.end());
    vv.erase(unique(vv.begin(), vv.end()), vv.end());
    sort(ranges.begin(), ranges.end());

    int ans = 0, done = 0;
    for (auto pr: ranges) {
        int l = upper_bound(vv.begin(), vv.end(), pr.first) - vv.begin();
        int r = upper_bound(vv.begin(), vv.end(), pr.second) - vv.begin();
        while (done < l)    dp[done+1] = max(dp[done+1], dp[done]), done++;
        dp[r] = max(dp[r], dp[l]+1);
        ans = max(ans, dp[r]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2796
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<cstdint>
#include<chrono>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

using namespace std;


class segtree_min_pointupdate {
private:
	typedef int T;
public:
	segtree_min_pointupdate(const int N) {
		SIZE = roundup_pow2(N);
		v.clear();
		v.resize(SIZE * 2, (1LL << 61));
	}

	//v[index]=numberとする。
	void update(const int index, const T number) {
		v[index + SIZE] = number;
		for (int i = (index + SIZE) / 2; i; i = i / 2)v[i] = min(v[i * 2], v[i * 2 + 1]);
	}

	//[index]の値を返す。
	T getnum(const int index) {
		return v[index + SIZE];
	}

	//[L,R)の最小値を返す。
	T getmin(const int L, const int R) {
		return getmin_inner(L, R, 1, 0, SIZE);
	}
private:
	T getmin_inner(const int queryL, const int queryR, const int index, const int segL, const int segR) {
		if (queryR <= segL || segR <= queryL)return (1LL << 61);
		if (queryL <= segL && segR <= queryR)return v[index];
		return min(getmin_inner(queryL, queryR, index * 2, segL, (segL + segR) / 2),
			getmin_inner(queryL, queryR, index * 2 + 1, (segL + segR) / 2, segR));
	}

	//x以上であるような2のべき乗数のうち最小のものを返す。
	int roundup_pow2(int x) {
		x--;
		rep(i, 6)x |= x >> (1LL << i);
		return x + 1;
	}

	int SIZE;
	vector<T>v;
};


signed main() {

	int N, M;
	cin >> N >> M;
	string S;
	cin >> S;

	//seg[i]:=(マスiからゴールまでの最短手数)*(N+1)+i
	segtree_min_pointupdate seg(N + M + 1);

	//dp[i]:=マスiからゴールまでの最短手数と、そのために次に踏むべき最も小さいマス
	vector<pair<int,int>>dp(N + 1, make_pair(0,0));

	seg.update(N, N);

	for (int i = N - 1; i >= 0; --i) {
		if (S[i] == '1') {
			dp[i] = make_pair(-1, -1);
			continue;
		}

		int res = seg.getmin(i + 1, i + M + 1);


		int tekazu = (res / (N + 1)) + 1;
		int next = res % (N + 1);

		if (tekazu > N) {
			dp[i] = make_pair(-1, -1);
			continue;
		}


		dp[i] = make_pair(tekazu, next);
		seg.update(i, tekazu * (N + 1) + i);
	}

	if (dp[0].first == -1) {
		cout << -1 << endl;
		return 0;
	}

	for (int ans = 0; ans < N;) {
		if (ans)cout << " ";
		cout << dp[ans].second - ans;
		ans = dp[ans].second;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 6144
s = input()
t = input()


S = list(s)
T = list(t)

S.reverse()
T.reverse()


flag = False

if len(S) < len(T):
    print ("UNRESTORABLE")

else:
    
    for i in range(len(S)-len(T)+1):

        for j in range(len(T)):

            fl2 = True

            if S[i+j] != T[j] and S[i+j] != "?":
                fl2 = False
                break

        if fl2:

            for j in range(len(T)):
                
                flag = True
                S[i+j] = T[j]

            break


    if flag:

        ans = ""

        for i in S:

            if i == "?":
                ans = "a" + ans
            else:
                ans = i + ans


        print (ans)
        
    else:

        print ("UNRESTORABLE")


Measured memory_bytes: 38384
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>
#include <tuple>
#include<map>

using namespace std;
int main() {
	string s;
	cin >> s;

	if (s.at(0) == 'R' && s.at(1) == 'R' && s.at(2) == 'R') {
		cout << 3 << endl;
	}
	else if (s.at(0) == 'R' && s.at(1) == 'R') {
		cout << 2 << endl;
	}
	else if (s.at(1) == 'R' && s.at(2) == 'R') {
		cout << 2 << endl;
	}
	else if (s.at(0) == 'R' || s.at(1) == 'R' || s.at(2) == 'R') {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()

int main(){
    int n;cin>>n;
    map<int,int> have;
    REP(i,n){
        int temp;cin>>temp;
        have[temp]++;
    }
    int m;cin>>m;
    bool res=true;
    REP(i,m){
        int temp;cin>>temp;
        if(have.count(temp)==0 or have[temp]==0){
            res=false;
            cout<<"NO"<<endl;
            break;
        }else{
            have[temp]--;
        }
    }
    if(res==true){
        cout<<"YES"<<endl;
    }
    return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>

using namespace std;

int h[1024*1500];
int w[1024*1500];

int main(){
  int n,m;
  while(scanf("%d%d",&n,&m), n+m){
    int hh[n];
    int ww[m];
    memset(h, 0, sizeof(h));
    memset(w, 0, sizeof(w));

    for(int i=0; i<n; i++)
      scanf("%d",&hh[i]);
    for(int i=0; i<m; i++)
      scanf("%d",&ww[i]);

    for(int i=0; i<n; i++){
      int sum = 0;
      for(int j=i; j<n; j++){
	sum += hh[j];
	h[sum]++;
      }
    }
    for(int i=0; i<m; i++){
      int sum = 0;
      for(int j=i; j<m; j++){
	sum += ww[j];
	w[sum]++;
      }
    }
    long long ans = 0;
    for(int i=0; i<1500*1024; i++)
      ans += (long long)w[i] * h[i];

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

Measured memory_bytes: 12000
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>

int main() 
{
	int N;
	std::cin >> N;
	int A;
	std::map<int,int> m;
	for (int i = 0; i < N; ++i) {
		std::cin >> A;
		auto it = m.find(A);
		if (it != m.end()) { // 見つかった
			m.at(A)++;
		} else {
			m.insert({A, 1});
		}
	}

	int k = 0;

	for (auto it = m.begin(); it != m.end(); ++it) {
		int f = it->first;
		int s = it->second;

		if ((s - f) > 0) {
			k += s - f;
		}
		else if ((s - f) < 0) {
			k += s;
		}
	}
	std::cout << k << std::endl;

	return 0;
}


Measured memory_bytes: 7936
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) { cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=a; i<(int)b; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int maxN = 2e5+2;


void solve()
{   
    int d, t, s;
    cin >> d >> t >> s;

    puts((d + s - 1) / s > t ? "No" : "Yes");
} 

int main()
{
    int t = 1;
    // scn(t);
    
    while(t --) {
        solve();
    }
    return 0;
}

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

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

    if(a>=0){
        if(c>=0){
            ans=b*d;
        }else if(d<0){
            ans=a*d;
        }else{
            ans=b*d;
        }
    }else if(b<0){
        if(c>=0){
            ans=b*c;
        }else if(d<0){
            ans=a*c;
        }else{
            ans=a*c;
        }
    }else{
        if(c>=0){
            ans=b*d;
        }else if(d<0){
            ans=a*c;
        }else{
            long long p=a*c,m=b*d;
            if(p>=m){
                ans=p;
            }else{
                ans=m;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

Measured memory_bytes: 2940
#include <iostream>
#include <set>

int main(int argc, char *argv[]) {
  int q;
  std::cin >> q;
  std::set<long> s;
  for (int i = 0; i < q; ++i) {
    int c, x;
    std::cin >> c >> x;
    switch (c) {
    case 0:
      s.insert(x);
      std::cout << s.size() << std::endl;
      break;
    case 1:
      std::cout << s.count(x) << std::endl;
      break;
    case 2:
      s.erase(x);
      break;
    case 3:
      int r;
      std::cin >> r;
      for (auto i = s.lower_bound(x); i != s.upper_bound(r); i++) {
        std::cout << *i << std::endl;
      }
      break;
    }
  }
}



Measured memory_bytes: 12468
#include<iostream>
#include <climits>
#include<vector>
#include<list>
#include<numeric>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

int n;

void countingSort(vector<int> A, vector<int> &B, int k) {
	vector<int> C(k, 0);
	REP(i, n) C[A[i]]++;
	FOR(i, 1, k) {
		C[i] += C[i - 1];
	}
	for (int j = n - 1;j >= 0;j--) {
		B[C[A[j]] - 1] = A[j];
		C[A[j]]--;
	}
}

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

	cin >> n;
	vector<int> A(n), B(n);
	REP(i, n) cin >> A[i];
	countingSort(A, B, 10001);
	REP(i, n) {
		if (i < n - 1) cout << B[i] << " ";
		else cout << B[i] << "\n";
	}

	return 0;
}


Measured memory_bytes: 26528
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n;
long long a,b,c,d;
bool flag=false;
int main(){
	cin>>n>>a>>b>>c>>d;
	for(int i=0;i<=n-1;i++)
	{
		long long l=(n-1-i)*c-d*i;
		long long r=(n-1-i)*d-c*i;
		if(l<=b-a&&b-a<=r)  
		{
			flag=true;
			break;
		}
	}
	if(flag==true)  cout<<"YES"<<endl;
	else cout<<"NO"<<endl; 
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
using namespace std;
int main( void )
{
	double height, max_height = INT_MIN, min_height = INT_MAX;
	while ( cin >> height )
	{
		max_height = height > max_height ? height : max_height;
		min_height = height < min_height ? height : min_height;
	}
	cout << max_height - min_height << endl;
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int n = s.length();
    int m = t.length();
    int cnt,res=INT_MAX;
    for(int i=0;i<n-m+1;i++){
        cnt = 0;
        string te = s.substr(i,m);
        for(int j=0;j<m;j++){
            if(te[j] != t[j])
                cnt++;
        }
        res = min(res,cnt);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<queue>
#define LL long long
using namespace std;
inline int read( )
{
  int sum=0;char c=getchar( );bool f=0;
  while(c<'0'||c>'9') {if(c=='-') f=1;c=getchar( );}
  while(c>='0'&&c<='9') {sum=sum*10+c-'0';c=getchar( );}
  if(f) return -sum;
  return sum;
}
const int I1=3e8,I2=6e8,I3=9e8;
const int N=200005;
int R,C,n,m,st[N];
inline int ch(int x,int y)
{
  if(!x) return 1+y;
  if(y==C) return I1+x;
  if(x==R) return I2-y;
  if(!y) return I3-x;
  return 0;
}
struct ex{int p,v;}d[N];
inline bool operator < (const ex &a,const ex &b) {return a.p<b.p;}
int main( )
{
  int i,x1,y1,x2,y2,A,B;
  R=read( );C=read( );n=read( );
  for(i=1;i<=n;i++)
    {
      x1=read( );y1=read( );x2=read( );y2=read( );
      if((A=ch(x1,y1))&&(B=ch(x2,y2))) d[++m]=(ex){A,i},d[++m]=(ex){B,i};
    }
  sort(d+1,d+m+1);
  int top=0;
  for(i=1;i<=m;i++)
    {
      if(!top||st[top]!=d[i].v) st[++top]=d[i].v;
      else top--;
    }
  puts(top?"NO":"YES");
  return 0;
}


Measured memory_bytes: 2176
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();

		if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
			System.out.println("Possible");
		} else {
			System.out.println("Impossible");
		}
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;
		private StringBuilder buffer = new StringBuilder();

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

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

		public long nextLong() throws IOException {
			long num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			int read = skip();
			do {
				buffer.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			String text = buffer.toString();
			buffer.delete(0, buffer.length());

			return text;
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    ll m;
    int v, p;
    cin >> n >> m >> v >> p;
    vector<ll> a(n), sum(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < n; ++i) {
        sum[i + 1] = sum[i] + a[i];
        // cerr << a[i] << " ";
    }
    // cerr << endl;

    int ans = 0;
    for (int i = n - 1; i >= 0; --i) {
        int hoge = upper_bound(a.begin(), a.end(), a[i] + m) - a.begin();
        if (n - hoge >= p) break;

        int rest = max(v - 1 - (n - hoge) - i - max((p - 1) - (n - hoge), 0), 0);
        if (rest == 0) {
            ++ans;
            continue;
        }
        hoge -= max((p - 1) - (n - hoge), 0);

        // cerr << i << " " << rest << " " << (hoge - i - 1) * (a[i] + m) << " " << (sum[hoge] - sum[i + 1]) << endl;
        if ((hoge - i - 1) * (a[i] + m) - (sum[hoge] - sum[i + 1]) < rest * m) continue;
        ++ans;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1792