akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

// https://qiita.com/pata_/items/e7cfdbbb4414cf13e715
void solve() {
    int n, q;
    cin >> n >> q;
    
    using t = tuple<int, int, int>;
    vector<t> ev; // 時刻, 場所,
    rep(i, n) {
        int s, t, x;
        cin >> s >> t >> x;
        ev.eb(s - x, 1, x);
        ev.eb(t - x, -1, x);
    }
    sort(all(ev), greater<>());
    
    vector<int> d(q);
    cin >> d;
    
    multiset<int> s;
    rep(i, q) { // 時間を走査して, 通行止めの場所をmultisetでもつ
        while (sz(ev)) {
            int t, k, x;
            tie(t, k, x) = ev.back();
            if (t <= d[i]) {
                ev.pop_back();
                if (k == 1) s.emplace(x);
                else s.erase(s.find(x));
            } else {
                break;
            }
        }
        if (sz(s)) cout << *s.begin() << endl;
        else cout << -1 << endl;
    }
}


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

using namespace std;

typedef long long int Int;

bool check(Int g,Int p)
{
    return p <= g;
}

int main(void)
{
    string s;
    cin>>s;
    Int count_g,count_p = 0;

    for(int i = 0;i < s.size();i++)
    {
	if(s[i] == 'p')
	    count_p++;
    }
    count_g = s.size()-count_p;

    Int score = s.size()/2 - count_p;

    cout<<score<<endl;


    return 0;
}


Measured memory_bytes: 512
def f_minimum_bounding_box(N, Positions, INF=float('inf')):
    # 参考: https://betrue12.hateblo.jp/entry/2019/06/17/202327
    X, Y = [{'L': [], 'R': [], 'U': [], 'D': []} for _ in range(2)]
    for x, y, d in Positions:
        X[d].append(int(x) * 2)
        Y[d].append(int(y) * 2)

    xs, ys = [], []
    for c in 'LRUD':
        if len(X[c]) != 0:
            xs.extend((max(X[c]), min(X[c])))
        if len(Y[c]) != 0:
            ys.extend((max(Y[c]), min(Y[c])))

    cand = []
    for x1 in xs:
        for x2 in xs:
            d = abs(x1 - x2)
            cand.extend((d, d // 2))
    for y1 in ys:
        for y2 in ys:
            d = abs(y1 - y2)
            cand.extend((d, d // 2))

    dx = {'L': -1, 'R': 1, 'U': 0, 'D': 0}
    dy = {'L': 0, 'R': 0, 'U': 1, 'D': -1}
    ans = INF
    for d in cand:
        xmax, ymax, xmin, ymin = -INF, -INF, INF, INF
        for c in 'LRUD':
            for i in range(len(X[c])):
                x = X[c][i] + dx[c] * d
                xmax = max(xmax, x)
                xmin = min(xmin, x)
            for j in range(len(Y[c])):
                y = Y[c][j] + dy[c] * d
                ymax = max(ymax, y)
                ymin = min(ymin, y)
        tmp = (xmax - xmin) * (ymax - ymin)
        ans = min(ans, tmp)
    return round(ans / 4, 12)

N = int(input())
Positions = [[i for i in input().split()] for j in range(N)]
print(f_minimum_bounding_box(N, Positions))

Measured memory_bytes: 85544
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<ll>
#define vvint vector<vint>
#define P pair<ll,ll>
#define INT_MAX 2147483647
#define MOD 998244353
#define PI 3.14159265358979323846
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

#define MAX 1000000000000


int main(void) {
	ll A, B, C, D; cin >> A >> B >> C >> D;
	vvint dp(C-A+1, vint(D-B+1));
	ll x=1,y=1;
	ll w = C - A, h = D - B;
	for (int i = 1; i <= w; i++) {
		x = (x * B)%MOD;
		dp[i][0] = x;
	}

	for (int i = 1; i <= h; i++) {
		y = (y * A) % MOD;
		dp[0][i] = y;
	}
	dp[0][0] = 1;

	for (ll i = 1; i <= w; i++) {
		for (ll j = 1; j <= h; j++) {
			int a = ((j+B)*dp[i - 1][j] + (i+A)*dp[i][j - 1]-dp[i-1][j-1]*(i+A-1)*(j+B-1))%MOD;

			if (a < 0) {
				dp[i][j] = a + MOD;
			}
			else {
				dp[i][j] = a;
			}
		}
	}
	cout << dp[w][h] << endl;
	return 0;
}

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


int main(){

    int N, ans=0;
    cin >> N;
    vector<int> B(N-1);
    for(int i=0;i<N;i++) cin >> B[i];
    ans += B[0]+B[N-2];

    for(int i=0;i<N-2;i++){
        ans += min(B[i], B[i+1]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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)*}
    };
}

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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        mut k: u64,
        mut ab: [(usize, u64); n],
    }
    let mut v = vec![0; 100_000 + 1];
    for i in 0..n {
        let (a, b) = ab[i];
        v[a] += b;
    }
    let mut cnt = 0;
    for i in 0..v.len() {
        cnt += v[i];
        if cnt >= k {
            println!("{}", i);
            return;
        }
    }
    panic!()
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

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

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

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

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

    ll n, m;
    cin >> n >> m;
    vector<vector<ll>> dist(n, vector<ll>(n, LLINF));
    REP(i, n) dist[i][i] = 0;
    REP(i, m) {
        ll a, b;
        cin >> a >> b;
        a--, b--;
        dist[a][b] = 0;
    }
    REP(k, n) REP(i, n) REP(j, n) chmin(dist[i][j], dist[i][k]+dist[k][j]);

    REP(i, n) {
        vector<ll> v;
        REP(j, n) if(dist[i][j] == 0 && dist[j][i] == 0) v.push_back(j);
        REP(i, v.size()) cout << v[i]+1 << (i+1==v.size()?'\n':' ');
    }

    return 0;
}



Measured memory_bytes: 3668
/**
 *    author:  [itmo] enot.1.10
 *    created: 03.04.2017 19:57:58       
**/
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(),a.end()
#define pw(x) (1LL<<(x))

using namespace std;

typedef long long ll;
typedef double dbl;
typedef vector<int> vi;
typedef pair<int, int> pi;

const int inf = 1.01e9;
const dbl eps = 1e-9;

/* --- main part --- */

const int N = 3e5 + 10;

int a[N];

int main()
{
    #ifdef home
        assert(freopen("1.in", "r", stdin));
        assert(freopen("1.out", "w", stdout));
    #endif
    int n;    
    scanf("%d", &n);
    forn(i, n * 3) scanf("%d", a + i);
    sort(a, a + n * 3);
    ll res = 0;
    for (int i = n; i < 3 * n; i += 2) res += a[i];
    printf("%lld\n", res);
    #ifdef home
        eprintf("time = %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
    #endif
    return 0;
}


Measured memory_bytes: 1408
h, n = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]
inf = 10 ** 9
dp = [inf for _ in range(h + 1)]
dp[0] = 0

for i in range(n):
    a, b = ab[i]
    for j in range(h):
        if dp[j] < inf:
            jj = min(j + a, h)
            dp[jj] = min(dp[j] + b, dp[jj])
print(dp[-1])


Measured memory_bytes: 42988
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <math.h>

typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<pair<pair<string, int>, int> > score;
    for(int i=0; i<n; ++i){
        string s;
        int p;
        cin >> s >> p;
        auto pp = make_pair(make_pair(s, p), i+1);
        score.push_back(pp);
    }
    sort(score.begin(), score.end(), [](auto a, auto b){
        return a.first.second > b.first.second;
    });
    stable_sort(score.begin(), score.end(), [](auto a, auto b){
        return a.first.first < b.first.first;
    });
    for(int i=0; i<n; ++i){
        cout << score[i].second << endl;
    }
    return 0;
}



Measured memory_bytes: 888
S = [s for s in input()]
p = int(input())
for _ in range(p):
	sy = input().split(' ')
	op = sy[0]
	a = int(sy[1])
	b = int(sy[2])
	if op == 'print':
		sh = ''
		for i in range(a,b+1): sh += S[i]
		print(sh)
	elif op == 'reverse':
		pick = []
		for i in range(a,b+1): pick.append(S.pop(a))
		for i,r in enumerate(reversed(pick)): S.insert(a+i, r)
	elif op == 'replace':
		q = [s for s in sy[3]]
		for i,s in enumerate(q):
			S.pop(a+i)
			S.insert(a+i, s)
		


Measured memory_bytes: 7760
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
using namespace std;
typedef long long ll;
//#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i =0;i<n;++i)
//#define mod (ll)(1e9+7)
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
  	int tmp = N;
    int S=0;
    while(N>0){
        S+=N%10;
        N/=10;
    }
    if(tmp%S==0) cout<< "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, map) for(auto it = m.begin(); it != m.end(); it++)

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N, M, sum = 0; cin >> N >> M;
    map<ll, ll> m;
    REP(i, N){
        ll a; cin >> a; sum = (sum + a) % M; m[sum]++;
    }
    ll ret = 0;
    FORMAP(it, m){
        if(it->first == 0) ret += it->second;
        ret += (it->second - 1) * (it->second) / 2;
    }
    cout << ret << endstr;
    return 0;
}


Measured memory_bytes: 4224
/*  ex2_3
    kosaq       */

#include <stdio.h>

int main(void){
    int length;      // The length of one side of square
    int white;      // The number of white

    // The number of black is (length * length) - white

    scanf("%d" "%d", &length, &white);       // input length and white
    printf("%d\n", length * length - white);      // output the number of black
    return 0;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;

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

    if (X == 3 || X == 5 || X == 7) {
        cout << "YES";
    }
    else {
        cout << "NO";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

int a, b;

void _main() {
    cin >> a >> b;
    if (a % 2 == 1 && b % 2 == 1) cout << "Odd" << endl;
    else cout << "Even" << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("output.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

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

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

		int n = sc.nextInt();
		int m = sc.nextInt();

		long[][] ab = new long[n][2];

		for (int i = 0; i < n; i++) {
			ab[i][0] = sc.nextInt();
			ab[i][1] = sc.nextInt();
		}

		Arrays.sort(ab, (a, b) -> Long.compare(a[0], b[0]));

//		// debug
//		for (int[] arr : ab) {
//			for (int i : arr) {
//				System.out.print(i + " ");
//			}
//			System.out.println();
//		}

		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (m < ab[i][1]) {
				ans += ab[i][0] * m;
				break;
			}
			ans += ab[i][0] * ab[i][1];
			m -= ab[i][1];
		}

		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 93048
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n,m;
  cin>>n>>m;
  
  int x;
  int B[10]={0,2,5,5,4,5,6,3,7,6};
  vector<int> A(10),C(10);
  rep(i,m){
    cin>>x;
    A[x]=1;
    C[B[x]]=1;
  }
  
  int dp[10010];
  rep(i,10010) dp[i]=-1;
  dp[0]=0;
  
  for(int i=2;i<=n;i++){
    for(int j=2;j<=7;j++){
      if(C[j]==1 && i-j>=0 && dp[i-j]!=-1 && dp[i]<dp[i-j]+1) dp[i]=dp[i-j]+1;
    }
  }
    
  for(int i=9;i>0;i--){
    if(A[i]==0) continue;
    while(n-B[i]>=0 && dp[n-B[i]]==dp[n]-1){
      cout<<i;
      n-=B[i];
    }
  }
  cout<<endl;
  
  return 0;
}

Measured memory_bytes: 3556
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int main() {

    int n;
    scanf("%d", &n);
    vector<int> num(100000, 0);
    for (int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        num[a]++;
    }

    int ans = 0;
    for (int i = 0; i < 100000; i++) {
        int score = num[i];
        if (i == 0) {
            score += num[1];
        } else if (i == 99999) {
            score += num[99998];
        } else {
            score = score + num[i - 1] + num[i + 1];
        }
        ans = max(score, ans);
    }
    printf("%d\n", ans);

    return 0;
}

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

long long gcd(long long a, long long b)
{
    if (b == 0) return a;
    return gcd(b, a%b);
}

int main()
{
    long long a, b;
    cin >> a >> b;
    cout << a * b / gcd(min(a, b), max(a, b)) << "\n";
}


Measured memory_bytes: 256
# coding: utf-8
class UnionFind:
    def __init__(self, node_num):
        self._rank = [0] * node_num
        self._par  = [i for i in range(node_num)]
        self.N    =  node_num

    def _find(self, x):
        if self._par[x] == x:
            return x
        else:
            self._par[x] = self._find(self._par[x])
            return self._par[x]

    def merge(self, x, y):
        x = self._find(x)
        y = self._find(y)
        if x == y: return

        if self._rank[x] < self._rank[y]:
            self._par[x] = y
        else:
            self._par[y] = x
            if self._rank[x] == self._rank[y]:
                self._rank[y] += 1

    def is_same(self, x, y):
        return self._find(x) == self._find(y)


N, Q = map(int, input().split())
uf = UnionFind(N)
for _ in range(Q):
    C, X, Y = map(int, input().split())

    if C == 0:
        uf.merge(X, Y)
    else:
        print(1 if uf.is_same(X, Y) else 0)

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

int main() {
  int N; 
  int ans = 0;

  cin >> N;
  while (N > 0)
  {
    ans += N % 10;
    N /= 10;
  }
  if (ans == 1)
    ans = 10;
  cout << ans << endl;
}

Measured memory_bytes: 256
// G++ MACro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){
  CIN(x,y);
  int ans=0;
  if(x==y)ans=0;
  else if(abs(x)<=abs(y)){//絶対値が増加しているなら
    if(x>=0&&y>=0)ans=y-x;
    else if((x>=0&&y<0)||(x<0&&y>=0))ans=abs(y)-abs(x)+1;
    else ans=abs(y)-abs(x)+2;
  }else{
    if(x>=0&&y>=0)ans=min(abs(y)+abs(x)+1,x-y+2);
    else if(x>=0&&y<0)ans=x+y+1;
    else if(x<0&&y>=0)ans=min(abs(x)+y,abs(x)-abs(y)+1);
    else ans=abs(x)-abs(y);
  }
  COUT(ans);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int SIZE = 100005;
vector<int> friends[SIZE], block[SIZE];
class DisjointSet {
    public:
        vector<int> rank, p, num;

        DisjointSet() {}
        DisjointSet(int size) {
            rank.resize(size, 0);
            p.resize(size, 0);
            num.resize(size, 1);
            for (int i=0; i<size; i++) makeSet(i);
        }

        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x, int y) {
            return findSet(x) == findSet(y);
        }

        void unite(int x, int y) {
            link(findSet(x), findSet(y));
        }
        
        void link(int x, int y) {
            if (x == y) return;
            if (rank[x] > rank[y]){
                p[y] = x;
                num[x] += num[y];
            } else
            {
                num[y] += num[x];
                p[x] = y;
                if (rank[x] == rank[y])
                {
                    rank[y]++;
                }
            }
        }
        
        int findSet(int x){                         //経路圧縮して、親の値を返す
            if (x != p[x]) {
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
        int Num(int x){
            return num[findSet(x)];
        }
};
int main(){
    int n, m, k;
    cin >> n >> m >> k;
    DisjointSet d = DisjointSet(n);
    int x, y;
    for (int i = 0; i < m; i++){
        cin >> x >> y;
        d.unite(x-1, y-1);
        friends[x-1].push_back(y-1);
        friends[y-1].push_back(x-1);
    }
    for (int i = 0; i < k; i++){
        cin >> x >> y;
        block[x-1].push_back(y-1);
        block[y-1].push_back(x-1);
    }
    for (int i = 0; i < n; i++)
    {
        int ans = d.Num(i) - int(friends[i].size()) - 1;
        for (int j = 0; j < block[i].size(); j++)
        {
            if (d.same(i, block[i][j]))
            {
                ans--;
            }
            
        }
        cout << ans << " ";
    }
    cout << endl;
}

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

int main()
{   int flag=0;
string s;
    cin>>s;
    s[2]==s[3]?flag++:flag=flag;
    s[4]==s[5]?flag++:flag=flag;
    flag==2?cout<<"Yes" :cout<<"No";
    return 0;
}


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

typedef long long ll;
typedef long double ld;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN

#define fi first
#define se second
#define pb push_back



/////////////////////GCD//////////////////////
ll gcd(ll a, ll b)
{
	if(b==0) return a;
	return gcd(b, a%b);
}


////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	vector<int> a(n), count(n, 0);
	for(int i = 1; i < n; i++)
	{
		cin>>a[i];
		count[a[i]-1]++;
	}
	for(int i = 0; i < n; i++)
	{
		cout<<count[i]<<endl;
	}

}

Measured memory_bytes: 4788
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;


int main() {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  long long ans = -1;
  for(int i=0;i<(1<<(n-1));i++){
    bitset<14> b(i);
    int c = b.count();
    if(c == k-1){
      long long sum = 0;
      int saidai = a.at(0);
      for(int j=0;j<n-1;j++){
        if(b.test(j)){
          if(a.at(j+1) <= saidai){
            saidai++;
            sum += saidai-a.at(j+1);
          }
        }
        if(a.at(j+1)>saidai){
          saidai = a.at(j+1);
        }
      }
      if(ans < 0){
        ans = sum;
      }
      else{
        ans = min(ans,sum);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3608
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;


namespace atcorder2
{
    class Program
    {
        public static long Read()
        {

            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {


            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       
       
        public static long gcd(long x,long y)
        {
            if (x < y) gcd(y, x);
            
            while (y > 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }

        public static long lcm(long x,long y)
        {
            return x * y / gcd(x, y);
        }



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var n = Read();
           
            var d = new Dictionary<string, long>();
            for (int i = 0; i < n; i++)
            {
                var str = ReadLine();
                if (d.ContainsKey(str))
                    d[str]++;
                else
                    d[str] = 1;
            }
            WriteLine(d.Count);
           
          
            Console.Out.Flush();
        }
    }
}




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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string a;
	cin >> a;
	if( a == "ABC" ) cout << "ARC" << '\n';
	else cout << "ABC" << '\n';
	return 0;
}


Measured memory_bytes: 3100
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<numeric>
using namespace std;
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
#define INF 1e+8
#define EPS 1e-7
#define PB push_back
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
typedef pair<int,int> Pii;
typedef vector<int> vi;
int main(){
    int ma;
    while(scanf("%d",&ma),ma){
        int n;
        int stage[256]={0};
        int D[256][256]={{0}};
        scanf("%d",&n);
        reps(i,1,n+1){
            scanf("%d",&stage[i]);
        }
        rep(i,n+1){
            reps(j,1,ma+1){
                int tmp = i+j;
                if(stage[tmp]==0)D[i][tmp] = 1;
                else if(stage[tmp]>0){
                    if(tmp+stage[tmp]>n+1)tmp = n+1;
                    else tmp += stage[tmp];
                    D[i][tmp] = 1;
                }
                else{
                    if(tmp+stage[tmp]<0)tmp = 0;
                    else tmp += stage[tmp];
                    D[i][tmp] =  1;
                }
            }
        }
        rep(k,n+2){
            rep(i,n+2){
                rep(j,n+2){
                    if(D[i][k] && D[k][j]){
                        D[i][j] = 1;
                    }
                }
            }
        }
        /*
        puts("--------------------------");
        rep(i,n+2){
            rep(j,n+2){
                printf("%d ",D[i][j]);
            }
            puts("");
        }
        puts("--------------------------");
        */
        bool flg = true;
        rep(i,n+1){
            if(D[0][i] && !D[i][n+1]){
                flg = false;
                break;
            }
        }
        flg ? puts("OK") : puts("NG");
    }
    return 0;
}

Measured memory_bytes: 1432
#include<math.h>
#include<stdio.h>
int zettaiti(int n){
  if(n<0){n=-n;}
  return n;
}


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

  if(n==0){printf("0");return 0;}

  i=0;
  while(n!=0){
    if((zettaiti(n))%2==0){
      S[i]=0;}else{S[i]=1;}
    n=n-S[i]*pow(-1,i);
    n=n/2;
    i++;
  }

  for(j=i-1;j>=0;j--){
    printf("%d",S[j]);
  }
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void){
	int tmp=0,a,b,c;
	
	scanf("%d %d %d",&a,&b,&c);
	if(a>c){
		tmp=a;
		a=c;
		c=tmp;
	}
	if(a>b){
		tmp=a;
		a=b;
		b=tmp;
	}
	if(b>c){
		tmp=b;
		b=c;
		c=tmp;
	}
	printf("%d %d %d\n",a,b,c);
	return 0;
}

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

int main(){
  long long S; cin >> S;
  long long b=S/1000000000,c=S%1000000000;
  if(b==0){
    cout << "0 0 1 0 0 " << S << endl;
  }else if(c==0){
    cout << "0 0 0 1000000000 " << b << " 0" << endl;
  }else{
    cout << "0 " << c << " " << b << " 0 " << b+1 << " 1000000000" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  char W[7][10]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  int M,D=0;
  int a,b,c,d,e,f,g=0;
  int days=0;
  int weeks=0;
  while(1){
    scanf("%d %d",&M,&D);
    if(M==0&&D==0)break;
    for(a=1;a<M;a++){
      if(a==2){
	days=days+29;
      }
      else if(a==4||a==6){
	days=days+30;
      }
      else if(a==9||a==11){
	days=days+30;
      }
      else{
	days=days+31;
      }
    }
    days=days+D;
    weeks=days%7;
    for(b=0;b<7;b++){
      if(weeks==b){
	printf("%s\n",W[b]);
      }
    }
    days=0;
    weeks=0;
  }
  return 0;
}

Measured memory_bytes: 580
import java.util.Scanner;
import java.lang.Math;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
	    int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        int max = Math.max(a, Math.max(b, c));      
        int sum = (int)Math.pow(2, k) * max + a + b + c - max;
        System.out.println(sum);
      
    }
}


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

using namespace std;

int main(void)
{
	int n,t;
	int res[200001]={0,};
	vector <pair<int,int>> x;

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

	cin >> n;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		x.push_back(make_pair(t,i));
	}

	sort(x.rbegin(),x.rend());

	for(int i=0;i<n;i++)
	{
		if(i<(n/2))
		{
			res[x[i].second] = x[(n/2)].first;
		}
		else
		{
			res[x[i].second] = x[(n/2)-1].first;
		}
	}

	for(int i=0;i<n;i++)
	{
		cout << res[i] << '\n';
	}



	return 0;
}

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

using namespace std;

int n, ans = INT_MAX;

int cal(int a) {
	int re = 0;
	while (a) {
		re += a % 10;
		a /= 10;
	}
	return re;
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; i++)
		ans = min(ans, cal(i) + cal(n - i));
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
const int maxn= 100010;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=0;
    cin>>n;
    cout<<pow(n,3)<<endl;
}

Measured memory_bytes: 256
A,V=map(int,input().split()) #A：鬼
B,W=map(int,input().split()) #B:逃走者
T=int(input())

dis=abs(A-B)
time=V-W #逃走者から見た鬼の秒速(鬼の方が早いとtime>0、それ以外の場合はtime<=0)

if time<=0:
  print('NO')
else:
  if time*T>=dis:
    print('YES')
  else:
    print('NO')


Measured memory_bytes: 9128
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>

using namespace std;
 
template <class T> using V = vector<T>;
 
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 long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;


 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
#define pb(a) push_back(a);
  
 

ll sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}




 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 


signed main() {
  ll n;
    cin>>n;
  vll A(n);
  FOR(i,0,n){
    cin>>A[i];
  }

  SORT(A);
  REV(A);
  if(n%2==1){
    A.pb(0);
  }
  ll s=A.sz;

  bl b=true;

  FOR(i,1,s){
    if(i%2==1){
      if(A[i]!=A[i-1]){
        b=false;
      }
    }

    else{
      if(A[i-1]!=A[i]+2){
        b=false;
      }
    }
  }

  ll ans=1;
  n/=2;
  
  if(b){
    while(n!=0){
      ans*=2;
      ans%=1000000007;
      n--;
    }
    cout<<ans<<endl;
  }
  else{
    cout<<0<<endl;
  }
}

Measured memory_bytes: 1536
n=int(input())
a=list(map(int,input().split()))
aset=set(a)
ans=1
if len(aset)>1:
    num1=a[0]
    num2=a[1]
    num3=2 #Ai<Ai+1 1  Ai>Ai+1 0
    if num1<num2:
        num3=1
    if num1>num2:
        num3=0
    for i in range(len(a)-2):
        num=a[2+i]
        if num3==2 and num2>num:
            num3=0
        if num3==2 and num2<num:
            num3=1
        if num3==0 and num2<num:
            ans+=1
            num3=2
        if num3==1 and num2>num:
            ans+=1
            num3=2
        num2=num
print(ans)


Measured memory_bytes: 20136
def main():


    #Union Find


    def find(x):
        if par[x] < 0:
            return x
        else:
            par[x] = find(par[x])
            return par[x]
    def unite(x,y):
        x = find(x)
        y = find(y)
        
        if x == y:
            return False
        else:
            if par[x] > par[y]:
                x,y = y,x
            par[x] += par[y]
            par[y] = x
            return True

    def same(x,y):
        return find(x) == find(y)

    def size(x):
        return -par[find(x)]

    n,m = map(int,input().split())
    par = [-1]*n

    for i in range(m):
        X,Y,Z = map(int,input().split())
        unite(X-1,Y-1)
    
    tank = set([])
    for i in range(n):
        tank.add(find(i))
    print(len(tank))

if __name__ == '__main__':
    main()


Measured memory_bytes: 12780
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,d[100];
    cin>>n;
    for(int i=0;i<n;i++){
		cin>>d[i];
	}
	sort(d,d+n);
	int f=d[0];
	int cnt;
	for(int i=1;i<n;i++){
		if(f==d[i]){
			cnt++;
		}
		f=d[i];
	}
	cout<<n-cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
S = input()

if S == 'SUN':
    print('7')
elif S == 'MON':
    print('6')
elif S == 'TUE':
    print('5')
elif S == 'WED':
    print('4')
elif S == 'THU':
    print('3')
elif S == 'FRI':
    print('2')
else:
    print('1')

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

int main()
{
    int n,c=0;
    scanf("%d",&n);
    while(1)
    {
        c=c+1000;
        if(c>=n)
            break;
    }
    if(c==n)
    {
        printf("0\n");

    }
    if(c>n)
    {
        printf("%d\n",c-n);
    }
    return 0;
}



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

int main(){
   const int MAX_A = 100000;
   int N;
   std::cin >> N;
   int a;
   std::vector<int> count(MAX_A+1,0);
   for(int i=0; i<N; ++i){
      std::cin >> a;
      count[a]++;
      count[a+1]++;
      count[a+2]++;
   }
   std::sort(count.begin(),count.end());

   std::cout << count[MAX_A] << std::endl;
   return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int N;
V<V<tuple<int,int>>> e;

V<int> memo;
void dfs(int ni) {
    REP(i,e[ni].size()) {
        int v, w;
        std::tie(v,w) = e[ni][i];
        if(memo[v] != -1) continue;
        if(w % 2 == 0) memo[v] = memo[ni];
        else memo[v] = 1 ^ memo[ni];
        dfs(v);
    }
}

int main(){
    INIT;
    cin >> N;
    e.resize(N+1);
    REP(i,N) {
        int u, v, w; cin >> u >> v >> w;
        e[u].push_back(make_tuple(v,w));
        e[v].push_back(make_tuple(u,w));
    }

    memo.resize(N+1,-1);
    memo[1] = 1;
    dfs(1);
    FOR(i,1,N+1) {
        cout << memo[i] << "\n";
    }
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll X, Y;

int main()
{
    cin >> X >> Y;

    ll ans = X % Y == 0 ? -1 : X;

    OUT(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int h[25];
int ans,n;
bool f=true;
int main() {
	cin>>n;
	for(int i=1; i<=n; i++) cin>>h[i];
	for(int i=1; i<=n; i++) {
		f=true;
		for(int j=i-1; j>0; j--) {
			if(h[i]<h[j]) {
				f=false;
				break;
			}
		}
		if(f==true)
			ans++;
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

ll n, k;

ll llmax(ll x, ll y){
	if (x > y) return x;
	return y;
}

bool is_ok(ll x, vector<ll> &a, vector<ll> &f){
	ll sum = 0;
	for (int i = 0; i < n; i++) sum += llmax(a[i] - x/f[i], 0);
	if (sum > k) return false;
	return true;
}

ll nibutan(ll ok, ll ng, vector<ll> &a, vector<ll> &f){
	if (ok - ng == 1) return ok;
	ll mid = (ok+ng)/2;
	if (is_ok(mid, a, f)) return nibutan(mid, ng, a, f);
	return nibutan(ok, mid, a, f);
}


int main(){
	ll sum = 0, maxa = 0, maxf = 0;
	cin >> n >> k;
	vector<ll> a(n), f(n);
	for (int i = 0; i < n; i++){
		cin >> a[i];
		sum += a[i];
		maxa = max(a[i], maxa);
	} 
	for (int i = 0; i < n; i++){
		 cin >> f[i];
		 maxf = max(f[i], maxf);
	}

	if (sum - k <= 0){
		cout << 0 << endl;
		return 0;
	}

	sort(a.begin(), a.end());
	sort(f.begin(), f.end(), greater<ll>());

	cout << nibutan(maxa*maxf, 0, a, f) << endl;
	return 0;
}



Measured memory_bytes: 3328
#include<iostream>

using namespace std;

int sum(int x) {
	int fx = 0;

	while (x > 0) {
		fx += x % 10;
		x /= 10;
	}
	return fx;
}


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

	

	if (n % sum(n) == 0) cout << "Yes" << endl;
	else cout << "No" << endl;



	return 0;
}

Measured memory_bytes: 256