akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int digit = 0;
		
		if (N >= 10) {
			digit = N % 10;
		}else {
			digit = N;
		}
		
		if (digit == 3) {
			System.out.println("bon");
		}else if (digit == 0 || digit == 1 || digit == 6 || digit == 8) {
			System.out.println("pon");
		}else {
			System.out.println("hon");
		}
	}
}

Measured memory_bytes: 35752
#include <iostream>
#include <cstdio>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <vector>
#include <memory.h>
#include <algorithm>
#define case        printf("Case %d: ",++tc);
#define read        freopen("tst.txt","r",stdin)
#define write       freopen("out.txt","w",stdout)
typedef long long ll;
using namespace std;
#define pi acos(-1)
#define mx 200001
int tree[mx*4],N,ar[mx];

void build(int n = 0,int l = 0,int r = N){
    if(l==r){
        tree[n] = ar[l];
        return;
    }
    int L = 2*n+1,R = L+1,m = l+r>>1;
    build(L,l,m);
    build(R,m+1,r);
    tree[n] = max(tree[L],tree[R]);
}

int query(int ql,int qr,int n = 0,int l = 0,int r = N){
    if(r<ql || qr<l)    return 0;
    if(ql<=l && r<=qr)  return tree[n];
    int L = 2*n+1,R = L+1,m = l+r>>1;
    return max(query(ql,qr,L,l,m),query(ql,qr,R,m+1,r));
}

main(){
int t,tc = 0;

scanf("%d",&N);
for(int i  = 0; i<N; i++)   cin>>ar[i+1];
build();
for(int i = 1; i<=N; i++){
    int a = query(0,i-1),b = query(i+1,N);
    cout<<max(a,b)<<endl;
}

return 0;
}



Measured memory_bytes: 4480
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
using namespace std;
using ll = long long;
using ld = long double;
ll mod = ll(1e9)+7;
ll inf = ll(5e18);
template<typename T1, typename T2> ll ceill(T1 a, T2 b){ return (a+b-1)/b; }
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) for (auto vvv : vv) cout << vvv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class DDigitSumReplace {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int m;
	    in >> m;
	    ll d, c;
	    ll keta = 0, sum = 0;
	    for(int i=0; i<m; i++){
	        in >> d >> c;
	        keta += c;
            sum += d * c;
	    }

	    out << (keta - 1) + (sum - 1) / 9 << endl;
	}
};


int main() {
	DDigitSumReplace solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
int n, h;
vector<int> a, b;

int main() {
    int x, y, z=-1;
    scanf("%d%d",&n,&h);
    
    for(int i = 0; i < n; i++){
        scanf("%d%d",&x,&y);
        a.push_back(x);
        z = max(z, x);
        b.push_back(y);
    }
    sort(begin(b), end(b));
    int c = 0;
    for(int i = n-1; i >=0; i--){
        if(b[i] < z || h <= 0)break;
        h -= b[i];
        c++;
    }
    if(h > 0)c += h / z + (h % z != 0);
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 1276
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
class Simple {
    private string S;
    void Solve() {
        //input
        S = io.String;
        //cal        
        //AB
        if(S.Length == 2) {
            if(S[0]==S[1])
                Console.WriteLine(1 + " " + 2);
            else
                Console.WriteLine(-1 + " " + (-1));
            return;
        }
        //AA?
        if(S[0] == S[1] && S[1] != S[2]) {
            Console.WriteLine(1 + " " + 3);
            return;
        }
        //?AA
        for(int i = 2; i < S.Length; ++i) {
            if(S[i - 2] != S[i - 1] && S[i - 1] == S[i]) {
                Console.WriteLine((i - 1) + " " + (i + 1));
                return;
            }
        }
        //A?A
        for(int i = 2; i < S.Length; ++i) {
            if(S[i - 2] != S[i - 1] && S[i - 2] == S[i]) {
                Console.WriteLine((i - 1) + " " + (i + 1));
                return;
            }
        }
        //none
        Console.WriteLine(-1 + " " + (-1));
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] {' '};
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if(BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while(st == "") st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


Measured memory_bytes: 11744
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    multiset<int> s[20];
    rep(i, 20) {
        s[i].insert(-1);
        s[i].insert(-1);
        s[i].insert(n);
        s[i].insert(n);
    }
    rep(i, n) rep(j, 20) {
        if (a[i]>>j&1) s[j].insert(i);
    }
    ll ans = 0;
    rep(i, n) {
        int l = i;
        int r = n;
        rep(j, 20) {
            auto it = s[j].lower_bound(i);
            it++;
            chmin(r, *it);
        }
        ans += (ll)(r-l);
    }
    
    
    cout << ans << endl;
    return 0;
}


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

#define N_MAX 200005

using namespace std;

int N, M;
bool taken[N_MAX];
set <int> dist;
pair <int, int> ans[N_MAX];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> N >> M;

    int half = N / 2;
    int L = 0;
    for(int i = 1, j = half; i < j; i++, j--) {
        ans[L++] = make_pair(i, j);
    }

    for(int i = half + 1, j = N - (N % 2 == 0); i < j; i++, j--) {
        ans[L++] = make_pair(i, j);
    }


    for(int i = 0; i < M; i++) {
        cout << ans[i].first << " " << ans[i].second << "\n";
    }
    return 0;
}


Measured memory_bytes: 4332
def gcd(a,b)
    a,b = b,a%b while b > 0
    a
end

def lcm(a, b)
  a*b/gcd(a, b)
end

n=gets.to_i
as=gets.split.map(&:to_i)

g=as.inject(1){|res, a| lcm(res,a)}

ans=0
as.each do |a|
  ans+=g/a
end
p ans%1000000007


Measured memory_bytes: 75644
# coding:utf-8

import sys

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n, x = LI()

    if x == 1 or x == 2 * n - 1:
        print('No')
        return 0

    print('Yes')
    if n < 3:
        print(*[n for n in range(1, 2 * n)], sep='\n')
        return 1

    # n段目の中心に[x-1, x, x+1]を置く
    tmp = [x - 1, x, x + 1]

    remain = list(set([n for n in range(1, 2 * n)]) - set(tmp))
    k = n - 2
    tmp = remain[:k] + tmp + remain[k:]
    print(*tmp, sep='\n')

    return 1


main()


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

int main() {
  string N;
  cin>>N;
  
  char ans=N.at(N.size()-1);
  
  if(ans=='2'||ans=='4'||ans=='5'||ans=='7'||ans=='9'){
    cout<<"hon"<<endl;
  }
  else if(ans=='0'||ans=='1'||ans=='6'||ans=='8'){
    cout<<"pon"<<endl;
  }
  
  else{
    cout<<"bon"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3596
N = int(input())
S = input()
dp = [0]*(N+1)
dp[0] = 0
for i in range(N):
    if i < N-1 and S[i] != S[i+1]:
        dp[i+2] = dp[i]+1
    dp[i+1] = max(dp[i+1], dp[i])
print(dp[N])


Measured memory_bytes: 9648
program abc158c
   implicit none
   integer::A,B,i,x=0
   real,parameter::eps=0.0000001

      read *,A,B
      do i=1000,1,-1
         if(int((0.08+eps)*i)==A) then
            if(int((0.10+eps)*i)==B) then
               x=i
            end if
         end if
      end do

      if (x/=0) then
         print *,x
      else
         print *,'-1'
      end if
      stop

   end program abc158c

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import Counter
def main():
    N = int(input())
    cnt_list = []
    for _ in range(N):
        S = input().rstrip()
        cnt_list.append(S)
    cnt_list = Counter(cnt_list)
    keys = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
    for k, v in cnt_list.items():
        keys[k] = v
    print('AC', 'x', keys['AC'])
    print('WA', 'x', keys['WA'])
    print('TLE', 'x', keys['TLE'])
    print('RE', 'x', keys['RE'])
if __name__ == "__main__":
    main()

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

char str[200005];
int num[40],n;
long long ans;

int main(){
	scanf("%s",str+1); n=strlen(str+1);
	for(int i=n;i>=1;--i) ans+=(n-i)-num[str[i]-'a']++;
	printf("%lld",ans+1);
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	double a_d,b_d;
	scanf("%d %d",&a,&b);
	a_d = static_cast<double>(a);
	b_d = static_cast<double>(b);
	printf("%d %d %.5f\n",a/b,a%b,a_d/b_d);
}



Measured memory_bytes: 2764
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>

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

typedef long long ll;

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout<<setprecision(10);
  int a,b,c;
  cin>>a>>b>>c;
  if(a*c<=b)cout<<c<<endl;
  else cout<<b/a<<endl;


  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pil pair<int,long long>
#define pli pair<long long,int>
#define pll pair<long long,long long>
#define pb push_back
#define mk make_pair
#define sd(x) scanf("%d", &x)
#define pd(x) printf("%d\n",x)
#define pdl(x) printf("%lld\n",x)
#define sdl(x) scanf("%lld", &x)
#define eps 1e-12l
#define maxn 100009
using namespace std;
int main()
{
	int n;
	sd(n);
	map<ll,int> mp;
	ll a[n],b[n];
	for(int i=0;i<n;i++)
	{
		sdl(a[i]);
		mp[a[i]]=i;
		b[i]=a[i];
	}
	ll ans=0;
	sort(b,b+n);
	for(int i=0;i<n;i++)
	{
		int x=mp[b[i]]-i;
		if(x%2)
		{
			ans++;
		}
	}
	ans++;
	ans=ans/2;
	pdl(ans);
}

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

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}

template <typename T> inline bool CheckMax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}

template <typename T> inline bool CheckMin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}

const int N = 300005;
const int mod = 998244353;

int n, a, b, fac[N], inv[N];
LL k;

inline int C(int x, int y) {
  return 1LL * fac[x] * inv[y] % mod * inv[x - y] % mod;
}

int main() {
#ifdef wxh010910
  freopen("d.in", "r", stdin);
#endif
  Read(n), Read(a), Read(b), Read(k);
  fac[0] = fac[1] = inv[0] = inv[1] = 1;
  for (int i = 2; i <= n; ++i) {
    fac[i] = 1LL * fac[i - 1] * i % mod;
    inv[i] = 1LL * (mod - mod / i) * inv[mod % i] % mod;
  }
  for (int i = 2; i <= n; ++i) {
    inv[i] = 1LL * inv[i - 1] * inv[i] % mod;
  }
  int ans = 0;
  for (int i = 0; i <= n && k >= 0; ++i, k -= a) {
    if (k % b == 0) {
      LL t = k / b;
      if (t >= 0 && t <= n) {
        ans = (1LL * C(n, i) * C(n, t) + ans) % mod;
      }
    }
  }
  printf("%d\n", ans);
#ifdef wxh010910
  Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N,M,tmp;
    cin >> N>>M;
    for(int i=0;i<M;i++){
        cin >> tmp;
        N -= tmp;
    }
    if(N <0)
        cout << -1 << "\n";
    else
        cout << N <<"\n";
    return 0;
}

Measured memory_bytes: 3656
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

ll GCD(ll a, ll b) {
  if (b == 0)
    return a;
  return GCD(b, a % b);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll K;
  cin >> K;
  ll sum = 0;
  FOR(i, 1, K + 1) FOR(j, 1, K + 1) FOR(k, 1, K + 1) {
    sum += GCD(i, GCD(j, k));
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3652
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		new Main();	
	}

	public Main() {
		while(sc.hasNext()){
			new aoj0081().doIt();
		}
	}
	class aoj0081 {
		private Point2D sub(Point2D p2, Point2D p1) {
	        double x = p2.getX() - p1.getX();
	        double y = p2.getY() - p1.getY();
	        return new Point2D.Double(x, y);
		}
		private Point2D mul(double value, Point2D p) {
	        return new Point2D.Double(p.getX() * value, p.getY() * value);
	    }
		private Point2D add(Point2D p1, Point2D p2) {
	        double x = p2.getX() + p1.getX();
	        double y = p2.getY() + p1.getY();
	        return new Point2D.Double(x, y);
		}
		private double norm(Point2D p){
			return p.getX() * p.getX() + p.getY() * p.getY();
		}
		private double dot(Point2D p1, Point2D p2){
	        return p1.getX() * p2.getX() + p1.getY() * p2.getY();
	    }
		private Point2D projection(Line2D l, Point2D p){
			double t = dot(sub(p, l.getP1()), sub(l.getP1(), l.getP2())) / norm(sub(l.getP1(), l.getP2()));
			return add(l.getP1(), mul(t, sub(l.getP1(), l.getP2())));
		}
		
		void doIt() {
			String str[] = sc.nextLine().split(",");
			double ab[] = new double[6];
			for(int i = 0;i < 6;i++){
				ab[i] = Double.parseDouble(str[i]);
			}
			Point2D P1 = new Point2D.Double(ab[0],ab[1]);
			Point2D P2 = new Point2D.Double(ab[2],ab[3]);
			Point2D Q = new Point2D.Double(ab[4],ab[5]);
			Line2D AB = new Line2D.Double(P1,P2);
			Point2D sa = projection(AB,Q);
			Point2D ans = new Point2D.Double(Q.getX() - (2*(Q.getX() - sa.getX())),Q.getY() - (2*(Q.getY() - sa.getY())));
			System.out.println(ans.getX()+" "+ans.getY());
		}
	}
}

Measured memory_bytes: 17188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[3005][3005];
signed main()
{
   ll n, x = 0, y = 0;
   cin >> n;
   ll arr[n+10] = {0};
   for(ll i = 0; i < n; i++)cin >> arr[i+1];
   for(int win = 1; win <= n; win++){
       for(int l = 1, r = win; r <= n; r++, l++){
           if((n-win)%2 == 0){
               dp[l][r] = max(dp[l+1][r] + arr[l], dp[l][r-1] + arr[r]);
           }
           else {
               dp[l][r] = min(dp[l+1][r] - arr[l], dp[l][r-1] - arr[r]);
           }
       }
   }
    cout << dp[1][n];
}

Measured memory_bytes: 70016
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	S := sc.next()
	flags := true
	for i := 0; i < len(S)/2; i++ {
		// fmt.Println(string(S[i]), string(S[len(S)-i-1]))
		if S[i] != S[len(S)-i-1] {
			flags = false
			fmt.Println("No")
			return
		}
	}

	for i := 0; i < len(S)/2; i++ {
		if string(S[i]) != string(S[len(S)/2-i-1]) {
			flags = false
			fmt.Println("No")
			return
		}
	}

	for i := len(S) / 2; i < len(S); i++ {
		if string(S[i]) != string(S[len(S)-i-1]) {
			flags = false
			fmt.Println("No")
			return
		}
	}
	if flags {
		yes()
		return
	}
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 640
// 2011/06/04 Tazoe

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

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

	int amd[31];
	for(int i=1; i<=w; i++)
		amd[i] = i;

	int n;
	cin >> n;

	for(int i=0; i<n; i++){
		string str;
		cin >> str;

		for(int j=0; j<str.size(); j++)
			if(str[j]==',')
				str[j] = ' ';

		istringstream ist(str);
		int a, b;
		ist >> a >> b;

		int tmp = amd[a];
		amd[a] = amd[b];
		amd[b] = tmp;
	}

	for(int i=1; i<=w; i++)
		cout << amd[i] << endl;

	return 0;
}

Measured memory_bytes: 0
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var p = int.Parse(line[1]);
        var s = Console.ReadLine().Trim();
        var a = new int[n];
        var pow = 1;
        for (int i = 0; i < n; i++)
        {
            var w = s[n - 1 - i] - '0';
            if (i != 0) pow *= 10;
            pow %= p;
            a[i] = (w * pow) % p;
        }
        if (p == 2 | p == 5) getAns25(n, p, s);
        else getAns(n, p, a);
    }
    static void getAns25(int n, int p, string s)
    {
        var ans = 0L;
        for (int i = 0; i < n; i++)
        {
            var w = (s[n -1-   i] - '0') % p;
            if (w == 0) ans += n - i;
        }
        Console.WriteLine(ans);
    }
    static void getAns(int n, int p, int[] a)
    {
        var d = new Dictionary<int, long>();
        d[0] = 1;
        var pre = 0;
        for (int i = 0; i < n; i++)
        {
            var t = (pre + a[i]) % p;
            if (d.ContainsKey(t)) d[t]++;
            else d[t] = 1;
            pre = t;
        }
        var ans = 0L;
        foreach (var x in d)
            if (x.Value >= 2) ans += (x.Value * (x.Value - 1)) / 2L;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 15712
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){int i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}

ll cul(ll X){
  ll ret=0;
  while(X>2){X=(X-1)/2; ret++;}
  return ret;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll X;
  cin>>X;
  ll lf=1,rg=1e18;
  while(rg-lf>1){
    ll mid=(lf+rg)>>1;
    if(cul(mid)>X){rg=mid;}
    else{lf=mid;}
  }
  cout<<lf<<endl;

  return 0;
}


Measured memory_bytes: 256
package main

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

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for B - Friendly Rabbits
	var N int
	fmt.Scan(&N)

	sc.Split(bufio.ScanWords)
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = nextInt() - 1
	}

	var ans int
	for i := 0; i < N; i++ {
		if a[i] > i {
			if a[a[i]] == i {
				ans++
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 3228
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    a, b = i_map()

    if a % 3 == 0:
        print('Possible')
        exit()

    if b % 3 == 0:
        print('Possible')
        exit()

    if (a+b) % 3 == 0:
        print('Possible')
        exit()

    print('Impossible')

if __name__ == '__main__':
    main()


Measured memory_bytes: 76916
import java.util.*;
import java.io.*;
public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		int n=Integer.parseInt(in.next());
		
		for(int i=0;i<n;i++) {
			int Y=Integer.parseInt(in.next()),M=Integer.parseInt(in.next()),D=Integer.parseInt(in.next());
			int res=0;
			
			int d;
			if(Y%3==0 || (Y%3!=0 && M%2==1))d=20;
			else d=19;
			for(int j=D;j<=d;j++) {
				res++;
			}
			M++;
			
			int m[]=new int[2];
			if(Y%3==0) {
				m[0]=20;
				m[1]=20;
			}
			else {
				m[0]=19;
				m[1]=20;
			}
			
			for(int j=M;j<=10;j++) {
				res+=m[j%2];
			}
			
			Y++;
			
			for(int j=Y;j<=999;j++) {
				res+=(j%3==0)? 200:195;
			}
			
			out.println(res);
		}
		out.flush();
	}
}



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

int god(int x, int y){
  int r;
  if(x < y) swap(x, y);
  while(y > 0){
    r = x % y;
    x = y;
    y = r;
  }
  return x;
}

int main(){
  int x, y;
  cin >> x >> y;
  cout << god(x, y) << "\n";
  return 0;
}



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

int main() {
	int N, K;
	cin >> N >> K;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		int x;
		cin >> x;
		ans += 2 * (K - x > x ? x : K - x);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
program main
    integer :: c(3,3), d

    read(*,*) c(:,1)
    read(*,*) c(:,2)
    read(*,*) c(:,3)

    d=c(2,1)-c(1,1)
    if(d==c(2,2)-c(1,2).and.d==c(2,3)-c(1,3))then
        d=c(3,1)-c(2,1)
        if(d==c(3,2)-c(2,2).and.d==c(3,3)-c(2,3))then
            d=c(3,1)-c(1,1)
            if(d==c(3,2)-c(1,2).and.d==c(3,3)-c(1,3))then
                write(*,*) 'Yes'
                stop
            endif
        endif
    endif
    
    write(*,*) 'No'
    
end program

Measured memory_bytes: 768
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), nextInt()
	fmt.Println(n - k + 1)
}


Measured memory_bytes: 640
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#pragma GCC optimize("Os")
#pragma GCC target("avx2,fma")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("Os")
*/
 
#include <bits/stdc++.h>
//#include <windows.h>
 
#define ll long long
#define X first
#define Y second
#define MP make_pair
 
using namespace std;
 
    /*
const int MAX_MEM = 1e8;
int mpos=0;
char mem[MAX_MEM];
inline void * operator new(size_t n){
	char *res = mem + mpos;
	mpos += n;
	assert(mpos <= MAX_MEM);
	return (void *)res;
}
 
inline void operator delete(void *){}
    */

const int N = 2e5 + 123;
const ll mod = 1e9 + 7;

int n;
ll a[N], res, pr[N];

int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin >> n;
	for(int i = 1;i <= n;i++){
		cin >> a[i];
		pr[i] = pr[i - 1] + a[i];
		//cout << pr[i] << "\n";
	}

	pr[n + 1] = pr[n];
	
	for(int i = 1, j = 0;i <= n + 1;i++){
		if(a[i] == 0){
			//cout << j << " " << i << " " << pr[i] - pr[j] << "\n";
			res += (pr[i] - pr[j]) / 2;
			j = i;
		}
	}

	cout << res;

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,x=0,n=0;
	scanf("%d",&k);
	while(1)
	{
		x=(x*10+7)%k;
		n++;
		if(x%k==0)
		{
			printf("%d\n",n);
			return 0;
		}
		if(n==10000000)
			break;
	}
	puts("-1");
	return 0;
}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;	// 998244353
using ll = long long;
using namespace std;

int main(){
	int h, w, n, sr, sc; cin >> h >> w >> n >> sr >> sc;
	--sr; --sc;
	int l = 0, r = w, u = 0, d = h;
	string s, t; cin >> s >> t;
	for( int i = n-1; i >= 0; --i ){
		// Aoki
		if( t[i] == 'L' ) r = min(w, r+1);
		if( t[i] == 'R' ) l = max(0, l-1);
		if( t[i] == 'U' ) d = min(h, d+1);
		if( t[i] == 'D' ) u = max(0, u-1);
		// Takahaschi
		if( s[i] == 'L' ) l = min(w, l+1);
		if( s[i] == 'R' ) r = max(0, r-1);
		if( s[i] == 'U' ) u = min(h, u+1);
		if( s[i] == 'D' ) d = max(0, d-1);
		if( l == r or u == d ){
			cout << "NO" << endl;
			return 0;
		}
	}
	if( u <= sr and sr < d and l <= sc and sc < r ) cout << "YES" << endl;
	else cout << "NO" << endl;
}

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

const double EPS = 0.0000001;

class Produce {
public:
	string name;
	int P, A, B, C, D, E, F, S, M;
	double eff;

	bool operator < (const Produce& obj) const
	{
		if (fabs(eff - obj.eff) <= EPS) {
			return name > obj.name;
		}

		return eff < obj.eff;
	}
};

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

		if (N == 0) {
			break;
		}

		vector<Produce> produces(N);

		for (int i = 0; i < N; i++) {
			cin >> produces[i].name >> produces[i].P >> produces[i].A >> produces[i].B >> produces[i].C >> produces[i].D >> produces[i].E >> produces[i].F >> produces[i].S >> produces[i].M;
		}

		for (int i = 0; i < N; i++) {
			int time = produces[i].A + produces[i].B + produces[i].C;
			for (int j = 0; j < produces[i].M; j++) {
				time += produces[i].D + produces[i].E;
			}

			produces[i].eff = ((double)produces[i].S*produces[i].F*produces[i].M - produces[i].P) / time;
		}

		sort(produces.rbegin(), produces.rend());

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

		cout << "#" << endl;
	}

	return 0;
}

Measured memory_bytes: 3152
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    string s;
    cin >> s;
    vector<int> a(4);
    for (int i=0; i<4; i++) a[i] = s[i] - '0';

    string ans;
    for (int i=0; i<(1<<3); i++) {
        int cnt = a[0];
        string tmp = to_string(a[0]);
        for (int j=0; j<3; j++) {
            if (i>>j&1) {
                cnt += a[j+1];
                tmp += "+" + to_string(a[j+1]);
            }
            else {
                cnt -= a[j+1];
                tmp += "-" + to_string(a[j+1]);
            }
        }
        if (cnt == 7) ans = tmp;
    }

    cout << ans << "=7" << endl;
}

Measured memory_bytes: 888
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = interact f

f [] = [ '\n' ]
f [a] = [a]
f ( a : b : s ) = a : f s



Measured memory_bytes: 1020
#coding:utf-8

def main():
    n = int(raw_input())
    a_list = map(int, raw_input().split())

    ans = 0
    bin = {}
    for a in a_list:
        if a not in bin:
            bin[a] = 1
        else:
            bin[a] += 1
        if bin[a] > a:
            ans += 1
    for k in bin.keys():
        if bin[k] < k:
            ans += bin[k]
    
    print ans
        

if __name__=="__main__":
    main()


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

int main()
{
  double n;
  char str_i[8];
  char str_d[4];
  int inte;
  double dou;
  double po;
  int flag;

  while(1){
    cin >> n;
    if(n < 0) break;

    flag = 0;

    //nを整数部と小数部に分解
    inte = (int)n;
    dou = n - (double)inte;

    //整数部を二進数変換
    if(inte >= 256){
      flag = 1;
    }else{
      for(int i = 0;i < 8;++i){
	if(inte % 2){
	  str_i[i] = '1';
	}else{
	  str_i[i] = '0';
	}
	inte /= 2;
      }
    }

    /*
    for(int i = 0;i < 8;++i){
      cout << str_i[7 - i];
    }
    cout << endl;
    */

    if(!flag){
      for(int i = 0;i < 4;++i){
	if(dou * 2 >= 1.0){
	  str_d[i] = '1';
	  dou = dou * 2.0 - 1.0;
	}
	else{
	  str_d[i] = '0';
	  dou *= 2.0;
	}
      }
      if(dou != 0) flag = 1;
    }

    /*
    for(int i = 0;i < 4;++i){
      cout << str_d[i];
    }
    cout << endl;
    */
    
    if(flag){
      cout << "NA" << endl;
    }else{
      for(int i = 0;i < 8;++i){
	cout << str_i[7 - i];
      }
      cout << '.';
      for(int i = 0;i < 4;++i){
	cout << str_d[i];
      }
      cout << endl;
    }

  }

  return 0;
}



Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#include <bitset>
#define M 1000000007
#define M1 998244353

#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define fast                        \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

ll power(ll x, ll n)
{
    ll result = 1;
    while (n)
    {
        if (n % 2 == 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}

ll gcd(ll a, ll b)
{
    if (!b)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}

inline ll mul(ll x, ll y, ll m)
{
    ll z = 1LL * x * y;
    if (z >= m)
    {
        z %= m;
    }
    return z;
}

ll powmod(ll x, ll y, ll m)
{
    ll r = 1;
    while (y)
    {
        if (y & 1)
        {
            r = mul(r, x, m);
        }
        y >>= 1;
        x = mul(x, x, m);
    }
    return r;
}



void start()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
/***********************************************************************************************************/

int main()
{
    start();
    ll n, k;
    cin>>n>>k;
    ll ans=k*pow(k-1, n-1);
    cout<<ans;


    return 0;
}

Measured memory_bytes: 4000
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
now = 1
count = 0
flag = 0
for i in range(len(li)):
    if li[i] == 1:
        flag = 1
    if li[i] == now:
        now += 1
    else:
        count += 1
if flag == 0:
    print(-1)
    exit()
else:
    print(count)

Measured memory_bytes: 26012
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

N,Y = map(int, input().split())

a = b = c = -1
for i in range((Y//10000)+1):
    for j in range((Y-10000*i)//5000+1):
        s = 10000*i + 5000*j + 1000*(N-i-j)
        if s == Y:
            a,b,c = i,j,N-i-j
            
print(a,b,c)

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(int i=cc;i>=n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
   int n;
   cin >> n;
   vector<ll>a(n);
   ll ans = 0;
   rep(i, 0, n)cin >> a[i];
   if(a[0]!=0){
       cout << -1 << endl;
       return 0;
   }
   rrep(i, n-1, 1){
       ans += a[i];
       while(a[i]-a[i-1]==1){
           i--;
       }
       if(a[i]-a[i-1]>1){
           cout << -1 << endl;
           return 0;
       }
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 4824
function main(input) {
    var N = input[0]-0;
    var D = input[1].split(" ")[0]-0;
    var X = input[1].split(" ")[1]-0;
    var ans = X;
    for(var i=2;i<2+N;i++){
        ans += Math.ceil(D/input[i]);
    }
    console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 7372
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

int N, K;
int a, b, c, d;

int main(){
	cin >> N>>K;
	while (N) {
		int cost[101][101] = {};
		for (int i = 0; i < K; i++) {
			cin >> a;
			if (a) {
				cin >> b >> c >> d;
				if (cost[b][c])cost[b][c] = min(cost[b][c], d);
				else cost[b][c] = d;
				cost[c][b] = cost[b][c];
			}
			else {
				cin >> b >> c;
				queue<int>Q;
				int dis[101];
				for (int j = 0; j <= N; j++) {
					dis[j] = INT_MAX;
				}
				dis[b] = 0;
				Q.push(b);
				while (!Q.empty()) {
					for (int j = 1; j <= N; j++) {
						if (!cost[Q.front()][j])continue;
						if (dis[Q.front()] + cost[Q.front()][j] >= dis[j])continue;
						dis[j] = dis[Q.front()] + cost[Q.front()][j];
						Q.push(j);
					}
					Q.pop();
				}
				if (dis[c] == INT_MAX)cout << "-1\n";
				else cout << dis[c] << endl;
			}
		}
		cin >> N>>K;
	}
	return 0;
}

Measured memory_bytes: 3072
def L_common(str1,str2):
    d = [0 for i in range(len(str2)+1)]
    
    for n1 in str1:
        tmp = d[:]
        for (j,n2) in enumerate(str2):
            if n1 == n2:
                d[j+1] = tmp[j]+1
            elif d[j+1]<d[j]:
                d[j+1] = d[j]
    return d[len(str2)]

n = int(input())
stock = []
for i in range(n):
    x = input()
    y = input()
    stock.append(L_common(x,y))

for i in stock:
    print(i)


Measured memory_bytes: 5632
#include <iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
#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++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1<<30;
const int mod=1000000007;    
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

ll gcd(ll x,ll y){
  if(x<y)swap(x,y);
  if(x%y)return gcd(y,x%y);
  return y;
  }
bool dp(int n,vector<ll> v){
  ll sum=0 ,cnt=0;
  rep(i,v.size()){
    sum+=v[i];
    sum%=2;
    if(v[i]&1)cnt++;
    }
  if(sum){
    if(!(n&1)) return true;
    if(cnt>2)return false;
    if(v[0]==1)return false;
    rep(i,n){
      if(v[i]&1)v[i]--;
      }
    ll g=v[0];
    rep(i,n-1)g=gcd(g,v[i+1]);
    rep(i,n)v[i]/=g;
    return !dp(n,v);
    }
  else{
    if(n%2)return true;
    return false;
    }
  }

    
int main(){
  int n;cin>>n;
  ll a[n];
  vector<ll> v;
  rep(i,n){
    cin>>a[i];
    }
  sort(a,a+n);
  rep(i,n)v.push_back(a[i]);
  if(dp(n,v))cout<<"First"<<endl;
  else cout<<"Second"<<endl;
  return 0;
  }


Measured memory_bytes: 20724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int>> ;
using GraphEdge = vector<vector<int>> ;
long long modinv(long long a, long long m=MOD) {long long b = m, u = 1, v = 0;while (b) {    long long t = a / b;    a -= t * b; swap(a, b);    u -= t * v; swap(u, v);}u %= m; if (u < 0) u += m;return u;}
//MODの割り算の際にa/＝b;をa *= modinv(b,MOD);とする。
int gcd(int a, int b){if (a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}
 
int main(){
    ll a,b,c,d;cin >> a >> b >> c >> d;
    ll tmp1 = a*c, tmp2 = a * d, tmp3 = b * c, tmp4 = b * d;
    ll ma = max(tmp1, max(tmp2, max(tmp3,tmp4)));
    cout <<ma << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;


int main(){
  int n;
  double d1=0,d2=0,d3=0,d4=0;
  vector<double>x,y,z;
  cin >> n;
  x.resize(n);
  y.resize(n);
  z.resize(n);
  cout <<fixed << setprecision(10);

  for(int i=0;i<n;i++){
    cin >> x[i];
  }
  for(int i=0;i<n;i++){
    cin >> y[i];
    z[i] = fabs(x[i]-y[i]);
  }


  for(int i=0;i<n;i++){
     d1 += z[i];
  }
  cout << d1 << endl;

  for(int i=0;i<n;i++){
    d2 += z[i]*z[i];
  }
  d2 = sqrt(d2);
  cout << d2 <<endl;
  
  for(int i=0;i<n;i++){
    d3 += z[i]*z[i]*z[i];
  }
  d3 =cbrt(d3);
  cout << d3 << endl;
  for(int i=0;i<n;i++){
    if(d4 < z[i]){
      d4 = z[i];
    }
  }
  cout << d4 << endl;
  return 0;
}
     




Measured memory_bytes: 3472
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int n, r;
    cin >> n >> r;
    
    if (n >= 10) {
        cout << r << endl;
    } else {
        cout << r + 100*(10-n) << endl;
    }



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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
vector<pair<int,int>> vt;
int main(){
	//freopen("in.txt","r",stdin);
	cin>>n;
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>s;
		int cnt=0;int low=0;
		for(char c:s){
			if(c=='('){
				cnt++;
			}else cnt--;
			low=min(low,cnt);
		}
		vt.emplace_back(cnt,low);
		sum+=cnt;
	}
	if(sum!=0) {
		puts("No");return 0;
	}
	sort(vt.begin(),vt.end(),[](pair<int,int> pii1,pair<int,int> pii2){return min(pii1.second,pii1.first+pii2.second) > min(pii2.second,pii2.first+pii1.second);});
	int foo=0;
	for(pair<int,int> pii:vt){
		if(foo<-pii.second){
			puts("No");
			return 0;
		}foo+=pii.first;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 11556
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
int main(){
    int n;cin >> n;
    int count4=0,count2=0,count1=0;
    rep(i,n){
        int a;cin >> a;
        if(a%4==0)count4++;
        if(a%4!=0&&a%2==0)count2++;
        if(a%2==1)count1++;
    }
    if(count2==0){
        if(count4>=count1-1){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        if(count4>=count1){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 256