akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.buffer.readline
import numpy as np

def main():
    N,A,B = map(int,input().split())
    INF = 10**10
    dp = np.full((N+1,10*N+2,10*N+2),INF)
    dp[0][0][0] = 0
    
    for i in range(N):
        a,b,c = map(int,input().split())
        dp[i+1][a:,b:] = np.minimum(dp[i][a:,b:],dp[i][:10*N+2-a,:10*N+2-b]+c)
        dp[i+1] = np.minimum(dp[i],dp[i+1])
    
    ans = INF
    x,y = A,B
    while x <= 10*N+1 and y <= 10*N+1:
        ans = min(ans,dp[N][x][y])
        x += A
        y += B
        
    print(int(ans) if ans != INF else -1)

if __name__ == "__main__":
    main()


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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;

const int MOD = (int)1e9 + 7;


template <typename Monoid>
class BIT {
private:
    vector<Monoid> _bit;
    int _n_max;
    function<Monoid(Monoid&, Monoid&)> _binary_operator;

public:
    BIT(int n, Monoid initial_val, function<Monoid(Monoid&, Monoid&)> binary_operator): 
        _n_max(n), _binary_operator(binary_operator) {
        _bit.resize(_n_max + 1, initial_val);
    }

    void add(int i, Monoid x) {  // 1-indexed
        for(int j = i; j <= _n_max; j += j & -j) 
            _bit.at(j) = _binary_operator(x, _bit.at(j));
    }

    Monoid sum(int i) {  // 1-indexed, sum of [1, i]
        Monoid res = 0;
        for(int j = i; j > 0; j -= j & -j) 
            res = _binary_operator(res, _bit.at(j));
        return res;
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    VI a(n);
    REP(i, n) cin >> a.at(i);
    vector<BIT<ll>> bit(n + 1, BIT<ll>(k + 1, 0, [](ll& lhs, ll& rhs) {
        return (lhs + rhs) % MOD;
    }));
    bit.at(0).add(0 + 1, 1);
    FOR(i, 1, n)FOR(j, 0, k) {
        ll sum = bit.at(i - 1).sum(j + 1) 
            - bit.at(i - 1).sum(max(j - a.at(i - 1), 0));
        bit.at(i).add(j + 1, (sum + MOD) % MOD);
    }

    cout << (bit.at(n).sum(k + 1) - bit.at(n).sum(k) + MOD) % MOD << ln;
    return 0;
}


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

const int MAX_N = 1555;
const int MAX_M = 1555;
const int MAX_W = 1111;
int h[MAX_N + 1];
int w[MAX_N + 1];
int N, M;

int main()
{
  while(cin >> N >> M, N){
    rep(i, N) cin >> h[i + 1];
    rep(i, M) cin >> w[i + 1];

    rep(i, N) h[i + 1] += h[i];
    rep(i, M) w[i + 1] += w[i];

    vi la(N * MAX_W), ra(M * MAX_W);
    rep(i, N + 1) rep(j, i) la[h[i] - h[j]] += 1;
    rep(i, M + 1) rep(j, i) ra[w[i] - w[j]] += 1;

    int res = 0;
    rep(i, min(N, M) * MAX_W) res += la[i] * ra[i];

    cout << res << endl;
  }

  return 0;
}

Measured memory_bytes: 14180
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF = 1e18;
#define put(n) cout<<(n)<<endl
#define rep(i,N) for(int(i)=0;(i)<(N);++(i))
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define pb(n) push_back(n) 

int main(){
    ll  N,W;
    cin >> N >> W;
    vector<ll> w(N),v(N);
    rep(i,N) cin >> w[i] >> v[i];

    ll dp[110][100100];
    rep(i,110)rep(j,100100) dp[i][j] = INF;
    dp[0][0] = 0;

    rep(i,N){
        for(int val=0;val<100100;++val){
            dp[i+1][val] = min(dp[i+1][val],dp[i][val]); 
            if(val - v[i] < 0) continue;
            dp[i+1][val] = min(dp[i+1][val],dp[i][val-v[i]]+w[i]); 
        }
    }

    int ans = 0;
    for(int val = 0; val < 100100; ++val){
        if(dp[N][val] <= W) ans = val;
    }

    cout << ans << endl;
}

Measured memory_bytes: 86272
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n, a, diff=0;
    vector<int> cards;
    cin >> n;
    while(cin >> a) {
        auto j = cards.begin();
        for(auto i=cards.begin(); i < cards.end() && *i > a; i++) j=i+1;
        cards.insert(j, a);
    }
    if(n%2==1) cards.push_back(0);
    for(int i=0; i<cards.size(); i+=2) diff += cards[i]-cards[i+1];
    cout << diff << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define mod 1000000007
#define pb push_back
typedef long long ll;
typedef long double ld;
#define FOR(i,n) for(i=0;i<n;i++)
#define FORE(i,n) for(i=0;i<=n;i++)
 
 
ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
}

ll maxl(ll a,ll b){
    if(a>b)return a;
    return b;
}

ll mulmod(ll a, ll b, ll mod){ 
    ll res = 0; 
    a = a % mod; 
    while (b > 0){ 
        if (b % 2 == 1){ 
            res = (res + a) % mod;
        }
        a = (a * 2) % mod; 
        b /= 2; 
    } 
    return res % mod; 
} 

 
int main()
{
	ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    int a[n+1];
    int b[n];
    for(int i=0;i<=n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        cin >> b[i];
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        ans+=min(a[i],b[i]);
        b[i]-=a[i];
        if(b[i]>0){
            ans+=min(a[i+1],b[i]);
            a[i+1] = max(0,a[i+1]-b[i]);
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define all(A) A.begin(), A.end()
#define sz(A) (int)A.size()
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <int, int> pii;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const int inf = 1e9;
//const ll inf = 1e18;
const int N = 2e5;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int h1, s1, h2, s2;
	cin >> h1 >> s1 >> h2 >> s2;
	int x = (h2 % s1 == 0 ? h2 / s1 : h2 / s1 + 1);
	int y = (h1 % s2 == 0 ? h1 / s2 : h1 / s2 + 1);
	if (y < x) cout << "No\n";
	else cout << "Yes\n"; 
 	return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>					
using namespace std;	
bool cmp(int a,int b){
	return b>a;
}
int main(void)	
{		long long n,k;
cin>>n>>k;
long long hea[200001];long long ans = 0;
	for(int i=0;i<n;i++){
	cin>>hea[i];
}
if(k>=n){
cout<<ans;
	return 0;
}else if(k==0){
	for(int i = 0;i<n;i++){
		ans+=hea[i];
	}
cout<<ans;
	return 0;
}else{
	sort(hea,hea+n,cmp);
for(int i=n-k-1;i>=0;i--){
	ans+=hea[i];
}	
cout<<ans;	return 0;

}					
return 0;	 									
 } 

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

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h.at(i);
  }
  int ans=1000000000;
  sort(h.begin(),h.end());
  for (int i = 0; i <= N-K; i++) {
    int d=h.at(i+K-1)-h.at(i);
    ans=min(ans,d);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<iomanip>
#include<cstdio>

#define INF 100000001
using namespace std;



int main(){
    int N, M;
    cin >> N >> M;

    int dp[M][1 << N];

    for(int i=0; i< M; i++){
        for(int j = 0; j < (1 << N); j++){
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;

    for(int i=0; i < M; i++){
        int a ,b;
        cin >> a >> b;
        int key = 0;
        for(int j = 0; j<b; j++){
            int c;
            cin >> c; c--;
            key += (1 << c);
        }
        if(i == 0){
            dp[i][key] = a;
        }
    
        else{
            for(int j = 0; j < (1 << N); j++){
                dp[i][j] = dp[i-1][j];
            }
            for(int j=0; j<(1 << N); j++){
                dp[i][j | key] = min(dp[i-1][j] + a, dp[i][j | key]);
            }
        }
    }
    
    cout << (dp[M-1][(1 << N)-1] == INF ? -1 :dp[M-1][(1 << N)-1] ) << endl;

    return 0;
}

Measured memory_bytes: 16256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

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


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

int main() {
    long long N;
    cin >> N;
    long long A = 1, B = N;
    long long max = N - 1;
    for(int i = 2; i <= sqrt(N) + 1; i++) {
        if(N % i == 0) {
            A = i;
            B = N / i;
        }
        if(A-1+B-1 < max) {
            max = A-1+B-1;
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define PI       3.1415926535897932384626433832795028841971
#define INF      100000000
#define EPS      1e-10
#define MOD      1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[100000], b[100000];
int aa[100000], bb[100000];
int ac[100000], bc[100000];

int main(){
    cin >> n;
    ll ans = 0;
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    int nowa = -1;
    rep(i,n){
        if(a[i] < nowa){
            cout << 0 << endl;
            return 0;
        }
        if(a[i] > nowa){
            aa[i] = a[i];
            nowa = a[i];
        } else{
            ac[i] = nowa;
        }
    }
    int nowb = 0;
    for(int i = n-1; i >= 0; i--){
        if(b[i] < nowb){
            cout << 0 << endl;
            return 0;
        } 
        if(b[i] > nowb){
            bb[i] = b[i];
            nowb = b[i];
        } else{
            bc[i] = nowb;
        }
    }
    ans = 1;
    rep(i,n){
        if(ac[i] > 0 && bc[i] > 0){
            ans = ans*min(ac[i],bc[i])%MOD;
        } else if(ac[i] > 0 && bc[i] == 0){
            if(ac[i] < bb[i]){
                cout << 0 << endl;
                return 0;
            }
        } else if(ac[i] == 0 && bc[i] > 0){
            if(bc[i] < aa[i]){
                cout << 0 << endl;
                return 0;
            }
        } else{
            if(aa[i] != bb[i]){
                cout << 0 << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
  int N, Q; cin >> N >> Q;
  string str; cin >> str;
  vector<int> s(N+1,0);
  for(int i=0; i<N; ++i){
    if(i+1<N && str[i]=='A' && str[i+1] == 'C') s[i+1] = s[i] + 1;
    else s[i+1] = s[i];
  }
  
  for(int i=0; i<Q; ++i){
    int l,r; cin >> l >> r;
    l--;
    r--;
    cout << s[r] - s[l] << endl;
  }
}

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

int main()
{
  int H, W, i, j;

  while(1)
    {
      cin >> H >> W;
      if(H==0 && W==0)
	break;

      for(i=0; i<W; i++)
	cout << "#";
      
      cout << endl;

      for(i=0; i<H-2; i++)
	{
	  cout << "#";
	  for(j=0; j<W-2; j++)
	    cout << ".";
	  cout << "#" << endl;
	}
      for(i=0; i<W; i++)
	cout << "#";
      cout << endl << endl;
    }
  return 0;
}

Measured memory_bytes: 1152
// atcoder/abc140/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

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

  int n;
  while (cin >> n) {
    vector<lli> b(n - 1);
    cin >> b;

    vector<lli> a(n, 0);
    a[0] = b[0];
    a[a.size() - 1] = b[b.size() - 1];

    for (int i = 1; i < b.size(); ++i) {
      a[i] = min(b[i - 1], b[i]);
    }

    // cout << a << endl;
    // cout << b << endl;
    for (int i = 0; i + 1 < a.size(); ++i) {
      assert(b[i] >= max(a.at(i), a.at(i + 1)));
    }

    lli sum = 0;
    each (i, a) sum += i;
    cout << sum << endl;
  }

  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b int64
	var s string
	fmt.Scan(&a, &s)
	for i := 0; i < len(s); i++ {
		if s[i] == '.' {
			continue
		}
		b *= 10
		b += int64(s[i] - '0')
	}
	ans := a * b / 100
	fmt.Println(ans)
}


Measured memory_bytes: 1752
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n,ans=1;
  cin>>n;
  ll a=1,b=1;
  rep(i,n){
    ll c,d;cin>>c>>d;
    ll g=max({(a+c-1)/c,(b+d-1)/d,(a+b+c+d-1)/(c+d)});
    a=c*g;b=d*g;
  }
  cout<<a+b<<endl;
}

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

const int N = 105;
const int K = 100005;

int n, k;
int a[N];
bool f[K];

int main() {
	scanf("%d %d", &n, &k);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", a + i);
	}
	for (int i = 0; i <= k; ++i) if (f[i] == false) {
		for (int j = 1; j <= n; ++j) if (i + a[j] <= k) {
			f[i + a[j]] = true;
		}
	}
	puts((f[k] ? "First" : "Second"));
}

Measured memory_bytes: 384
r, g, b = [int(x) for x in input().split()]
times = int(input())

def check(r, g, b, times):
    while True:
        if b > g > r:
            return 'Yes'
        elif b <= g:
            times -= 1
            b *= 2
        elif g <= r:
            times -= 1
            g *= 2
        if times < 0:
            return 'No'

print(check(r, g, b, times))

Measured memory_bytes: 9164
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while( sc.hasNext() ){
            String[] line = sc.nextLine().split(" ");
            int inputnum = Integer.parseInt(line[0]);
            int inputnum2 = Integer.parseInt(line[1]);
            int inputnum3 = Integer.parseInt(line[2]);
            if(inputnum < inputnum2 ){
                if(inputnum2 < inputnum3){
                    System.out.println("Yes");    
                }
                else {
                    System.out.println("No");    
                }
            }
            else {
                System.out.println("No");    
            }
        }
    }
}

Measured memory_bytes: 26120
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000
#define MAX 200001
#define MOD 1000000007
ll fac[MAX], finv[MAX], inv[MAX];
const int MX = 1000005;

int main(){
    int N,W;cin>>N>>W;
    vector<int> v(N+1);
    vector<int> w(N+1);
    vector<vector<int>> dp(N+1,vector<int>(W+1,0));
    for(int i=1;i<N+1;i++){
        cin>>v[i]>>w[i];
    }
    for(int i=1;i<N+1;i++){
        for(int j=0;j<W+1;j++){
            if(j-w[i]>=0) dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
            else dp[i][j] = dp[i-1][j];
        }
    }
    cout<<dp[N][W]<<endl;
}


Measured memory_bytes: 6836
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (w, a, b) = scan!(i64, i64, i64);

    if a + w < b {
        println!("{}", b - a - w)
    } else if b + w < a {
        println!("{}", a - b - w)
    } else {
        println!("0")
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;
ll N;
ll M;
string s;
vector<ll > input1;  
vector<vector <ll > > input2;

int main(){
    
    //cin >> N;
    int N, L;
    cin >> N >> L;
    //vector<int>ans(N, 0);
    vector< pair<ll, ll > > ans2(N);
    //int ans = 0;
    //pair<ll, ll> ans;
    for(int i = 0; i < N; i++){
        int temp = 0;
        int temp2 = 0;
        for(int j = 0; j < N; j++){
            if(j == i){
                temp += L + j+1 - 1;
                continue;
            }
            temp  += L + j+1 - 1;
            temp2 += L + j+1 - 1;
        }
        //cout << temp << endl;
        ans2[i] = make_pair(abs(temp - temp2), temp2);
        //ans[i] = temp - temp2;
    }

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

    

    cout << ans2[0].second << endl;

} 

Measured memory_bytes: 256
package main

import (
	"io"
	"os"

	"fmt"
)

func Solve(in io.Reader, out io.Writer) {
	var n, x int
	fmt.Fscan(in, &n, &x)

	var m = make([]int, n)
	sum := 0
	min := 0
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &m[i])
		sum += m[i]
		if min == 0 || min > m[i] {
			min = m[i]
		}
	}

	num := n
	num += (x - sum) / min

	fmt.Fprintln(out, num)
}

func main() {
	Solve(os.Stdin, os.Stdout)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll K, rec[60], ans[60];
const ll N = 50;
int main() {
	cin >> K;
	if (K == 0) {
		cout << 2 << endl;
		cout << 1 << " " << 1;
		exit(0);
	}
	ll div = (K - 1) / N, mo = K % N;
	iota(ans, ans + N, 0);
	for (ll i=0;i<N;i++)
		ans[i] += div;
	if (mo == 0)
		for (ll i = 0; i < N; i++)
			ans[i]++;
	else {
		for (ll i=0;i< mo;i++) {
			ans[i] += 50;
			for (ll j=0;j<N;j++)
				if(i != j)
					ans[j]--;
		}
	}
	cout << N << endl;
	for (ll i=0;i<N;i++) cout << ans[i]<<" ";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  int A[N];
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  long money=1000;
  for(int i=0;i<N-1;i++){
    if(A[i+1]>A[i]){
      money=money+(money/A[i])*(A[i+1]-A[i]);
    }
  }
  cout<<money<<endl;
  return 0;
}

Measured memory_bytes: 3632
N = int(input())
H = [int(h) for h in input().split()]
az = [0]*N
ans = 0
while H != az:
    has_found = False
    for i in range(N):
        if H[i] == 0:
            has_found = False
            continue
        if not has_found:
            has_found = True
            ans += 1
        H[i] -= 1
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=998244353;
const long long INF = 1LL << 60;

//// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

signed _main(){
  int N; cin >> N;
  int max=0,ans=1;
  v<int> D(N);
  v<int> num(100000+10,0);
  rep(i,N){
    cin >> D[i];
    if(i!=0 && D[i]==0){
      cout << 0 << endl;
      return 0;
    }
    num[D[i]]++;
    chmax(max,D[i]);
  }
  if(D[0]!=0){
    cout << 0 << endl;
    return 0;
  }
  for(int i=1;i<max;i++){
    ans = ans * modpow(num[i],num[i+1],MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s,t;
    cin>>s>>t;
    int cnt=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
            cnt++;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3916
import java.io.*;
import java.util.*;

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

        InputStreamReader isr =new InputStreamReader(System.in);
   		BufferedReader br =new BufferedReader(isr);
    	String buf = br.readLine();
        
        while (true) {
            int i, sum = 0;
            if (Character.getNumericValue(buf.charAt(0)) == 0) break;
            for (i = 0;i < buf.length();i++) {
                sum += Character.getNumericValue(buf.charAt(i));
            }
            System.out.println(sum);
            buf = br.readLine();
        }
    }
}

Measured memory_bytes: 24112
INF = 1 << 60

n, k = gets.split.map(&:to_i)
hs = gets.split.map(&:to_i)

dp = [0]
# refer ahead
n.times do |i|
  k.times do |l|
    j = i + l + 1
    next unless j < n

    # change min
    cost = dp[i] + (hs[i] - hs[j]).abs
    dp[j] = cost if (dp[j] || INF) > cost
  end
end

p dp.last


Measured memory_bytes: 9036
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int bsr(int x) { return 31 - __builtin_clz(x); }
int bsr(ll x) { return 63 - __builtin_clzll(x); }
int bsf(int x) { return __builtin_ctz(x); }
int bsf(ll x) { return __builtin_ctzll(x); }

class compare {
public:
	bool operator()(tuple<ll, ll> a, tuple<ll, ll> b) {
		return (get<1>(a) > get<1>(b));
	}
};

ll n,k;
vl v;

bool check(ll d){
	vvb dp(n,vb(k,false));
	dp[0][0]=true;
	rep(i,n-1){
		ll vt=i+(i>=d?1:0);
		rep(j,k){
			if(dp[i][j]){
				dp[i+1][j]=true;
				if(j+v[vt]<k)dp[i+1][j+v[vt]]=true;
			}
		}
	}
	bool ret=false;
	rep(j,k){
		if(dp[n-1][j]&&k-v[d]<=j)ret=true;
	}
	return ret;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll in;
	cin>>n>>k;
	rep(i,n){
		cin>>in;
		v.push_back(in);
	}
	sort(all(v));
	ll ng=-1,ok=n,mid;
	while(abs(ok-ng)>1){
		mid=(ok+ng)/2;
		if(check(mid))ok=mid;
		else ng=mid;
	}
	cout<<ng+1<<endl;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int a,b;
  cin>>a>>b;
  a--;b--;
  cout<<(a*b)<<endl;

}

Measured memory_bytes: 256
d, n = map(int, input().split())
 
if d == 0:
    if n != 100:
        print(n)
    else:
        print(n + 1)
elif d == 1:
    if n != 100:
        print(n * 100)
    else:
        print(n * 100 + 100)
else:
    if n != 100:
        print(n * 10000)
    else:
        print(n * 10000 + 10000)


Measured memory_bytes: 38256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >   
#define vpl vector< pair<ll,ll> >   
#define viii vector< vector<vector<int> > >
#define cd complex<double>
#define PI 4*atan(1)
#define MOD 998244353
#define pi 3.14159265358979323846//20 decimals
#define eps -0.000001
#define N 4000000

int32_t main()
{
    IOS;
    
    string s;
    cin>>s;
    int n=s.length();

    int ans=0;
    int cnt=0;
    for(int i=n-1;i>=0;i--)
    {
        if(s[i]=='B')
        {
            ans+=cnt;

        }
        else
            cnt++;
    }
    cout<<ans;

    return 0;


}

Measured memory_bytes: 720
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	std::string S;
	in >> S;

	LL a, b;
	a = std::stoi(S.substr(0, 2));
	b = std::stoi(S.substr(2, 2));

	bool f1 = false, f2 = false;
	if (1 <= a && a <= 12) f1 = true;
	if (1 <= b && b <= 12) f2 = true;

	std::string ans;
	if (f1 && f2) ans = "AMBIGUOUS";
	else if (f2) ans = "YYMM";
	else if (f1) ans = "MMYY";
	else ans = "NA";
	out << ans << std::endl;
}


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

using namespace std;
int a[55][55];
char b[] = "123456789";
int main(){
    int i,n,m,x,y;
    scanf("%d%d",&n,&m);
    for(i=1;i<=m;i++)
        {
        scanf("%d%d",&x,&y);
        a[x][y] = a[y][x] = 1;
    }
    b[n] = 0;
    int ans =0;
    while(1)
        {
        int valid = 1;
        for(i=1;i<n;i++)
            {
            x = b[i-1]-'0';
            y = b[i]-'0';
            if(a[x][y]==0)
                {
                valid = 0; break;
            }
        }
        ans += valid;
        
        if(!next_permutation(b+1,b+n))break;
    }
    printf("%d\n",ans);
    return 0;
}


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

int main() {
    int K,S;
    cin >> K >> S;
    int cnt = 0;
    for(int i=0;i<K+1;i++) {
        for(int j=0;j<K+1;j++) {
            if(S - i - j >= 0 && K >= S - i - j) {
                cnt += 1;
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextString() string {
	if !sc.Scan() {
		panic("failed scan string")
	}
	return sc.Text()
}

func nextInt() int {
	if !sc.Scan() {
		panic("failed scan int")
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()

	as := make([]int, n)

	for i := 0; i < n; i++ {
		as[i] = nextInt() - i - 1
	}
	sort.IntSlice(as).Sort()
	b := as[n/2]
	var sum int
	for i := 0; i < n; i++ {
		bb := as[i] - b
		if bb > 0 {
			sum += bb
		} else {
			sum -= bb
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define LL long long

void solve(long long N, long long M, std::vector<long long> A){
    vector<LL> acc(N, 0);
    map<LL, LL> cnt;
    acc[0]=A[0]%M;
    for(LL i=1; i<N; i++)acc[i]=(acc[i-1]+A[i])%M;
    for(LL i=0; i<N; i++)cnt[acc[i]]++;

    LL ans=cnt[0];
    for(LL i=0; i<N; i++){
        cnt[acc[i]]--;
        ans += cnt[acc[i]];
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    ll n, d;
    cin >> n >> d;
    
    int ans = 0;
    rep(i, n) {
        ll x, y;
        cin >> x >> y;
        if (x*x+y*y<=d*d) {
            ans++;
        }
    }
    
    cout << ans << endl;
    return 0;
}


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

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    set<int> se;
    for (int i = A; i < A + K && i <= B; i++) {
        se.insert(i);
    }
    for (int i = B; i > B - K && i >= A; i--) {
        se.insert(i);
    }
    for (auto s : se) {
        cout << s << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a=0,b=0,n;
    string A,B;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>A>>B;
        if(A==B){
            a++;
            b++;
        }
        else if(A>B) a+=3;
        else b+=3;
    }
    cout<<a<<" "<<b<<endl;
    return 0;
    }


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

int main() {
  int N;
  cin >> N;
  vector<pair<int,int>> A(N);
  for(int i=0;i<N;i++){
    cin >> A[i].first;
    A[i].second = i;
  }
  
  sort(A.begin(),A.end());
  
  for(int i=0;i<N;i++) cout << A[i].second+1 << " ";
  return 0;
}


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

class Dice{
private:
  int right,left,front,back,bottom,now;
  void role(int num[6],int num2[6],string str){
    for(int i=0;i<str.size();i++){
      if(num[0]==num2[0]&&num[1]==num2[1]&&num[2]==num2[2]&&num[3]==num2[3]&&num[4]==num2[4]&&num[5]==num2[5]){
	cout<<"Yes"<<endl;
	return;
      }
      switch(str[i]){
      case 'S':num[1]=now;num[0]=back;num[4]=bottom;num[5]=front;now=num[0];back=num[4];bottom=num[5];front=num[1];break;
      case 'W':num[3]=front;num[1]=right;num[2]=back;num[4]=left;front=num[1];left=num[3];back=num[4];right=num[2];break;
      case 'E':num[3]=bottom;num[0]=left;num[2]=now;num[5]=right;now=num[0];left=num[3];bottom=num[5];right=num[2];break;
      case 'N':num[4]=now;num[0]=front;num[1]=bottom;num[5]=back;now=num[0];back=num[4];bottom=num[5];front=num[1];break;
      }
      if(num[0]==num2[0]&&num[1]==num2[1]&&num[2]==num2[2]&&num[3]==num2[3]&&num[4]==num2[4]&&num[5]==num2[5]){
	cout<<"Yes"<<endl;
	return;
      }
    }
    cout<<"No"<<endl;
    return;
  }
public:
  void Scan(int num[6],int num2[6]){
    now=num[0];right=num[2];left=num[3];front=num[1];back=num[4];bottom=num[5];
    role(num,num2,"WWWNWWWWNWWWWNWWWNWWWWNNWWWNWWW");
  }
};

int main(){
  Dice dice;
  int a,b,n;
  int num[6],num2[6];
  for(int i=0;i<6;i++)
    cin>>num[i];
  for(int i=0;i<6;i++)
    cin>>num2[i];
  dice.Scan(num,num2);
  return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back


using namespace std;

void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {std::cout << x;}
void __print(unsigned x) {std::cout << x;}
void __print(unsigned long x) {std::cout << x;}
void __print(unsigned long long x) {std::cout << x;}
void __print(float x) {std::cout << x;}
void __print(double x) {std::cout << x;}
void __print(long double x) {std::cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
template <typename T> inline void inp(T &any) {cin >> any;} template <typename T, typename... U>inline void inp(T &a, U &...b) {cin >> a; inp(b...);}
#define rin(args...) ll args; inp(args);
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#define matdeb(mat,row,col) cout << #mat << "::" << endl; printmat(mat,row,col); printpartition;
#define debugv(v,n) cout << #v << ":" << endl; printv(v,0,n-1); printpartition;
#else
#define debug(x...)
#define matdeb(mat,row,col)
#define debugv(v,n)
#endif

const int maxm = 1000000000 + 7;

double startTime;
double getCurrentTime() {
	return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


//----------->CODE BEGINS --------------->


int main()
{

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

	int n,k;
	cin>>n>>k;

	ll ans = 1;

	loop(i,n)
	{
		ans = min(ans*2,ans+k);
	}

	cout<<ans<<endl;

}


Measured memory_bytes: 3640
#include <iostream>
#include <string>

using namespace std;

typedef unsigned long long ULL;

int main()
{
  string s;

  cin >> s;

  for(int i = 0 ; i < s.length(); i++)
  {
    if(s[i] != s[s.length()-i-1])
    {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}



Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: u32 = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

pub trait SetMinMax {
	fn setmin(&mut self, v: Self) -> bool;
	fn setmax(&mut self, v: Self) -> bool;
}
impl<T> SetMinMax for T where T: PartialOrd {
	fn setmin(&mut self, v: T) -> bool {
		*self > v && { *self = v; true }
	}
	fn setmax(&mut self, v: T) -> bool {
		*self < v && { *self = v; true }
	}
}

fn solve() {
	let (n,r) = read!(i64,i64);
	if n>=10 {
		println!("{}", r);
	}
	else{
		println!("{}", r + (10-n)*100)
	}
}

fn run() {
    solve();
}


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

int main() {
  int n, b, nb, sum;
  cin >> n;
  cin >> b;
  sum = b;
  for (int i = 1 ; i < n - 1; i++) {
    cin >> nb;
    sum += min(b, nb);
    b = nb;
  }
  sum += b;
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
const int lmod = 998244353;
ll modpow(ll a, ll b) {
  if (b == 0)
    return 1;
  ll f = modpow(a, b / 2);
  f = (f * f) % lmod;
  if (b & 1)
    f = (f * a) % lmod;
  return f;
}
ll fact(int n) {
  ll f = 1;
  for (int i = 1; i <= n; i++)
    f = (f * i) % lmod;
  return f;
}
inline ll mult(ll a, ll b) { return ((a % lmod) * (b % lmod)) % lmod; }
inline ll sum(ll a, ll b) { return ((a % lmod) + (b % lmod)) % lmod; }
ll ncr(ll n, ll r) {
  ll num = fact(n);
  ll den = mult(fact(r), fact(n - r));
  ll iden = modpow(den, lmod - 2);
  return mult(num, iden);
}
ll solve(ll n, ll m, ll K) {
  ll ans = 0, ncrVal = 1;
  for (ll k = 0; k <= K; k++) {
    ans = sum(ans, mult(mult(m, modpow(m - 1, n - 1 - k)), ncrVal));
    ncrVal = mult(mult(ncrVal, modpow(k + 1, lmod - 2)), n - 1 - k);
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll n, m, k;
  cin >> n >> m >> k;
  cout << solve(n, m, k) << "\n";
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

const ll MOD = 1e9 + 7;

int N;
vec<int, 2> G;

ll dp[100010][2];

ll solve(int v, int p, int c) {
  ll& res = dp[v][c];
  if (res != -1) return res;
  res = 1;
  for (int u : G[v]) {
    if (u == p) continue;
    ll sum = 0;
    for (int nc = 0; nc < 2; nc++) {
      if (c == 1 && nc == 1) continue;
      sum += solve(u, v, nc);
      sum %= MOD;
    }
    res = res * sum % MOD;
  }
  return res;
}

int main() {
  while (cin >> N) {
    G.clear();
    G.resize(N);
    for (int i = 0; i < N - 1; i++) {
      int x, y;
      cin >> x >> y;
      --x;
      --y;
      G[x].push_back(y);
      G[y].push_back(x);
    }
    memset(dp, -1, sizeof(dp));
    ll res = (solve(0, -1, 0) + solve(0, -1, 1)) % MOD;
    cout << res << endl;
  }
  return 0;
}


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

using namespace std;

const int mx = 1 << 18;
vector<int> dp[mx];

vector<int> tmp;

void join(int x, int y) {  
  for (int it: dp[y]) dp[x].push_back(it);
  partial_sort(dp[x].begin(), dp[x].begin() + 2, dp[x].end(), greater<int>());
  while (dp[x].size() > 2) dp[x].pop_back();  
}

signed main() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  tmp.reserve(10);
  int n, x;
  cin >> n;
  const int N = 1 << n;

  for (int i = 0; i < N; ++i) {
    cin >> x;
    dp[i].push_back(x);
  }

  for (int i = 0; i < n; ++i) {
    for (int mask = 1; mask < N; ++mask) {
      if (mask >> i & 1) {
        join(mask, mask ^ (1 << i));
      }
    }
  }

  int premax = 0;
  for (int i = 1; i < N; ++i) {
    int sum = 0;
    assert(dp[i].size() == 2);
    for(int x: dp[i]) sum += x;
    if (premax < sum) {
      premax = sum;
    }
    cout << premax << '\n';
  }

  return 0;
}

Measured memory_bytes: 17408
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
	int X;
	scanf("%d", &X);
	vector<int> power;
	power.push_back(1);
	power.push_back(1001);
	for (int i = 2; i <= 31; ++i){
		for (int j = 2; j <= 9; ++j)
		{
			int answer = 1;
			for (int k = 0; k < j; ++k) answer *= i;
			power.push_back(answer);
		}
	}
	sort(power.begin(), power.end());
	printf("%d\n", *(upper_bound(power.begin(), power.end(), X) - 1));
	return 0;
}

Measured memory_bytes: 256