akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T x; cin >> x; return x; }

signed main()
{
	int inning = in();
	REP(i, inning) {
		bool base[3]{ false, false, false };
		int point = 0, out = 0;
		while (out < 3) {
			string str = in<string>();
			if (str == "HIT") {
				if (base[2]) {
					++point;
					base[2] = false;
				}
				if (base[1]) {
					base[2] = true;
					base[1] = false;
				}
				if (base[0]) {
					base[1] = true;
					base[0] = false;
				}
				base[0] = true;
			} else if (str == "HOMERUN") {
				REP(i, 3) {
					if (base[i]) {
						++point;
						base[i] = false;
					}
				}
				++point;
			} else if (str == "OUT") {
				if (++out == 3) {
					break;
				}
			}
		}
		cout << point << endl;
	}
}


Measured memory_bytes: 3004
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    ll h=0,w=0,c=0,d=0,n,m,k,ans=0,y;
    string s,s2;
    cin >> n;
    m = n;
    while(m>0){
        ans += m % 10;
        m /= 10; 
    }
    if(n%ans==0) cout << "Yes" <<endl;
    else cout << "No" <<endl;
    return 0;
}


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

using namespace std;

#define ll long long 

ll arr[100005],dp[100005], n;

int main()
{
	ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	int k;
	
	cin >> n >> k;
	
	for(int i = 1; i <= n; i++)
	{
		cin >> arr[i];
	}
	
	dp[1] = 0;
	dp[2] = abs(arr[2] - arr[1]);
		
	for(int i = 3; i <= n; i++)
	{
		ll ans = 1000000000000000000;
		
		for(int j = 1; j <= k; j++)
		{
			if(abs(i-j) <= 0) break;
			else
			{
			    ans = min(ans, dp[i-j] + abs(arr[i] - arr[i-j]));    	
			}
		}
		
		dp[i] = ans;
	}	
		
    cout << dp[n] << endl;		
		
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
long long k,I,A,x_y,x[2],fib[2],a,i;double D;
#define MOD 1000000007
int dp[3];
int main(){
    cin>>k;
    a=sqrt(k)/16;
    x_y=(long long)(2*sqrt(k-a-0.01))-1;
    A=(x_y+2)*(x_y+2)/4;
    I=(x_y+1)*(x_y+1)/4+1;
    D=1.0*(A+I)/2;
    if(k<=D){x[1]=(k-I)*2;}
    else{x[1]=(A-k)*2+1;}
    x[0]=x_y-x[1];
    
    for(int h=0;h<2;h++){
    if(x[h]<3){
        fib[h]=x[h]+1;
    }
    else{
        dp[0]=1;
        dp[1]=2;
        dp[2]=3;
 
        for(i=3;i<=x[h];i+=3)
        {
            dp[0]=(dp[1]+dp[2])%MOD;
            dp[1]=(dp[2]+dp[0])%MOD;
            dp[2]=(dp[0]+dp[1])%MOD;
        }
 
        fib[h]=dp[x[h]%3];
    }
    }
    cout<<(fib[0]*fib[1])%MOD<<endl;
}

Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)
#define INF 1<<29;

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

    i64 ec = 0;
    i64 oc = 0;
    int x = 1;
    while(x*k <= 2*n)
    {
        if(x%2 == 0) ec++;
        else oc++;
        x++;
    }

    i64 cnt = ec*ec*ec;
    if(k%2 == 0) cnt += oc*oc*oc;
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

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

	vector<int> input(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> input[i];
	}

	vector<int> sorted(N);
	copy(input.begin(), input.end(), sorted.begin());
	sort(sorted.begin(), sorted.end());

	int count = 0;
	for (int i = 0; i < N; ++i)
	{
		if (input[i] != sorted[i])
		{
			++count;
		}
	}

	if (count > 2)
	{
		cout << "NO" << endl;
	}
	else
	{
		cout << "YES" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
	string n;

	cin >> n;
	for (int i = 0; i < n.length(); i++) {
		if (n[i] == '9') {
			cout << 1;
		}
		else {
			cout << 9;
		}
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
// tyrionlannister238

#include<bits/stdc++.h>
using namespace std;
 
string to_string(string s) {
    return '"' + s + '"';
}

string to_string(char ch) {
    string s(1, ch);
    return '\'' + s + '\'';
}

string to_string(const char *s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define ll long long
#define pb push_back
#define speed ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);

int main() {
	ll w, s; cin >> s >> w;
	cout << ((w >= s) ? "unsafe\n" : "safe\n");
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <sstream>
#include <cstdlib>
#include <cstdio>
using namespace std;


int main(){
	string s,tmp;
	while(getline(cin,s)){
		stack<double>st;
		stringstream ss(s);
		while(ss>>tmp){
			if(tmp=="+"||tmp=="-"||tmp=="*"||tmp=="/"){
				double s1,s2;
				s2=st.top();
				st.pop();
				s1=st.top();
				st.pop();
				if(tmp=="+")st.push(s1+s2);
				if(tmp=="-")st.push(s1-s2);
				if(tmp=="*")st.push(s1*s2);
				if(tmp=="/")st.push(s1/s2);
			}
			else{
				st.push(atof(tmp.c_str()));
			}
		}
		printf("%.6lf\n",st.top());
	}
	
	return 0;
}


Measured memory_bytes: 1276
#include <iostream>
#include <cstdio>
using namespace std;
 
int main(){
    string s;
    cin >> s;
    int n = s.size();
 
    int length;
    for(int i = 1; i < n/2; i++) {
        if(s.substr(0, n/2-i) == s.substr(n/2-i, n/2-i)){
            length = s.size() - 2*i;
            break;
        }
    }
 
    cout << length << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>

using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5+111;
#define ll long long
int n, a[maxn], vis[maxn];
ll k;
vector<int> q;

int main(){
    scanf("%d %lld", &n, &k);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    int u = 1;
    while (!vis[u]){
        vis[u] = 1;
        q.push_back(u);
        u = a[u];
    }
    int p = 0;
    for (;p<q.size(); p++) if (q[p]==u) break;
    if (k <= p){
        int m = k;
        printf("%d\n", q[m]);
    }
    else {
        int m = (k-p)%(q.size()-p);
        printf("%d\n", q[m+p]);
    }
}



Measured memory_bytes: 5784
#include<bits/stdc++.h>
#define cs const
#define pb push_back
#define y1 y_1
using namespace std;
typedef long long ll;
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	ll S; scanf("%lld",&S);
	ll t = sqrt(S);
	if(1ll * t * t == S){
		cout << 0 << " " << 0 << " " << t << " " << 
		0 << " " << 0 << " " << t << '\n';
		return 0;
	} ++t;
	ll x2 = t, y1 = t;
	ll r = t * t - S;
	ll x1 = 1, y2 = r;
	if(t < 1e9){
		if(r & 1) ++x2, --y1, --r;
		x1 = 2, y2 = r >> 1; 
		cout << 0 << " " << 0 << " " << x1 << 
		" " << y1 << " " << x2 << " " << y2;
		return 0;
	} else{
		if(r <= 1e9){
			cout << 0 << " " << 0 << " " << x1 << 
			" " << y1 << " " << x2 << " " << y2;
			return 0;
		} y1 = t - 1;
		r = t * (t - 1) - S;
		y2 = r;
		cout << 0 << " " << 0 << " " << x1 << 
		" " << y1 << " " << x2 << " " << y2;
	}
	return 0;
}

Measured memory_bytes: 3616
#include<iostream>
using namespace std;
int x[100100],ans[100100];
int main()
{
int N;
cin>>N;
for(int i=0;i<N;i++)
	cin>>x[i];
ans[N-1]=1;
for(int i=N-2;i>=0;i--)
	if(x[i]<x[i+1])
    	ans[i]=1;
    else	ans[i]=1+ans[i+1];
int res=0;
for(int i=0;i<N;i++)
	res=max(res,ans[i]);
cout<<res-1<<endl;
return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

#define N 500000
#define INFTY 1000000000

int S[N];
int cnt=0;

void merge(int A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;

  n1 = mid - left;
  n2 = right - mid;

  int L[n1+1],R[n2+1];

  for(i=0;i<n1;i++){
    L[i] = A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i] = A[mid+i];
  }
  
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i = i + 1;
    }else{
      A[k] = R[j];
      j = j+1;
    }
    cnt++;
  }
}

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

int main(){

  int n;
  int i;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  mergeSort(S,0,n);
  
  for(i=0;i<n;i++){
    printf("%d",S[i]);
    if(i<n-1) printf(" ");
  }
  printf("\n%d\n",cnt);
  
  return 0;
}



Measured memory_bytes: 5584
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/23 08:47:11 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	string	s;
	cin >> s;

	// vector<int>	V(26);
	int	minv;
	minv = INT_MAX;
	vector<pair<int, char>>	PP(26);
	for (char c = 'a'; c <= 'z'; c++)
	{
		// 配列を作る必要はなかった。直すの面倒なのでこれで提出
		vector<int>	V(100);
		int	tail;
		int	cnt;
		int	j;

		j = 0;
		cnt = 0;
		rep(i, s.size())
		{
			if (s.at(i) == c)
			{
				V.at(j) = cnt;
				j++;
				cnt = 0;
			}
			else
				cnt++;
		}
		tail = cnt;
		sort(V.begin(), V.end(), greater<>());
		int	times;
		times = 0;
		while (tail > 0 && V.at(0) > 0)
		{
			times++;
			tail--;
			for (int i = 0; V.at(i) != 0; i++)
				V.at(i)--;
		}
		if (V.at(0))
		{
			times += V.at(0);
			// while (1)
			// {
			// 	times++;
			// 	for (int i = 0; V.at(i) != 0; i++)
			// 		V.at(i)--;
			// 	V.at(0)--;
			// 	sort (V.begin(), V.end(), greater<>());
			// 	if (V.at(0) <= 0)
			// 		break ;
			// }
		}
		else if (tail)
			times += tail;
		minv = min(minv, times);
	}
	cout << minv << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		int a, b, cnt = 0;
		for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			b = sc.nextInt();
			if (a >= h && b >= w) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 26324
for _ in range(int(input())):
    s=list(input())
    word,direct=[],""
    for i in s:
        if i.isalpha():
            if direct==">":
                if i not in word:word.append(i)
            else:
                if i not in word:word.insert(0,i)
        elif i=="<" or i==">":direct=i
    print(*word,sep="")


Measured memory_bytes: 5632
void main() {
	auto N = ri;
	auto S = rs;
	ulong res = ulong.max;
	auto A = new int[](N);
	A[0] = S[0] == 'W';
	foreach(i; 1..N) A[i] = S[i] == 'W' ? A[i-1]+1 : A[i-1];
	/*auto B = new int[](N);
	[0] = S[0] == 'E';
	foreach(i; 1..N) B[i] = S[i] == 'E' ? B[i-1]+1 : B[i-1];
	*/
	debug A.writeln;
	//B.writeln;
	auto C = iota(1, N+1).map!(a => a - A[a-1]).array;
	debug C.writeln;
	foreach(i; 0..N) {
		ulong tmp;
		tmp += C[$-1] - C[i];
		tmp += i < 1 ? 0 : A[i-1];
		debug tmp.writeln;
		res = min(res, tmp);
	}
	res.writeln;
}

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

import std.stdio;
import std.string;
import std.conv;
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: 4436
package main

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

var H int

type Heap []int

func (h Heap) maxHeapify(idx int) {
	var largest int
	l := 2 * idx
	r := 2*idx + 1

	if l <= H && h[l] > h[idx] {
		largest = l
	} else {
		largest = idx
	}
	if r <= H && h[r] > h[largest] {
		largest = r
	}

	if largest != idx {
		h[idx], h[largest] = h[largest], h[idx]
		h.maxHeapify(largest)
	}
}

func answer(reader io.Reader) string {
	sc := bufio.NewScanner(reader)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	H, _ = strconv.Atoi(sc.Text())

	A := make(Heap, H+1)
	for i := 1; i <= H; i++ {
		sc.Scan()
		k, _ := strconv.Atoi(sc.Text())
		A[i] = k
	}

	for i := H / 2; i >= 1; i-- {
		A.maxHeapify(i)
	}

	var out bytes.Buffer
	for i := 1; i <= H; i++ {
		out.WriteString(fmt.Sprintf(" %d", A[i]))
	}

	return out.String()
}

func main() {
	fmt.Println(answer(os.Stdin))
}



Measured memory_bytes: 25144
s=input()
ans=1
istwo=False
isskip=False
for i in range(1,len(s)):
    if isskip:
        isskip=False
        ans+=1
        continue
    if istwo:
        ans+=1
        istwo=False
        isskip=True
        continue
    if s[i]==s[i-1]:
        istwo=True
    else:
        ans+=1
print(ans)

    


Measured memory_bytes: 3500
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String X = sc.next();
		String[] listA = X.split("");
		String ans = "Good";
		for (int i = 0; i < 3; i++) {
			if (listA[i].equals(listA[i + 1])) {
				ans = "Bad";
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23508
from heapq import heapify, heappop,heappush
n=int(input())
a=list(map(int,input().split()))
a=[i*(-1) for i in a]
a.sort()

ans=0
q=[]
heappush(q,a[0])
for i in range(1,n):
    tmp = heappop(q)
    ans += tmp*(-1)
    heappush(q,a[i])
    heappush(q,a[i])
print(ans)

Measured memory_bytes: 31604
import sys
from copy import deepcopy

n, m = [int(i) for i in input().split()]
es = [[int(j) for j in input().split()] for i in range(m)]

x = [float('-inf')] * (n+1)
x[1] = 0
border = sys.maxsize // 1000

for i in range(n):
    for a, b, c in es:
        x[b] = max(x[b], x[a]+c)
        if x[b] >= border:
            x[b] = float('inf')

prevxn = x[n]
for a, b, c in es:
        x[b] = max(x[b], x[a]+c)

if prevxn != x[n]:
    print('inf')
else:
    print(x[n])

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
// Big two primes 
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define int long long 
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
const int MAXN = (int)((1e5) + 100);
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;}  
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 


signed main(){
  fio;
    int n;
    cin>>n;
    vector<int> h(n),dp(n,inf);
    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],dp[i] + abs(h[i]-h[i+1]));
        if(i+2 < n) dp[i+2] = min(dp[i+2],dp[i] + abs(h[i]-h[i+2]));

    }
    cout<<dp[n-1]<<endl;
  rr;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define abs (x)(x>0?x:-x)


int main()
{
	int N;
	int A[100001];
	int B[100000];
	long long int C = 0;
	long long int sum = 0;

	scanf("%d", &N);

	for (int i = 0; i <= N; i++)
	{
		scanf("%d", &A[i]);
		C += A[i];
	}

	for (int i = 0; i < N; i++)
		scanf("%d", &B[i]);

	for (int i = 0; i < N; i++)
	{
		if (A[i] <= B[i])
		{
			B[i] -= A[i];
			A[i] = 0;

			if (A[i + 1] >= B[i] - A[i])
			{
				A[i + 1] -= B[i] - A[i];
			}
			else
			{
				A[i + 1] = 0;
			}
		}
		else
		{
			A[i] -= B[i];
		}


	}


	for (int i = 0; i <= N; i++)
	{
		sum += A[i];
		//printf("%d ", A[i]);
	}


	printf("%lld", C-sum);
}

Measured memory_bytes: 896
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<string>
#include <ios>     
#include <iomanip> 
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const llong MOD = 1000000007;

llong gcd(llong a, llong b) {
	if (a < b) swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}

llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}

//ここまで共通

int main() {
	double W, H, x, y;
	cin >> W >> H >> x >> y;
	double S = (double)((W * H) / 2);
	printf("%1.9lf", S);
	cout << ' ';

	
	if (x * 2 == W && y * 2 == H) cout << 1;
	else cout << 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
using node = tuple<ll, ll>;
const int inf = numeric_limits<int>::max();
const ll mod = 998244353LL;

ll fact[300000];
ll rfact[300000];
ll col_pow[300000];

void init_fact() {
  fact[0] = 1LL;
  for(int i = 1;i < 300000; ++i) {
    fact[i] = (fact[i-1] * i) % mod;
  }

  // calc fact[299999]^(mod-2)
  ll acc = 1LL;
  ll x = mod - 2LL;
  ll p = fact[299999];
  while(x > 0) {
    if(x & 1) {
      acc = (acc * p) % mod;
    }
    p = (p * p) % mod;
    x >>= 1;
  }
  rfact[299999] = acc;

  for(int i = 299999;i > 0;--i){
    rfact[i-1] = (rfact[i] * i) % mod;
  }
}

void init_col_pow(ll m) {
  col_pow[0] = 1LL;
  for(int i = 1;i < 300000;++i) {
    col_pow[i] = (col_pow[i-1] * (m - 1LL)) % mod;
  }
}

ll comb(int n,int k) {
  ll res = 1LL;
  res = (res * fact[n]) % mod;
  res = (res * rfact[n-k]) % mod;
  res = (res * rfact[k]) % mod;
  return res; 
}

int main(void) {
  int n, m, k;
  cin >> n >> m >> k;
  init_fact();
  init_col_pow((ll)m);
  ll res = 0LL;
  for(int i = 0;i <= k;++i){
    ll delta = 1;
    delta = (delta * (ll)m) % mod;
    delta = (delta * col_pow[n-1-i]) % mod;
    delta = (delta * comb(n - 1,i)) % mod;
    res = (res + delta) % mod;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 10688
N=int(input())
H=list(map(int,input().split()))
flag=True
for i in range(1,N):
    if H[i]>H[i-1]:
        H[i]-=1
    elif H[i]==H[i-1]:
        pass
    elif H[i]<H[i-1]:
        flag=False
print("Yes" if flag else "No")

Measured memory_bytes: 15020
### subroutines

def rect(x, y, w, h)
  #p ['rect', x, y, w, h]
  $sums[y + h][x + w] - $sums[y + h][x] - $sums[y][x + w] + $sums[y][x]
end

def count_div(x0, y0, w, h, ar = rect(x0, y0, w, h))
  return $cache[y0][x0][h][w] if ! $cache[y0][x0][h][w].nil?

  min_s = ar
  max_gn = 1

  for dy in (1...h)
    ar0 = rect(x0, y0, w, dy)
    next if ar0 < $limit
    ar1 = rect(x0, y0 + dy, w, h - dy)
    next if ar1 < $limit

    gn0, s0 = count_div(x0, y0, w, dy, ar0)
    gn1, s1 = count_div(x0, y0 + dy, w, h - dy, ar1)

    gn = gn0 + gn1
    s = (s0 < s1) ? s0 : s1

    if max_gn < gn || (max_gn == gn && min_s < s)
      max_gn = gn
      min_s = s
    end    
  end

  for dx in (1...w)
    ar0 = rect(x0, y0, dx, h)
    next if ar0 < $limit
    ar1 = rect(x0 + dx, y0, w - dx, h)
    next if ar1 < $limit

    gn0, s0 = count_div(x0, y0, dx, h, ar0)
    gn1, s1 = count_div(x0 + dx, y0, w - dx, h, ar1)

    gn = gn0 + gn1
    s = (s0 < s1) ? s0 : s1

    if max_gn < gn || (max_gn == gn && min_s < s)
      max_gn = gn
      min_s = s
    end    
  end

  $cache[y0][x0][h][w] = [max_gn, min_s]
end

### main

loop do
  h, w, sup = gets.split.map(&:to_i)
  break if (h | w | sup) == 0

  $dms = h.times.map{gets.split.map(&:to_i)}

  $sums = (h + 1).times.map{(w + 1).times.map{0}}
  for y in (0...h)
    for x in (0...w)
      $sums[y + 1][x + 1] =
        $dms[y][x] + $sums[y + 1][x] + $sums[y][x + 1] - $sums[y][x]
    end
  end
  #p $sums; exit

  $limit = $sums[h][w] - sup
  #p $limit
  
  $cache = h.times.map{w.times.map{(h + 1).times.map{(w + 1).times.map{nil}}}}

  max_gn, min_s = count_div(0, 0, w, h)
  puts [max_gn, min_s - $limit].join(' ')
end

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
  pr(b);
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  int h, w;
  cin >> h >> w;

  vector<string> g(h);
  int black = 0;
  for (int i = 0; i < h; i++)
  {
    cin >> g[i];
    for (int j = 0; j < w; j++)
    {
      black += g[i][j] == '#';
    }
  }

  queue<pair<int, int>> q;
  q.emplace(0, 0);

  vector<vector<int>> dist(h, vector<int>(w, -1));
  dist[0][0] = 0;

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

  while (!q.empty())
  {
    int y = q.front().first;
    int x = q.front().second;
    q.pop();
    for (int k = 0; k < 4; k++)
    {
      int yy = y + dy[k];
      int xx = x + dx[k];
      if (yy < 0 || xx < 0 || yy >= h || xx >= w)
        continue;
      if (g[yy][xx] == '#')
        continue;
      if (dist[yy][xx] != -1)
        continue;
      dist[yy][xx] = dist[y][x] + 1;
      q.emplace(yy, xx);
    }
  }

  if (dist[h - 1][w - 1] == -1)
  {
    cout << -1 << endl;
  }
  else
  {
    cout << (h * w) - dist[h - 1][w - 1] - black - 1 << endl;
  }
}


Measured memory_bytes: 3640
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin, (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
struct Edge {
	int to;
	int id;
};
vector<vector<Edge>> g;
vector<int> ans;
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
	  fac[i] = fac[i-1] * i % MOD;
	  inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
	  finv[i] = finv[i-1] * inv[i] % MOD;
	}
}
//組み合わせ
long long COM (int n, int k) {
	if(n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
void dfs(int q, int c = -1, int p = -1) {
	int k = 1;
	rep (i, g[q].size()) {
		int u = g[q][i].to;
		int ei = g[q][i].id;
		if (u == p) continue;
		if (k == c) k++;
		ans[ei] = k; k++;
		dfs(u, ans[ei], q);
	}
}
void solve() {
	int n; cin >> n;
	g.resize(n);
	ans = vector<int>(n - 1);
	rep (i, n - 1) {
		int a, b; cin >> a >> b;
		a--; b--;
		g[a].push_back((Edge){b, i});
		g[b].push_back((Edge){a, i});
	}
	dfs(0);
	int mx = 0;
	rep (i, n - 1) {
		mx = max(mx, (int)ans[i]);
	}
	cout << mx << endl;
	rep (i, n - 1) {
		cout << ans[i] << endl;
	}
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 8320
#include <stdio.h>
int main(void){
int h1,h2,m1,m2, k;
scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
printf("%d\n", h2*60+m2-k-h1*60-m1);

return 0;
}

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

int main() {
	int w, a, b;
	cin >> w >> a >> b;
	int ar = a, al = a + w, br = b, bl = b + w;
	if (al < br) {
		cout << br - al << endl;
	}
	else if (bl < ar) {
		cout << ar - bl << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

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

#define DEVIDE 1000000007

int N, K;
vector<int> childs[100001];
long long cnt;

long long P(int n, int k) {
  long long ans = 1;                                              
  for(int i=0; i<k; i++) {
    ans *= ((n-i)%DEVIDE);
    ans %= DEVIDE;
  }
  return ans;
}

void dfs(int v, int p, bool start){
  if(childs[v].size() != 1 || start) {
      cnt *= (P(start ? K-1 : K-2, childs[v].size()-(start ? 0 : 1))%DEVIDE);
      cnt %= DEVIDE;
  }
  for(int i=0; i<childs[v].size(); i++) {
    if(childs[v][i]!=p) {
        dfs(childs[v][i], v, false);
    }
  }
}

int main() {
  cin >> N >> K;
  int a,b;
  cnt = K;
  for(int i=0; i<N-1; i++) {
    scanf("%d", &a);
    scanf("%d", &b);
    childs[a].push_back(b);
    childs[b].push_back(a);
  }
  dfs(1, 0, true);
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 9216
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N,P; cin>>N>>P;
    vint a(N);
    REP(i,N) cin>>a[i];

    bool odd=0;
    REP(i,N) if(a[i]%2==1) odd=1;

    int ans;
    if(odd) ans=pow(2,N-1);
    else{
        if(P%2==0) ans=pow(2,N);
        else ans=0;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
using AtCoderBeginnerContest137.Questions;
using AtCoderBeginnerContest137.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest137.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var ab = inputStream.ReadIntArray();
            var a = ab[0];
            var b = ab[1];
            var plus = a + b;
            var sub = a - b;
            var mul = a * b;
            yield return Math.Max(Math.Max(plus, sub), mul);
        }
    }
}


namespace AtCoderBeginnerContest137
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest137.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest137.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d;
    cin >>n>>d;
    int a[n][d];
    long long int sum=0,temp,c=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<d;j++)
            cin >>a[i][j];
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            sum=0;
            for(int k=0;k<d;k++)
            {
                sum+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
            }
            temp=sqrt(sum);
            if(temp*temp==sum)c++;
        }
    }
    cout <<c<<endl;
}


Measured memory_bytes: 256
w,h,x,y,r=[int(x) for x in input().split()]
if x < 0 or y < 0 or x > w or y > h:
    print('No')
else:
	first, second = False, False 
	if (x + r <= w) and (x - r >= 0):
	    first = True
	if (y + r <= h) and (y - r >= 0):
	    second = True
	if first and second:
	    print('Yes')
	else:
	    print('No')


Measured memory_bytes: 5604
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

#define ll long long
#define pb push_back

int main(){

	int N, A, B;
	cin >> N >> A >> B;
	cout << min(A, B) << " " << max(0, A + B - N) << endl;

	return 0;
}


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

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

int main(){
    int ans = 700;
    rep(i,3){
        char c = getchar();
        if(c == 'o') ans += 100;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

#define int long long

int32_t main()
{
    int a,b; cin>>a>>b;
    if((a+b)%2==0) cout<<(a+b)/2;
    else cout<<"IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,i,k,j;
    cin>>n>>k;
    ll ar[n];
    for(i=0;i<n;i++)
    cin>>ar[i];
    
    ll dp[n];
    for(i=0;i<n;i++)
    dp[i]=1000000000;
    
    dp[0]=0;
   // dp[1]=abs(ar[0]-ar[1]);
 
    for(i=1;i<n;i++)
    {
        for(j=1;j<=k;j++)
        {
            if(i-j>=0)
            dp[i]=min(dp[i],abs(ar[i]-ar[i-j])+dp[i-j]);
        }
    }
    
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
N=int(input())
D=False
ans=1
List=list(map(int,input().split()))
if 0 in List:
  print(0)
else:
  for i in range(N):
    ans=ans*List[i]
    if ans>10**18:
      print(-1)
      D=True
      break
  if D==False:
    print(ans)

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

int main() {
  int n,w;
  cin >> n;
  set<int> a;
  rep(i,n){
    cin >> w;
    a.insert(w);
  }
  cout <<a.size()<<endl;
}

Measured memory_bytes: 3608
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處

int main() {
    char s[5];
    scanf("%s", s);
    int ans = 0;
    for (int i = 0; i < 4; i++) {
        if (s[i] == '-') {
            ans--;
        } else {
            ans++;
        }
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 128
n,m = (int(x) for x in input().split())
l,r = (int(x) for x in input().split())

for i in range(m - 1):
	a,b = (int (x) for x in input().split())
	if l > r:
		continue
	if l < a:
		l = a
	if r > b:
		r = b

print(r - l + 1 if r >= l else 0)

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


#define ll long long
#define FOR(x,y,z) for(ll x = y; x <= (ll)z; x++)
#define line cout << endl

using namespace std;


void A() {
	int n;
	cin >> n;
	n %= 10;
	if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
		cout << "hon";
	}
	else if (n == 0 || n == 1 || n == 6 || n == 8) {
		cout << "pon";
	}
	else if (n == 3) {
		cout << "bon";
	}

	
}


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




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

using namespace std;

int main(){

    int N;
    cin >> N;
    
    vector<int> H(N);
    
    for (int i = 0; i < N; i ++) {
        cin >> H[i];
    }
    
    int ans = 1;
    int see = 0;
    
    for (int i = 1; i < N; i++) {
        for (int j = 0; j < i; j++) {
            if (H[j] > H[i]) {
                see = 1;
            }
        }
        if (see == 0) {
            ans += 1;
        }
        see = 0;
    }
    
    
    cout << ans << endl;
    
    
    
    
    
    return 0;
    
}


Measured memory_bytes: 384
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K = int(input())


print(A[K-1])

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int a;
	for(int i=0;i<m;i++){
		cin>>a;
		n-=a;
	}
	if(n<0){
		cout<<"-1"<<endl;
	}else{
		cout<<n<<endl;
	}
}


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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<ll, ll> ll_ll;
const int MOD = 1e9 + 7;
const ll INF = LLONG_MAX / 2;
struct edge { int i, v, w; };

int main() {
	int N; cin >> N;
	vector<ll> a(100);
	a[0] = 2, a[1] = 1;
	for (int i = 2; i < 100; i++) a[i] = a[i - 1] + a[i - 2];
	cout << a[N] << endl;
}


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

int main(){
	int n;
	string str;
	while(cin >> n, n){
	
	vector<char> s[1008];
		for(int i = 0;i < n;i++){
			cin >> str;
			for(int j = 0;j < str.size();j++)s[i].push_back(str[j]);
			int plus;
			for(int j = 1;j < str.size();j++){
				if(s[i][j] != '.' && s[i][j-1] == '.')s[i][j-1] = '+', plus = j - 1;
			}
			for(int j = 0;j < str.size();j++){
				if(s[i][j] == '.')s[i][j] = ' ';
			}
			for(int j = i-1;j >= 0;j--){
				if(s[j].size() <= plus)break;
				if(s[j][plus] == '+'){
					for(int k = j+1;;k++){
						if(s[k][plus] == '+')break;
						s[k][plus] = '|';
					}
					break;
				}
				if(s[j][plus] != ' ')break;
			}
		}
		for(int i = 0;i < n;i++){
			for(int j = 0;j < s[i].size();j++)cout << s[i][j];cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1800
<?php
list($n, $x) = ints();
$a = ints();
sort($a);
$cnt = 0;
for ($i = 0; $i < $n; ++$i) {
    if ($x < $a[$i]) break;
    if ($i < $n - 1) {
        ++$cnt;
        $x -= $a[$i];
    } elseif ($x === $a[$i]) {
        ++$cnt;
    }
}
echo $cnt;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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

int main() {
  int N;
  cin >> N;
  int max = 0;
  
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int h;
    cin >> h;
    if (h >= max) {
      max = h;
      ans++;
    }
  }
  
  cout << ans << endl;
  
}

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

using namespace std;

int main(){
    long int n, a[200000]={}, b[200000]={};
    long long int k;
    int num=0, x=0;
    set<int>st;

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

    for (int i = 0; i < k; i++)
    {
        if(b[num] == 0){
            b[num] = i+1;
        }else{
            x = (k-(b[num]-1)) % (i-b[num]+1);
            break;
        }
        num = a[num] - 1;
    }

    for (int i = 0; i < x; i++)
    {
        num = a[num] - 1;
    }

    cout << num + 1 << endl;
    
    return 0;
}

Measured memory_bytes: 6772
import java.io.*;
import java.util.*;
public class Main
{
	final long mod=(long)(1e9+7);
	final int maxn=(int)(1e6);
	
	private void solve()throws IOException
	{
		int n=nextInt();
		boolean flag=true;
		for(int i=1;i<=n;i++)
		{
			int a=nextInt();
			if(a%2==0)
			{
				if(a%3==0 || a%5==0)
					continue;
				else
					flag=false;
			}
		}
	out.println(flag?"APPROVED":"DENIED");
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();

		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 24532
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
ll n, m;
ll k;
ll CEIL(ll x, ll y)
{
	return (x + y - 1ll) / y;
}
int main()
{
	//freopen("D:\\code\\text\\input.txt","r",stdin);
	//freopen("D:\\code\\text\\output.txt","w",stdout);
	n = readll();
	m = readll();
	k = readll();
	if (m > n)
		swap(n, m);
	printf("%lld\n", CEIL(k, n) );
	return 0;
}




Measured memory_bytes: 256
//====== begin of bisma c++ template===========
#include<bits/stdc++.h>
#include <assert.h>
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define ll long long 
#define sum(a,b) a=a+b
#define mem(a, b) memset(a, (b), sizeof(a))

//=======binarysearch===========
int bs(vector<int>&a,int que){
 auto it=lower_bound(a.begin(),a.end(),que);
 if(*it==que){
    return it-a.begin();
 }
 return -1;
}
//========binarysearch=========



//=======SUBSET WITH BRUTEFORCE=============
void subsets(int S[], int n) {
     int nSub = 1<<n; 
     for(int i=0; i<nSub; i++){
          cout<<"{ ";//optional
          for(int k=0; k<n; k++){
               //if the k-th bit is set
               if( (1<<k) & i){
                    cout<<S[k]<<" ";
               } 
          }
          cout<<"}\n"; //optional
     }
}
//======SUBSET WITH BRUTE FORCE================


//======permuatate all ==================
void permutate(){
int n,x;
cin>>n;

vector<int> permutation;
for (int i = 0; i < n; i++) {
    cin>>x;
permutation.push_back(x);
}
do {
 rep(i,0,n-1) cout<<permutation[i];
 cout<<endl;
} while (next_permutation(permutation.begin(),permutation.end()));

}
//====permuatate all======================





//=====check prime========================
bool isprime(int x)
{
  if ( x == 2 ) return true;
  if ( x  < 2 ) return false;
  for ( int i = 2; i * i <= x; i++ )
    if ( x % i == 0 ) return false;
  return true;
}
//======check prime=====================



//======= the end of bisma c++ template ============



int main(){



int n,m,d;

cin>>n>>m>>d;

double ans;

if(d==0){
  ans=(m-1)*(1.0/n);

  cout<<fixed<<setprecision(10)<<ans<<endl;
}else{
  ans=(m-1)*2.0*(n-d)/(1.0*n*n);
  cout<<fixed<<setprecision(10)<<ans<<endl;


}

    return 0;
}















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

using namespace std;

int main(){
    int n;
    double A[100];
 
    cin>>n;
    for(int i=0;i<n;i++){
        cin >> A[i];
    }

    double sum = 0.0;
    for(int i=0;i<n;i++){
        sum += 1.0/A[i];
    }

    double retval = 1.0/sum;
    cout<< std::setprecision(10)<<retval<<endl;

}



Measured memory_bytes: 256