akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){int b=0;for(auto itr :a){if(b++!=0)cout << " "; cout << itr;} }
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
#define int ll
signed main(){
    string s;
    while(getline(cin,s),s!="."){
        bool flag = true;
        stack<char>st;
        rep(i,s.size()){
            if(s[i] == '(' || s[i] == '['){
                st.push(s[i]);
                continue;
            }
            if(s[i] == ')' || s[i] == ']'){
                if(st.empty())flag = false;
                else if(st.top() == '(' && s[i] == ')'){
                    st.pop();
                    continue;
                }else if(st.top() == '[' && s[i] == ']'){
                    st.pop();
                    continue;
                }else flag = false;
            }
        }
        cout << (flag && st.empty() ?  "yes":"no") << endl;
    }
}




Measured memory_bytes: 3212
import itertools
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, q = map(int, readline().split())
s = readline().decode().rstrip()

lis = [0]*n
for i in range(n - 1):
    if s[i] + s[i + 1] == 'AC':
        lis[i+1] = 1

a = list(itertools.accumulate(lis))

for _ in range(q):
    l, r = map(int, readline().split())
    print(a[r-1]-a[l-1])

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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

int main(void) {
	while (1) {
		int d;
		double e;
		double xx, yy;
		double mini = 1000;

		cin >> d >> e;
		if (d == 0) {
			break;
		}
		FOR(i, 0, d) {
			xx = (double)i;
			yy = (double)(d - i);
			if (abs(sqrt(pow(xx, 2) + pow(yy, 2)) - e) < mini) {
				mini = abs(sqrt(pow(xx, 2) + pow(yy, 2)) - e);
			}
		}
		printf("%.10lf\n", mini);
	}
}


Measured memory_bytes: 3200
#include <iostream>

int main(void)
{
    // input two integer
    int a, b;
    std::cin >> a >> b;

    if (0 == (a * b) % 2)
    {
        std::cout << "Even" << std::endl;
    }
    else
    {
        std::cout << "Odd" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys
import math
import collections
from collections import deque
#k = int(input())
a, b, c = map(int, sys.stdin.readline().split())
#s = input()
#x = sys.stdin.readline().split()

if c-a-b <= 0:
    print("No")
    sys.exit()

    
d = (c-a-b) ** 2
e = 4 * a * b

if d - e > 0:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 3316
#include <iostream>
using namespace std;
int main (){
    long long int A,B,x=0,i=1;
    cin >> A >> B;
    while (x==0){
        A*=2;
        if(A>B){
            x=1;
        }else{
            i++;
        }
        
    }
    cout << i;
    
    
    
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	var ans int
	for i := 1; i <= n; i += 2 {
		var count int
		for j := 1; j <= n; j += 2 {
			if i%j == 0 {
				count++
			}
		}
		if count == 8 {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int n, w;
int weight[105] = {}, value[105] = {};

int dp[105][10005] = {};

int main(){
    string s;
    int sum = 0;
    cin>>s;

    rep(i,0,s.size()){
        sum += s[i]-'0';
    }
    if(sum == 150){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
}

Measured memory_bytes: 256
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k-1])

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)

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

  if(N%2==1){
    cout<<0<<endl;
    return 0;
  }

   if(N==1000000000000000000){
     //cout<<124999999999999995<<endl;
     //return 0;
   }

ll tt = 0;
ll ss=0;
ll bb =50;
ll mm  = 1;

  for(ll i=5;;i*=5){
   ll tmp = i*2;
   ss += N/tmp;
   if(tmp>N)
   break;
  }





  cout<<tt+ss<<endl;



}


/*




*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vs = vector<string>;
using vp = vector<pii>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(), (x).end()
#define each(a, x) for (auto&& a : (x))
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, n) for (ll i = (a); i < (n); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _per(i, n) peri(i, 0, n)
#define peri(i, a, n) for (ll i = (n) - 1; i >= (a); --i)
#define per(...) _overload3(__VA_ARGS__, peri, _per)(__VA_ARGS__)
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
template<typename T> inline void chmax(T& a, const T& b) {if (a < b) a = b;}
template<typename T> inline void chmin(T& a, const T& b) {if (a > b) a = b;}
template<typename T> inline void print(const T& x) {cout << x << "\n";}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p) {is >> p.fi >> p.se; return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) {os << p.fi << " " << p.se; return os;}
template<typename T> istream& operator>>(istream& is, vector<T>& v) {each(in, v) is >> in; return is;}
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {rep(i, sz(v)) {os << v[i] << (i + 1 != sz(v) ? " " : "");} return os;}
struct Init {Init() {ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(10);}} init;

int main() {
    ll n, m;
    cin >> n >> m;
    priority_queue<ll> q;
    rep(i, n) {
        ll a;
        cin >> a;
        q.push(a);
    }
    rep(i, m) {
        ll a = q.top();
        q.pop();
        q.push(a / 2);
    }
    ll sum = 0;
    rep(i, n) {
        sum += q.top();
        q.pop();
    }
    print(sum);
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n,m; 
int main()
{
   scanf("%d %d",&n,&m);
   if(n%2==0)n--;
   int l=1,r=n/2+2;
   int t=n/2;
  
		for(int i = 1; i <= m; i++) {
		if(i & 1) {
			printf("%d %d\n", l, l + t);
			t--;
			l++;
		}
		else {
			printf("%d %d\n", r, r + t);
			t--;
			r++;
		}
	}
   

return 0;
}


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

int main(){
    long long n, m, x;
    cin >> n >> m >> x;

    vector<vector<long long> > a(n, vector<long long>(m));
    vector<long long> c(n);
    for(long long i = 0; i < n; i++){
        cin >> c[i];

        for(long long j = 0; j < m; j++) cin >> a[i][j];
    }

    long long minv = 1e9;
    bool buy = false;
    for(long long bit = 0; bit < (1 << n); bit++){
        vector<long long> skill(m, 0);
        long long cost = 0;
        for(long long mask = 0; mask < n; mask++){
            if(bit & (1 << mask)){
                cost += c[mask];

                for(long long i = 0; i < m; i++){
                    skill[i] += a[mask][i];
                }
            }
        }

        bool flag = true;
        for(long long i = 0; i < m; i++){
            if(skill[i] < x){
                flag = false;
                break;
            }
        }

        if(flag == true) minv = min(minv, cost), buy = true;

    }

    if(buy != true) printf("-1\n");
    else cout << minv << endl;
    return 0;
}

Measured memory_bytes: 3556
#include<stdio.h>
int R=1,C=1,H[2000010],N[2000010];
long long MAX(long long a,long long b){return a<b?b:a;}
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]<N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
int main(){
  int n,i,a;
  long long d[200010],e[200010],k,m,s=0,l=-1,r=1e18+10;
  scanf("%d %lld",&n,&k);
  for(i=0;i<n;i++){
    scanf("%d",&a);
    hin(a);
  }
  for(i=0;i<n;i++)d[i]=N[hout()];
  R=C=1;
  for(i=0;i<n;i++){
    scanf("%d",&a);
    hin(-a);
  }
  for(i=0;i<n;i++)e[i]=-N[hout()];
  //for(i=0;i<n;i++)printf("%lld %lld\n",d[i],e[i]);printf("\n");
  while(r-l-1){
    m=(l+r+1)/2;
    s=0;
    for(i=0;i<n;i++)s+=MAX((d[i]-m/e[i]),0);
    if(s<=k)r=m;
    else    l=m;
  }
  printf("%lld\n",r);
  return 0;
}
	


Measured memory_bytes: 8320
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<signed(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 20000000000;
typedef std::pair<ll,ll> P;


	ll ans=0;
	ll N,M,K;
	P A[100010];
	string S,T;
	ll id=0;
	ll sum;bool F=true;

int main(){
	ios_base::sync_with_stdio(false);
	cin>>N>>K;
	REP(i,N){
		int a;
		cin>>a;
		A[i]={a,i};
	}
	sort(A,A+N);
	ans=INF;
	REP(i,N-K+1){
			sum=A[i+K-1].first-A[i].first;
			DEB(sum)END
		ans=min(sum,ans);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		// 1行、2つ(複数)数字
		String[] ss0 = br.readLine().trim().split(" ", 0);
		long N = Long.parseLong(ss0[0]);
		long M = Long.parseLong(ss0[1]);

		if(N-M>=2){ System.out.println(0); return; }
		if(M-N>=2){ System.out.println(0); return; }

		dp("N=[" + N + "], M=[" + M + "]");
			
		long mod = 1000000007;
		long ans = 0;
		//i = 7 % 3;    // i = 1

		dp("mod=[" + mod + "], ans=[" + ans + "]");

		ans = ((fact(M) % mod) * (fact(N) % mod)) % mod;
		
		if(N==M) { ans = (ans * 2) % mod; }

		System.out.println(ans); return;
	}
	//-----------------------------------------------------------------
	// Debug.Print
	static void dp(String s) {
		//System.out.println(s);
	}
	static void dp(StringBuilder s) { dp(s.toString()); }
	static void dp(int i) { dp(String.valueOf(i)); }
	static void dp(long i) { dp(String.valueOf(i)); }

	static long fact(long i) {
		long mod = 1000000007;
		long ans=i;

		//dp("mod=[" + mod + "], ans=[" + ans + "], i=[" + i + "]");

		if(i>1){ ans = (ans * fact(i-1)) % mod; }
		return ans;
	}

	//-----------------------------------------------------------------
	// 入力値確認：リスト
	static void checkInput(List l) { System.out.println(l); }
	//-----------------------------------------------------------------
	// 入力値確認：配列、1次元、float型
	//   ＜使い方＞
	//     float[] f = new float[N];
	//     checkInput(f);
	static void checkInput(float[] i1) {
		StringBuilder sb = new StringBuilder();
		for(float i: i1) sb.append("[" + i + "]");
		System.out.println(sb);
	}
	//-----------------------------------------------------------------
	// 入力値確認：配列、1次元、int型
	//   ＜使い方＞
	//     int[] c = new int[N];
	//     checkInput(c);
	static void checkInput(int[] i1) {
		StringBuilder sb = new StringBuilder();
		for(int i: i1) sb.append("[" + i + "]");
		System.out.println(sb);
	}
	//-----------------------------------------------------------------
	// 入力値確認：配列、二次元、int型
	static void checkInput(int[][] i2) {
		StringBuilder sb = new StringBuilder();
		for(int[] i1: i2){
			for(int i: i1) sb.append("[" + i + "]");
			sb.append(System.getProperty("line.separator"));
		}
		System.out.println(sb);
	}
	//-----------------------------------------------------------------
	// 入力値確認：配列、二次元、int型
	static void checkInput(long[][] i2) {
		StringBuilder sb = new StringBuilder();
		for(long[] i1: i2){
			for(long i: i1) sb.append("[" + i + "]");
			sb.append(System.getProperty("line.separator"));
		}
		System.out.println(sb);
	}

}


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

int main() {
    int h, w, p;
    cin >> h >> w >> p;
    int ans = 0;
    char arr[h][w];
    for (int i = 0; i<h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> arr[i][j];
        }
    }

    int black;
    for (int i = 0; i < (1 << h) - 1; i++) {
        for (int j = 0; j < (1 << w) - 1; j++) {
            black = 0;
            for (int k =  0; k < h; k++) {
                for (int l = 0; l < w; l++) {
                    if ((i >> k & 1) == 0 && (j >> l & 1) == 0 && (arr[k][l] == '#')) {
                        black++;
                    }
                }
            }
            if (black == p) {
                ans = ans + 1;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

const int Z = 1e9+7;

int bexp(int a, int x) {
    if (x == 0) {
        return 1;
    }
    if (x % 2 == 1) {
        return 1ll * a * bexp(a, x - 1) % Z;
    }
    int t = bexp(a, x / 2);
    return 1ll * t * t % Z;
}

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

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

    int ans = 0;
    int dp[k+1];
    for (int i = k; i >= 1; i--) {
        dp[i] = bexp(k / i, n);
        for (int j = i + i; j <= k; j += i) {
            dp[i] = (dp[i] + Z - dp[j]) % Z;
        }

        ans = (ans + 1ll * i * dp[i]) % Z;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3584
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int v[n],c[n];
    int ans=0;
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    for(int i=0;i<n;i++){
        cin >> c[i];
        if(v[i]-c[i]>0){
            ans+=v[i]-c[i];
        }
    }
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("03")
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef vector<ll> vec;
typedef vector<vector<ll> > matrix;
ll const mod=1e9+7;
vec adj[100100];
ll dp[100100][3];
ll dfs(ll s,ll p,ll col)
{
	ll d=0,ans1=1;
	if(dp[s][col] != -1)
		return dp[s][col];
	for(auto it=adj[s].begin();it != adj[s].end();it++)
	{
		if(*it == p)
			continue;
		ll ans=0;
		if(col == 1)
		{
			ans=(ans+dfs(*it,s,0)+mod)%mod;
		}
		else
		{
			ans=(ans+dfs(*it,s,1)+mod)%mod;
			ans=(ans+dfs(*it,s,0)+mod)%mod;
		}
		ans1=(ans1*ans)%mod;
		d+=1;
	}
	if(d == 0)
		return 1;
	return dp[s][col]=ans1;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll ans,x,y,n;
	cin>>n;
	for(ll i=1;i<n;i++)
	{
		cin>>x>>y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	memset(dp,-1,sizeof(dp));
	ans=dfs(1,-1,0);
	memset(dp,-1,sizeof(dp));
	ans=(ans+dfs(1,-1,1)+mod)%mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 13696
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int N, M; cin >> N >> M;
  int S[N], T[M];
  rep(i, N){
    cin >> S[i];
  }
  rep(i, M){
    cin >> T[i];
  }
  ll dp[N+1][M+1] = {}; ll cum[N+1][M+1] = {};
  rep(i, N){
    rep(j, M){
      if(S[i]==T[j]) dp[i+1][j+1]=(cum[i][j]+1)%mod;
      else dp[i+1][j+1] = 0;
      cum[i+1][j+1]+=(((cum[i][j+1]+cum[i+1][j])%mod-cum[i][j]+mod)%mod+dp[i+1][j+1])%mod;
      cum[i+1][j+1]%=mod;
    }
  }
  //cout << cum[1][2] << " " << cum[2][1] << " " << cum[1][1] << endl;
  cout << (cum[N][M]+1)%mod << endl;
}


Measured memory_bytes: 62848
#include<iostream>
using namespace std;
typedef long long ll;
int main()
{
    int a,b,c;
    while(cin>>a>>b>>c)
    {
        int t=0;
        t=b/a;
        if(t<=c)
            cout<<t<<endl;
        else
            cout<<c<<endl;

    }
    return 0;
}


Measured memory_bytes: 256
// AOJ Volume 0 Problem 0011

#include <stdio.h>

int main(void)
{
    int lines[31];
    int v_lines, h_lines;
    int a, b;
    int tmp;
    int i;
    
    scanf("%d%d", &v_lines, &h_lines);
    
    for (i = 1; i <= v_lines; i++){
        lines[i] = i;
    }
    
    for (i = 0; i < h_lines; i++){
        scanf("%d,%d", &a, &b);
        
        tmp = lines[a];
        lines[a] = lines[b];
        lines[b] = tmp;
    }
    
    for (i = 1; i <= v_lines; i++){
        printf("%d\n", lines[i]);
    }

    return (0);
}

Measured memory_bytes: 0
#include <iostream>
#include <climits>
#include <string>
#include <stdlib.h>
#include <algorithm>

using namespace std;
 
int ascSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);
 
    if ( _v1 < _v2 ) {
        return 1;
    } else if ( _v1 > _v2 ) {
        return -1;
    } else {
        return 0;
    }
}
int main() {
	long long n,i,x=0,one=0,two=0;
	cin >> n;
	long long a[100005];
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	qsort(a,n,sizeof(a[0]),ascSort);
	for(i=0;i<(n-1);i++){
		if(a[i]==a[i+1] && x==0){
			one = a[i];
			i +=1;
			x=1;
		}else if(a[i]==a[i+1] && x==1){
			two = a[i];
			x =2;
			break;
		}
	}
	cout << one*two << endl;
	return 0;
}

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


long Lmax(long x, long y) {
	if (x > y)return x;
	return y;
}

int max(int x, int y) {
	if (x > y)return x;
	return y;
}

long Lmim(long x, long y) {
	if (x < y)return x;
	return y;
}

int mim(int x, int y) {
	if (x < y)return x;
	return y;
}

int abs(int x) {
	if (x < 0) {
		return -x;
	}
	return x;
}


double houwa;
int N,C,H, M, K,W,A,B,ans;
string S,k;

int main() {
	cin >> S;

	for (int i = 0; i < S.size() - 9; i++){
		cout << S[i];
}
	cout << S[S.size() - 9]<<endl;

	
	return 0;
}




Measured memory_bytes: 256
n = int(input())
s = dict()
for i in range(n):
    si = input()
    if si in s:
        s[si] +=1
    else:
        s[si] = 0
l = max(s.values())
ans = []
for i in s:
    if s[i] ==l:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)

Measured memory_bytes: 35288
# include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;
 
# define S second
# define F first
# define kill(x) return(cout << x << endl, 0)
# define debug(x) cerr<< #x << " : " << x << endl
# define ddebug(x, y) cerr<< #x << " : " << x  << ", " << #y << " : " << y << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)
# define UB upper_bound 

const int MAXN = 2000 + 10;
int n, k;
vector <int> adj[MAXN];
pii edg[MAXN];
int hei[MAXN];

int dfs(int u)
{
	int res = (hei[u] > k / 2);
	for (int v : adj[u])
		if (hei[v] == -1)
		{
			hei[v] = hei[u] + 1;
			res += dfs(v);
		}
	return res;
}

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	cin >> n >> k;
	for (int i = 0; i < n - 1; i ++)
	{
		int u, v;
		cin >> u >> v;
		u --, v --;
		adj[u].PB(v);
		adj[v].PB(u);
		edg[i] = {u, v};
	}

	int ans = n;
	for (int i = 0; i < n; i ++)
	{
		if (!(k & 1))
		{
			memset(hei, -1, sizeof hei);
			hei[i] = 0;
			smin(ans, dfs(i));
		}
		else if (i != n)
		{
			memset(hei, -1, sizeof hei);
			int u = edg[i].F, v = edg[i].S;
			hei[u] = hei[v] = 0;
			smin(ans, dfs(u) + dfs(v));
		}
	}
	cout << ans << endl;

	return 0;
}


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

int main(void){
    ll n,k;
    cin>>n>>k;
    vector<ll>p(n);
    rep(0,i,n)cin>>p[i];
    sort(p.begin(),p.end());
    ll ans=0;
    rep(0,i,k){
        ans+=p[i];
    }
    cout<<ans;
}

Measured memory_bytes: 3592
#include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;

bool check_even(string str,int lsize){ 
    int i=0; int k=lsize-2; int mid=k/2;
//    while(!check_even{}
    int flag;
    for(int i=0; i<mid-1;i++){ int j=i+mid;
    	if(str[i]==str[j]){flag=1;}
    	else {flag=0; break;}
    }
 
 if(!flag){
   	lsize=lsize-2;
   	check_even(str,lsize);
   }
   if(flag==1){cout<<k;}

return 0;
}


int main (){
    string str;
    cin>>str;
     int lsize=str.length();
   // int i=0; int k=lsize; int mid=k/2;
   check_even(str,lsize);
    

     return 0;
}


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

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

    int s, t, c;
    vector<vector<int>> imos(35, vector<int>(100005, 0));
    for (int i = 0; i < N; i++)
    {
        cin >> s >> t >> c;
        imos[c][s - 1]++;
        imos[c][t]--;
    }

    for (int i = 0; i < imos.size(); i++)
    {
        for (int j = 1; j < imos[i].size(); j++)
        {
            imos[i][j] += imos[i][j - 1];
        }
    }
    for (int i = 0; i < imos.size(); i++)
    {
        for (int j = 1; j < imos[i].size(); j++)
        {
            imos[i][j] = min(imos[i][j], 1);
        }
    }

    int ans = 0;
    for (int i = 0; i < 100005; i++)
    {
        int tmp = 0;
        for (int j = 0; j < imos.size(); j++)
        {
            tmp += imos[j][i];
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 14336
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <iomanip>
using namespace std;
typedef long long unsigned int llui_t;
typedef long long int lli_t;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


/* inputs */
llui_t N;
vector<llui_t> A(15, 0);
vector<llui_t> P{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};


int main() {
  cin >> N;

  for(llui_t i=1; i<=N; i++) {
    llui_t n = i;
    for (size_t pi = 0; pi < P.size(); pi++) {
      int p = P[pi];
      while (n % p == 0) {
        A[pi] += 1;
        n = n / p;
      }
    }
  }

  llui_t ans = 0;
  for (size_t i1 = 0; i1 < A.size(); i1++) {
    if (A[i1] >= 74) ans += 1;
    for (size_t i2 = i1+1; i2 < A.size(); i2++) {
      if (A[i1] >= 14 && A[i2] >= 4) ans+=1;
      if (A[i1] >= 4  && A[i2] >= 14) ans+=1;
      if (A[i1] >= 24 && A[i2] >= 2) ans+=1;
      if (A[i1] >= 2  && A[i2] >= 24) ans+=1;
      for (size_t i3 = i2+1; i3 < A.size(); i3++) {
        if (A[i1] >= 4 && A[i2] >= 4 && A[i3] >= 2) ans+=1;
        if (A[i1] >= 4 && A[i2] >= 2 && A[i3] >= 4) ans+=1;
        if (A[i1] >= 2 && A[i2] >= 4 && A[i3] >= 4) ans+=1;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
using System;

namespace ConsoleApplication25
{
    class Program
    {
        static void Main(string[] args)
        {
            string shuffle;
            string Input;
            while (true)
            {
                
            Input = Console.ReadLine();
                if("-" == Input)
                    break;
                //?????£??????????????°
                string M = Console.ReadLine();
                int m = int.Parse(M);
                //?????£?????????????????????
                for (int i = 0; i < m; i++)
                {
                    string H = Console.ReadLine();
                    int h = int.Parse(H);
                    //????????????
                    string shuffle1 = Input.Substring(0, h);
                    string shuffle2 = Input.Substring(h);
                    shuffle = shuffle2 + shuffle1;
                    Input = shuffle;
                }
                Console.WriteLine(Input);
            }
        }
    }
}

Measured memory_bytes: 8900
#include <iostream>
#include <iomanip>

int main()
{
	double a, b, c, d, e, f;
	while(std::cin >> a >> b >> c >> d >> e >> f) {
	    double A = e;
	    double B = - b;
	    double D = - d;
	    double E = a;
	    double det = a * e - b * d;
	    double x = (A * c + B * f) / det;
	    double y = (D * c + E * f) / det;
	    if ( x == 0 ) {
	        x = 0;
	    }
	    if ( y == 0 ) {
	        y = 0;
	    }
		
		std::cout << std::fixed << std::setprecision(3) << x << " " << y << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1280
H, W = map(int, input().split())
obs = [[False for _ in range(W)] for _ in range(H)]
for y in range(H):
    s = input()
    for x in range(W):
        obs[y][x] = (s[x] == '#')

inc_x = [[0 for _ in range(W)] for _ in range(H)]
cnt_x = [[0 for _ in range(W)] for _ in range(H)]
for y in range(H):
    for x in range(W):
        if obs[y][x]: 
            inc_x[y][x]= 0
        elif x == 0 or obs[y][x-1]:
            inc_x[y][x] = 1
        else:
            inc_x[y][x] = inc_x[y][x-1] + 1
    for x in reversed(range(W)):
        if obs[y][x]:
            cnt_x[y][x]= 0
        elif x == W-1 or obs[y][x+1]:
            cnt_x[y][x] = inc_x[y][x]
        else:
            cnt_x[y][x] += cnt_x[y][x+1]

inc_y = [[0 for _ in range(W)] for _ in range(H)]
cnt_y = [[0 for _ in range(W)] for _ in range(H)]
for x in range(W):
    for y in range(H):
        if obs[y][x]: 
            inc_y[y][x]= 0
        elif y == 0 or obs[y-1][x]:
            inc_y[y][x] = 1
        else:
            inc_y[y][x] = inc_y[y-1][x] + 1
    for y in reversed(range(H)):
        if obs[y][x]:
            cnt_y[y][x]= 0
        elif y == H-1 or obs[y+1][x]:
            cnt_y[y][x] = inc_y[y][x]
        else:
            cnt_y[y][x] += cnt_y[y+1][x]


cnt = [[cnt_x[y][x]+cnt_y[y][x]-1 for x in range(W)] for y in range(H)]
ans = max([max(cnt[y]) for y in range(H)])
print(ans)


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

int main() {
string T;
cin>>T;
int N=T.size();
 for(int i=0;i<N;i++){
  if(T.at(i)=='?'){
   T.at(i)='D';
  }
 }
cout <<T<<endl;
}

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


using namespace std;

int main(){
    int A,X;
    int ans = 0;
    cin >> X >> A;

    if(X < A){
        ans = 0;
    }else{
        ans = 10;
    }
    
    
    
    cout << ans <<endl;

    return 0;
}

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

int main(int argc,char* argv[]){
  int N;
  cin >> N;
  long long A[N+1];
  long long sum=0;
  for(int i=1;i<=N;i++){
    cin >> A[i];
    if(i%2!=0) sum += A[i];
    else sum -= A[i];
  }
  cout << sum << " ";
  for(int i=1;i<N;i++){
    sum-= 2*A[i];
    sum *=-1;
    cout << sum << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2048
a = input()
if len(a) ==6:
  print(90909)
elif len(a) == 5:
  print(90909-90000 +int(a)-9999)
elif len(a) == 4:
  print(90909-90000)
elif len(a) ==3:
  print(90909-90000-900+int(a)-99)
elif len(a) ==2:
  print(90909-90000-900)
else:
  print(int(a))

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string.h>
#include <queue>
#include <math.h>
#include <string>
#include <iostream>
using namespace std;
typedef long long ll;

struct Robot
{
	int s, e;

	bool operator < (Robot r2)
	{
		if (e == r2.e) return s < r2.s;
		return e < r2.e;
	}
};

const int MN = 1e5 + 5;
Robot R[MN];
int main()
{
	int N;
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
	{
		int x, l;
		scanf("%d %d", &x, &l);
		R[i] = { x - l, x + l };
	}
	sort(R + 1, R + N + 1);

	int ans = 0;
	int pre = -1e9;
	for (int i = 1; i <= N; i++)
	{
		if (R[i].s < pre) continue;
		else pre = R[i].e, ans++;
	}
	printf("%d", ans);

	return 0;
}

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

int main()
{
	long long a,b,p,r,lcm;
	cin>>a>>b;
	p=a*b;
	
	do{
		r=a%b;
		a=b;
		b=r;
	}while(r!=0);
	
	lcm=p/a;
	cout<<lcm<< endl;
	return 0;
}

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

int main(void) {
    
    long long K,A,B,T,ans; 
    cin>>K>>A>>B;
    T=K;
    ans=1;
    
    if(B-A<=2){
        ans=ans+K;
        cout<<ans<<endl;
        return 0;
        
    }

    
    while(T > 0){
        if(ans>=A && T>=2){
            ans=ans+B-A;
            T=T-2;
            // cout << "2" <<endl;
            // cout << "T:" << T << endl;
        }else if(ans>=A){
            ans=ans+1;
            T = T - 1;
            // cout<<ans<<endl;
            // return 0;
            // cout << "3" <<endl;
        }else if(ans+T>=A){
            T = T - (A - ans);
            ans = A;
            // cout << "1" <<endl;
            // cout << "T:" << T << endl;
        } else {
            ans = ans + T;
            T = 0;
        }
    }
    
    cout<<ans<<endl;

    
    return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define INF  numeric_limits<int_fast64_t>::max();
#define intf int_fast64_t
int main(){
    intf d,t,s;
    cin >>d >>t >>s;
    if(d <= t*s){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

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

int main() {
  int x,a,b,c;
  cin >> x ;
  a=x%2;
  x=x/10;
  b=x%2;
  x=x/10;
  c=x%2;
  cout << a+b+c << endl;
}


Measured memory_bytes: 256
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
//#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;

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

    ll a,b,c,n,maxi=0,f=0,mini=INF;
    ll sum=0;
    string str,sub;
    ll h,w;
    ll m,k;
    cin>>n;
    cin>>str>>sub;
    string d,e;
    ll ans=n*2;
    for(ll i=1;i<=n;i++){
        d=sub.substr(0,i);
        e=str.substr(str.length()-i,i);
        if(d==e) maxi=max(maxi,i);
    }
    cout<<ans-maxi<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
using Graph = vector<vector<int>>;
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; }
const int INF = 1e9;
const LL LLINF = 1e16;

LL dp[3030][3030][2];

int main(){
    fastcin();

    int n, t;
    cin >> n >> t;
    vector<pair<int, int>> v(n);
    rep(i, n) cin >> v[i].first >> v[i].second;
    sort(all(v));
    vector<LL> a(n), b(n);
    rep(i, n){
        a[i] = v[i].first;
        b[i] = v[i].second;
    }
    // rep(i, n) cin >> a[i] >> b[i];
    rep(i, 3030)rep(j, 3030)rep(k, 2) dp[i][j][k] = -LLINF;
    dp[0][0][0] = 0;
    rep(i, n)rep(j, t)rep(k, 2){
        if(k == 0){ // まだ食べる
            if(j+a[i] < t) chmax(dp[i+1][j+a[i]][0], dp[i][j][0]+b[i]);
            chmax(dp[i+1][j][0], dp[i][j][0]);
        }else{
            chmax(dp[i+1][j][1], dp[i][j][0]+b[i]);
            chmax(dp[i+1][j][1], dp[i][j][1]);
        }
    }
    LL ans = 0;
    rep(i, t+1){
        chmax(ans, dp[n][i][1]);
    }
    cout << ans << endl;

}

Measured memory_bytes: 143744
def main():
    N = int(input())
    A = list(map(int, input().split()))

    even = []

    for e in A:
        if e % 2 == 0:
            even.append(e)


    for e in even:
        if e % 3 != 0 and e % 5 != 0:
            print("DENIED")
            exit(0)

    print("APPROVED")


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>*/
#define ll long long
#define ld long double
#define vll vector <ll>
#define vvll vector <vll>
#define pll pair <ll, ll>
#define vpll vector <pll>
 
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define per(i, a, b) for(ll i = a - 1; i >= b; --i)
 
#define endl "\n"
#define pb push_back
#define pf push_front
 
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
 
#define sorta(v) sort(all(v))
#define sortd(v) sort(rall(v))
#define vld vector<ld>
 
#define debug if (1)
#define log(val) debug {clog << "\n" << #val << ": " << val << "\n";}
 
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
#define mod (ll)(1e9 + 7)
 
using namespace std;

const ll N = 2e5 + 5;

ll mas[N];

void solve() {
    ld n;
    cin >> n;
    
    n /= 3;
    
    n = pow(n, 3.0);
    
    cout << setprecision(6) << fixed << n;
}

int main() {
    //ios
    //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
    
    ll tests = 1;
    //cin >> tests;
    while (tests--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 384
using System;
class Program{
	static int[] s;
	static void Main(){
		s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		long[][] arr=new long[2][];
		arr[0]=new long[s[0]];
		arr[1]=new long[s[0]];
		long ans=long.MaxValue;
		for(int i=0;i<s[0];i++){
			long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
			arr[0][i]=q[0];
			arr[1][i]=q[1];
		}

		var h1=new System.Collections.Generic.SortedSet<long>(arr[0]);
		var h2=new System.Collections.Generic.SortedSet<long>(arr[1]);
		long[] x=new long[h1.Count];
		long[] y=new long[h2.Count];
		h1.CopyTo(x,0);
		h2.CopyTo(y,0);

		for(int i=0;i<x.Length-1;i++){
			for(int j=i+1;j<x.Length;j++){
				for(int k=0;k<y.Length-1;k++){
					for(int l=k+1;l<y.Length;l++){
						int p=0;
						for(int m=0;m<s[0];m++){
							if(arr[0][m]>=x[i]&&arr[0][m]<=x[j]&&arr[1][m]>=y[k]&&arr[1][m]<=y[l]){
								p++;
								if(p==s[1]){
									ans=Math.Min(ans,(x[j]-x[i])*(y[l]-y[k]));
									break;
								}
							}
						}
					}
				}
			}
		}
		Console.WriteLine("{0}",ans);
	}
}

Measured memory_bytes: 13908
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while(sc.hasNext()) {

            int a = sc.nextInt();
            int b = sc.nextInt();

            if ( (a!=0) && (b!=0) ) {
                for (int i = 0; i<a; i++) {

                    if((i==0)||(i==(a-1))) {
                        for (int j = 0; j < b; j++) {
                            if (j == (b - 1))
                                System.out.printf("#\n");
                            else
                                System.out.printf("#");
                        }
                    }

                    else {
                        for (int j = 0; j < b; j++) {
                            if (j == (b - 1))
                                System.out.printf("#\n");
                            else if(j==0)
                                System.out.printf("#");
                            else
                                System.out.printf(".");
                        }
                    }
                }
            }
            else
                break;
            System.out.println();
        }
    }
}



Measured memory_bytes: 58208
use std::io::Read;
use std::io::Write;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let mut g = vec![vec![]; n];
    for _ in 1..n {
        let a: usize = it.next().unwrap().parse().unwrap();
        let b: usize = it.next().unwrap().parse().unwrap();
        let w: u32 = it.next().unwrap().parse().unwrap();
        g[a].push((b, w));
        g[b].push((a, w));
    }
    let mut dp = vec![0; n];
    let mut r = (0, 0);
    for _ in 0..3 {
        let mut stack = vec![(r.1, r.1, 0)];
        while let Some((v, p, d)) = stack.pop() {
            dp[v] = std::cmp::max(dp[v], d);
            r = std::cmp::max(r, (d, v));
            for &(u, w) in &g[v] {
                if u != p {
                    stack.push((u, v, d + w));
                }
            }
        }
    }
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    for d in dp {
        writeln!(out, "{}", d).ok();
    }
}

fn main() {
    run();
}



Measured memory_bytes: 7100
#include <iostream>

using namespace std;

int mem_table[100001] = {1, 1, 0};
bool broken_table[100001] = {};

int count(int n) {
    if(n == 0) return 1;
    else if(n == 1) return 1;
    else if(mem_table[n] != 0) return mem_table[n];
    else {
        if(broken_table[n-1]) {
            return mem_table[n] = count(n-2);
        } else if(broken_table[n-2]) {
            return mem_table[n] = count(n-1);
        } else {
            return mem_table[n] = (count(n-1) + count(n-2)) % 1000000007;
        }
    }
};

int main() {
    int N, M; cin >> N >> M;
    // inputかつbroken_tableに連続して破損がないか確認
    int last_tmp = -1;
    int tmp = 0;
    for(int i = 0; i < M; i++) {
        cin >> tmp;
        broken_table[tmp] = true;
        if(tmp - last_tmp == 1) {
            cout << 0 << endl;
            return 0;
        }
        last_tmp = tmp;
    }

    cout << count(N) << endl;
}


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

using namespace std;

#define ll long long int
#define ld long double
#define MAX 1005
#define MOD 1000000007
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 3.14159265358979323846
#define Q ll _; cin >> _; while(_--)
#define endl "\n"
#define flush fflush(stdout);

int main(){

    fast

    ll i,n,k;
    cin >> n >> k;
    ll a[n+1];
    for(i=1;i<=n;i++){
        cin >> a[i];
    }
    ll dp[n+1];
    for(i=1;i<=n;i++){
        dp[i] = INT_MAX;
    }
    dp[1] = 0;
    for(i=2;i<=n;i++){
        ll x = max((ll)1,i-k);
        for(ll j=x;j<i;j++){
            dp[i] = min(dp[j]+abs(a[i]-a[j]),dp[i]);
        }
    }
    cout << dp[n] << endl;

}

//    cout << fixed << setprecision(12);


Measured memory_bytes: 5168
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;




int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> a(n);
    priority_queue<ll> Q;
    priority_queue<ll,vector<ll>,greater<ll>> Q2;
    ll ans=0;
    for(ll i=0;i<n;i++){cin>>a[i]; ans+=abs(a[i]-i); Q.push(min(a[i],i)); Q2.push(max(a[i],i));}
    while(m--){
        ans+=max((Q.top()-Q2.top())<<1,0LL);
        Q.pop(); Q2.pop();
    }
    cout<<ans<<endl;
    
    
    return 0;
}



Measured memory_bytes: 5536
using System;
using System.Collections.Generic;
using System.Linq;

public class AtCoderB
{
    static void Main()
    {
        int n;
        int k;
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            n = int.Parse(words[0]);
            k = int.Parse(words[1]);
        }

        int answer = 0;
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            for (int i = 0; i < n; i++)
            {
                if (int.Parse(words[i]) >= k)
                {
                    answer++;
                }
            }
        }

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 15584
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Multiplication3 | diff Multiplication3.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Multiplication3.cpp && ./a.out

/*

 5/31/2020

 5:05-5:07 WA
 5:15 AC

 */

LL A;
string B;

void solve_round() {
  LL b=(LL)(round(stod(B)*100));
  //dump(b);
  LL res=A*b/100;
  cout<<res<<endl;
}

void solve() {
  if(SZ(B)==1) B.push_back('.');
  while(SZ(B)<4) B.push_back('0');
  LL b=(B[0]-'0')*100+(B[2]-'0')*10+B[3]-'0';
  LL res=A*b/100;
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>A>>B;
  solve_round();

  return 0;
}


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

using namespace std;
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007
#define INF (1<<28)
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define floot10 cout<<fixed<<setprecision(10);
#define int long long
int h[2100000],n=0;
//不等号には気を付けよう(3敗)配列の数にも気を付けよう(一敗)
void solve(int now){
	int maxi=now;
	if(2*now<=n){
		if(h[maxi]<h[now*2]) maxi=now*2;
	}
	if(2*now<n){
		if(h[2*now+1]>h[maxi]) maxi=now*2+1;
	}
	if(now!=maxi){
		swap(h[now],h[maxi]);
		solve(maxi);
	}
}

signed main(){
	while(1){
		string s;
		cin>>s;
		if(s[0]=='i'){
			int num;
			cin>>num;
			n++;
			h[n]=num;
			for(int i=n;i>1;i/=2){
				if(h[i/2]>h[i]) break;
				swap(h[i],h[i/2]);
			}
		}
		else if(s[1]=='x'){
			cout<<h[1]<<endl;
			h[1]=h[n--];
			solve(1);
		}
		else break;
	}
	return 0;
}



Measured memory_bytes: 10848
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1000000007;
ll const N=1e6+5;

int main() {
    
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        ll a,b,c;cin>>a>>b>>c;
        ll t=c-a-b;
        string ans="Yes";
        if(t<=0){
            ans="No";
        }
        else{
            t=t*t;
            ll y=4*a*b;
            if(t<=y){
                ans="No";
            }
        }
        cout<<ans;
    }
    return 0;   
}
 

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long int n,m,res;
    scanf("%lld %lld",&n,&m);
    if(n==1&&m==1) res=1;
    else if(n==1&&m>1) res=m-2;
    else if(m==1&&n>1) res=n-2;
    else if(n>1&&m>1) res=(m-2)*(n-2);
    printf("%lld",res);
    return 0;
}


Measured memory_bytes: 128