akhauriyash/Code-Regression huggingface dataset:
/*=============================================================================================================================/*
                                               Bismillahir Rahmanir Rahim

      _     ____  ___  ____   _   _  _         ___  ____   _         _     __  __
     / \   / ___||_ _|| __ ) | | | || |       |_ _|/ ___| | |       / \   |  \/  |
    / _ \  \___ \ | | |  _ \ | | | || |        | | \___ \ | |      / _ \  | |\/| |
   / ___ \  ___) || | | |_) || |_| || |___     | |  ___) || |___  / ___ \ | |  | |
  /_/   \_\|____/|___||____/  \___/ |_____|   |___||____/ |_____|/_/   \_\|_|  |_|

   _   __           __  __  __
  |_) (_  _  o__   /   (_  |_
  |_)o__)(_  || |  \__ __) |__

    ___                    _   _      _                _ _               __   ___                 _         _        _
   / __|_ _ ___ ___ _ _   | | | |_ _ (_)_ _____ _ _ __(_) |_ _  _   ___ / _| | _ ) __ _ _ _  __ _| |__ _ __| |___ __| |_
  | (_ | '_/ -_) -_) ' \  | |_| | ' \| \ V / -_) '_(_-< |  _| || | / _ \  _| | _ \/ _` | ' \/ _` | / _` / _` / -_|_-< ' \
   \___|_| \___\___|_||_|  \___/|_||_|_|\_/\___|_| /__/_|\__|\_, | \___/_|   |___/\__,_|_||_\__, |_\__,_\__,_\___/__/_||_|
                                                            |__/                           |___/


   FB: https://facebook.com/SIAsibul
   Gmail: asibulislam8@gmail.com

/*=============================================================================================================================*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vii;
typedef vector<pil> vil;
typedef vector<pli> vli;
typedef vector<pll> vll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,n) for(ll i=0;i<(n);i++)
#define f1(i,n) for(ll i=1;i<=(n);i++)
#define f2(i,a,n) for(ll i=(a);i<=(n);i++)
#define fr(i,n,a) for(ll i=(n);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))
#define nl "\n"


const int INF = 1e9 + 5;
const int MXN = 2e5 + 5;
const int MOD = 1e9 + 7;

int solve(){
    int a[5];
    f0(i, 5){
        cin >> a[i];
        if(a[i] == 0) return cout << i+1 << nl, 0;
    }
    cout << 0 << nl;
}

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


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll = long long int;

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



}

Measured memory_bytes: 256
#include <stdio.h>

int last;
char map[40000][20000];

int existPool(int,int);
int getArea(int,int,int);
void setNext(int* i,int* j);

int main(){
  int tmp, i = 19999, j = 0, k = 0;
  int pool[10000], n = 0;
  char pre, s[20000], c;

  //input

  scanf("%s",s);
  map[i][j] = s[k++];
  pre = map[i][j];
  
  while( (c = s[k++]) != '\0'){
    if(pre == '/'){
      if(c == '\\')j++;
      else{ i--; j++; }
    }

    else if(pre == '\\'){
      if(c == '\\'){ i++; j++; }
      else j++;
    }

    else{
      if(c == '\\'){ i++; j++; }
      else j++;
    }
    
    map[i][j] = c;
    pre = c;
  }

  //simulation
  
  last = j+1;
  i = 19999;
  
  for(j = 0; j < last; j++){
    
    if(map[i][j] == '\\'){
      tmp = existPool(i,j);
      if(tmp > j){
	pool[n] = getArea(i,j,tmp);
	n++;
	k = tmp;
	setNext(&i,&k);
	j = tmp;
      }
      
      else{
	k = j;
	setNext(&i,&k);
      }
    }
    
    else{
      k = j;
      setNext(&i,&k);
    }
    
  }

  //output

  tmp = 0;
  for(i = 0; i < n; i++){
    tmp += pool[i];
  }

  printf("%d\n%d",tmp,n);
  for(i = 0; i < n; i++){
    printf(" %d",pool[i]);
  }
  printf("\n");

  return 0;
}

int existPool(int y, int x){
  int j = x, result = 0;
  
  while(1){
    j++;
    if(map[y][j] == '/'){
      result = 1;
      break;
    }
    if(j >= last-1) break;
  }

  if(result) return j;
  else return x;
}

int getArea(int y, int x0,int xt){
  int i = y, j, k, result = 0, harf = 0;

  for(j = x0; j <= xt; j++){
    if( (map[i][j] == '\\') || (map[i][j] == '/') ){
      result += (i-y);
      harf++;
    }
    else{
      result += (i-y+1);
    }

    k = j;
    setNext(&i,&k);
  }

  result += (harf/2);

  return result;
}

void setNext(int* i, int* j){
  int x, y;

  y = *i;
  x = *j;

    if(map[y][x] == '\\'){
      if(map[y+1][x+1] == '\\'){
	y++;
	x++;
      }
      else x++;
    }
    
    else if(map[y][x] == '/'){
      if(map[y][x+1] == '\\') x++;
      else{
	y--;
	x++;
      }
    }

    else{
      if(map[y+1][x+1] == '\\'){
	y++;
	x++;
      }
      else x++;
    }

    *i = y;
    *j = x;
  
}


Measured memory_bytes: 81824
#include <iostream>

using namespace std;
#define div 1000000007

int main() {
	int N, M;
	long long int Npata, Mpata;
	scanf("%d", &N);
	scanf("%d", &M);
	
	if((abs(N) - abs(M)) == 0){
		Npata = N;
		for (int i = N - 1; i > 0; i--) {
			Npata *= i;
			Npata %= div;
		}
		Mpata = M;
		for (int j = M - 1; j > 0; j--) {
			Mpata *= j;
			Mpata %= div;
		}
		printf("%d\n", (Npata*Mpata* 2)%div);
		
	
		
	}
	else if ((abs(N) - abs(M)) == 1 || (abs(N) - abs(M)) == -1) {
		Npata = N;
		for (int i = N - 1; i > 0; i--){
			Npata *= i;
		Npata %= div;
	}
		Mpata = M;
		for (int j = M - 1; j > 0; j--){
			Mpata *= j;
		Mpata %= div;
	}
		printf("%d\n", (Npata*Mpata)%div);
	}
	else {
			printf("%d\n", 0);
			
			
	}
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,p,b,sum;
  int card;
  cin >> n >> m >> p;
  while(n!=0){
    sum = 0;
    for(int i=0;i<n;i++){
      if(m-1==i){
        cin >> card;
        sum+=card;
      }else{
        cin >> b;
        sum+=b;
      }
    }
    if(card==0) cout << 0 << endl;
    else cout << (100-p)*sum/card << endl;
    cin >> n >> m >> p;



  }
}



Measured memory_bytes: 2980
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int x;cin>>x;
    if(30<=x)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3632
from collections import Counter
n = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

lst=[]
for i in range(n):
    lst.extend(prime_factorize(i+1))
lst=Counter(lst)
ans=1
INF=1000000007
for i in lst.values():
    ans*=i+1
    ans%=INF
print(ans)

Measured memory_bytes: 3316
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

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

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    map<lli,vi> a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>k;
    a[0].pb(0);
    cnt=0;
    repA(i,1,n)
    {
        cin>>in;
        cnt+=in-1;
        cnt%=k;
        a[cnt].pb(i);
    }

    dbg(k,a);
    lli ans=0;
    for(auto &x:a)
    {
        x.Y.pb(INF);
        const vi &b=x.Y;
        const lli n=sz(b);
        dbg(b);
        lli i=0,j=0;
        while(i<n-1)
        {
            while(j<n&&b[j]-b[i]<k)
                j++;
            ans+=j-i-1;
            dbg(i,j);
            // dbg(b[i],b[j]);
            i++;
        }
    }

    cout<<ans<<endl;

}   aryanc403();
    return 0;
}

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

int GCD(int A, int B) {
  if(A<B) {
    return GCD(B,A);
  }
  
  int R = A % B;
  
  if(R==0) {
    return B;
  } else {
    return GCD(B,R);
  }
}

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  
  int gcd = GCD(A,B);
  int i = gcd;
  int cnt = 0;
  while(gcd) {
    if(gcd%i==0) {
      cnt++;
      if(cnt==K) {
        cout << i << endl;
        break;
      }
    }
    i--;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	int x = c - a,y = d - b;
	
	REP(i,x)cout << 'R' ;
	REP(i,y)cout << 'U' ;
	REP(i,x)cout << 'L' ;
	REP(i,y+1)cout << 'D';
	REP(i,x+1)cout << 'R';
	REP(i,y+1)cout << 'U';
	cout << "LU";
	REP(i,x+1)cout << 'L';
	REP(i,y+1)cout << 'D';
	cout << 'R' << endl;	
	
	return 0;
}

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

public class Main{

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

	public static void solve(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int m = sc.nextInt();
			int nmin = sc.nextInt();
			int nmax = sc.nextInt();
			if(m==0 && nmin==0 && nmax==0){
				break;
			}
			int[] p = new int[m];
			for(int i=0;i<m;i++){
				p[i] = sc.nextInt();
			}
			Arrays.sort(p);
			
			int nans = 0;
			int gap = -1;
			for(int i=nmax;i>=nmin;i--){
				if(gap<p[m-i]-p[m-i-1]){
					nans = i;
					gap = p[m-i]-p[m-i-1];
				}
			}
			System.out.println(nans);
		}	
	}
}

Measured memory_bytes: 58068
a, b = map(int, input().split())

pa = int(a * 100/8)
pb = int(b * 100/10)

ans1 = None
ans2 = None

for price in range(pb-1, pa+2):
    if int(price * 0.08) == a and int(price * 0.1) == b:
        ans1 = price
        break

for price in range(pa-1, pb+2):
    if int(price * 0.08) == a and int(price * 0.1) == b:
        ans2 = price
        break

if ans1 is None and ans2 is None:
    print(-1)
elif ans2 is None:
    print(ans1)
elif ans1 is None:
    print(ans2)
else:
    print(min(ans1,ans2))


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int N, v[55];
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> v[i];
  }
  sort(v, v+N);
  double ret = v[0];
  for (int i=1; i<N; i++) {
    ret = (ret + v[i]) / 2.0;
  }
  printf("%.12f\n", ret);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
 
ll a[110000];
ll b[110000];
int main(){
    ll n,r;
    cin>>n>>r;
    if(n<10)cout<<r+(10-n)*100;
    else cout<<r;
    
}

Measured memory_bytes: 3604
#!/usr/bin/env python3
import sys
from collections import deque

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(N: int, M: int, L: "List[int]", R: "List[int]", D: "List[int]"):
    dist = [[] for _ in range(N+1)]
    value = [None for _ in range(N+1)] ## value[i] i+1の値

    ## あるノードとつながっている「ノードと距離」を入れていく
    for i in range(M):
        dist[L[i]].append((R[i],D[i]))
        dist[R[i]].append((L[i],-D[i]))

    def BFS(queue):
        while queue:
            q = queue.popleft()
            q_value = value[q]

            for node_number, distance in dist[q]:
                if value[node_number] == None:
                    value[node_number] = q_value+distance
                    queue.append(node_number)
                else:
                    if value[node_number] == q_value+distance:
                        continue
                    else: ##矛盾してるからあうと
                        print(NO)
                        sys.exit()
    
    for index, v in enumerate(value):
        if index == 0:
            continue
        if v == None and dist[index]: 
            value[index] = 0
            BFS(deque([index]))

    print(YES)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]"
    R = [int()] * (M)  # type: "List[int]"
    D = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
        D[i] = int(next(tokens))
    solve(N, M, L, R, D)

if __name__ == '__main__':
    main()


Measured memory_bytes: 70524
#include <bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;++a)
#define lb(x) ((x)&(-(x)))
using namespace std;
void Fly (int a,int b,int v) {
	if (a==b) {
		printf("%d ",a);
		return;
	}
	int x=lb(a^b);
	v^=x;
	int y=lb(v);
	Fly(a,a^y,v);
	Fly(a^y^x,b,v);
}
int main () {
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	if (__builtin_popcount(a^b)&1) {
		puts("YES");
		Fly(a,b,(1<<n)-1);
	}
	else puts("NO");
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<vector>
#include<list>
#include<map>
#include<unordered_map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

#define ld  long double
#define ll  long long int
#define ull unsigned long long int
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,s,n) for(int i=s;i<n;i++)
#define endl "\n"

const ll INF = 1LL << 60;
const ld EPS = 1e-11;

//切り上げ整数除算
int divRoundUp(const int& a, const int& b) { return (a + b - 1) / b; }
//四捨五入
int roundOff(const double& a) { return (int)(a + 0.5); }
// r の(誤差付きの)符号に従って, -1, 0, 1 を返す.
int sgn(const ld& r) { return (r > EPS) - (r < -EPS); }
// a, b の(誤差付きの)大小比較の結果に従って, -1, 0, 1 を返す.
int sgn(const ld& a, const ld& b) { return sgn(a - b); }
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;

inline void Main() {
	const ll mod = 1e9 + 7;
	int n, m; cin >> n >> m;
	vector<bool> a(n + 1, true);
	REP(i, m) {
		int t; cin >> t;
		a[t] = false;
	}

	vector<ll> dp(n + 1);
	dp[0] = 1;
	FOR(now, 0, n) {
		FOR(next, now + 1, min(n, now + 2) + 1) {
			if (!a[next])continue;
			dp[next] += dp[now];
			dp[next] %= mod;
		}
	}
	cout << dp[n] << endl;
}

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

	Main();

	return 0;
}

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

int main() {
	int n;
	cin >> n;
	int mn = 10000;
	for(int i=1;i<=n/2;i++)
	{
		int a = i,b = n - i;
		int c=0,d=0;
		while(a > 0)
		{
			c += a % 10;
			a /= 10;
		}
		while(b > 0)
		{
			d += b % 10;
			b /= 10;
		}
		mn = min(mn,c+d);
	}
    cout << mn << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
using namespace std;

int N, A, B;

int main() {
    cin >> N >> A >> B;
    vector<long long> v(N);
    map<long long, int> mp;
    for (int i = 0; i < N; i++) {
        cin >> v[i];
        mp[v[i]]++;
    }
    sort(v.begin(), v.end(), greater<long long>());
    
    vector<vector<long long>> pascal(N + 1, vector<long long>(N + 1, 1));
    for (int n = 1; n <= N; n++) {
        for (int r = 1; r < n; r++) {
            pascal[n][r] = pascal[n - 1][r - 1] + pascal[n - 1][r];
        }
    }
    
    if (v[0] == v[A - 1]) {
        cout << setprecision(18) << (double) v[0] << endl;
        long long c = 0;
        int n = mp[v[0]];
        for (int r = A; r <= min(B, n); r++) {
            c += pascal[n][r];
        }
        cout << c << endl;
        return 0;
    }
    
    int a = 0;
    long long sum = 0;
    for (int i = 0; i < A; i++) {
        long long tmp = v[i];
        sum += tmp;
        if (tmp == v[A - 1]) a++;
    }
    cout << setprecision(18) << (double) sum / (double) A << endl;
    cout << pascal[mp[v[A - 1]]][a] << endl;
}



Measured memory_bytes: 256
n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

s = [float('inf')] * n
s[0] = 0
for i in range(n):
    for j in range(i+1, min(i+k+1, n)):
        s[j] = min(s[j], s[i] + abs(h[i]-h[j]))

print(s[n-1])

Measured memory_bytes: 55008
//300
fun ac093(args: Array<String>) {
    val numList = listOf(0).plus(args[1].split(" ").map { it.toInt() }).plus(0)

    val expected = (1 until numList.size).map {
            Math.abs(numList[it] - numList[it - 1])
    }.sum()

    val ans = (1 until numList.size - 1).map {
        if (numList[it - 1] <= numList[it] && numList[it] <= numList[it + 1]
                || numList[it - 1] >= numList[it] && numList[it] >= numList[it + 1]) {
            expected
        } else {
            expected - Math.abs(numList[it] - numList[it - 1])- Math.abs(numList[it + 1] - numList[it]) + Math.abs(numList[it + 1] - numList[it - 1])
        }
    }

    ans.forEach { println(it) }
}

fun main(args: Array<String>) {
    ac093(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

Measured memory_bytes: 63916
/*
___ is a raging sadist.
*/

//Destroy all WA at test 2

#include <bits/stdc++.h>
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define pb push_back
#define show(x) cout << (#x) << " : " << x << endl;
#define ll long long
#define ld long double
#define pow power
#define mp make_pair
#define ff first
#define ss second
#define pii pair<ll, ll>
#define sq(x) ((x) * (x))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(a) int((a).size())
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define endl "\n"
#define PI 3.14159265
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll MOD1 = 998244353;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7; 
using namespace std;

ll power(ll x, ll y) 
{ 
   ll res = 1;      
  
   
    while (y > 0) 
    { 
       
        if (y & 1) 
            res = (long long)(res*x); 
  

        y = y>>1; 

        if (x<=100000000)
        x = (long long)(x*x);

        //cout<<x<<'\n'; 
    } 
    return res; 
} 






int main()
{

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

fastio();

    ll n,m,total;
    cin>>n>>m>>total;

    vector <ll> a(n); vector <ll> b(m); vector <ll> pre1(n,0); vector <ll> pre2(m,0);

    For(i,0,n)
    cin>>a[i];

    pre1[0]=a[0];

    for(int i=1;i<n;i++)
    {
        pre1[i]=a[i]+pre1[i-1];
    }

    For(i,0,m)
    cin>>b[i];

    pre2[0]=b[0];

    for(ll i=1;i<m;i++)
    {
        pre2[i]=b[i]+pre2[i-1];
    }

    ll ans=0;

    if (pre1[n-1]+pre2[m-1]<=total)
        ans=n+m;

    for(ll i=0;i<n;i++)
    {
        if (pre1[i]<=total)
        ans=max(ans,i+1);
    }

    for(ll i=0;i<m;i++)
    {
        if (pre2[i]<=total)
        ans=max(ans,i+1);
    }


    for(int i=0;i<n;i++)
    {
        if (total-pre1[i]<b[0])
            break;

        ll temp=i+1;

        ll pos=upper_bound(all(pre2),total-pre1[i])-pre2.begin();
        temp+=pos;

        ans=max(ans,temp);
    }

  for(int i=0;i<m;i++)
    {
        if (total-pre2[i]<a[0])
            break;

        ll temp=i+1;

        ll pos=upper_bound(all(pre1),total-pre2[i])-pre1.begin();
        temp+=pos;

        ans=max(ans,temp);
    }

    cout<<ans;

return 0;
}

Measured memory_bytes: 9548
import java.util.*;
public class Main { 
	public static void main(String arts[]) { 
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		String s =sc.next();
		int ans = 0;
		for(int i = 1; i < n; i++){
			int count = 0;
			for(char c = 'a' ; c <= 'z'; c++){
				//全部の文字見つけてやるよ
				int finds1 = 0;
				int finds2 = 0;
				//string1
				for(int j = 0 ; j < i ; j ++){
					if(s.charAt(j) == c){
						finds1=1;
						break;
					}
				}
				for(int j = i ; j < n; j++){
					if(s.charAt(j) ==c){
						finds2 = 1;
						break;
					}
				}
				if(finds1==1&&finds2==1){
					count ++;
				}
			}
			if(count > ans){
				ans = count;
			}
		}
		System.out.println(ans);
	} 
} 




Measured memory_bytes: 22996
import java.util.*;

public class Main{
  public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int count1 = 0;
		int count2 = 0;
		for(int i = 0;i < N;i++) {
			int A = sc.nextInt();
			if(A % 2 == 0) {
				if(A % 3 == 0 || A % 5 == 0) {
					count1++;
				}else {
					count2++;
				}
			}
		}
		if(count2 > 0) {
			System.out.println("DENIED");
		}else {
			System.out.println("APPROVED");
		}
	}
}

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

int main(){

    int N,a;
    long long K;
    cin >> N >> K;
    vector<int> dest(N,0);
    int i,j;

    vector<int> dest_from_0(N,0);
    dest_from_0[0] = 0;
    vector<int> visited(N,0);
    visited[0] = 1;
    vector<int> when_visit(N,0);
    when_visit[0] = 0;

    for(i=0;i<N;++i){
        cin >> a;
        dest[i] = a-1;
    }

    int now(0),next;
    for(i=1;i<N;++i){
        next = dest[now];
        if(visited[next]==0){
            visited[next] = 1;
            dest_from_0[i] = next;
            when_visit[next] = i;
            now = next;
        }else{
            break;
        }
    }

    if( K > when_visit[next] ) {
        K = ( K - when_visit[next] ) % ( i - when_visit[next] );
        cout << dest_from_0[ when_visit[next] + K ] + 1  << endl;
    }else{
        cout << dest_from_0[ K ] + 1  << endl;
    }

    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
const int INF = 1e9 + 7;

using namespace std;

#define MAX_V 100
int d[MAX_V][MAX_V];

int main(){
    int v,e,a[1000],b[1000],c[1000],ans=0;
    scanf("%d",&v);
    REP(i,v) REP(j,v) d[i][j] = INF;
    REP(i,v) d[i][i] = 0;
    scanf("%d",&e);
    REP(i,e) scanf("%d%d%d",a+i,b+i,c+i);
    REP(i,e){
        --a[i];--b[i];
        d[a[i]][b[i]] = d[b[i]][a[i]] = c[i];
    }

    REP(k,v) REP(i,v) REP(j,v) d[i][j] = min(d[i][j],d[i][k] + d[k][j]);

    bool used;
    REP(i,e){
        used = true;
        REP(s,v) if(d[s][a[i]] + c[i] == d[s][b[i]]) used = false;
        if(used) ++ans;
    }

    printf("%d\n",ans);
    return 0;
}


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

using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
ll pow_mod(ll fi,ll se,ll mod){
  if(se==0){
    return 1;
  }
  if(se%2){
    return pow_mod(fi,se-1,mod)*fi%mod;
  }
  ll t=pow_mod(fi,se/2,mod);
  return t*t%mod;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}

vector<pair<int,int>> Dir={{-1,0},{1,0},{0,1},{0,-1}};
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/


int main(){
  ll n,k;
  cin>>n>>k;
  if(k!=1)op(n-k)
  else op(0)
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  ll n,k; cin >> n >> k;
  vector<ll> M, P;
  ll zero = 0;
  loop(i,0,n) {
    ll a; cin >> a;
    if (a == 0) zero++;
    else if (a < 0) M.push_back(a);
    else P.push_back(a);
  }
  sort(M.begin(), M.end());
  sort(P.begin(), P.end());
  ll m = M.size(), p = P.size();

  if (k <= m*p) {
    auto f = [&](ll x) {
      ll num = 0;
      loop(i,0,p) {
        ll xx = (x-P[i]+1)/P[i];
        num += upper_bound(M.begin(), M.end(), xx) - M.begin();
      }
      return num;
    };

    ll ng = -1000000000000000001, ok = 1000000000000000001;
    while (ng+1<ok) {
      ll mid = (ng+ok)>>1;
      if (f(mid) < k) ng = mid;
      else ok = mid;
    }
    cout << ok << endl;
    return 0;
  }

  k -= m*p;

  ll numZero = zero ? zero*(zero-1)/2 : 0;
  numZero += zero * (m+p);
  if (k <= numZero) {
    cout << 0 << endl;
    return 0;
  }

  k -= numZero;

  loop(i,0,m) M[i] *= -1;
  reverse(M.begin(), M.end());

  auto f = [&](ll x) {
    ll num = 0;
    loop(i,0,p) {
      ll xx = x/P[i];
      int j = upper_bound(P.begin(), P.end(), xx) - P.begin();
      if (i < j) j--;
      num += j;
    }
    loop(i,0,m) {
      ll xx = x/M[i];
      int j = upper_bound(M.begin(), M.end(), xx) - M.begin();
      if (i < j) j--;
      num += j;
    }
    return num>>1;
  };

  ll ng = -1000000000000000001, ok = 1000000000000000001;
  while (ng+1<ok) {
    ll mid = (ng+ok)>>1;
    if (f(mid) < k) ng = mid;
    else ok = mid;
  }
  cout << ok << endl;
  return 0;
}


Measured memory_bytes: 5052
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<ll> vc;
typedef unordered_map<ll,ll> umap;
#define pb emplace_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;

int next_combination(int sub){
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}

int main() {
    // your code goes here
    int n,m,q,a[55],b[55],c[55],d[55],ans=0,bit;
    cin >> n >> m >> q;
    rep(i,1,q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    m--;
    bit = (1<<n)-1;
    for(;bit<(1<<(m+n));bit=next_combination(bit)){
        int mm=0,s[15]={0},sj=1;
        rep(j,0,m+n-1){
            if(bit&(1<<j)){
                s[sj]=mm;
                sj++;
            } else {
                mm++;
            }
        }
        int am=0;
        rep(j,1,q){
            if(s[b[j]]-s[a[j]]==c[j]) am+=d[j];
        }
        chmax(ans,am);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
from fractions import gcd
from math import sqrt, ceil
A, B, K = map(int, input().split())
c = gcd(A, B)
res = 0
count = 0

for i in reversed(range(1,c + 1)):
    if c % i == 0:
        count += 1
        if count == K:
            print(i)
            break

Measured memory_bytes: 5048
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define mx 1000002
mt19937 myrand(time(0));

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    ll x,n;
    cin>>x>>n;
    ll vis[105]={0};
    for(int i=0;i<n;i++){
        ll v;
        cin>>v;
        vis[v+1]=1;
    }
    ll a,b;
    for(int i=x;i<=101;i++){
        if(!vis[i+1]){
            a=i;
            break;
        }
    }
    for(int i=x-1;i>=-1;i--){
        if(!vis[i+1]){
            b=i;
            break;
        }
    }
    if(abs(x-a)<abs(x-b)){
        cout<<a<<endl;
    }
    else cout<<b<<endl;
    return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int a[55][55];
ll dp[55][55][55];

ll solve(int l, int r, int m) //match [l,r], m is blocked
{
	if(dp[l][r][m]!=-1) return dp[l][r][m];
	if(l==r) return 1;
	if(l>r) return 0;
	dp[l][r][m]=0;
	for(int l1=l;l1<m;l1++)
	{
		for(int r1=r;r1>m;r1--)
		{
			if(a[l1][r1])
			{
				for(int l2=l1;l2<m;l2++)
				{
					for(int r2=m+1;r2<=r1;r2++)
					{
						dp[l][r][m]+=solve(l,l2,l1)*solve(l2+1,r2-1,m)*solve(r2,r,r1);
					}
				}
			}
		}
	}
	return dp[l][r][m];
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	n*=2;
	for(int i=0;i<n;i++)
	{
		string s; cin>>s;
		for(int j=0;j<n;j++)
		{
			a[i][j]=s[j]-'0';
		}
	}
	memset(dp,-1,sizeof(dp));
	ll ans=0;
	for(int i=1;i<n;i++)
	{
		if(a[0][i]) ans+=solve(1,n-1,i);
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
 
int main() {
  bool f=true;
  vector<int> a(128,0);
  string w;
  cin >> w;
  for(int i=0;i<w.size();i++){
    a[w.at(i)] ++;
  }
  for(int i=0;i<128;i++){
    if (a[i]%2==1) f=false;
  }
  if(f==true) cout << "Yes" <<endl;
  else cout << "No" <<endl;
}

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

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/
ll N, A[100010];
map<ll, ll> m;
/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>N;
    REP(i,0,N){
        cin>>A[i];
        m[A[i]]++;
    }

    vector<ll> v;

    for (auto itr = m.begin(); itr != m.end(); itr++){
        int t = (*itr).second;

        while(t >= 2){
            v.push_back((*itr).first);
            t -= 2;
        }
    }

    sort(v.begin(), v.end(), greater<ll>());

    ll ans = 0;

//    REP(i,0,v.size()){
//        if(i + 1 <= N - 1) ans = max(ans, v[i] * v[i+1]);
//    }
    if(2 <= v.size()) ans = max(ans, v[0] * v[1]);

    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define rep(i,n) for (ll i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    string N; cin >> N;
    if(N[0]=='9' || N[1]=='9') cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <stdio.h>

int click_2button(int *button1, int *button2){
	int coin = 0;
	coin += *button1;
	(*button1)--;
	coin += *button2;
	(*button1)++;
	return coin;
}

int main(void){
	int a, b, in_a, in_b, count;
	int coin[3];
	scanf("%d %d", &in_a, &in_b);
	a = in_a;
	b = in_b;
	coin[0] = click_2button(&a, &b);
	coin[1] = click_2button(&a, &a);
	coin[2] = click_2button(&b, &b);
	printf("%d", coin[0] >= coin[1] && coin[0] >= coin[2] ? coin[0] : coin[1] >= coin[0] && coin[1] >= coin[2] ? coin[1] : coin[2]);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  int n, k; cin >> n >> k;
  vector<int> p(n);
  vector<double> e(n);
  vector<int> s(1001, 0);
  for(int i=1; i<=1000; i++) s[i] = s[i-1] + i;

  for(int i=0; i<n; i++) {
    cin >> p[i];
    e[i] = s[p[i]] * 1.0 / p[i];
  }

  double ans = 0.0;
  double tmp = 0.0;
  for(int i=0; i<k; i++) tmp += e[i];
  ans = max(ans, tmp);
  for(int i=k; i<n; i++) {
    tmp += e[i];
    tmp -= e[i-k];
    ans = max(ans, tmp);
  }
  printf("%.10lf\n", ans);

}

// EOF


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
// template<class T> T gabs(const T& x) { return max(x, -x); }
// #define abs gabs

int main() {
    i64 n;
    const i64 mod = 1e9 + 7;
    i64 ans = 1;
    cin >> n;
    for (i64 i = 1; i <= n; ++i) (ans *= i) %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
N, M = map(int, input().split(" "))

goto = {i: [] for i in range(1, N+1)}
sign = np.zeros(N, dtype=int)
for _ in range(M):
  A, B = map(int, input().split(" "))
  goto[A].append(B)
  goto[B].append(A)

# print(goto)

visited = set([1])
queue = [1]
while len(queue) > 0:
  v = queue.pop(0)
  for nex in goto[v]:
    if nex in visited:
      continue
    sign[nex-1] = v
    queue.append(nex)
    visited.add(nex)
print("Yes")
for s in sign[1:]:
  print(s)


Measured memory_bytes: 65924
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "x", long, "y");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    long h, a;
    scan(h, a);
    writeln((h + a - 1) / a);
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

using namespace std;

int main()
{

    int n , i;
    string s;
    cin>>s;
    n = s.length();
    for( i = 0 ; i < n ; i++)
    {
        if(s[i]!=s[n-1-i]) 
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    for( i = 0 ; i < (n-1)/2 ; i++)
    {
        if(s[i]!=s[(n-1)/2-i-1]) 
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    for( i = (n+1)/2 ; i < n ; i++)
    {
        if(s[i]!=s[n-1-i]) 
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    

}

Measured memory_bytes: 256
#17 C - Sentou
N, T = map(int,input().split())
t = list(map(int,input().split()))

time = 0
for i in range(1,N):
    diff = t[i] - t[i-1]
    if diff < T:
        time += diff
    else:
        time += T
print(time+T)   

Measured memory_bytes: 30900
from functools import lru_cache
import sys
sys.setrecursionlimit(10**6)

n = int(input())
mod = 10**9 + 7
#memo = [{}for i in range(n+1)]

def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i-1],t[i] = t[i],t[i-1]
        if ''.join(t).count('AGC') >= 1:
                return False
    return True
@lru_cache(None)
def dfs(cur,last3):
#    if last3 in memo[cur]:
 #       return memo[cur][last3]
    if cur == n:
        return 1
    ret = 0
    for i in 'ACGT':
        if ok(last3 + i):
            ret = (ret + dfs(cur+1,last3[1:]+i)) % mod
  #  memo[cur][last3] = ret
    return ret
print(dfs(0,'   '))


Measured memory_bytes: 5620
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())
a = [int(i) for i in readline().split()]


from collections import Counter

c = Counter(a)

two = 0
ans  = n
for x in c:
    i = c[x]
    while i > 2:
        i -= 2
        ans -= 2
    if i == 2:
        two += 1

ans -= (two+1)//2*2

print(ans)





Measured memory_bytes: 18404
#include <cstdio>
#include <utility>
#include <cctype>
#include <complex>
#include <vector>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;char c;while(isspace(c = gcu()));do{s+=c;}while(c=gcu(),c!=' '&&c!='\n'&&c!=EOF);return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H &&h, T... t){out(h);out(t...);}
template <typename... T> _OUTL(T... t){out(t...);outl();}
#define dbg(...) fprintf(stderr,__VA_ARGS__)
struct range{
	int e,b=0,s=1;range(int b,int e,int s):e(e),b(b),s(s){} range(int b,int e): e(e), b(b){} range(int e):e(e){}
	struct it{int v,s; it(int v,int s):v(v),s(s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

_T using V = vector<T>;
using P = complex<int>;

int square (int a) {
	return a * a;
}

int main() {
	for (int n; (n = in);) {
		V<P> v(n);
		V<V<bool>> m(5001, V<bool>(5001));
		for (int i: range(n)) {
			int x {in}, y {in};
			v[i] = {x, y};
			m[y][x] = true;
		}
		auto check = [&](P a) {
			int x {real(a)}, y {imag(a)};
			return x >= 0 && x < 5001 && y >= 0 && y < 5001 && m[y][x];
		};
		int r {};
		for (auto p1 {begin(v)}; p1 != end(v); p1++)
			for (auto p2 {next(p1)}; p2 != end(v); p2++) {
				P d {(*p1 - *p2) * P{0, 1}};
				if (check(*p1 + d) && check(*p2 + d))
					r = max(r, square(real(d)) + square(imag(d)));
			}
		outl(r);
	}
}


Measured memory_bytes: 5704
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll,ll> pll;


ll n, k;
string s;
int main()
{
        cin >> n >> k;
        cin >> s;
        ll ans = 0;
        ll cnt1=0;
        ll cnt2=0;
        for(ll i=0;i<n-1;i++) {
                if(s[i] == 'L' && s[i+1] == 'R') cnt1++;
                else if(s[i] == 'R' && s[i+1] == 'L') cnt2++;
                else ans++;
        }
        while(k--){
                if(cnt1 && cnt2) {
                        ans+=2;
                        cnt1--; cnt2--;
                }else if(cnt1 || cnt2) {
                        ans += 1;
                        if(cnt1) cnt1--;
                        else cnt2--;
                }else break;
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>

int main(void)
{
    int x,n;
    int ans=0;
    int max=0;
    int i;

    scanf("%d %d",&x,&n);
    // printf("%d %d",x,n);
    int  a[n];
    for (i=0;i<n;i++){
        scanf("%d",&a[i]);
        // printf("%d\n",a[i]);
    }
    // printf("%d\n",i);

    for (i=0;i<n-1;i++){
        if (a[i+1]-a[i]>max)
            max=a[i+1]-a[i];
    }

    if (a[0]+x-a[n-1]>max)
        max=a[0]+x-a[n-1];

    ans=x-max;
    printf("%d\n",ans);
    
    return 0;
}

Measured memory_bytes: 896
import numpy as np
a,b,h,m =  map(int,input().split())
w_h = 2*np.pi*((h+m/60)/12)
w_m = 2*np.pi*(m/60)
c_2 = a**2 + b**2 -2*a*b*np.cos(w_h-w_m)
print(c_2**0.5)

Measured memory_bytes: 27180
N = int(input())

# 26進数
v = []
while True:
    N, mod = divmod(N, 26)
    if mod == 0:
        mod = 26
        N -= 1
    v.append(mod)
    if N < 26:
        v.append(N)
        break
v = v[::-1]
# print('v', v)
alphabets = list('0abcdefghijklmnopqrstuvwxyz')
s = []
for i in v:
    if i == 0:
        continue
    s.append(alphabets[i])
# print('s', s)
ans = ''.join(s)
print(ans)


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

int a, b;
double x = 0.08;
double y = 0.1;

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> a >> b;
    for (int i = 1; i <= 1250; i++)
    {
        if (floor(i * x) == a && floor(i * y) == b)
        {
            cout << i;
            cin >> a;
            return 0;
        }
    }
    cin >> a;
    cout << -1;
}

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

bool m[5001][5001];

int main() {

  while( true ) {

    long long int n;
    cin >> n;
    if ( n == 0 ) break;

    for ( long long int i = 0; i <= 5000; i++ ) {
      for ( long long int j = 0; j <= 5000; j++ ) {
	m[i][j] = false;
      }
    }

    vector< long long int > x, y;
    for ( long long int i = 0; i < n; i++ ) {
      long long int in_x, in_y;
      cin >> in_x >> in_y;
      x.push_back( in_x );
      y.push_back( in_y );
      m[in_x][in_y] = true;
    }

    long long int ans = 0;
    for ( long long int i = 0; i < n - 1; i++ ) {
      for ( long long int j = i + 1; j < n; j++ ) {

	for ( long long int k = 0; k < 2; k++ ) {

	  long long int dx = x[i] + ( y[j] - y[i] );
	  long long int dy = y[i] - ( x[j] - x[i] );
	  if ( dx >= 0 && dx <= 5000 && dy >= 0 && dy <= 5000 && m[dx][dy] == true ) {
	    dx = x[j] + ( y[j] - y[i] );
	    dy = y[j] - ( x[j] - x[i] );
	    if ( dx >= 0 && dx <= 5000 && dy >= 0 && dy <= 5000 && m[dx][dy] == true ) {
	      dx = x[i] - x[j];
	      dy = y[i] - y[j];
	      double l = sqrt( dx * dx + dy * dy );
	      ans = max( ans, (long long int)( l * l + 0.50 ) );
	    }
	  }

	  swap( x[i], x[j] );
	  swap( y[i], y[j] );

	}

      }
    }

    cout << ans << endl;

  }

  return 0;

}

Measured memory_bytes: 25720