akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(){
  int n;
  while(1){
    cin >> n;
    if(n == -1)break;
    int num = 4280;
    int t,t2,t3,t4;
     t2=t3=t4=0;
     t = 1150;
     if(10 < n&&n <= 20){
       t2 = n-10;
     }else if(20 < n&&n <= 30){
       t2 = 10;
       t3 = n-20;
     }else if(30 < n){
       t2 = 10;
       t3 = 10;
       t4 = n-30;
     }
    int ans = t + t2*125 + t3*140 + t4*160;
    cout << num-ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define pll     pair<long long, long long>
#define ll      long long

int main() {
        string s;
        cin >> s;
        for (int i = 0; i < s.size() - 1; i ++) {
                if (s[i] == 'A' && s[i + 1] == 'C') {
                        cout << "Yes" << endl;
                        return 0;
                }
        }
        cout << "No" << endl;
        return 0;
        return 0;
}



Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC083
{
    class C
    {
        static void Main(string[] args)
        {
            long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long X = input[0];
            long Y = input[1];

            long res = X;
            int i = 0;
            //while (X * Math.Pow(2, i) <= Y) i++;

            while (res <= Y)
            {
                i++;
                res *= 2;
            }

            Console.WriteLine(i);
        }
    }
}


Measured memory_bytes: 13268
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef long long ll;
const int maxn = 100005;
int a[maxn], b[maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i <= n; i++)cin >> a[i];
	for (int i = 0; i < n; i++)cin >> b[i];
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] > b[i])ans += b[i];
		else {
			ans += a[i];
			b[i] -= a[i];
			ans += min(b[i], a[i + 1]);
			a[i + 1] -= min(b[i], a[i + 1]);
		}
	}
	cout << ans << endl;;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define Task "A"

using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int a, b;
    cin >> a >> b;
    if (a - 2 * b > 0) cout << a - 2*b;
    else cout << 0;

    return 0;
}



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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int a, b, h;
  cin >> a >> b >> h;
  cout << (a+b) * h / 2 << endl;

  return 0;
}


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

using LL = long long;

int N;
string S;
LL dfs(int i, stack<LL>& st){
  if(i == N){
	LL res = 0;
	stack<LL> tmp = st;
	while(!tmp.empty()){
	  res += tmp.top();
	  tmp.pop();
	}
	return res;
  }
  
  LL res = 0;
  for(int j=i+1;j<=N;++j){
	st.push(stol(S.substr(i,j-i)));
	res += dfs(j, st);
	st.pop();
  }
  return res;
}

int main(){
  cin >> S;
  N = S.size();

  stack<LL> st;
  cout << dfs(0, st) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

typedef long long ll;

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

// const int C ;
// const int M = 1000000007;

string P[100010];
int a[26];

int main () {
  int N, K;
  cin >> N >> K;
  for (auto i = 0; i < N; i++) {
    cin >> P[i];
  }
  fill(a, a+26, 0);
  for (auto i = 0; i < N; i++) {
    a[P[i][0] - 'A']++;
  }
  int ans = 0;
  while (true) {
    sort(a, a+26);
    reverse(a, a+26);
    bool ok = false;
    int cnt = 0;
    for (auto i = 0; i < 26; i++) {
      if (a[i] > 0) {
        a[i]--;
        cnt++;
        if (cnt == K) {
          ok = true;
          break;
        }
      }
    }
    if (ok) {
      ans++;
    } else {
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1664
#include <iostream>
#define MAX 100000
#define NIL -1
using namespace std;

struct Node {
    int parent;
    int left;
    int right;
};

struct Node T[MAX];
int D[MAX];
int n;

int getDepth(int u) {
    int d = 0;
    while ( T[u].parent != NIL ) {
        u = T[u].parent;
        d++;
    }
    return d;
}

void setDepth(int u, int p) {
    D[u] = p;
    if ( T[u].right != NIL ) {
        setDepth(T[u].right,p);
    }
    if ( T[u].left != NIL ) {
        setDepth(T[u].left,p+1);
    }
}

void printChildren(int u) {
    int c = T[u].left;
    while ( c != NIL ) {
        cout << c;
        c = T[c].right;
    }
}

void print(int u) {
    int i, c;
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].parent << ", ";
    cout << "depth = " << D[u] << ", ";

    if ( T[u].parent == NIL ) cout << "root, ";
    else if ( T[u].left == NIL ) cout << "leaf, ";
    else cout << "internal node, ";

    cout << "[";

    for ( i = 0, c = T[u].left; c != NIL; ++i, c = T[c].right ) {
        if ( i ) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}

int main() {
    int i, j, d, v, c, l = 0, r = 0;
    cin >> n;
    for ( i = 0; i < n; ++i ) T[i].parent = T[i].left = T[i].right = NIL;

    for ( i = 0; i < n; ++i ) {
        cin >> v >> d;
        for ( j = 0; j < d; ++j ) {
            cin >> c;
            if ( j == 0 ) T[v].left = c;
            else T[l].right = c;
            l = c;
            T[c].parent = v;
        }
    }
    for ( i = 0; i < n; ++i ) {
        if ( T[i].parent == NIL ) r = i;
    }

    setDepth(r,0);
    for ( i = 0; i < n; ++i ) print(i);
    return 0;
}


Measured memory_bytes: 7776
use std::str::FromStr;
use std::collections::HashSet;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn main() {
    let s : String = get_one();
    let mut set : HashSet<char> = HashSet::new();
    for c in s.chars() {
        set.insert(c);
    }
    let t = "abcdefghijklmnopqrstuvwxyz".to_string();
    let mut ans = None;
    for c in t.chars() {
        if !set.contains(&c) {
            ans = Some(c);
            break;
        }
    }
    match ans {
        None => println!("{}", "None"),
        Some(x) => println!("{}", x),
    }
}


Measured memory_bytes: 4352
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
char s[100][100];
int n,m,tot;
int qx[10000],qy[10000],h,t,dep[100][100];
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
	{
		scanf("%s",s[i]+1);
		for (int j=1;j<=m;j++) if (s[i][j]=='.') tot++;
	}
	qx[++t]=1,qy[t]=1;dep[1][1]=1;
	while (h<t)
	{
		int nx=qx[++h],ny=qy[h];
		//cout<<
		for (int k=0;k<4;k++)
		{
			int xx=nx+dx[k],yy=ny+dy[k];
			if (xx==n&&yy==m) {printf("%d",tot-dep[nx][ny]-1);return 0;}
			if (xx>=1&&xx<=n&&yy>=1&&yy<=m)
			{
				if (!dep[xx][yy]&&s[xx][yy]=='.')
					dep[xx][yy]=dep[nx][ny]+1,qx[++t]=xx,qy[t]=yy;
			}
		}
	}
	printf("-1");
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int n, u, v, m; cin >> n >> u >> v >> m;

	vector<vector<int>> usagi(n + 1, vector<int>(n + 1, 0));
	vector<vector<int>> neko(n + 1, vector<int>(n + 1, 0));
	map<int, pair<int,int>> usagi_dayo, neko_dayo;

	/* input 1 */
	for (int i = 1; i <= n;i++) for (int j = 1; j <= n;j++) {
		cin >> usagi[i][j];
		usagi_dayo[usagi[i][j]] = { i,j };
	}
	for (int i = 1; i <= n;i++) for (int j = 1; j <= n;j++) {
		cin >> neko[i][j];
		neko_dayo[neko[i][j]] = { i,j };
	}

	/* initialize */
	/*	
		yoko := sum of x axis
		tate := sum of y axis
		naname := lower_right_diagonal(0),upper_right_diagonal(1)
	*/
	vector<int> usagi_yoko(n+1, 0), usagi_tate(n+1, 0), usagi_naname(2, 0);
	vector<int> neko_yoko(n+1, 0), neko_tate(n+1, 0), neko_naname(2, 0);
	for (int i = 1; i <= n;i++) {
		for (int j = 1; j <= n;j++) {
			// usagi[tate][yoko]
			// tate[tate][yoko]
			if (i == j) {
				usagi_naname[0]++;
				neko_naname[0]++;
			}
			if (i + j == n + 1) {
				usagi_naname[1]++;
				neko_naname[1]++;
			}

			usagi_tate[i]++;
			usagi_yoko[j]++;

			neko_tate[i]++;
			neko_yoko[j]++;
		}
	}

	/* input 2 */
	vector<int> card(m);
	for (int i = 0; i < m;i++) cin >> card[i];

	/* solve */
	for (int i = 0; i < m;i++) {
		auto usasa = usagi_dayo[card[i]];
		auto nekoko = neko_dayo[card[i]];

		/* usagi */
		if (usasa.first != 0 && usasa.second != 0) {
			if (n == 1) {
				u--;
			}
			else {
				if (usasa.first == usasa.second) {
					usagi_naname[0]--;
					if (usagi_naname[0] <= 0)u--;
				}
				if (usasa.first + usasa.second == n + 1) {
					usagi_naname[1]--;
					if (usagi_naname[1] <= 0)u--;
				}
				usagi_tate[usasa.first]--;
				usagi_yoko[usasa.second]--;

				if (usagi_tate[usasa.first] <= 0)u--;
				if (usagi_yoko[usasa.second] <= 0)u--;
			}
		}

		/* neko */
		if (nekoko.first != 0 && nekoko.second != 0) {
			if (n == 1) {
				v--;
			}
			else {
				if (nekoko.first == nekoko.second) {
					neko_naname[0]--;
					if (neko_naname[0] <= 0)v--;
				}
				if (nekoko.first + nekoko.second == n + 1) {
					neko_naname[1]--;
					if (neko_naname[1] <= 0)v--;
				}
				neko_tate[nekoko.first]--;
				neko_yoko[nekoko.second]--;

				if (neko_tate[nekoko.first] <= 0)v--;
				if (neko_yoko[nekoko.second] <= 0)v--;
			}
		}

		if (u <= 0 && v <= 0) {
			cout << "DRAW" << endl;
			return 0;
		}
		else if (u <= 0) {
			cout << "USAGI" << endl;
			return 0;
		}
		else if (v <= 0) {
			cout << "NEKO" << endl;
			return 0;
		}
	}
	cout << "DRAW" << endl;
	return 0;
}

Measured memory_bytes: 23712
using System;
 
public class AtCoder
{
    public static void Main()
    {
        int n;
        n = int.Parse(Console.ReadLine().Trim());
        string[] s;
        s = Console.ReadLine().Trim().Split(' ');
        int[] a = new int[n];
        double avg = 0;
        for (int i = 0; i < n; i++)
        {
            a[i] = int.Parse(s[i]);
            avg = avg + a[i];
        }
        avg = avg / n;
        double m, ans;
        m = 10000000;
        for (int i = 0; i < n; i++)
        {
            m = Math.Min(m, (double)Math.Abs(avg - a[i]));
            
        }
        ans = -1;
        int j = 0;
        while (ans == -1)
        {
          	
            if ((double)Math.Abs(avg - a[j]) == m) ans = j;
            j++;
        }
 
 
            Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13140
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> arr = new ArrayList<>();
    int count = 0;
    for(int i = 0; i < n; i++) {
      arr.add(sc.nextInt());
    }
    for(int i = 0; i < n - 1; i++) {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    }
    System.out.println(arr.get(n - 1));
    System.out.println(count);
  }
}



Measured memory_bytes: 26452
use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| i64::from_str(n).unwrap());
    let (a, b, c) = (it.next().unwrap(), it.next().unwrap(),  it.next().unwrap());
    if c >= a && c <= b {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll n;
    cin >> n;
    vector<ll> x(n);
    vector<ll> y(n);
    for(int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
    }
    for(int i = 0; i < n-1; i++)
    {
        if(((x[i] + y[i])%2 == 0 && (x[i+1] +y[i+1])%2 == 0) 
        || ((x[i] + y[i])%2 != 0 && (x[i+1] +y[i+1])%2 != 0))
        {
            continue;
        }
        else
        {
            cout << -1 << endl;
            return 0;
        }
    }
    vector<ll> arm;
    if((x[0]+y[0]) % 2 == 0)
    {
      cout << 32 << endl;
      arm.push_back(1);  
    }
    else
    {
      cout << 31 << endl;
    }
    ll j = 1;
    for(int i = 0; i < 31; i++)
    {
        arm.push_back(j);
        j = j << 1;
    }
    reverse(arm.begin(), arm.end());
    for(int i = 0; i < arm.size()-1; i++)
    {
        cout << arm[i] << " ";
    }
    cout << arm[arm.size()-1] << endl;

    for(int i = 0; i < n; i++)
    {
        ll u = x[i] + y[i];
        ll v = x[i] - y[i];
        ll nx = 0;
        ll ny = 0;
        for(int j = 0; j < arm.size(); j++)
        {
            if(nx <= u && ny <= v)
            {
                cout << "R";
                nx += arm[j];
                ny += arm[j];
            }
            else if(nx >= u && ny >= v)
            {
                cout << "L";
                nx -= arm[j];
                ny -= arm[j];
            }
            else if(nx <= u && ny >= v)
            {
                cout << "U";
                nx += arm[j];
                ny -= arm[j];
            }
            else
            {
                cout << "D";
                nx -= arm[j];
                ny += arm[j];
            }
        }
        cout << endl;
    }
}


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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

	int h, w, a, b;
	cin >> h >> w >> a >> b;

	vector<vector<int>> mat(h, vector<int>(w, 0));

	rep (i, 0, h) {
		rep (j, 0, w) {
			if ((j < a && i < b) || (j >= a && i >= b)) {
				mat[i][j] = 0;
			} else {
				mat[i][j] = 1;
			}
		}
	}

	rep (i, 0, h) {
		rep (j, 0, w) {
			cout << mat[i][j];
		}
		cout << endl;
	}

	return 0;
}


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

//flagを用いたバブルソート
int bubbleSort(int A[], int N) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) { //ソート済みならブレイク
		flag = 0;
		for (int j = N - 1; j >= i + 1; j--) {
			if (A[j] < A[j - 1]) {
				swap(A[j], A[j - 1]);
				flag = 1;
				sw++;
			}
		}
	}
	return sw;
}


int main() {
	int A[100], N, sw;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];

	sw = bubbleSort(A, N);

	for (int i = 0; i < N; i++) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw << endl;

	return 0;
}


Measured memory_bytes: 3116
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>

using namespace std;

int main()
{
    char s1[11];
    char s2[11];
    char s3[11];

    if (scanf("%s%s%s", s1, s2, s3) < 3) return 0;

    printf("%c%c%c\n", s1[0] - 32, s2[0] - 32, s3[0] - 32);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){
	int N,c=0;
	cin >> N;
	int a[N];
	for(int i=0;i<N;i++){
		cin >> a[i];
	}
	for(int i=0;i<N;i++){
		if((i+1)%2==1 && a[i]%2==1){
			c++;
		}
	}

	cout << c;
	
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

vector<string> word;
vector<string> rword;

int none(string s){
  return upper_bound(all(word),s) - lower_bound(all(word),s);
}

int left(string s){
  string t = s;
  t[s.size() - 1]++;
  return lower_bound(all(word),t) - lower_bound(all(word),s);
}

int right(string s){
  reverse(all(s));
  string t = s;
  t[s.size() - 1]++;
  return lower_bound(all(rword),t) - lower_bound(all(rword),s);
}

int main(){
  int N,M;
  cin >> N >> M;
  word.resize(N);
  rword.resize(N);
  rep(i,0,N - 1){
    cin >> word[i];
    rword[i] = word[i];
    reverse(all(rword[i]));
  }
  sort(all(word));
  sort(all(rword));
  rep(i,0,M - 1){
    string s;
    cin >> s;
    int ans = 0;
    if(s.find('?') == s.npos){
      if(s[0] == '*'){
        ans += right(s.substr(1, s.size() - 1));
      }
      else if(s[s.size() - 1] == '*'){
        ans += left(s.substr(0,s.size() - 1));
      }
      else{
        ans += none(s);
      }
    }
    else{
      int idx = s.find('?');
      for(char c = 'a';c <= 'z';c++){
        s[idx] = c;
        if (s[0] == '*')
        {
          ans += right(s.substr(1, s.size() - 1));
        }
        else if (s[s.size() - 1] == '*')
        {
          ans += left(s.substr(0, s.size() - 1));
        }
        else
        {
          ans += none(s);
        }
      }
    }
    cout << ans <<endl;
  }
}


Measured memory_bytes: 11932
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

LL mod = 1000000007;

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

  LL N, K;
  cin >> N >> K;
  REP(i,K){
    LL a, b;
    cin >> a >> b;
    a--;
    b--;
    a = min(a, N - a - 1);
    b = min(b,N - b -1);
    LL d = min(a,b)%3;
    cout << d + 1 << endl;
  }
}



Measured memory_bytes: 3172
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <sstream>

using namespace std;

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

int main() {
	int n, q;
	while (cin >> n >> q && n) {
		map<string, pair<int, int>> tb;
		rep(i, n) {
			string s;
			int a, end;
			cin >> s >> a >> end;
			int start = end - a + 1;
			if (tb.count(s)) {
				tb[s].first = min(tb[s].first, start);
				tb[s].second = max(tb[s].first, end);
			}
			else {
				tb[s].first = start;
				tb[s].second = end;
			}
		}
		rep(i, q) {
			int t;
			cin >> t;
			string out = "Unknown";
			for (auto i : tb) {
				if (i.second.first <= t && t <= i.second.second) {
					stringstream ss;
					ss << i.first << " " << t - i.second.first + 1;
					out = ss.str();
				}
			}
			cout << out << endl;
		}
	}

	return 0;
}

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

int main() {
	int a;
	cin >> a ;
	string s;
	cin >> s;
	
	if (a>=3200) {
		cout << s << endl;
	} else {
		cout << "red" << endl;
	}
	// your code goes here
	return 0;
}




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

public class Main {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static FastReader s = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    private static int[] rai(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        return arr;
    }

    private static int[][] rai(int n, int m) {
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextInt();
            }
        }
        return arr;
    }

    private static long[] ral(int n) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextLong();
        }
        return arr;
    }

    private static long[][] ral(int n, int m) {
        long[][] arr = new long[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextLong();
            }
        }
        return arr;
    }

    private static int ri() {
        return s.nextInt();
    }

    private static long rl() {
        return s.nextLong();
    }

    private static String rs() {
        return s.next();
    }

    static boolean isPrime(int val)
    {
        int flag=0;
        for(int i=2;i<=Math.sqrt(val);i++)
        {
            if(val%i==0)
            {
                flag=1;
                break;
            }
        }
        return flag==0;
    }
    public static void main(String[] args) throws IOException {
        StringBuilder ans = new StringBuilder();
//        int t=ri();
        int t=1;
        while (t-- > 0)
        {
            int x=ri();
            int y=ri();
            if(y>4*x || y<2*x)
            {
                ans.append("No\n");
            }
            else if((y&1)==1)
            {
                ans.append("No\n");
            }
            else
            {
                ans.append("Yes\n");
            }
        }
        out.print(ans.toString());
        out.flush();

    }
}
//9999991


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

using namespace std;
using ll = long long;

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(ll, x);

    ll y = x / 11;
    ll ans = y * 2 + 1;
    if ( x % 11 > 6 ) ans++;
    if ( x % 11 == 0 ) ans--;

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import heapq
import sys
input=sys.stdin.readline

N,Q = map(int,input().split(" "))
querys = []
START = 1
GOAL = 0
GO = 2

for _ in range(N):
    s,t,x = (map(int,input().split(" ")))
    s -=(x + 0.5)
    t -= (x + 0.5)
    querys.append( (s,START,x) )
    querys.append( (t,GOAL,x) )

for _ in range(Q):

    querys.append( (int(input()),GO,-1)  )
koji_place = []
koji_um = set([])
heapq.heapify(koji_place)
querys.sort()
for query in querys:
    time,qtype,place = query
    if qtype == START:
        heapq.heappush(koji_place,place)
        koji_um.add(place)
    elif qtype == GOAL:
        koji_um.remove(place)
    else:
        while koji_place and koji_place[0] not in koji_um: #更新と最近の場所のチェックを同時に行う
            heapq.heappop(koji_place) #koji place のpopは最大で place分，つまり合計で10 ** 5回行われるため ここのwhile
            # はOに影響を与えない
        if koji_place:
            print(koji_place[0])
        else:
            print(-1)





Measured memory_bytes: 86540
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		var ca = new char[H][];
		for(int i=0;i<H;i++) ca[i] = S[i].ToCharArray();
		
		
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if(S[i][j] == '#') continue;
				char c = '0';
				for(int k=-1;k<=1;k++){
					for(int l=-1;l<=1;l++){
						if(!InRange(i+k, 0 ,H) || !InRange(j+l, 0 ,W)) continue;
						if(S[i+k][j+l] == '#') c++;
					}
				}
				ca[i][j] = c;
			}
		}
		for(int i=0;i<H;i++) Console.WriteLine(new String(ca[i]));
		
	}
	bool InRange(int t, int l, int r){
		return l <= t && t < r;
	}
	int H,W;
	String[] S;
	public Sol(){
		var d = ria();
		H = d[0]; W = d[1];
		S = new String[H];
		for(int i=0;i<H;i++) S[i] = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13268
#include<stdio.h>

int main(){
	int N,X,i,D=2000000001,count;
	scanf("%d %d",&N,&X);
	int x[N+1],y[N+1];
	for(i=1;i<=N;i++){
		scanf("%d",&x[i]);
		y[i]=abs(x[i]-X);
	}
	
	for(i=1;i<=N;i++){
		if(y[i]<D) D=y[i];
	}
	
	for(;;){
		count=0;
		for(i=1;i<=N;i++){
			if(y[i]%D==0) count++;
			else break;
		}
		if(count==N){
			printf("%d",D);
			return 0;
		}
		else D--;
	}
}

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

public class Hello
{
    public static void Main()
    {
        hoge();
        //System.Console.ReadLine();
    }

    public static void hoge()
    {
        var vars = System.Console.ReadLine().Split(' ').Select(long.Parse).ToArray();


        System.Console.WriteLine(vars[0] * vars[1]);

    }
}

Measured memory_bytes: 28232
integer N,M
read*,N,M
print"(i0)",mod(kaijo(N)*kaijo(M)*merge(1,0,abs(M-N)<=1)*merge(2,1,M==N),10**9+7)

contains
pure function kaijo(X)
  integer,intent(in)::X
  integer(8) kaijo
  kaijo=1
  do i=1,X
    kaijo=mod(kaijo*i,10**9+7)
  end do
end function kaijo
end

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (int64_t i = 0; i < (int64_t) (n); ++i)
#define pb emplace_back
#define endl '\n'

template<typename T> void _dbg(const char*_s,T _h) { cerr<<_s<<" = "<<_h<<"\n"; }

template<typename T, typename... Ts> void _dbg(const char*_s,T _h,Ts... _t) {
    for(int _b=0;((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',';)cerr<<*_s++;
    cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);
}

#define int long long

#ifdef LOCAL
    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
    #define dbg(...)
#endif

const int N = 5 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n, m;
int U[N];
int g[N][N];
vector<int> path;

bool read() {
    if (!(cin >> n >> m))
        return false;

    forn (i, m) {
        int u, v;
        cin >> u >> v;
        g[u - 1][v - 1] = 1;
    }

    return true;
}

void dfs(int v) {
    U[v] = 1;
    path.pb(v);

    for (int to = 0; to < n; ++to)
        if (g[v][to]) {
            if (!U[to]) {
                dfs(to);
            } else if (U[to] == 1) {
                reverse(path.begin(), path.end());
                while (path.back() != to) path.pop_back();
                reverse(path.begin(), path.end());
                int nn = path.size();
                int sz = nn, i1 = -1, j1 = -1;

                forn (i, nn)
                    forn (j, nn)
                        if (g[path[i]][path[j]]) {
                            int cur = i - j + 1;

                            if (cur <= 0)
                                cur += nn;

                            if (cur < sz)
                                sz = cur, i1 = i, j1 = j;
                        }

                cout << sz << endl;

                if (sz == nn) {
                    for (auto i : path)
                        cout << i + 1 << endl;
                } else {
                    for (int i = j1; ; (++i) %= nn) {
                        cout << path[i] + 1 << endl;

                        if (i == i1)
                            break;
                    }
                }

                exit(0);
            }
        }

    U[v] = 2;
    path.pop_back();
}

void solve() {
    for (int i = 0; i < n; ++i)
        if (!U[i])
            dfs(i);

    cout << -1 << endl;
}

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

    while (read())
        solve();

    return 0;
}



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

int main(){
	while(1){
		int n;
		cin>>n;

		if(n==0)
			break;
		
		int len[40];
		for(int i=0;i<n;i++){
			string w;
			cin>>w;

			len[i]=w.size();
		}

		for(int i=0;i<n;i++){
			bool flg=false;
			int sta=0;
			int sum=0;
		
			for(int j=i;j<n;j++){
				sum+=len[j];

				if(sum==5||sum==12||sum==17||sum==24||sum==31){
					sta++;
				}

				if(sta==5){
					flg=true;
					break;
				}
				else if(sum>=31){
					break;
				}
			}
			
			if(flg){
				cout<<i+1<<endl;
				break;
			}
		}
	}

	return 0;
}
		


Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main()
{
	int N;
	cin >> N;
	vector<int> v(N);

	rep(i,N){
		cin >> v[i];
	}

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

	int ans = 0;

	ans = v[N - 1] - v[0];

	cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <set>
#include <cstring>
using namespace std;
#define M 1000000007
typedef long long ll;
ll dp[1005],n,m;
char s[1005],t[1005];
int main(void){
    scanf(" %s %s",s,t);
    n=strlen(s);
    m=strlen(t);
    dp[0]=1;
    for(int i=0;i<n;i++)for(int j=m-1;j>=0;j--)if(s[i]==t[j])dp[j+1]=(dp[j+1]+dp[j])%M;
    printf("%lld\n",dp[m]);
}



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

using namespace std;

const int Maxn = 1e2+7;

int n;

struct Node
{
	int x, y, h;
	bool operator < (const Node &b) const
	{
		return h > b.h;
	}
} a[Maxn];

inline int calc(int x, int y, Node b)
{
	return b.h+abs(x-b.x)+abs(y-b.y);
}

int main()
{
	cin >> n;
	for(int i = 1; i <= n; ++i)
		cin >> a[i].x >> a[i].y >> a[i].h;
	sort(a+1, a+n+1);
	for(int i = 0; i <= 100; ++i)
	{
		for(int j = 0; j <= 100; ++j)
		{
			int H = calc(i, j, a[1]), flag = 1;
			for(int k = 2; k <= n; ++k)
			{
				if(a[k].h == 0 && H-abs(i-a[k].x)-abs(j-a[k].y) > 0)
				{
					flag = 0;
					break;
				}
				else if(a[k].h > 0 && calc(i, j, a[k]) != H)
				{
					flag = 0;
					break;
				}
			}
			if(flag)
			{
				cout << i << " " << j << " " << H << endl;
				return 0;
			}
		}
	}
	return 0;
}


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

int main(){
  string s; cin>>s;
  int ans=1000;
  for(int i=0;i<s.length()-2;i++){
    string b=s.substr(i,3);
    int k=atoi(b.c_str());
    ans = min(abs(753-k),ans);
  }
  
  cout<<ans<<endl;
  return 0;
}
    

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int N, M, a[55], b[55], ans[55];
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = 1; i <= N; i++) {
		ans[i] = 0;
		for (int j = 0; j < M; j++) {
			if (i == a[j] || b[j] == i) {
				ans[i]++;
			}
		}
		cout << ans[i] << endl;
	}
}

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

#define endl "\n"
#define int long long
#define vec(x) vector<x>
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int>>
#define matrix(x) vector<vector<x>>
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a, b, sizeof a)
#define setBits(n) __builtin_popcountll(n)
#define prec(n) fixed<<setprecision(n)
#define ff first
#define ss second
#define print(x) for(auto it:x) cout<<it<<" ";
#define dbg(x) cerr<<#x<<" :: "<<x<<endl;
#define dbg2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
const int INF = 1e9;
const int MOD = 1e9 + 7; 
const double pi = acos(-1);
int power(int a,int b,int m=MOD)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}
int dir[]={-1, 0, 1, 0, -1};
int dx[]={1,1,0,-1,-1,-1, 0, 1};
int dy[]={0,1,1, 1, 0,-1,-1,-1};

const int N = 1e5+1;
vi h(N);
int dp[N];

int helper(int i)
{
	if(i==0)
	return 0;
	if(dp[i]!=-1)
	return dp[i];
	int op1=INF,op2=INF;
	if(i>0)
	op1=abs(h[i]-h[i-1])+helper(i-1);
	if(i>1)
	op2=abs(h[i]-h[i-2])+helper(i-2);
	return dp[i]=min(op1,op2);
}

void solve()
{
	int i,n;
	cin>>n;
	for(i=0;i<n;i++)
	cin>>h[i];
	mem(dp,-1);
	cout<<helper(n-1)<<endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int t;
	t=1;
	//cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 6528
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

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

int n;
cin >> n;
vi h(n);
vi dp(n);
rep(i,n)cin >> h[i];
dp[0] = 0;
dp[1] = abs(h[1]-h[0]);
for(int i=2;i<n;++i){
    dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
}
fin(dp[n-1]);

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {

	public static void main(String[] args)throws Exception {

		   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	        while(true){
	        	String line = br.readLine();
	        	//文字列に先頭又は最後に空白文字がくっ付いている場合、それらを全て取り除く。
	        	line = line.trim();
	        	//半角スペースを区切り文字として扱う
	        	String[] readLineArray = line.split("[\\s+]");
	        	//変数に配列を代入
	        	int a = Integer.parseInt(readLineArray[0]);
	        	int b = Integer.parseInt(readLineArray[1]);
	        	if(a == 0 && b == 0){
	        		break;
	        	}
	        	for(int i = 1;i <= a;i++){
	        		for(int j = 1;j <= b; j++){
	        			if(i%2 != 0){
	        				if(j%2 != 0){
	        					System.out.printf("#");
	        				}
	        				else{
	        					System.out.printf(".");
	        				}
	        			}else {
	        				if(j%2 == 0){
	        					System.out.printf("#");
	        				}
	        				else{
	        					System.out.printf(".");
	        				}
	        			}
	        		}
	        		System.out.printf("\n");
	        	}
	        	System.out.printf("\n");
	        	
	        }

	}

}

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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

/* 
  //エラトステネスのふるい
  int maxNum = 100000;
  char isNotPrime[maxNum+1] = {};
  isNotPrime[0]=isNotPrime[1]=1;
  for(int i=2;i<maxNum;i++){
    if(isNotPrime[i]==1) continue;
    int num = i+i;
    while(num<=maxNum){
      isNotPrime[num]=1;
      num += i;
    }
  }
*/
// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

// 降順ソート vector<int> v;
// sort(v.begin(),v.end(),greater<int>());

signed main() {
  int n;
  cin >> n;
  
  int p;
  int count = 0;
  bool flag = false;
  for(int i=0;i<n;i++){
    cin >> p; p--;
    if(p==i && flag==false){
      count++;
      flag = true;
    }
    else{
      flag = false;
    }
  }
  cout << count << endl;
  
  return 0;
}



Measured memory_bytes: 3672
#include <bits/stdc++.h> 
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
    fast_io;

    ll n,k;
    cin>>n>>k;

    vector<ll> h(n+1);

    for(ll i=0;i<n;i++)
    cin>>h[i];
    vector<ll> dp(n+1);

    //base case
    dp[0] = 0;

    for(ll i=1;i<n;i++)
    {
        dp[i] = INT_MAX;
        for(ll j=i-1;j>=0 && (i-j)<=k;j--)
        {
            dp[i] = min(dp[i], abs(h[j] - h[i]) + dp[j]);
        }
    }
    cout<<dp[n-1]<<endl;
    
return 0;
}


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

int main() {
    int x[10];
    int ans;
    for (int i = 0; i < 5; i++) {
        cin >> x[i];
        if (x[i] == 0) {
            ans = i;
            break;
        }
    }
    cout << ans + 1;
}


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

#define ll long long
#define ld long double
#define ft first
#define sd second
#define pb push_back
using namespace std;
const ll mod = 1e9+7;

ll power(ll a, ll b, ll m = mod) {
    ll x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}

const int N = 2e6+9;
// int a[N];
ll f[N], invf[N];
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);  
    f[0] = invf[0] = 1;  
    for(int i = 1; i < N-4; i++) {
        f[i] = f[i-1] * i % mod;
        invf[i] = power(f[i], mod-2);
    }

    int x, y; cin >> x >> y;
    if((x + y) % 3 != 0) {
        return cout << "0\n", 0;
    }
    int n = (x + y) / 3;
    int a = x - n, b = y - n;
    // a = 5; b = 0;
    int ans = 0;
    if(a == 0 || b == 0) {
        ans = 1;
    } else if(a < 0 || b < 0) {
        ans = 0;
    } else {
        ans = f[a + b] * invf[a] % mod * invf[b] % mod;
    }
    cout << ans << endl;

    
    
    


    return 0;
    
}


Measured memory_bytes: 31488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	ll n,a,b,c,d,e;
	cin>>n>>a>>b>>c>>d>>e;
	ll minimum=min(a,min(b,min(c,min(d,e))));
	cout<<(n+minimum-1)/minimum+4;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

int n, ma, mb;
int a[41], b[41], c[41];
int dp[50][410][410];
const int INF = 1e7;

signed main(){
    cin >> n >> ma >> mb;
    rep(i, 0, n){
        cin >> a[i] >> b[i] >> c[i];
    }
    rep(i, 0, 41){
        rep(j, 0, 410){
            rep(k, 0, 410){
                dp[i][j][k] = INF;
            }
        }
    }
    dp[0][0][0] = 0;
    rep(i, 0, n){
        rep(j, 0, 410){
            rep(k, 0, 410){
                if(dp[i][j][k] == INF) continue;
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
                if(j + a[i] >= 410 || k + b[i] >= 410) continue;
                dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
            }
        }
    }
    // rep(i, 0, n){
    //     rep(j, 0, 410){
    //         rep(k, 0, 410){
    //             dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
    //             if(j - a[i] < 0 || k - b[i] < 0) continue;
    //             dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j - a[i]][k - b[i]] + c[i]);
    //         }
    //     }
    // }
    int ans = INF;
    rep(i, 0, 410){
        rep(j, 0, 410){
            if(i == 0 && j == 0) continue;
            if(ma * j == mb * i){
                ans = min(ans, dp[n][i][j]);
            }
        }
    }
    // rep(i, 0, 20){
    //     rep(j, 0, 20){
    //         if(dp[n][i][j] == INF) cout << -1 << " ";
    //         else cout << dp[n][i][j] << " ";
    //     }
    //     cout << endl;
    // }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 55680
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;

ll dp[405][405], prefix[405], sum, n, arr[405];

void solve(ll i , ll j){
	dp[j][i+j] = inf;
	for (ll g = 0; g < i; g++){
		dp[j][i+j] = min(dp[j][i+j], dp[j][j+g] + dp[j+g+1][j+i] + prefix[j+i] - prefix[j -1 ]);
	}
}
 
int main(){
	cin >> n;
	for(ll i = 1; i <= n; i++){
		cin >> arr[i];
		sum += arr[i];
		prefix[i] = sum;
	}
	for (ll k = 1; k < n; k++){
		for (ll t = 1; t <= n - k; t++){
			solve(k, t);
		}
	}
	cout << dp[1][n] << '\n';
}


Measured memory_bytes: 1536
#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<limits>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
using namespace std;

int main()
{
    int l,r,d;
    cin>>l>>r>>d;
    cout<<(r/d-(l-1)/d);
    

    return 0;
}

Measured memory_bytes: 3632
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Weather Prediction 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 3;
const char wts[N][16] = { "Sunny", "Cloudy", "Rainy" };

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  char s[16];
  scanf("%s", s);

  int k = (s[0] == 'S') ? 0 : (s[0] == 'C') ? 1 : 2;
  puts(wts[(k + 1) % N]);
  return 0;
}


Measured memory_bytes: 256