akhauriyash/Code-Regression huggingface dataset:
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            var input = Console.ReadLine().Split();
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int C = int.Parse(input[2]);
         
         
            if (C >= A && C <= B) {
                Console.WriteLine("Yes");
            }else {
                Console.WriteLine("No");
            }
        }
    }
}

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

int main()
{
  int n, a[100000];
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  int cnt = 0;
  for(int i = 0; i < n; i++){
    if(a[i] % 2 == 0){
      cnt++;
    }
  }

  if(cnt == n){
    cout << "second" << endl;
  }else{
    cout << "first" << endl;
  }

  return 0;
}


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

long double right[3], left[3], top[3], bottom[3];

long double calcSpace(long double);

int main()
{
	int N;
	scanf("%d", &N);
	// {l, 0, r}, {b, 0, t}
	for (int i{}; i < 3; i++) right[i] = -1e9;
	for (int i{}; i < 3; i++) left[i] = 1e9;
	for (int i{}; i < 3; i++) top[i] = -1e9;
	for (int i{}; i < 3; i++) bottom[i] = 1e9;

	for (int i{}; i < N; i++)
	{
		long double x, y;
		char d;
		scanf("%Lf%Lf %c", &x, &y, &d);
		if (d == 'R')
		{
			right[2] = std::max(right[2], x);
			left[2] = std::min(left[2], x);
			top[1] = std::max(top[1], y);
			bottom[1] = std::min(bottom[1], y);
		}
		if (d == 'L')
		{
			right[0] = std::max(right[0], x);
			left[0] = std::min(left[0], x);
			top[1] = std::max(top[1], y);
			bottom[1] = std::min(bottom[1], y);
		}
		if (d == 'U')
		{
			right[1] = std::max(right[1], x);
			left[1] = std::min(left[1], x);
			top[2] = std::max(top[2], y);
			bottom[2] = std::min(bottom[2], y);
		}
		if (d == 'D')
		{
			right[1] = std::max(right[1], x);
			left[1] = std::min(left[1], x);
			top[0] = std::max(top[0], y);
			bottom[0] = std::min(bottom[0], y);
		}
	}
	long double min{calcSpace(0)};
	long double velo[3]{-1, 0, 1};
	for (int i{}; i < 3; i++)
	{
		int next{(i + 1) % 3};
		if (left[i] != 1e9 && left[next] != 1e9)
		{
			long double time{-(left[i] - left[next]) / (velo[i] - velo[next])};
			if (time >= 0)
				min = std::min(min, calcSpace(time));
		}
		if (right[i] != -1e9 && right[next] != -1e9)
		{
			long double time{-(right[i] - right[next]) / (velo[i] - velo[next])};
			if (time >= 0)
				min = std::min(min, calcSpace(time));
		}
		if (top[i] != -1e9 && top[next] != -1e9)
		{
			long double time{-(top[i] - top[next]) / (velo[i] - velo[next])};
			if (time >= 0)
				min = std::min(min, calcSpace(time));
		}
		if (bottom[i] != 1e9 && bottom[next] != 1e9)
		{
			long double time{-(bottom[i] - bottom[next]) / (velo[i] - velo[next])};
			if (time >= 0)
				min = std::min(min, calcSpace(time));
		}
	}
	printf("%.10Lf\n", min);

	return 0;
}

long double calcSpace(long double time)
{
	long double r{std::max({right[0] - time, right[1], right[2] + time})};
	long double l{std::min({left[0] - time, left[1], left[2] + time})};
	long double t{std::max({top[0] - time, top[1], top[2] + time})};
	long double b{std::min({bottom[0] - time, bottom[1], bottom[2] + time})};
	return (r - l) * (t - b);
}

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

int main() {

    ll n; cin >> n;
    vector<ll> t(n + 1, 0), x(n + 1, 0), y(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        cin >> t[i] >> x[i] >> y[i];
    }
    
    bool can = true;
    vector<ll> dt(n), dist(n);
    for (int i = 0; i < n; i++) {
        dt[i] = t[i + 1] - t[i];
        dist[i] = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
        if (!(dist[i] <= dt[i] && dt[i] % 2 == dist[i] % 2)) {
            can = false;
        }
    }

    if (can)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;

}

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

using namespace std;

vector<pair<int, int> > v;

int main() {
    int n, tmp; scanf("%d",&n);
    for (int i=1; i<=n; i++) {
        scanf("%d",&tmp);
        v.push_back({tmp, i});
    }
    sort(v.begin(), v.end());
    for (int i=0; i<n; i++) {
        printf("%d ",v[i].second);
    }
    return 0;
}

Measured memory_bytes: 1780
/*
"Won't stop until I'm phenomenal."
- Phenomenal, Eminem
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;



int main(){
    Shazam;
    ll n; cin>>n;
    cout<<n*(n-1)/2<<endl;
    return 0;
}

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

using namespace std;

int main()
{
  int h,w;

  cin >> h >> w;

  vector<vector<char>> s(h,vector<char> (w));

  vector<vector<int>> right(h,vector<int> (w));
  vector<vector<int>> left(h,vector<int> (w));
  vector<vector<int>> down(h,vector<int> (w));
  vector<vector<int>> up(h,vector<int> (w));

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> s.at(i).at(j);
    }
  }

  int count=0;

  for(int i=0;i<h;i++){
    count=0;
    for(int j=0;j<w;j++){
      if(s.at(i).at(j)=='.'){
        count++;
        right.at(i).at(j)=count;
      }
      else if(s.at(i).at(j)=='#'){
        count=0;
      }
    }
  }
  for(int i=0;i<h;i++){
    count=0;
    for(int j=w-1;j>=0;j--){
      if(s.at(i).at(j)=='.'){
        count++;
        left.at(i).at(j)=count;
      }
      else if(s.at(i).at(j)=='#'){
        count=0;
      }
    }
  }
  for(int i=0;i<w;i++){
    count=0;
    for(int j=0;j<h;j++){
      if(s.at(j).at(i)=='.'){
        count++;
        down.at(j).at(i)=count;
      }
      else if(s.at(j).at(i)=='#'){
        count=0;
      }
    }
  }
  
  for(int i=0;i<w;i++){
    count=0;
    for(int j=h-1;j>=0;j--){
      if(s.at(j).at(i)=='.'){
        count++;
        up.at(j).at(i)=count;
      }
      else if(s.at(j).at(i)=='#'){
        count=0;
      }
    }
  }
  int ans=0;
  for(int i=0;i<h;i++){
    //cout << "[" << i << "]" << "--------------------" << endl;
    for(int j=0;j<w;j++){
      ans = max(ans,(right.at(i).at(j)+left.at(i).at(j)+down.at(i).at(j)+up.at(i).at(j)-3));
      //cout << right.at(i).at(j) << "|" <<  left.at(i).at(j) << "|" << down.at(i).at(j) << "|" << up.at(i).at(j)<< endl;
    } 
  }
  cout << ans << endl;
}


Measured memory_bytes: 67200
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
	string s;
	cin >> s;
	bool f = false;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'C') {
			f = true;
		}
		if (s[i] == 'F' && f) {
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
}

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

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
  int x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << x2 + y1 - y2 << " " << y2 - x1 + x2 << " " << x1 + y1 - y2 << " " << y1 - x1 + x2 << endl;
	return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    string S, T; cin >> S >> T;

    rep(i, 0, S.size()) {
        if (S == T) {
            cout << "Yes" << endl;
            return 0;
        }
        S.push_back(S[0]);
        S.erase(S.begin());
    }

    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 200000;

int main(void){
    ll N;
    ll A[MAX_N];
    ll L[MAX_N + 1], R[MAX_N + 1];
    ll answer = INF;

    /*
    after sorting in ascending order...
    A[i] <= b <= A[i + 1]
    f = (A[i + 1] - A[i])
      + (A[i + 2] - A[i - 1])
      + (A[i + 3] - A[i - 2])
      ...
      + (A[N - 1] - A[k]) or (A[k] - A[0])
      - (A[k - 1] + ... + A[0]) + b * k or + (A[N - 1] + ... + A[k + 1]) - b * .
    f = 
    */

    cin >> N;
    rep(i, N){
        cin >> A[i];
        A[i] -= i + 1;
    }

    sort(A, A + N);
    
    L[0] = 0;
    R[0] = 0;
    rep(i, N){
        L[i + 1] = L[i] + A[i];
        R[i + 1] = R[i] + A[N - i - 1];
    }

    answer = min(R[N] - A[0] * N, A[N - 1] * N - L[N]);

    For(i, 1, N){
        ll cnt = R[N - i] - L[i];
        ll c = 2 * i - N;
        answer = min({answer, cnt + c * A[i], cnt + c * A[i - 1]});
    }

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
    int w, n;
    cin >> n >> w;
    vector<int> a(n),b(n);
    vector<int> dp(w + 1);
    for (int i = 0;i < n;i++)cin >> a[i] >> b[i];
    for (int i = 0;i < n;i++) {
        for (int j = 0;j <= w ;j++) {
            if (j - b[i] < 0)continue;
            dp[j] = max(dp[j], dp[j - b[i]] + a[i]);
        }
    }
    cout << dp[w] << endl;
}


Measured memory_bytes: 3156
#!/usr/bin/env python3
import math

def main():
    N = int(input())
    a_list = [int(s) for s in input().split()]
    sousa_count = 0
    for a in a_list:
        sousa_count += count_devide_2(a)
    print(sousa_count)

def count_devide_2(num):
    count = 0
    while True:
        if num%2 == 0:
            num = math.floor(num/2)
            count += 1
        else:
            return count

if __name__ == "__main__":
    main()


Measured memory_bytes: 4148
#include <iostream>

using namespace std;

int main(void){

  int N, M;
  long long H[100000];
  int A[100000], B[100000];
  int sc[100000];
  int sum = 0;

  cin >> N >> M;  // 展望台の数と道の数を入力
  for(int i=0; i<N; i++){ // 展望台の標高を入力
    cin >> H[i];
  }
  for(int i=0; i<M; i++){ // 道で結ばれた展望台を記録
      cin >> A[i] >> B[i];
  }

  for(int i=0; i<M; i++){
    if(H[A[i]-1] < H[B[i]-1]) sc[A[i]-1] = 1;
    else if(H[A[i]-1] > H[B[i]-1]) sc[B[i]-1] = 1;
    else sc[A[i]-1] = sc[B[i]-1] = 1;
  }

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

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 5588
#include<bits/stdc++.h>
#define ll long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define MAX 1000000007

using namespace std;
int main()
{
 	speed_up
    ll l,r;cin>>l>>r;
    ll out=MAX;
    for(ll i=l;i<r&&out;i++)
    {
    	for(ll j=i+1;j<=r&&out;j++)
    	out=min(out,(i*j)%2019);
	}
	cout<<out;
   
	
	
 return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll mod = 100000000000000003;
int ne[200001], he[10001];
char C[1200100];

ll num[524300];
int kazu[524300];
const int ma = (1 << 19) - 1;
int query(ll n) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) return kazu[n2];
		n2 = n2 * 61 % 524287;
	}
	return 0;
}
void add(ll n, int b) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) {
			kazu[n2] |= b;
			return;
		}
		n2 = n2 * 61 % 524287;
	}
	num[n2] = n + 1;
	kazu[n2] = b;
}

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


	fread(C, 1, 1200100, stdin);
	char* ci = C, c;
	int N = 0;
	while ((c = *ci++) >= '0') N = N * 10 + c - '0';

	ll dekai[100];
	int d = 0;
	char* s[200001];
	rep1(i, N) {
		s[i] = ci;
		while (*ci++ >= '0');
		int n = ci - s[i] - 1;	
		if (n <= 100000) {
			ne[i] = he[n];
			he[n] = i;
		}
		else {
			dekai[d++] = (ll(n) << 30) + s[i] - C;
		}
	}

	ll kotae = 0;

	for (int M = 1; M <= 10000; M++) {
		for (int p = he[M]; p; p = ne[p]) {
			auto S = s[p];
			int k[26] = {};
			ll are = 0;
			for (int i = M - 1; i >= 1; i--) {
				int tmp = query(are);
				if (tmp) {
					rep(j, 26) if ((tmp >> j & 1)) {
						k[j]++;
					}
				}
				kotae += k[S[i] - 'a'];
				k[S[i] - 'a'] = 0;
				are = (are * 30 + S[i] - 'a' + 1) % mod;
			}

			kotae += k[S[0] - 'a'];
			k[S[0] - 'a'] = 0;

			add(are, 1 << (S[0] - 'a'));
		}
	}
	sort(dekai, dekai + d);
	rep(p, d) {
		auto S = C + (dekai[p] & (1 << 21) - 1);
		int k[26] = {};
		ll are = 0;
		for (int i = (dekai[p] >> 30) - 1; i >= 1; i--) {
			int tmp = query(are);
			if (tmp) {
				rep(j, 26) if ((tmp >> j & 1)) {
					k[j]++;
				}
			}
			kotae += k[S[i] - 'a'];
			k[S[i] - 'a'] = 0;
			are = (are * 30 + S[i] - 'a' + 1) % mod;
		}

		kotae += k[S[0] - 'a'];
		k[S[0] - 'a'] = 0;

		add(are, 1 << (S[0] - 'a'));
	}
	printf("%lld\n", kotae);


	Would you please return 0;
}

Measured memory_bytes: 11240
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

n=input1()
s=str(input())
count=0
print(s.count("ABC"))










Measured memory_bytes: 13616
#include<bits/stdc++.h>
using namespace std;
int x[256];
int main()
{
    char w[2020];
    cin >> w;
    for(int i=0; w[i]; ++i)
        x[w[i]]++;
    for(int i=0; i<256; ++i)
        if(x[i]%2==1)
        {
            puts("No");
            return 0;
            
        }
    puts("Yes");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    int n, k;
    cin >> n >> k;
    long double ans = 0;

    rep(i, n){
        int p = i + 1;
        int l = 0;
        while(1){
            if (p * (int)(pow(2,l)) >= k) break;
            l++;
        }
        ans += 1 / pow(2, l);
    }

    cout << fixed << setprecision(15) << ans / n << endl;

    return 0;
}


Measured memory_bytes: 4108
import java.util.*;
public class Main {
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    List<List<Integer>> from = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      from.add(new ArrayList<>());
    }
    
    for (int i = 0; i < N-1; i++) {
      int a = sc.nextInt();
      int b = sc.nextInt();
      from.get(a-1).add(b-1);
      from.get(b-1).add(a-1);
    }
    int[] c = new int[N];
    for (int i = 0; i < N; i++) {
      c[i] = sc.nextInt();
    }
    Arrays.sort(c);
    
    int idx = N-1;
    int[] d = new int[N];
    boolean[] visit = new boolean[N];
    long M = 0;
    PriorityQueue<Pair> q = new PriorityQueue<>((a,b)->b.b-a.b);
    d[0] = c[idx--];
    q.offer(new Pair(0, d[0]));
    visit[0] = true;
    while (!q.isEmpty()) {
      Pair now = q.poll();
      for (int to : from.get(now.a)) {
        if (!visit[to]) {
          visit[to] = true;
          d[to] = c[idx--];
          Pair next = new Pair(to, d[to]);
          q.offer(next);
          M += Math.min(now.b, next.b);
        }
      }
    }
      
    StringBuilder ans = new StringBuilder();
    ans.append(M+"\n");
    for (int i = 0; i < N; i++) {
      ans.append(d[i]);
      if (i < N-1) {
        ans.append(' ');
      } else {
        ans.append('\n');
      }
    }
    System.out.print(ans.toString());
  }
  
  private static class Pair {
    private final int a;
    private final int b;
    private Pair(int a, int b) {
      this.a = a;
      this.b = b;
    }
  }
}

Measured memory_bytes: 46844
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<math.h>
#include<vector> 
#include<cstdio> 
#include<set>
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
{string s;
 cin>>s;
 int ans=0;
 for(int i=0;i<s.size();i++)
 if(s[i]=='o')
 ans++;
 cout<<700+100*ans<<endl; 
 system("pause");
 return 0;
}

Measured memory_bytes: 504
<?php
             
            fscanf(STDIN, "%d", $N);
        	$in = [];
            for ($i = 0; $i < 5; $i++) {
              fscanf(STDIN, "%d", $input);
              $in[] = $input;
            }
        	sort($in);
            $result = 4 + ceil($N / $in[0]);
            printf("%d\n", $result);

Measured memory_bytes: 4604
# -*- coding: utf-8 -*-
"""
Created on Sat Jul  7 20:16:39 2018
SHPC_C
@author: maezawa
"""

n, m, d = list(map(int, input().split()))

#k = 0
#for i in range(1,n+1):
#    for j in range(1,n+1):
#        if abs(i-j) == d:
#            k += 1

if d == 0:
    k = n
else:
    k = (n-d)*2

#print('k = {}'.format(k))
print(k*(m-1)/n**2)

Measured memory_bytes: 2940
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    h, w, k = geta(int)
    c = []
    for _ in range(h):
        c.append(gete())

    ans = 0
    for bi in range(1 << h):
        for bj in range(1 << w):

            rem = 0
            for i in range(h):
                if bi >> i & 1 == 1:
                    continue
                for j in range(w):
                    if bj >> j & 1 == 1:
                        continue
                    if c[i][j] == "#":
                        rem += 1

            if rem == k:
                ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 68748
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define cl clear() ;
#define vl vector<ll>
#define sz size()
#define len length()
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define en end()
#define ro return 0
#define br break
#define eb emplace_back
#define con continue
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;

int main()
{
    ios;
    char c; cin >> c ; if(c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u') cout << "vowel\n" ; else cout << "consonant\n" ; ro ;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	double a,b;
	while(cin>>a>>b){
		string z="NA";
		if(a<70&&b<148)
			z="E";
		if(a<55&&b<116)
			z="D";
		if(a<50&&b<105)
			z="C";
		if(a<43&&b<89)
			z="B";
		if(a<40&&b<83)
			z="A";
		if(a<37.5&&b<77)
			z="AA";
		if(a<35.5&&b<71)
			z="AAA";
		cout<<z<<endl;
	}
    return 0;
}
 

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

using namespace std;

int N;
int A[100000];

void solve() {
    int num = 0;
    reverse(A, A + N);
    for (int i = 0; i < N; ++i) {
        while (i + 1 < N && A[i] == A[i + 1]) ++i;
        if (i + 1 < N && A[i] < A[i + 1]) {
            while (i + 1 < N && A[i] <= A[i + 1])++i;
        } else if (i + 1 < N && A[i] > A[i + 1]) {
            while (i + 1 < N && A[i] >= A[i + 1]) ++i;
        }
        ++num;
    }
    printf("%d\n", num);
}

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    solve();
    return 0;
}

Measured memory_bytes: 4136
N = int(input())
a = [int(i) for i in input().split()]

ret = [0] * N

for i in range(N-1, -1, -1) :
    s = a[i]
    for j in range(i, N, i + 1) :
        s ^= ret[j]
    ret[i] = s
    
b = []
for i in range(N) :
    if ret[i] :
        b.append(i+1)

print(len(b))
print(' '.join([str(i) for i in b]))

Measured memory_bytes: 73104
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String [] A  = new String[N];
    for(int i = 0;i<N;i++){
      char [] B  = new char[10];
      B = sc.next().toCharArray(); 
      Arrays.sort(B);
      A[i] = new String(B);
    }
    HashMap<String,Integer> map = new HashMap<String,Integer>();
    long ans = 0;
    for(int i = 0;i<N;i++){
      if(map.containsKey(A[i])){
        map.put(A[i],map.get(A[i])+1);
        // ans++;
      }else{
        map.put(A[i],1);
      }
    }
    for(String key : map.keySet()){
      long tmp = map.get(key);
      if(tmp>1){
        ans += (tmp*(tmp-1)/2);
      }
    }
    System.out.println(ans);
  }
}



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

int dp[105][10005];

int main() {
  int N,W;
  cin >> N >> W;
  vector<int> value(N),weight(N);
  for(int i=0;i<N;i++) {
    cin >> value[i] >> weight[i];
  }
  for(int w=0;w<=W;w++) dp[0][w]=0;

  for(int i=0;i<N;i++) {
    for(int w=0;w<=W;w++) {
      if(w >= weight[i]) dp[i+1][w] = max(dp[i][w-weight[i]]+value[i], dp[i][w]);
      else dp[i+1][w] = dp[i][w];
    }
  }
  cout << dp[N][W] << endl;
}


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

void output(vector<int> x){
    int y = x.size();
    for(int i=0;i<y-1;i++){
        cout << x[i] << " ";
    }
    cout << x[y-1] << endl;;
}
void insertionSort(vector<int> x){
    int n = x.size();
    int v;
    for(int i=1;i<n;i++){
        v = x[i];
        int j = i-1;
        while(j>=0&&x[j]>v){
            x[j+1] = x[j];
            j--;
            x[j+1] = v;  
        }
        output(x);
    }
}


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    output(a);
    insertionSort(a);
    return 0;
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
int main()
{
   // freopen("i.txt","r",stdin);
    string s1;
    int n,l;
    cin>>n>>l;
    vector <string> v;
    vector <string>:: iterator it;
    while(n--){
        cin>>s1;
        v.push_back(s1);
    }
    sort(v.begin(),v.end());
    string s2="";
    for(it=v.begin();it!=v.end();it++){
        s2+=*it;
    }
    cout<<s2<<endl;
    return 0;
}


Measured memory_bytes: 3612
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	a := iSScan(n)
	x := max(a)
	y := mod * mod
	for i := 0; i < n; i++ {
		if abs(x/2-a[i]) < abs(x/2-y) && x != a[i] {
			y = a[i]
		}
	}
	fmt.Println(x, y)
}


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

using ll = unsigned long;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
    ll N, A;
    cin >> N;
    vector<ll> b(60, 0);
    rep(i, N) {
        cin >> A;
        rep(j, 60) {
            b[j] += (A >> j) % 2;
        }
    }
    ll ans = 0;
    rep(i, 60) {
        ll x = 1LL << i;
        x %= MOD;
        x *= b[i];
        x %= MOD;
        x *= N - b[i];
        x %= MOD;
        ans += x;
        ans %= MOD;
    }
    cout << ans << endl;
    //rep(i, 60) cout << b[i] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,X,Y;
    cin >> N >> X >> Y;
    X--; Y--;
    vec<int> ans(N);
    for(int i=0;i<N;i++) for(int j=i+1;j<N;j++){
        int d = min(j-i,abs(i-X)+abs(j-Y)+1);
        ans[d]++;
    }
    for(int i=1;i<=N-1;i++) cout << ans[i] << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>
int binSearch(int[], int, int);
int main(void){
    int i, n, q, C = 0, S[100000], T[50000];
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%d", &T[i]);
    }
    for(i = 0; i < q; i++){
        if(binSearch(S, n, T[i]) != -1) C++;
    }
    printf("%d\n", C);
    

    return 0;
}
int binSearch(int src[], int n, int dst){
    int head = 0, tail = n, mid;
    while(head < tail){
    mid = (head + tail) / 2;
    if(src[mid] == dst) return mid;
    else if(dst < src[mid]) tail = mid;
    else if (dst > src[mid]) head = mid + 1;
    }
    return -1;
}


Measured memory_bytes: 2300
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;


int solve(){
  int N;cin>>N;
  int a,b,c,d;

  string s;
  cin>>a>>b>>c>>d;
  cin>>s;
  VI road(N+1);
  for(int i=0;i<N;i++){
    if(s[i]=='.'){
      road[i]=0;
    }
    else{
      road[i]=1;
    }

  }
  road[N]=1;
if(c<d){
  for(int now=a;now<c-1;now++){
    if(road[now]==1&&road[now+1]==1){
      cout<<"No"<<endl;
      return 0;
    }
  }
  for(int now=b;now<d-1;now++){
    if(road[now]==1&&road[now+1]==1){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
  }
else{
  for(int now=a;now<c-1;now++){
    if(road[now]==1&&road[now+1]==1){
      cout<<"No"<<endl;
      return 0;
    }
  }
  for(int now=b;now<d-1;now++){
    if(road[now]==1&&road[now+1]==1){
      cout<<"No"<<endl;
      return 0;
    }
  }
  for(int now=b-1;now<=d-1;now++){
    if(road[now-1]==0&&road[now]==0&&road[now+1]==0){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;

}
return 0;
}


int main(){
  solve();
  return 0;

}

Measured memory_bytes: 1284
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int N , M , sum=1000000000;
  cin>>N>>M;
  vector<int> A(N);
     for(int i=0;i<N;i++){
       cin>>A[i];
     }
     for(int i=0;i<=N-M;i++){
       int B=abs(A[i])+abs(A[i+M-1]-A[i]);
       int C=abs(A[i+M-1])+abs(A[i]-A[i+M-1]);
       sum=min(sum,min(B,C));
     }
  cout<<sum<<endl;
}

Measured memory_bytes: 888
N = int(input())
F = [list(map(int,input().split())) for i in range(N)]
P = [list(map(int,input().split())) for i in range(N)]

ans = -(10**10)
for i in range(1,1024):
	X = [0]*N
	for j in range(N):
		count = 0
		for k in range(10):
			if (i>>k)&1 == 1 and F[j][k] == 1:
				count += 1
		X[j] = P[j][count]
	ans = max(ans,sum(X))

print(ans)


Measured memory_bytes: 3064
class team:
    def __init__(self,name,result):
        self.name = name
        self.win = 0
        self.lose = 0
        for i in range(len(result)):
            if result[i] == 0:
                self.win += 1
            elif result[i] == 1:
                self.lose +=1
            else:
                pass

while True:
    results = []
    n = int(input())

    if n==0:
        break

    for i in range(n):
        lst = input().split()
        name = lst[0]
        lst = lst[1:]
        result = list(map(int,lst))

        results.append(team(name,result))

    results = sorted(results,key = lambda w:w.lose)
    results = sorted(results,key = lambda w:w.win, reverse = True)

    for i in range(n):
        print(results[i].name)




Measured memory_bytes: 5604
#!/usr/bin/env python3
import sys


def solve(a: int, b: int):
    if a>b:
        print("".join(str(b)*a))
    else:
        print("".join(str(a)*b))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(a, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
require 'openssl'
N,*X = $<.read.split.map &:to_i
M = (10**9+7).to_bn
m = 0.to_bn
F = (1...N).inject(m+1) {|s,i| s.mod_mul(i.to_bn,M)}
p (0...N).inject {|s,i|
	m += F * i.to_bn.mod_inverse(M)
	((m%=M) * (X[i]-X[i-1]).to_bn + s) % M
  }.to_i

Measured memory_bytes: 17276
//
//  main.cpp
//  algorithm-practice1
//
//  Created by g-2018 on 2017/04/28.
//  Copyright ?? 2017??´ 3431. All rights reserved.
//

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
  //****??´??????
  //**** int a????????£?¨?
  int a[5];
  for(int i=0;i<5;i++){
    cin >> a[i];
    }
  //?????????
  sort(a,a+5);
  
  for(int i=4; i >= 0; i--){
    if( i != 4 ){
      cout << " ";
        }
    //**** ????????????
    cout << a[i];
  }
  cout << endl;
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

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

int N;
ll H;
ll a[SIZE],b[SIZE];

int main()
{
	cin >> N >> H;
	rep(i,0,N)cin >> a[i] >> b[i];
	sort(a,a+N,greater<>());
	sort(b,b+N,greater<>());
	ll ans=0;
	rep(i,0,N){
		if(b[i] < a[0])break;
		H -= b[i];
		ans++;
		if(H <= 0)break;
	}
	if(H > 0) ans += (H + a[0] - 1)/a[0];
	cout << ans << endl;
	return 0;
}


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

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

    sort (a.begin(), a.end());
    int ans = 0, c = 1;
    for (int i = 1; i < n; i++) {
        if (a[i] == a[i-1]) c++;
        else {
            if (c & 1) ans++;
            c = 1;
        }
    }
    if (c > 0 && c & 1) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3788
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}

int main() {
	ll ans = 0;
	ll tmp;
	int l; 
	cin >> l;
	int m = 0;
	vector<tuple<int, int, int>> v;
	for(int i= 2; i<= 19; i++){
		v.push_back(make_tuple(i, i+1, 0));
		v.push_back(make_tuple(i, i+1, 1<<(19-i)));
		m+=2;
	}
	int mi = 0; 
	for(int sh = 0; mi<l; sh++){
		if(l &(1<< sh)){
			v.push_back(make_tuple(1, 20-min(sh,18), mi));
			mi+=(1<<min(sh,18));
			m++;
		}
	}
	cout << "20 " << v.size() << endl;
	REP(i, v.size()){
		cout << get<0>(v[i]) << " " << get<1>(v[i]) << " " << get<2>(v[i]);
		cout << endl;
	}
}

Measured memory_bytes: 3636
use std::io;
use std::str::FromStr;
use std::collections::HashSet;
use std::collections::HashMap;

static MOD: u64 = 1_000_000_007;

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

fn calc_prime_numbers(n: u64) -> HashSet<u64> {
    let limit: u64 = (n as f64).sqrt() as u64;
    let mut prime_numbers: HashSet<u64> = HashSet::new();
    for i in 2..(limit+1) {
        let mut flag = true;
        for p in &prime_numbers {
            if i % p == 0 {
                flag = false;
            }
        }
        if flag {
            prime_numbers.insert(i);
        }
    }
    prime_numbers
}

fn main() {
    let n: u64 = input();
    let prime_nums = calc_prime_numbers(1000000);
    let mut divisor_count: HashMap<u64, u64> = HashMap::new();
    // println!("{:?}", prime_nums);
    for i in 1..(n+1) {
       for p in &prime_nums {
           let mut num = i;
           while num % *p == 0 {
                num /= *p;
                let n = divisor_count.entry(*p).or_insert(0);
                *n += 1;
           }
           if num == 1 {
               break;
           }
       }
    }

    let mut ans = 1;
    for i in divisor_count.values() {
        ans *= (i+1);
        ans %= MOD;
    }
    // divisor_count.remove(&1);
    // println!("{:?}", divisor_count);
    println!("{}", ans);
}


Measured memory_bytes: 4352
A,B,C,D,E,F = (int(i) for i in input().split())

water_list = []
suger_list = []

for i in range(F):
  if 100*A*i <= F:
    for j in range(F):
      if 100*B*j <= F:
        if 100*A*i + 100*B*j <= F:
          water_list.append(100*A*i + 100*B*j)
        else:
          break
      else:
        break
  else:
    break

for i in range(F):
  if C*i <= F:
    for j in range(F):
      if D*j <= F:
        if C*i + D*i <= F:
          suger_list.append(C*i+D*j)
        else:
          break
      else:
        break
  else:
    break

ans = 0
ans_list = []

for water in water_list:
  for suger in suger_list:
    if water != 0 and suger != 0:
      if suger/(water + suger) >= ans and water+suger <= F and suger <= (water/100)*E:
        ans = suger/(water + suger)
        ans_list = [water,suger]

if ans != 0:
  print(str(ans_list[0]+ans_list[1]) + " " + str(ans_list[1]))
else:
  print(str(A*100) + " 0")


Measured memory_bytes: 9160
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define S_MAX 1000
#define N_MAX 100000
#define M_MAX 100000
#define INF 2000000000
#define MOD 1000000007
#define SMAP(a, b) ((a)!=(b))&&((a)^=((b)^=((a)^= (b))))

typedef unsigned long long ull;
typedef   signed long long dll;

typedef struct {
	int a;
	int b;
	int c;
} moneydata;

int n, m;
int h, w;
int i, j;
int k;

char a[S_MAX][S_MAX + 1];
char monsho[2][2 + 1];

int max(int a, int b){
	return (a > b) ? a : b;
}

int tokeynum(char c){
	switch(c){
	case 'J':
		return 0;
	case 'O':
		return 1;
	case 'I':
		return 2;
	}
	return -1;
}

char tochar(int n){
	return "JOI"[n];
}

int mdiff(int i, int j){
	int s[3] = {0};
	int prevkey = tokeynum(a[i][j]);

	if (i > 0 && j > 0 &&
		a[i-1][j-1] == monsho[0][0] &&
		a[i-1][j] == monsho[0][1] &&
		a[i][j-1] == monsho[1][0]) {
		s[tokeynum(monsho[1][1])]++;
	}
	if (i > 0 && j < w-1 &&
		a[i-1][j] == monsho[0][0] &&
		a[i-1][j+1] == monsho[0][1] &&
		a[i][j+1] == monsho[1][1]) {
		s[tokeynum(monsho[1][0])]++;
	}
	if (i < h-1 && j > 0 &&
		a[i][j-1] == monsho[0][0] &&
		a[i+1][j-1] == monsho[1][0] &&
		a[i+1][j] == monsho[1][1]) {
		s[tokeynum(monsho[0][1])]++;
	}
	if (i < h-1 && j < w-1 &&
		a[i][j+1] == monsho[0][1] &&
		a[i+1][j] == monsho[1][0] &&
		a[i+1][j+1] == monsho[1][1]) {
		s[tokeynum(monsho[0][0])]++;
	}

	return max(s[(prevkey + 1) % 3], s[(prevkey + 2) % 3]) - s[prevkey];
}

void solve(){
	int result = 0;
	int maxdiff = 0;
	for (i = 0; i < h - 1; i++) {
		for (j = 0; j < w - 1; j++) {
			if (a[i][j] == monsho[0][0] &&
				a[i][j+1] == monsho[0][1] &&
				a[i+1][j] == monsho[1][0] &&
				a[i+1][j+1] == monsho[1][1]) {
				result++;
			}
		}
	}

	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			int tdiff = mdiff(i, j);
			if (tdiff > maxdiff) maxdiff = tdiff;
		}
	}

	printf("%d\n", result + maxdiff);

	return;
}

int main (void) {
	scanf("%d%d", &h, &w);
	for (i = 0; i < h; i++) scanf("%s", a[i]);
	scanf("%s%s", monsho[0], monsho[1]);

	solve();
	
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int h[n];
    vector <int>dp(n,INT_MAX);
    for(int i=0;i<n;i++)
     cin >> h[i];
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        if(i+1<n)
            dp[i+1]=min(dp[i+1],abs(h[i+1]-h[i])+dp[i]);
        if(i+2<n)
        dp[i+2]=min(dp[i+2],abs(h[i+2]-h[i])+dp[i]);

    }
    cout << dp[n-1];
    return 0;
}

Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m;
	cin>>n>>m;
	if(1<=n and n<=9 and 1<=m and m<=9)puta(n*m);
	else puta(-1);
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=50;
//↑templete
int main() {
	ll L,R;
	cin>>L>>R;
	ll DP[64][2][2][2]={};	//DP[i][j][k][l] 上からi桁が決まっている, j:L<=x確定か？, k:y<=R確定か？, l:最上位桁が一致していることが確定か？
	DP[63][0][0][0]=1;	//63桁目は流石に絶対(x,y)=(0,0)しかないでしょ

	for(int i=62;i>=0;i--){	//上から
		//各桁(x,y)=(1,1),(0,1),(0,0)のどれか

		ll Ld=!!(L&(1LL<<i)), Rd=!!(R&(1LL<<i));	//LとRのi桁目
		for(int j=0;j<2;j++){
			for(int k=0;k<2;k++){
				for(int l=0;l<2;l++){
					ll temp=DP[i+1][j][k][l];

					//(x,y)=(a,b)への遷移
					for(int a=0;a<2;a++){
						for(int b=0;b<2;b++){

							if(a && !b)	//(x,y)=(1,0)の遷移はない
								continue;
							if(!j && Ld && !a)	//L<=xが確定していないかつLd=1のとき、xを0にできない
								continue;
							if(!k && !Rd && b)	//y<=Rが確定していないかつRd=0のとき、yを1にできない
								continue;
							if(!l && a!=b)	//最上位桁が確定していないとき、x!=yにできない
								continue;

							int nj=j,nk=k,nl=l;	//遷移先

							if(!j && !Ld && a)	//L<=xを確定させる場合
								nj=1;
							if(!k && Rd && !b)	//y<=Rを確定させる場合
								nk=1;
							if(!l && a && b)//最上位桁の一致を確定させる場合
								nl=1;

							(DP[i][nj][nk][nl]+=temp)%=MOD;
						}
					}
				}
			}
		}
	}

	ll ans=0;
	for(int j=0;j<2;j++){
		for(int k=0;k<2;k++){
			for(int l=0;l<2;l++){
				(ans+=DP[0][j][k][l])%=MOD;
			}
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
void main() {
	auto N = ri;
	writeln((N-1)/2);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

bool compX(pair<int, ll> p1, pair<int, ll> p2) {
  return p1.second < p2.second;
}
bool compI(pair<int, ll> p1, pair<int, ll> p2) {
  return p1.first < p2.first;
}

int main(){
  int A, B, Q;
  cin >> A >> B >> Q;
  vector<ll> S(A+2, 0), T(B+2, 0);
  S[0] = -1e10;  S[A+1] = 2e+10;
  T[0] = -1e10;  T[B+1] = 2e+10;
  for(int i=0; i<A; i++)
    cin >> S[i+1];
  for(int i=0; i<B; i++)
    cin >> T[i+1];
  vector<pair<int, ll> > X;
  for(int i=0; i<Q; i++) {
    ll x;
    cin >> x;
    X.push_back(pair<int, ll>(i, x));
  }
  sort(X.begin(), X.end(), compX);
  vector<pair<int, ll> > Ans;
  int tmpA = 0, tmpB = 0;
  for(int i=0; i<X.size(); i++) {
    ll x = X[i].second;
    while(S[tmpA] <= x) tmpA++;
    while(T[tmpB] <= x) tmpB++;
    ll al = S[tmpA-1], ar = S[tmpA];
    ll bl = T[tmpB-1], br = T[tmpB];
    // cout << max(ar, br)-x << ' ' << x-min(al, bl) << ' '
    // 	 << (br-al)+min(br-x,x-al) << ' ' << (ar-bl)+min(x-bl,ar-x) << endl;
    ll ans = min(min(max(ar, br)-x, x-min(al, bl)),
		 min((br-al)+min(br-x,x-al), (ar-bl)+min(x-bl,ar-x)));
    Ans.push_back(pair<int, ll>(X[i].first, ans));
  }
  sort(Ans.begin(), Ans.end(), compI);
  for(int i=0; i<Ans.size(); i++)
    cout << Ans[i].second << endl;
  return 0;
}

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

int main()
{
    int i, k, m, n;
    cin>>k;

    if(k%2 == 0)
    {
        m = k/2;
        n = k/2;
    }
    else
    {
        m = k/2;
        n = m +1;
    }

    cout<<m*n;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DEBUG
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> pii;
///////////// END OF TEMPLATE //////////////////////////////

const int mxsz = 1e5 + 3;
int n;
int l[mxsz], r[mxsz];

priority_queue<LL> kiri;
priority_queue<LL, vector<LL>, greater<LL> > kanan;
int main() {
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> l[i] >> r[i];
	LL ans = 0LL, lzl = 0LL, lzr = 0LL;
	kiri.push(l[1]);
	kanan.push(l[1]);
	for (int i = 2; i <= n; i++){
		lzr += r[i-1] - l[i-1];
		lzl -= r[i] - l[i];
		LL tmpl = kiri.top() + lzl, tmpr = kanan.top() + lzr;
		if (l[i] <= tmpl){
			kiri.pop();
			kiri.push(l[i] - lzl);
			kiri.push(l[i] - lzl);
			kanan.push(tmpl - lzr);
			ans += llabs(tmpl - l[i]);
		} else if (l[i] >= tmpr){
			kanan.pop();
			kanan.push(l[i] - lzr);
			kanan.push(l[i] - lzr);
			kiri.push(tmpr - lzl);
			ans += llabs(l[i] - tmpr);
		} else {
			kiri.push(l[i] - lzl);
			kanan.push(l[i] - lzr);
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 2804