akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

/////////////////////////////////////////////////////
#define MOD (ll)(1e9+7)


ll H,W,K;
ll i,j,k;
ll ans,sum;
ll moddiv(ll a,ll b){
    for(ll m=MOD-2;m>0;m/=2){
        if(m&1){
            a=a*b%MOD;
        }
        b=b*b%MOD;
    }
    return a;
}
int main(){
    scanf("%lld%lld%lld",&H,&W,&K);
    ans+=K;
    ll a=0;
    fornum(i,0,K){
        a=(a+i+1)%MOD;
    }
    ans=(ans+(moddiv(a,H+W)*(H+W)%MOD))%MOD;
    ll b=0;
    fornum(i,0,K){
        b=(b+(K-i)*i)%MOD;
    }
    b=(b*2)%MOD;
    ans=(ans+(moddiv(moddiv(b,H+W),H+W-1)*H%MOD*W%MOD))%MOD;
    sum=1;
    fornum(i,H+W-K+1,H+W+1){
        sum=(sum*i)%MOD;
    }
    printf("%lld",(ans*sum)%MOD);
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n; cin >> n;
	vll v(n), c(n);
	rep(i, n) cin >> v[i];
	rep(i, n) cin >> c[i];
	vll vc(n);
	rep(i, n) vc[i] = v[i]-c[i];

	sort(rall(vc));

	ll ans=0;
	for(int i=0; vc[i]>0; i++){
		ans += vc[i];
	}

	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
/*
 
 Author: @ygyash

*/

#include <bits/stdc++.h>
#define ll long long
#define ld long double

using namespace std;

ll minll(ll a, ll b)
{
    return a < b ? a : b;
}
ll maxll(ll a, ll b)
{
    return a > b ? a : b;
}


int main() {
   
    #ifndef ONLINE_JUDGE    
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif    

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

    sort(a.begin(),a.end());
    ll ans = 0;
    for(int i=0;i<n;i++){
        for(int j = i+1;j<n;j++){
            if(a[j]==a[i]){
                continue;
            }
            for(int k = j+1;k<n;k++){
                if(a[k]==a[j]||a[k]==a[i]){
                    continue;
                }

                if((a[i]+a[j]>a[k])){
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>

typedef long long int ll;


template<typename T>
T factorial(T n) {
    assert(n > 0);
    if (n == 1 or n == 0) {
        return 1;
    } else {
        return factorial(n - 1) * n;
    }
}

template<typename T>
T factorial(T n, T minN) {
    assert(n > 0);
    assert(minN > 0);
    if (n == minN) {
        return n;
    } else {
        return factorial(n - 1, minN) * n;
    }
}

template<typename T>
T combination(T n, T r) {
    assert(n>0);
    assert(r>0);
    return factorial(n, n - r + 1) / factorial(r);
}

template<typename T>
std::vector<std::pair<T, ll>> countSortedArr(T *arr, const ll n) {
    typedef std::pair<T, ll> countPair;
    std::vector<countPair> result;

    T cVal = arr[0];
    ll cCal = 1;
    for (ll i = 1; i < n; ++i) {
        if (arr[i] == cVal) {
            cCal++;
        }

        if (arr[i] != cVal or i == n-1) {
            countPair pair = std::make_pair(cVal, cCal);
            result.push_back(pair);
            cVal = arr[i];
            cCal = 1;
        }
    }

    return result;
}

int main() {
    int N;
    ll *M;

    std::cin >> N;

    M = new ll[N + 1];
    M[0] = 0;

    for (int i = 0; i < N; ++i) {
        int a;
        std::cin >> a;
        M[i + 1] = M[i] + a;
    }

    std::sort(M, M + (N + 1));

    std::vector<std::pair<ll, ll>> countArr = countSortedArr(M, N+1);

    ll count = 0;
    for (const std::pair<ll, ll> &pair : countArr) {
        if (pair.second > 1) {
            count += combination(pair.second, (ll) 2);
        }
    }
    std::cout << count << std::endl;

    delete[](M);

    return 0;
}

Measured memory_bytes: 7536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string s;
	cin>>s;
	ll n = s.length();
	bool flg = true;
	for(ll i=0;i<n/2;i++)
	{
		if (s[i]!=s[n-i-1])
			flg= false;
	}
	n = n/2;
	for(ll i=0;i<n/2;i++)
	{
		if (s[i]!=s[n-i-1])
			flg = false;
	}
	if (flg)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std; 

int main()
{
    int n; string s;
    set<string> pass;
    cin >> n >> s;
    int ans = 0;
    for(int i=0; i<1000; i++)
    {
        int v[3] = { i/100, (i/10) % 10, i % 10 };
        int f = 0;
        for(int j=0; j<n; j++)
        {
            if (s[j] == ('0' + v[f])) f++;
            if(f==3) break;
        }
        if(f==3) ans++;
    }

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


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

namespace ABC121cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var nmc = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var b = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int result = 0;
            for(int i = 0; i < nmc[0]; i++)
            {
                var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                int sum = nmc[2];
                for(int j = 0; j < nmc[1]; j++)
                {
                    sum += a[j] * b[j];
                }
                if (sum > 0) result++;
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13268
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n = gets.to_s.to_i
    @a = gets.split.map(&:to_i)
  end

  def solve
    ans = 0
    0.upto(n-3) do |i|
      (i+1).upto(n-2) do |j|
        (j+1).upto(n-1) do |k|
          ans += 1 if query(i,j,k)
        end
      end
    end
    ans
  end

  def query(i,j,k)
    a[i] < a[j] + a[k] &&
    a[j] < a[i] + a[k] &&
    a[k] < a[j] + a[i] &&
    a[i] != a[j] &&
    a[i] != a[k] &&
    a[k] != a[j]
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end

Measured memory_bytes: 14344
A, B = map(int, input().split())
S = input()
if len(S) == A + B + 1 and S[A] == '-':
    for i in range(len(S)) :
        if  i == A :
            continue
        if "0" > S[i] or "9" < S[i] :
            print("No")
            exit()
    print("Yes")
else :
    print("No")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B){
  cout<<C<<endl;
  }
  if(A==C){
  cout<<B<<endl;
  
  }
  if(B==C){
  cout<<A<<endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <queue>
#include <utility>
using std::queue;
using std::pair;
using std::make_pair;

const int N = 100 + 10;
const int M = 1000 + 10;

int cap[N][N], n, m, C;
int dis[N][M];
bool vis[N][M];
typedef pair<int, int> pir;
queue<pir> Q;

int solve()
{
	while(!Q.empty()) Q.pop();
	memset(dis, 0x3f, sizeof(dis));
	memset(vis, 0, sizeof(vis));
	vis[1][0] = 1; dis[1][0] = 0;
	Q.push(make_pair(1, 0));
	while(!Q.empty())
	{
		pir tmp = Q.front(); Q.pop();
		int i = tmp.first, k = tmp.second;
		vis[i][k] = 0;
		for(int j = 1; j <= n; j++) if(cap[i][j] != 0x3f3f3f3f)
		{
			if(dis[i][k] + cap[i][j] < dis[j][k])
			{
				dis[j][k] = dis[i][k] + cap[i][j];
				if(!vis[j][k])
				{
					Q.push(make_pair(j, k));
					vis[j][k] = 1;
				}
			}
			if(k < m && dis[i][k] + 0 < dis[j][k+1])
			{
				dis[j][k+1] = dis[i][k] + 0;
				if(!vis[j][k+1])
				{
					Q.push(make_pair(j, k+1));
					vis[j][k+1] = 1;
				}
			}
		}
	//	printf("%d : \n", i);
	//	for(int j = 1; j <= n; j++)
	//		printf("%d ", dis[j][0]); puts("");
	}
	for(int i = 0; i <= m; i++)
		if(dis[n][i] <= C) return i;
}

int main()
{
	while(scanf("%d%d%d", &n, &m, &C) == 3 && (n||m||C))
	{
		memset(cap, 0x3f, sizeof(cap));
		for(int i = 1; i <= m; i++)
		{
			int x, y, z;
			scanf("%d%d%d", &x, &y, &z);
			if(cap[x][y] > z) cap[x][y] = z;
		}
		printf("%d\n", solve());
	}
	return 0;
}

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

using namespace std;

int N;
int A, B;
int a[41], b[41], c[41];
int dp[50][410][410];

int main() {
  cin >> N >> A >> B;
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }

  fill(dp[0][0], dp[50][0], 1 << 30);
  dp[0][0][0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= 400; j++) {
      for (int k = 0; k <= 400; k++) {
        if (j < a[i] || k < b[i]) {
          dp[i + 1][j][k] = dp[i][j][k];
        } else {
          dp[i + 1][j][k] = min(dp[i][j][k], dp[i][j - a[i]][k - b[i]] + c[i]);
        }
      }
    }
  }

  int ans = 1 << 30;
  for (int i = 1; i * A <= 400 && i * B <= 400; i++) {
    ans = min(ans, dp[N][i * A][i * B]);
  }
  cout << (ans == 1 << 30 ? -1 : ans) << endl;

  return 0;
}

Measured memory_bytes: 33024
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
// #define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this


const ll MAXN = 1e5 + 5;
ll a[MAXN][3],dp[MAXN][3];
ll n,k;

ll rec(ll idx,ll prev){

    if(idx > n) return 0;

    ll &ans = dp[idx][prev];

    if(ans!=-1) return ans;

    ans = 0;

    FOR(j,0,2){
        if(j != prev){
            ans = max(ans,a[idx][j] + rec(idx+1,j));
        }
    }

    return ans;
}

void solve(){
    cin>>n;
    memset(dp,-1,sizeof(dp));

    FOR(i,1,n){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }

    ll ans = 0;
    FOR(j,0,2) ans = max(ans,rec(1,j));
    cout<<ans<<endl;
}

signed main(){


    FastRead;    

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

Measured memory_bytes: 12800
N, A, B, C, D = map(int, input().split())
S = input()

if S[A-1:max([C, D])].find('##') != -1:
    print('No')
    exit()

if C < D:
    print('Yes')
    exit()

if S[B-2:D+1].find('...') >= 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3572
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include "bits/stdc++.h"
using namespace std;
#define int int32_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l = 0, int r = numeric_limits<int>::max())
{return uniform_int_distribution<int> (l, r)(rng);}

template <typename T, typename G>
ostream& operator << (ostream& out, const pair<T, G> &a) 
{return out << "( " << a.x << ", " << a.y << ")";}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &a) 
{out << "[ "; for(const auto &i: a) out << i << ", "; return out << "]" << endl;}

template <typename T>
ostream& operator << (ostream& out, const set<T> &a) 
{out << "{ "; for(const auto &i: a) out << i << ", "; return out << "}" << endl;}

template <typename T, typename G>
ostream& operator << (ostream& out, const map<T, G> &a) 
{out << "< "; for(const auto &i: a) out << i << ", "; return out << ">" << endl;}

template<typename T, size_t N>
typename enable_if<!is_same<typename remove_cv<T>::type, char>::value,
ostream&>::type operator << (ostream& out, T (&a)[N])
{out << "[ "; for(const auto &i: a) out << i << ", "; return out << "]" << endl;}

void debug_out(){cerr << endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr << (H) << ' '; debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr << '#' << #__VA_ARGS__ << ":\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n, ans = 0;
	cin >> n;
	ans = n + n * n + n * n * n;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) x.begin(),x.end()

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main()
{
	int n;
	cin>>n;
	vector<ll> p(n),pos(n+1,0);
	rep(i,n){
		cin>>p[i];
		pos[p[i]] = i+1;
	}
	ll ans = 0;

	multiset<ll> s;
	s.insert(0);
	s.insert(0);
	s.insert(n+1);
	s.insert(n+1);
	for (ll now = n; now >= 1; now--){
		auto it = s.lower_bound(pos[now]);
		ll x_r = *it;

		it++;
		ll x_rr = *it;

		it--;
		it--;
		ll x_l = *it;

		it--;
		ll x_ll = *it;

		ans += now*(x_r-pos[now])*(x_l-x_ll);
		ans += now*(x_rr-x_r)*(pos[now]-x_l);

		s.insert(pos[now]);
	}
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<string>
#include <vector>
#include<math.h>
#include <algorithm>
using namespace std;

int main()
{
	int N,C=0;
	cin >> N;
	vector<int> d(N);

	for(int i=0;i<N;i++)
		cin >> d[i];

	for (int i = 0; i < N; i++)
		for (int j = i+1; j < N; j++)
			C += d[i] * d[j];

	cout << C;

	return 0;
}


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


int main()
{
    int n, d;
    cin >> n >> d;
    int tmp = n / (d * 2 + 1);
    int amari = n % (d * 2 + 1) == 0 ? 0 : 1;
    cout << tmp + amari << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a;i<n;i++)
#define ve vector
#define ss second 
#define ff first
#define pf pop_front
#define pob pop_back
#define psf push_front
#define res(x) cout<<x<<'\n'
#define read(t) ll t;cin>>t

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    read(n);
    string a[n];
    map<string,int>m;
    map<string,bool>mb;
    
    f(i,0,n){
        cin>>a[i];
        m[a[i]]++;
        mb[a[i]]=true;
    }
    sort(a,a+n);
    vector<int>v;
    int x=1;
    f(i,0,n-1){
        if(a[i]==a[i+1]){x++;
        }
        else{
            v.pb(x);
            x=1;
        }
    }
    v.pb(x);
    if(a[n-2]!=a[n-1]){
        v.pb(1);
    }
    int max=0;
    f(i,0,v.size()){
        if(v[i]>=max){
            max=v[i];
        }
    }

    f(i,0,n){
        if(m[a[i]]==max&&mb[a[i]]==true){
            
                cout<<a[i]<<endl;

            mb[a[i]]=false;
        }
    }

    
    
    


   

}

Measured memory_bytes: 40040
#include<iostream>
using namespace std;
int main()
{
  int a, b, c, x, count;
  cin >> a >> b >> c >> x;
  count = 0;
  for(int i = 0; i <= a; i++){
   for(int j = 0; j <= b; j++){
    for(int k = 0; k <= c; k++){
      if (500 * i + 100 * j + 50 * k == x){
       count++; 
      }
    }
   }
  }
  cout << count << endl;
  
  }


Measured memory_bytes: 256
import sys
from collections import defaultdict as dd
from collections import deque as dq
import heapq
hpush = heapq.heappush
hpop = heapq.heappop
input = sys.stdin.readline
N = int(input())
e = dd(list)
for _ in range(N - 1):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)

K = int(input())
ls = [-10 ** 10] * (N + 1)
rs = [10 ** 10] * (N + 1)

Q = dq([])
h = []
res = [-10 ** 10] * (N + 1)
for _ in range(K):
  x, v = map(int, input().split())
  ls[x] = v
  rs[x] = v
  hpush(h, (v, x))
  res[x] = v
  Q.append(x)

vis = [0] * (N + 1)
while len(Q):
  x = Q.popleft()
  if vis[x]: continue
  vis[x] = 1
  for y in e[x]:
    ls[y] = max(ls[y], ls[x] - 1)
    rs[y] = min(rs[y], rs[x] + 1)
    if ls[y] % 2 == ls[x] % 2:
      print("No")
      exit(0)
    if vis[y]: continue
    Q.append(y)

for x in range(1, N + 1):
  if ls[x] > rs[x]:
    print("No")
    exit(0)


while len(h):
  _, x = hpop(h)
  for y in e[x]:
    if res[y] != -10 ** 10: continue
    res[y] = res[x] + 1
    hpush(h, (res[y], y))
  #print(res, h)

print("Yes")
for r in res[1: ]: print(r)

Measured memory_bytes: 98652
#include<iostream>

using namespace std;

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

int main() {
  string str;
  cin >> str;
  rep (i, 13) {
    rep (j, i * 8 + 32) cout << "+";
    cout << ">";
  }
  int now = 13;
  rep (i, str.size()) {
    int n = str[i];
    int m = (n - 28) / 8;
    while (now != m) {
      if (now < m) {
	++now;
	cout << ">";
      } else {
	--now;
	cout << "<";
      }
    }
    int l = n - (m * 8 + 32);
    if (l < 0) {
      rep (i, -l) {
	cout << "-";
      }
      cout << ".";
      rep (i, -l) {
	cout << "+";
      }
    } else {
      rep (i, l) {
	cout << "+";
      }
      cout << ".";
      rep (i, l) {
	cout << "-";
      }
    }
  }
}

Measured memory_bytes: 1164
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    H, W = LI()
    g = []
    for _ in range(H):
        g.append(S())
    dp = [[inf for _ in range(W)] for __ in range(H)]

    if g[0][0] == '#':
        dp[0][0] = 1
    else:
        dp[0][0] = 0

    for r in range(H):
        for c in range(W):
            if r == 0 and c == 0:
                if g[r][c] == '#':
                    dp[r][c] = 1
                else:
                    dp[r][c] = 0
 
            cand1, cand2 = inf, inf
            if 0 <= r-1 < H:
                if g[r-1][c] == '.' and g[r][c] == '#':
                    dp[r][c] = min(dp[r][c], dp[r-1][c] + 1)
                else:
                    dp[r][c] = min(dp[r][c], dp[r-1][c])
            if 0<= c-1 < W:
                if g[r][c-1] == '.' and g[r][c] == '#':
                    dp[r][c] = min(dp[r][c], dp[r][c-1] + 1)
                else:
                    dp[r][c] = min(dp[r][c], dp[r][c-1])
    print(dp[-1][-1])
main()



Measured memory_bytes: 69868
H, N = map(int, input().split())
A_list = []
for i in range(1, N+1):
    A_list.append("A_" + str(i))

A_list = map(int, input().split())
A_total = sum(A_list)

if A_total >= H:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 24212
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    }
    println!("{}", s.replace(",", " "));
} 


Measured memory_bytes: 4352
fun main(args: Array<String>) = println(run {
    val n = readLine()!!.toInt()
    val (d,x) = readLine()!!.split(" ").map { it.toInt() }
    val a = (1..n).map { readLine()!!.toInt() }

    x + a.sumBy { (1..d step it).count() }
})


Measured memory_bytes: 37908
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int n; cin >> n;
    vector<int> a(n);
    int sum = 0;
    rep(i, n) cin >> a[i], sum += a[i];
    sort(a.begin(), a.end());
    int ans = sum;
    if(sum%10 == 0) {
        bool ok = false;
        rep(i, n) {
            if(a[i]%10 != 0) {
                ans -= a[i];
                ok = true;
                break;
            }
        }
        if(!ok) ans = 0;
    }
    cout << ans;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

var sc  = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		os.Exit(1)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	x:=0
	for i := 0; i<=1; i++ {
		x += nextInt()
	}
	if x >= 10 {
		fmt.Println("error")
	} else {
		fmt.Println(x)
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-12;
const int N=200000+10,maxn=200000+10,inf=0x3f3f3f3f;

struct point{
    point(int _x=0,int _y=0){x=_x,y=_y;}
    int x,y;
    bool operator <(const point& rhm)const{
        return x<rhm.x;
    }
}p[N];
priority_queue<point> Q;
int main()
{
    int n,h;
    scanf("%d%d",&n,&h);
    for(int i=0;i<n;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        Q.push(point(x,1));
        Q.push(point(y,2));
    }
    int ans=0;
    while(h>0)
    {
        point cur=Q.top();
        if(cur.y==2) Q.pop();
        else
        {
            ans+=h/cur.x;
            if(h%cur.x) ans++;
            break;
        }
        h-=cur.x;
        ans++;
    }
    printf("%d\n",ans);
    return 0;
}
/********************

********************/


Measured memory_bytes: 3956
class Dice(object):
    def __init__(self, listnum):
        self.a = listnum[0]
        self.b = listnum[1]
        self.c = listnum[2]
        self.d = listnum[3]
        self.e = listnum[4]
        self.f = listnum[5]

    def moveS(self):
        listnew =[]
        listnew.append(self.e)
        listnew.append(self.a)
        listnew.append(self.c)
        listnew.append(self.d)
        listnew.append(self.f)
        listnew.append(self.b)
        return Dice(listnew)

    def moveN(self):
        listnew =[]
        listnew.append(self.b)
        listnew.append(self.f)
        listnew.append(self.c)
        listnew.append(self.d)
        listnew.append(self.a)
        listnew.append(self.e)
        return Dice(listnew)

    def moveE(self):
        listnew =[]
        listnew.append(self.d)
        listnew.append(self.b)
        listnew.append(self.a)
        listnew.append(self.f)
        listnew.append(self.e)
        listnew.append(self.c)
        return Dice(listnew)

    def moveW(self):
        listnew =[]
        listnew.append(self.c)
        listnew.append(self.b)
        listnew.append(self.f)
        listnew.append(self.a)
        listnew.append(self.e)
        listnew.append(self.d)
        return Dice(listnew)


No1 = Dice(input().split())
listmove = list(input())
for i in range(len(listmove)):
    if listmove[i] == "S":
        No1 = No1.moveS()
    elif listmove[i] == "N":
        No1 = No1.moveN()
    elif listmove[i] == "E":
        No1 = No1.moveE()
    elif listmove[i] == "W":
        No1 = No1.moveW()

print(No1.a)


Measured memory_bytes: 5572
#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
#define mt make_tuple
using namespace std;
using ll=long long;
using P=pair<int,int>;
using G=vector<vector<int>>;
using tlll=tuple<ll,ll,ll>;
int main(){
    int n;
    cin >> n;
    vector<tlll> height,ground;
    ll ansx,ansy,ansh;
    rp(i,n){
        ll x,y,h;
        cin >> x >> y >> h;
        if(h!=0) height.push_back(mt(x,y,h));
        else ground.push_back(mt(x,y,h));
    }
    bool allok=false;
    rp(cx,101){
        rp(cy,101){
            ll nx=get<0>(height[0]);
            ll ny=get<1>(height[0]);
            ll nh=get<2>(height[0]);
            ll nowh=nh+abs(nx-cx)+abs(ny-cy);
            bool ok=true;
            for(int i=1;i<height.size();i++){
                nx=get<0>(height[i]);
                ny=get<1>(height[i]);
                nh=get<2>(height[i]);
                if(nh+abs(nx-cx)+abs(ny-cy)!=nowh){
                    ok=false;
                    break;
                }
            }
            if(!ok) continue;
            rp(i,ground.size()){
                nx=get<0>(ground[i]);
                ny=get<1>(ground[i]);
                nh=get<2>(ground[i]);
                if(nowh-abs(nx-cx)-abs(ny-cy)>0ll){
                    ok=false;
                    break;
                }
            }
            if(ok){
                ansx=cx; ansy=cy; ansh=nowh;
                allok=true;
                break;
            }
        }
        if(allok) break;
    }
    cout << ansx << " " << ansy << " " << ansh << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <string.h>
#include <cstdlib>
#include <iomanip>
#include <stdio.h>

using namespace std;

int main(){
  int sum=0;
  char c;

  while(1){
    scanf("%c",&c);
    if(c=='0'&&sum==0)
       return 0;
    if(isdigit(c)) {
      sum+=c-'0';
    }
    if(c=='\n') {
      printf("%d\n",sum);
      sum=0;
    }

  }

}


Measured memory_bytes: 3212
n = int(input())
cnt = [1] * 101
for i in range(2, n+1):
    for j in range(2, n+1):
        while i % j == 0:
            i /= j
            cnt[j] += 1

san = 0; go = 0; jugo = 0; nijugo = 0; shitigo = 0
for i in range(2, 101):
    if cnt[i] >= 3: san += 1
    if cnt[i] >= 5: go += 1
    if cnt[i] >= 15: jugo += 1
    if cnt[i] >= 25: nijugo += 1
    if cnt[i] >= 75: shitigo += 1

print(shitigo + nijugo*(san-1) + jugo*(go-1) + go*(go-1)//2*(san-2))

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, K;
    cin >> N >> K;

    vector<Pll> p;
    rep (i, N) {
        ll a, b;
        cin >> a >> b;
        p.push_back(make_pair(a, b));
    }

    sort(p.begin(), p.end());

    ll cnt = 0;
    rep (i, N) {
        if (cnt+p[i].second < K) {
            cnt += p[i].second;
        } else {
            cout << p[i].first << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 2420
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
    int counter = 0;

    int remain4b = x - a;

    while(remain4b > 0){
      remain4b = remain4b - b;
      counter++;
    }

    counter-- ;
    remain4b = x - a;
    int ans = remain4b - b * counter;
    if(ans == b){
      ans = 0;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 22228
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,m,d = inm()
if d==0:
    ret = (m-1)/n
else:
    ret = (m-1)*max(0,2.0*(n-d)/(n**2))
print(ret)


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

static const double PI = 3.141592;

int main(){
	int n;
	while ( cin >> n && n != -1 ){
		double x = 1.0, y = 0.0;
		for ( int i = 2; i <= n; ++i ){
			double rad = atan2( y, x ) + PI / 2;
			x += cos( rad );
			y += sin( rad );
		}

		cout << setprecision( 2 ) << setiosflags( ios::fixed );
		cout << x << endl << y << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define INF 100100100
 
int main(){
 
  int v, e; cin >> v >> e;
  int n = v;
  vector<vector<int> > dis(v, vector<int> (v, INF));
  for(int i = 0; i < e; i++){
    int a, b, c; cin >> a >> b >> c;
    dis[a][b] = c;
  }
 
  vector<vector<int> > dp((1 << n), vector<int> (n, INF));
  dp[0][0] = 0;
  for(int i = 0; i < (1 << n); i++){
    for(int j = 0; j < n; j++){
      for(int k = 0; k < v; k++){
        if((i & (1 << k)) != 0) continue;
 
        int cost = dp[i][j] + dis[j][k];
 
        chmin(dp[i | (1 << k)][k], cost);
      }
    }
  }  
 
  if(dp[(1 << v) - 1][0] == INF) cout << -1 << endl;
  else cout << dp[(1 << v) - 1][0] << endl;
 
  return 0;
}


Measured memory_bytes: 6208
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQUE(a)  (a).erase(unique((a).begin(),(a).end()),(a).end())
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int n,a[200000];

int main() {
	cin>>n;
	ll ans=(ll)1<<62;
	ll sum=0;
	REP(i,n){
		cin>>a[i];
		sum+=a[i];
	}
	ll s=0;
	FOR(i,0,n-1){
		s+=a[i];
		sum-=a[i];
		ans = min(ans, abs(s-sum));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll INM = 114514;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};

int main() {
	IOS();
	int k, x;
	cin >> k >> x;
	bool ok = false;
	for (int i = max(-1000000, x - k + 1); i <= min(1000000, x + k - 1); i++) {
		if (ok) cout << " ";
		cout << i;
		ok = true;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

long long sqr(long long n) {
    return static_cast<long long>(n)*n;
}

long long bipow(long long c, long long n) {
    if (n == 0) {
        return 1;
    } else if(n == 1) {
        return c;
    } else if(n%2 == 0) {
        return sqr(bipow(c, n/2));
    } else {
        return (static_cast<long long>(c)*sqr(bipow(c, (n-1)/2)));
    }
}

void solve(long long N, long long P){
  if (N >= 40) {
    std::cout << 1 << std::endl;
    return;
  }
  if (N == 1) {
    std::cout << P << std::endl;
    return;
  }
  long long ans = 1;
  long long x = 1;
  while (true) {
    long long y = bipow(x, N);

    if (P < y) {
      break;
    }

    if (P % y == 0) {
      ans = x;
    }
    x++;
  }
  std::cout << ans << std::endl;
  return;
}

int main(){
  long long N;
  long long P;
  scanf("%lld",&N);
  scanf("%lld",&P);
  solve(N, P);
  return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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



int main(){
    long long int N;
    cin >> N;
    long long int a[N];
    for(int i=0;i<N;++i){
        cin >> a[i];
    }
    long long int num=0;
    long long int num_2=0;
    for(int i=0;i<N;++i){
        if(a[i]%4==0){
            ++num;
        }
        if(a[i]%2==0){
            ++num_2;
        }
    }
    num_2=(num_2-num)/2;
    if(num+num_2>=N/2){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define F first
#define S second
#define pb push_back
mt19937 rnd;

const int N = 2e6 + 10;
vector<int> a, b, c, d;
int pref[N];
vector<int> pos;

void calc_prefix_array(vector<int> t) {
    int n = t.size();
    pref[0] = 0;
    int border = 0;
    for (int i=1; i<n; i++) {
        while (border > 0 && t[i] != t[border]) {
            border = pref[border - 1];
        }
        if (t[i] == t[border]) {
            border++;
        }
        else {
            border = 0;
        }
        pref[i] = border;
    }
}

void kmp(vector<int> pattern, vector<int> text) {
    vector<int> s;
    for (int i : pattern) s.pb(i);
    s.pb(-1000);
    for (int i : text) s.pb(i);
    calc_prefix_array(s);
    int k = pattern.size();
    for (int i=k+1; i<s.size(); i++) {
        if (pref[i] == k) pos.pb(i - 2 * k);
    }
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    int n;
    cin >> n;
    for (int i=1; i<=n; i++) {
        int cur;
        cin >> cur;
        a.pb(cur);
    }
    for (int i=1; i<=n; i++) {
        int cur;
        cin >> cur;
        b.pb(cur);
    }
    a.pb(a[0]), b.pb(b[0]);
    for (int i=0; i<n; i++) {
        c.pb(a[i] ^ a[i+1]);
        d.pb(b[i] ^ b[i+1]);
    }
    for (int i=0; i<n-1; i++) {
        c.pb(c[i]);
    }
    kmp(d, c);
    for (int i : pos) {
        int x = b[0] ^ a[i];
        cout << i << " " << x << "\n";
    }

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 16532
#include<iostream>
using namespace std;
int main()
{
    int n, s, ans = 0, a8 = 0;
    bool b[8] = {0};
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> s;
        int k = s / 400;
        if(k >= 8) a8 += 1;
        else b[k] = 1;
        
    }
    for(int i = 0; i < 8; i++){
        ans += b[i];
    }
    //minimum
    cout << (ans == 0 ? 1 : ans) << ' ' << flush;
    //MAXIMUM
    cout << ans + a8 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<map>
#include<queue>
#include<time.h>
#include<limits.h>
#include<cmath>
#include<ostream>
#include<iterator>
#include<set>
#include<stack>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep_1(i,m,n) for(int i=m;i<=n;i++)
#define mem(st) memset(st,0,sizeof st)
inline int read()
{
	int num=0, w=0;
	char ch=0;
	while (!isdigit(ch))
	{
		w|=ch=='-';
		ch = getchar();
	}
	while (isdigit(ch))
	{
		num = (num<<3) + (num<<1) + (ch^48);
		ch = getchar();
	}
	return w? -num: num;
}
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef pair<double,double> pdd;
const int inf = 0x3f3f3f3f;
const int N=2e6+10;
int a[N];
int b[N];
void solve()
{
	int n;
	cin>>n;
	int ans=n-1;
	for(int i=2;i<=n-1;i++)
	{
		ans+=n/i;
		if(n%i==0)
			ans--;
	}
	cout<<ans<<endl;
}
signed main()
{
	int t=1;
	while(t--)
		solve();
	return 0;
}



Measured memory_bytes: 3620
#include<iostream>
#include<vector>

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

int main(){
    int h,n; std::cin >> h >> n;
    std::vector<int> a(n), b(n);
    rep(i,n) std::cin >> a[i] >> b[i];

    std::vector<int> dp(h+1,INF); dp[0]=0;
    for(int i=1; i<=h; ++i){
        rep(j,n){
            int k=std::max(i-a[j],0);
            dp[i] = std::min(dp[i], dp[k]+b[j]);
        }
    }
    std::cout << dp[h] << std::endl;
    return 0;
}

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

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, m;
    cin >> n >> m;

    if(n >= m) {
        cout << 0 << endl;
        return 0;
    }

    vector<int> v(m), d(m);
    for(auto& x : v) cin >> x;

    sort(v.begin(), v.end());
    for(int i = 1; i < m; ++i) d[i] = v[i] - v[i - 1];

    sort(d.rbegin(), d.rend());
    int sum = 0;
    for(int i = 0; i < n - 1; ++i) sum += d[i];

    cout << v.back() - v.front() - sum << endl;
}

Measured memory_bytes: 1152
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<String> elements = Arrays.asList(sc.nextLine().split(" "));
		
		Main checker = new Main();
		String result = checker.checkEquilateralTriangle(elements);
		
		System.out.println(result);
		sc.close();
	}
	
	public String checkEquilateralTriangle(List<String> elements) {
		long count = elements.stream().distinct().count();
		return count == 1 ? "Yes" : "No";
	}

}

Measured memory_bytes: 27732
import bisect

N = int(input())
A = map(int, input().split())
B = map(int, input().split())
C = map(int, input().split())

A = list(A)
A.sort()
B = list(B)
B.sort()
C = list(C)
C.sort()

count = 0

for b in B:
    l = bisect.bisect_left(A, b)
    r = bisect.bisect_right(C, b)
    count += l * (N - r)

print(count)


Measured memory_bytes: 29708
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P2;
const int inf=1000000000;
priority_queue<P2> que;
int main() {
	ll dp[3][3][2]={};
	int n;
	string s,t;
	cin>>n;
	cin>>s>>t;
	if(s[0]==t[0]){
		dp[0][0][0]=1;
		dp[1][1][0]=1;
		dp[2][2][0]=1;
	}else{
		dp[0][1][0]=1;
		dp[0][2][0]=1;
		dp[1][0][0]=1;
		dp[1][2][0]=1;
		dp[2][0][0]=1;
		dp[2][1][0]=1;
	}
	for(int i=1;i<n;++i){
		for(int j=0;j<3;++j){
			for(int k=0;k<3;++k){
				dp[j][k][i%2]=0;
			}
		}
		if(s[i]==t[i]){
			if(s[i-1]==t[i-1]){
				for(int k=0;k<3;++k)dp[k][k][i%2]=(dp[(k+1)%3][(k+1)%3][(i-1)%2]+dp[(k+2)%3][(k+2)%3][(i-1)%2])%1000000007;
			}else{
				for(int k=0;k<3;++k)dp[k][k][i%2]=(dp[(k+1)%3][(k+2)%3][(i-1)%2]+dp[(k+2)%3][(k+1)%3][(i-1)%2])%1000000007;
			}
		}else if(s[i]==s[i-1]&&t[i]==t[i-1]){
			for(int k=0;k<3;++k){
				dp[k][(k+1)%3][i%2]=dp[k][(k+1)%3][(i-1)%2];
				dp[k][(k+2)%3][i%2]=dp[k][(k+2)%3][(i-1)%2];
			}
		}else if(s[i]==s[i-1]){
			for(int k=0;k<3;++k){
				dp[k][(k+1)%3][i%2]=dp[k][(k+2)%3][(i-1)%2];
				dp[k][(k+2)%3][i%2]=dp[k][(k+1)%3][(i-1)%2];
			}
		}else if(t[i]==t[i-1]){
			for(int k=0;k<3;++k){
				dp[(k+1)%3][k][i%2]=dp[(k+2)%3][k][(i-1)%2];
				dp[(k+2)%3][k][i%2]=dp[(k+1)%3][k][(i-1)%2];
			}
		}else if(s[i-1]==t[i-1]){
			for(int k=0;k<3;++k){
				dp[k][(k+1)%3][i%2]=dp[(k+2)%3][(k+2)%3][(i-1)%2];
				dp[k][(k+2)%3][i%2]=dp[(k+1)%3][(k+1)%3][(i-1)%2];
			}
		}else{
			for(int k=0;k<3;++k){
				dp[k][(k+1)%3][i%2]=dp[(k+1)%3][k][(i-1)%2]+dp[(k+1)%3][(k+2)%3][(i-1)%2]+dp[(k+2)%3][k][(i-1)%2];
				dp[k][(k+1)%3][i%2]%=1000000007;
				dp[k][(k+2)%3][i%2]=dp[(k+2)%3][k][(i-1)%2]+dp[(k+2)%3][(k+1)%3][(i-1)%2]+dp[(k+1)%3][k][(i-1)%2];
				dp[k][(k+2)%3][i%2]%=1000000007;
			}
		}
	}
	ll r=0;
	for(int i=0;i<3;++i){
		for(int j=0;j<3;++j){
			r+=dp[i][j][(n-1)%2];
		}
	}
	cout<<r%1000000007<<endl;
	return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int X[10],Y[10];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	vector<int> V;
	FOR(i,N) {
		V.push_back(i);
		cin>>X[i]>>Y[i];
	}
	double ret=0;
	int pat=0;
	do {
		FOR(i,N-1) {
			ret+=hypot(X[V[i]]-X[V[i+1]],Y[V[i]]-Y[V[i+1]]);
		}
		pat++;
		
	} while(next_permutation(ALL(V)));
	ret/=pat;
	_P("%.12lf\n",ret);
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int main(){
  string l;
  int n;
  double a,b,c,d,e,f,s,m,p;
  vector<pair<double,string> > vp;
  pair<double,string> pa;
  while(1){
    cin>>n;
    if(n==0)break;
    vp.clear();
    for(int i=0;i<n;i++){
    cin>>l>>p>>a>>b>>c>>d>>e>>f>>s>>m;
    pa.second=l;
    a=a+b+c+m*(d+e);
    f=f*s*m-p;
    pa.first=-1*(f/a);
    vp.push_back(pa);
    }
    sort(vp.begin() , vp.end());
    for(int i=0;i<n;i++){
      cout<<vp[i].second<<endl;
    }
    cout<<"#"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3124
n=[ int(input()) for i in range(5) ]

ind=0
ind_min=9
for i,num in enumerate(n):
    if num % 10 == 0 :
        continue
    if num % 10 < ind_min:
        ind_min = num%10
        ind=i

sum=0
for i,num in enumerate(n):
    if i == ind:
        sum+=num
    else:
        sum+=int((num+9)/10)*10

print(sum)

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

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

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



const int N = 1e5 + 1;
vector<int> adj[N];
vector<pair<int,int>> edges;
map<pair<int,int>, int> col;
int ans;

void dfs(int a, int par, int forbidden) {
        int cur_col = 1;
        for (auto b: adj[a]) {
                if (par == b) continue;
                if (cur_col == forbidden) cur_col++;
                dfs(b, a, cur_col);
                col[{a, b}] = cur_col;
                cur_col++;
        }

        ans = max(ans, cur_col - 1);
}

void _main() {
        int n; cin >>n;
        for (int i = 1; i <= n-1; i++) {
                int a, b; cin >> a >> b;
                adj[a].emplace_back(b);
                adj[b].emplace_back(a);
                edges.emplace_back(a, b);
        }

        dfs(1, 0, 0);
        cout << ans << '\n';
        for (auto e: edges) {
                if (!col.count(e)) swap(e.first, e.second);
                cout << col[e] << '\n';
        }
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 17856