akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)
#define loop(i, a, b) for(lli i=a; i<b; i++)
#define loopb(i, a, b) for(lli i=a; i>=b; i--)
#define pb push_back
#define umap unordered_map
typedef long long int lli;
typedef pair<lli, lli> pii;
typedef vector<lli> vll;
// use to avoid collision
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// for pair in unordered_map
struct hash_pair {
    static uint64_t splitmix64(uint64_t x) {
    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
	}
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const{
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        uint64_t x = hash1 ^ hash2;
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
lli M = 1e9 + 7;
lli power(lli x, lli y){
    lli res = 1;
    x = x%M;
    while (y > 0) {
        if (y & 1)
            res = (res*x)%M;
        y = y>>1;
        x = (x*x)%M;
    }
    return res%M;
}
lli solve(){
	lli a, b;
	cin>>a>>b;
	cout <<ceil((double)a/(double)b)<<"\n";
}
int main(){
	fastio;
	lli t;
	// cin>>t;
	t = 1;
	while(t>0){
		t--;
		solve();
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ABC
{
    class ABC075C
    {
        public class Edge
        {
            public int a;
            public int b;
            public Edge() { a = 0; b = 0; }
            public Edge(int _a, int _b)
            {
                a = _a;
                b = _b;
            }
        }
        //隣接行列
        static bool[,] graph = null;

        //訪れた点のリストメモ
        static bool[] visitedPoints = null;

        static int NUM_POINT = 0;
        static int NUM_EDGE = 0;

        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            NUM_POINT = int.Parse(str[0]);//点の数N
            NUM_EDGE = int.Parse(str[1]);//辺の数M
            var EdgeList = new List<Edge>(NUM_EDGE);
            graph = new bool[NUM_POINT, NUM_POINT];//初期化.点の数の自乗
            for(int i = 0; i < NUM_EDGE; ++i)//辺の数だけ
            {
                string[] s = Console.ReadLine().Split(' ');
                int a = int.Parse(s[0]);
                int b = int.Parse(s[1]);
                //a,bともに1以上。配列のindexに合わせるため、1引く
                a--;
                b--;
                EdgeList.Add(new Edge(a, b));
                graph[a,b] = graph[b,a] = true;//隣接行列をマーク
            }

            //DFSで訪れた点のリスト。trueなら訪れた
            visitedPoints = new bool[NUM_POINT];

            //橋となった数。答え。
            int bridgeCount = 0;

            for(int i = 0; i < NUM_EDGE; ++i)//全ての辺に対して
            {
                //キャッシュであるvisitedを初期化
                for(int j = 0; j < NUM_POINT; j++) { visitedPoints[j] = false; }

                //その辺をカットする
                graph[EdgeList[i].a,EdgeList[i].b] = graph[EdgeList[i].b,EdgeList[i].a] = false;

                //適当な点からスタートして、行ける点を全部マーキング
                DFS(0);

                //点を全部調べる。行けない点が存在するかどうか(マーキングされていない点があったか)チェック
                for (int j = 0; j < NUM_POINT; ++j)
                {
                    if(visitedPoints[j] == false)
                    {
                        //行けない点があった。よって、切った辺はbridgeだった。
                        bridgeCount++;
                        break;
                    }
                }

                //これでその辺に対する操作は終了
                //次回のために、切った辺をつなぎ直す
                graph[EdgeList[i].a, EdgeList[i].b] = graph[EdgeList[i].b, EdgeList[i].a] = true;
            }

            Console.WriteLine("{0}", bridgeCount);
        }

        /// <summary>
        /// 深さ優先探索
        /// </summary>
        /// <param name="x">開始点index</param>
        /// 隣接行列graph[点数][点数], 到達チェックvisited[点数]が存在するとする
        public static void DFS(int x)
        {
            if(visitedPoints[x] == true)//一度見たらもう見なくてもいいので戻る
            {
                return;
            }
            visitedPoints[x] = true;//到達したのでチェック
            //次に行ける点を探索。次に行ける点=点Xからつながっている点
            for (int i = 0; i < NUM_POINT; ++i)
            {
                if(graph[x,i] == true)//点Xから接続されている辺を見ている
                {
                    DFS(i);//i番目の点が接続されていた。そこからDFSする
                }
            }
        }

    }
}


Measured memory_bytes: 13268
#include<stdio.h>
int main(){
	int x[5];
	int n=3;
	int middle;
	for(int i=0;i<n;i++)scanf("%d",&x[i]);
	int min=x[0],max=x[0];
	for(int i=1;i<n;i++){
	    if(min>x[i]){
	        middle=min;
	        min=x[i];
	    }else
	    if(max<x[i]){
	        middle=max;
	        max=x[i];
	    }else{
	    	middle=x[i];
	    }
	    
	}
	printf("%d %d %d\n",min,middle,max);
	
	return 0;
}


Measured memory_bytes: 2040
import math

def plot(x,y):
    print(f"{x:.8f} {y:.8f}")

def koch(n,x1,y1,x2,y2):
    if n==0:
        plot(x1,y1)
        return
    ax=(2*x1+x2)/3
    ay=(2*y1+y2)/3
    bx=(x1+2*x2)/3
    by=(y1+2*y2)/3
    cx=(bx-ax)*(1/2)-(by-ay)*(math.sqrt(3)/2)+ax
    cy=(bx-ax)*(math.sqrt(3)/2)+(by-ay)*(1/2)+ay
    koch(n-1,x1,y1,ax,ay)
    koch(n-1,ax,ay,cx,cy)
    koch(n-1,cx,cy,bx,by)
    koch(n-1,bx,by,x2,y2)
    
n=int(input())
koch(n,0,0,100,0)
plot(100,0)



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

int main()
{
    long long int n,k,i,j;
    cin>>n>>k;
    vector <long long int>a,b;
    a.resize(n);
    b.resize(n);    for(i=0;i<n;i++)
        cin>>a[i];

    b[0]=0;
    for(i=1;i<n;i++)
        b[i]=1000000000;
    for(i=1;i<n;i++)
    {
        j=i-1;
        while(j>=0 && j!=i-k-1)
        {
            b[i]=min(b[i],b[j]+abs(a[i]-a[j]));
            j--;
        }
    }

    cout<<b[n-1];
    return 0;



}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int p[100005],a[100005];
int main()
{
    int n, k, q;
    cin>>n>>k>>q;

    for(int i=1;i<=n;i++)
    {
        p[i]=k-q;
    }
    for(int i=1;i<=q;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=q;i++)
    {
        p[a[i]]++;
        
    }
    for(int i=1;i<=n;i++)
    {
        if(p[i]<1)
        {
            cout<<"No"<<endl;
        }
        else
        {
            cout<<"Yes"<<endl;
        }
    }

    return 0;
}


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

using namespace std;

int main(){
  string str;
  cin >> str;
  int sum=0; 
 for(int i=0;i<3;i++){
   if(str.c_str()[i]=='1') sum+=1;
  }
 cout << sum <<endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
const int maxn=1e5+7;
const ll modn=1e9+7;
const int inf=2e9+7;
const double PI = acos(-1.0);
const double eps=1e-8;
inline int lowbit(int x){return x&-x;}
inline ll lowbit(ll x) {return x&-x;}
inline int CountOneBinary(ll num){int ans=0;while(num){if(num&1) ans+=1;num>>=1;}return ans;}
inline void read(int &x){char c;x=0;for(c=getchar();c>'9'||c<'0';c=getchar());for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';}
inline void read(ll &x){char c;x=0;for(c=getchar();c>'9'||c<'0';c=getchar());for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';}
inline ll qpow(ll x,ll y){ll ans=1;while(y){if(y&1) ans=ans*x%modn;x=x*x%modn;y>>=1;}return ans;}
inline double qpow(double x,ll y){double ans=1;while(y){if(y&1) ans=ans*x;x=x*x;y>>=1;}return ans;}
ll n,m;
ll u[maxn],v[maxn],w[maxn];
int main()
{
    ll l;
    while(scanf("%lld",&l)==1)
    {
        for(n=0,m=0;(1ll<<n)<=l;n++);
        for(int i=1;i<n;i++)
        {
            u[m]=i;v[m]=i+1;w[m]=0;m++;
            u[m]=i;v[m]=i+1;w[m]=1ll<<(i-1);m++;
        }
        ll tn=l-(1ll<<(n-1)),cur=1ll<<(n-1);
        for(ll i=n-1;i;i--)
        {
            int curn=1ll<<(i-1);
            if(tn>=curn)
            {
                u[m]=i;v[m]=n;w[m]=cur;cur+=curn;m++;
                tn-=curn;
            }
        }
        printf("%lld %lld\n",n,m);
        for(int i=0;i<m;i++) printf("%lld %lld %lld\n",u[i],v[i],w[i]);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
signed main()
{
    int a, b, x;
    cin >> a >> b >> x;
    int ans = (b / x);
    if (a == 0)
        ans++;
    else
    {
        ans -= ((a - 1) / x);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int yon=0;
    double ans,W, H, x, y;
    cin >> W >> H >> x >> y;
    ans = (W * H)/2;
    if(x == W/2){
        if(y == H/2){
            yon = 1;
        }
    }
    cout << ans<< " " << yon << endl;
}

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

typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '
 
const int MAXN = 1e5 + 5;

int largest(int a, int b){
	return (a<b)?b:a;
}


int main() {
	int n = 0, q = 0, k = 0;
	cin >> n >> k >> q;
	k = k - q;
	int number = 0;
	vector<int> g(n);
	fill(g.begin(), g.end(), k);
	for(int i = 0; i < q; ++i){
		cin >> number;
		g[number-1]++;
	}
	for(int  i = 0; i < n; ++i){
		if(g[i] <= 0){
			cout << "No" << endl;
		}
		else{
			cout << "Yes" << endl;
		}
	}

	

    return 0;
} 

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FOR(i) for(cin>>i;i>0;i--)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define re(x) {cout<<x<<endl;return 0;}
//#define x first
//#define y second

using namespace std;

int main()
{
	int k,a[33]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cin>>k;
	cout<<a[k]<<endl;
	return 0;}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int h,w,s,u[33][33]={},a[33][33][33][33]={},t,b[33][33][33][33]={};
int Usum(int i,int j,int k,int l){
    int R=0;
    R=u[i+k][j+l]-u[i+k][j]-u[i][j+l]+u[i][j];
    return R;
}

int main(){
    while (cin >> h >> w >> s && h!=0){
        for (int i=1; i<=h; i++){
            for (int j=1; j<=w; j++){
                cin >> u[i][j];
                u[i][j] += u[i-1][j];
                u[i][j] += u[i][j-1];
				u[i][j] -= u[i-1][j-1];
            }
		}
		t=u[h][w]-s;
        for (int i=1; i<=h; i++){						//??????
            for (int j=0; j<=h-i; j++){					//???
                for (int k=1; k<=w; k++){               //???
                    for (int l=0; l<=w-k; l++){			//???
                        if (Usum(j,l,i,k)>=t){
							a[j][l][i][k]=1;
						}
                        else a[j][l][i][k]=-100000000;
                        for (int m=1; m<i; m++){
                            if (a[j][l][i][k]<a[j][l][m][k]+a[j+m][l][i-m][k]){
								a[j][l][i][k]=a[j][l][m][k]+a[j+m][l][i-m][k];
								if (b[j][l][m][k]<b[j+m][l][i-m][k]) b[j][l][i][k]=b[j][l][m][k];
								else b[j][l][i][k]=b[j+m][l][i-m][k];
							}
							if (a[j][l][i][k]==a[j][l][m][k]+a[j+m][l][i-m][k] && b[j][l][i][k]<b[j][l][m][k] && b[j][l][i][k]<b[j+m][l][i-m][k]){
								if (b[j][l][m][k]<b[j+m][l][i-m][k]) b[j][l][i][k]=b[j][l][m][k];
								else b[j][l][i][k]=b[j+m][l][i-m][k];
							}
                        }
                        for (int m=1; m<k; m++){
                            if (a[j][l][i][k]<a[j][l][i][m]+a[j][l+m][i][k-m]){
								a[j][l][i][k]=a[j][l][i][m]+a[j][l+m][i][k-m];
								if (b[j][l][i][m]<b[j][l+m][i][k-m]) b[j][l][i][k]=b[j][l][i][m];
								else b[j][l][i][k]=b[j][l+m][i][k-m];
							}
							if (a[j][l][i][k]==a[j][l][i][m]+a[j][l+m][i][k-m] && b[j][l][i][k]<b[j][l][i][m] && b[j][l][i][k]<b[j][l+m][i][k-m]){
								if (b[j][l][i][m]<b[j][l+m][i][k-m]) b[j][l][i][k]=b[j][l][i][m];
								else b[j][l][i][k]=b[j][l+m][i][k-m];
							}
                        }
						if (a[j][l][i][k]==1) b[j][l][i][k]=Usum(j,l,i,k)-t;
                    }
                }
            }
        }
        cout << a[0][0][h][w] << " " << b[0][0][h][w] << endl;
    }
}

Measured memory_bytes: 11880
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

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

	int H1,M1,H2,M2,K;
	cin >> H1 >> M1 >> H2 >> M2 >> K;

	cout << 60 * (H2 - H1) + (M2 - M1) - K << endl;

	return 0;
}

Measured memory_bytes: 3504
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include<iomanip>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int inf = 1000000;

int main(int argc, const char * argv[]) {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 1; i <= N; i++) {
    ans += i;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

const int MOD = 1e9 + 7;
const long long INF = 1e18;
const int MaxN = 2e5 + 15;

long long F[MaxN];

long long getMax(int pos)
{
    long long res = F[pos];
    for(int x = pos; x > 0; x &= (x + 1), --x)
        res = max(res, F[x]);
    return res;
}

void up(int pos, long long newValue)
{
    for(int x = pos; x < MaxN; x |= x + 1)
        F[x] = max(F[x], newValue);
}

int h[MaxN], a[MaxN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);

    int n;
    cin >> n;

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

    for(int i = 0; i < n; ++i)
    {
        long long curDp = getMax(h[i] - 1) + a[i];;
        up(h[i], curDp);
    }

    cout << getMax(n) << '\n';

    return 0;
}



Measured memory_bytes: 3328
#include<iostream>
#include<stdio.h>
using namespace std;
typedef long long ll;
const int MAX=1e5+10;
ll node[MAX],sum; 
int n,m;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	cin>>node[i];
	node[0]=0;
	sum=0;
	for(int i=1;i<=n;i++)
	if(node[i-1]+node[i]>m)
	{
	sum=sum+node[i]-(m-node[i-1]);
	node[i]=m-node[i-1];
	}
	cout<<sum;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
    int x = 0, y = 0, z = 0, a = 0;
    cin >> x >> y >> z;
    while(x > z)
    {
        x -= z;
        if(x >= y)
        {
            x -= y;
            a++;
        }
        else
        {
            break;
        }
    }

    if(x >= z)
    {
        cout << a;
    }
    else if(a == 0)
    {
        cout << a;
    }
    else
    {
        cout << a - 1;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String args[]){
		Scanner cin = new Scanner(System.in);

		int target = cin.nextInt();
		long A[] = new long[target];
		int count =0;
		long tmp = 0L;
		long tmp_sum = 0L;
		boolean flg_brk = false;
		for(int i=0;i<target;i++){
			A[i] = cin.nextLong();
		}
		cin.close();
		Arrays.sort(A);

		for(int j=0;j<target-1;j++){
			tmp = A[j]+tmp_sum;
			if(2*tmp>=A[target-1]){
				count = target -j;
				break;
			}else if(j==0||A[j]!=A[j-1]){
				for(int k=j+1;k<target&&2*tmp>=A[k];k++){
					tmp += A[k];
					if(2*tmp>=A[target-1]){
						count = target-j;
						flg_brk = true;
					}
				}
				if(flg_brk){
					break;
				}
			}
			tmp_sum += A[j];
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 50644
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

int N;
ll C[200010];
ll dp[200010];
ll add[200010];

ll solve(){
    dp[0] = 1;
    REP(i, N){
        if(i > 0 && C[i] == C[i - 1]){
            dp[i + 1] = dp[i];
            continue;
        }
        dp[i + 1] = (dp[i] + add[C[i]]) % MOD;
        add[C[i]] = (add[C[i]] + dp[i]) % MOD;
    }
    return dp[N];
}

signed main(){
    cin >> N;
    REP(i, N){
        cin >> C[i];
        C[i]--;
    }
    PRINT(solve());
    return 0;
}

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

#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

typedef long long LL;
template<typename T> using V = std::vector<T>;
template<typename T> using VV = std::vector<std::vector<T>>;
template<typename T> using VVV = std::vector<std::vector<std::vector<T>>>;
template<class T> inline T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> inline void print(T x) { std::cout << x << std::endl; }
template<class T> inline bool inside(T y, T x, T H, T W) {return 0 <= y and y < H and 0 <= x and x < W; }
inline double distance(double y1, double x1, double y2, double x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }

const int INF = 1L << 30;
const double EPS = 1e-9;
const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy = { 0, 1, 0, -1 }, dx = { 1, 0, -1, 0 };    // 4近傍（右, 下, 左, 上）

using namespace std;

int N;
vector<vector<int>> graph;
vector<vector<int>> dp;
int func(int node, int state) {
    if (dp[state][node] >= 0) {
        return dp[state][node];
    }

    if ((state == (1 << N) - 1) and node == 0) {
        return dp[state][node] = 0;
    }

    int cost = INF;
    for (int u = 0; u < N; ++u) {
        if (graph[node][u] == INF) { continue; }
        if (!(state >> u & 1)) {
            cost = min(cost, func(u, state | 1 << u) + graph[node][u]);
        }
    }

    return dp[state][node] = cost;
}


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

    int E;
    cin >> N >> E;

    graph.resize(N, vector<int>(N, INF));
    FOR(i, 0, E) {
        int s, t, d;
        cin >> s >> t >> d;
        graph[s][t] = d;
    }

    dp.resize(1 << N, vector<int>(N, -1));
    int ans = func(0, 0);

    if (ans == INF) {
        print(-1);
    }
    else {
        print(ans);
    }

    return 0;
}


Measured memory_bytes: 6160
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll A, B, X;

int main() {
	scanf("%lld %lld %lld", &A, &B, &X);
	if(A + B >= X && A <= X) {
		printf("YES\n");
	} 
	else {
		printf("NO\n");
	}
	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

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

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

    sort(a.begin(), a.end());
    cout << a[a.size()-1] - a[0] << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
t = list(map(int,input().split()))
m = int(input())
ans = []
for i in range(m):
    p,x = map(int,input().split())
    tot = sum(t)
    tot = tot  -  t[p - 1]+x
    ans.append(tot)
for i in ans:
    print(i)


Measured memory_bytes: 3060
#include <iostream>
#include <cmath>

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

using namespace std;

int main() {
    int N, D, X, A;
    cin >> N >> D >> X;

    REP(i, N) {
        cin >> A;
        X += ceil((double)D / A);
    }
    cout << X << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int dp[101][10001];
int value[100];
int weight[100];
int NEGA_INF = -10000000;

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

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

Measured memory_bytes: 7000
import java.util.*;
class Main{
        public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
                int b = sc.nextInt();
        int c = sc.nextInt();

                int [] d = new int [3];
        d[0] = a;
        d[1] = b;
        d[2] = c;

        Arrays.sort(d);
        if((d[0] == 5 && d[1] == 5) && d[2] == 7)
          System.out.println("YES");
        else
          System.out.println("NO");

    }
}

Measured memory_bytes: 19796
#include <bits/stdc++.h>
using namespace std;
int main()
  {      int N,L;
                  cin>>N>>L;
                  int t=L*N+N*(N+1)/2-N;
                if((L<=0 && L+N-1>=0) || (L>=0 && L+N-1<=0))
                {
                    cout<<t;
                }
                else if(L>=0)
                {
                    cout<<t-L;
                }
                else
                {
                    cout<<t-L-N+1;
                }



     return 0;
  }


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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pi;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    switch(n%10){
        case 2: case 4: case 5: case 7: case 9:
            cout << "hon" << endl;
            break;
        case 0: case 1: case 6: case 8:
            cout << "pon" << endl;
            break;
        case 3:
            cout << "bon" << endl;
            break;
    }

    return 0;
}


Measured memory_bytes: 3612
N = gets.strip.to_i
L = gets.split(/\s+/).map(&:to_i)

ls = L.sort
n = ls.size

s = 0
for i in 0...(n-2) do
  li = ls[i]
  for j in (i+1)...(n-1) do
    lj = ls[j]
    next if li == lj
    for k in (j+1)...(n) do
      lk = ls[k]
      next if lj == lk
      if li + lj > lk
        s += 1
      else
        break
      end
    end
  end
end

puts s


Measured memory_bytes: 14372
import java.io.*;
import java.util.StringTokenizer;
import java.util.Arrays;

class Main {
	public static void main (String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			while (!(buf = br.readLine()).equals("0")) {
				int n = Integer.parseInt(buf);
				int min[] = new int[n];
				int max[] = new int[n];
				int h[][] = new int[n][n];
				Arrays.fill(min,-1);
				Arrays.fill(max,0);
				for (int i=0;i<n;i++) {
					StringTokenizer st = new StringTokenizer(br.readLine());
					for (int j=0;j<n;j++) {
						h[i][j] = Integer.parseInt(st.nextToken());
					}
				}
				boolean flag = true;
				for (int i=0;i<n;i++) {
					for (int j=0;j<n;j++) {
						if (max[j]<h[i][j]) max[j] = h[i][j];
						if (min[i]==-1||min[i]>h[i][j]) min[i] = h[i][j];
					}
				}

				for (int i=0;i<n;i++) {
					for (int j=0;j<n;j++) {
						if (h[i][j]==min[i]&&h[i][j]==max[j]) {
							System.out.println(h[i][j]);
							flag = false;
							break;
						}
					}
					if (flag==false) break;
				}
				if (flag) System.out.println(0);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 16880
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n;
    vector<int> c(4, 0);
    cin >> n;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        c[a]++;
    }
    int m = n+1;
    vector< double > dp(m*m*m, 0);
    auto f = [&](int i1, int i2, int i3){ return (i1*m+i2)*m+i3; };
    for(int i3=0;i3<=n;i3++){
        for(int i2=0;i2<=n;i2++){
            for(int i1=0;i1<=n;i1++){
                int sum = i1+i2+i3;
                if(sum == 0) continue;
                double &res = dp[f(i1, i2, i3)];
                res = 1.0 * (n-sum);
                if(i1 > 0) res += (dp[f(i1-1, i2, i3)] + 1.0) * i1;
                if(i2 > 0) res += (dp[f(i1+1, i2-1, i3)] + 1.0) * i2;
                if(i3 > 0) res += (dp[f(i1, i2+1, i3-1)] + 1.0) * i3;
                res *= 1.0 / sum;
                // cout << i1 << " " << i2 << " " << i3 << endl;
                // cout << fixed << setprecision(12) << (res) << endl;
            }
        }
    }
    cout << fixed << setprecision(12) << dp[(f(c[1], c[2], c[3]))] << endl;
}


Measured memory_bytes: 213376
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>

using namespace std;

int main()
{
    string s;
    cin>>s;
    if(s=="Sunny"){
        cout<<"Cloudy";
    }
    else if(s=="Cloudy"){
        cout<<"Rainy";
    }
    else{
        cout<<"Sunny";
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int a = 0;
    int b = 0;
    int c = 0;
    for(int i = 0; i < N; i++) {
      int n = sc.nextInt();
      if(n % 4 == 0) {
        a++;
      } else if(n % 2 == 0) {
        b++;
      } else {
        c++;
      }
    }
    String ans = "No";
    if(c == 0) {
      ans = "Yes";
    } else if(c == 1) {
      if(a > 0) ans = "Yes";
    } else {
      if(a >= c) ans = "Yes";
      if(a == c - 1 && b == 0) ans = "Yes";
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 48596
public class Main {

  private static void solve() {
    int d = ni();
    int t = ni();
    int s = ni();

    int x = (d + s - 1) / s;

    if (x <= t) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 36720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
ll a[100010];
ll b[100010];
ll c[100010];
bool d[100010];
ll ans = 1;

int main(){
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  c[0] = a[0];
  d[0] = 1;
  for (int i = 1; i < n; i++) {
    c[i] = a[i];
    if (a[i] != a[i - 1]) {
      d[i] = 1;
    }
  }
  if (c[n - 1] < b[n - 1] || (d[n - 1] && b[n - 1] != c[n - 1])) {
    puts("0");
    return 0;
  }
  c[n - 1] = b[n - 1];
  d[n - 1] = 1;
  for (int j = n - 2; j >= 0; j--) {
    if (b[j] != b[j + 1]) {
      if (d[j]) {
        if (b[j] != c[j]) {
          puts("0");
          return 0;
        }
      } else {
        if (c[j] < b[j]) {
          puts("0");
          return 0;
        } else {
          c[j] = b[j];
          d[j] = 1;
        }
      }
    } else {
      if (d[j]) {
        if (b[j] < c[j]) {
          puts("0");
          return 0;
        }
      } else {
        c[j] = min(c[j], b[j]);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (!d[i]) {
      ans *= c[i];
      ans %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

int main(){
    int a, b;
    cin >> a >> b;
    
    int ans = 0;
    for(int i = a; i <= b; i++){
        if(i/10000 == i%10 && i/1000%10 == i%100/10)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();

        long digits = Long.MAX_VALUE;
        double sqrt = Math.sqrt(n);
        for (long i = 1; i <= sqrt; i++) {
            if (n % i == 0) {
                long a = n / i;
                digits = Math.min(digits, f(a, i));
            }
        }

        System.out.print(digits);
    }

    static long f(long a, long b) {
        return Math.max(Long.toString(a).length(), Long.toString(b).length());
    }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
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;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    sort(all(h));
    int ans = inf;
    rep(i,n-k+1) {
        chmin(ans,h[i+k-1]-h[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static long n = sc.nextLong();
    static long w = sc.nextLong();
    static long[] weight = new long[110];
    static long[] value = new long[110];
    static long[][] dp = new long[110][101000];
    public static void main(String[] args) {
        for (int i = 0; i < n; i++){
            weight[i] = sc.nextLong();
            value[i] = sc.nextLong();
        }
        for (int i = 0; i < 110; i++)
            for (int j = 0; j < 101000; j++)
                dp[i][j] = 0;
        for (int i = 0; i < n; i++){
            for (int j = 0; j <= w; j++){
                if (j - (int)weight[i] >= 0)
                    dp[i + 1][j] = chmax(dp[i + 1][j], dp[i][j - (int)weight[i]] + value[i]);
                dp[i + 1][j] = chmax(dp[i + 1][j], dp[i][j]);
            }
        }
        System.out.println(dp[(int)n][(int)w]);
    }

    public static long chmax (long a, long b){
        if (a > b){
            return a;
        } else {
            return b;
        }
    }
}


Measured memory_bytes: 126932
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
//i64 mod = 1000000007;
int int_max = 2147483647;
int max_n = 1e5;

template<typename IntType>
IntType all_pattern(IntType a, IntType b, IntType mod_ = 1000000007) {
  IntType res = 1;
  for (a %= mod_; b; a = a * a % mod_, b >>= 1) {
    if (b & 1) res = res * a % mod_;
  }
  return res;
}

struct fast_combination {
    fast_combination(int n, int mod_) :fac(n+1, 0), finv(n+1, 0), inv(n+1, 0), mod_(mod_) {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i=2; i<=n; ++i) {
            fac[i] = fac[i-1] * i % mod_;
            inv[i] = mod_ - inv[mod_%i] * (mod_/i) % mod_;
            finv[i] = finv[i-1] * inv[i] % mod_;
        }
    }

    int64_t operator()(int n, int k) {
        if (n > fac.size()-1) return -1;
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n-k] % mod_) % mod_;
    }

    int64_t multichoose(int n, int k) {
        return this->operator ()(n+k-1, k);
    }

    std::vector<int64_t> fac, finv, inv;
    int mod_;
};

int main(int argc, char **argv) {
    i64 n,m,k;
    cin >> n >> m >> k;
    i64 mod{998244353};


    fast_combination fc(n, mod);

    i64 ans{0};
    for (int i=0; i <= k; ++i) {
        i64 comb = fc(n-1, i);
        i64 pat = all_pattern(m-1, n-i-1, mod);
        pat = (m * pat) % mod;
        ans += (pat * comb) % mod;
        ans %= mod;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8008
n = int(input()) #waiting_for_pudging
a = list(map(int, input().split())) #waiting_for_pudging
b = list(map(int, input().split())) #waiting_for_pudging
c = list(map(int, input().split())) #waiting_for_pudging
summ = 0 #waiting_for_pudging
for i in range(n-1): #pudging
    if a[i] + 1 == a[i + 1]: #pudging
        summ += c[a[i]-1] #pudging
        summ += b[a[i]-1] #pudging
    else: #pudging
        summ += b[a[i]-1] #pudging
print(summ + b[a[n-1]-1]) #pudging
#accepted
    

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-

N = int(input())

ans = 0
cursor = "357"


def increment(cursor):
    l = len(cursor)
    ret = [''] * (l + 1)
    if cursor[-1] == '7':
        ret[-1] = '3'
        ret[-2] = '3'
    elif cursor[-1] == '5':
        ret[-1] = '7'
    elif cursor[-1] == '3':
        ret[-1] = '5'

    for i in range(l-1):
        if ret[-(2 + i)] == '3':
            if cursor[-(2 + i)] == '7':
                ret[-(2 + i)] = '3'
                ret[-(3 + i)] = '3'
            elif cursor[-(2 + i)] == '5':
                ret[-(2 + i)] = '7'
            elif cursor[-(2 + i)] == '3':
                ret[-(2 + i)] = '5'
        else:
            ret[-(2 + i)] = cursor[-(2 + i)]

    return ''.join(ret)


while N >= int(cursor):
    if '7' in cursor and '5' in cursor and '3' in cursor:
        ans += 1
    cursor = increment(cursor)

print(ans)


Measured memory_bytes: 3064
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = int(input())
n, a, b, c, d  = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s  = input()
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

is_rock2 = '##' in s[a:d+1]
is_empty3 = '...' in s[b-1:d+2]

joken = (not is_rock2) and (is_empty3 if c > d else 1)
print('Yes' if joken else 'No')


Measured memory_bytes: 3956
#!/usr/bin/env python3

N = int(input())
lst = "AC,WA,TLE,RE".split(',')
mp = {s : 0 for s in lst}
for i in range(N):
    S = input().strip()
    mp[S] += 1
for s in lst:
    print(f'{s} x {mp[s]}')
    


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

using namespace std;

int main(){
  string S;
  unsigned long long int K;
  
  cin >> S >> K;
  
  char ans = 'x';
  //K番目以下で始めに出てきた1以外の数字を答えにする
  for(int i = 0; i < min((unsigned long long int)S.size(),K); i++){
    if(S[i] == '1') continue;
    else {
       ans = S[i];
       break;
    }
  }
  if(ans == 'x') cout << '1';
  else cout << ans;
}


Measured memory_bytes: 256
#[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")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      ls: [usize; n],
    }
    let mut ls = ls;
    ls.sort();
    let s = ls.iter().sum::<usize>() - ls[ls.len() - 1];
    if s > ls[ls.len() - 1] {
        println!("{}", "Yes");
    } else {
        println!("{}", "No");
    }
}


Measured memory_bytes: 4352
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


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)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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



int main() {
	
	set<int> n;
	rep(i, 3) {
		int x;
		cin >> x;
		n.insert(x);
	}
	if (n.size() == 2) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main()
{
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  int dp[n];
  dp[0]=0;
  dp[1]=abs(arr[1]-arr[0]);
  if(n==2){
    cout<<dp[n-1]<<"\n";
    return 0; 
  }
  for(int i=2;i<n;i++)
  {
    dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
  }
  cout<<dp[n-1]<<"\n";
}


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

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> a(h);

    for(int i=0;i < h;i++) cin >> a.at(i);
    for(int i=0;i < w + 2;i++) cout << "#";
    cout << endl;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(j == 0) cout << "#";
            cout << a.at(i).at(j);
            if(j == w - 1) cout << "#" << endl;
        }
    }
    for(int i=0;i < w + 2;i++) cout << "#";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807/2;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n,k;
int p[200100];
int d[200100];
int t[200100];
int tt[200100];
int tt2[200100];
int main(){
	cin>>n>>k;
	REP(i,n)cin>>p[i];
	REP(i,n-1){
		if(p[i]<=p[i+1])d[i]=1;
	}
	int kk=0;
	REP(i,k-1)kk+=d[i];
	int co=0;
	if(kk==k-1){
		t[0]=1;
		co++;
	}
	FOR(i,k-1,n-1){
		kk+=d[i];
		kk-=d[i-k+1];
		if(kk==k-1){
			t[i-k+2]=1;
			co++;
		}
	}
	multiset<int> m1;
	REP(i,k)
		m1.insert(p[i]);
	int co2=0;
	FOR(i,k,n){
		int flag=1;
		if(*(--m1.end())>p[i])flag=0;
		if(*m1.begin()<p[i-k])flag=0;
		if(flag){
			tt2[i-k+1]=1;
			co2++;
		}
		m1.erase(m1.find(p[i-k]));
		m1.insert(p[i]);
		//cout<<tt2[i-k]<<endl;
	}
	if(co<=1){
		cout<<(n-k+1)-co2<<endl;
		return 0;
	}
	
	int tt3=0;
	for(int i=0;i<=n-k;i++){
		if(tt2[i]!=1&&t[i]!=1)tt3++;
	}
	cout<<tt3+1<<endl;
	return 0;
}

Measured memory_bytes: 11136
x, n = gets.split.map(&:to_i)
ps = gets.split.map(&:to_i)

targets = (-200..200).to_a - ps

min = 10**20
ans = 10**20
targets.each do |t|
  if (x-t).abs < min
    ans = t
    min = (x-t).abs
  elsif (x-t).abs == min && t < ans
    ans = t
  end
end
puts ans

Measured memory_bytes: 14412
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, i, f=1, p, h;
	cin >> n;
	int a[n+1], b[n+1], c[n+1];
	a[0]=0;
	b[0]=0;
	c[0]=0;
	for (i=1; i<=n; i++)
	{
		cin >> a[i] >> b[i] >> c[i];
		p=fabs(b[i]-b[i-1])+fabs(c[i]-c[i-1]);
		h=a[i]-a[i-1];
		if (p>h) f=0;
		if (p%2!=h%2) f=0;
	}
	if (f==0) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
#define mod 1000000007;
using namespace std;
int main(){
    string S;
    cin >> S;
    int C=0;
    if(S[0]==S[1]){
        if(S[2]==S[3] && S[0]!=S[2]){
            C++;
        }
    }
    else if(S[0]==S[2]){
        if(S[1]==S[3] && S[0]!=S[1]){
            C++;
        }
    }
    else if(S[0]==S[3]){
        if(S[1]==S[2] && S[0]!=S[1]){
            C++;
        }
    }
    if(C==1){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 888
import Data.List

dataSet :: [[Int]] -> Int -> Int -> Int -> [Int] -> (Int,[Int])
dataSet [] _ m wcd misp = ((m - 1) - wcd,misp)
dataSet ([win,mis]:xs) n m wcd misp
  | win >= n = dataSet xs n m (wcd+1) misp
  | otherwise = dataSet xs n m wcd ((mis-n):misp)

calc :: (Int,[Int]) -> Int
calc (0,_) = 0
calc (nes,misp) = sum $ take nes (sort misp)

main = do
  n_m <- getLine
  contents <- getContents
  let 
    [n,m] = map read $ words n_m :: [Int]
    lst = map  (map read) $ map words $ lines contents :: [[Int]]
    cost = calc $ dataSet lst n m 0 []
  putStrLn $ show cost


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

ll minCost(vector<int> &height){
    const int n = height.size();
    if(n < 2){
        return 0;
    }
    vector<ll> dp(n);
    dp[0] = 0;
    dp[1] = abs(height[0] - height[1]);
    for(int i = 2; i<n;i++){
        ll cost1 = dp[i-1] + abs(height[i-1] - height[i]);
        ll cost2 = dp[i-2] + abs(height[i] - height[i-2]);
        dp[i] = min(cost1, cost2);
    }
    return dp[n-1];
}
int main(){
    // freopen("in.txt","r",stdin);
    int n;
    cin>>n;
    vector<int> arr(n);
    for (int i = 0; i < n; i++){
        cin>>arr[i];
    }
    cout<<minCost(arr);
    return 0;
}


Measured memory_bytes: 4532
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONG_INF 100000000000000
int main() {
	int n;
	cin >> n;
	vector<int> a;
	REP(i, n) {
		int tmp;
		cin >> tmp;
		a.push_back(tmp);
	}
	sort(a.begin(), a.end());
	if (n % 2 == 0) {
		for (int i = 0;i < n;i += 2) {
			if (a[i] != i + 1 || a[i + 1] != i + 1) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	else {
		if (a[0] != 0) {
			cout << 0 << endl;
			return 0;
		}
		for (int i = 1;i < n;i += 2) {
			if (a[i] != i + 1 || a[i + 1] != i + 1) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	long long ans = 1;
	for (int i = 0;i < n / 2;++i) {
		ans *= 2;
		ans %= MAX_MOD;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 892