akhauriyash/Code-Regression huggingface dataset:
using System;

namespace _167_a
{
    internal class Registration
    {
        private static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();
            if (s == null || t == null) return;

            for (var i = 0; i < s.Length; i++)
            {
                if (s[i] != t[i])
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.WriteLine("Yes");
        }
    }
}

Measured memory_bytes: 25880
from itertools import cycle

INITIALIZE = 32

while True:

    input_count = int(input())

    if input_count == 0:
        break

    get_list = [int(item) for item in input().split(" ")]

    ohajiki = INITIALIZE
    output = []

    for get_count in cycle(get_list):

        ohajiki -= (ohajiki - 1) % 5
        output.append(ohajiki)

        if get_count < ohajiki:
            ohajiki -= get_count
            output.append(ohajiki)
        else:
            output.append(0)
            break

    output = [str(item) for item in output]
    print("\n".join(output))



Measured memory_bytes: 5648
//ALLAH
#include <bits/stdc++.h>
using namespace std;
int n,A[100005][4],dp[100005][5];
int miro(int node,int son){
	int cev=-1000000000;
	if(node==n+1) return 0;
	if(dp[node][son]!=-1) return dp[node][son];
	for(int i=1;i<=3;i++){
		if(son==i){
			continue;
		}
		cev=max(miro(node+1,i)+A[node][i],cev);
	}
	return dp[node][son]=cev;	
}
int main(){
	memset(dp,-1,sizeof(dp));
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d %d %d",&A[i][1],&A[i][2],&A[i][3]);
	}
	int ty=miro(1,0);
	printf("%d",ty);
	
	return 0;
}



Measured memory_bytes: 11520
N,M = gets.split.map(&:to_i)

wa = {}
ac = {}
readlines.each do |ps|
  p,s = ps.split
  i = p.to_i
  next if ac[i]
  if s == 'AC'
    ac[i] = true
  else
    wa[i] = (wa[i] || 0) + 1
  end
end
puts ac.values.size
puts wa.inject(0) {|r,(k,v)| r + (ac[k] ? v : 0) }


Measured memory_bytes: 17404
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int in;
  while(cin>>in){
    int out=1;
    rep(i,in)out+=i+1;
    cout<<out<<endl;
  }
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int x[][] = new int[n][d];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < d; j++) {
				x[i][j] = sc.nextInt();
			}
		}
		int ans = 0;
		for (int i = 0; i < n - 1; i++) {
			for (int j = i + 1; j < n; j++) {
				if (dist(x[i], x[j])) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}

	static public boolean dist(int a[], int b[]) {
		int dist = 0;
		for (int i = 0; i < a.length; i++) {
			dist += (a[i] - b[i]) * (a[i] - b[i]);
		}
		if ((int)Math.sqrt(dist) *(int)Math.sqrt(dist) - dist == 0) {
			return true;
		} else {
			return false;
		}
	}

}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define MAX 100005
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
int  counter[MAX];

vector<pii> vp;

bool compare(pii A, pii B)
{
    return A.second > B.second;
}

int main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt","w", stdout);
    // #endif
    int n, k, u, v;

    cin>>n>>k;

    for(int i = 0; i < n; i++){
        cin>>u>>v;
        vp.push_back(make_pair(u, v));
    }

    sort(vp.begin(), vp.end(), compare);
    priority_queue<int, vector<int>, greater<int> > pq;

    ll sum = 0, cnt = 0;
    for(int i = 0; i < k; i++){
        sum += vp[i].second;
        counter[vp[i].first]++;
        if(counter[vp[i].first] >= 2)
            pq.push(vp[i].second);
        else
            cnt++;
    }

    ll ans = sum + (cnt * cnt);

    for(int i = k; i < n; i++){
        if(pq.empty())
            break;
        if(counter[vp[i].first] >= 1)
            continue;
        counter[vp[i].first]++;
        int temp = pq.top();
        pq.pop();

        sum -= temp;
        sum += vp[i].second;
        cnt++;
        ans = max(ans, sum + (cnt * cnt));
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1780
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long
#define ld long double
#define zeros(x) x^(x-1)&x
#define pii pair<ll,ll>
#define cd complex<double>
#define dbg(x) cerr<<#x<<": "<<x<<endl;ll
#define Nmax 400005
#define OFF 100001
using namespace std;

ll x, y;

int main()
{
    cin >> x >> y;
    if (x==y){
        cout << 0 << '\n';
        return 0;
    }
    ll ans = max(abs(x),abs(y)) - min(abs(x),abs(y));
    if (y * x < 0) ans++;
    else if (x!=0 && y!=0 && y < x) ans += 2;
    else if (y==0 && x > 0) ans++;
    else if (x==0 && y < 0) ans++;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define MOD 1000000007
#define ar array
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);

struct segtree {
	int size;
	vector<int> maxs;

	void init(int n) {
		size = 1;
		while (size < n) size *= 2;
		maxs.assign(2*size, 0);
		return;
	}

	void set(int pos, int val, int x, int lx, int rx) {
		if (rx - lx == 1) {
			maxs[x] = val;
			//cout << "Val found : " << val << endl;
			return;
		}
		int mid = (lx + rx) / 2;
		if (pos < mid) set(pos, val, 2*x + 1, lx, mid);
		else set(pos, val, 2*x + 2, mid, rx);
		maxs[x] = max(maxs[2*x + 1], maxs[2*x + 2]);
		return;
	}

	void set(int pos, int val) {
		return set(pos, val, 0, 0, size);
	}

	int calc_max(int l, int r, int x, int lx, int rx) {
		if (l <= lx && rx <= r) {
			//cout << "CALC_MAX entered : " << maxs[x] << endl;
			return maxs[x];
		}
		if (rx <= l || r <= lx) return 0;
		int mid = (lx + rx) / 2;
		int left_max = calc_max(l, r, 2*x + 1, lx, mid);
		int right_max = calc_max(l, r, 2*x + 2, mid, rx);
		return max(left_max, right_max);
	}

	int calc_max(int l, int r) {
		return calc_max(l, r, 0, 0, size);
	}
};

int32_t main() {
	fast_io;

	// int t; cin >> t;
	// while (t--) {
		
	// }
	int n;
	cin >> n;
	segtree st;
	vector<int> height(n), beauty(n); int max_height = 0;
	for (int i = 0; i < n; i++) {
		cin >> height[i];
		if (height[i] > max_height) max_height = height[i];
	} 
	for (int i = 0; i < n; i++) {
		cin >> beauty[i];
	}
	vector<int> dp(max_height + 1);
	st.init(max_height + 1);
	// dp[i] = max_beauty of flowers where max height is i
	for (int flower = 0; flower < n; flower++) {
		// for (int i = 0; i < height[flower]; i++) {
		// 	dp[height[flower]] = max(dp[height[flower]], beauty[flower] + dp[i]);
		// }
		int best_val = st.calc_max(0, height[flower]); //cout << best_val << endl;
		dp[height[flower]] = beauty[flower] + best_val;
		//cout << dp[height[flower]] << endl;
		st.set(height[flower], dp[height[flower]]);
		// for (int i : st.maxs) {
		// 	cout << i <<  " ";
		// }
		// cout << endl;
	}
	// int answer = 0ll;
	// for (int i = 0; i < dp.size(); i++) {
	// 	answer = max(answer, dp[i]);
	// }
	// cout << answer << endl;
	cout << st.calc_max(0, max_height + 1) << endl;
	// for (int i : st.maxs) {
	// 	cout << i << " ";
	// }
	// cout << endl;

	return 0;
}

Measured memory_bytes: 11872
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    A, B, C = LI()

    ans = min(B // A, C)
    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9128
import bisect
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))

asum, bsum = [0], [0]
for i in range(n):
  if k < a[i] + asum[i]:
    break
  asum.append(a[i] + asum[i])
for i in range(m):
  if k < b[i] + bsum[i]:
    break
  bsum.append(b[i] + bsum[i])

ans = 0
for i in range(len(asum)):
  ans = max(ans, i + bisect.bisect(bsum, k-asum[i]) - 1)
print(ans)


Measured memory_bytes: 40564
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAX 1000000000
int dx[] = {1,0,-1,0};
int dy[] = {0,-1,0,1};
const ll INF = 10010010010001;
vector<vector<bool>> graph;
vector<bool> reached;
ll MOD = 998244353;

int main(){
    int N;
    cin >> N;
    ll max1=0,max2=0;
    vector<ll> A(N);
    for(int i=0;i<N;i++) cin >> A[i];
    sort(A.begin(),A.end(),greater<ll>());
    for(int i=0;i<N-1;i++){
        if(max1 == 0){
            if(A[i] == A[i+1]){
                max1 = A[i];
                i++;
            }
        }else if(max2 == 0){
            if(A[i] == A[i+1]){
                max2 = A[i];
            }
        }
        else{
            break;
        }
    }
    cout << max1*max2 << endl;
}


Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
//const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
//istringstream iss(sentence);
long long mod = 998244353;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
  
const int biggg = 2000000000;
const long long bigggest = 1000000000000000000LL;
const double eps = .0000000001;

int main(){
    prep();
    int k;
    string s;
    cin >> k >> s;
    if (s.size() > k){
        for (int i=0; i<k; i++){
            cout << s[i];
        }
        cout <<"...";
    }else{
        cout << s;
    }
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;

    int c = (a - b * 2);
    cout << (c < 0 ? 0 : c) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define ll long long
int main() {
   // cout<<"Hello World!";
   ll n;
   cin>>n;
   ll arr[n];
   for(ll i=0;i<n;i++)cin>>arr[i];
   ll count=0;
   for(ll i=0;i<n;i++){
       if(arr[i]!=0){
           count++;
       }
   }
   if(count!=n){
       cout<<0<<endl;
       return 0;
   }
   ll s=1;
   for(ll i=0;i<n;i++){
       if(s>1000000000000000000/arr[i]){
           cout<<-1<<endl;
           return 0;
       }
       s=s*arr[i];

   }
   cout<<s<<endl;









}


Measured memory_bytes: 4376
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
const long long MAXN=1e5+5;
using namespace std;
typedef long long ll;

const ll INF = 1e18;//极大值 

ll a[MAXN];
//queue<ll> be,en;

//priority_queue <ll> p;//优先队列，默认从大到小 
priority_queue <ll,vector<ll>,greater<ll> > be;//从小到大 
priority_queue <ll,vector<ll>,less<ll> > en; //从大到小
ll n;

int main() {
 	ll x;
	cin>>n;
	ll mx=0,mn=0,ans=-INF;
	ll pre[MAXN]={0};
	for(int i=1;i<=3*n;i++){
		cin>>x;
		if(i<=n){
			be.push(x);
			mx+=x; 
		}
		else if(i<=2*n){
			a[i-n]=x;
		}
		else if(i>=2*n+1){
			en.push(x);
			mn+=x;
		}
	}
	pre[n-n]=mx;//pre[0]=pre[n]
	for(int i=1;i<=n;i++){
		mx+=a[i];
		be.push(a[i]);
		if(be.size()>n){
			mx-=be.top();
			be.pop();
		}
		pre[i]=max(pre[i-1],mx);
	}
	ans=max(ans,pre[n]-mn);
	for(int i=n;i>=1;i--){
		en.push(a[i]);
		mn+=a[i];
		if(en.size()>n){
			mn-=en.top();
			en.pop();
		}
		ans=max(ans,pre[i-1]-mn);
	}
	cout<<ans<<endl;
 	return 0;
 }
 

Measured memory_bytes: 4084
N = raw_input().split()
N = int(N[0])
a_list = raw_input().split()
a_list = [int(x) for x in a_list]
b_list = raw_input().split()
b_list = [int(x) for x in b_list]
if sum(a_list) < sum(b_list):
    print -1
else:
    diff_list = []
    for a, b in zip(a_list, b_list):
        diff_list.append(a-b)
    minus_sum = sum([x for x in diff_list if x < 0])
    minus_len = len([x for x in diff_list if x < 0])
    plus_list_sorted = sorted([x for x in diff_list if x > 0], reverse=True)
    tmp_idx = 0
    for item in plus_list_sorted:
        if minus_sum >= 0:
            break
        minus_sum += item
        tmp_idx += 1
    print minus_len + tmp_idx

Measured memory_bytes: 20028
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mem(a) memset(a,0,sizeof(a))
typedef long long ll;
typedef pair<int,int> pii;
 
const int mn=1e3+5;
ll a,b,c;
ll x,y;
 
int main() {
	cin>>a>>b>>c;
	cin>>x>>y;
	ll ans=1e18;
	if (c+c<=a+b){
		int u=min(x,y);
		for(int i=u;i<=max(x,y);i++){
			ans=min(max(0ll,(x-i))*a+max(0ll,(y-i))*b+i*2*c,ans);
		}
	}
	else ans=x*a+y*b;
	cout<<ans;
	return 0;
}

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

    int main(){
      double t,x;
      cin >> t >> x;
      cout << t/x << endl;
      return 0;}


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

int main() {
  string s;
  cin >> s;
  bool app[26];
  for (int i = 0; i < 26; i++) {
    app[i] = false;
  }
  for (int i = 0; i < s.size(); i++) {
    app[s[i] - 'a'] = true;
  }
  char answer;
  for (int i = 0; i < 26; i++) {
    if (app[i] == false) {
      answer = 'a' + i;
      cout << answer << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

Measured memory_bytes: 512
<?php
fscanf(STDIN, '%d', $N);
$sum = [0, 0, 0, 0];
$ans = 0;
for ($i = 0; $i < $N; $i++) {
	fscanf(STDIN, '%s', $S);
	$type = 0;
    $len = strlen($S); 
    if ($S[0] === 'B') {
        $type += 2;
    }
    if ($S[$len - 1] === 'A') {
        $type += 1;
    }
	$ans += substr_count($S, 'AB');
	$sum[$type]++;
}
if ($sum[3] === 0) {
    $ans += min($sum[1], $sum[2]);
} else {
	if ($sum[1] + $sum[2] > 0) {
		$ans += $sum[3] + min($sum[1], $sum[2]);
	} else {
		$ans += $sum[3] - 1;
	}
}
printf('%d', $ans);


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

inline void draw(int i, int j){
    if((i + j) % 2 == 0){ cout << '#'; }else{ cout << '.'; }
}

int main()
{
    int H, W, i, j;
    while(1){
        cin >> H >> W;
        if(H + W < 1) break;
        for(i = 0; i < H; i++){
            for(j = 0; j < W; j++) draw(i, j);
            cout << endl;
        }
        cout << endl;
    };
    return 0;
}
     

Measured memory_bytes: 1152
#include "bits/stdc++.h"

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

int main() {
	ll a, b, c, d;

	cin >> a >> b >> c >> d;

	ll x = min(b, d);
	ll y = max(a, c);

	if (y > x) {
		cout << 0 << endl;
	}
	else {
		cout << x - y << endl;
	}
}

Measured memory_bytes: 256
// =====================================================================================
//
//       Filename:  at.cpp
//
//    Description:  
//
//        Version:  1.0
//        Created:  19/04/20 05:21:38 PM IST
//       Revision:  none
//       Compiler:  g++
//
//         Author:  Kiran Bhanushali (), kiranbhanushali143.kb143@gmail.com
//   Organization:  
//
// =====================================================================================

#include<bits/stdc++.h>


using namespace std;

#define int long long 
#define pb push_back
//#define _SHOW_TIME

void solve(){
    int k , a, b;
    cin>>k>>a>>b;
    int ok = b/k - (a-1)/k;
    if(ok){
        cout<<"OK"<<endl;
    }else{
        cout<<"NG"<<endl;
    }
}
int32_t main(){
 /////////////////////////////////////
    #ifdef _SHOW_TIME
	int tt = (int) clock();
    #endif
    /////////////////////////////////////
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /////////////////////////////////////
    solve();
    /////////////////////////////////////
    #ifdef _SHOW_TIME
        cerr << "TIME = " << (double)(clock() - tt) / CLOCKS_PER_SEC << endl;
    #endif
    /////////////////////////////////////
    return 0;

}



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

int main() {
  int N;
  cin >> N;
  int64_t ans = 0;
  for (int i = 1; i <= N; i++) {
    if (i%3==0 || i%5==0) continue;
    ans += i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];

int main(){
  int s ;
  cin >> s;
  int a[1000001] ;
  a[1] = s ;
  bool b= false;
  for(int i=2;i<1000001;i++){
    if(a[i-1] %2 == 0)
      a[i] = a[i-1] /2 ;
    else
      a[i] = a[i-1]*3 +1 ;
    for(int j=1;j<i;j++){
      if(a[i] == a[j]){
        cout << i << endl;
        b = true ;
        break;
      }
    }
    if(b) break;
  }
}

Measured memory_bytes: 256
import math
import numpy
K = int(input())

total = tmp = 0
for a in range(1,K+1) :
  for b in range(1,K+1) :
   tmp=math.gcd(a,b)
   for c in range(1,K+1) :
      total += math.gcd(tmp,c)

print(total)


Measured memory_bytes: 27088
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#define ll long long
using namespace std;
const int N=2000005;
int n,a[N];
ll ans;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	if(a[1]){printf("-1\n");return 0;}
	for(int i=n;i>=1;--i){
		if(a[i]-a[i-1]>1){printf("-1\n");return 0;}
		if(a[i+1]-a[i]!=1)ans+=a[i];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: usize,
        p: [u64; n]
    }

    let mut pm = p;
    pm.sort();
    println!("{}", pm .iter().take(n-1).fold(0, |acc, &x| acc + x) + pm[n-1] / 2);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();
        string s = sc.next();
        if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
            Console.WriteLine("Bad");
        else Console.WriteLine("Good");
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<queue>
using namespace std;
static const int N=100;
static const int INFTY=2000000000;
int n,M[N+1][N+1];
int d[N+1];
void bfs(int s){
    queue<int> q;
    q.push(s);
    for(int i=1;i<=n;i++)d[i]=INFTY;
    d[s]=0;
    int u;
    while(!q.empty()){
        u=q.front();
        q.pop();
        for(int v=1;v<=n;v++){
            if(M[u][v]==0)continue;
            if(d[v]!=INFTY)continue;
            d[v]=d[u]+1;
            q.push(v);
        }
    }
    for(int i=1;i<=n;i++)
        cout<<i<<" "<<((d[i]==INFTY)?-1:d[i])<<"\n";

}

int main(){
    int u,k,v;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>u>>k;
        for(int j=1;j<=k;j++){
            cin>>v;
            M[u][v]=1;
        }
    }
    bfs(1);
    return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vc(n, 0);
  
  for(int i=0; i<m; i++){
    int a, b;
    cin >> a >> b;
    vc[a-1] += 1;
    vc[b-1] += 1;
  }
  for(int i=0; i<n; i++)
    cout << vc[i] << endl;
  
  
  return 0;
}

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


int N;
string s;

string solve(string b){

  for(int i = 0; i < N-2; i++){
    int j = (i+1)%N;
    if(s[j] == 'o'){
      if(b[j] == 'S') b += b[j-1];
      else b += b[j-1]=='W'?'S':'W';
    } else {
      if(b[j] == 'W') b += b[j-1];
      else b += b[j-1]=='W'?'S':'W';
    }
  }
  //cout<<b<<endl;
  if(s[0] == 'o'){
    if(b[0] == 'S' && b[N-1] != b[1]) return "X";
    if(b[0] == 'W' && b[N-1] == b[1]) return "X";
  } else {
    if(b[0] == 'S' && b[N-1] == b[1]) return "X";
    if(b[0] == 'W' && b[N-1] != b[1]) return "X";
  }
  
  if(s[N-1] == 'o'){
    if(b[N-1] == 'S' && b[N-2] != b[0]) return "X";
    if(b[N-1] == 'W' && b[N-2] == b[0]) return "X";
  } else {
    if(b[N-1] == 'S' && b[N-2] == b[0]) return "X";
    if(b[N-1] == 'W' && b[N-2] != b[0]) return "X";
  }

  return b;
  
}

int main(){

  string temp;
  cin>>N;
  cin>>s;
  
  if((temp = solve("SW")) != "X"){
    cout<<temp<<endl;
  } else if((temp = solve("WS")) != "X"){
    cout<<temp<<endl;
  }  else if((temp = solve("WW")) != "X"){
    cout<<temp<<endl;
  }else  if((temp = solve("SS")) != "X"){
    cout<<temp<<endl;
  }else {
    cout<<-1<<endl;
  }



    
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define testing 0
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << endl
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<endl
#define dbv(v) cerr << #v << ":"; for (auto i : v) cerr << i << ' '; cerr << endl
#define dbvp(v) cerr << #v << ":"; for (auto i : v) cerr << "{"  << i.f << ',' << i.s << "} "; cerr << endl
#define dba(a,ss,ee) cerr << #a << ":"; FOR(i,ss,ee) cerr << a[i] << ' '; cerr << endl
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define inf (int)1e9
#define oo (ll)1e18
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "hi\n";
typedef pair <int, int> pi;
typedef pair <ll,ll> pl;
typedef pair <pi, int> pii;
string lts(ll x) {stringstream s; s << x; return s.str(); }
ll stl(string x) {stringstream s(x); ll temp; s >> temp; return temp; }
string cts(char x) {string s(1,x); return s;}
const int MOD = 1e9 + 7;
template <typename T> void maxself(T& a, T b) {
    a = max(a, b);
}
template <typename T> void minself(T& a, T b) {
    a = min(a, b);
}
#define MAXN 
#if !testing
    #define cerr if(0)cout
#endif
int A[200005];
int dp[200005];
int main() {
    IAMSPEED
    // set testing to 0 when submitting to judge
    #if testing
        freopen("input.txt", "r", stdin);
    #endif
    ll n; cin >> n;
    // number of 0s = min(number of multiples of 5s, multiple of 2) = no. 5s.
    // every 5
    // every 25
    ll ans = 0;
    if (n%2==0) {
        ll divide = 10;
        // 10 20 30 40 50 60 70 80 90 100
        while (divide <= n) {
            ans += n/divide;
            divide *= 5;
        }
    } else {
        return cout << 0, 0; //no zeros cause no 2*
    }
    cout << ans;
}


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

int rev(int x){
    string s=to_string(x);
    reverse(s.begin(),s.end());
    return atoi(s.c_str());
}
 
int main() {
    int a;
    cin >> a;
    if(a<1200){
        cout << "ABC" << endl;
    }else if(a>=2800){
        cout << "AGC" << endl;
    }else{
        cout << "ARC" <<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double d;
const long long INF = 10000000000000;
int main() {
 string S,T;
 cin >> S >> T;
  
 bool flag1 = true;
 bool flag2 = true;
 map<char,char> ma;
 map<char,char> ima;
 
 for(int i = 0;i<S.size();i++){
   char s = S[i];
   char t = T[i];
   if(ma.count(s)){
     if(ma[s] != t){
       flag1 = false;
       break;
     }
   }
   if(ima.count(t)){
     if(ima[t] != s){
       flag2 = false;
       break;
     }
   }
   ma[s] = t;
   ima[t] = s;
 }
  if(flag1&&flag2) cout << "Yes" << endl;
  else cout << "No" << endl;
   
               
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
const double pi = acos(-1);

struct Point{
    double x, y;
    
    Point(double x = 0, double y = 0): x(x), y(y) {}

    Point operator + (Point p) { return Point(x + p.x, y + p.y); }
    Point operator - (Point p) { return Point(x - p.x, y - p.y); }
    Point operator * (double a) { return Point(a * x, a * y); }
    Point operator / (double a) { return Point(x / a, y / a); }

    double norm() {return x * x + y * y; }
    double abs() {return sqrt(norm()); }

    bool operator < (const Point &p) const{
        return (x != p.x ? x < p.x : y < p.y);
    }

    bool operator == (const Point &p) const{
        return (fabs(x - p.x) < EPS && fabs(y - p.y) < EPS);
    }
};

typedef Point Vector;

double norm(Vector a){
    return a.x * a.x + a.y * a.y;
}

double abs(Vector a){
    return sqrt(norm(a));
}

double arg(Vector p){
    return atan2(p.y, p.x);
}

Vector polar(double a, double r){
    return Point(cos(r) * a, sin(r) * a);
}

int main(){
    while(1){
        int n; cin>>n;
        if(n == 0) return 0;
        vector<Point> p;
        for(int i=0; i<n; i++){
            double x, y; cin>>x>>y;
            p.emplace_back(x, y);
        }

        int ans = 1;
        for(int i=0; i<n; i++){
            for(int j=i+1; j<n; j++){
                Point p1 = p[i];
                Point p2 = p[j];

                double dist = abs(p1 - p2);

                if(2.0 < dist) continue;

                Point mp = {(p1.x + p2.x) / 2, (p1.y + p2.y) / 2};

                double rad = arg(p2 - p1);
                
                double rad1 = rad + pi / 2;
                double rad2 = rad - pi / 2;

                double sideLength = sqrt(1.0 * 1.0 - abs(mp - p1) * abs(mp - p1));
                
                Point c1 = mp + polar(sideLength, rad1);
                int sum = 0;
                for(int k=0; k<n; k++){
                    dist = abs(c1 - p[k]);
                    if(1.0 + EPS < dist) continue;
                    sum++;
                }

                ans = max(ans, sum);

                Point c2 = mp + polar(sideLength, rad2);
                sum = 0;
                for(int k=0; k<n; k++){
                    dist = abs(c2 - p[k]);
                    if(1.0 + EPS < dist) continue;
                    sum++;
                }

                ans = max(ans, sum);
            }
        }

        cout << ans << endl;
    }
}


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

int main() {
  int N;
  cin >> N;
  vector<int> card(N);
  
  for (int i = 0; i < N; i++) {
    cin >> card.at(i);
  }
  
  sort(card.begin(), card.end());
  reverse(card.begin(), card.end());
  
  int Alice = 0;
  int Bob = 0;
  
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) {
      Alice += card.at(i);
    }
    else {
      Bob += card.at(i);
    }
  }
  
  cout << Alice - Bob << endl;
  
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.stream.LongStream;
import java.util.function.Predicate;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DWidespread solver = new DWidespread();
        solver.solve(1, in, out);
        out.close();
    }

    static class DWidespread {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextInt(), a = in.nextInt(), b = in.nextInt();
            long[] h = LongStream.range(0, n).map(x -> in.nextInt()).toArray();
            Predicate<Long> p = k -> Arrays.stream(h)
                    .map(i -> i - b * k)
                    .filter(i -> i > 0)
                    .map(i -> (i + a - b - 1) / (a - b)).sum() <= k;
            long min = 0, max = 1000_000_000;
            while (max - min > 1) {
                long mid = (min + max) / 2;
                if (p.test(mid)) {
                    max = mid;
                } else {
                    min = mid;
                }
            }
            out.println(max);
        }

    }
}



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

const ll INF = 1000000000;
ll N,a,ans,dp[20][100001];
vector<ll> V;

int main(void){
    cin >> N;
    V.push_back(1);
    a = 6;
    while(a<=N){
        V.push_back(a);
        a*=6;
    }
    a = 9;
    while(a<=N){
        V.push_back(a);
        a*=9;
    }
    
    for(ll i=0;i<=V.size();i++)for(ll j=0;j<=N;j++)dp[i][j]=INF;
    dp[0][0] = 0;
    
    rep(i,V.size()){
        rep(j,N+1){
            if(j-V[i]>=0) dp[i+1][j] = min(dp[i+1][j-V[i]]+1,dp[i][j]);
            else dp[i+1][j] = dp[i][j];
        }
    }
    
    //rep(i,V.size())cout << V[i] << endl;
    ans = INF;
    rep(i,V.size())ans = min(ans,dp[i+1][N]);
    cout << ans << endl;
}


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

int main(void) {

	// TODO: submit前にprintf-debugの削除確認！
	//int N, M;
	string S;

	cin >> S;
	
	if(S[0] != 'A') {
		cout << "WA";
		return 0;
	}
	S[0] = 'a';
	int cntC = 0;
	for(int i=2; i<S.size()-1; i++) {
		if(S[i] == 'C') {
			cntC++;
			S[i] = 'c';
		}
	}
	
	if(cntC != 1) {
		cout << "WA";
		return 0;
	}
	
	string lowerStr = S.substr(0, S.size());
	transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), ::tolower);
	if(S == lowerStr) cout << "AC";
	else cout << "WA";
	
	return 0;
}



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

#if 1
#define gun() getchar_unlocked()
#else
#define gun() getchar()
#endif

int bb(){
  int m = 0,c = gun();
  do m = 10 * m + (c & 0xf), c = gun();
  while(c>='0');
  return m;
}

#define DF 0x10101010
#define N 100


int a[N],*b[N];
int c[N][2];
int s,e;
int w[N];

void bump(int n){

  int i,u,v;


  c[0][0]=n;
  c[0][1]=0;
  w[n]=0;
  s=0;
  e=1;


  while(s!=e){
    n=c[s][0];
    u=c[s++][1];
    if(w[n]<u)
      continue;
    for(i=0;i<a[n];i++){
      v=b[n][i];
      if(w[v]>u+1){
	w[v]=u+1;
	c[e][0]=v;
	c[e++][1]=u+1;
      }
    }
  }
}

int main(){
  int i,j,n,l,v;

  n = bb();
  memset(w,DF,n<<2);
  for(i=0;i<=n-1;i++){
    v=bb()-1;
    a[v]=l=bb();
    b[v]=malloc(l<<2);
    for(j=0;j<=l-1;j++)
      b[v][j]=bb()-1;
  }

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



Measured memory_bytes: 2088
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n;

int main() {
    cin >> n;

    Vi a(n);
    REP(i, n) cin >> a[i];
    auto mini = min_element(ALL(a));
    auto maxi = max_element(ALL(a));

    if (*mini == *maxi) {
        cout << 0 << '\n';
        return 0;
    }
    cout << n*2-1 << '\n';
    if (abs(*mini) < abs(*maxi)) {
        int idx = maxi - a.begin();
        REP(i, n) printf("%d %d\n", idx+1, i+1);
        REP(i, n-1) printf("%d %d\n", i+1, i+2);
    } else {
        int idx = mini - a.begin();
        REP(i, n) printf("%d %d\n", idx+1, i+1);
        RREP(i, n-2, 0) printf("%d %d\n", i+2, i+1);
    }

    return 0;
}


Measured memory_bytes: 256
int main(void)
{
	int n, t, max = 0, min = 1000000001;
	scanf("%d%*c", &n);
	for(int i=0;i<n;i++) {
		scanf("%d%*c", &t);
		if(t > max) max = t;
		if(t < min) min = t;
	}
	printf("%d", abs(max-min));

	return 0;
}

Measured memory_bytes: 128
import std.stdio;
import std.array;
import std.string;
import std.conv;

string s;

void main(){
	int n;
	readf("%d\n", &n);
	for (int i = 0; i < n; i++) {
		s = chomp(readln());
		writeln(expression());
	}
}

int expression(){
	int result = term();
	while (1) {
		if (s[0] == '+') {
			s.popFront();
			result += term();
		}else if (s[0] == '-') {
			s.popFront();
			result -= term();
		}else {
			break;
		}
	}
	return result;
}

int term(){
	int result = factor();
	while (1) {
		if (s[0] == '*') {
			s.popFront();
			result *= factor();
		}else if (s[0] == '/') {
			s.popFront();
			result /= factor();
		}else {
			break;
		}
	}
	return result;
}

int factor(){
	int result;
	if (s[0] == '(') {
		s.popFront();
		result = expression();
		s.popFront();
	}else if (s[0] == '-') {
		s.popFront();
		result = -factor();
	}else {
		int i;
		for (i = 0; s[i] >= '0' && s[i] <= '9'; i++) {
		}
		result = to!int(s[0..i]);
		s = s[i..$];
	}
	return result;
}

Measured memory_bytes: 1000
#include<bits/stdc++.h>
#include<stack>
#include<vector>
#include<string>
#define int long long
using namespace std;
main()
{
	//freopen("input.txt","rt",stdin);
	double w,h,x,y;
	cin>>w>>h>>x>>y;
	double mx = w*h;
	mx /= 2;
	//cout<<f<<" "<<p<<" "<<q<<" "<<r<<endl;
	if(w/2 == x && h/2 == y)
	{
		cout<<fixed<<setprecision(7)<<mx<<" "<<"1"<<endl;
	}
	else
	{
		cout<<fixed<<setprecision(7)<<mx<<" "<<"0"<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long   ll;
typedef unsigned long long   ull;
typedef long double ld;
typedef pair<ll, ll>    pll;
typedef pair<ull, ull>    pull;
typedef pair<int, int>  pii;
typedef pair<ld, ld>  pld;
ll h, w;
ll a[100][100];
ll b[100][100];
ll dif[100][100];
ll dp[100][100][10000];
ll f(ll i, ll j, ll k){
    if(i == 0 || j == 0)
        return 1e18;
    if(k >= 10000)
        return 1e18;
    if(dp[i][j][k] != 1e18)
        return dp[i][j][k];
    if(i == 1 && j == 1){
        return dp[i][j][k] = abs(k-dif[i][j]);
    }
    dp[i][j][k] = min(f(i-1, j, abs(k-dif[i][j])), dp[i][j][k]);
    dp[i][j][k] = min(f(i, j-1, abs(k-dif[i][j])), dp[i][j][k]);
    dp[i][j][k] = min(f(i-1, j, abs(k+dif[i][j])), dp[i][j][k]);
    dp[i][j][k] = min(f(i, j-1, abs(k+dif[i][j])), dp[i][j][k]);
    return dp[i][j][k];
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    
    cin >> h >> w;
    for(ll i = 1; i <= h; ++i)
        for(ll j = 1; j <= w; ++j)
            cin >> a[i][j];
    for(ll i = 1; i <= h; ++i)
        for(ll j = 1; j <= w; ++j)
            cin >> b[i][j];
    for(ll i = 0; i <= h; ++i)
        for(ll j = 0; j <= w; ++j){
            dif[i][j] = abs(a[i][j]-b[i][j]);
        }
    for(ll i = 0; i <= h; ++i)
        for(ll j = 0; j <= w; ++j)
            for(ll k = 0; k < 10000; ++k)
                dp[i][j][k] = 1e18;
    
    cout << f(h, w, 0) << "\n";
}

Measured memory_bytes: 633472
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

int main() {
    int N;
    cin >> N;
    vector<int> a(N+1);
    rep(i,1,N+1) cin >> a[i];
    int ans = 0;
    rep(i,1,N+1) {
        if (i % 2 == 1 && a[i] % 2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n){
        cin >> h[i];
    }
    vector<int> dp(n+4,1'000'000'007);
    dp[1] = abs(h[1] - h[0]);
    dp[2] = abs(h[2] - h[0]);
    rep(i, n)
    {
        if (dp[i] == 1'000'000'007)
            continue;
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
    }
    cout << dp[n-1] << endl;
}


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

int main()
{
    int n,m;
    cin >> n >> m;
    if(m>=n){
        cout << "Yes" << endl;
    }else
    {
        cout << "No" << endl;
    }
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define MOD(x) ((x % MOD_N) + MOD_N) % MOD_N
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SIZE(c) (int)((c).size())
#define EACH(i,v) for(auto i=v.begin();i!=v.end();++i)
#define REACH(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
#define LB(c,x) distance((c).begin(),lower_bound(ALL(c),x))
#define UB(c,x) distance((c).begin(),upper_bound(ALL(c),x))
#define COUNT(c,x) (upper_bound(ALL(c),x)-lower_bound(ALL(c),x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;
#define NL cerr<<endl;
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T sum(vector<T>&v){return accumulate(ALL(v),T());}
template<typename T>T sum(vector<T>&v,int a,int b){return accumulate(v.begin()+a,v.begin()+b,T());}
template<typename T>T max(vector<T>&v){return *max_element(ALL(v));}
template<typename T>T min(vector<T>&v){return *min_element(ALL(v));}
template<typename T>T max_index(vector<T>&v){return distance((v).begin(),max_element(ALL(v)));}
template<typename T>T min_index(vector<T>&v){return distance((v).begin(),min_element(ALL(v)));}

struct edge { int to, cost; };

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}

const int INF = 1e18;
const int MOD_N = 1e9+7;

signed main()
{
   int n; cin >> n;
   V<V<char>> S(n, V<char>(n));
   REP(i, n) {
      REP(j, n) {
         cin >> S[i][j];
      }
   }

   int ans = 0;
   REP(B, n) {
      bool flag = true;
      REP(i, n) REP(j, n) {
         if (S[i][(j+B) % n] != S[j][(i+B) % n]) {
            flag = false;
         }
      }
      if (flag) ans += n;
   }
   cout << ans << endl;

   return 0;
}


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

int main(){
  vector<int> vec;
  int x = 1;
  while(x != 0){
    int i = 0;
    cin >> x;
    vec.push_back(x);
    i += i;
  }

for(int i;i < vec.size()-1;i++){
  cout << "Case " << i + 1 <<  ": " <<vec[i] << endl;
}
  return 0;
}


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


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




int main() {
    float pi = 3.1415926;
    float r;
    cin >> r;
    cout << 2 * r * pi << endl;
}


Measured memory_bytes: 3788
N,K = map(int,input().split())
senbei = [0]*K
i = 0
while(1):
    if N == 0:
        break
    for i in range(K):
        if N == 0:
            break
        senbei[i] += 1
        N -= 1
    if N <= 0:
        break
print(abs(max(senbei) - min(senbei)))

    

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
//size_t f = string::npos
//make pair, tuple

int main(){
      int w,h,n;cin >> w >> h >> n;
      int minX = 0;
      int minY = 0;
      int maxX = w;
      int maxY = h;
      for(int i = 0;i < n;i++){
            int x,y,a;cin >> x >> y >> a;
            if(a == 1)minX = max(minX, x);
            else if(a == 2)maxX = min(maxX, x);
            else if(a == 3)minY = max(minY,y);
            else maxY = min(maxY, y);
      }
      cout << (max(0, maxX - minX)) * max(0, (maxY - minY));
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int LCS(char x[], char y[]) {

int m = strlen(x);
int n = strlen(y);
int c[m+1][n+1];
int i, j;
for(i=0;i<=m;i++) 
  c[i][0] = 0;
for(i=0;i<=n;i++)
  c[0][i] = 0;
for(i=1;i<=m;i++){
  for(j=1;j<=n;j++){
    if( x[i-1] == y[j-1] )
      c[i][j] = c[i-1][j-1] +1;
    else if( c[i-1][j] >= c[i][j-1])
      c[i][j] = c[i-1][j];
    else 
      c[i][j] = c[i][j-1];
  }
}
return c[m][n];
}

int main(){

 int n, i,  x[1000], y[1000];
 
 scanf("%d", &n);
 for(i=0;i<n;i++){
   scanf("%s %s", x, y);
   printf("%d\n", LCS(x, y));
 }
return 0;

}

Measured memory_bytes: 4528
#include <bits/stdc++.h>
using namespace std;
#define ll long long int

int main() {
	// your code goes here
	ll l, r, d;
	cin>>l>>r>>d;
	ll cnt=(r/d)-((l-1)/d);
	cout<<cnt<<endl;
	// while(t--){
	// 	ll n;
	// 	cin>>n;
	// 	if(n%2==0) cout<<(n/2)<<endl;
	// 	else cout<<((n+1)/2)<<endl;
	// }	
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <cstdlib>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);

void header() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int dp[15][15];

void solve() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        dp[to_string(i)[0] - '0'][i % 10]++;
    }

    ll res = 0;
    for (int i = 0; i < 10; i++)
        for (int j = 0; j < 10; j++)
            res += dp[i][j] * dp[j][i];

    cout << res << endl;
}

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


Measured memory_bytes: 256
import java.io.*;

class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // int x = Integer.parseInt(br.readline());
        try {
            int x = Integer.parseInt(br.readLine());
            System.out.println(x*x*x);
        } catch (IOException e) {
            e.printStackTrace();
        }
        
        
    }
}


Measured memory_bytes: 24296
function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var X = input[0];
  var Y = input[1];
  var Z = input[2];
  var output = Math.floor(X / (Y + Z));
  if(X % (Y + Z) < Z){
     output--;
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 7372