akhauriyash/Code-Regression huggingface dataset:
/*---------------------------------------------------------------------*/
/*                   -------------------------------------             */
/*                   -----------MEHEDI HASAN--------------             */
/*                   -----CSE,JAHANGIRNAGAR UNIVERSITY----             */
/*                   -------------------------------------             */
/*---------------------------------------------------------------------*/
#include<bits/stdc++.h>
#include <cassert>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
/*---------------------------------------------------------------------*/
#define FAST        ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
#define cc(x)       cout<<#x<<"="<<x<<" ";
#define ccc(x)      cout<<#x<<"="<<"("<<x.ff<<" "<<x.ss<<") ";
#define CC(x)       cout<<"["<<#x<<"] = ";for(auto xx: x) cout<<xx<<" ";
#define CCC(x)      cout<<"["<<#x<<"] = ";for(auto xx: x) cout<<"("<<xx.ff<<" "<<xx.ss<<") ";
#define MARK(x)     cout<<x<<" ";
#define ee          cout<<"\n";
#define OK          cout<<"Ok till line "<<__LINE__<<"\n";
/*---------------------------------------------------------------------*/
#define ff          first
#define ss          second
#define ll          long long
#define ull         unsigned long long
#define pii         pair<int,int>
#define mp          make_pair
#define ps          push
#define psb         push_back
#define psf         push_front
#define pp          pop
#define ppb         pop_back
#define ppf         pop_front
#define all(x)      x.begin(),x.end()
#define TESTS       int t;cin>>t;for(int tcase=1;tcase<=t;tcase++)
#define ordered_set tree< int, null_type, less_equal< int >, rb_tree_tag, tree_order_statistics_node_update>
/*---------------------------------------------------------------------*/
#define MAX (ll)(1e6)
#define MOD (ll)(1e9+7)

int main()
{
    FAST
    string s;
    cin>>s;
    if(s.find('7')!=-1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;






    return 0;

}
/*--------------------------------------------------------------------*/
/*
>Check Corner Cases (n==1 or T==1)
>Overflow issues?
>LB / UB !!not found!! check?
*/
/*--------------------------------------------------------------------*/
/* ---INPUT---
--------(1)------

-------(2)-------


-------(3)-------


-------(4)-------



--------------
*/
/*--------------------------------------------------------------------*/



//https://codeforces.com/contest/466/problem/C try again


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
#define rep(pos, len) for(int pos=0;pos<len;pos++)
#define repp(pos, len) for(int pos=1;pos<=len;pos++)
 
#define INF 987654321
#define IINF 2987654321987654321
#define MOD 1000000007

struct SegmentTree {
	int n;
	vector<ll> st;

	void init(int sz) {
		n = 1;
		while(n < sz)
			n <<= 1;
		st.assign(2*n, 0LL);
	}

	void update(int p, ll val) {
		p += n-1;
		st[p] += val;
		for(p >>= 1; p; p >>= 1)
			st[p] = st[2*p] + st[2*p+1];
	}

	ll rangeSum(int l, int r) {
		ll sum = 0;
		for(l += n-1, r += n-1; l <= r; l >>= 1, r >>= 1) {
			if(l&1)
				sum += st[l++];
			if(!(r&1))
				sum += st[r--];
		}
		return sum;
	}
};

const int MAXN = 2e5 + 50;
ll n, d, a;
ll x[MAXN], h[MAXN];
void readInput() {
	scanf("%lld%lld%lld", &n, &d, &a);
	vector<pll> v(n+1);
	for(int i = 1; i <= n; i++) 
		scanf("%lld%lld", &v[i].first, &v[i].second);
	sort(v.begin() + 1, v.end());
	for(int i = 1; i <= n; i++)
		tie(x[i], h[i]) = v[i];
}


void solve() {
	ll cnt = 0;
	SegmentTree tree;
	tree.init(n);
	for(int i = 1; i <= n; i++) {
		int l = lower_bound(x+1, x+n+1, x[i]-2*d) - x;
		ll damage = tree.rangeSum(l, i-1);
		if(h[i] <= damage)
			continue;
		else {
			ll cur = (h[i] - damage - 1) / a + 1;
			tree.update(i, cur * a);
			cnt += cur;
		}
	}	
	printf("%lld", cnt);
}


int main() {
	readInput();
	solve();
}

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

using namespace std;

#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

signed main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(nullptr); 
	cout.tie(nullptr); 
	cerr.tie(nullptr);	

	int m, d;
	cin >> m >> d;

	int sol = 0;
	for (int i = 11; i <= d; ++i){
		int d1 = i % 10, d2 = i / 10;

		if (d1 < 2 || d2 < 2 || d1 * d2 > m) continue;
		++sol;
	}

	cout << sol << '\n';
}

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

int main(){
  ll N;
  cin >> N;
  
  vector<ll> town(5);
  
  for (int i = 0; i < 5; i++){
    cin >> town[i];
  }
  
  ll minimum = *min_element(town.begin(),town.end());
  cout << (N + minimum - 1)/minimum + 4;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
int h,w;
map<pii,int>Mp;
map<pii,int>res;
void solve(){
    int mv[]={0,1,2};
    for(auto itr:Mp){
        pii temp=itr.first;
        if(itr.second==0)continue;
        rep(j,3)rep(k,3){
            int x=temp.second-mv[j];
            int y=temp.first-mv[k];
            if((1<=x&&x+2<=w)&&(1<=y&&y+2<=h)){
                res[mp(y,x)]++;
            }
        }
    }
}
signed main(){
    cin>>h>>w;
    int n; cin>>n;
    rep(i,n){
        pii temp;cin>>temp.first>>temp.second;
        Mp[temp]++;
    }
    solve();
    vector<int>ans(10,0);
    ans[0]=(h-2)*(w-2)-res.size();
    for(auto itr:res)ans[itr.second]++;
    for(int i=0;i<=9;i++)cout<<ans[i]<<endl;
}


Measured memory_bytes: 62720
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int a,b,c,d; cin >> a >> b >> c >> d;
    out(max(a*b,c*d));

    return 0;
}

Measured memory_bytes: 256
#pragma region Template
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RNG(i, a, b) for(int i = a; i < b; i++)
#define RBF(i, v) for(auto& i : v)
#define ALL(x) x.begin(), x.end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;
template<typename T> using VP = vector<pair<T, T>>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = INT64_MAX >> 1;
const int INF = INT_MAX >> 1;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }
#pragma endregion

signed main()
{
	string S;
	cin >> S;

	int i = 0;
	while (i < 3) {
		cout << S[i];
		i++;
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	for(int i=0;i<3;i++) {

    		String buf=sc.next();

    		System.out.print(buf.substring(i,i+1));

    	}

    	System.out.println();

    }

}







Measured memory_bytes: 21716
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int s=sc.nextInt();
        int h=s/3600;
        s%=3600;
        int m=s/60;
        s%=60;
        System.out.printf("%d:%d:%d\n",h,m,s);
    }

}

Measured memory_bytes: 17236
using System;
using System.Linq;

namespace CSharp
{
    class Program
    {
        public static void Main()
        {
            var N = long.Parse(Console.ReadLine());
            var city = new long[5].Select(_ => long.Parse(Console.ReadLine())).ToArray();

            Console.WriteLine((long)Math.Ceiling((double)N / city.Min()) + 4);
        }
    }
}

Measured memory_bytes: 13396
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Set;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class F {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            long N = in.nextLong();
            int ans = 0;
            Set<Long> set = new HashSet<>();
            set.add(N);
            set.add(N - 1);
            long a = N - 1;
            for (long i = 2; i < Math.sqrt(a) + 1; i++) {
                if (a % i == 0) {
                    set.add(i);
                    set.add(a / i);
                }
            }
//        ans += set.size() + 1;
//        set.clear();
            for (long i = 2; i < Math.sqrt(N) + 1; i++) {
                if (N % i == 0) {
                    set.add(i);
                    set.add(N / i);
                }
            }
            for (Long k : set) {
                if (k == 1) continue;
                a = N;
                while (a % k == 0) a /= k;
                if (a % k == 1) ans++;
            }
            out.println(ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 22868
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2020 Bjarni Dagur Thor Karason

#include <bits/stdc++.h>

using namespace std;

#define rep(i,a,b) for (__typeof(a) i=(a); i<(b); i++)
#define MP make_pair
#define PB push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define PI 3.14159265359

const ll INF = 1e18L;

int n;
vi slimes;
vector<ll> pre;
ll memo[401][401];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    for (int i = 0; i < 401; i++) {
        for (int j = 0; j < 401; j++) {
            memo[i][j] = INF;
        }
    }
    cin >> n;
    slimes.resize(n);
    pre.resize(n + 1);
    for (int i = 0; i < n; i++) cin >> slimes[i];
    pre[0] = 0;
    for (int i = 0; i < n; i++) {
        pre[i + 1] = pre[i] + slimes[i];
    }
    for (int l = n - 1; l >= 0; l--) {
        for (int r = 0; r < n; r++) {
            if (l > r) continue;
            if (l == r) memo[l][r] = 0;
            else {
                for (int i = l; i <= r - 1; i++) {
                    memo[l][r] = min(memo[l][r], memo[l][i] + memo[i + 1][r] + pre[r + 1] - pre[l]);
                }
            }
        }
    }
    cout << memo[0][n - 1] << endl;

    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int N,R;
    cin >> N >> R;
    if (N >= 10) cout << R << endl;
    else cout << R + 100 * (10-N) << endl;


    return 0;
}


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

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = mod
N = 4 * 10 ** 6 + 10 # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
    
def shikiri(a,b):
    return fact[a+b]*factinv[a]*factinv[b]%mod

ans=0
for i in range(min(n,m+1)):
    ans+=shikiri(n-1-i,i)*cmb(n,i,p)
    #print(ans)
    ans%=mod

if m==1:
    ans-=1
print(ans)

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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	for(int n;cin>>n&&n;){
		vi a(n);
		rep(i,n) cin>>a[i];
		ll sum=accumulate(all(a),0ll);
		ll res=LLONG_MAX;
		ll x=0;
		rep(i,n-1){
			x+=a[i];
			res=min(res,abs(sum-x-x));
		}
		cout<<res<<endl;
	}
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii  pair<int,int>
#define vpii vector<pii>
#define vll  vector<ll>
#define vi  vector<int>
#define pb push_back
#define f  first
#define s  second

int main() {

     string s;
     cin>>s;
     int ct=700;
     for(int i=0;i<3;++i)
     if(s[i]=='o')
      ct+=100;
     
     cout<<ct;
      
     

	return 0;
}

Measured memory_bytes: 256
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;

int main() {
  int a,b;
  cin >> a >> b;
  if(a>12){
    cout << b << endl;
  }
  else if(a>=6){
    cout << b/2 << endl;
  }
  else{
    cout << "0" << endl;
  }
}

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

bool is(char c){return c=='A'||c=='T'||c=='G'||c=='C';}

int main(){
  int sz,q;cin>>sz>>q;
  string s;cin>>s;
  int cnt[100000]={};
  
  for(int i=1;i<sz;++i){
    if(s[i-1]=='A'&&s[i]=='C'){
      cnt[i]=cnt[i-1]+1;
    }
    else cnt[i]=cnt[i-1];
  }
  
  while(q--){
    int h,t;cin>>h>>t;
    cout<<cnt[t-1]-cnt[h-1]<<endl;
  }
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>

int main()
{
	int sums[1000] = {};
	int len = 0;
	for (len = 0; ; ++len) {
		char str[1000];
		std::cin >> str;
		if (str[0] == '0') break;
		int a;
		for (a = 0; str[a] != '\0'; ++a);
		for (int i = 0; i < a; ++i) {
			int tmp = str[i] - '0';
			sums[len] += tmp;
		}
	}
	for (int i = 0; i < len; ++i) {
		std::cout << sums[i] << std::endl;
	}
	
}



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

using namespace std;

int main(){
    string str;
    cin >> str;

    for(int i=2;i<str.size();i=i+2){
        for(int j=0;j<(str.size()-i)/2;j++){
            //cout << "i,j=" << i << "," << j << ":" << str[j] << "&" << str[j+(str.size()-i)/2] << endl;
            if(str[j]!=str[j+(str.size()-i)/2])break;
            if(j==((str.size()-i)/2)-1){
                cout << str.size()-i << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
//dlang template---{{{
import std.stdio;
import std.conv;
import std.string;
import std.array;
import std.algorithm;
import std.typecons;
import std.math;
import std.range;

// MIT-License https://github.com/kurokoji/nephele
class Scanner
{
  import std.stdio : File, stdin;
  import std.conv : to;
  import std.array : split;
  import std.string;
  import std.traits : isSomeString;

  private File file;
  private char[][] str;
  private size_t idx;

  this(File file = stdin)
  {
    this.file = file;
    this.idx = 0;
  }

  this(StrType)(StrType s, File file = stdin) if (isSomeString!(StrType))
  {
    this.file = file;
    this.idx = 0;
    fromString(s);
  }

  private char[] next()
  {
    if (idx < str.length)
    {
      return str[idx++];
    }

    char[] s;
    while (s.length == 0)
    {
      s = file.readln.strip.to!(char[]);
    }

    str = s.split;
    idx = 0;

    return str[idx++];
  }

  T next(T)()
  {
    return next.to!(T);
  }

  T[] nextArray(T)(size_t len)
  {
    T[] ret = new T[len];

    foreach (ref c; ret)
    {
      c = next!(T);
    }

    return ret;
  }

  void scan()()
  {
  }

  void scan(T, S...)(ref T x, ref S args)
  {
    x = next!(T);
    scan(args);
  }

  void fromString(StrType)(StrType s) if (isSomeString!(StrType))
  {
    str ~= s.to!(char[]).strip.split;
  }
}
//}}}

void main() {
  Scanner sc = new Scanner;

  int N;

  sc.scan(N);

  auto convChar = to!string(N);

  foreach (i; convChar) {
    if (i == '7') {
      writeln("Yes");
      return;
    }
  }

  writeln("No");
}


Measured memory_bytes: 2736
using System;
using System.Collections.Generic;
using System.Linq;

namespace kakomon
{
    class Program
    {
        static void Main(string[] args)
        {
            agc006_a();
        }

        static void agc006_a()
        {
            // A - Prefix and Suffix
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            string t = Console.ReadLine();
            int ans = 0;
            // 頭揃えた状態からtを1つずつ後ろにずらしていく
            for (int i=0; i<n; i++)
            {
                // 比較するsとtの部分文字列
                string s_part = s.Substring(i);
                string t_part = t.Substring(0, n-i);
                // 一致したら答えを生成
                if (s_part.Equals(t_part))
                {
                    ans = n + i;
                    break;
                }
            }
            // ansがnullのままだったら、一致しなかったので、単純に結合
            if (ans == 0) ans = 2 * n;
            // 答えを出力
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int LEN = 1e5 + 5;
int i, j, k, n, m, s, t, ans, now;
char c[LEN], nowc;
int main() {
    scanf("%s", c + 1);
    n = strlen(c + 1);
    now = 1, nowc = c[1];
    for (int i = 2; i <= n; i++) {
        if (c[i] != c[i - 1]) {
            ans++;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    int c[n], s[n], f[n];
    int i, j;
    for(i=1;i<n;i++) scanf("%d %d %d", &c[i], &s[i], &f[i]);
    
    int jikan[n+1];
    for(i=0;i<=n;i++) jikan[i] = 0;
    
    for(i=1;i<n;i++){
        jikan[i] += s[i] + c[i];
        for(j=i+1;j<n;j++){
            if(jikan[i] <= s[j]) jikan[i] = s[j] + c[j];
            else if((jikan[i]-s[j])%f[j]==0) jikan[i] += c[j];
            else {
                int temp = jikan[i];
                jikan[i] = s[j];
                while(temp > jikan[i]) jikan[i] += f[j];
                jikan[i] += c[j];
            }
        }
    }
    
    for(i=1;i<=n;i++) printf("%d\n", jikan[i]);
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using P = pair <int,int>; //to, cost
using WeightedGraph = vector<vector <P>>; //to cost
const long long INF = 1LL << 60;
const int MOD = 1000000007;
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; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int n,k; cin>>n>>k;
    vector <int> a(n);
    rep(i,n) cin>>a[i]; 
    sort(a.begin(),a.end(),greater<int>());
    int ans = 0;
    rep(i,n){
        if(k) k--;
        else ans+=a[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
# include<stdio.h>
int main()
{
	int n,red,blue,i;
	char w;
	scanf("%d",&n);
	red=1;
	blue=0;
	for(i=1;i<=n+1;i++)
	{
		scanf("%c",&w);
		if(w=='R')
		{
			red++;
		}
		else
		{
			blue++;
		}
	}
	if(red>blue)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}

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

using namespace std;

int main(){
    int H,W,A,B;
    cin >> H >> W >> A >> B;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(j<A){
                if(i<B){
                    cout << 0;
                }else{
                    cout << 1;
                }
            }else{
                if(i<B){
                    cout << 1;
                }else{
                    cout << 0;
                }
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 1280
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    cout << a[0] + a[1];
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
S = input()
ans = 'keyence'

if(len(S) == 7 and ans==S):
    print('YES')
else:
    for i in range(7):
        if(S[i] == ans[i]):
            flag = True
        elif S[len(S)-7+i::] == ans[i::]:
            flag = True
            break
        else:
            flag = False
            break

    if(~flag):
        ans = ans[::-1]
        S = S[::-1]
        for i in range(7):
            if(S[i] == ans[i]):
                flag = True
            elif S[len(S)-7+i::] == ans[i::]:
                flag = True
                break
            else:
                flag = False
                break

    

    if(flag):
        print('YES')
    else:
        print('NO')


Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

typedef i32 RUQ_val;

typedef struct range_update_query {
  RUQ_val *val;
  int32_t size;
  int32_t bit;
  RUQ_val empty;
} RUQ;

RUQ* new_RUQ (const int32_t n) {
  int32_t k = 0;
  while ((1 << k) < n) ++k;
  RUQ *s = (RUQ *) calloc (1, sizeof (RUQ));
  s->val = (RUQ_val *) calloc (2 << k, sizeof (RUQ_val));
  s->size = 1 << k;
  s->bit = k;
  s->empty = -2;
  s->val[1] = -1;
  return s;
}

static inline void propagate (RUQ *s, int32_t k) {
  if (s->val[k] == s->empty) return;
  s->val[2 * k] = s->val[2 * k + 1] = s->val[k];
  s->val[k] = s->empty;
}

void update (RUQ *s, int32_t l, int32_t r, RUQ_val v) {
  for (int32_t i = s->bit; i > 0; --i) {
    propagate (s, (l + s->size) >> i);
    propagate (s, (r - 1 + s->size) >> i);
  }
  for (l += s->size, r += s->size; l < r; l >>= 1, r >>= 1) {
    if (l & 1) s->val[l++] = v;
    if (r & 1) s->val[--r] = v;
  }
}

RUQ_val find (RUQ *s, int32_t x) {
  x += s->size;
  for (int32_t i = s->bit; i >= 0; --i) {
    if (s->val[x >> i] != s->empty) {
      return s->val[x >> i];
    }
  }
  return s->empty;
}

typedef struct node {
  i32 s, t, x;
} node;

int cmp_node (const void *a, const void *b) {
  i32 d = ((node *)a)->x - ((node *)b)->x;
  return d == 0 ? 0 : d > 0 ? -1 : 1;
}

int cmp_int (const void *a, const void *b) {
  i32 d = *(i32 *)a - *(i32 *)b;
  return d == 0 ? 0 : d < 0 ? -1 : 1;
}

i32 to_index (i32 *z, i32 len, i32 v) {
  i32 l = 0;
  i32 r = len;
  while (r - l > 1) {
    i32 m = (l + r) / 2;
    if (z[m] <= v) {
      l = m;
    } else {
      r = m;
    }
  }
  return l;
}

void run (void) {
  i32 n, q;
  scanf ("%" SCNi32 "%" SCNi32, &n, &q);
  node *p = (node *) calloc (n, sizeof (node));
  i32 *d = (i32 *) calloc (q, sizeof (i32));
  i32 *z = (i32 *) calloc (2 * n + q, sizeof (i32));
  for (i32 i = 0; i < n; ++i) {
    i32 s, t, x;
    scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &s, &t, &x);
    p[i] = (node) {s - x, t - x, x};
    z[i] = s - x;
    z[i + n] = t - x;
  }
  for (i32 i = 0; i < q; ++i) {
    scanf ("%" SCNi32, d + i);
    z[2 * n + i] = d[i];
  }
  qsort (p, n, sizeof (node), cmp_node);
  qsort (z, 2 * n + q, sizeof (i32), cmp_int);
  i32 len = 1;
  for (i32 i = 1; i < 2 * n + q; ++i) {
    if (z[i] == z[len - 1]) continue;
    z[len++] = z[i];
  }
  RUQ *s = new_RUQ (len);
  for (i32 i = 0; i < n; ++i) {
    i32 l = to_index (z, len, p[i].s);
    i32 r = to_index (z, len, p[i].t);
    update (s, l, r, p[i].x);
  }
  for (i32 i = 0; i < q; ++i) {
    i32 k = to_index (z, len, d[i]);
    i32 v = find (s, k);
    printf ("%" PRIi32 "\n", v);
  }
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 15828
/*
 *
 * Copyright(c) 2017 Taikai Takeda <297.1951@gmail.com> All rights reserved.
 *
 */
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

class BIT {
    vector<int> bit;
    int m;
public:
    BIT(int m): m(m), bit(m+1, 0){};
    BIT(vector<int> & a): m(a.size()+1), bit(a.size()+1, 0){
        for (int i = 1; i < m; i++) {
            add(i, a[i-1]);
        }
    };

    void add(int i, int val){
        if (i <= m){
            bit[i] += val;
            add(i + (- i & i), val);
        }
    };
    int csum(int i){
        if (i <= 0)
            return 0;
        return bit[i] + csum(i - (-i & i));
    };
    // sum of ragne [i, j]
    int sumr(int i, int j){
        return csum(j) - csum(i - 1);
    };
};


//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    VVI ls(m + 2);
    REP(i, n){
    	int l, r;
    	cin >> l >> r;
    	r++;
    	ls[r-l].push_back(l);
    }

    BIT bit(m+2);

    int base = n;

    for (int d = 1; d <= m; ++d) {
    	for(auto l: ls[d-1]) {
    		int r = l + d-1;
    		bit.add(l, 1);
    		bit.add(r, -1);
    	}
    	base -= ls[d-1].size();
    	int ans = base;
    	for (int i = d; i <= m; i += d){

    		ans += bit.csum(i);
    	}      	
    	cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 6784
def _3():
    from collections import defaultdict

    def can_pair(s1, s2):
        l = []
        for c1, c2 in zip(s1, s2):
            c = sorted([c1, c2])
            if c in l:
                l.remove(c)
            else:
                l.append(c)

        if len(s1) % 2 == 0:
            return len(l) == 0
        else:
            if len(l) == 1:
                if l[0][0] == l[0][1]:
                    return True
            return False

    def pair_graph(s1, s2):
        N = len(s1)
        G = np.zeros([N, N])
        for i in range(N):
            for j in range(i+1, N):
                if s1[i] == s2[j] and s1[j] == s2[i]:
                    G[i, j] = 1
                    G[j, i] = 1
        return G

    import numpy as np
    H, W = list(map(int, input().split(' ')))
    S = []
    d = defaultdict(list)

    for h in range(H):
        s = input()
        S.append(s)
        d[''.join(sorted(S))].append(h)

    already_paired = np.zeros(H)

    Gs = []

    for i in range(H):
        if already_paired[i]:
            continue

        for j in range(i+1, H):
            if already_paired[j]:
                continue

            if can_pair(S[i], S[j]):
                already_paired[i] = 1
                already_paired[j] = 1
                G = pair_graph(S[i], S[j])
                Gs.append(G)
                break

    if already_paired.sum() < H - 1:
        print('NO')
        exit()

    elif already_paired.sum() == H - 1:
        for i in range(H):
            if already_paired[i] == 0:
                G = pair_graph(S[i], S[i])
                Gs.append(G)
                break

    G = np.array(Gs).sum(axis=0) // len(Gs)

    def is_perfect_matching(G):
        N = len(G)
        if N == 1:
            return True

        for i in range(N):
            for j in range(i+1, N):
                if G[i, j] == 1:
                    l = list(range(N))
                    l.remove(i)
                    l.remove(j)
                    if len(l) == 0:
                        return True
                    if is_perfect_matching(G[l][:, l]):
                        return True
        return False

    if is_perfect_matching(G):
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    _3()

Measured memory_bytes: 18284
#include <iostream>

#include<vector>

#include<string>

#include<algorithm>

#include<cmath>

#include<cstdlib>

#include<utility> 

#include<cstdio> 

#define vii vector< pair<int,int> >

#define vi vector<int>

#define INF 1000000007

#define ff first

#define ss second

#define lli long long int

#define ulli unsigned long long int

using namespace std;

int main() {

 ios_base::sync_with_stdio(false);

    cin.tie(NULL);

  int n;

  cin>>n;

  if(n>=30)

    cout<<"Yes";

    else cout<<"No";

 

}



Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int m[2], d[2];
	REP(i, 2) {
		cin >> m[i] >> d[i];
	}

	if (m[1] == m[0] + 1) {
		cout << "1\n";
	}
	else {
		cout << "0\n";
	}

	return 0;
}


Measured memory_bytes: 256
line = gets.split(' ')
line = line.map { |x| x.to_i }

N = line[0]
X = line[1]
T = line[2]

A = N.to_f / X.to_f

if A == N / X
  total_time = (N / X) * T
else
  total_time = (N / X + 1) * T
end

p total_time

Measured memory_bytes: 14228
from numpy.fft import rfft, irfft
import numpy as np

N, M = map(int, input().split())
A = list(map(int, input().split()))

a = np.bincount(A, minlength=2 ** 18)

fa = rfft(a)
a2 = irfft(fa ** 2)
a2 = np.round(a2).astype(np.int)

cum_a2 = np.cumsum(a2)

index = np.searchsorted(cum_a2, N ** 2 - M)

a2[index] -= cum_a2[index] - (N ** 2 - M)

ans = sum(A) * 2 * N - (a2[: index + 1] * np.arange(index + 1)).sum()
print(ans)


Measured memory_bytes: 35776
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

bool solve(string s){
    int n = (int)s.size();

    if(n & 1){
        return false;
    }

    for(int i = 0 ; i < n ; i += 2){
        if(s[i] != 'h' || s[i + 1] != 'i'){
            return false;
        }
    }

    return true;
}

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

    string s;
    cin >> s;

    if(solve(s)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    cout << flush;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int n;
ll memo[100100],h[100100];
bool done[100100];

ll solve(int i){
	if(done[i]){
		return memo[i];
	}
	done[i] = true;
	if(i==n-1){
		memo[i] = 0ll;
		return memo[i];
	}else if(i==(n-2)){
		memo[i] = abs(h[n-1]-h[n-2]);
		return memo[i];
	}
	memo[i] = min(solve(i+1)+abs(h[i]-h[i+1]),solve(i+2)+abs(h[i]-h[i+2]));
	return memo[i];
}

int main(void){
	int i;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> h[i];
	}
	cout << solve(0) << endl;
	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define M 7368800
int a[M];
int main(){
  int i,j,n,m;
  while(cin>>n>>m,n,m){
   int c=0;
   for(i=0;i<M;i++)a[i]=0;
    for(i=0;i<n;i++)a[i]++;
    for(i=0;i<m;i++){
      while(a[c])c++;
      for(j=c;j<M;j+=c)a[j]++;
    }
  for(;a[c];c++){}
    cout<<c<<endl;
  }
}

Measured memory_bytes: 31856
#include <bits/stdc++.h>
using namespace std;
#define F(i,a,b) for(long long int i=a;i<b;i++)
#define f(i,n) for(long long int i=0;i<n;i++)
typedef unsigned long long ull;
typedef long long ll;
#define vint vector<int>
#define vll vector<long long int>
#define pb(a) push_back(a);
#define bug(x) cout<<#x<<" = "<<x<<"\n";
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)

int main(){
	fastio;
	int t; cin>>t;
  map<char,int> m;
	while(t--){
		string s;
      cin>>s;
      
      if(s[0]=='A') m['A']++;
      else if(s[0]=='W') m['W']++;
      else if(s[0]=='T') m['T']++;
      else{m['R']+=1;}
		
	}
  cout<<"AC x "<<m['A']<<"\n";
    cout<<"WA x "<<m['W']<<"\n";
    cout<<"TLE x "<<m['T']<<"\n";
    cout<<"RE x "<<m['R']<<"\n";
	return 0;
}

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

#define PI 3.14159265358979323846
#define int long long int
#define ff first
#define ss second
#define pb push_back

#define N 1010
#define MOD 1000000007

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

    double n;
    cin >> n;

    double k = (int) (n / 1.08);

    if (floor(k * 1.08) == n)
    	cout << k;
    else if (floor((k + 1) * 1.08) == n)
    	cout << k + 1;
    else
    	cout << ":(";
   	return 0;	
   		
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int s,w;
    cin>>s>>w;
    if(s<=w) cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
}


Measured memory_bytes: 3556
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    for _ in range(K):
        m = True
        a = [0] * N
        t = 0
        for i in range(N):
            t += a[i] + 1
            if i + A[i] + 1< N:
                a[i + A[i] + 1] -= 1
            a[i] = t
        t = 0
        b = [0] * N
        for i in reversed(range(N)):
            t += b[i]
            b[i] = t
            t += 1
            if i - A[i] - 1 >= 0:
                b[i - A[i] - 1] -= 1
            A[i] = a[i] + b[i]
            if A[i] < N:
                m = False
        if m:
            break
    return A

print(*main())


Measured memory_bytes: 124804
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int a[1111][1111];
int b[1111][1111];

void prep(int n, int m)
{
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			b[i][j]=a[i][j];
			if(i) b[i][j]^=b[i-1][j];
			if(j) b[i][j]^=b[i][j-1];
			if(i>0&&j>0) b[i][j]^=b[i-1][j-1];
		}
	}
}

int calc(int n, int m)
{
	int ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			for(int i2=i;i2<n;i2++)
			{
				for(int j2=j;j2<m;j2++)
				{
					int cur=b[i2][j2];
					if(i) cur^=b[i-1][j2];
					if(j) cur^=b[i2][j-1];
					if(i>0&&j>0) cur^=b[i-1][j-1];
					//if(cur) cerr<<i<<' '<<j<<' '<<i2<<' '<<j2<<'\n';
					ans+=cur;
				}
			}
		}
	}
	return ans;
}

void naive(int n, int m)
{
	int ans=-1;
	vector<vi> vec;
	int N=(1<<n)-1; int M=(1<<m)-1;
	N++; M++;
	for(int i=0;i<(1<<(((N-1)/2)*((M-1)/2)));i++)
	{
		int bit=i^((1<<(((N-1)/2)*((M-1)/2)))-1);
		for(int j=0;j<N;j++)
		{
			for(int k=0;k<M;k++) a[j][k]=1;
		}
		for(int j=1;j<N;j+=2)
		{
			for(int k=1;k<M;k+=2)
			{
				a[j][k]=bit&1;
				bit>>=1;
			}
		}
		for(int j=0;j<2*N-1;j++)
		{
			for(int k=0;k<2*M-1;k++)
			{
				a[j][k]=a[min(j,2*N-2-j)][min(k,2*M-2-k)];
			}
		}
		prep(2*N-1,2*M-1);
		int cc = calc(2*N-1,2*M-1);
		if(cc>ans)
		{
			vec.clear();
			vec.resize(2*N-1);
			for(int j=0;j<2*N-1;j++)
			{
				vec[j].resize(2*M-1);
				for(int k=0;k<2*M-1;k++) vec[j][k]=a[j][k];
			}
			ans=cc;
		}
	}
	cout<<"ANS: "<<ans<<'\n';
	for(int i=0;i<2*N-1;i++)
	{
		for(int j=0;j<2*M-1;j++)
		{
			cout<<vec[i][j];
		}
		cout<<'\n';
	}
}

void solve(int xl, int xr, int yl, int yr)
{
	if(xl==xr)
	{
		a[xl][yl]=1;
		return ;
	}
	int xm=(xl+xr)>>1; int ym=(yl+yr)>>1;
	a[xm][ym]=1;
	solve(xl,xm-1,yl,ym-1);
	solve(xl,xm-1,ym+1,yr);
	solve(xm+1,xr,yl,ym-1);
	solve(xm+1,xr,ym+1,yr);
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m; cin>>n>>m;
	int mx=max(n,m);
	solve(0,(1<<mx)-2,0,(1<<mx)-2);
	for(int i=0;i<(1<<n)-1;i++)
	{
		for(int j=0;j<(1<<m)-1;j++)
		{
			cout<<a[i][j];
		}
		cout<<'\n';
	}
}


Measured memory_bytes: 6400
using System;

namespace ABC152A
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] str = Console.ReadLine().Split(' ');
			int n = int.Parse(str[0]);
			int m = int.Parse(str[1]);
			Console.WriteLine(n == m ? "Yes" : "No");
		}
	}
}


Measured memory_bytes: 13140