akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  ll a[n];
  rep(i,n) R a[i];
  sort(a,a+n);
  ll sum=0;
  rep(i,n-1) sum+=a[i];
  if(sum>a[n-1]) pr("Yes");
  else pr("No");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;

int main(){

	int n, a[100], ans=0, cnt=0;
	bool flag[8];
	memset(flag, 1, sizeof(flag));
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a, a+n);
	for(int i=0; i<n; i++){
		if(flag[a[i]/400] && a[i]<3200){
			ans++;
			flag[a[i]/400]=false;
		}
		if(a[i]>=3200){
			if(ans==0){
				ans++;
			} else {
				cnt++;
			}
		}
	}
	cout << ans <<" "<< ans+cnt << endl;

	return 0;
}

Measured memory_bytes: 256
<?php

function chmin(&$a, $b) {
    if ($a > $b) {
        $a = $b;
    }
}

fscanf(STDIN, "%d", $n);
$h = explode(' ', trim(fgets(STDIN)));

$dp = array_fill(0, $n, PHP_INT_MAX);
$dp[0] = 0;
$dp[1] = abs($h[1] - $h[0]);

for ($i = 2; $i < $n; ++$i) {
    chmin($dp[$i], $dp[$i - 1] + abs($h[$i] - $h[$i - 1]));
    chmin($dp[$i], $dp[$i - 2] + abs($h[$i] - $h[$i - 2]));
}

echo $dp[$n - 1];


Measured memory_bytes: 16884
mod = 10 ** 9 + 7

# permutation
def prm(n,k,mod=10**9+7):
    res = 1
    for i in range(k):
        res = res * (n-i) % mod
    return res

def cmb(n,k,mod=10**9+7):
    return prm(n,k) * pow(prm(k,k),mod-2,mod) % mod

n, a, b = map(int, input().split())

#何も選ばない1通りを除く
ans = pow(2,n,mod) - 1 - cmb(n,a) - cmb(n,b)
print(ans % mod)

Measured memory_bytes: 3064
def main():
    t1,t2 = map(int,input().split())
    a1,a2 = map(int,input().split())
    b1,b2 = map(int,input().split())
    A1 = a1*t1
    A2 = a2*t2
    B1 = b1*t1
    B2 = b2*t2
    A3 = A1+A2
    B3 = B1+B2
    if A3 == B3:
        print("infinity")
    elif A1 < B1 and A3 < B3:
        print(0)
    elif A1 > B1 and A3 > B3:
        print(0)
    elif A3 < B3:
        gap = B3-A3
        x = A1-B1
        num = x//gap
        ans = num*2+1
        if x%gap == 0:
            ans -= 1
        print(ans)
    elif A3 > B3:
        gap = A3-B3
        x = B1-A1
        num = x//gap
        ans = num*2+1
        if x%gap == 0:
            ans -= 1
        print(ans)
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 38508
#!/usr/bin/env python3
from collections import defaultdict

#奇数文字目がすべて R, U, D のいずれか。#
# 偶数文字目がすべて L, U, D のいずれか。

[N, K, Q] = map(int, input().split())
# print(N, K, Q)

score = defaultdict(int)
for i in range(Q):
    n = int(input())
    score[n - 1] += 1
for i in range(N):
    if K - (Q - score[i]) > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 16172
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) std::begin(x), std::end(x)
using namespace std;

/**
 * @brief a flexible binary search
 * @param[in] p  a monotone predicate defined on [l, r)
 * @return  \min \{ x \in [l, r) \mid p(x) \}, or r if it doesn't exist
 */
template <typename UnaryPredicate>
int64_t binsearch(int64_t l, int64_t r, UnaryPredicate p) {
    assert (l <= r);
    -- l;
    while (r - l > 1) {
        int64_t m = l + (r - l) / 2;
        (p(m) ? r : l) = m;
    }
    return r;
}

int64_t solve(int n, int64_t k, vector<int64_t> & a, vector<int64_t> & f) {
    sort(ALL(a));
    sort(ALL(f));
    reverse(ALL(f));
    return binsearch(0, a.back() * f.front() + 1, [&](int64_t answer) {
        int64_t used = 0;
        REP (i, n) {
            if (a[i] * f[i] <= answer) continue;
            int64_t delta = (a[i] * f[i] - answer + f[i] - 1) / f[i];
            assert (a[i] - delta >= 0 and (a[i] - delta) * f[i] <= answer);
            used += delta;
        }
        return used <= k;
    });
}

int main() {
    int n; int64_t k; cin >> n >> k;
    vector<int64_t> a(n);
    REP (i, n) cin >> a[i];
    vector<int64_t> f(n);
    REP (i, n) cin >> f[i];
    cout << solve(n, k, a, f) << endl;
    return 0;
}


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


int n,x;
int a[105];

int main(){
	//freopen("in.txt", "r", stdin);
	ios::sync_with_stdio(0); cin.tie(0);
    while(cin >> n >> x){
        for(int i = 0; i < n; ++i){
            cin >> a[i];
        }
        sort(a,a+n);
        int ans = 0;
        for(int i = 0; i < n; ++i){
            x -= a[i];
            if(x < 0) break;
            else ++ans;
        }
        if(ans == n) {
            if(x != 0) --ans;
        }
        cout << ans << endl;
    }
	return 0;
}


Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
//#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define reps(i, j, k) for(auto i = j; i < k; ++i)
#define rep(i, j) reps(i, 0, j)
#define decs(i, j, k) for(auto i = j; i >= k; --i)
#define dec(i, j) decs(i, j, 0)
#define iter(i, j) for(auto i = j.begin(); i != j.end(); ++i)
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int, int>
#define vpi vector<pi>
#define vb vector<bool>
#define F first
#define S second
#define mp make_pair
#define um unordered_map
#define all(x) (x).begin(), (x).end()  
#define fast_io ios::sync_with_stdio(0); cin.tie(0);
#define file_io freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define IMAX std::numeric_limits<int>::max()
#define IMIN std::numeric_limits<int>::min()
using namespace std;

int main()
{
    int n; cin >> n;
    vll a(n); rep(i, n) cin >> a[i];
    unordered_set<ll> s;
    bool d = true;
    rep(i, n)
    {
        if(s.find(a[i]) != s.end())
        {
            d = false;
            break;
        }
        else
            s.insert(a[i]);
    }
    if(d) cout << "YES";
    else cout << "NO";
    return 0;
}

Measured memory_bytes: 10056
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
//cout << fixed << setprecision(0)

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

int lcm(int a,int b){
  return a*b/gcd(a,b);
}

int main() { 
  int n;cin >> n;
  int ans;
  rep(i,n){
    int a;cin >> a;
    a--;
    ans += a;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s;
bool c[5];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s;
	FOR(i, s.size()) {
		if (s[i] == 'N') c[0] = true;
		else if (s[i] == 'S') c[1] = true;
		else if (s[i] == 'E') c[2] = true;
		else c[3] = true;
	}
	if (c[0]^c[1] || c[2]^c[3]) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

const int MN = 200010;
int n;
int h[MN], a[MN];
ll tree[MN];

void add(int k, ll v) {
    while (k <= n) {
        tree[k] = max(tree[k], v);
        k += k & -k;
    }
}

ll find_max(int k) {
    ll res = 0;
    while (k) {
        res = max(res, tree[k]);
        k -= k & -k;
    }
    return res;
}

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

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

    for (int i = 0; i < n; i++) {
        ll v = a[i] + find_max(h[i]);
        add(h[i], v);
    }
    cout << find_max(n) << endl;
    return 0;
}

Measured memory_bytes: 3328
#import<cstdio>
int main(){int a,c=3,r=1;for(char d[]="123546",s[9];a=scanf("%s",s),*s>60;r+=*d&7)*s%6-4?d[5]=d[a+=*s%5+*s*2+c&3],d[a]=*d,d[++a%4+1]=~*d,*d=~d[5]:c+=*s+3;~-r&&printf("%d\n",r);~a&&main();}

Measured memory_bytes: 0
def main():
  l,r=map(int,input().split())
  ans=10**9
  if any([r//2019>l//2019,r==0,l==0]):
    ans=0
    print(ans)
  else:
    l%=2019
    r%=2019
    for i in range(l,r):
      for j in range(i+1,r+1):
        ans=min(ans,i*j%2019)
    print(ans)
main()

Measured memory_bytes: 38896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    ll N, M, K;
    cin >> N >> M >> K;

    vector<ll> inv(200005); inv[1] = 1;
    for (int i = 2; i < 200005; i++) {
        inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;
    }

    ll ans = 1;
    for (ll i = 0; i < K-2; i++) {
        ans = ans * (N*M - 2 - i) % MOD;
        ans = ans * inv[1+i] % MOD;
    }
    ans = ans * inv[6] % MOD;
    ll tmp = 0;
    tmp = M*N*(M+N) % MOD;
    tmp = (tmp + MOD - (M+N)) % MOD;
    tmp = tmp * M * N % MOD;

    ans = ans * tmp % MOD;

    printf("%lld\n", ans);


}


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

#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int

const int maxr = 2e5 + 5;
int arr[maxr];
int n, k;
bool cheak(int x) {
	int count = 0;
	for (int i = 0; i < n; i++) {
		count += ((arr[i] - 1) / x);
	}
	return count <= k;
}

int binary_search(int low, int high) {
	int ans;
	while (low <= high) {
		int mid = (low + high) / 2;
		if (cheak(mid)) {
			ans = mid;
			high = mid - 1;
		}
		else {
			low = mid + 1;
		}
	}
	return ans;
}

int32_t main()
{
	GO;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int ans = binary_search(1, 1e12);
	cout << ans << endl;
	return 0;
}

//!

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

int main(){
  int N;
  cin >> N;
  
  int c, d, res = 0;
  for(int i =0; i<25; i++)
    for(int j =0; j<18; j++)
      if(N == 4*i + 7*j) res = 1;
  
  res == 1 ? cout << "Yes" <<endl : cout << "No" <<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main()
{
	char s[1005];
	scanf("%s",s);
	if(s[2]==s[3]&&s[4]==s[5])
	{
		printf("Yes\n");
	} 
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
/* 角度でソートし全区間を試す */

#define rep(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define repn(i, m, n) for (int (i) = (m) ; (i) < (int)(n) ; ++(i))
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define repn_rev(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= (m) ; --(i))

#define INF 2e9
#define ll long long
#define MOD 1e9+7

typedef pair<int, int> P;

bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.first < secondElof.first;
}

int main(){
    int n, K;
    cin>>n>>K;
    string s; cin>>s;
    char a[n];
    int index = 0;
    for(auto v: s){
        a[index] = v;
        index++;
    }
    char prev = a[0];
    int kaisu = 0;
    if(a[0]=='R'){
        for(int i=1; i<n; i++){
            char tmp = a[i];
            if(a[i]=='L'){
                if(prev=='R'){
                    kaisu++;
                }
                if(kaisu>K){
                    break;
                }
                a[i] = 'R';
            }
            prev = tmp;
        }
    }
    else{
        for(int i=1; i<n; i++){
            char tmp = a[i];
            if(a[i]=='R'){
                if(prev=='L'){
                    kaisu++;
                }
                if(kaisu>K){
                    break;
                }
                a[i] = 'L';
            }
            prev = tmp;
        }
    }
    int ans = 0;

    if(a[0]=='R'){
        if(a[1]=='R'){
            ans++;
        }
    }
    if(a[n-1]=='L'){
        if(a[n-2]=='L'){
            ans++;
        }
    }
    for(int i=1; i<n-1; i++){
        if(a[i]=='R'){
            if(a[i+1]=='R'){
                ans++;
            }
        }
        if(a[i]=='L'){
            if(a[i-1]=='L'){
                ans++;
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}

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

int main() {
	char s;
	int n,a[4][13 + 1] = {0};
	int num;
	
	cin >> n;
	for ( int i = 0; i < n; i++ ) {
		cin >> s >> num;
		num = num - 1;
		if ( s == 'S' ) a[0][num]++;
		else if ( s == 'H' ) a[1][num]++;
		else if ( s == 'C' ) a[2][num]++;
		else if ( s == 'D' ) a[3][num]++;
	}
	for ( int i = 0; i < 4; i++ ) {
		for ( int j = 0; j < 13; j++ ) {
			if ( i == 0 ) s = 'S';
			if ( i == 1 ) s = 'H';
			if ( i == 2 ) s = 'C';
			if ( i == 3 ) s = 'D';
			
			if ( a[i][j] == 0 ) {
				cout << s << " " << j + 1 << endl; 
        //endlを"\n"にして下にendlつけると2回改行
			} 
		}
	}
	
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }



int main() {
    int n,m; cin >> n >> m;
    vector<int> a(m);
    vector<int> b(m);
    rep(i, m) cin >> a[i] >> b[i];


    set<int> candidate;

    rep(i, m) {
        if(b[i] == n) candidate.insert(a[i]);
    }

    rep(i, m) {
        if(a[i] == 1) if(candidate.count(b[i])) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }

    cout << "IMPOSSIBLE" << endl;
    return 0;
}


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

#[allow(unused_macros)]
macro_rules! chmax {
    ( $ x : expr , $ y : expr ) => { if $ x < $ y { $ x = $ y ; true } else { false } };
}

fn main() {
    input! {
        n: usize, k: usize,
        v: [i64;n]
    }

    let mut max = None;

    for l in 0..k+1 {
        for r in 0..k-l+1 {
            if l + r > n {break;}
            let d = k - l - r;
            let mut taken = vec![];
            let mut sum = 0;
            for i in 0..l {
                sum += v[i];
                taken.push(v[i]);
            }
            for i in 0..r {
                sum += v[n-i-1];
                taken.push(v[n-i-1]);
            }
            taken.sort();
            for i in 0..d {
                if i >= taken.len() {break;}
                if taken[i] >= 0 {break;}
                sum -= taken[i];
            }
            chmax!(max, Some(sum));
        }
    }
    println!("{}", max.unwrap());
}


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

int main(){

    int d , n ;
    cin >> d >> n ;
    if ( n == 100 ){
        if ( d == 0 ) cout << 100 + 1 << endl;
        else if ( d == 1 ) cout << 10000 + 100 << endl;
        else cout << 1000000 + 10000 << endl;
        return 0 ;
    }
    if ( d == 0 ) cout << n << endl;
    else if ( d == 1 ) cout << n * 100 << endl;
    else cout << n * 10000 << endl;



    return 0 ;
}


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


int main(){
  int n;
  cin >> n;
  bool cards[53] = {};
  char mark;
  int num;
  
  for(int i=0; i<n; i++){
    cin >> mark >> num;

    switch(mark){
    case 'S': break;
    case 'H': num += 13; break;
    case 'C': num += 26; break;
    case 'D': num += 39; break;
    }
    cards[num] = num; 
  }
  
  for(int i=1; i<=52; i++){
    if(cards[i]==0){
      switch((i-1)/13){
      case 0: mark = 'S'; break;
      case 1: mark = 'H'; break;
      case 2: mark = 'C'; break;
      case 3: mark = 'D'; break;
      }
      cout << mark << " " << (i - ((i-1)/13)*13) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3064
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String s = sc.next();
    String t = sc.next();
    int index = 200;
    for(int i = 0; i < N; i++) {
      String sub = s.substring(i);
      String sub2 = t.substring(0, N - i);
      if(sub.equals(sub2)) {
        index = i;
        break;
      }
    }
    if(index == 200) index = N;
    System.out.println(N + index);
  }
}

Measured memory_bytes: 22736
/*   You have lost, my dear   */

#include<bits/stdc++.h>
#pragma GCC optimize("O2")
#define mod 1000000007
using namespace std;
int d,n;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>d>>n;
    int p10=1;
    int dd=d;
    while(dd)
    {
        p10*=100;
        --dd;
    }
    for(int i=p10;n;i+=p10)
    {
        int ct=0;
        int ii=i;
        while(ii%100==0)
            ii/=100,++ct;
        if(ct==d)
            --n;
        if(n==0)
        {
            cout<<i;
            return 0;
        }
    }
    return 0;
}


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

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; }
template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; }

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

int V, E;
vector<int> G[10001];
vector<int> ans;
int indeg[10001];
bool seen[10001];

void dfs( int s ){
    seen[s] = true;

    for( auto nv : G[s] ){
        if( seen[nv] ) continue;
        dfs( nv );
    }

    ans.emplace_back( s );
}

int main(){
    cin >> V >> E;
    REP( i, E ){
        int s, t; cin >> s >> t;
        G[s].emplace_back( t );
        indeg[t]++;
    }

    REP( i, V ){
        if( indeg[i] == 0 ){
            dfs( i );
        }
    }

    REP( i, ans.size() ) cout << ans[ans.size() - i - 1] << endl;

}

/*

*/


Measured memory_bytes: 3792
def rec(i,n):
    r=0
    if i==4:
        return 1 if n==0 else 0
    for m in range(10):
        r+=rec(i+1,n-m)
    return r
while True:
    try:
        n=int(input())
        print(rec(0,n))
    except:
        break

Measured memory_bytes: 7576
N,M = map(int,input().split())

ah = N*2
bh = M*2
ans1 = 0
while True:
    ap = min(N,ah)
    bh -= ap
    if bh <= 0:
        break
    ans1 += 1
    #print('ans1,ah,bh,ap',ans1,ah,bh,ap)
    bp = (bh+1)//2
    ah -= bp
    if ah <= 0:
        break
    ans1 += 1
    #print('ans1,ah,bh,bp',ans1,ah,bh,bp)

#print(ans1)

ah = N*2
bh = M*2
ans2 = 0
while True:
    ap = (ah+1)//2
    bh -= ap
    if bh <= 0:
        break
    ans2 += 1
    bp = min(M,bh)
    ah -= bp
    if ah <= 0:
        break
    ans2 += 1

#print(ans2)

print(min(ans1,ans2))



Measured memory_bytes: 5596
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for p in (1,2,3):
    sigma = 0
    for i in range(n):
        sigma += abs(x[i]-y[i])**p
    Dxy = sigma**(1/p)
    print('{:.6f}'.format(Dxy))
max = 0
for i in range(n):
    if max < abs(x[i]-y[i]):
        max = abs(x[i]-y[i])
print('{:.6f}'.format(max))


Measured memory_bytes: 5648
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

vector<pair<ll,ll>> prime_factor(ll n){
    vector<pair<ll,ll>> p;
    for(ll i=2;i*i<=n;i++){
        if(n % i != 0) {
            //cout << i << endl;
            continue;
        }

        ll ex=0;
        while(n % i == 0){
            ex++;
            n /= i;
        }
        p.push_back(make_pair(i,ex));
    }

    if(n != 1){
        p.push_back(make_pair(n,1));
    }

    return p;
}

int main(){
    ll n;
    cin >> n;
  	vector<ll> factor(n+1,0);
  	ll ans=1;
  	for(int i=2;i<=n;i++){
      //cout << i << endl;
      const auto &prime = prime_factor(i);
      for(auto p : prime){
          if(p.second != 0){
              factor[p.first] += p.second;
          }
      }
    }
  
  	for(int i=2;i<=n;i++){
      if(factor[i] != 0){
        ans = (ans * (factor[i]+1)) % mod;
      }
    }
  
  	cout << ans << endl;
  
    return(0);
}

Measured memory_bytes: 3524
A,B,C=map(int,input().split())
K=int(input())

F=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            p=A*2**x
            q=B*2**y
            r=C*2**z
            if p<q<r and x+y+z<=K:
                F=1

if F:
    print("Yes")
else:
    print("No")


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

int main()
{
    int a[5];
    for(int i=0; i<5; i++) cin>>a[i];
    if(a[0]==0) cout<<a[1]-1;
    else if(a[1]==0) cout<<a[2]-1;
    else if(a[2]==0) cout<<a[3]-1;
    else if(a[3]==0) cout<<a[4]-1;
    else if(a[4]==0) cout<<a[3]+1;
}


Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <chrono>
#include <random>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = 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 PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

#define int LL
signed main(void) {
    int N; cin >> N;
    int high = N, low = 0;
    while (high - low > 1) {
        int mid = (high + low) / 2;
        int sum = (mid * (mid + 1)) / 2;
        if (sum >= N) high = mid;
        else low = mid;
    }
    int sum = (high * (high + 1)) / 2;
    int buf = sum - N;
    RREP(i, high) {
        if (i + 1 != buf) printf("%lld\n", i + 1);
    }
}


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

int main() {
	char c[2][3], c_180[2][3];

	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
			c_180[1 - i][2 - j] = c[i][j];
		}
	}

	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 3; j++) {
			if (c_180[i][j] != c[i][j]) {
				cout << "NO" << endl;
				return 0;
			}
		}
	}

	cout << "YES" << endl;

	return 0;
}

Measured memory_bytes: 256
N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))

DP = [0] * N

for i in range(1, N):
    DP[i] = min((X[i] - X[i-1]) * A, B) + DP[i-1]

print(DP[N-1])


Measured memory_bytes: 62704
#include <stdio.h>

void RSort(int *, int, int);
void Reverse(int *, int, int, int);
double sum=0;

int main(){

  int i, n;
  int N[200000];

  scanf("%d", &n);

  for(i=0; i<n; i++)
    scanf("%d", &N[i]);

  RSort(N,0,n);

  printf("%.0f\n", sum);

  return 0;
}

void RSort(int *A, int left, int right){

  int mid,temp;

  if(left+1<right){
    mid=(left+right)/2;
    RSort(A, left, mid);
    RSort(A, mid, right);
    Reverse(A, left, mid, right);
  }
}

void Reverse(int *A, int left, int mid, int right){

  int k, n1, n2, L[200000], R[200000], i, j;

  n1=mid-left;
  n2=right-mid;

  for(i=0;i<n1;i++)
    L[i]=A[left+i];

  for(i=0;i<n2;i++)
    R[i]=A[mid+i];

  L[n1]=1000000000;
  R[n2]=1000000000;
  i=0;
  j=0;

  for(k=left; k<right; k++){
    if(L[i]<R[j]){
      A[k]=L[i];
      i++;
    }else{
      A[k]=R[j];
      sum+=n1-i;
      j++;
    }
  }
}

Measured memory_bytes: 4328
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
#define fi first
#define se second
#define sc scanf
#define pr printf
#define pb push_back
const ll inf = 1e18;
const int nax = 2e6 + 7;
ll mod;
using namespace std;
ll exp(ll a , ll b){
	if(b == 0)	return 1;
	int x = b % 2 == 0 ?   ((exp(a , b/2)%mod)*(exp(a , b / 2)%mod))%mod :  (a%mod*exp(a , b - 1) % mod)%mod;
	return x;
}
int n , m;
int main(int argc,char ** argv){
	dhoom;
	cin >> n >> m;
	vector< int > v;
	int a[m];
	for(int i = 0 ; i < m ; i++)
	{
		cin >> a[i];	
	}
	ll ans = 0;
	sort(a , a + m);
	for(int i = 0 ; i < m - 1 ; i++)
	{
		v.pb(a[i + 1] - a[i]);
		ans += (a[i + 1] - a[i]);
	}
	sort(v.rbegin() , v.rend());
	int r = min(m - 1 , n - 1);
	for(int i = 0 ; i < r ; i++)
		ans -= v[i];
	cout << ans << endl;
	return 0;
	
}


Measured memory_bytes: 1276
import java.util.Scanner;
import java.util.stream.IntStream;

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

        String S = sc.next();

        System.out.println(solve(S));

        sc.close();
    }

    static int solve(String S) {
        return IntStream.rangeClosed(0, S.length() - 3)
                .map(i -> Math.abs(Integer.parseInt(S.substring(i, i + 3)) - 753)).min().getAsInt();
    }
}

Measured memory_bytes: 35880
n = input()
if len(n) == 1:
  print(int(n))
else:
  all9flg = True
  for i in range(1, len(n)):
    if n[i] != "9":
      all9flg = False
  if all9flg:
    print(9 * (len(n) - 1) + int(n[0]))
  else:
    print(9 * (len(n) - 1) + int(n[0]) - 1)

Measured memory_bytes: 38384
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}

/********************************************************/
//	d.erase(unique(all(d)), d.end());




int main()
{
	IOS;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		// reverse(a.begin(),a.end());
		cin>>n;
		// n=s.length();
		pll a[n];
		rep(i,n)
		{
			cin>>a[i].ss>>a[i].ff;
		}
		sort(a,a+n);
		c=0;
		rep(i,n)
		{
			if(c+a[i].ss>a[i].ff)
			{
				cout<<"No";
				return 0;
			}
			else
			{
				c=c+a[i].ss;
			}
		}
		
		cout<<"Yes";
		
		if(t!=0)
	   		cout<<"\n";
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

const int N=55;

ll len[N];
ll cate[N];

inline ll ask(ll l,ll p)
{
    if(l==0)
    {
        if(p==0)
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
    else
    {
        if(p==1)
        {
            return 0;
        }
        if(p<=len[l-1]+1)
        {
            return ask(l-1,p-1);
        }
        if(p==len[l-1]+2)
        {
            return cate[l-1]+1;
        }
        if(p<=2*len[l-1]+2)
        {
            return cate[l-1]+1+ask(l-1,p-(len[l-1]+2));
        }
        if(p==2*len[l-1]+3)
        {
            return 2*cate[l-1]+1;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    len[0]=1;
    cate[0]=1;
    for(int i=1;i<N;i++)
    {
        len[i]=2*len[i-1]+3;
        cate[i]=2*cate[i-1]+1;
    }
    ll n,p;
    cin>>n>>p;
    cout<<ask(n,p)<<"\n";
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    long long int sum = 0;
    vector<int> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    map<long long int,long long int> num;
    for(int i = 0; i < N; i++) {
        num[A[i]] += 1;
    }

    for(int i = 1; i <= N; i++) {
        sum += num[i] * (num[i] - 1) / 2;
    }

    for(int i = 0; i < N; i++) {
        sum -= num[A[i]] * (num[A[i]] - 1) / 2;
        sum += (num[A[i]] - 1) * (num[A[i]] - 2) / 2;
        cout << sum << endl;
        sum += num[A[i]] * (num[A[i]] - 1) / 2;
        sum -= (num[A[i]] - 1) * (num[A[i]] - 2) / 2;
        
    }
    return 0;
}

Measured memory_bytes: 15872
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Node[] nodes = new Node[n];
		for (int i = 0; i < n; i++) {
		    nodes[i] = new Node(i);
		}
		for (int i = 0; i < n; i++) {
		    int x = sc.nextInt();
		    int left = sc.nextInt();
		    int right = sc.nextInt();
		    nodes[x].left = left;
		    nodes[x].right = right;
		    if (left >= 0) {
		        nodes[left].parent = x;
		    }
		    if (right >= 0) {
		        nodes[right].parent = x;
		    }
		}
		StringBuilder sb = new StringBuilder();
		for (Node x : nodes) {
		    if (x.parent == -1) {
		        sb.append("Preorder\n");
		        set(nodes, x.idx, sb, 0);
		        sb.append("\nInorder\n");
		        set(nodes, x.idx, sb, 1);
		        sb.append("\nPostorder\n");
		        set(nodes, x.idx, sb, 2);
		        break;
		    }
		}
		System.out.println(sb);
	}
	
	static void set(Node[] nodes, int idx, StringBuilder sb, int type) {
	    if (type == 0) {
	        sb.append(" ").append(idx);
	    }
	    if (nodes[idx].left >= 0) {
	        set(nodes, nodes[idx].left, sb, type);
	    }
	    if (type == 1) {
	        sb.append(" ").append(idx);
	    }
	    if (nodes[idx].right >= 0) {
	        set(nodes, nodes[idx].right, sb, type);
	    }
	    if (type == 2) {
	        sb.append(" ").append(idx);
	    }
	}
	
	static class Node {
	    int idx;
	    int parent;
	    int left;
	    int right;

	    public Node(int idx) {
	        this.idx = idx;
	        parent = -1;
	        left = -1;
	        right = -1;
	    }
	}
}



Measured memory_bytes: 26400
import java.util.Scanner;

public class Main {
    static int n;
    static int k;
    static int[] a = {3,5,7};
    static long count = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        dfs(0);
        System.out.println(count);
    }
    static void dfs(long i) {
        if (i > n) return;
        if (String.valueOf(i).contains("3")
        && String.valueOf(i).contains("5")
        && String.valueOf(i).contains("7")) {
            count++;
        }
        for (int j = 0; j < 3; j++) {
            dfs(i*10 + a[j]);
        }
    }
}

Measured memory_bytes: 30420
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    vec<ll> a(n); rep(i,n) cin >> a[i];
    ll ans = 0;
    rep(i,n)if((i+1) * a[i] % 2 == 1)ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<string>
 
#define MAX 100000
typedef long long llong;
 
using namespace std;
 
int n, k;
vector<llong> T(MAX);
 
int check(llong P) {
    int i = 0;
    for (int j = 0; j < k; ++j) {
        llong s = 0;
        while (s + T[i] <= P) {
            s += T[i];
            ++i;
            if (i == n)
                return n;
        }
    }
    return i;
}
 
llong solve() {
    llong left = 0, right = MAX*10000;
    llong mid;
    while (right-left>1) {
        mid = (left + right) / 2;
        int v = check(mid);
        if (v >= n) right = mid;
        else
            left = mid;
    }
    return right;
}
 
int main() {
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> T[i];
    }
    llong res = solve();
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3460
#include <iostream>
#include <algorithm>
#include <queue>
#include <tuple>
#include <stack>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define INF INT_MAX>>1 //要climits#includ

typedef long long ll;

using namespace std;

int main(void){
	string str;
	cin >> str;
	int count = 0;
	int len = str.length();
	for(int i=0; i<len; i++){
		if(str[i] == 'o') count++;
	}
	count += 15-len;
	if(count >=8) cout << "YES" << endl;
	else cout << "NO" << endl;
}


/*
int main(void){
	int N;
	cin >> N;
	cout << 180*(N-2) << endl;
	return 0;
}
*/

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
 
int n,m,a;
 
while(1){
 
scanf("%d%d%d",&n,&m,&a);if(n==0&&m==0&&a==0)break;
 
int N[1003][102]={};
for(int i=0;i<m;i++){
    int h,p,q;
scanf("%d%d%d",&h,&p,&q);
 
N[h][p]=1;
N[h][q]=2;
}
 
for(int i=1000;i>=0;i--)
{if(N[i][a]==1)a++;
else if(N[i][a]==2)a--;
}
printf("%d\n",a);
}
return 0;
}

Measured memory_bytes: 2960
import java.util.*;

public class Main {    
    
  public static void main(String[] args) {
   
     Scanner sc = new Scanner(System.in);                                      
     
     String S = sc.next();
     
     char ch = S.charAt(0);
     
     int l = 0;
     
     int count = 1;
     
     for(int i = 1;i < S.length();i++){         
         if(ch == S.charAt(i)){
            continue; 
         }else{
            ch = S.charAt(i);
            count++;            
         }                  
     }
     
     System.out.println(count-1);
             
  }   
}


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

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> X(M, 0);
    for (int i = 0; i < M; i++) cin >> X[i];

    sort(X.begin(), X.end());

    if (M == 1 || N >= M) {
        cout << 0 << endl;
    } else {
        vector<int> dx(M-1, 0); //駒間の距離
        for (int i = 0; i < M - 1; i++) dx[i] = X[i+1] - X[i];
        sort(dx.begin(), dx.end());
        int ans = 0;
        for (int i = 0; i < M - N; i++) ans += dx[i];
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>

using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using Graph = vector<vector<int> >;

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;


int main()
{
	int n;
	cin >> n;
	vector<int> x(n), y(n), p(n);
	rep(i, n) {
		cin >> x[i] >> y[i];
		p[i] = i;
	}
	double sum = 0;
	do {
		for (int i = 1; i < n; i++) {
			sum += sqrt(pow(x[p[i]] - x[p[i - 1]], 2) + pow(y[p[i]] - y[p[i - 1]], 2));
		}
	} while (next_permutation(p.begin(), p.end()));

	int k = 1;
	for (int i = 1; i <= n; i++) {
		k *= i;
	}
	cout << fixed << setprecision(8);
	cout << sum / k << endl;
}


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

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


Measured memory_bytes: 3572
MOD = 10**9 + 7
N, M = map(int, input().split())
broken = [False] * (N+1)
for i in range(M):
    a = int(input())
    broken[a] = True
dp = [0] * (10 ** 5 + 10)
dp[0] = 1
for i in range(N):
    dp[i] %= MOD
    if broken[i]:
        dp[i] = 0
    dp[i + 1] += dp[i]
    dp[i + 2] += dp[i]
print(dp[N] % MOD)

Measured memory_bytes: 7668
// Problem : B - Multiple of 9
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define sz(x)           (int)x.size()
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*(b/gcd(a,b)))
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
#define watch(x)        cout << #x << " = " << x << endl
#define trace(x)        cerr << #x << " = " << x << endl
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void babuBhaiya()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){
    
	string s; cin>>s;
	int a = 0;
	for(char c : s){
		int x = c-'0';
		a += x;
	}
	if(a%9 == 0) cout<<"Yes";
	else cout<<"No";
}

 
int32_t main()
{
    babuBhaiya();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

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

void fnInput(int& rnMaxNum)
{
  cin >> rnMaxNum;
}

int64_t fnToInt(const vector<char>& cnrvcNum)
{
  const vector<int> cnvnDgt = {0, 3, 5, 7};
  int64_t nRtn = 0;
  int nNumPos = 0;

  for (int i = cnrvcNum.size() - 1; i >= 0; i--)
  {
    if (cnrvcNum[i] == '0') break;
    nRtn += cnvnDgt[ cnrvcNum[i] - '0' ] * pow(10.0, nNumPos++);
  }

  return nRtn;
}

int fnDgt753_Check(const vector<char>& cnrvcNum)
{
  int nDig3 = 0, nDig5 = 0, nDig7 = 0;

  for (int i = 0; i < cnrvcNum.size(); i++)
    if      (cnrvcNum[i] == '1') nDig3++;
    else if (cnrvcNum[i] == '2') nDig5++;
    else if (cnrvcNum[i] == '3') nDig7++;

  if (nDig3 && nDig5 && nDig7)
    return 1;
  else
    return 0;
}

int fnDgt753_Count(int nMaxNum)
{
  int nDgt753Cnt = 0;
  int nDgtSiz = to_string(nMaxNum).size();
  vector<char> vcNum(nDgtSiz + 1, '0');

  while (fnToInt(vcNum) <= nMaxNum) 
  {
    if (fnDgt753_Check(vcNum)) nDgt753Cnt++;

    vcNum[vcNum.size() - 1]++;
    for (int i = vcNum.size() - 1; i >= 1; i--)
      if (vcNum[i] > '3')
      {  
        vcNum[i - 1]++;
        vcNum[i] = '1';
      }
      else
        break;
  }

  return nDgt753Cnt;
}

int main()
{
  int nMaxNum;

  fnInput(nMaxNum);
  cout << fnDgt753_Count(nMaxNum) << endl;

  return 0;
}

Measured memory_bytes: 384
#include <cstdio>
int n, t[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5 };
int main() {
	scanf("%d", &n);
	printf("%d\n", t[n]);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>
#include <sstream>

using namespace std;
 
int main() {
    int N;
    long long int a[11000];

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

    int ans = 0;

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

        if(a[i] % 2) continue;
        
        while(a[i] % 2 == 0){
            ans++;
            a[i] /= 2;
        }
 
    }
    
    cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int len,len2,i,j,flg=0,cnt,k;
	char s[202],s1[202],p[202];
	scanf("%s",s);
	scanf("%s",p);
	strcpy(s1,s);
	strcat(s,s1);
	len=strlen(s);
	len2=strlen(p);
	for(i=0;i<len2;i++){
		for(j=0;j<len;j++){
			if(s[j]==p[i]){
				cnt=1;
				for(k=1;k<=len2;k++){
					if(s[j+k]==p[i+k]){
						cnt++;
					}
					else break;
				}
				if(cnt==len2)	flg=1;
			}
		}
	}
	if(flg==1) printf("Yes\n");
	else printf("No\n");
	return 0;
}
	

Measured memory_bytes: 960
#include <iostream>
#include <vector> //可変長配列
#include <queue> //キュー
#include <unordered_map> //ハッシュ連想配列
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define ll long long int
#define INFTY (1<<21)

using namespace std;

int a,b,c,d;

int main(void){
    cin.sync_with_stdio(false);
    a = getchar()-'0';
    b = getchar()-'0';
    c = getchar()-'0';
    d = getchar()-'0';
    getchar();
    int op1[] = {a+b, a-b}, op2[] = {b+c, b-c}, op3[] = {c+d, c-d};
    char op[] = {'+', '-'};
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 2; j++){
            for(int k = 0; k < 2; k++){
                if(op1[i]+op2[j]+op3[k]-b-c==7){
                    cout<<a<<op[i]<<b<<op[j]<<c<<op[k]<<d<<"=7"<<endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int MAX_V = 10000;
int prime[10001];
int main() {
  int i, k, l;
  int m = 0;
  int n[10000] = {1};
  int p1[10000];
  int q1[10000];
  while (1) {
    scanf("%d", &n[m]);
    if (n[m] == 0) {
      break;
    }
    m++;
  }
  for (i = 2; i <= MAX_V; i++) {
    prime[i] = 1;
  }
  for (i = 2; i * i <= MAX_V; i++) {
    if (prime[i]) {
      for (k = 2 * i; k <= MAX_V; k += i) {
        prime[k] = 0;
      }
    }
  }
  for (l = 0; l < m; l++) {
    while (1) {
      if (prime[n[l]] == 1 && prime[n[l] - 2] == 1) {
        p1[l] = n[l] - 2;
        q1[l] = n[l];
        printf("%d %d\n", p1[l], q1[l]);
        break;
	  }
      n[l]--;
    }
  }
  return 0;
}

Measured memory_bytes: 684