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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int asz, bsz, m; std::cin >> asz >> bsz >> m;
  vi a(asz), b(bsz);
  int amin = inf, bmin = inf;
  rep(i, asz) std::cin >> a[i], chmin(amin, a[i]);
  rep(i, bsz) std::cin >> b[i], chmin(bmin, b[i]);
  int dis = inf;
  rep(i, m) {
    int x, y, c; std::cin >> x >> y >> c, --x, --y;
    chmin(dis, a[x] + b[y] - c);
  }
  int ans = min(dis, amin+bmin);
  std::cout << ans << "\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1<<29
#define LLINF 1LL<<60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}

ll N;
 
int main() {
    cin >> N;
    vector<ll> A(3*N);
    REP(i, 3*N) cin >> A[i];
    priority_queue<ll> Pl, Pr;
    ll sl = 0, sr = 0;
    FOR(i, 0, N-1) {
        sl += A[i];
        Pl.push(-A[i]);
        sr += A[2*N+i];
        Pr.push(A[2*N+i]);
    }
    vector<ll> left(N+1), right(N+1);
    left[0] = sl;
    right[N] = sr;
    FOR(i, 0, N-1) {
        Pl.push(-A[N+i]);
        sl = sl + A[N+i] + Pl.top();
        left[i+1] = sl;
        Pl.pop();
    }
    DOWN(i, N-1, 0) {
        Pr.push(A[N+i]);
        sr = sr + A[N+i] - Pr.top();
        right[i] = sr;
        Pr.pop();
    }
    ll ans = -LLINF;
    FOR(i, 0, N) ans = max(ans, left[i] - right[i]);
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5996
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
int main()
{
	SPEED
	int a, b;
	cin >> a >> b;
	if (2*b >= a)
	{
		cout << 0;
	}
	else
	{
		cout << a - (2*b);
	}
	return 0;
}

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<ll, ll>  pii;
typedef pair<ld, ld>  pld;
typedef long double ld;
ll n, k;
ll a[309];
ll dp[309][309][309];
ll f(ll idx, ll h, ll ch){
    
    if(ch < 0)
        return 1e18;
    if(idx > n)
        return 0;
    if(dp[idx][h][ch] != -1)
        return dp[idx][h][ch];
    ll &r = dp[idx][h][ch];
    r = 1e18;
    r = min(r, f(idx+1, idx, ch) + max((ll)0,(a[idx]-a[h])));
    r = min(r, f(idx+1, h, ch-1));
    //cout << idx << " " << h << " " << ch << " " << r << "\n";
    return r;
}

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

    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    
    cin >> n >> k;
    for(ll i = 1; i <= n; ++i)
        cin >> a[i];
    for(int i1 = 0; i1 <= 300; ++i1)
        for(int i2 = 0; i2 <= 300; ++i2)
            for(int i3 = 0; i3 <= 300; ++i3)
                dp[i1][i2][i3] = -1;
    
    cout << f(1, 0, k);
}

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

using namespace std;

int N;
int A[210];

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

    int count = 0;
    while (true) {
        for (int i = 0; i < N; i++) {
            if (A[i] % 2) goto BREAK;
            A[i] /= 2;
        }
        count++;
    }
BREAK:
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
N,*ABC = gets.split.map(&:to_i)
L = $<.map(&:to_i)

Mp = lambda{|abc|
	return Float::INFINITY if abc.any?{|x| x[1]<0 }
	return (0..2).inject(0){|a,i|
		a + (abc[i][0]-ABC[i]).abs + abc[i][1]*10
	}
}
min = Float::INFINITY
Join = lambda{|abc,i|
	abc.each_with_index{|x,j|
		x[0] += L[i]
		x[1] += 1
		mp = Mp[abc] if x[0]-ABC[j] < L[i]
		min = mp if mp && mp < min
		Join[abc,i+1] if i+1 < N
		x[0] -= L[i]
		x[1] -= 1
	}
	Join[abc,i+1] if i+1 < N
}

Join.call([[0,-1],[0,-1],[0,-1]], 0)
p min


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

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> vec(N);

    for(int i=0; i<Q; i++){
        int c;
        cin >> c;
        vec.at(c-1)++;
    }

    for(int i=0; i<N; i++){
        if(vec.at(i)>=Q-K+1){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>

using namespace std;

int mod = 1000000007;

long long mpow(int a, int b);

int main()
{
	int x, y;
	cin >> x >> y;
	
	if ((x + y) % 3 != 0) {
		cout << 0 << endl;

		return 0;
	}

	int m = (2 * y - x) / 3, n = (2 * x - y) / 3;
	if (m < 0 || n < 0) {
		cout << 0 << endl;

		return 0;
	}

	if (m > n) {
		int tmp = m;
		m = n;
		n = tmp;
	}

	long long t = 1;
	long long s = 1;
	for (int i = 0; i < m; i++) {
		t *= m + n - i;
		t %= mod;
		s *= i + 1;
		s %= mod;
	}

	cout << (t * mpow(s, mod - 2)) % mod << endl;

	return 0;
}

long long mpow(int a, int b)
{
	long long t = a;
	long long ans = 1;
	for (int i = 0; b != 0; i++) {
		if ((b & 1) == 1) {
			ans *= t;
			ans %= mod;
		}
		t *= t;
		t %= mod;
		b >>= 1;
	}

	return ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

int main(){
  string S; cin>>S;
  int N=S.length();
  rep(i,8){
    string T="";
    for(int j=0;j<i;j++) T+=S[j];
    for(int j=N-1-(7-i)+1;j<N;j++) T+=S[j];
    if(T=="keyence"){
      cout<<"YES\n";
      return 0;
    }
  }
  cout<<"NO\n";
  return 0;
}


Measured memory_bytes: 256
#n = int(input())
n,m = map(int,input().split())
#a_L = list(map(int,input().split()))

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

if n != 1 and n !=0:
    a = cmb(n,2)
else:
    a = 0

if m != 1 and m !=0:
    b = cmb(m,2)
else:
    b = 0
print(a + b)

Measured memory_bytes: 38256
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long
#define msize 30

vector<pair<int,int> > dd[600000];
int d[600000];
int ans[600000];

int main()
{
  int i,j,n,ddd,q,ll,rr,now,minbad,x;
  pair<int,int> tmp;
  vector<pair<int,int> > vp;
  scanf("%d%d",&n,&ddd);
  for (i=0;i<n;i++)
    scanf("%d",&d[i]);
  dd[n].clear();
  dd[n].push_back(make_pair(0,0));
  for (i=n-1;i>=0;i--)
  {
    //cout<<i<<endl;
    vp.clear();
    for (j=0;j<dd[i+1].size();j++)
    {
      tmp=dd[i+1][j];
      vp.push_back(make_pair(tmp.first+d[i],tmp.second+d[i]));
      if (tmp.second>d[i]/2) tmp.second=d[i]/2;
      if (tmp.first<=tmp.second)
      {
        vp.push_back(tmp);
        vp.push_back(make_pair(d[i]-tmp.second,d[i]-tmp.first));
      }
    }
    sort(vp.begin(),vp.end());
    dd[i].clear();
    ll=-11;rr=-12;
    for (j=0;j<vp.size();j++)
    {
      if (vp[j].first>rr+1)
      {
        if (rr>1000000000) rr=1000000000;
        if ((ll<=rr)&&(dd[i].size()<msize))
        {
          dd[i].push_back(make_pair(ll,rr));
        }
        ll=vp[j].first;rr=vp[j].second;
      }
      else
      {
        if (vp[j].second>rr) rr=vp[j].second;
      }
    }
    if (rr>1000000000) rr=1000000000;
    if (ll<=rr)
    {
      dd[i].push_back(make_pair(ll,rr));
    }
    //for (j=0;j<dd[i].size();j++)
    //  cout<<dd[i][j].first<<" "<<dd[i][j].second<<endl;
  }
  now=ddd;
  for (i=0;i<n;i++)
  {
    //cout<<i<<endl;
    minbad=dd[i+1][0].second+1;
    if (minbad<=now) ans[i]=1;
    else ans[i]=0;
    if (now>=d[i]) now=now-d[i];
    else
    {
      if (d[i]-now<now) now=d[i]-now;
    }
  }
  scanf("%d",&q);
  for (i=0;i<q;i++)
  {
    scanf("%d",&x);
    x--;
    printf("%s\n",ans[x]==1?"YES":"NO");
  }
  return 0;
}

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

int main() {
  ll n;
  cin >> n;
  vector<int> ans;
  while(n > 0){
      ans.push_back(n % 26);
      if(n%26 == 0) n -= 1;
      n /= 26;
  }
  reverse(ans.begin(),ans.end());
  for(int i:ans){
      if( i == 0){
          cout << 'z';
      }else{
          cout << (char)('`' + i);
      }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x;
  int cnt=0;
  cin>>a>>b>>c>>x;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
	if(500*i+100*j+50*k==x)cnt++;
      }
    }
  }
  cout<<cnt<<endl;
  return(0);
}


Measured memory_bytes: 256
n,m=map(int,input().split())
si=[list(map(int,input().split())) for i in range(m)]

#元の市の番号を末尾に追加。
#（答えの出力時に直さないといけないため）
for i in range(m):
  si[i].append(i)
si.sort()

#番号追加済みの市をメモる
sicount=[0]*n

#各配列のさらに末尾に、番号を追加。
for i in range(m):
  nanbanme=sicount[si[i][0]-1]+1
  sicount[si[i][0]-1]+=1
  ninsiki=str(si[i][0]).zfill(6)+str(nanbanme).zfill(6)
  si[i].append(ninsiki)

from operator import itemgetter

si=sorted(si,key=itemgetter(2))
for i in si:
  print(i[3])

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

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



int ASCttenannoryaku(const void *a,const void *b) {
	return *(int *)a - *(int *)b;
}
int main(void)
{
	int card[3][3];
	int n, num, check;
	for(int i = 0; i < 3; i++) {
		for (size_t j = 0; j < 3; j++)
		{
			scanf("%d",&card[i][j]);
		}
	}
	//printf("ｎは？");
	scanf("%d",&n);
	for (size_t i = 0; i < n; i++) {
		scanf("%d", &num);
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (card[j][k] == num)	card[j][k] = -1;
			}
		}
	}
	for (int i = 0; i < 3; i++) {
		check = i;
		if (card[check][0] == card[check][1] && card[check][2] == card[check][0]) {
			printf("Yes");
			return 0;
		}
		if (card[0][i] == card[1][i] && card[2][i] == card[0][i]) {
			printf("Yes");
			return 0;
		}
	}
	if (card[0][0] == card[1][1] && card[2][2] == card[0][0]) {
		printf("Yes");
		return 0;
	}
	else if (card[0][2] == card[1][1] && card[2][0] == card[0][2]) {
		printf("Yes");
		return 0;
	}

	printf("No");

	return 0;
}
/*
1 2 3
4 5 6
7 8 9*/

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

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

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template< typename T > using matrix = vector< vector< T > >;

//FUNCTION  


void solve(void)
{
  int N;
  cin>>N;
  vector<int> x(N),y(N),h(N);
  int ANS = 0;

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

      bool check = 1;
      vector<int> hv;
      for (int i = 0; i < N; i++)
      {
        if(h[i] == 0)continue;

        int Hs = abs(x[i] - c1) + abs(y[i] - c2) + h[i];
        hv.push_back(Hs);
      }
      for (int i = 0; i < hv.size()-1; i++)
      {
        if(hv[i] != hv[i+1]) check =0;

      }
      if(hv.size() == 0)continue;

      int H = hv[0];
      for (int i = 0; i < N; i++)
      {
        if(h[i] != 0)continue;
        if(H - abs(x[i] - c1) - abs(y[i] - c2) > 0) check = 0;
      }
      
      
      if(check == 1)
      {
        cout<<c1<<" "<<c2<<" "<<hv[0]<<endl;
        return;
      }
      
    }
    
  }
  abort();
  cout<<1<<endl;
  
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;

class UnionFind {
public:
	vector<int> par;
	UnionFind(int n) {
		par = vector<int>(n, -1);
	}
	int root(int a) {
		if (par[a] < 0) {
			return a;
		}
		else {
			return par[a] = root(par[a]);
		}
	}
	int size(int a) {
		return -par[root(a)];
	}
	bool connect(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b) {
			return false;
		}
		if (size(a) < size(b)) {
			swap(a, b);
		}
		par[a] += par[b];
		par[b] = a;
		return true;
	}
};


int main() {
	int n, m; cin >> n >> m;
	vector<int> ans(n);
	UnionFind uni(n);
	rep(i, 0, m) {
		int u, v, w; cin >> u >> v >> w;
		u--; v--;
		uni.connect(u, v);
	}
	rep(i, 0, n) ans[i] = uni.root(i);
	sort(ans.begin(), ans.end());
	int cnt = 1;
	rep(i, 0, n - 1) if (ans[i] != ans[i + 1]) cnt++;
	printf("%d", cnt);
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  set<int>data;
  for(int i=0;i<N;i++){
    int x;
    cin >> x;
    if(data.count(x)) data.erase(x);
    else data.insert(x);
  }
  cout << data.size() << endl;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun May 17 21:53:03 JST 2020
 **/

signed main() {
    Int n, m;
    std::cin >> n >> m;
    std::vector<std::vector<Int>> g(n);
    REP(i, m) {
        Int u, v;
        std::cin >> u >> v;
        u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    std::vector<Int> visited(n), from(n, -1);
    std::queue<Int> q;
    q.push(0);
    visited[0] = true;
    while (!q.empty()) {
        Int v = q.front();
        q.pop();
        for (Int u : g[v]) {
            if (visited[u]) continue;
            from[u] = v;
            visited[u] = true;
            q.push(u);
        }
    }
    if (std::find(visited.begin(), visited.end(), false) == visited.end()) {
        std::cout << "Yes" << std::endl;
        REP(i, 1, n) std::cout << from[i] + 1 << "\n";
    } else {
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 13720
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void makegraph(int x,vector<vec> &v){rep(i,x-1){int a=in(),b=in();v[a].pb(b);v[b].pb(a);}}
template<typename A, size_t NNN, typename T>
void Fill(A (&array)[NNN], const T &val){
    fill( (T*)array, (T*)(array+NNN), val );
}
#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=924844033;
#define N 355050

ll n,m,k;

main(){
    n=in();
    int a[100];
    rep(i,n)a[i]=in();
    int s=0;
    rep(i,n)s+=a[i];
    bool flag=true;
    rep(i,n){
        if(a[i]>=s-a[i])flag=false;
    }
    cout<<(flag?"Yes":"No");
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

struct s1 {
  static int64 op(int64 a, int64 b) { return max(a, b); }
  static int64 e() { return -INF_LL; }
  static int64 mapping(int64 l, int64 r) { return max(l, r); };
  static int64 composition(int64 l, int64 r) { return max(l, r); };
  static int64 id() { return -INF_LL; };
};

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

//  auto op1 = [](int64 a, int64 b) -> int64 {
//    return max(a, b);
//  };
//  auto e = []() { return -INF_LL; };
//  auto mapping = [](int64 l, int64 r) { return max(l, r); };
//  auto composition = [](int64 l, int64 r) { return max(l, r); };
//  auto id = []() { return -INF_LL; };
  int64 N;
  cin >> N;
  int64 res = 0;
  FOR(i, 1, N+1) {
    res += (N-1) / i;
  }
  cout << res << endl;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int ans = 0;
    for (int i = 0; i < 10; ++i) {
        int s;
        cin >> s;
        ans += s;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3180
from collections import deque
#グラフの連結成分を調べる
def Graph(ab):
    G=[[] for i in range(n)]
    for a,b in ab:
        G[a-1].append(b)
        G[b-1].append(a)
    return G

n, q = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n - 1)]
px = [list(map(int,input().split())) for i in range(q)]

G = Graph(ab)
ki = [0] * n

for i in range(q):
    root, score = px[i]
    ki[root - 1] += score

q = deque()
q.append((1, -1))

while q:
    v, p = q.popleft()
    for next in G[v - 1]:
        if next == p:continue
        ki[next - 1] += ki[v - 1]
        q.append((next, v))
print(*ki)

Measured memory_bytes: 121500
/*Program from Luvwgyx*/
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fir first
#define sec second
#define pi pair<int ,int >
#define mp(x,y) make_pair(x,y)
using namespace std;
const int dx[4]={0,0,1,-1};
const int dy[4]={1,-1,0,0};
const int maxn=1e3+10;
queue<pi >q;
char mp[maxn][maxn];
int dep[maxn][maxn];
bool vis[maxn][maxn];
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void print(int x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)print(x/10);
    putchar(x%10+'0');
}
void write(int x){print(x);puts("");}
int main(){
    int n=read(),m=read(),ans=0;
    for(int i=1;i<=n;i++)scanf("%s",mp[i]+1);
    for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)if(mp[i][j]=='#')q.push(mp(i,j)),vis[i][j]=1;
    while(!q.empty()){
        pi now=q.front();q.pop();
        int x=now.fir,y=now.sec;ans=max(ans,dep[x][y]);
        for(int i=0;i<4;i++){
            int xx=x+dx[i],yy=y+dy[i];
            if(xx<1||xx>n||yy<1||yy>m||vis[xx][yy])continue;
            vis[xx][yy]=1;dep[xx][yy]=dep[x][y]+1;q.push(mp(xx,yy));
        }
    }write(ans);
    return 0;
}


Measured memory_bytes: 11008
#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

const int MOD = 1000000007;

int main(){
	int N, M;
	static long long dp[3001][3001];
	while(cin >> N >> M){
		string S; cin >> S;
		vector<int> upperNum(N, 0);
		vector<int> right(N, 0);
		for(int i=0;i<N;i++) right[i] = i;
		for(int i=0;i<M;i++){
			int l, r; cin >> l >> r;
			--l; --r;
			right[l] = max(right[l], r);
		}
		for(int i=1;i<N;i++) right[i] = max(right[i], right[i-1]);
		upperNum[0] = (S[0] == '1');
		for(int i=1;i<N;i++){
			upperNum[i] = upperNum[i-1] + (S[i] == '1');
		}
		memset(dp, 0, sizeof(dp));
		dp[0][0] = 1;
		int lower = 0;
		for(int i=0;i<N;i++){
			if(lower + right[i] - i + 1 == upperNum[right[i]]) ++lower;
			int upper = upperNum[right[i]];
			for(int j=0;j<N;j++){
				for(int k=0;k<2;k++){
					if(lower <= j+k && j+k <= upper) dp[i+1][j+k] = (dp[i][j]+dp[i+1][j+k])%MOD;
				}
			}
		}
		cout << dp[N][upperNum[N-1]] << endl;
	}
}


Measured memory_bytes: 70656
import itertools
n, m = map(int, input().split())
# n: switch,    m: lamp
data = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))

# O(100*(2**10))なので、全探索も容易なはず
ans = 0
for i in itertools.product([0, 1], repeat=n):  # パターンごと
    flag = True
    for j, val in enumerate(p):
        # 全てのランプがONなら、ans += 1
        # i = [0,1,1,1,1, ]
        tar = data[j]
        num = tar[0]
        count = 0
        for k in range(num):
            pick = tar[k + 1]
            count += i[pick - 1]
        # print(count)
        if (count % 2 == val):
            pass
        else:
            flag = False

    if (flag is True):
        ans += 1
    else:
        pass


print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef pair<int,ii> iii;
typedef pair<int, iii> iiii;
typedef pair<double, ii> dii;
typedef long long ll;
typedef pair<ll, ii> lii;
const int INF = 1000000000;
const double EPS = 1e-9;
#define LSOne(S) (S & (-S))
int mods(int a, int b) { return (b + (a%b)) % b; }
 
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    
    int n, d[100005];

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

    sort(d, d+n);

    cout << d[n/2] - d[n/2-1] << '\n';
 
    return 0;
}

Measured memory_bytes: 640
namespace ABC062_PictureFrame
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    class Program
    {
        static void Main(string[] args)
        {
            // 入力
            var input = Console.ReadLine().Split(' ').Select(elem => int.Parse(elem)).ToArray();
            int H = input[0];
            int W = input[1];
            List<string> lineList = new List<string>();
            for (int i = 0; i < H; i++) lineList.Add(Console.ReadLine());

            // 処理
            string frame = string.Empty;
            for (int i = 0; i < W; i++) frame += "#";
            lineList.Insert(0, frame);
            lineList.Add(frame);
            for (int index = 0; index < lineList.Count; index++) lineList[index] = "#" + lineList[index] + "#";

            // 出力
            foreach (var line in lineList)
            {
                Console.WriteLine(line);
            }
        }
    }
}


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

using namespace std;

int main() {
    int x, y, z;
    int k;
    cin >> x >> y >> z;
    cin >> k;

    vector<long long> a(x), b(y), c(z);
    for (int i = 0; i < x; ++i) cin >> a[i];
    for (int i = 0; i < y; ++i) cin >> b[i];
    for (int i = 0; i < z; ++i) cin >> c[i];

    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    sort(b.begin(), b.end());
    reverse(b.begin(), b.end());
    sort(c.begin(), c.end());
    reverse(c.begin(), c.end());

    vector<long long> abc;
    for (int A = 0; A < x; ++A) {
        for (int B = 0; B < y; ++B) {
            if ((A + 1) * (B + 1) > k) break;
            for (int C = 0; C < z; ++C) {
                if ((A + 1) * (B + 1) * (C + 1) > k) break;
                abc.push_back(a[A] + b[B] + c[C]);
            }
        }
    }

    sort(abc.begin(), abc.end());
    reverse(abc.begin(), abc.end());

    for (int i = 0; i < k; ++i) {
        cout << abc[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 2036
// author:  Harsh Nema
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 10000000000000;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
	fastio;
	// #ifndef ONLINE_JUDGE 
	//     freopen("input.txt","r",stdin);
	//     freopen("output.txt","w",stdout);
	// #endif
	ll n=0,k=0;
	cin>>n>>k;
  	ll ar[n]={0};
  	ll dp[n]={0};
  	for(ll i=0;i<n;++i)
  		cin>>ar[i];
  	dp[0]=0;
  	dp[1]=abs(ar[1]-ar[0]);
  	for(ll i=2;i<n;++i)
  	{
  		ll m=INT_MAX;
  		for(ll j=i-1;j>=max(0ll,i-k);--j)
  		{
  			m=min(m,dp[j]+abs(ar[j]-ar[i]));
  		}
  		dp[i]=m;
  	}
  	// for(auto i:dp)
  	// 	cout<<i<<" ";
  	cout<<dp[n-1];
   return 0;
}

Measured memory_bytes: 1792
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
struct node
{
	int x,id;
}c[100010];
int n,m,a[100010],b[100010],fa[100010];
long long f[100010],s[100010];
bool used[100010];
int cnt,head[100010],to[200010],nxt[200010];
vector<int> v;
void add(int x,int y)
{
	cnt++;
	to[cnt]=y;
	nxt[cnt]=head[x];
	head[x]=cnt;
}
bool cmp(node x,node y)
{
	return x.x<y.x;
}
int find(int x)
{
	if (fa[x]!=x)
	{
		fa[x]=find(fa[x]);
	}
	return fa[x];
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
	{
		scanf("%d%d",&a[i],&b[i]);
		c[i].x=max(a[i]-b[i],0);
		c[i].id=i;
	}
	sort(c+1,c+n+1,cmp);
	for (int i=0;i<m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	for (int i=1;i<=n;i++)
	{
		fa[i]=i;
	}
	for (int i=1;i<=n;i++)
	{
		int x=c[i].id;
		v.clear();
		s[x]=b[x];
		used[x]=true;
		for (int j=head[x];j;j=nxt[j])
		{
			int y=to[j];
			y=find(y);
			if (!used[y] || y==find(x))
			{
				continue;
			}
			v.push_back(y);
			s[x]+=s[y];
			fa[y]=x;
		}
		f[x]=s[x]+c[i].x;
		for (int j=0;j<v.size();j++)
		{
			int y=v[j];
			f[x]=min(f[x],s[x]-s[y]+max(1LL*c[i].x,f[y]));
		}
	}
	printf("%lld\n",f[c[n].id]);
    return 0;
}
//羽毛似雪无瑕点，顾影秋池舞白云。
//——李绅《忆放鹤》

Measured memory_bytes: 6144
import math
input_para = list(map(int,input().split(' ')))
ans = 0
for i in range(input_para[0]):
    point = list(map(int,input().split(' ')))
    if(math.sqrt(point[0]**2 + point[1] ** 2)<=input_para[1]):
        ans += 1
print(ans)


Measured memory_bytes: 9184
A, B, K = gets.chomp.split(' ').map(&:to_i)
x = [A, B].min
array = Array.new
(1..x).each do |i|
  array << i if A % i == 0 && B % i == 0
end
new_array = array.sort { |a, b| b <=> a }
puts new_array[K - 1]


Measured memory_bytes: 1788
// AOJ 1027: A Piece of Cake
// 2017.8.17 bal4u@uu
// 2017.12.15

#include <stdio.h>

char buf[20000], *p;

int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int K, i, s;
	
	while (fgets(p=buf, 10, stdin) && *p != '0') {
		K = getint();
		fgets(p=buf, sizeof(buf), stdin);
		s = 0, i = K*(K-1) >> 1; while (i--) s += getint();
		printf("%d\n", s / (K - 1));
	}
	return 0;
}

Measured memory_bytes: 1736
l = sorted(map(int,input().split()))[::-1]
a = l[0]
b = l[1]
c = l[2]
s = 0
s += a-b
c += (a-b)
if (a-c)%2==0:
  s += (a-c)//2
else:
  s += (a-c-1)//2+2
print(s)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
	int a;
	cin >> a;
	cout << a * a * 3 << endl;
}


Measured memory_bytes: 3608
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
xs = []
for i in range(0, len(x)-1):
  xs.append(x[i+1] - x[i])
xs.sort()

ans = 0
for i in range(0, len(xs)):
  if m - i <= n:
    break
  ans += xs[i]
print(ans)

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

int main() {
	int n;
	cin>>n;
	int a=n%10;
	n=n/100;
	int b=n;
	if(a==b){
	    cout<<"Yes"<<endl;
	}
	else{
	    cout<<"No"<<endl;
	}
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;

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

	int h, w, n; cin >> h >> w >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++) cin>>a[i];
	vector<P> mapping(h*w+1);
	for(int i=0;i<h*w;i++){
		int x,y,tmp=i%(2*w);
		if(tmp<w){
			x=i/w;y=i%w;
		}
		else{
			x=i/w;y=w-1-i%w;
		}
		mapping[i]=P(x,y);
	}
	int idx=0;
	VVI res(h + 1, vector<int>(w + 1, 0));
	for(int i=0;i<n;i++){
		for(int j=0;j<a[i];j++){
			int x=mapping[idx].first,y=mapping[idx].second;
			res[x][y]=i+1;
			idx++;
		}
	}
	for (int i = 0; i < h; i++) {
		cout<<res[i][0];
		for (int j = 1; j < w; j++) {
			cout << " "<<res[i][j];
		}
		cout << endl;
	}

}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.regex.Pattern;

public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        int n = Integer.parseInt(stdin.readLine());
        stdout.println((n % 2 == 0) ? n / 2 - 1: n / 2);
    }

    private Pattern space = Pattern.compile(" ");

    private int[] toIntArray(String line) {
        return space.splitAsStream(line).mapToInt(Integer::parseInt).toArray();
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}

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

int main(void){
    // Your code here!
    int H,W,aK;
    char inmap[6][6] = {};
    int map[6][7] = {0};
    int bumap[6][7] = {0};
    int ans = 0;
    int sum = 0;
    
    scanf("%d%d%d",&H,&W,&aK);
    map[5][6] = aK;
    for(int i = 0; i < H; i++){
        scanf("%6s",inmap[i]);
        for (int j = 0; j< W; j++){
            if (inmap[i][j] == '#'){
                map[i][j] = 1;
            } else {
                map[i][j] = 0;
            }
        }
    }

    for (int hb = 0; hb < (int)pow(2,H); hb++) {
        for (int wb = 0; wb < (int)pow(2,W); wb++){
            memcpy(bumap, map, sizeof(map));

            for (int i = 0; i < H; i++){
                //printf("%d\n",(int)(hb >> i));
                if (hb >> i & 1 == 1){
                    for (int k = 0; k < W; k++){
                        map[i][k] = 0;
                    }
                }
            }

            for (int i = 0; i < W; i++){
                if (wb >> i & 1 == 1){
                    for (int k = 0; k < H; k++){
                        map[k][i] = 0;
                    }
                }
            }
            
            sum = 0;
            for (int i = 0; i < H; i++){
                for (int j = 0; j < W; j++){
                    sum += map[i][j];
                }
            }

            if (sum == map[5][6]){
                ans++;
            }
            memcpy(map, bumap, sizeof(bumap));
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 2500
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
using namespace std;
const int maxn = 3000+10;
long long a[maxn];
long long dp[maxn][maxn];
int main() {
    int n ;
    cin >> n ;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i =  0; i < n;i++){
        dp[i][i] = a[i];
    }
    
    for(int r = 0 ; r < n; r++){
        for(int l = r-1 ; l >= 0; l--){
            dp[r][l]  = max(a[r] - dp[r-1][l],a[l] - dp[r][l+1]);
        }
    }
    cout << dp[n-1][0];
    return 0;
}


Measured memory_bytes: 69120
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	ll n;
	cin>>n;
	ll a[n+1];
	for (ll i=1;i<=n;i++)
		cin>>a[i];
	ll dp[n+1];
	dp[0]=0;
	dp[1]=0;
	dp[2]=abs(a[2]-a[1]);
	for (ll i=3;i<=n;i++)
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	cout<<dp[n];
}

Measured memory_bytes: 1792
import copy, sys
S = input()
s = copy.deepcopy(S)
for i in range(int(len(S)/2)) :
    s = s[:-2]
    s1 = s[0:int(len(s)/2)]
    s2 = s[int(len(s)/2):int(len(s))]

    if s1 == s2:
        print(len(s))
        sys.exit()


Measured memory_bytes: 3572
import math

def Minimization(n , k , al):

    ans = math.ceil((n - 1) / (k - 1))

    return ans

def main():
    n , k = map(int , input().split())
    al = list(map(int , input().split()))
    print(Minimization(n , k , al))

if __name__ == '__main__':
    main()

Measured memory_bytes: 13812
while True:
    m=int(input())
    p=1000-m
    a=p//500
    x=p%500
    b=x//100
    y=x%100
    c=y//50
    z=y%50
    d=z//10
    o=z%10
    e=o//5
    f=o%5
    if m==0:
        break
    print(a+b+c+d+e+f)


Measured memory_bytes: 5584
#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, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;
/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
*/
int main()
{
    int N, K;
    cin >> N >> K;
    vector<ll> H(N);
    REP(i, N) {
        cin >> H.at(i);
    }
    sort(ALL(H));
    ll min_value = INF;
    for (int i = 0; i + K-1 < N; i++)
    {
        min_value = min(min_value, H.at(i + K - 1) - H.at(i));
    }
    cout << min_value << endl;
    return 0;
}

Measured memory_bytes: 1024
n, m = list(map(int, input().split()))
mod = 10**9+7

X = list(map(int, input().split()))
Dx = []
for i in range(n-1):
    Dx.append(X[i+1]-X[i])
#print(Dx)
S = [0]
for x in Dx:
    S.append((S[-1]+x) % mod)
#print(S)
T = [0]
for s in S:
    T.append((T[-1]+s) % mod)
#print(T)
Ux = 0
for i in range(1, n):
    Ux += (S[i]*i-T[i]) % mod
    #print(S[i]*i-T[i])

#print(Ux)

Y = list(map(int, input().split()))
Dy = []
for i in range(m-1):
    Dy.append(Y[i+1]-Y[i])
#print(Dy)
S = [0]
for y in Dy:
    S.append((S[-1]+y) % mod)
#print(S)
T = [0]
for s in S:
    T.append((T[-1]+s) % mod)
#print(T)
Uy = 0
for i in range(1, m):
    Uy += (S[i]*i-T[i]) % mod
    #print(S[i]*i-T[i])

#print(Uy)

print(Ux*Uy%mod)

Measured memory_bytes: 31484
#include <bits/stdc++.h>
using namespace std;
int n, cnt;
char s[500020];
int p[500020];
int f[500020];
int g[500020];
void gao(int *f) {
	int u = 0;
	for (int i = 2; i <= n; i++) {
		while (u > 0 && s[u + 1] != s[i]) {
			u = p[u];
		}
		if (s[u + 1] == s[i]) {
			u++;
		}
		p[i] = u;
	}
	for (int i = 1; i <= n; i++) {
		if (p[i] == 0 || i % (i - p[i]) > 0) {
			f[i] = 1;
		}
	}
}
int main() {
	scanf("%s", s + 1);
	n = strlen(s + 1);
	gao(f);
	if (f[n]) {
		printf("1\n1\n");
		return 0;
	}
	reverse(s + 1, s + 1 + n);
	gao(g);
	for (int i = 1; i <= n; i++) {
		if (f[i] && g[n - i]) {
			cnt++;
		}
	}
	if (cnt == 0) {
		printf("%d\n1\n", n);
	} else {
		printf("2\n%d\n", cnt);
	}
	return 0;
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
#define INF (1LL<<60)
#define MOD7 1000000007LL
#define PREP(i, s, x) for(ll i = (s); i < (x); i ++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i --)
#define REP(i, x) PREP(i, 0, x)
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;
template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return 1;}return 0;}
ll llpow(ll a, ll n){ll res=1;REP(_,n){res*=a;}return res;}

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    REP(i, n){
        ll k = i + 1;
        if(k % 3 != 0 && k % 5 != 0){
            ans += k;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ;; ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( $ t : ty ;; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ;; ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let n = get!(usize);
    if n == 1 {
        println!("Hello World");
    } else {
        let a = get!(usize);
        let b = get!(usize);
        println!("{}", a + b);
    }
}


Measured memory_bytes: 8572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

vector<vector<ll>> g;
ll n, m, a, b, q, v[100008], d[100008], c[100008], ans[100008], ansd[100008];

void dfs(ll at, ll dx, ll cx){
	if(ansd[at] < dx){
		if(ans[at] == 0){
			ans[at] = cx;
		}
		ansd[at] = dx;
		zep(i, 0, g[at].size()){
			dfs(g[at][i], dx-1, cx);
		}
	}
}

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n >> m;
	g.resize(n);
	zep(i, 0, m){
		cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	cin >> q;
	zep(i, 0, q){
		cin >> v[i] >> d[i] >> c[i];
		v[i]--;
	}
	
	memset(ans, 0, sizeof(ans));
	memset(ansd, -1, sizeof(ansd));
	rrep(i, q-1, 0){
		dfs(v[i], d[i], c[i]);
	}
	
	zep(i, 0, n){
		print(ans[i])
	}
	return 0;
}

Measured memory_bytes: 10868
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;

int main(){
  ll a;
  long double b;
  cin >> a >> b;
  b*=1000;
  ll c;
  c=b*1;
  c/=10;
  ll ans=a*c;
  ans/=100;
  
  cout << ans << endl;
  
  
}
  
  
  


Measured memory_bytes: 3728