akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
	string A, B;
	cin >> A >> B;
	cout << (A.size() > B.size() ? "GREATER" : A.size() == B.size() ? A > B ? "GREATER" : A == B ? "EQUAL" : "LESS" : "LESS") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;
template<class T>
bool chmax(T &a, const T &b) {
    if(a<b) {
        a=b;
        return true;
    }

    return false;
}
struct Artist {
    int e,s;
    Artist(int e=0,int s=0) :
        e(e),s(s) {}
};
void input(int len, Artist *a) {
    rep(i,len) {
        string ss;
        int e,s;
        cin>>ss>>e>>s;
        a[i]=Artist(e,s);
    }
}
Artist artist1[102], artist2[102];
// ??????????????????????????°?????????
int dp1[102][5][1003];
int dp2[102][102][1003];

int lim,n,m,x;

void solve() {
    rep(i,102) rep(j,5) rep(k,1003) dp1[i][j][k]=-1;
    rep(i,102) rep(j,102) rep(k,1003) dp2[i][j][k]=-1;

    input(n,artist1);
    input(m,artist2);
    dp1[0][0][0]=dp2[0][0][0]=0;

    rep(k,lim) rep(i,n) rep(j,3) {
        Artist a=artist1[i];
        int lim_n = k+a.e;
        if(lim_n <= lim&&dp1[i][j][k]!=-1) 
            chmax(dp1[i+1][j+1][lim_n],dp1[i][j][k]+a.s);
        chmax(dp1[i+1][j][k],dp1[i][j][k]);
    }
    rep(k,lim) rep(i,m) rep(j,m) {
        Artist a=artist2[i];
        int lim_n = k+a.e;
        if(lim_n <= lim&&dp2[i][j][k]!=-1) 
            chmax(dp2[i+1][j+1][lim_n],dp2[i][j][k]+a.s);
        chmax(dp2[i+1][j][k],dp2[i][j][k]);
    }

    //rep(i,20) printf("%d %d\n",i,dp1[n][2][i]);
    //rep(i,20) printf("%d %d\n",i,dp2[m][2][i]);

    int ans=0;
    rep(i,lim) {
        int max1=max(dp1[n][1][i],dp1[n][2][i]);
        int max2=0;
        for(int j=x;j<=m;j++) for(int k=0;k<=lim-i;k++) chmax(max2,dp2[m][j][k]);

        chmax(ans,max1+max2);
        // printf("%d %d : %d\n",i,lim-i,max1+max2);
    }

    cout<<ans<<endl;
}

int main() {
    while(cin>>lim>>n>>m>>x) {
        if(lim+n+m+x==0) break;
        solve();
    }
    return 0;
}

Measured memory_bytes: 43968
N = int(input())
h_list = list(map(int, input().split()))

ans = 0
h_min = min(h_list)

ans += h_min

pre = h_min
for i in range(N):
    h = h_list[i]
    if i == 0:
        ans += h - h_min
        pre = h
    else:
        if h >= pre:
            ans += h - pre
            pre = h
        else:
            pre = h
print(ans)


Measured memory_bytes: 3060
#include <stdio.h>

int main(void) {
	int t,h,m,s;
	scanf("%d",&t);
	h=t/3600;
	m=(t%3600)/60;
	s=(t%3600)%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 1828
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

void PrintBitC(int c)
{
    int bit = 1 << 30;
    while (bit != 0)
    {
        if (c & bit)
            putchar('1');
        else
            putchar('0');
        bit >>= 1;
    }
    putchar('\n');
}


int main(){
    int n,k; cin >> n >> k;
    vector<ll> a(n), b(n);
    rep(i,n) cin >> a[i] >> b[i];
    ll ans = 0;
    rep(i,n) if((~k & a[i]) == 0) ans += b[i]; 
    for(int i=1;i<30;i++){
        if((1<<i & k) == (1<<i)){
            int tk = (~(1<<i) & k) | ((1<<i) - 1);
           // PrintBitC(tk);
            ll ta = 0;
            rep(j,n){
                if((~tk & a[j]) == 0) ta += b[j];
            }
            ans = max(ans, ta);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2304
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL A,B,N;

LL ans = 0;

LL f(LL x){
	return (A*x/B) - A*(x/B);
}

void solve(){
	if(B-1LL<=N){
		ans = f(B-1LL);
		return;
	}else{
		ans = f(N);
		return;
	}
}
 
int main(){
    cin >> A >> B >> N;

    solve();

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

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

using namespace std;

typedef unsigned long long int ll;

int main(void){
  ll H,W;
  cin >> H >> W;
  ll firstR,secondR;

  if(H == 1 || W == 1){
    cout << 1 << endl;
    return 0;
  }
  
  if(W%2 == 0){
    firstR = W/2;
    secondR = W/2;
  }else{
    firstR = (W+1)/2;
    secondR = firstR-1;
  }
  
  ll ans;
  if(H%2 == 0){
    ans = (H/2)*(firstR + secondR);
  }else{
    ans = ((H-1)/2)*(firstR + secondR);
    ans = ans + firstR;
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    int l[n];
    for (int i = 0; i < n; i++) {
        cin >> l[i];
    }
    partial_sort(l, l + k, l + n, greater<int>() );
    cout << accumulate(l, l + k, 0) << endl;
    return 0;
}


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

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int a = fs.nextInt();
        int b = fs.nextInt();
        int t = fs.nextInt();
        int ans = 0;
        for( float i = a ; i < t + 0.5f ; i += a ){
            ans += b;
        }
        System.out.println( ans );
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) {
                return buffer[ptr++];
            } else {
                return -1;
            }
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
                ptr++;
            }
            return hasNextByte();
        }

        public String next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
                throw new NumberFormatException();
            }
            return (int) nl;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


Measured memory_bytes: 21204
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
 
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <numeric>
#include <time.h>
#include <stack>
#include <bitset>

#define prev asasddlsa
#define rank aljds

#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i++)
 
using namespace std;
 
typedef long long ll;
typedef double dbl;
 
template<typename T>
void print(const vector<T>& s){
    for (auto x : s)
        cout << x << " ";
    cout << endl;
}
 
template<class T>   
void print(const T* s, int n){
    for (int i = 0; i < n; i++)
        cout << s[i] << ' ';
    cout << endl;
}

template<class T>
void print(vector<vector<T>> s){
    for (int i = 0; i < s.size(); i++)
        print(s[i]);
}


int solve(){
    int n, k;
    cin >> n >> k;
    vector<int> s(n);
    for (int& x : s)
        cin >> x;
    vector<int> lst(n + 1);
    for (int iter = 0; iter < k; iter++){
        fill(lst.begin(), lst.end(), 0);
        for (int i = 0; i < n; i++){
            int l = max(0, i - s[i]);
            int r = min(n - 1, i + s[i]);
            lst[r + 1]--, lst[l]++;
        }
        // print(lst);
        int cur = 0;
        bool ok = true;
        for (int i = 0; i < n; i++){
            cur += lst[i];
            s[i] = cur;
            if (s[i] != n)
                ok = false;
        }
        if (ok)
            break;
    }
    print(s);
    return 0;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(10);
    cout << fixed; 
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; i++){
        // cout << "Case #" << i + 1 << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 4784
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
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;}

int A,B;
inline void solve(){
  IN2(A,B);
  OUT(A>8||B>8?":(":"Yay!");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


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

int main(){
    double i,w,h,f=0;
    char c;
    while(cin>>i>>c>>w>>c>>h){
        if(w/h/h>=25){
            f=1;
            cout<<i<<endl;
        }
    }
    if(!f)cout<<"????????????"<<endl;
}

Measured memory_bytes: 1276
#include<bits/stdc++.h>
#define faster  ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
using namespace std;

int main()
{
    //faster

    int n;
    cin>>n;
    double a[n];
    for(int i=0; i<n; i++)
        cin>>a[i];

    sort(a,a+n);

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

    }

    //cout<<a[n-1]<<endl;
    printf("%lf\n",a[n-1]);




    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#include <iostream>

using namespace std;

bool sortBySecond(pair<int, long> a, pair<int, long> b) {
    return (a.second < b.second);
}

int main() {

    int N, M;
    cin >> N >> M;
    vector<long long> As;
    for (int i = 0; i < N; i++) {
        long long A;
        cin >> A;
        As.push_back(A);
    }

    vector<pair<int, long>> BCs;

    for (int i = 0; i < M; i++) {
        int B;
        long C;
        cin >> B >> C;
        BCs.emplace_back(B, C);
    }

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

    sort(BCs.rbegin(), BCs.rend(), sortBySecond);

    int aP = 0;

    bool end = false;

    for (int i = 0; i < M; i++) {

        if (end) {
            break;
        }

        for (int j = 0; j < BCs[i].first; j++) {

            if (aP >= N) {
                end = true;
                break;
            }

            if (As[aP] < BCs[i].second) {
                As[aP] = BCs[i].second;
                aP += 1;
            } else {
                end = true;
                break;
            }
        }
    }

    long long sum = 0;

    for (int i = 0; i < N; i++) {
        sum += As[i];
    }

    cout << sum << "\n";

    return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n,h; cin >> n >> h;
    vint a(n),b(n);
    rep(i,n) cin >> a[i] >> b[i];

    sort(all(b),greater<int>());
    int res=0;
    int maxa=MAX(a);
    rep(i,n){
        if(b[i]>maxa){
            h-=b[i];
            res++;
        }
        if(h<=0) {cout<<res<<endl; return 0;}
    }
    //cout<<h<<endl;
    res+=(h+maxa-1)/maxa;
    cout<<res<<endl;


}

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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
#define mt make_tuple
const ll MOD2 = 998244353;
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; }

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll N, M, V, P; cin >> N >> M >> V >> P;
  vector<ll> a(N), b(N), s(N); FOR(i,N){ cin >> a[i]; }
  
  //main
  sort(a.begin(), a.end(), greater<ll>());
  FOR(i,N){//受入票数と、順位に影響を及ぼさない票数の累積和
    if(a[i]>=a[P-1]){ b[i] = 0; }
    else{ b[i]+= b[i-1]+a[P-1]-a[i]; }
  }
  
  //FOR(i,N){ cout << b[i] << endl;}
  
  ll ans = 0;
  for(ll i=0; i<N; i++){
    if(a[i]>=a[P-1]){ ans ++; }//最初からボーダー圏内
    else if(a[i]+M<a[P-1]){ continue; }//全員が投票してもボーダー圏外
    else{
      if(V<=P+N-i-1){ ans ++; }//対抗馬に票が入らない
      else{
        ll tmp = (a[i]+M-a[P-1])*(i-P+1)+b[i-1];
        if(tmp>=(V-(P+N-i-1))*M){ ans ++; }
      }
    }
  }
  
  // output
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 2560
#pragma comment(linker, "/stack:200000000")
                #pragma GCC optimize ("Ofast")
                #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
                #include <iostream>
                #include <iomanip>
                #include <sstream>
                #include <cstring>
                #include <vector>
                #include <deque>
                #include <queue>
                #include <set>
                #include <map>
                #include <valarray>
                #include <iterator>
                #include <functional>
                #include <limits>
                #include <algorithm>
                #include <numeric>
                #include <cmath>
                #include <cassert>
                #include <unordered_map>
                #include <unordered_set>
                #include <stack>
                using namespace std;
                #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
                 #define trace(x) cerr << #x << ": " << x << " " << endl;
             
                typedef int64_t ll;
             
                #define endl '\n'
                #define int ll
                ll mod=1e9+7;
                ll mod1=1e9+5;
                
                ll power(ll a,ll b)
                {
                    if(b==0) return 1;
                    else if(b%2==0)
                        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
                    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
                }
                bool check(string s,string s1)
                {
                    int j=0;
                    for(int i=0;i<s.length();++i)
                    {
                        if(j==3)
                            break;
                        if(s[i]==s1[j])
                        {
                            j++;
                        }
                    }
                    if(j==3)
                        return 1;
                    return 0;

                }
             int32_t main()
                {
                IOS
                
                int n;
                cin>>n;
                string s;
                cin>>s;
                int ans=0;
                for(int i=0;i<=9;++i)
                {
                    for(int j=0;j<=9;++j)
                    {
                        for(int k=0;k<=9;++k)
                        {
                            char ch,ch1,ch2;
                            ch='0'+i;
                            ch1='0'+j;
                            ch2='0'+k;
                            string s1="";
                            s1+=ch;
                            s1+=ch1;
                            s1+=ch2;
                            if(check(s,s1))
                                ans++;
                        }
                    }
                }
                cout<<ans<<endl;


                
            }

Measured memory_bytes: 384
#include <stdio.h>

int main(void) {
    int n;
    scanf("%d", &n);

    int a[n];
    int buf;
    int flag = 0;

    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        if (i == 1) {
            buf = a[i];
            continue;
        }
        if (a[i] > buf) {
            buf = a[i];
        }
        if ((buf - a[i]) > 1) {
                flag = 1;
        }
    }

    if (flag > 0) {
        printf("%s\n", "No");
    } else {
        printf("%s\n", "Yes");
    }

    return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] arr = new int[n];
		int[] dp = new int[n];
		
		for(int i = 0;i < n;i++)
			arr[i] = sc.nextInt();
		
		Arrays.fill(dp, 0);
		
		if(n == 1) {
			System.out.println(arr[0]);
			return;
		}
		
		
		for(int i = 1;i < n;i++) {
			int min = Integer.MAX_VALUE;
			for(int j = Math.max(0, i - k);j < i;j++) {
				min = Math.min(min, Math.abs(arr[i] - arr[j]) + dp[j]);
			}
			dp[i] = min;
		}
		
		System.out.println(dp[n-1]);
		return;
		
	}
}


Measured memory_bytes: 59888
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int l, r, d;
    cin >> l >> r >> d;
    int ret = 0;
    for (int i = l; i <= r; i++) {
        if (i % d == 0)ret++;
    }
    cout << ret << endl;
    return 0;
}

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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 1e5;

string s;

map <string, int> res;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> s;
    res["SUN"] = 7;
    res["MON"] = 6;
    res["TUE"] = 5;
    res["WED"] = 4;
    res["THU"] = 3;
    res["FRI"] = 2;
    res["SAT"] = 1;
    cout << res[s];
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
const int INF = 1 << 30;
 
struct SegNode
{
  int v;
 
  SegNode(int v) : v(v) {}
 
  SegNode operator*(const SegNode &r) const
  {
    return (v < r.v ? *this : r);
  }
} e(INF);
 
struct SegmentTree
{
  int sz;
  vector< SegNode > seg;
 
  SegmentTree(int n)
  {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz - 1, e);
  }
 
  void update(int k, const SegNode &x)
  {
    k += sz - 1;
    seg[k] = x;
    while(k > 0) {
      k = (k - 1) >> 1;
      seg[k] = seg[2 * k + 1] * seg[2 * k + 2];
    }
  }
 
  SegNode query(int a, int b, int k, int l, int r)
  {
    if(a >= r || b <= l) return (e);
    if(a <= l && r <= b) return (seg[k]);
    return (query(a, b, 2 * k + 1, l, (l + r) >> 1) * query(a, b, 2 * k + 2, (l + r) >> 1, r));
  }
 
  SegNode query(int a, int b)
  {
    return (query(a, b, 0, 0, sz));
  }
};
 
int main()
{
  int N, K;
  string S, T;
 
  cin >> N >> K;
 
  cin >> S;
  cin >> T;
 
  vector< int > sweep(N + 1);
  for(int i = 0; i + 1 < N; i++) {
    if(T[i] != T[i + 1]) sweep[i + 1] = 1;
    sweep[i + 1] += sweep[i];
  }
 
  SegmentTree seg(N);
  vector< int > dp(N + 1, INF);
  dp[0] = 0;
  seg.update(0, 0);
  for(int i = 1; i <= N; i++) {
    dp[i] = min(dp[i - 1] + (S[i - 1] != T[i - 1]), (seg.query(i - K, i - 1).v + 3 + sweep[i - 1]) / 2);
    seg.update(i, dp[i] * 2 - sweep[i]);
  }
  cout << dp.back() << endl;
}

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


using namespace std;


using ll = long long;




int main(void) {
    ll N;
    cin >> N;
    vector<ll> lines(N);
    ll ans = 0;
    for (ll i = 0; i < N; i++) {
        cin >> lines[i];
    }

    for (ll i = 0; i < N; i++) {
        for (ll j = i + 1; j < N; j++) {
            for (ll k = j + 1; k < N; k++) {
                ll a, b, c;
                a = lines[i];
                b = lines[j];
                c = lines[k];
                if (a == b || b == c || c == a)
                    continue;
                bool ok = ((a + b > c) && (b + c > a) && (c + a > b));
                if (ok) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}


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

int allTime;

struct Data{
	char name[10];
	int time;
};

Data Q[100000];
int head,tail;
int MAX;

void init(int n){
	head=tail=allTime=0;
	MAX = n+1;
}

bool isEmpty(){
	return head==tail;
}

bool isFull(){
	return head == (tail+1)%MAX;
}

void enqueue(Data D){
	if(tail==MAX){
		tail=0;
	}
	Q[tail] = D;
	tail++;
}

Data dequeue(){
	Data D;
	D = Q[head];
	head++;
	if(head==MAX){
		head=0;
	}
	return D;
}

int main(){
	int n,q;
	scanf("%d%d",&n,&q);
	init(n);
	for(int i=0;i<n;i++){
		Data T;
		scanf("%s",T.name);
		scanf("%d",&T.time);
		enqueue(T);
	}
	
	while(!isEmpty()){
		Data T;
		T = dequeue();
		
		
		if(T.time > q){
			T.time -= q;
			allTime += q;
			enqueue(T);
		}else{
			allTime += T.time;
			printf("%s ",T.name);
			cout<<allTime<<endl;
		}
		
	}
	
	return 0;
}

Measured memory_bytes: 2020
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    vector<ll> a(N); for(auto& in:a) cin >> in;

    ll cnt = 0;
    ll now = 1;
    for(int i = 0; i < N;i++){
        if(a[i] == now){
            now++;
            cnt++;
        }
    }
    if(cnt == 0) res = -1;
    else res = N-cnt;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_169_Multiplication_1
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            int result =inputLongArray[0] * inputLongArray[1];

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28220
/*~~~~~~ !! Roopam Mishra !!
 
    " ॐ नमः शिवाय "
    
    जो वास्तविक नहीं है उससे कभी भी मत डरो.
    
    “And don’t you dare call this code pathetic, you foul — you evil little cockroach!!”
    Even I don't understand now what I wrote, yet you are not allowed to call this pathetic..
                                                                                ~~~~~~*/
 
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define MOD 1000000007
#define INF 1000000000000000000
#define endll "\n"
#define pb push_back
#define forn(i,n) for(i=0;i<n;i++)
#define forab(i,a,b) for(i=a;i<=b;i++)
#define vpll vector<pair<ll,ll>>
#define pll pair<ll,ll>
#define vll vector<ll>
#define ff first
#define ss second
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define test ll t;cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main() 
{
	fast_io;
	ll n,k,i,j;
	cin>>n>>k;
	ll a[n],h[n];
	forn(i,n)cin>>a[i];
	h[0]=0;
	h[1]=abs(a[0]-a[1]);
	for(i=2;i<min(k,n);i++)
	{
	    ll mini=LLONG_MAX;
	    for(j=0;j<i;j++)
	    {
	        mini=min(mini,h[j]+abs(a[i]-a[j]));
	    }
	    h[i]=mini;
	}
	for(i=k;i<n;i++)
	{
	    ll mini=LLONG_MAX;
	    for(j=i-k;j<i;j++)
	    {
	        mini=min(mini,h[j]+abs(a[i]-a[j]));
	    }
	    h[i]=mini;
	}
	cout<<h[n-1]<<endll;
	return 0;
} 

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MOD=1e9+7;
const int MAX=1e3;

int prime[MAX+1];
bool isp[MAX+1];

int main(){
		//入力
	int N;
	cin >> N;
	
	int p = 0;
	//初期化
	for(int i=0;i<=N;i++)
		isp[i]=true;
	isp[0]=isp[1]=false;
	//2以上で素数ならふるい落とす
	for(int i=2;i<=N;i++){
		if(isp[i]){
			p++;
			prime[p]=i;
			for(int j=2*i;j<=N;j+=i) isp[j]=false;
		}
	}
	lli ans=1;
	rep1(i,p){
		int sum=0,x=N;
		while(x>0){
			x=x/prime[i];
          	sum+=x;
		}
		ans=ans*(1+sum)%MOD;
	}
	cout<<ans;
	
}

Measured memory_bytes: 256
import math
f = []
while True:
    try:
        st = input().strip().split(',')
        x,y = list(map(float,st ))
        f.append(x + y*1j)
    except EOFError:
        break

ss = 0.0
fo = f[0]
for j in range(2,len(f)):
    i = j - 1
    a = abs(f[i]-fo)
    b = abs(f[j]-fo)
    c = abs(f[j]-f[i])
    z = (a + b + c) / 2.0
    s = math.sqrt(z*(z-a)*(z-b)*(z-c))
    ss += s
print("%.6f" % ss)

Measured memory_bytes: 7488
package main

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

var count int

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	length, _ := strconv.Atoi(sc.Text())
	A := make([]int, length)
	i := 0
	for sc.Scan() {
		A[i], _ = strconv.Atoi(sc.Text())
		i++
	}

	mergeSort(A, 0, length)
	fmt.Println(strings.Trim(fmt.Sprint(A), "[]"))
	fmt.Println(count)
}

func merge(A []int, left int, mid int, right int) {
	n1 := mid - left
	n2 := right - mid

	L := make([]int, n1+1)
	R := make([]int, n2+1)
	for i := 0; i <= n1-1; i++ {
		L[i] = A[left+i]
	}
	for i := 0; i <= n2-1; i++ {
		R[i] = A[mid+i]
	}
	L[n1] = int(math.Pow(10, 9)) + 1
	R[n2] = int(math.Pow(10, 9)) + 1

	i := 0
	j := 0

	for k := left; k <= right-1; k++ {
		count++
		if L[i] <= R[j] {
			A[k] = L[i]
			i++
		} else {
			A[k] = R[j]
			j++
		}
	}

}

func mergeSort(A []int, left int, right int) {
	if left+1 < right {
		mid := (left + right) / 2
		mergeSort(A, left, mid)
		mergeSort(A, mid, right)
		merge(A, left, mid, right)
	}
}



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

#define INF 1e9
using namespace std;

int main() {

    int N; cin >> N;

    vector<int> x(N), y(N), h(N);
    int si = -1;

    for (int i = 0; i < N; ++i) {
        cin >> x[i] >> y[i] >> h[i];

        if (h[i] > 0) {
            si = i;
        }
    }

    //答えは最初はあり得ない点にしておく
    int resx = -1, resy = -1, resh = -1;

    //座標について全探索
    for (int posx = 0; posx <= 100 ; ++posx) {
        for (int posy = 0; posy <= 100; ++posy) {
            //高さ > 0の点から求めた高さH
            int tmph = h[si] + abs(x[si] - posx) + abs(y[si] - posy);

            bool ok = true;

            //上で求めた高さHが他の全ての点で満たされているか調べる
            for (int i = 0; i < N; ++i) {
                //高さがある点の場合
                if (h[i] > 0 && tmph != h[i] + abs(x[i] - posx) + abs(y[i] - posy)) {
                    ok = false;
                }

                //高さが0の点の場合
                //H-|X-Cx|-|Y-Cy| < 0が正しい条件なので、その反対で正の場合は満たされていない
                if (h[i] == 0 && tmph > abs(x[i] - posx) + abs(y[i] - posy)) {
                    ok = false;
                }
            }

            if (ok) {
                resx = posx;
                resy = posy;
                resh = tmph;
            }
        }
    }

    cout << resx << " " << resy << " " << resh << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define ll long long

int main(){
  string s;cin>>s;
  if(s=="Sunny")
    cout<<"Cloudy";
  else if(s=="Cloudy")
    cout<<"Rainy";
  else
    cout<<"Sunny";
}
  

Measured memory_bytes: 256
/**
 *  author:   TakeruOkuyama
 *  created:  2020-04-08 11:25:40
**/
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P =pair<int,int>;

int main(){
    string s, t;
    cin >> s >> t;
    vector<int> ss(26, 0), tt(26, 0);
    rep(i, s.size()){
        ss[int(s[i])-97]++;
    }
    rep(i, t.size()){
        tt[int(t[i])-97]++;
    }
    reverse(tt.begin(), tt.end());
    string sss="",ttt="";
    rep(i, 26){
        rep(j,ss[i]){
            sss+=(char(i+97));
        }
    }
    rep(i, 26){
        rep(j,tt[i]){
            ttt+=char(122-i);
        }
    }
    //cout << sss << endl << ttt << endl;
    //cout<<strcmp("aaa","vvv")<<endl;
    /*rep(i, 26){
        cout<<ss[i]<<" ";
    }
    cout<<endl;
    rep(j, 26){
        cout<<tt[j]<<" ";
    }
    cout<<endl;
    /*if(strcmp(sss, ttt)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }*/
    if(sss<ttt){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
return 0;}

/**
 * compile: g++ code.cpp
 * run: ./a.out
 * insert date string: ctrl + shift + i
 * 
**/ 

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

using namespace std;

vector<int> h;
vector<int> dp;
int cost(int i, int j) {
	return abs(h[i] - h[j]);
}
// bottom up
// int main() {
// 	int n;
// 	cin>>n;
// 	h.resize(n);
// 	for(int i=0; i<n; i++) {
// 		cin>>h[i];
// 	}
// 	dp.resize(n);
// 	dp[0] = 0;
// 	dp[1] = abs(h[0]-h[1]);
// 	for(int i=2; i<n; i++) {
// 		dp[i] = min(dp[i-1] + cost(i,i-1), dp[i-2] + cost(i,i-2));
// 	}
// 	cout<<dp[n-1]<<endl;
// 	return 0;
// }

int func(int idx) {
	if(idx>=dp.size() || idx<0)
		return INT_MAX;
	if(dp[idx]!=-1)
		return dp[idx];
	if(idx==0)
		return dp[0] = 0;
	if(idx==1)
		return dp[1] = cost(0,1);
	dp[idx] = min(func(idx-1) + cost(idx,idx-1), func(idx-2) + cost(idx,idx-2));
	return dp[idx];
}

int main() {
	int n;
	cin>>n;
	h.resize(n);
	for(int i=0; i<n; i++) {
		cin>>h[i];
	}
	dp.resize(n,-1);
	cout<<func(n-1)<<endl;
	return 0;
}



Measured memory_bytes: 3328
//Code Author: S.M. Istiak Ahmed
#include<bits/stdc++.h>
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
using namespace std;

struct mc{
    vector<ll> v;
    stack<ll> g,s;
};
struct st{
    int val,l,r;
};
ll getMax(mc &x){
  return x.v[x.g.top()];
}
ll getMin(mc &x){
  return x.v[x.s.top()];
}
ll top(mc &x){
  return x.v.back();
}
bool isEmpty(mc &x){
  if(x.v.size()) return 0;
  return 1;
}
void pushVal(mc &x,ll val){
  ll sz=x.v.size();
  x.v.push_back(val);
  if(x.g.empty()) x.g.push(sz);
  else if(val>=x.v[x.g.top()]) x.g.push(sz);
  if(x.s.empty()) x.s.push(sz);
  else if(val<=x.v[x.s.top()]) x.s.push(sz);
}
void popVal(mc &x){
  ll sz=x.v.size();
  if(!sz){
    return;
  }
  if(sz-1==x.g.top()) x.g.pop();
  if(sz-1==x.s.top()) x.s.pop();
  x.v.pop_back();
}

int power(ll x,ll y,int p){
    int res=1;
    //x=x%p;
    if(x==0) return 0;
    while(y>0){
        if(y&1)
            res=(res*x);
        y=y>>1;
        x=(x*x);
    }
    return res;
}
bool isPrime(int n){
    if(n<=1)
        return 0;
    if(n<=3)
        return 1;
    if(n%2==0 || n%3==0)
        return 0;
    for(int i=5; i*i<=n; i+=6){
        if(n%i==0 || n%(i+2)==0){
            return 0;
        }
    }
    return 1;
}
int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ll x,k,d,ans;
  cin>>x>>k>>d;
  x=abs(x);
  if(x/d<=k){
    ans=x%d;
    if((k-(x/d))&1) ans-=d,ans=abs(ans);
  }else ans=x-(k*d);
  cout<<ans;
  return 0;
}


Measured memory_bytes: 3644
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

ans = sum(b)
for i in range(n-1):
    now = a[i]
    if a[i+1] == now +1:
        ans += c[now-1]
print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int64_t dceil(int64_t, int64_t);
int64_t dfloor(int64_t, int64_t);

int64_t dceil(int64_t x, int64_t y)
{
    if (y < 0) {
        return dceil(-x, -y);
    }
    if (x < 0) {
        return -dfloor(-x, y);
    }
    return (x + y - 1) / y;
}

int64_t dfloor(int64_t x, int64_t y)
{
    if (y < 0) {
        return dfloor(-x, -y);
    }
    if (x < 0) {
        return -dceil(-x, y);
    }
    return x / y;
}

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

    vector<int> ss;
    irep(i, f / c) irep(j, f / d)
    {
        int v = i * c + j * d;
        if (v <= f) {
            ss.push_back(v);
        }
    }
    sort(ss.begin(), ss.end());
    ss.erase(unique(ss.begin(), ss.end()), ss.end());

    vector<int> ws;
    irep(i, f / (100 * a)) irep(j, f / (100 * b))
    {
        int v = i * a + j * b;
        if (v <= f) {
            ws.push_back(v);
        }
    }
    sort(ws.begin(), ws.end());
    ws.erase(unique(ws.begin(), ws.end()), ws.end());

    int rs = 0, rm = 0;
    for (const int w : ws) {
        for (const int s : ss) {
            int m = 100 * w + s;
            if (s <= e * w && m <= f) {
                if (rs * m <= s * rm) {
                    rs = s;
                    rm = m;
                }
            }
        }
    }

    cout << rm << " " << rs << endl;
    return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

void chmin(int &a, int b){
  if(a > b)
    a = b;
}
void chmax(int &a, int b){
  if(a < b)
    a = b;
}

void llchmin(ll &a, ll b){
  if(a > b)
    a = b;
}
void llchmax(ll &a, ll b){
  if(a < b)
    a = b;
}

int main(){
  int n, k;
  cin >> n >> k;
  
  int cnt = 0, num = 1;
  while(true){
    if(n < num){
      cout << cnt << endl;
      break;
    }
    
    else{
      num *= k;
      cnt ++;
    }
  }
  
  return 0;
  
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repc(i, t, n) for(int i = t; i < (n); ++i)

using namespace std;
using ll = long long;

int main(){

	int r; cin >> r;

	cout << 2 * r * M_PI << endl;

	return 0;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int dp[10000][10000];
int ways(char** mat,int n,int m,int si,int sj)
{
    if(si==n-1 && sj==m-1)
    {
        return 1;
    }
    if(si>=n || sj>=m)
    {
        return 0;
    }
    if(mat[si][sj]=='#')
        return 0;
    if(dp[si][sj]>-1)
        return dp[si][sj];
    int option1=ways(mat,n,m,si+1,sj)%MOD;
    int option2=ways(mat,n,m,si,sj+1)%MOD;
    return dp[si][sj]=(option1+option2)%MOD;
}
int main()
{
    int n,m;
    cin>>n>>m;
char **mat=new char*[n];
    {
        for(int i=0;i<n;i++)
        {
            mat[i]=new char[m];
            for(int j=0;j<m;j++)
            {
                cin>>mat[i][j];
            }
        }
    }
    memset(dp,-1,sizeof(dp));
    cout<<ways(mat,n,m,0,0)<<endl;
}

Measured memory_bytes: 395300
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>

using namespace std;

int N, L;
vector<string>s;

int is_pali(string s1){
  for(int i=0;i<s1.size()/2;i++){
    if(s1[i] != s1[s1.size()-i-1]){
      return 0;
    }
  }
  return 1;
}

int is_reverse(string s1, string s2){
  reverse(s2.begin(), s2.end());
  return !s1.compare(s2);
}

int main()
{
  cin >> N >> L;
  for(int i=0;i<N;i++){
    string x;
    cin >> x;
    s.push_back(x);
  }
  sort(s.begin(), s.end());
  string resf = "";
  string resb = "";
  set<int>S;
  for(int i=0;i<s.size();i++){
    for(int j=i+1;j<s.size();j++){
      //      cout << s[i] << " " << s[j] << endl;
      if(is_reverse(s[i], s[j])){
	resf += s[i];
	resb =  s[j] + resb;
	S.insert(i);
	S.insert(j);
	s.erase(s.begin() + j);
	s.erase(s.begin() + i);
	i--;
	break;
      }
    }
  }
  string mid = "";
  for(int i=0;i<s.size();i++){
    if(is_pali(s[i])){
      mid = s[i];
      break;
    }
  }
  //  cout << S.size() << endl;
  cout << resf << mid << resb << endl;
  return 0;
}

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

int main(){
    int n;

    cin >> n;

    for (int i = 1; i <= n; i++){
        int x = i;
        if ( x % 3 == 0) cout << " " << i;
        else {
            while (x != 0) {
                if ( x % 10 == 3) {
                    cout << " " << i;
                    break;
                }
                else x /= 10;
            }
        }
    }
    cout << endl;
    
}



Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N - 1);
    REP(i, N)
    {
        cin >> A[i];
    }
    REP(i, N)
    {
        cin >> B[i];
    }
    REP(i, N - 1)
    {
        cin >> C[i];
    }

    int res = 0;
    REP(i, N)
    {
        res += B[A[i] - 1];
        if (i == 0)
        {
            continue;
        }
        if (A[i] - A[i - 1] == 1)
        {
            res += C[A[i - 1] - 1];
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <cmath>
#include <map>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 100000;
int a[1 + nmax], b[1 + nmax];

int main() {
  int n;
  std::cin >> n;
  for(int i = 1;i <= n; i++)
    std::cin >> a[i] >> b[i];
  ll result = 0;
  for(int i = n; 1 <= i; i--) {
    if((a[i] + result) % b[i] == 0)
      continue;
    else 
      result += b[i] - (a[i] + result) % b[i];
  }
  std::cout << result;
  return 0;
}


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

const int maxV = 100000;
const int maxW = 1000000001;

int dp[101][maxV + 1];

int main() {
    int n, W;
    cin >> n >> W;
    vector<int> w(n), v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> w.at(i) >> v.at(i);
    }
    
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= maxV; j++)
        {
            dp[i][j] = maxW;
        } 
    }
    
    dp[0][0] = 0;
    for (int i = 0; i < n; i++)
    {
        for (int sum_v = 0; sum_v <= maxV; sum_v++)
        {
            if (sum_v - v.at(i) >= 0 && dp[i][sum_v - v.at(i)] < maxW) {
                dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - v.at(i)] + w.at(i));
            }
            dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v]);
        }
    }
    
    int ans = 0;
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= maxV; j++)
        {
            if (dp[i][j] <= W) ans = max(ans, j);
        }
        
    }
    cout << ans << endl;
}


Measured memory_bytes: 39680
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def inverse(N, mod):
	return (pow(N, mod - 2, mod))

def main():
	a, b, c, d = getlist()
	ans = max(a * c, a * d, b * c, b * d)
	print(ans)





if __name__ == '__main__':
	main()

Measured memory_bytes: 64732