akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    for k in range(1000):
        if (k*k-k) % 2 == 0 and (k*k-k) // 2 == N:
            break
    else:
        print('No')
        return

    c = 1
    S = [set() for _ in range(k)]
    for i in range(k):
        for j in range(i+1, k):
            S[i].add(c)
            S[j].add(c)
            c += 1
    print('Yes')
    print(k)
    for s in S:
        print(len(s), ' '.join(map(str, s)))



def main():
    N = read_int()
    (slv(N))


if __name__ == '__main__':
    main()


Measured memory_bytes: 24220
/*
 * atcoder/abc116/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
#include <stack>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }


int N;
int H[101];

void solve() {
  cin >> N;
  loop(n,0,N) cin >> H[n];

  int count = 0;
  loop(n,0,N) {
    if (n==0) { count = H[0]; continue; }
    if (H[n] > H[n-1]) count += H[n] - H[n-1]; // 前回よりも高い山の高さだけカウントすればOK
  }
  cout << count << endl;
}

int main() {
  // cout.precision(15);
  // cout << fixed << double
  solve();
  return 0;
}


Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
const char dir[4] = { 'u','l','d','r' };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

vector<pair<int, int>> v;
int n, m;

int main() {
	cin >> n;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		v.emplace_back(make_pair(a, b));
	}
	cin >> m;
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		v.emplace_back(make_pair(a, b));
	}
	sort(ALL(v));
	UNIQUE(v);
	REP(i, v.size()) {
		if (i)cout << " ";
		cout <<v[i].first << ":"<<(v[i].second<10?"0":"") << v[i].second;
	}
	cout << endl;
	//system("pause");
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef pair<ll, ll> P;



int main(){
    ll a, b, c, x, y;
        cin >> a >> b >> c >> x >> y;
    ll ans = a*x+b*y;
        for(ll i=0; i<=max(x,y); i++){
            ans = min(ans, 2*c*i + a*max(0LL,x-i) + b*max(0LL,(y-i)));
        }
    cout << ans << endl;
}
        

            

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

/*
Range Sum Query by FenwickTree(Binary Indexed Tree)

total number: n
queries:
    1. add(i, val): bit[i] += val 
    2. sum(n): sum(bit[0] + ... + bit[n-1])
time complexity: O(log n)
space complexity: O(N)

Self-balancing binary search tree or Segment Tree can do the same, it takes longer to program and complexity also increases.

Thanks: http://hos.ac/slides/20140319_bit.pdf
    
used in ARC031 C, indeednow finalB E, DSL2B(AOJ), ARC033 C, yukicoder No.59
*/

template<typename T> struct RangeSumQuery {
  int N;
  vector<T> dat;

  RangeSumQuery(int N) : N(N) {
    assert(N > 0);
    dat.resize(N, 0);
  }

  void add(int k, T val) {
    assert(0 <= k && k < N);
    for (int x = k; x < N; x |= x + 1) {
      dat[x] += val;
    }
  }

  // [0, k)
  T sum(int k) {
    assert(k >= 0);
    T ret = 0;
    for (int x = k - 1; x >= 0; x = (x & (x + 1)) - 1) {
      ret += dat[x];
    }
    return ret;
  }
  // [l, r)
  T sum(int l, int r) {
    assert(0 <= l && l <= r && r <= N);
    return sum(r) - sum(l);
  }

  T index(int k) {
    assert(0 <= k && k < N);
    return sum(k+1) - sum(k);
  }
};

int A[200010];
P idx[200010];

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  REP(i, N) {
    int a;
    cin >> a;
    idx[i] = P(a, i);
  }
  RangeSumQuery<ll> fwt(N);
  REP(i, N) fwt.add(i, 1);
  sort(idx, idx + N);

  ll ans = 0;
  for (P p : idx) {
    ans += fwt.sum(p.second);
    fwt.add(p.second, -1);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4164
#include <bits/stdc++.h>
using namespace std;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 100 + 10;
int n, m;
int dp[maxn][maxn];
char s[maxn][maxn];
int f(int i, int j)
{
	if(i == n && j == m) return s[i][j] == '#';
	if(~dp[i][j]) return dp[i][j];
	int ret1, ret2;
	if(i == n)
	{
		if(s[i][j] == '.') ret1 = f(i, j + 1);
		else if(s[i][j + 1] == '.') ret1 = f(i, j + 1) + 1;
		else ret1 = f(i, j + 1);
		dp[i][j] = ret1;
	}
	else if(j == m)
	{
		if(s[i][j] == '.') ret2 = f(i + 1, j);
		else if(s[i + 1][j] == '.') ret2 = f(i + 1, j) + 1;
		else ret2 = f(i + 1, j);
		dp[i][j] = ret2;
	}
	else
	{
		if(s[i][j] == '.') ret1 = f(i, j + 1);
		else if(s[i][j + 1] == '.') ret1 = f(i, j + 1) + 1;
		else ret1 = f(i, j + 1);
		
		if(s[i][j] == '.') ret2 = f(i + 1, j);
		else if(s[i + 1][j] == '.') ret2 = f(i + 1, j) + 1;
		else ret2 = f(i + 1, j);
		dp[i][j] = min(ret1, ret2);
	}
	return dp[i][j];
}
int main()
{
	memset(dp, -1, sizeof dp);
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i) scanf("%s", s[i] + 1);
	printf("%d\n", f(1, 1));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int decisionGroup (int num)
{
    int ans;
    switch(num)
    {
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
            ans = 1;
            break;
        case 4:
        case 6:
        case 9:
        case 11:
            ans = 2;
            break;
        case 2:
            ans = 3;
            break;
    }
    return ans;
}

int main() {
	int x, y, xa, ya; cin >> x >> y;
    xa = decisionGroup(x);
    ya = decisionGroup(y);
	cout << (xa==ya?"Yes":"No") << endl;
	return 0;
}

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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

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

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 *1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 100100;

int A[MAX];

int main()
{
	//freopen("in.txt","r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int n, m;
	scanf("%d%d", &n, &m);
	FOR (i, 0, n)
	{
		scanf("%d", &A[i]);
	}

	int pos = -1;

	FOR (i, 1, n)
	{
		if (A[i] + A[i-1] >= m) pos = i;
	}

	if (pos == -1)
	{
		cout<<"Impossible"<<endl;
		return 0;
	}

	printf("Possible\n");
	FOR (i, 0, pos - 1)
	{
		printf("%d\n", i + 1);
	}

	RFOR(i, n - 1, pos - 1)
	{
		printf("%d\n", i + 1);
	}


}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
const int N = 3;
int a[N], n;
int main() {
    n = 3;
    for(int i = 1 ; i <= n ; ++ i) scanf("%d", &a[i]); sort(a + 1, a + 1 + 3);
    int ans = abs(a[2] - a[1]) + abs(a[3] - a[2]);
    do {
        ans = min(ans, abs(a[2] - a[1]) + abs(a[3] - a[2]));
    } while(next_permutation(a + 1, a + 1 + 3));
    printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>

long long mod = 1e9+7;
class Mint {
public:
  long long x;
  Mint(){}; // 引数なしでも定義できるように引数なしコンストラクタも用意しておく
  Mint(long long a){
    x = a%mod;
    while(x<0){
      x += mod;
    }
  };
  Mint& operator += (const Mint &a){
    x+=a.x;
    x%=mod;
    return *this;
  }
  Mint& operator -= (const Mint &a){
    x += (mod - a.x);
    x%=mod;
    return *this;
  }
  Mint& operator *= (const Mint &a){
    x*=a.x;
    x%=mod;
    return *this;
  }

  // a^n mod を計算する
  // Useaeg: Mint z = y.pow(y, n);
  Mint pow(Mint a, long long n) const {
    Mint y(1);
    Mint b(a);
    while (n > 0) {
      if (n & 1) y *= b;
      b *= b;
      n >>= 1;
    }
    return y;
  }

  // a^{-1} mod を計算する
  Mint modinv(const Mint &a) const {
    return pow(a, mod-2);
  }

  Mint& operator /= (const Mint &a) {
    x *= modinv(a).x;
    x %= mod;
    return *this;
  }

  Mint operator + (Mint &a) const {
    Mint y(*this);
    y += a;
    return y;
  }

  Mint operator - (Mint &a) const {
    Mint y(*this);
    y -= a;
    return y;
  }

  Mint operator * (Mint &a) const {
    Mint y(*this);
    y *= a;
    return y;
  }

  Mint operator / (Mint &a) const {
    Mint y(*this);
    y/=a;
    return y.x;
  }

  // nCk @mod を計算する
  Mint nCk(Mint &n, const long long k) const {
    Mint y = Mint(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
      y /= i;
    }
    return y;
  }

  // nPk @mod を計算する
  Mint nPk(Mint &n, long long k) const {
    Mint y(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
    }
    return y;
  }
};



int main(){
  int n, m;
  std::cin >> n >> m;
  std::vector<long long> x(n), y(m);
  std::vector<Mint > X(n-1), Y(m-1);
  long long tmp;
  for (int i=0; i<n; i++) {
    std::cin >> x[i];
  }
  for (int i=0; i<m; i++) {
    std::cin >> y[i];
  }
  for (int i=0; i<n-1; i++) {
    X[i] = Mint(x[i+1] - x[i]);
  }
  for (int i=0; i<m-1; i++) {
    Y[i] = Mint(y[i+1] - y[i]);
  }

  Mint xsum(0);
  Mint single(0);
  Mint multiple(n-1);
  Mint kazu(1);
  Mint ni(2);
  for (int i=0; i<n/2; i++) {
    Mint temp(single.x);
    temp += kazu*multiple;
    xsum += temp * X[i];
    //printf("xsum += temp * X[%d] = %lld * %lld\n", i, temp.x, X[i].x);
    if (n-2-i==i) break;
    xsum += temp * X[n-2-i];
    single += ni * kazu;
    multiple -= ni;
    kazu += 1;
    //printf("xsum += temp * X[%d] = %lld * %lld\n", n-2-i, temp.x, X[n-2-i].x);
  }
  Mint ysum(0);
  single = Mint(0);
  multiple = Mint(m-1);
  kazu = 1;
  for (int i=0; i<m/2; i++) {
    Mint temp(single.x);
    temp += kazu*multiple;
    ysum += temp * Y[i];
    if (m-2-i == i) break;
    ysum += temp * Y[m-2-i];
    single += ni * kazu;
    multiple -= ni;
    kazu += 1;
  }
  Mint ans = xsum * ysum;
  std::cout << ans.x << std::endl;
  return 0;
}

Measured memory_bytes: 6044
#include<bits/stdc++.h>
#define rep(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)
#define dep(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)
#define re(i,a,n) for(int _tmp=n,i=a;i<_tmp;++i)
#define fec(i,a) for(__typeof a.begin() i=a.begin();i!=a.end();++i)
#define For(i,v,u) for(int i=H[u],v=to[i];i;i=nxt[i],v=to[i])
#define si(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define X first
#define Y second
#define inf 1000000000
using namespace std;
template<class T> inline void read(T&x){char c;bool fu=0;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x*=-1;}
template<class T> inline void read(T&x,T&y){read(x);read(y);}
template<class T> inline void read(T&x,T&y,T&z) {read(x,y);read(z);}
template<class T> inline void MAX(T&x,T y){if(x<y)x=y;}
template<class T> inline void MIN(T&x,T y){if(x>y)x=y;}
typedef long long ll;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;
const int N=111111;
//head
int n,T,a[N],now,mx,cnt;
int main() {
	read(n,T);
	rep(i,1,n)read(a[i]);
	now=a[1];
	rep(i,2,n)if(now<a[i]){
		if(a[i]-now>mx){
			mx=a[i]-now;
			cnt=1;
		}else if(a[i]-now==mx)++cnt;
	}else now=a[i];
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
using namespace std;
const int N = 107;
const int W = 1e5 + 7;
int n, m_w;
long long a[N][W];
int w[N];
long long v[N];

int main(){
    ///preprocessing
    #ifndef ONLINE_JUDGE
    freopen("test.inp", "r", stdin);
    #endif // ONLINE_JUDGE
    fio;
    ///code below
    cin >> n >> m_w;
    for (int i = 0; i <= n; i++){
        for (int j = 0; j <= m_w; j++){
            a[i][j] = -1;
        }
    }
    for (int i = 0; i < n; i++){
        cin >> w[i] >> v[i];
    }
    a[0][0] = 0;
    for (int i = 0; i < n; i++){
        for (int j = 0; j <= m_w; j++){
            if (a[i][j] != -1){
                a[i + 1][j] = max(a[i + 1][j], a[i][j]);
                if (j + w[i] <= m_w){
                    a[i + 1][j + w[i]] = max(a[i + 1][j + w[i]], a[i][j] + v[i]);
                }
            }
        }
    }
    long long m = -1;
    for (int i = 0; i <= m_w; i++){
        m = max(m, a[n][i]);
    }
    cout << m;
}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << end
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;

    int n,k; cin >> n >> k;
    vl x(n);
    rep(i,n)cin >> x[i];
    ll res = 0;
    rep(i,n){
        ll ans = min(x[i],k-x[i]);
        res+=ans*2;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    string s;
    cin >> s;
    rep(i, sz(s)) {
        cout << s[i];
        if (i == 3)cout << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 256
<?php
	$n = trim(fgets(STDIN));
	$arr = explode(' ', trim(fgets(STDIN)));
	$min = $arr[0];
	$count = 0;
	for ($i=0; $i<$n; $i++) {
	    if ($min >= $arr[$i]) {
	        $min = $arr[$i];
	        $count ++;
	    }
	}
	echo $count . "\n";

Measured memory_bytes: 18932
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,k,a,b,c,d,s,ct;
    cin>>n>>k;
    if(n>=10) cout<<k<<endl;
    else
    {
       a=k+100*(10-n);
    cout<<a<<endl;
    }
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
  int n;
  
  cin >> n;
  int a[n];
  rep(i,0,n){
    cin >> a[i];
  }
  
  long long sum = 1;

  rep(i,0,n){
    sum *= 3;
  }
  
  long long sum_d = 1;
  
  rep(i,0,n){
    if(a[i] % 2 == 0){
      sum_d *= 2;
    }
  }
  
  cout << sum - sum_d << endl;

  ret 0;
}

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

signed main() {
	int n, ans = 0;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		ans ^= a;
	}
	if (ans == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main() {
 
   
        long long n,i,j,k,sum=0,count=0,ans=0;
        cin>>n;
        long long a[n];
        for(i=0;i<n;i++)
        {
            cin>>a[i];
            if(a[i]==1)
            sum=1;
        }
        if(sum==0)
        cout<<-1;
        else
        {
            i=0;k=1;
            while(i<n)
            {
                if(a[i]==k)
                {
                    k++;
                }
                i++;
            }
            
            cout<<(n-k+1);
        }
        
       

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long

using namespace std;

const int maxn = 100010;
int n, x, y, tot = 0;

int read(){
    int x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*w;
}

signed main()
{
    #ifndef ONLINE_JUDGE
  	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
    #endif  

    n = read();
	while(n --) {
		x = read(); y = read();
		if(x == y) tot ++;
		else tot = 0;
		if(tot == 3) {
			printf("Yes");
			return 0;
		}
	}
	printf("No");

    return 0;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
const ll mod=1e9+7;
bool sortbysec(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.second<b.second);
}
int main()
{
    int x,a;
    cin>>x>>a;
    if(x<a)
        cout<<0<<endl;
    else
        cout<<10<<endl;






}















































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

int main() {

  string S; 
  int K;

  cin >> K ;
  cin >> S ;
  
  
   
  if (S.size() <= K) {
    cout << S << endl;
  }
    
  else {
     int count = 0;
  for (int i = 0; i < K+1; i++) {
    if (i <= K-1) {
       cout << S.at(i);
       count++;
    }
    else {
      cout << "..." << endl;
  }
  }
  }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N;
int v[10] = { 2,4,5,7,9,0,1,6,8,3 };
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;

	rep(i, 0, 10) if (v[i] == N % 10) {
		if (i < 5) cout << "hon" << endl;
		else if (i < 9) cout << "pon" << endl;
		else cout << "bon" << endl;
		return;
	}
}







Measured memory_bytes: 3652
#include "bits/stdc++.h"
#define MAXN 300009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int arr[MAXN];
int main(){
	//~ #ifndef ONLINE_JUDGE
    //~ freopen("file.in", "r", stdin);
	//~ #endif	
	int n;
	scanf("%d",&n);
	ll ans=0;
	for(int i=1;i<=n*3;i++)
		scanf("%d",arr+i);
	sort(arr+1,arr+n*3+1);	
	for(int i=0;i<n;i++)
		ans+=arr[n*3-i*2-1];
	printf("%lld\n",ans);	
	return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>

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

int main(){
	int N, M, X, A, i, suml, sumr;
	scanf("%d%d%d", &N, &M, &X);
	for(i = 0, suml = 0, sumr = 0; i < M; i++){
		scanf("%d", &A);
		if(A < X){
			suml++;
		}
		else{
			sumr++;
		}
	}
	printf("%d\n", min(suml, sumr));
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    ll oddsum = 0, oddmax = -1e10, evensum = 0, evenmax = -1e10;
    for (int i = 0; i < N; i++) {
        if (i%2 == 0) {
            evensum += max(A[i], 0LL);
            evenmax = max(evenmax, A[i]);
        }
        else {
            oddsum += max(A[i], 0LL);
            oddmax = max(oddmax, A[i]);
        }
    }
    
    if (evenmax <= 0 && oddmax <= 0) {
        ll mx = max(evenmax, oddmax);
        int pos;
        for (int i = 0; i < N; i++) {
            if (A[i] == mx) {
                pos = i+1;
                break;
            }
        }
        cout << mx << endl;
        cout << N-1 << endl;
        for (int i = N; i >= pos+1; i--) cout << i << endl;
        for (int i = 0; i < pos-1; i++) cout << 1 << endl;
        return 0;
    }
    else {
        vector<ll> ans;
        cout << max(oddsum, evensum) << endl;
        while (A[0] < 0) {
            A.erase(A.begin());
            ans.push_back(1);
            swap(oddsum, evensum);
        }
        if (oddsum > evensum) {
            ans.push_back(1);
            A.erase(A.begin());
        }
        while (A[0] < 0) {
            ans.push_back(1);
            ans.push_back(1);
            A.erase(A.begin(), A.begin()+2);
        }
        while (A.size() > 1) {
            if (A.size() == 2) {
                ans.push_back(2);
                A.erase(A.begin()+1);
            }else if (A.size() >= 4) {
                if (A[2] >= 0) {
                    ans.push_back(2);
                    A[0] += A[2];
                    A.erase(A.begin()+1, A.begin()+3);
                }else {
                    ans.push_back(3);
                    A[1] += A[3];
                    A.erase(A.begin()+2, A.begin()+4);
                }
            }else {
                if (A[2] >= 0) {
                    ans.push_back(2);
                    A[0] += A[2];
                    A.erase(A.begin()+1, A.begin()+3);
                }else {
                    ans.push_back(3);
                    A.erase(A.begin()+2, A.begin()+3);
                }
            }
        }
        cout << ans.size() << endl;
        for (int i = 0; i < (int)ans.size(); i++) {
            cout << ans[i] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
k, n = map(int, input().split())
A = input().split()
a = [int(i) for i in A]

kyori = k + a[0] - a[n-1]

for i in range(n):
    if kyori < a[i] - a[i-1]:
        kyori = a[i] - a[i-1]
print(k-kyori)

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

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  double w;
  while (cin >> w) {
    if (w <= 48) cout << "light fly" << endl;
    else if (w <= 51) cout << "fly" << endl;
    else if (w <= 54) cout << "bantam" << endl;
    else if (w <= 57) cout << "feather" << endl;
    else if (w <= 60) cout << "light" << endl;
    else if (w <= 64) cout << "light welter" << endl;
    else if (w <= 69) cout << "welter" << endl;
    else if (w <= 75) cout << "light middle" << endl;
    else if (w <= 81) cout << "middle" << endl;
    else if (w <= 91) cout << "light heavy" << endl;
    else cout << "heavy" << endl;    
  }

  return 0;
}


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

using namespace std;
using ll        = long long;
using predicate = function<bool(ll)>;

int const NMAX = 2e5 + 11;

ll n, k, a[NMAX], f[NMAX];

bool ok(ll x)
{
    ll tk = k;
    for (int i = 0; i < n; ++i)
    {
        tk -= max((ll)0, a[i] - x / f[i]);
        if (tk < 0)
            return false;
    }
    return true;
}

ll bs(ll l, ll r, predicate p)
{
    while (l < r)
    {
        ll m = l + (r - l) / 2;
        if (p(m))
            r = m;
        else
            l = m + 1;
    }

    return l;
}

int main(void)
{
    cin >> n >> k;
    for (int i = 0; i < n; ++i)
        cin >> a[i];

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

    sort(a, a + n);
    sort(f, f + n, greater<int>());

    cout << bs(0, 1e12 + 11, ok) << endl;
    return 0;
}


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

int main() {
  int N,a,b;
  long int sum;
  cin >> N;
  sum = 0;
  
  for (int i = 1; i < N + 1; i++) {
    a = i % 3;
    b = i % 5;
   if (a == 0 || b == 0) {
     sum = sum + 0;
   }
    else {
      sum = sum + i;
    }
  }
     
  
  cout << sum << endl;
}
  
  


Measured memory_bytes: 3640
#include <iostream>
#include <cstdlib>

using namespace std;

int main() {
  while( 1 ) {
    int n;  
    cin >> n;
    if( !n ) { return EXIT_SUCCESS; }

    int i;
    for( i = 0; n != 1; i++ ) {
      n = ( n % 2 ? n * 3 + 1 : n / 2 ); 
    }
    cout << i << endl;
  }
}

Measured memory_bytes: 1160
H, W = map(int, input().split())
S = [input() for _ in range(H)]
for i in range(H):
    S[i] = list(S[i])
    
if (H == 1) and (W == 1):
    if S[0][0] == '.':
        S[0] = '0'
elif (H == 1) and (W != 1):
    for col in range(W):
        if S[0][col] == '#':
            continue
        if col == 0:
            S[0][col] = str([S[0][col+1]].count('#'))
        elif col == W - 1:
            S[0][col] = str([S[0][col-1]].count('#'))
        else:
            S[0][col] = str([S[0][col-1], S[0][col+1]].count('#'))
elif (H != 1) and (W == 1):
    for row in range(H):
        if S[row][0] == '#':
            continue
        if row == 0:
            S[row][0] = str([S[row+1][0]].count('#'))
        elif row == H - 1:
            S[row][0] = str([S[row-1][0]].count('#'))
        else:
            S[row][0] = str([S[row-1][0], S[row+1][0]].count('#'))
else:
    for row in range(H):
        for col in range(W):
            if S[row][col] == '#':
                continue
            if row == 0:
                if col == 0:
                    S[row][col] = str([S[row][col+1], S[row+1][col], S[row+1][col+1]].count('#'))
                elif col == W - 1:
                    S[row][col] = str([S[row][col-1], S[row+1][col-1], S[row+1][col]].count('#'))
                else:
                    S[row][col] = str([S[row][col-1], S[row][col+1], S[row+1][col-1],
                               S[row+1][col], S[row+1][col+1]].count('#'))
            elif row == H - 1:
                if col == 0:
                    S[row][col] = str([S[row-1][col], S[row-1][col+1], S[row][col+1]].count('#'))
                elif col == W - 1:
                    S[row][col] = str([S[row-1][col-1], S[row-1][col], S[row][col-1]].count('#'))
                else:
                    S[row][col] = str([S[row-1][col-1], S[row-1][col], S[row-1][col+1],
                                   S[row][col-1], S[row][col+1]].count('#'))
            else:
                if col == 0:
                    S[row][col] = str([S[row-1][col], S[row-1][col+1],
                                   S[row][col+1],
                                   S[row+1][col], S[row+1][col+1]].count('#'))
                elif col == W - 1:
                    S[row][col] = str([S[row-1][col-1], S[row-1][col],
                                   S[row][col-1], 
                                   S[row+1][col-1], S[row+1][col]].count('#'))
                else:
                    S[row][col] = str([S[row-1][col-1], S[row-1][col], S[row-1][col+1],
                                   S[row][col-1], S[row][col+1],
                                   S[row+1][col-1], S[row+1][col], S[row+1][col+1]].count('#'))
for i in range(len(S)):
    print(''.join(S[i]))  

Measured memory_bytes: 9372
from collections import defaultdict
sosu = defaultdict(int)
def soinsu(n):
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            sosu[i] += 1
    if n > 1:
        sosu[n] += 1
    return

N, P = map(int, input().split())
soinsu(P)
ans = 1
for i, j in sosu.items():
    ans *= i ** (j // N)

print(ans)


Measured memory_bytes: 3444
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

string W[10];

int main() {
  int N;
  cin >> N;
  cin >> W[0];
  bool flg = true;
  for (int i = 1; i < N; ++i) {
    cin >> W[i];
    if (W[i - 1][W[i - 1].size() - 1] != W[i][0]) {
      flg = false;
    } else {
      for (int j = 0; j < i; ++j) {
        if (W[j] == W[i]) {
          flg = false;
          break;
        }
      }
    }
  }
  if (flg) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
#define F(i,a,n) for(int i=a;i<n;i++)
#define mod 1000000007 
#define pb push_back

int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int w=1;
	// cin>>w;
	while(w--){
	int n;
	cin>>n;
	vi v1(n),v2(n);
	cin>>v1[0]>>v2[0];
	cin>>v1[1]>>v2[1];
	F(i,2,n){
		cin>>v1[i]>>v2[i];
		if(v1[i]==v2[i]&&v1[i-1]==v2[i-1]&&v1[i-2]==v2[i-2]){cout<<"Yes";return 0;}
	}
	cout<<"No";

	}

	return 0;
}

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

/*
素数のe乗で、Nを割り切れるもの
のuniqueは最大で何個か

素因数分解する
各要素に対して1個以上とるから
1 2 3 4 5 6...
1 3 6 10 15 みたいな感じで三角数できまる
*/

int	main(void)
{
	long long n;
	cin >> n;
	vector<int> max_num(60, 0);
	max_num[1] = 1;
	int add = 1;
	for (int i = 1; i < 60; i += add)
	{
		max_num[i] = add;
		add++;
	}
	for (int i = 2; i < 60; i++)
	{
		if (max_num[i] == 0) max_num[i] = max_num[i - 1];
	}
	long long ans = 0;
	long long num = n;
	for (int i = 2; (long long)i * i < n; i++)
	{
		if (num % i == 0)
		{
			int tmp = 0;
			while (num % i == 0)
			{
				num /= i;
				tmp++;
			}
			ans += max_num[tmp];
		}
	}
	if (num != 1) ans++;
	cout << ans << endl;
	return (0);
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,t[100000],m,p,x;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>t[i];
	}
	cin>>m;
	for(int i=0;i<m;i++){
		int sum=0;
		cin>>p>>x;
		for(int j=0;j<n;j++){
			if(j==p-1)sum+=x;
			else sum+=t[j];
		}
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
long long cnt[65];
int main()
{
    long long n,ans = 0;
    scanf("%lld",&n);
    for(long long i=0;i<n;i++)
    {
        long long num;
        scanf("%lld",&num);
        for(long long j=0;j<=60;j++)  cnt[j] = cnt[j]+(((1ll<<j)&num)!=0);
    }
    for(long long i=0;i<=60;i++)
    {
        long long f = cnt[i]*(n-cnt[i])%mod;
        long long s = (1ll<<i)%mod;
        ans = (ans+(f*s%mod))%mod;
    }
    printf("%lld\n",ans);
}


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

int main()
{
  int a, b, c;
  cin>>a>>b>>c;
  if (a==b && a != c) {
    cout << "Yes" << endl;
  } else if (b==c && a!=c) {
    cout << "Yes" <<endl;
  } else if (a==c && a!=b){
    cout << "Yes" << endl;
  } else {
    cout << "No" <<endl;
  }
}


Measured memory_bytes: 256
direct = ((0, -1), (0, 1), (-1, 0), (1, 0)) #移動方向

def search(x, y, mp): 
  if mp[x][y] == "1": #1を見つけたら0に書き換える
    mp[x][y] = "0"
    for dx, dy in direct: #4方向について繰り返す
      search(x + dx, y + dy, mp)
 
while True:
  #mp...全体のマップ、上下左右を0で囲っておく
  mp = [list("0" + input() + "0") for _ in range(12)]
  mp.insert(0, [0] * 14)
  mp.append([0] * 14)

  ans = 0

  for x in range(1, 13):
    for y in  range(1, 13):
      if mp[x][y] == "1":
        ans += 1
        search(x, y, mp)

  print(ans)

  try:
    input()
  except EOFError:
    break


Measured memory_bytes: 5576
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int inf=1e4+9,mod=1e9+7;
ll a[inf],d,n,dp[inf][102][2];
string ss;

ll solve(int pos,int mul,bool smaller){

    if(pos==n+1)
        return (mul==0);

    ll &ret=dp[pos][mul][smaller];
    if(ret!=-1)
        return ret;
    ret=0;
    for(int i=0;i<=a[pos];i++)
        ret=(ret+solve(pos+1,(mul+i)%d,smaller|(i<a[pos])  )  )%mod;

    for(int i=a[pos]+1;i<10 && smaller;i++)
        ret=(ret+solve(pos+1,(mul+i)%d,smaller  )  )%mod;

    return ret;
}

int main(){

    cin>>ss>>d;
    n=ss.size();
    for(int i=1;i<=n;i++)
        a[i]=ss[i-1]-'0';

    memset(dp,-1,sizeof(dp));
    cout<<(solve(1,0,0)-1+mod)%mod<<endl;//-1 for the zero 
}


Measured memory_bytes: 17280
#include "bits/stdc++.h"
using namespace std;

struct UnionFind {
  vector<int> r;

  UnionFind(int n) {
    r = vector<int> (n,-1);
  }

  int root(int x) {
    if(r[x]<0) return x;
    return r[x] = root(r[x]);
  }

  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x==y) return false;
    if(r[x]>r[y]) swap(x,y);
    r[x]+= r[y];
    r[y] = x;
    return true;
  }

  int size(int x) {
    return -r[root(x)];
  }

};

int main() {
  int n,m;
  cin >> n >> m;
  UnionFind UF(n);
  for(int i=0;i<m;i++) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    UF.unite(a,b);
  }
  int ans=0;
  for(int i=0;i<n;i++) {
    ans = max(ans, UF.size(i));
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

struct Edge {
  int to;
  int weight;
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

int main()
{
  int k;
  cin>>k;
  Graph g(k);
  for(auto&& i:irange(0,k)) {
    g[i].push_back(Edge{(i+1)%k, 1});
    g[i].push_back(Edge{(i*10)%k, 0});
  }
  vecint d(k, k);
  d[1] = 1;
  deque<int> q;
  q.push_back(1);
  while (!q.empty()) {
    int i = q.front();
    q.pop_front();
    for (auto&& e:g[i]) {
      if (d[e.to] > d[i] + e.weight) {
        d[e.to] = d[i] + e.weight;
        if (e.weight > 0) {
          q.push_back(e.to);
        } else {
          q.push_front(e.to);
        }
      }
    }
  }
  cout<<d[0]<<endl;
  return 0;
}


Measured memory_bytes: 6272
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

fac = [1, 1]     # 元テーブル
f_inv = [1, 1]   # 逆元テーブル
inv = [0, 1]     # 逆元テーブル計算用テーブル
def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod)


def cmb(n, r, mod):
    if n < 0 or r < 0:
        return 0
    if r > n:
        return 0

    return fac[n] * f_inv[r] * f_inv[n-r] % mod


def prime_factorization(n):
    d = []
    i, e = 2, 0  # factor, exponent
    while i * i <= n:
        while n % i == 0:
            n //= i
            e += 1
        if e > 0:
            d.append((i, e))
        i += 1
        e = 0
    if n > 1:
        d.append((n, 1))
    return d


def main():
    N,M = map(int, readline().split())

    prepare(N+100, MOD)
    d = prime_factorization(M)

    ans = 1
    for i, e in d:
        ans *= cmb(N-1+e, e, MOD)
        ans %= MOD

    print(ans)


if __name__ == "__main__":
    main()


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

int main() {
	int N, X;
	cin >> N >> X;
	vector<int> m(N);
	int sum = 0;
	int Min = 10000;
	for (int i = 0; i < N; i++) {
		cin >> m.at(i);
		sum += m.at(i);
		Min = min(Min, m.at(i));
	}

	int count = (X - sum) / Min;

	cout << count + N << endl;

}

Measured memory_bytes: 256
#include <stdio.h>

long long W[101];
long long V[101];

long long dp[101][100001];

long long max(long long a, long long b) {
    if (a >= b) return a;
    else return b;
}

long long q (long long k, long long w) {
    if (dp[k][w] != -1) return dp[k][w];
    if (k == 0) dp[k][w] = 0;
    else if (w < W[k]) dp[k][w] = q(k-1, w);
    else {
        dp[k][w] = max(V[k] + q(k-1, w - W[k]), q(k-1, w));
    } 
    return dp[k][w];
}

int main(void) {

    long long N, M;
    scanf("%lld%lld", &N, &M);

    for (int i = 1; i <= N; i++) {
        scanf("%lld%lld", &W[i], &V[i]);
    }


    for (int i = 0; i <= N; i++) {
        for (long long j = 0; j <= M; j++) {
            dp[i][j] = -1;
        }
    }

    printf("%lld\n", q(N, M));


    return 0;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int x;
  cin >> x;
  x /= 200;
  cout << 10 - x << '\n';
}


Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c, d;
    bool bl;
    cin >> a >> b >> c >> d;
    if(abs(c-a) <= d){
        cout << "Yes" << endl;
    }else if(abs(a-b) <= d && abs(c-b) <= d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	
	int i, d, num;
	
	while(scanf("%d", &d) != EOF){
		num = 0;
		i = d;
		do{
			num = num + d * ((i - d) * (i - d));
			i += d;
		}while(i <= 600);
	
		printf("%d\n", num);
	}
	
	return 0;
}

Measured memory_bytes: 592
#include <cstdio>
#include <cstring>

char map[21][21];
int res;
int w,h;

void dfs(int sx, int sy) {
    if(sx<0 || sx>w-1 || sy<0 || sy>h-1) return;
    if(map[sy][sx] == '#') return;

    res++;
    map[sy][sx] = '#';

    dfs(sx+1,sy);
    dfs(sx,sy+1);
    dfs(sx-1,sy);
    dfs(sx,sy-1);
    return;
}

int main(void)
{
    int px,py;

    while(true)
    {
        res = 0;
        scanf("%d%d", &w, &h);
        if(!w && !h) break;
        for(int j=0; j < h; j++)
            scanf("%s", map[j]);

        for(int j=0; j < h; j++)
            for(int i=0; i < w; i++)
                if(map[j][i] == '@')
                    py = j, px =i;
        dfs(px, py);
        printf("%d\n", res);
    }

    return 0;
}

Measured memory_bytes: 1048
#include <stdio.h>

int main(void)
{

  int n;
  int k;

  scanf("%d", &n);
  scanf("%d", &k);

  int sum = 0;
  int x;

  for (int i = 0; i < n; ++i)
  {
    scanf("%d", &x);

    if (x - 0 < k - x)
    {
      sum += 2 * x;
    }
    else
    {
      sum += 2 * (k - x);
    }
  }

  printf("%d\n", sum);

  return 0;
}

Measured memory_bytes: 128
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>

#define pb(a) push_back(a)
#define mp make_pair


int main(){

  CIN(n,a);
  Yes(n%500<=a);



  return 0;
}



Measured memory_bytes: 768
import math

N = int(input()) * 3
a = list(map(int, input().split()))
ans = 0

a = sorted(a, reverse = True)

for i in range(1, int(2.0 / 3.0 * float(N)), 2):
    #print(a[i])
    ans += a[i]

print(ans)

Measured memory_bytes: 41156
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;

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

  int f[N];
  for(int i=0;i<N;i++){
    f[i] = 0;
  }
  int i=0;
  for(int l=1;l<=N;l++){
    for(int m=1;m<=N-l*l-l*m-l;m++){
      for(int n=1;n<=N-l*l-m*m-l*m-m*n-n*l;n++){
        int sum = l*l+m*m+n*n+l*m+m*n+n*l;
        if(sum>N) continue;
        f[sum-1] = f[sum-1]+1;
      }
    }
  }
  for(int i=0;i<N;i++){
    printf("%d\n",f[i]);
  }
  return 0;
}

Measured memory_bytes: 3744
<?php

	fscanf(STDIN, "%d",$n);
	$array = explode(" ",trim(fgets(STDIN)));
	
	for($i=0;$i<$n;$i++){
		if($i==0){
			$Amax = $array[$i];
		}elseif($Amax < $array[$i]){
			$Amax  = $array[$i];
		}
	}

	for($i=0;$i<$n;$i++){
		if($i==0){
			$Amin = $array[$i];
		}elseif($Amin > $array[$i]){
			$Amin  = $array[$i];
		}
	}
			
	echo $Amax - $Amin;
	
?>

Measured memory_bytes: 4856
s=input()
t=input()
n=len(s)
m=len(t)
dp=[[0 for x in range(n+1)] for y in range(m+1)]
for i in range(1,m+1):
    for j in range(1,n+1):
        if(s[j-1]==t[i-1]):
            dp[i][j]=1+dp[i-1][j-1]
        else:
            temp=max(dp[i-1][j],dp[i][j-1])
            dp[i][j]=temp
i,j=m,n
ans=''
while (i>0 and j>0):
    if(s[j-1]==t[i-1]):
        ans+=s[j-1]
        i-=1
        j-=1
    else:
        if(dp[i-1][j]>dp[i][j-1]):
            i-=1
        else:
            j-=1
print(ans[::-1])

Measured memory_bytes: 120156
N=int(input())
S=input()

ans=0
for i in range(N):
    X=S[:i]
    Y=S[i:]
    temp=0
    for j in range(26):
        if chr(ord("a")+j) in X and chr(ord("a")+j) in Y:
            temp+=1
    ans=max(ans,temp)
print(ans)

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

typedef long long ll;

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,l,n) for(int i=(l);i<=(n);i++)

template<class T>
using vt = vector<T>;
template<class T>
using vvt = vector<vector<T>>;

int main(){
    int a,b;
    cin >> a >> b;
    if(b+a > 23) cout << b+a-24 << endl;
    else cout << b+a << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int i=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int i=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    int N;
    cin >> N;
    map<string, int> mp;
    REP(i, N){
        string S;
        cin >> S;
        mp[S]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
    return 0;
}


Measured memory_bytes: 3632
process.stdin.resume();
process.stdin.setEncoding("utf8");
let input = "";
process.stdin.on("data", function(chunk) {input += chunk;});
process.stdin.on("end", function() {main(input.split("\n"));});

function main(lines) {
	let obj = {
		n : Number(lines[0]),
		A : lines[1].split(" ").map(Number),
		R : [],
		calc : function(i,w) {
			for (let k = i; k < this.n; k++) {
				let w2 = w + this.A[k];
				this.R.push(w2);
				this.calc(k+1, w2);
			}
		}
	};
	let M = lines[3].split(" ").map(Number);

	obj.calc(0,0);
	
	M.forEach(m => {
		if (obj.R.includes(m)) console.log("yes");
		else console.log("no");
	});
}


Measured memory_bytes: 47200