akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include<limits.h>
#include<stdio.h>
#include<cstring>
#include<string>
using namespace  std;
typedef long long ll;
typedef long double ld;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define fi first
#define se second
#define rsz(a,n) a.resize(n)
#define test(t) ll t;cin>>t;while(t--)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define fillv(a,k) memset(a,k,sizeof(a))
#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
// #define sp cout<<" "
#define spaceprint(a,i,s,n) {forsn(i,s,n) { cout<<a[i]; sp;}}
#define lineprint(a,i,s,n) {forsn(i,s,n) {cout<<a[i]; ln;}}
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
#define all(c) c.begin(),c.end()
#define trav(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element)  (find(all(container),element) != container.end())// check the presence of element
//copy(from_begin, from_end, to_begin); copy function
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<string> vs;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
typedef map<ll,ll> m64;
const int LIM = 1e5+5, MOD =  1e9;
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
ll gcd(ll a, ll b) { if(b == 0) return a; return gcd(b, a % b); }
ll mod=1e9+7;
ll fastpowMOD(ll a, ll p,ll MOD){ if(p==0) return 1; ll z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }

ll fact[200004];
void compfact ()
{
	fact[0]=1;
	for (ll i=1;i<=200002;i++)
		fact[i]=(fact[i-1]%mod*i%mod)%mod;
}
vp64 v;
ll dp[2002][2002];

void solve (ll ind,ll l , ll r)
{
	if (dp[l][r]!=-1)
		return;
	else if (l>r)
		return;
	else if (l==r)
	{
		dp[l][r]=v[ind].fi*abs(v[ind].se-l);
	}
	else
	{
		solve(ind+1,l+1,r);
		solve(ind+1,l,r-1);
		dp[l][r]=max(dp[l][r],dp[l+1][r]+v[ind].fi*abs(v[ind].se-l));
		dp[l][r]=max(dp[l][r],dp[l][r-1]+v[ind].fi*abs(v[ind].se-r));

	}

}
int main()
{
	fast;
	ll a,b;
	cin>>a>>b;
	ll x;
	cin>>x;
	cout<<(b/x-a/x+!(a%x));

}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
int main(void){

    string s;
    cin >> s;
    bool flag = false;
    for(int i=0; i<3; i++) {
        if(s.substr(i,1) == s.substr(i+1,1)) flag = true;
    }

    if(flag) cout << "Bad" << endl;
    else cout << "Good" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>

typedef long long int64;

int main(void) {
  int n;
  std::cin >> n;
  std::string s;
  std::cin >> s;

  int c = 0;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s.at(i) != s.at(i + 1)) c++;
  }
  std::cout << c + 1 << std::endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int MAX = 110000;
int main(){
  vector<bool> prime(MAX + 1, true);
  prime[0] = false;
  prime[1] = false;
  for (int i = 2; i <= MAX; i++){
    if (prime[i]){
      for (int j = i * 2; j <= MAX; j += i){
        prime[j] = false;
      }
    }
  }
  while (1){
    int N, P;
    cin >> N >> P;
    if (N == -1 && P == -1){
      break;
    }
    vector<int> p;
    for (int i = N + 1; i <= MAX; i++){
      if (prime[i]){
        p.push_back(i);
        if (p.size() == P){
          break;
        }
      }
    }
    vector<int> sum;
    for (int i = 0; i < P; i++){
      for (int j = i; j < P; j++){
        sum.push_back(p[i] + p[j]);
      }
    }
    sort(sum.begin(), sum.end());
    cout << sum[P - 1] << endl;
  }
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
const double PI = 3.14159265358979323846;
int vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance(vec.begin(), itr);
  if (index != vec.size()) {  // 発見できたとき
    return 1;
  } else {  // 発見できなかったとき
    return 0;
  }
}
int main() {
  string s, t;
  cin >> s >> t;
  int size = s.size();
  int f = 0;
  for (int i = 0; i < size; i++) {
    if (s[i] != t[i]) {
      f++;
    }
  }
  cout << f;
}

Measured memory_bytes: 3860
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <utility>
#include <queue>
#define INF 1000000007

using namespace std;
typedef long long int ll;



int h,w;
int ma[21][21];
int ans = INF;
int si,sj,gi,gj;

void dfs(int i, int j, int times){
    if (i<0 or j<0 or i>=h or j>=w or times >= 11) return;
    if(i==gi and j==gj){
        ans = min(ans, times);
        return;
    }
    int flag = 0;
    int oi = i,ui = i,mj= j,hj=j;
    if(i+1<h and ma[i+1][j]!=1){
        while (ma[oi][j]!=1) {
            oi++;
            if (oi>=h){
                break;
            }
            if (ma[oi][j]==3) {
                ans = min(ans, times+1);
                flag ++;
                break;
            }
        }
        if (oi<h and flag == 0){
            ma[oi][j] = 0;
            dfs(oi-1, j, times+1);
            ma[oi][j] = 1;
        }
    }
    if (i-1>=0 and ma[i-1][j]!=1) {
        flag = 0;
        while (ma[ui][j]!=1) {
            ui--;
            if (ui <= -1) {
                break;
            }
            if(ma[ui][j]==3){
                ans = min(ans, times+1);
                flag ++;
                break;
            }
        }
        if(ui>=0 and flag == 0){
            ma[ui][j]=0;
            dfs(ui+1, j, times+1);
            ma[ui][j]=1;
        }
    }
    if(j+1<w and ma[i][j+1]!=1){
        flag = 0;
        while (ma[i][mj]!=1) {
            mj++;
            if (mj>=w) {
                break;
            }
            if (ma[i][mj]==3) {
                ans = min(ans, times+1);
                flag++;
                break;
            }
        }
        if (mj<w and flag == 0) {
            ma[i][mj] = 0;
            dfs(i, mj-1, times+1);
            ma[i][mj] = 1;
        }
    }
    if(j-1>=0 and ma[i][j-1]!=1){
        flag = 0;
        while (ma[i][hj]!=1) {
            hj--;
            if (hj <= -1) {
                break;
            }
            if (ma[i][hj] == 3) {
                ans = min(ans, times+1);
                flag ++;
                break;
            }
        }
        if(hj>=0 and flag == 0) {
            ma[i][hj]=0;
            dfs(i, hj+1, times+1);
            ma[i][hj]=1;
        }
    }
    return;
}


int main(){
    for (;;) {
        cin >> w >> h;
        if (!h and !w) break;
        ans = INF;
        for(int i = 0; i<h ; i++){
            for (int j=0; j<w; j++) {
                cin >> ma[i][j];
                if (ma[i][j]==2) {
                    si = i;
                    sj = j;
                }
                if (ma[i][j]==3) {
                    gi = i;
                    gj = j;
                }
            }
        }
        ma[si][sj] = 0;
        dfs(si, sj, 0);
        if (ans == INF or ans == 11) {
            cout << -1 << endl;
        }else{
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 1160
#include <iostream>

int main(){
    
    int number = 0;
    int mod = 0;

    std::cin >> number;
    mod = number % 10;

    if(mod == 0 | mod == 1 | mod == 6 | mod == 8){
        std::cout << "pon" << std::endl;
    }
    else if(mod == 2 | mod == 4 | mod == 5 | mod == 7 | mod == 9){
        std::cout << "hon" << std::endl;
    }
    else if(mod == 3){
        std::cout << "bon" << std::endl;
    }
    
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll H, N;
    cin >> H >> N;
    vector<ll> dp(H + 1, numeric_limits<ll>::max());
    vector<pair<ll, ll>> A(N);
    rep(i, N) cin >> A[i].first >> A[i].second;
    dp[0] = 0;
    for(ll i = 0;i < H;i++) {
        if(dp[i] == numeric_limits<ll>::max()) continue;
        iter(j, A) {
            ll index = min(H, i + j.first);
            dp[index] = min(dp[i] + j.second, dp[index]);
        }
    }
    cout << dp.back() << endl;
    return 0;
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
int i,j,k,count1=0,count2=0;

int main(void){
    int ans=0;
    string s;
    cin>>s;
    if(s.length()%2==0){
        for(i=0;i<s.length();i+=2){
            if(s[i]=='h'&&s[i+1]=='i')count1++;
        }
    }
    if(count1==s.length()/2)ans=1;
    if(s.length()==1)ans=0;
    cout<<(ans? "Yes" : "No")<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int alpha = 'A' - 'a';
        for(int i = 0 ; i < str.length() ; i++)
        {
                if(str.charAt(i) >= 'A' && str.charAt(i) <= 'Z')
                    System.out.print((char)(str.charAt(i) - alpha));
                else if(str.charAt(i) >= 'a' && str.charAt(i) <= 'z')
                    System.out.print((char)(str.charAt(i) + alpha));
                else
                    System.out.print(str.charAt(i));
        }
        System.out.println();
    }
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N, M;
  cin >> N >> M;
  vector< int > ev[101010];
  for(int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    if(M - x >= 0) ev[M - x].emplace_back(y);
  }
  int64 ret = 0;
  priority_queue< int > que;
  for(int i = M; i >= 0; i--) {
    for(auto &p : ev[i]) que.emplace(p);
    if(que.size()) {
      ret += que.top();
      que.pop();
    }
  }
  cout << ret << endl;
}




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

using namespace std;

const int N = 500000, Q = 500000;

int aa[N], ll[Q], rr[Q], iia[N], iiq[Q], ft[N], ans[Q];

void update(int i, int n, int x) {
	while (i < n) {
		ft[i] += x;
		i |= i + 1;
	}
}

int query(int i) {
	int x = 0;
	while (i >= 0) {
		x += ft[i];
		i &= i + 1, i--;
	}
	return x;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n, q; cin >> n >> q;
	for (int i = 0; i < n; i++)
		cin >> aa[i];
	for (int h = 0; h < q; h++) {
		int l, r; cin >> l >> r, l--, r--;
		ll[h] = l, rr[h] = r;
	}
	for (int ha = 0; ha < n; ha++)
		iia[ha] = ha;
	sort(iia, iia + n, [] (int i, int j) { return aa[i] < aa[j] || aa[i] == aa[j] && i > j; });
	for (int ha1 = 0, ha2; ha1 < n; ha1 = ha2) {
		int a = aa[iia[ha1]];
		aa[iia[ha1]] = n;
		ha2 = ha1 + 1;
		while (ha2 < n && aa[iia[ha2]] == a) {
			aa[iia[ha2]] = iia[ha2 - 1];
			ha2++;
		}
	}
	for (int hq = 0; hq < q; hq++)
		iiq[hq] = hq;
	sort(iiq, iiq + q, [] (int h1, int h2) { return ll[h1] > ll[h2]; });
	for (int i = n - 1, hq = 0; hq < q; hq++) {
		int h = iiq[hq];
		int l = ll[h], r = rr[h];
		while (i >= l) {
			update(aa[i], n, -1);
			update(i, n, 1);
			i--;
		}
		ans[h] = query(r);
	}
	for (int h = 0; h < q; h++)
		cout << ans[h] << '\n';
	return 0;
}


Measured memory_bytes: 17432
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
	int A, B, K;
	cin >> A >> B >> K;
	if (B - A + 1 >= 2*K) {
		for (int i = 0; i < K; i++) cout << A + i << endl;
		for (int i = 0; i < K; i++) cout << B - K + 1 + i << endl;
	}
	else {
		for (int i = 0; i < B - A + 1; i++)cout << A + i << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

void solve()
{
    ll n;
    cin>>n;
    vi v;
    ll x;
    rep(i,0,n)
    {
        cin>>x;
        v.pb(x);
    }
    sort(all(v));
    ll ans=0;
    set<pair<ll,pii>>s;
    rep(i,0,n)
    {
        rep(j,i+1,n)
        {
            rep(k,j+1,n)
            {
                if(v[k]<v[i]+v[j])
                {

                    if(v[i]!=v[j]&&v[j]!=v[k]&&v[i]!=v[k])
                    {
                        s.insert({i,{j,k}});    
                    }
                }
            }
        }
    }
    cout<<s.size()<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 13724
let () =
  Scanf.scanf "%d" @@ fun n ->
  let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x)) in
  let a' = Array.init n (fun i -> a.(i) - (i+1)) in
  Array.sort (-) a';
  let m = a'.((n-1)/2) in
  Array.mapi (fun i e -> abs (e - (m + (i+1)))) a
  |> Array.fold_left (+) 0 |> Printf.printf "%d\n"

Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
long long l,r,ans=2019;

int main(){
	cin>>l>>r;
	for(long long i=l;i<=min(r,l+2020);i++){
		for(long long j=i+1;j<=min(r,i+2020);j++){
			ans=min(ans,(i*j)%2019);
		}
	}
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    long long int p=100;
    long long int x;
    scanf("%lld",&x);
    int k=0;
    while(1)
    {
        if(p!=x)
        {
         p=p*1.01;
         k++;
        }
        if(p>=x)
            break;
    }
    printf("%d\n",k);
    return 0;
}

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

typedef long long ll;

using namespace std;

const string no = "NO";
const string yes = "YES";

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

  int diff = a - b;
  c = max(0, c - diff);
  cout << c << endl;

  return 0;
}




Measured memory_bytes: 256
n = int(input())

total = [i for i in range(1, n + 1)]
fizz = [i for i in range(1, n + 1) if i % 3 == 0]
buzz = [i for i in range(1, n + 1) if i % 5 == 0]
fizzbuzz = [i for i in range(1, n + 1) if i % 15 == 0]

ans = sum(total) - sum(fizz) - sum(buzz) + sum(fizzbuzz)
print(ans)


Measured memory_bytes: 141856
#include<bits/stdc++.h>
using namespace std;
#define int                 long long
#define FF(i,a,b)           for(int i=a;i<b;i++)
#define BF(i,a,b)           for(int i=a;i>=b;i--)
#define vi                  vector<int>
#define MAP                 map<int,int>
#define pb                  push_back
#define MP                  make_pair
#define F                   first
#define S                   second
#define pi                  pair<int,int>
#define all(v)              v.begin(),v.end()
#define PIE                 3.1415926535897932384626433832795
#define print0(a)           cout<<a<<"\n"
#define print1(a)           cout<<a<<' '
#define print2(a,b)         cout<<a<<" "<<b<<" ";
#define print3(a,b,c)       cout<<a<<" "<<b<<" "<<c<<" ";
#define print4(a,b,c,d)     cout<<a<<" "<<b<<" "<<c<<" "<<d<<" ";
#define FastIO              ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
/**************************************************************************************/
                       /*Global Variables*/
const int mod = 1e9+7;
const int N = 2e5+10;
const int inf = 3e18;

/**************************************************************************************/
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
int Power(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)res*=a;
        a*=a;
        b>>=1;
    }
    return res;
}
signed main()
{
    FastIO;
    // ifstream("a1.in");
    // ofstream("a1.out");
    //freopen("a1.in","r",stdin); freopen("a1.out","w",stdout);
    int T=1;
    //cin>>T;
    for(int t=1;t<=T;t++)
    {
        
        int x;
        cin>>x;
        int val=100;
        int cnt=0;
        while(val<x)
        {
            val+=(val/100);
            cnt++;
        }
        cout<<cnt<<"\n";
        
    }

}
/*
|| Do what you can with all you have,wherever you are. ||

|| Knowing is not enough, we must apply. Wishing is not enough, we must do. ||

|| A goal is a dream with deadline. ||

|| Whether you think you can or you think you can't, you're right. ||
*/



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

double dis(pair<long, long> a, pair<long, long> b){
  return abs(a.first - b.first) + abs(a.second - b.second);
}

int main() {
  int N, M;
  cin >> N >> M;
  pair<long, long> g[N], c[M];
  for(int i=0; i<N; i++){
    cin >> g[i].first >> g[i].second;
  }
  for(int i=0; i<M; i++){
    cin >> c[i].first >> c[i].second;
  }

  int ans[N];
  for(int i=0; i<N; i++){
    double min = 1e9;
    for(int j=M-1; j>=0; j--){
      if(min >= dis(g[i], c[j])){
        min = dis(g[i], c[j]);
        ans[i] = j+1;
      }
    }
  }

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



Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60

N, M = map(int, readline().split())
S = [[] for _ in range(M)]
for i in range(M):
    _, *S[i] = [int(s) - 1 for s in readline().split()]
P = list(map(int, readline().split()))

ans = 0
for i in range(1 << N):
    switches = [bool(i & (1 << j)) for j in range(N)]
    all_lit = True
    for j in range(M):
        if sum(switches[k] for k in S[j]) % 2 != P[j]:
            all_lit = False
            break
    if all_lit:
        ans += 1

print(ans)


Measured memory_bytes: 3064
N, A, B = map(int,input().split())
keta, ans = 0, 0
for i in range(1, N+1):
  keta, tmp = 0, i
  while tmp // 10 > 0:
    keta += tmp % 10
    tmp = tmp // 10
  keta += tmp
  if A <= keta <= B:
    ans += i
print(ans)

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int s,w;
    cin>>s>>w;
    if(s <= w) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
 
int    main( void )
{
    int N, X[101], i, P, tai[1000], kekka;
    
    //入力
    scanf("%d", &N);
    for(i=0; i<N; i++){
        scanf("%d", &X[i]);
    }
    
    //体力計算
    for(P=1; P<=100; P++){
        tai[P]=0;
        for(i=0; i<N; i++){
            tai[P] = tai[P] + ((X[i]-P) * (X[i]-P));
        }
    }
    
    //比較
    for(P=1; P<99; P++){
        if(tai[P]-tai[P+1] <= 0){
            tai[P+1]=tai[P];
        }
        kekka=tai[P+1];
    }
    
    printf("%d", kekka);
    
    return 0;
}


Measured memory_bytes: 128
import heapq, bisect

N = int(input())
h1 = []
h2 = []
lst = []
dic = {}

for _ in range(N):
  a,b = map(int, input().split())
  dic[a] = b
  lst.append(a)
  
lst.sort()

for _ in range(N):
  t = tuple(map(int, input().split()))
  heapq.heappush(h2, t)

j = 0
k = 0
rlt = 0
while h2:
  t = heapq.heappop(h2)
  j = bisect.bisect_left(lst, t[0])
  g = []
  for i in range(k,j):
    heapq.heappush(h1, -dic[lst[i]])
  while h1:
    c = heapq.heappop(h1)
    if -c < t[1]:
      rlt += 1
      break
    else:
      g.append(c)
  for c in g:
    heapq.heappush(h1, c)
  k = j
  
print(rlt)

Measured memory_bytes: 74240
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+5;
char s[15][N];
int a[15][N];
int cal(int x1,int x2,int y) {
    int ans=0;
    for(int i=x1;i<=x2;i++) {
        ans+=(s[i][y]=='1');
    }
    return ans;
}
int main() {
    //freopen("in.txt","r",stdin);
    int n,m,k;
    scanf("%d%d%d",&n,&m,&k);
    for(int i=0;i<n;i++) {
        scanf("%s",s[i]);
    }
    int ans=1e9;
    for(int s=0;s<(1<<(n-1));s++) {
        vector<int> vec;
        vec.push_back(-1);
        for(int i=0;i<n-1;i++) {
            if((1<<i)&s) vec.push_back(i);
        }
        vec.push_back(n-1);
        int sz=vec.size();
        bool f=true;
        for(int j=0;j<m;j++) {
            for(int i=1;i<sz;i++) {
                a[i][j]=cal(vec[i-1]+1,vec[i],j);
                if(a[i][j]>k) f=false;
            }   
        }
        if(!f) continue;
        int num=0,b[15]={0};
        for(int j=0;j<m;j++) {
            bool f=true;
            for(int i=1;i<sz;i++) {
                b[i]+=a[i][j];
                if(b[i]>k) f=false;
            }
            if(!f) {
                num++;
                for(int i=1;i<sz;i++) {
                    b[i]=a[i][j];
                }
            }
        }
        ans=min(ans,sz-2+num);
    }
    printf("%d\n",ans);
    return 0;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
typedef vector<vector<int>> Graph;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);

    int N; cin >> N;
    set<string> words;
    vector<string> S(N);
    rep(i, N) {
        cin >> S[i];
        words.insert(S[i]);
    }
    int M; cin >> M;
    vector<string> T(M);
    rep(i, M) {
        cin >> T[i];
        words.insert(T[i]);
    }

    int ans = 0;
    for (auto w : words) {
        int tmp = 0;
        for (auto s : S) if (s == w) tmp++;
        for (auto t : T) if (t == w) tmp--;
        ans = max(ans, tmp);
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
package main

import (
	"fmt"
	"strconv"
)

var count = 0

func main() {
	var n int
	fmt.Scan(&n)
	rec1(n, "")
	fmt.Println(count)
}

func rec1(max int, str string) {
	if len(str) > 0 {
		tmp, _ := strconv.Atoi(str)
		if tmp > max {
			return
		} else {
			t, f, s := 0, 0, 0
			for _, l := range str {
				ss := string(l)
				switch ss {
				case "3": t++
				case "5": f++
				case "7": s++
				}
			}
			if t > 0 && f > 0 && s > 0 {
				count++
			}
		}
	}
	rec1(max, str + "3")
	rec1(max, str + "5")
	rec1(max, str + "7")
}

Measured memory_bytes: 1920
from math import cos, sin, pi

n = int(input())

p1 = (0, 0)
p2 = (100, 0)
theta = pi/3


def koch(d, p1, p2):
    if d == 0:
        return None

    sx = (2*p1[0] + p2[0]) / 3
    sy = (2*p1[1] + p2[1]) / 3
    tx = (p1[0] + 2*p2[0]) / 3
    ty = (p1[1] + 2*p2[1]) / 3
    ux = (tx - sx) * cos(theta) - (ty - sy) * sin(theta) + sx
    uy = (tx - sx) * sin(theta) + (ty - sy) * cos(theta) + sy

    koch(d-1, p1, (sx, sy))
    print("{} {}".format(sx, sy))
    koch(d-1, (sx, sy), (ux, uy))
    print("{} {}".format(ux, uy))
    koch(d-1, (ux, uy), (tx, ty))
    print("{} {}".format(tx, ty))
    koch(d-1, (tx, ty), p2)


print("{} {}".format(p1[0], p1[1]))
koch(n, p1, p2)
print("{} {}".format(p2[0], p2[1]))



Measured memory_bytes: 5744
# 反復深化

# 距離
distance = (
    (),
    (0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6),
    (1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5),
    (2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3, 5, 4, 3, 4),
    (3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2, 6, 5, 4, 3),
    (1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5),
    (2, 1, 2, 3, 1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4),
    (3, 2, 1, 2, 2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3),
    (4, 3, 2, 1, 3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2),
    (2, 3, 4, 5, 1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4),
    (3, 2, 3, 4, 2, 1, 2, 3, 1, 0, 1, 2, 2, 1, 2, 3),
    (4, 3, 2, 3, 3, 2, 1, 2, 2, 1, 0, 1, 3, 2, 1, 2),
    (5, 4, 3, 2, 4, 3, 2, 1, 3, 2, 1, 0, 4, 3, 2, 1),
    (3, 4, 5, 6, 2, 3, 4, 5, 1, 2, 3, 4, 0, 1, 2, 3),
    (4, 3, 4, 5, 3, 2, 3, 4, 2, 1, 2, 3, 1, 0, 1, 2),
    (5, 4, 3, 4, 4, 3, 2, 3, 3, 2, 1, 2, 2, 1, 0, 1)
)

# 距離を求める
def get_distance(board):
    sd = 0
    for i in range(16):
        p = board[i]
        if p == 0:
            continue
        sd += distance[p][i]
    return sd

adjacent = (
    (1, 4),         # 0
    (0, 2, 5),      # 1
    (1, 3, 6),      # 2
    (2, 7),         # 3
    (0, 5, 8),      # 4
    (1, 4, 6, 9),   # 5
    (2, 5, 7, 10),  # 6
    (3, 6, 11),     # 7
    (4, 9, 12),     # 8
    (5, 8, 10, 13), # 9
    (6, 9, 11, 14), # 10
    (7, 10, 15),    # 11
    (8, 13),        # 12
    (9, 12, 14),    # 13
    (10, 13, 15),   # 14
    (11, 14)        # 15
)

GOAL = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0]

# 下限値枝刈り法
def df_lower_search(limit, move, space, lower, pre_p):
    if move == limit:
        if board == GOAL:
            return True
    else:
        for i in adjacent[space]:
            p = board[i]
            if p == pre_p:
                continue
            board[space] = p
            board[i] = 0
            new_lower = lower - distance[p][i] + distance[p][space]
            if new_lower + move <= limit:
                if df_lower_search(limit, move + 1, i, new_lower, p):
                    return True
            board[space] = 0
            board[i] = p

import sys

board = list(map(int, sys.stdin.read().split()))

s = board.index(0)
e_o = (0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0)

n = get_distance(board)

if e_o[s] != n % 2:
    n += 1

for l in range(n, 46, 2):
    if df_lower_search(l, 0, s, n, None):
        print(l)
        break
        



Measured memory_bytes: 5772
/*****************************************************

Code by: Vichitr
Compiled On: 23rd March 2019

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

#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define pb push_back
#define pf pop_front
#define mp make_pair
#define loop(i,n) for(int i=0;i<n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ip pair<int, int>
#define N 100007
const ll MOD = 1e9+7;
const ll SZ = 107;


signed main()
{
    fast;

    int n;
    cin>>n;
    int h[n+5];
    for(int i=1;i<=n;i++) cin>>h[i];
    int dp[n+5];
    dp[0]=dp[1] = 0;
    dp[2] = abs(h[2]-h[1]);
    for(int i=3;i<=n;i++)
    {
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n];
    return 0;
}


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

int n,m,ans;

signed main()
{
	cin>>n>>m;
	if (n==1||m==1)
	{
		cout<<1<<endl;
		return 0;
	}
	ans=n*m;
	
	if (ans%2==0)  cout<<ans/2ll<<endl;
	else cout<<(ans/2ll)+1ll<<endl;
	
	return 0;
}

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

#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

   string A,B,C;
   cin>>A>>B>>C;
   if(A[A.size()-1]==B[0] && B[B.size()-1]==C[0]){
      cout<<"YES"<<endl;
   }
   else cout<<"NO"<<endl;
   return 0;
}


Measured memory_bytes: 256
import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	double x1,y1,x2,y2;
	String str[]=new String[4];
	str=input.readLine().split(" ");
	
	x1=Double.parseDouble(str[0]);
	y1=Double.parseDouble(str[1]);
	x2=Double.parseDouble(str[2]);
	y2=Double.parseDouble(str[3]);
	if(x1>=x2 && y1>=y2)
	    {
		System.out.println(Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y1-y2),2)));
	    }
	else if(x2>=x1 && y1>y2)
	    {
		System.out.println(Math.sqrt(Math.pow((x2-x1),2)+Math.pow((y1-y2),2)));
	    }
	else if(x1>=x2 && y2>=y1)
	    {
		System.out.println(Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y2-y1),2)));
	    }
	else if(x2>=x1 && y2>=y1)
	    {
		System.out.printf("%.8f\n",Math.sqrt(Math.pow((x2-x1),2)+Math.pow((y2-y1),2)));
	    }
    }
}

Measured memory_bytes: 16996
#include <iostream>
#include <math.h>
using namespace std;
int main(void){
    int n,m;
    cin>>n>>m;
    float t,p,ans;
    t = 100*n + 1800*m;
    p = pow(0.5,m);
    ans = t / p;
    cout<<int(ans)<<endl;
}

Measured memory_bytes: 512
// 2018/12/17 Tazoe

#include <iostream>
using namespace std;

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

	int cnt = 0;
	int cnt_max = -1;

	for(int i=0; i<N; i++){
		int A;
		cin >> A;

		if(A==0){
			cnt = 0;
		}
		else{
			cnt++;
		}

		if(cnt_max<cnt){
			cnt_max = cnt;
		}
	}

	cout << cnt_max+1 << endl;

	return 0;
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef long long LL;
using namespace std;

int main() {
    string s; cin>>s;
    int mn = 1000;
    for(int i=0; i<s.length()-2; i++) {
        int sum=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
        mn = min(mn, abs(sum-753));
    }
    cout<<mn<<endl;
    return 0;
}


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

int main(){
  int A[5][4][11], n;
  for(int i = 1; i <= 4;i++){
    for(int j = 1;j <= 3;j++){
      for(int k = 1;k <= 10;k++){
       A[i][j][k] = 0;
      }
    }
  }
  cin >> n;
  for(int i = 0;i < n;i++){
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    A[b][f][r] += v;
  }
  for(int f = 1;f <=4;f++){
    if(f > 1)cout << "####################" << endl;
    for(int b = 1;b <=3;b++){
      for(int r = 1;r <= 10;r++){
        cout << " " << A[f][b][r];
      }
      cout << endl;
    }
  }
}


Measured memory_bytes: 3076
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int[] NK=cin.ArrayInt(2,0);
        char[] S=cin.next().ToCharArray();
        string ans="";
        for(int i=0;i<NK[0];i++)
        {
          if(i==NK[1]-1)ans+=S[i].ToString().ToLower();
          else ans+=S[i].ToString();
        }
        Console.WriteLine(ans);
    }


}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public static void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }//Answer.IntArrayAns(x);
    public static void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
        return b;        
    }
}

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

int main(){
    int n;

    cin >> n;
    vector<vector<int>> a(n, vector<int>(n, 0));

    for(int i = 0; i < n; i++){
        int u, k;
        cin >> u >> k;
        for(int j = 0; j < k; j++){
            int v;
            cin >> v;
            a[u - 1][v - 1] = 1; 
        }
        
    }

    for(auto vv: a){
        for(int i = 0; i < n; i++){
            cout << vv[i];
            if(i != n - 1){
                cout << " ";
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3140
h, w, k = map(int, input().split())
s = [str(input()) for _ in range(h)]
#print(s)
p_ = [list(c) for c in s]

t = [[0]*h for _ in range(w)]
for i in range(h):
    for j in range(w):
        t[j][i] = int(p_[i][j])

#print(t)

ans = 10**7
for i in range(2**(h-1)):
    c = 0
    d = {}
    for j in range(h):
        d[j] = 0
    for j in range(h-1):
        if (i >> j) & 1:
            d[j] = c
            c += 1
        else:
            d[j] = c
    d[h-1] = c
    #print(c)
    #print(d)
    l = [0]*(c+1)
    cnt = c
    for a in range(w):
        temp = [0]*(c+1)
        for b in range(h):
            l[d[b]] += t[a][b]
            temp[d[b]] += t[a][b]
        if max(temp) > k:
            break
        if max(l) > k:
            cnt += 1
            l = temp
    else:
        ans = min(ans, cnt)
    continue

print(ans)


Measured memory_bytes: 45916
#include<bits/stdc++.h>
            using namespace std;
            #define rep(i,b) for(i=0;i<b;++i)
            #define repp(i,a,b) for(i=a;i<b;++i)
            #define endl "\n"
            #define pi 3.14159265358979323846
            #define LLONG_MAX 99999999999999
            typedef long long int lli;
            int main(){
                lli i,j,t,k,n,m,f,g,q;
                lli a,b,c;
                cin>>a>>b>>c;
                lli ans=min(lli(b/a),c);
                cout<<ans<<endl;

                return 0;

            }



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    vector<ll> a(n);rep(i,n){cin>>a[i];}
    ll dp[n][n];
    ll size[n][n],csum[n+1]={};
    csum[0]=0;
    rep(i,n){csum[i+1]=csum[i]+a.at(i);}
    rep(i,n)repr(j,i,n){
        size[i][j]=csum[j+1]-csum[i];
    }
    rep(i,n)rep(j,n){dp[i][j]=1LL<<60;}
    rep(i,n){dp[i][i]=0;}
    rep(i,n-1){
        dp[i][i+1] = a[i]+a[i+1];
    }

    repr(width,2,n){
        for(int i=0;i+width<n;i++){
            rep(j,width){
                DEBUG{
                    printf("i: %d, i+j: %d, i+w: %d\n",i,i+j,i+width);
                    printf("size : %lld",size[i][i+width]);
                }
                assert(i+width<n);
                assert(i+j+1<=i+width);
                dp[i][i+width] = min(dp[i][i+width],dp[i][i+j]+dp[i+j+1][i+width]+size[i][i+width]);
            } 
        }
    }
    cout << dp[0][n-1] << endl;
    return 0;
}


Measured memory_bytes: 2816
n, t = map(int, raw_input().split())

mx = 0
s = 0
for i in xrange(n):
    x = input()
    mx = max(mx, x)
    r = t - s
    if r < 0:
        print 1
    else:
        ans = r / mx + 1
        if r % mx >= x:
            ans += 1
        print ans
    s += x

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

int main() {
  string s;
  cin >> s;
  int a,b,c,d;
  a = s.at(0) - '0';
  b = s.at(1) - '0';
  c = s.at(2) - '0';
  d = s.at(3) - '0';
  if (a+b+c+d==7) cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
  else if (a-b+c+d==7) cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
  else if (a+b-c+d==7) cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
  else if (a-b-c+d==7) cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
  else if (a+b+c-d==7) cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
  else if (a-b+c-d==7) cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
  else if (a+b-c-d==7) cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
  else if (a-b-c-d==7) cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
  
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
  val (N, M, Q) = readInts()
  val ABCD = (1..Q).map { readInts() }

  val array = Array(N) { 0 }

  var max = 0
  fun f(): Int {
//    println(array.joinToString())
    val sum = ABCD.sumBy {
      val (a, b, c, d) = it
      if (array[b - 1] - array[a - 1] == c) d else 0
    }
//    println(sum)
    return sum
  }

  fun dfs(i: Int, min: Int) {
    for (m in min..M) {
      array[i] = m
      if (i + 1 == N)
        max = Math.max(max, f())
      else
        dfs(i + 1, m)
    }
  }
  dfs(0, 1)

  println(max)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 40740
import sys
input = sys.stdin.readline

def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1)
    return num
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
def main():
    N = int(input())
    num = num2alpha(N)
    ans = num.lower()
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9204
#include<bits/stdc++.h>
#define LL long long
#define DB long double
using namespace std;
#define P 998244353
inline int ad(int x,int y){return (x+y>=P)?(x+y-P):(x+y);}
inline int mt(int x,int y){return 1ll*x*y%P;}
inline void mo(int &x){x=(x>=P)?(x-P):x; x=(x<0)?(x+P):x;}
template<typename T>inline void ckmx(T &x,T y){x=max(x,y);}
template<typename T>inline void ckmi(T &x,T y){x=min(x,y);}
template<typename T>void read(T &x){
	x=0;int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if (c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-48;
	x*=f;
}
int n;
int a[310];
int f[310][90010]; 
int g[310][90010];
int po(int x,int k){
	int rt=1;
	while(k){
		if(k&1) rt=mt(rt,x);
		x=mt(x,x);
		k>>=1;
	}
	return rt;
}
int main(){
	read(n);
	int s=0;
	for(int i=1;i<=n;++i)
		read(a[i]),s+=a[i];
	f[0][0]=1;
	for(int i=1;i<=n;++i)
		for(int j=0;j<=s;++j)
			mo(f[i][j+a[i]]+=f[i-1][j]),mo(f[i][j]+=ad(f[i-1][j],f[i-1][j]));
	int ans=0;
	for(int j=(s+1)/2;j<=s;++j)
		mo(ans+=f[n][j]);
	ans=mt(ans,3);
	if(!(s&1)){
		g[0][0]=1;
		for(int i=1;i<=n;++i)
			for(int j=0;j<=s;++j)
				mo(g[i][j+a[i]]+=g[i-1][j]),mo(g[i][j]+=g[i-1][j]);	
		mo(ans-=mt(g[n][s/2],3));
	}
	mo(ans=po(3,n)-ans);
	cout<<ans<<endl;
	return 0;
}


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

int main(){
int K,S;

cin>>K>>S;
int res=0;
for(int x=0; x <= K; ++x){
for(int y=0; y <= K; ++y){ 
int z = S-x-y;
if (z>=0&&z<=K) ++res;
} 
}
cout << res <<endl;
}

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

int main(){
	ios::sync_with_stdio(false);
    long long n,k;
    cin>>n>>k;
    long long ans=(n/k)*(n/k)*(n/k);
    if(k%2==0){
        ans+=((n+k/2)/k)*((n+k/2)/k)*((n+k/2)/k);
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void solve(ll n,ll m,vector<ll> a) {
  vector<ll> v;
  map<ll,ll> ma;
  rep(i,n*m) {
    ll x=a[i%n];
    if(!ma[x]) {
      v.pb(x);
      ma[x]++;
    } else {
      while(v.size()&&ma[x]) {
        ma[v.back()]--;
        v.pop_back();
      }
    }
    //cout << i << "   ";PR(v,v.size());
  }
  PR(v,v.size());
}

void Main() {
  ll n,m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i,n) R a[i];
  //solve(n,m,a);
  rep(i,n) a.pb(a[i]);
  ll d[n];
  memset(d,-1,sizeof(d));
  map<ll,ll> ma;
  rrep(i,a.size()) {
    if(i<n) d[i]=ma[a[i]];
    ma[a[i]]=i;
  }
  ll x=0,ans=0;
  vector<P> g;
  while(x!=n&&x!=n*2) {
    x%=n;
    g.pb(P(d[x]+1-x,x));
    x=d[x]+1;
    ans+=g.back().F;
  }
  m=(m*n)%ans;
  //if(!m) m=ans;
  vector<P> p;
  p.pb(P(0,-1));
  rep(i,g.size()) p.pb(P(g[i].F+p.back().F,g[i].S));
  //rep(i,p.size()) pr(p[i].F,p[i].S);
  ll k=upper_bound(all(p),P(m,MAXL))-p.begin();
  vector<ll> v;
  ma.clear();
  REP(i,p[k-1].F,m) {
    ll x=a[i%n];
    if(!ma[x]) {
      v.pb(x);
      ma[x]++;
    } else {
      while(v.size()&&ma[x]) {
        ma[v.back()]--;
        v.pop_back();
      }
    }
    //cout << i << "   ";PR(v,v.size());
  }
  PR(v,v.size());
}

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


Measured memory_bytes: 28128
#include <bits/stdc++.h>
using namespace std;
long long N, M, k;
int main() {
	//freopen("input.txt", "r", stdin);
	cin >> N >> M >> k;
	vector< long long > a(N + 3, 0LL), b(M + 3, 0LL);
	// a[0] = b[0] = 0;
	for (int i = 0; i < N; ++i){
		cin >> a[i];
		if(i)
			a[i] = a[i] + a[i-1];
		// a[i] += a[i-1];
	}
	for (int j = 0; j < M; ++j){
		cin >> b[j];
		if(j)
			b[j] += b[j-1];
	}

	long long ans = 0, j = M-1;

	for (int i = 0; i < N; ++i) {
		if(a[i] > k)
			break;
		while(j >= 0 && b[j] +a[i]> k)
			--j;
		//if(j>=0)
			ans = max(i+j+2, ans);
	}

	j = N - 1;
	for (int i = 0; i < M; ++i) {
		if(b[i] > k)
			break;
		while(j >= 0 && a[j] +b[i]> k)
			--j;
		//if(j >= 0)
			ans = max(i+j+2, ans);
	}


	// /for (int i = 1; i )
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 6424