akhauriyash/Code-Regression huggingface dataset:
from itertools import accumulate


N, *A = map(int, open(0).read().split())

A = [0] + A + [0]
P = list(accumulate([abs(A[i] - A[i + 1]) for i in range(N + 1)], initial=0))

for i in range(N):
    ans = P[i] - P[0]
    ans += abs(A[i + 2] - A[i])
    ans += P[N + 1] - P[i + 2]
    print(ans)


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

#define ll long long int
#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
#define pb push_back
#define mt make_tuple
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define sum(v) accumulate(all(v), 0)
#define cinv(v, n) rep(i, n) cin >> v[i]
#define prec(n) fixed << setprecision(n)

using namespace std;

int main() {
  int n;
  cin >> n;
  vi l(n * 2);
  cinv(l, n * 2);
  sort(all(l));
  int c = 0;
  rep(i, n) c += min(l[2 * i], l[2 * i + 1]);
  cout << c << endl;
  return 0;
}


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

int main() {
 
 // int64_t a;
  unsigned long long int a;

  cin >> a ;
  
  unsigned long long int money = 100;
  int year = 0;
  while(money < a){
  	money = money * 1.01;
   // cout << money << endl;
    year++;
  }

  cout << year << endl;
  
  return 0;
  
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  ll N, K; cin >> N >> K;
  auto m = N % K;
  m = std::min(m, K-m);
  cout << m << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)

#define REPISE (s,e) for(int i=s,i<e;i++)
#define REPJSE (s,e) for(int j=s,j<e;j++)

#define MAX 200000

using namespace std;

long long getPat (int a)
{
  long long res;
  if (a <= 1)
    return 0;

  res = (long long) a * (long long)(a-1) / (long long) 2;
  return res;
}

int main ()
{
  int N;
  int A[MAX];
  int counter[MAX];
  long long sum;
  long long res;

  REPI(MAX)
  {
    A[i] = 0;
    counter[i] = 0;
  }
    
  cin >> N;

  REPI(N)
  {
    cin >> A[i];
    counter[A[i]-1]++;
  }
    
  REPI(N)  
    sum += getPat(counter[i]);
  
  REPI(N)
  {
    res = sum - getPat(counter[A[i]-1]) + getPat(counter[A[i]-1]-1);
    cout << res << endl;
  }

  return 0;
}

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

int main() {
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            int residual = n - r * i - g * j;
            if (residual < 0) continue;
            if (residual % b == 0) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;



int main() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		int ai;
		cin >> ai;
		a[ai-1]++;
	}
	sort(a.begin(), a.end());
	int sum = 0;
	for (int i = 0;i< n - k; i++) {
		sum += a[i];
	}
	cout << sum << endl;
	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define ROF(i, a, b) for (int i = a; i >= b; i--)
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

int main() {
    int n; cin >> n;
    vi f(n + 2), x(n + 1);
    FOR(i, 1, n + 1) {
        f[i] = f[i % __builtin_popcount(i)] + 1;
    }
    int pc = 0;
    FOR(i, 1, n) {
        char c; cin >> c;
        x[i] = c == '1';
        pc += x[i];
    }
    vi ans(n + 1);
    if (pc > 1) {
        int s1 = 0, s2 = 0, m1 = pc - 1, m2 = pc + 1;
        for (int i = n, j1 = 1, j2 = 1; i > 0; i--, j1 = j1 * 2 % m1, j2 = j2 * 2 % m2) {
            if (x[i]) {
                s1 = (s1 + j1) % m1;
                s2 = (s2 + j2) % m2;
            }
        }
        for (int i = n, j1 = 1, j2 = 1; i > 0; i--, j1 = j1 * 2 % m1, j2 = j2 * 2 % m2) {
            if (x[i])
                ans[i] = f[(s1 - j1 + m1) % m1] + 1;
            else 
                ans[i] = f[(s2 + j2) % m2] + 1;
        }
    }
    else if (pc == 0)
        FOR(i, 1, n) ans[i] = 1;
    else {
        FOR(i, 1, n)  {
            if (x[i]) ans[i] = 0;
            else if (i == n) ans[i] = 2;
            else ans[i] = 1;
        }
    }
    FOR(i, 1, n)
        cout << ans[i] << endl;
}

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

long long a[16][16];
long long dp[1<<16];
int main(){
  int N;
  std::cin>>N;
  for(int i=0;i<N;++i){
    for(int j=0;j<N;++j){
      std::cin>>a[i][j];
    }
  }
  for(int i=0;i<1<<16;++i){
    for(int j=0;j<16;++j){
      for(int k=j+1;k<16;++k){
	if((i&(1<<j))>0&&(i&(1<<k))>0){
	  dp[i]+=a[j][k];
	}
      }
    }
  }
  for(int i=1;i<1<<16;++i){
    int mask=((1<<16)-1)^i;
    for(int j=((1<<16)-1)&mask;j>0;j=(j-1)&mask){
      dp[i|j]=std::max(dp[i|j],dp[i]+dp[j]);
    }
  }
  std::cout<<dp[(1<<16)-1]<<std::endl;
  return 0;
}


Measured memory_bytes: 768
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

int main(void) {
    int ulimit, sum;
    get_int2(&ulimit, &sum);

    int i, j;
    int cnt = 0;
    for(i = 0; i <= ulimit; i++) {
        for(j = 0; j <= ulimit; j++) {
            int rem = sum-i-j;
            if(rem >= 0 && rem <= ulimit) cnt++;
        }
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 128
// abc167_b
#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 <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
  int a,b,c,k,ans=0;
  cin>>a>>b>>c>>k;
  ans+=min(k,a);
  ans-=min(max(k-a-b,0),c);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

vi dx{-1,1,0,0};
vi dy{0,0,-1,1};

int main() {
  int H,W;
  cin >> H >> W;
  int ch,cw;
  cin >> ch >> cw;
  ch--;cw--;
  int dh,dw;
  cin >> dh >> dw;
  dh--;dw--;
  v(string) s(H);
  rep(i,H) {
    cin >> s[i];
  }
  deque<pair<int,int>> que;
  que.emplace_back(ch,cw);
  vvi d(H,vi(W,INF));
  d[ch][cw]=0;
  int now=0;
  while(!que.empty()) {
    int x = que.front().first;
    int y = que.front().second;
    que.pop_front();
    rep(di,4) {
      int nx=x+dx[di];
      int ny=y+dy[di];
      if(nx<0||ny<0) continue;
      if(nx>=H||ny>=W) continue;
      if(s[nx][ny]!='.') continue;
      if(d[nx][ny]<=d[x][y]) continue;
      d[nx][ny]=d[x][y];
      que.emplace_front(nx,ny);
    }
    srep(di,-2,3) {
      srep(dj,-2,3) {
        int nx=x+di;
        int ny=y+dj;
        if(nx<0||ny<0) continue;
        if(nx>=H||ny>=W) continue;
        if(s[nx][ny]!='.') continue;
        if(d[nx][ny]<=d[x][y]+1) continue;
        d[nx][ny]=d[x][y]+1;
        que.emplace_back(nx,ny);
      }
    }
  }
  if(d[dh][dw]==INF) {
    cout << -1 << endl;
  } else {
    cout << d[dh][dw] << endl;
  }
  return 0;
}

Measured memory_bytes: 9496
#include <cstdio>
#include <cstdint>
#include <vector>

constexpr intmax_t mod = 1e9+7;

template <typename Tp>
Tp gcd(Tp a, Tp b, Tp& x, Tp& y) {
  x = Tp(0);
  y = Tp(1);
  for (Tp u = y, v = x; a;) {
    Tp q = b/a;
    std::swap(x -= q*u, u);
    std::swap(y -= q*v, v);
    std::swap(b -= q*a, a);
  }
  return b;
}

template <typename Tp>
Tp modinv(Tp a, Tp mod) {
  Tp x, y;
  gcd(a, mod, x, y);
  x %= mod;
  if (x < 0) x += mod;
  return x;
}

template <typename Tp>
Tp modadd(Tp a, Tp b, Tp mod) {
  a += b % mod;
  if (a < 0) a += mod;
  if (a >= mod) a -= mod;
  return a;
}

template <typename Tp>
Tp modadd(std::initializer_list<Tp> const& adds, Tp mod) {
  Tp res = 0;
  for (auto const& add: adds) {
    res += add % mod;
    if (res < 0) res += mod;
    if (res >= mod) res -= mod;
  }
  return res;
}

template <typename Tp>
Tp modsub(Tp a, Tp b, Tp mod) {
  a -= b % mod;
  if (a < 0) a += mod;
  if (a >= mod) a -= mod;
  return a;
}

template <typename Tp>
Tp modmul(std::initializer_list<Tp> const& muls, Tp mod) {
  Tp res = 1;
  for (auto const& mul: muls) (res *= mul) %= mod;
  return res;
}

template <typename Tp>
Tp modpow(Tp base, intmax_t iexp, Tp mod) {
  Tp res = 1;
  for (Tp dbl = base; iexp; iexp >>= 1) {
    if (iexp & 1) res = res * dbl % mod;
    dbl = dbl * dbl % mod;
  }
  return res;
}

class modchoose {
  std::vector<intmax_t> fact, fact_inv;
  const intmax_t mod;

public:
  modchoose(intmax_t N, intmax_t mod): mod(mod) {
    fact.resize(N+1);
    fact_inv.resize(N+1);
    fact[0] = 1;
    for (intmax_t i = 1; i <= N; ++i)
      fact[i] = fact[i-1] * i % mod;

    fact_inv[N] = modinv(fact[N], mod);
    for (intmax_t i = N; i--;)
      fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
  }

  intmax_t operator ()(intmax_t n, intmax_t r) const {
    if (!(0 <= r && r <= n && 0 <= n)) return 0;
    intmax_t res = fact[n] * fact_inv[r] % mod;
    (res *= fact_inv[n-r]) %= mod;
    return res;
  }
};

int main() {
  intmax_t n, k;
  scanf("%jd %jd", &n, &k);

  modchoose mc(n+k, mod);
  intmax_t res = mc(n-1, k-1);
  printf("%jd\n", res);
}



Measured memory_bytes: 2764
N = int(input())

h = list(map(int, input().split()))

dp = [-1]*N


def solve(id):
    if dp[id] == -1:
        if id == 0:
            dp[id] = 0
        elif id == 1:
            dp[id] = abs(h[1]-h[0])
        else:
            dp[id] = min(dp[id-1] + abs(h[id] - h[id-1]),
                         dp[id-2] + abs(h[id] - h[id-2]))
    return dp[id]


for i in range(N):
    solve(i)

print(dp[-1])


Measured memory_bytes: 13980
#include <iostream>


#include <string>


#include <algorithm>


#include <utility>


#include <iomanip>


#include <functional>


#include <queue>


#include <stack>


#include <map>


#include <vector>


#include <cmath>


#include <cctype>


#include <cstdio>


#define ll long long


#define INF 1e+9


#define MOD 1000000007


using namespace std;



ll par[100001];


ll r[100001];


ll num[100001];


void init(ll n){


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


        par[i]=i;


        r[i]=0;


        num[i]=1;


    }


}


int find(ll x){


    if(par[x]==x){


        return x;


    }else{


        return par[x]=find(par[x]);


    }


}


void unite(ll x, ll y){


    x = find(x);


    y = find(y);


    if(x==y){


        return;


    }


    


    if(r[x] < r[y]){


        num[find(y)] += num[find(x)];


        par[x]=y;


    }else if(r[x] > r[y]){


        num[find(x)] += num[find(y)];


        par[y]=x;


    }else{


        num[find(x)] += num[find(y)];


        par[y]=x;


        r[x]++;


    }


}


bool same(ll x, ll y){


    return find(x)==find(y);


}



int main(){


    ll N,M;


    cin >> N >> M;


    


    ll A[100001],B[100001];


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


        cin >> A[i] >> B[i];


        A[i]--;


        B[i]--;


    }


    


    init(N);


    


    ll connected[100002];


    connected[M]=0;


    for(ll i=M-1; i>=0; i--){


        if(same(A[i],B[i])){


            connected[i] = connected[i+1];


        }else{


            connected[i] = connected[i+1] + num[find(A[i])]*num[find(B[i])];


        }


        unite(A[i],B[i]);


    }


    


    for(ll i=0; i<M; i++){


        cout << N*(N-1)/2 - connected[i+1] <<endl;


    }


    


    return 0;


}

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

// Shortening code
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

// Macros
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = a; i >= b; i--)

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // Your code
    ll a, b, n;
    cin >> a >> b >> n;
    ll ind = min(b - 1, n);
    cout << floor(a * ind / b);
    return 0;
}

Measured memory_bytes: 3788
import itertools

N = int(input())
A = list(input().split())
B = list(itertools.combinations(A,3))
cnt = 0
for i in B:
  a = int(i[0])
  b = int(i[1])
  c = int(i[2])
  if (a-b)*(b-c)*(c-a) != 0: 
    if a + b > c and b + c > a and c + a > b:
      cnt += 1
print(cnt)



Measured memory_bytes: 20572
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

vector<ll> A;
// vectorのリサイズ
// A.resize(N);

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return b/gcd(a,b)*b;}

ll sum(ll l , ll r) {
  return (l+r)*(r-l+1)/2;
}


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

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

  ll n, k;
  cin >> n >> k;
  mint ans = 0;
  for(ll i = k; i <= n+1; i++){ 
    ll left = sum(0, i-1);
    ll right = sum(n-i+1, n);
    ans += right-left+1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int>c(n);
    vector<vector<int>>a(n,vector<int>(m));
    rep(i,n){
        cin>>c[i];
        rep(j,m){
            cin>>a[i][j];
        }
    }
    
    int ans=INF;
    rep(i,1<<n){
        int money=0;
        vector<int>res(m);
        rep(j,n){
            if(i>>j&1){
                money+=c[j];
                rep(k,m){
                    res[k]+=a[j][k];
                }
            }
        }
        bool ok=true;
        rep(k,m){
            if(res[k]<x){
                ok=false;
                break;
            }
        }
        if(ok)ans=min(ans,money);
    }
    if(ans==INF)cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3528
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define YY cout << "Yes" << endl
#define NN cout << "No" << endl
const int INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
bool is_prime(long long n) {  //素数判定
  for(int64_t i = 2; i * i <= n; i++) {
    if(n % i == 0) return false;
  }
  return true;
}
int solve(){
  ll h,n;
  cin >> h >> n;
  vector<int>v(n);
  rep(i,n)cin >> v[i];
  rep(i,n)h -= v[i];
  if(h <= 0)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16) << endl; 
  solve();
  return 0;
} 

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

typedef vector< vector<int> > vvi;
typedef vector< vector<bool> > vvb;
typedef vector< vector<char> > vvc;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef long long ll;

int gcd(int a,int b){
    int kani=max(a,b);
    int ebi=min(a,b);
    int r=kani%ebi;
    while(r!=0){
        kani=ebi;
        ebi=r;
        r=kani%ebi;
    }
    return ebi;
}

int main(){
    int k;
    cin >> k;
    int sum=0;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                sum+=gcd(i,gcd(j,l));
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3564
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

struct Graph{
    struct Node{
        unordered_set<int> inEdges, outEdges;
        vector<pair<int, int>> cands;
        int maxDepth = -1;
        int from = 0;
    };
    vector<Node> nodes;
    Graph(int num): nodes(num){ }
    int id(Node* n){ return n - &nodes[0]; }
    int id(Node& n){ return &n - &nodes[0]; }
    void print(){ for(auto& node : nodes){ prints(id(node), node.outEdges); } }
    void add1Edge(int from, int dest){
        nodes[from].outEdges.insert(dest);
        nodes[dest].inEdges.insert(from);
    }
    void dfs(int idx, int from = -1, int depth = 0){
        nodes[idx].cands.emplace_back(depth, from);
        printde(idx, nodes[idx].cands.size(), nodes[idx].inEdges.size());
        if(depth && nodes[idx].cands.size() != nodes[idx].inEdges.size()){ return; }
        sort(nodes[idx].cands.rbegin(), nodes[idx].cands.rend());
        from = nodes[idx].cands[0].second;
        depth = nodes[idx].cands[0].first;
        printde(idx, from, depth);
        // bool first = nodes[idx].maxDepth == -1;
        // if(nodes[idx].maxDepth >= depth){
        //     return;
        // }
        nodes[idx].from = from;
        nodes[idx].maxDepth = depth;
        // if(!first){ return; }
        for(int didx : nodes[idx].outEdges){
            dfs(didx, idx, depth + 1);
        }
    }
};

/*
            -> 6 -> 
1 -> 5 -> 2 ------> 3 -> 4
  ------>
*/

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    Graph g(n);
    unordered_set<int> root;
    for(int i = 0; i < n; i++){
        root.insert(i);
    }
    for(int i = 0; i < n - 1 + m; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g.add1Edge(a, b);
        root.erase(b);
    }
    g.dfs(*root.begin());
    for(int i = 0; i < n; i++){
        cout << g.nodes[i].from + 1 << '\n';
    }
}


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

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> A(N);

  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A[i].first = a;
    A[i].second = i + 1;
  }

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

  for (int i = 0; i < N; i++) {
    cout << A[i].second;
    if (i != N - 1) {
      cout << " ";
    } else {
      cout << endl;
    }
  }
}


Measured memory_bytes: 1536
#include<stdio.h>
int main(void)
{
	int n,a,b,c,d[100],x,y,t,max,i,j;
	scanf("%d %d %d %d", &n, &a, &b, &c);
	x=c;
	y=a;
	max=c/a;
	for(i=0; i<n; i++)
	scanf("%d", &d[i]);
	for(i=0; i<n; i++)
	{
		for(j=n-1; j>=i+1; j--)
		{
			if(d[j]>d[j-1])
			{
				t=d[j];
				d[j]=d[j-1];
				d[j-1]=t;
			}
		}
	}
	for(i=0; i<n; i++)
	{
		x+=d[i];
		y+=b;
		if(x/y>max)
		max=x/y;
	}
	printf("%d\n", max);
	
	return 0;
}


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

int a[2345];

int main() {
    int n; scanf("%d", &n);
    for (int i = 0; i < n; ++i) scanf("%d", a+i);
    sort(a, a+n);
    //for (int i = 0; i < n; ++i) printf("%d ", a[i]);
    //printf("\n");
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            int lo = a[j]-a[i], hi = a[i]+a[j];
            int x1 = lower_bound(a+j, a+n, lo)-a;
            int x2 = lower_bound(a+j, a+n, hi)-a;
            //printf("%d %d %d %d: %d %d\n", i, j, lo, hi, x1, x2);
            ans += max(0, x2-x1-1);
        }
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


class SegmentTree():
    def __init__(self, n):
        self.n = 2**(n-1).bit_length()
        self.data = [0 for _ in range(2*self.n)]

    def set(self, k, v):
        v_val = ord(v)-ord('a') #アルファベットを数字にする。'a'->1, 'b'->2 ..
        self.data[k+self.n-1] = 1 << v_val #含むアルファベットをbitで管理

    def build(self):
        for k in reversed(range(self.n-1)):
            self.data[k] = self.data[k*2+1] | self.data[k*2+2] 

    def update(self, k, a):
        k += self.n-1
        v_val = ord(a)-ord("a")
        self.data[k] = 1 << v_val

        while k > 0:
            k = (k-1)//2
            self.data[k] = self.data[k*2+1] | self.data[k*2+2]

    def query(self, l, r):
        L = l+self.n
        R = r+self.n
        ret = 0
        while L < R:
            if R & 1:
                R -= 1
                ret |= self.data[R-1]
            if L & 1:
                ret |= self.data[L-1]
                L += 1
            L >>= 1
            R >>= 1
        return ret

N = int(input())
S = [v for v in input()[:-1]]
Q = int(input())
query = [[v for v in input()[:-1].split()] for _ in range(Q)]

Seg = SegmentTree(N)
for i, s in enumerate(S):
    Seg.set(i, s)

Seg.build()

for q, v1, v2 in query:
    if q == "1":
        Seg.update(int(v1)-1, v2)
    else:
        val = Seg.query(int(v1)-1, int(v2))
        print(bin(val)[2:].count("1"))

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var NCK = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var N = NCK[0];
            var C = NCK[1];
            var K = NCK[2];
            var TList = Enumerable.Range(0, N)
                .Select(_ => Console.ReadLine()).Select(int.Parse)
                .OrderBy(x => x)
                .ToArray();

            var numCustomer = 0;
            var timeLimit = TList[0] + K; ;
            var numBus = 0;
            foreach (var T in TList)
            {
                if (numCustomer == C
                    || timeLimit < T)
                {
                    numBus++;
                    numCustomer = 0;
                    timeLimit = T + K;
                }

                numCustomer++;
            }

            if (numCustomer > 0)
            {
                numBus++;
            }

            var output = numBus;
            Console.WriteLine(output);
        }

        static int NumberOfDigits(long x)
        {
            if (x < 10) return 1;

            var result = 0;
            while (x > 0)
            {
                result++;
                x /= 10;
            }

            return result;
        }

        static int SumOfDigits(int x)
        {
            var sum = 0;
            while (x > 0)
            {
                sum += x % 10;
                x /= 10;
            }

            return sum;
        }
    }
}


Measured memory_bytes: 18652
N = int(input())
A = 0
B = 0
AB = 0
ans = 0

S = list()

for _ in range(N):
    S.append(input())

for s in S:
    ans += s.count("AB")
    if s[0] == "B" and s[-1] == "A":
        AB += 1
    elif s[0] == "B":
        B += 1
    elif s[-1] == "A":
        A += 1

if AB == 0:
    ans += min(A, B)
else:
    if A + B != 0:
        ans += AB + min(A, B)
    else:
        ans += AB - 1

print(ans)


Measured memory_bytes: 3700
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#include<vector> 
using namespace std;
#define N 100002
vector<int> g[N];
int parent[N],dis[N];
int n,num;
void dfs(int cur,int par){
	int i,now;
	dis[cur] = dis[par] + 1;
//	cout<<cur<<' '<<dis[cur]<<endl;
	for( i=0;i<g[cur].size();i++ )
	{
		now = g[cur][i];
		if( now == par )
			continue;
		parent[now]=cur;
		dfs(now,cur);
	}
}
// 求一棵子树中的节点数量 
void dfs1(int cur,int par){
	int i,now;
	num++;
	for( i=0;i<g[cur].size();i++ )
	{
		now = g[cur][i];
		if( now == par )
			continue;
		dfs1(now,cur);
	}
}
int main(){
	int i,to,from,k,cur,cnt;
	cin>>n;
	for( i=0;i<n-1;i++ ){
		cin>>to>>from;
		g[to].push_back(from);
		g[from].push_back(to);
	}
	dis[0]=-1;
	dfs(1,0);
	k=dis[n]-1;
//	cout<<k<<endl;
	cur = n;
	cnt=0;
	while( 1 )
	{
		if( cnt>=k/2 )
			break;
		cur = parent[cur];
		cnt++;
	}
	num=0;
	dfs1(cur,parent[cur]);
//	cout<<num<<endl;
	if( num>=n-num )
		cout<<"Snuke";
	else
		cout<<"Fennec";
	return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<endl
#define AA(i) cout<<i<<endl;
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
  string S,T; cin >> S;
  int i, j, k, Q; cin >> Q;
  char l;
  bool d=true;
  rep(i,Q){
    cin >> j;
    if(d){
      if(j == 1){
        d = false;
      }
      else{
        cin >> k >> l;
        if(k == 1){
          T += l;
        }
        else{
          S = S + l;
        }
      }
    }
    else{
      if(j == 1){
        d = true;
      }
      else{
        cin >> k >> l;
        if(k == 2){
          T += l;
        }
        else{
          S = S + l;
        }
      }
    }
  }
  if(d){
    reverse(T.begin(), T.end());
    AA(T+S);
    }
  else{
    reverse(S.begin(), S.end());
    AA(S+T);  
  }
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  int id = 0;
  for (int i=0; i<20; i++) {
    for (int j=0; j<30; j++) {
      int sum = 7*i + 4*j;
      if (sum == N) {
        id++;
      }
    }
  }
  if (id>0) {
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int i = n - 1; i >= 0; i -= 2) {
		cout << a[i] << " ";
	}
	int k;
	if (n % 2 == 0)k = 0;
	else k = 1;
	for (int i = k; i < n - 1; i += 2) {
		cout << a[i] << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 2944
#include <cstdio>
#include <set>
using namespace std;

int main() {
	multiset<int> ms;
	int n, m, t;
	bool flag = 0;
	scanf("%d", &n);
	while (n--) {
		scanf("%d", &t);
		ms.insert(t);
	}
	scanf("%d", &m);
	while (m--) {
		scanf("%d", &t);
		if (!ms.count(t))
			flag = 1;
		else ms.erase(ms.find(t));
	}
	puts(flag ? "NO" : "YES");
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef tree<signed, null_type, less_equal<signed>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//find_by_order();
//order_of_key();
 
#define PB  push_back
#define ALL(x)  (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP  make_pair
 
#define debug(_x)       cerr << #_x << '=' << (_x) << endl;
#define debug2(_x, _y)  cerr << #_x << '=' << (_x) << ' ' << #_y << '=' << (_y) << endl;
#define debugn(_a)      cerr << #_a << ": "; for (const auto _x: _a) cerr << (_x) << ' '; cerr << endl;

#define HERE debug(__LINE__);

#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

#define int long long int

typedef pair<int, int> ii;
typedef pair<pair<int, int>, int> iii;
typedef vector<int> vi;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX>>1;
const int NINF = LONG_LONG_MIN/2;
const double PI = 3.141592653589793238;


//MODULAR ARITHMATIC
const int mmod = 1000000007;

int add(int a, int b, int m=mmod) {
    return (a%m + b%m)%m;
}

int sub(int a, int b, int m=mmod) {
    return (a%m - b%m + m)%m;
}

int mul(int a, int b, int m=mmod) {
    return ((a%m) * (b%m) % m);
}

int pow(int a, int b, int m=mmod) {
    a %= m;
    int r = 1;
    while (b) {
        if (b&1) r = r*a%m;
        b >>= 1;
        a = a*a%m;
    }
    return r;
}

int inv(int a, int m=mmod) {
    return pow(a, m-2, m);
}

ii norm(int a, int b) {
    int g = __gcd(a, b);
    a /= g, b /= g;
    if (a == 0) b = 1;
    if (b == 0) a = 1;
    if (a < 0) a = -a, b = -b;
    return {a, b};
}

ii inv(ii p) {
    return norm(-p.second, p.first);
}

int pw[200010];

int32_t main() {
    FAST_IO;
    pw[0] = 1;
    for(int i = 1; i < 2e5 + 7; i++)
        pw[i] = pw[i - 1] * 2 % mmod;
        
    int n;
    cin >> n;
    int a[n], b[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    
    int ans = 0;
    map<ii, int> cnt, vis;
    
    for (int i = 0; i < n; i++) {
        if (a[i] == 0 && b[i] == 0) ans++;
        else {
            ii p = norm(a[i], b[i]);
            cnt[p]++;
        }
    }
    int tt = 1;
    for (auto pp: cnt) {
        ii p = pp.first, q = inv(p);
        if (vis[p]) continue;
        tt = mul(tt, sub(add(pw[cnt[p]], pw[cnt[q]]), 1));
        vis[p] = vis[q] = 1;
    }
    ans = add(ans, tt);
    ans = sub(ans, 1);
    cout << ans << endl;
}

// g++ -Wall -Wextra -Wshadow -fsanitize=undefined



Measured memory_bytes: 58340
S = list(input())
l = len(S)
if l%2 == 0:
    ans = ['0', '1']*int(l/2)
else:
    ans = ['0', '1']*int(l//2)
    ans.append('0')

cnt = 0
for i in range(l):
    if ans[i] != S[i]:
        cnt += 1

print(min(cnt, l-cnt))

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

using namespace std;

const int N = 200010;

int a[N], b[N];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	int first = 0, second = 0;
	for (int i = n - 1; i >= 1; i--) {
		if (a[i] == a[i - 1]) {
			if (! first) first = a[i];
			else if (! second) second = a[i];
			i--;
		}
	}
	cout << first * 1LL * second << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

const int add_to[4][4]={
	{0,1,2,3},
	{1,4,3,6},
	{2,7,4,1},
	{3,2,5,4}
};

int main(void) {
	int data_num,cur_data,i,j;
	int result[8];
	int a[4];
	int b[4];
	while(1) {
		scanf("%d",&data_num);
		if(data_num==0)break;
		for(cur_data=0;cur_data<data_num;cur_data++) {
			scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3]);
			scanf("%d%d%d%d",&b[0],&b[1],&b[2],&b[3]);
			for(i=0;i<8;i++)result[i]=0;
			for(i=0;i<4;i++) {
				for(j=0;j<4;j++) {
					result[add_to[i][j]]+=a[i]*b[j];
				}
			}
			printf("%d %d %d %d\n",
				result[0]-result[4],result[1]-result[5],
				result[2]-result[6],result[3]-result[7]
			);
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<math.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi > vvi;

#define pb push_back
#define inf 999999999
#define rep(i, n) for(int i = 0; i < n; i++)
#define dep(i, n) for(int i = n; i >= 0; i--)
#define For(i, n, m) for(int i = n; i < m; i++)
#define dor(i, n, m) for(int i = n; i >= m; i--)
#define out(n) cout << n << endl;
#define vut(a) for(int i = 0; i < a.size(); i++) COUT(a[i])
#define aut(a) for(int i = 0; i < a.length(); i++) COUT(a[i])
#define sort(a) for(int i = 0; i < a.size() - 1; i++) for(int j = 0; j < a.size() - i - 1; j++) if(a[j] > a[j + 1]) swap(a[j], a[j + 1]);
#define dort(a) for(int i = 0; i < a.size() - 1; i++) for(int j = 0; j < a.size() - i - 1; j++) if(a[j] < a[j + 1]) swap(a[j], a[j + 1]);

struct ab {
  int x;
  int y;
};

int main() {
  int a, b;
  cin >> a >> b;

  vector<ab> c(a), d(b);

  rep(i, a) {
    cin >> c[i].x >> c[i].y;
  }

  rep(i, b) {
    cin >> d[i].x >> d[i].y;
  }

  rep(i, a) {
    int min = inf;
    int num;
    rep(j, b) {
      int x, y;

      if((c[i].x < 0 && d[j].x < 0) || (c[i].x >= 0 && d[j].x >= 0)) {
        x = abs(c[i].x - d[j].x);
      }else {
        x = abs(c[i].x) + abs(d[j].x);
      }

      if((c[i].y < 0 && d[j].y < 0) || (c[i].y >= 0 && d[j].y >= 0)) {
        y = abs(c[i].y - d[j].y);
      }else {
        y = abs(c[i].y) + abs(d[j].y);
      }

      if(min > x + y) {
        min = x + y;
        num = j + 1;
      }
    }
    out(num);
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#define X first
#define Y second
using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

const int N=1000010,mod=1e9+7; 

LL a,b,n;
LL ans;

int main()
{
	cin>>n>>a>>b;
	
	ans+=n/(a+b)*a;
	
	ans+=min(a,n%(a+b));
	
	cout<<ans<<endl;
	
	
	
	
	
	
	
	
	
	return 0;
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(void)
{
    int n;
    cin >> n;
    vector<pair<int,int>> a(n);
    int i;
    for(i=0;i<n;i++)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.begin(), a.end());
    for(i=0;i<n;i++)
    {
        cout << a[i].second + 1 << " ";
    }
    return 0;
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  int a, b, c;
  int a1, b1, c1;

  a = N/10;
  a1 = N%10;
  b = a/10;
  b1 = a%10;
  c = b/10;
  c1 = b%10;

  string ans = "No";

  if(a1==7 || b1 == 7 || c1 == 7) ans = "Yes";

  cout << ans << endl;
    
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  char S[101010];
  cin >> S;
  bool a[26];
  //bool b[26];
  int i;
  for(i = 0; i < 26; i++){
    a[i] = false;
  //  b[i] = false;
  }
  for(i = 0; S[i] != '\0'; i++){
    a[S[i] - 'a'] = true;
  }
  int ans = 0;
  for(i = 0; i < 26; i++){
    if(a[i] == false){
      ans = 'a' + i;
      break;
    }
  }
  if(ans == 0){
      cout << "None" << endl;
  }else{
    cout << (char)ans << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint x;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> x;
	if(x >= 30) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

ll H;

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

  std::cin >> H;

  ll res = 0, n = 1;

  while(H > 1){
      res += n;
      H /= 2;
      n *= 2;
  }

  res += n;

  std::cout << res << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 55

int length;
char S[NUM],T[NUM];

void func(){

	scanf("%s %s",S,T);

	for(length = 0; S[length] != '\0'; length++);

	int diff_loc = -1;

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

		if(S[i] != T[i]){
			diff_loc = i;
			break;
		}
	}

	if(diff_loc == -1){

		printf("0\n");
		return;
	}

	int R1_S,R1_T;

	for(R1_S = length-1; R1_S >= 0 && S[R1_S] == '0'; R1_S--);
	for(R1_T = length-1; R1_T >= 0 && T[R1_T] == '0'; R1_T--);

	if(R1_S < diff_loc){

		printf("%d\n",R1_T-R1_S);
		return;
	}
	if(R1_T < diff_loc){

		printf("%d\n",R1_S-R1_T);
		return;
	}
	if(R1_S == diff_loc){

		printf("%d\n",R1_T-R1_S);
		return;
	}
	if(R1_T == diff_loc){

		printf("%d\n",R1_S-R1_T);
		return;
	}

	printf("%d\n",(R1_S-diff_loc)+R1_T-diff_loc);
}

int main(){

	int num_query;
	scanf("%d",&num_query);

	for(int loop = 0; loop < num_query; loop++){

		func();
	}

	return 0;
}



Measured memory_bytes: 3200
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define All(v) (v).begin(),(v).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;

deque<char> a, b, c;

char dfs(char x){
    if(x=='a'){
        if(a.size()==0){
            cout << 'A' << endl;
            return 0;
        }
        char y = a.front();
        a.pop_front();
        dfs(y);
    }
    if(x=='b'){
        if(b.size()==0){
            cout << 'B' << endl;
            return 0;
        }
        char y = b.front();
        b.pop_front();
        dfs(y);
    }
    if(x=='c'){
        if(c.size()==0){
            cout << 'C' << endl;
            return 0;
        }
        char y = c.front();
        c.pop_front();
        dfs(y);
    }
}

int main(){
    string sa, sb, sc;
    cin >> sa >> sb >> sc;
    rep(i, sa.length()) a.push_back(sa[i]);
    rep(i, sb.length()) b.push_back(sb[i]);
    rep(i, sc.length()) c.push_back(sc[i]);
    dfs('a');
}

Measured memory_bytes: 256
<?php
$m_d= explode(" ", trim(fgets(STDIN)));

$m = $m_d[0];
$d = $m_d[1];

$count = 0;
for ($i = 1; $i <= $m; $i++) {
     for ($j = 1; $j <= $d; $j++) {
         $tmp = str_split($j);
         if(count($tmp) >= 2) {
             if($tmp[0] >= 2 && $tmp[1] >= 2) {
                 if(array_product($tmp) === $i) {
                     $count++;
                 }
             }
         }
     }
}
echo $count;

Measured memory_bytes: 4856
#include<bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for (int i=0;i<(n);i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int,int>;
using ll = long long;
using namespace std;
int main(void){
    int n;
    string s, t;
    cin >> n >> s >> t;
    rep(i, n){
        cout << s[i] << t[i];
    }
    return 0;
}

Measured memory_bytes: 3488
#include<stdio.h>
#include<stdlib.h>
#define K 10000
void CountingSort(int *,int *,int);

int main(){
  int n,i;
  int *A,*B;

  scanf("%d",&n);
  A=(int *)malloc(sizeof(int)*n);
  B=(int *)malloc(sizeof(int)*n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  // printf("\na\n");

  CountingSort(A,B,n);

  for(i=0;i<n;i++){
    printf("%d",B[i]);
    if(!(i==n-1)) printf(" ");
  }
  printf("\n");
  return 0;
}

void CountingSort(int *a,int *b,int n){
  int *c,*cc;
  int i,j;

  c=(int *)malloc(sizeof(int)*(K+1));
  cc=(int *)malloc(sizeof(int)*(K+1));

  for(i=0;i<=K;i++) c[i]=0;
  // printf("\nb\n");
  for(i=0;i<n;i++){
    c[a[i]]++;
  }


 //preparing for *cc
  i=0;
  while(1){
    if(i==0) cc[0]=c[0];
    else{
      cc[i]=c[i]+cc[i-1];
    }
    i++;
    if(i==K+1) break;
    } 

  //printf("\nb\n"); 
  for(j=n-1;j>=0;j--){
    b[cc[a[j]]-1]=a[j];
    cc[a[j]]--;
  } 
}

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

using namespace std;

int N,X,Y,Z;
const int MOD = 1e9 + 7;
typedef long long LL;
const int M = 1 << 18;
int f[41][M];
int po[41];

int main()
{
    po[0] = 1;
    for (int i=1;i<=40;i++)po[i] = po[i - 1] * 10LL % MOD;
    scanf("%d%d%d%d",&N,&X,&Y,&Z);
    memset(f,0,sizeof(f));
    int forbid = (1 << Z) + (1 << Y + Z) + (1 << X + Y + Z);
    f[0][0] = 1;
    int ans = 0;
    for (int i=0;i<N;i++)
        for (int j=0;j<M;j++)
        if ((j & forbid) != forbid)
        {
            for (int l=1;l<=10;l++)
            {
                int nxt = ((j << l) | (1 << l)) & (M - 1);
                f[i + 1][nxt] += f[i][j];
                if (f[i + 1][nxt] >= MOD) f[i + 1][nxt] -= MOD;
            }
        }
    for (int i=0;i<M;i++)
    if ((i & forbid) != forbid)
    {
        ans += f[N][i];
        if (ans >= MOD) ans -= MOD;
    }
    printf("%d\n",(po[N] - ans + MOD) % MOD);
}


Measured memory_bytes: 42240
$n = <>;
@a = split(" ", <>);
@b = split(" ", <>);
@c = split(" ", <>);

$prev = -1;
my$s = 0;
foreach my$a (@a) {
  $s += $b[$a-1];
  if ((0 < $prev) && ($prev + 1 == $a)) {
    $s += $c[$a-2];
  }
  $prev = $a;
}
print $s;

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

namespace atcoder_Beginner_Contest096_Question1
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (input[0] <= input[1])
            {
                Console.WriteLine(input[0]);
            }
            else
            {
                Console.WriteLine(input[0] - 1);
            }
        }
    }
}


Measured memory_bytes: 13268
n = int(input())
table = []
for _ in range(n):
    a = int(input())
    tmp = []
    for _ in range(a):
        person,assessment = map(int,input().split())
        person -=  1
        tmp.append([person,assessment])
    table.append(tmp)

def check(i,n):
    
    for j in range(n):
        if i >> j & 1:
            for person,assessment in table[j]:
                if (i >> person)&1 !=  assessment:
                    return False
    
    return True

ans = 0
for i in range(2**n):
    if check(i,n):
        ans = max(ans,bin(i).count("1"))

print(ans)

Measured memory_bytes: 3064