akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
    int n, k;
    scanf("%d%d",&n,&k);
    int a[n];
    for(int i = 0; i < n; i++)
        scanf("%d",&a[i]);
    int b[n];
    for(; k > 0 ;k--){
        int j = 0;
        for(int i = 0; i < n; i++){
            if(a[i] < n)
                j++;
        }
        if(j == 0)
            break;
        for(int i = 0; i < n; i++)
            b[i] = 0;
        for(int i = 0; i < n; i++){
            if(i - a[i] >= 0)
                b[i - a[i]] ++;
            else
                b[0] ++;
            if(a[i] + i + 1 < n)
                b[a[i] + i + 1] --;
        }
        a[0] = b[0];
        for(int i = 0; i < n - 1; i++)
            a[i + 1] = b[i + 1] + a[i];
    }
    for(int i = 0; i < n; i++)
        printf("%d ",a[i]);
    return 0;
}

Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  vector<int> ans(10000000,0);
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++){
    for(int j=a[i];j<=a[n-1];j+=a[i]){
      ans[j]++;
    }
  }
  long long cnt=0;
  for(int i=0;i<n;i++){
    if(ans[a[i]]==1)cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}
      

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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=200005;
ll a[N];
ll n;
map<pii,ll> dp;
ll rec(ll idx,ll left){
    if(dp.find({idx,left})!=dp.end()) return dp[{idx,left}];
    if(left==0){
        dp[{idx,left}]=0;
        return 0;
    }
    if(idx==n){
        dp[{idx,left}]=-INF;
        return -INF;
    }
    ll rem_el=n-idx;
    if(((rem_el+1)/2)<left){
        dp[{idx,left}]=-INF;
        return -INF;
    }
    ll ans;
    ans=rec(idx+1,left);
    if(left>0) ans=max(ans,rec(idx+2,left-1)+a[idx]);
    return dp[{idx,left}]=ans;
}
void solve(){
    cin>>n;
    rep(i,0,n-1) cin>>a[i];
    rec(0,n/2);
    cout<<dp[{0,n/2}]<<endl;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 39584
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std ;
typedef long long int ll ;


int main(){
	ios;
	ll a,b,k;
	cin>>a>>b>>k;
	
	if(k>=a+b){
		cout<<0<<" "<<0<<"\n";
	}
	else if(k-a>0){
		cout<<"0 "<<b-(k-a)<<'\n'; 
	}
	else
		cout<<a-k<<" "<<b<<"\n";

	return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <array>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long;

int main()
{
    int N, K;
    scanf("%d %d\n", &N, &K);
    vector<int> A(N);
    ll plus_sum = 0;
    ll plus_range_sum = 0;
    ll minus_range_sum = 0;
    ll range_sum_min = LLONG_MAX;
    for (int i = 0; i < N; ++i){
        int ai;
        scanf("%d", &ai); getchar();
        A[i] = ai;
        if (ai > 0){
            plus_sum += ai;
            plus_range_sum += ai;
        }else{
            minus_range_sum += -ai;
        }
        if (i >= K){
            auto& aik = A[i - K];
            if (aik > 0) plus_range_sum -= aik;
            if (aik < 0) minus_range_sum -= -aik;
        }
        if (i >= K - 1){
            range_sum_min = min(plus_range_sum, range_sum_min);
            range_sum_min = min(minus_range_sum, range_sum_min);
        }
    }
    printf("%lld\n", plus_sum - range_sum_min);
}


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


int main() {
  int N;
  cin >> N;
  int cnt = 0;


  rep1(i, N) {
    int p;
    cin >> p;
    if (p != i) {
      cnt += 1;
    }
  }

  if (cnt == 2 || cnt == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7;
int n;
int num[1005];
void gen (int x){
	for(int i = 2 ; i <= n ; ++i){
		while(x % i == 0){
			num[i]++;
			x /= i;
		}
	}
}
int main() {
	cin>>n;
	long long  res = 1;
	for(int i = 2 ; i <= n ; ++i)gen(i);
	for(int i = 2 ; i <= n ; ++i)res = (res * (num[i] + 1)) % Mod;
	cout<<res;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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 Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;
    
    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }
    
    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }
    
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }
    
    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }
    
    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

int INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, m;
    cin>>n>>m;

    UnionFind<ll> wds(n);
    rep(i, m) {
        ll l, r, d;
        cin>>l>>r>>d; l--; r--;

        if (wds.issame(l, r) && wds.diff(l, r) != d) {
            cout<<"No"<<endl;
            return 0;
        }

        wds.merge(l, r, d);
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 1792
#define Link "https://arc085.contest.atcoder.jp/tasks/arc085_c"

#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>

#define TASK "MUL"

#define pii pair<int,int>
#define i first
#define v second

using namespace std;

void OpenFile()
{
    freopen(TASK".INP","r",stdin);
    freopen(TASK".OUT","w",stdout);
}

const int oo = 1e9 + 1;
const int maxn1 = 1e2 + 2;
const int maxn2 = 1e3 + 1;
int n,S,T,a[maxn1],cf[maxn2],cnt,b[maxn1],num[maxn1];
vector <pii> e[maxn1];
long long res;

void Enter()
{
    cin >> n;
    for (int i=1;i<=n;++i)
        cin >> a[i];
}

void Connect(int u, int v, int w)
{
    e[u].push_back(pii(++cnt,v));
    cf[cnt] = w;
    e[v].push_back(pii(++cnt,u));
}

void Init()
{
    S = 0;
    T = n + 1;
    cnt = 1;
    for (int i=1;i<=n;++i)
        if (a[i] <= 0) {
            Connect(S,i,-a[i]);
            for (int j=i+i;j<=n;j+=i)
                Connect(i,j,+oo);
        }
        else {
            Connect(i,T,a[i]);
            res += a[i];
        }
}

bool Can(int S, int T)
{
    queue <int> qu;
    fill(b,b+n+1+1,+oo);
    b[S] = 0;
    qu.push(S);
    while (!qu.empty()) {
        int u = qu.front();
        qu.pop();
        if (u == T)
            return 1;
        for (pii p : e[u]) {
            int i = p.i;
            int v = p.v;
            if (cf[i] > 0 && b[v] == +oo) {
                b[v] = b[u] + 1;
                qu.push(v);
            }
        }
    }
    return 0;
}

int Find(int u, int mn)
{
    if (u == T)
        return mn;
    num[u] = cnt;
    for (pii p : e[u]) {
        int i = p.i;
        int v = p.v;
        if (num[v] != cnt && cf[i] > 0 && b[v] == b[u] + 1)
            if (int x = Find(v,min(mn,cf[i]))) {
                cf[i] -= x;
                cf[i^1] += x;
                return x;
            }
    }
    return 0;
}

void Solve()
{
    while (Can(S,T))
        while (int x = (++cnt,Find(S,+oo)))
            res -= x;
    cout << res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //OpenFile();

    Enter();
    Init();
    Solve();
}


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

typedef long long ll;

int main() {
    ll N, s = 0;
    cin >> N;
    vector<ll> A(N + 1);
    rep(i, N) {
        cin >> A[i];
        s += A[i];
    }
    ll b = N * (N + 1) / 2;
    if (s % b != 0) {
        cout << "NO\n";
        return 0;
    }
    ll t = s / b;
    A[N] = A[0];
    rep(i, N) {
        ll d = A[i] + t - A[i + 1];
        if (d < 0 || d % N != 0) {
            cout << "NO\n";
            return 0;
        }
    }
    cout << "YES\n";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int a[100001];
int Count = 0;
int fib[100001];

int fibonacci(int n) {
    int i;
    fib[0] = 1;
    if(a[Count] == 1){
        fib[1] = 0;
        Count++;
    }
    else fib[1] = 1;
    for(i = 2; i <= n; ++i) {
        if(i == a[Count]){
            fib[i] = 0;
            Count++;
        }
        else{
            fib[i] = (fib[i-1] + fib[i-2])%1000000007;
        }

    }
    return fib[n];
}

int main(){
    int N,M;
    cin >> N >> M;
    for (int i = 0; i < M; i++)
    {
        cin >> a[i];
    }
    int ans = fibonacci(N);
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;

template<class T>
struct Gedge {
	LL src, to;
	T cost;
	Gedge(LL s, LL t, T c) :src(s), to(t), cost(c) {}
	Gedge(LL t, T c) :src(-1), to(t), cost(c) {}
};

template<class T>
using WeightedGraph = vector<vector<Gedge<T>>>;
using UnweightedGraph = vector<vector<LL>>;
template<class T>
using Gedges = vector<Gedge<T>>;

struct TNode {
	LL parent;
	VLL childs;
	TNode() :parent(-1) {};
};
using Tree = vector<TNode>;

//到達不可能->INF
template<class T>
void dijkstra(WeightedGraph<T>& G, LL start, vector<T>& res) {
	res.resize(G.size(), INF);
	res[start] = 0;
	typedef pair<T, LL> P;
	priority_queue<P, vector<P>, greater<P>> q;
	q.push(P(0, start));
	while (!q.empty()) {
		LL cur = q.top().second;
		T cost = q.top().first;
		q.pop();
		if (res[cur] < cost)continue;
		for (Gedge<T> e : G[cur]) {
			if (res[e.to] > cost + e.cost) {
				res[e.to] = cost + e.cost;
				q.push(P(res[e.to], e.to));
			}
		}
	}
	return;
}

LL conv(LL pos, LL c) {
	return pos * 2501 + c;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N, M, S;
	cin >> N >> M >> S;
	S = min(S, (LL)2500);
	WeightedGraph<LL> Gcost(N),Gtime(N);
	for (LL m = 0; m < M; m++) {
		LL u, v;
		cin >> u >> v;
		u--; v--;
		LL a, b;
		cin >> a >> b;
		Gcost[u].push_back(Gedge<LL>(u, v, a));
		Gcost[v].push_back(Gedge<LL>(v, u, a));
		Gtime[u].push_back(Gedge<LL>(u, v, b));
		Gtime[v].push_back(Gedge<LL>(v, u, b));
	}
	vector<PLL> exc(N);   //first枚にsecond分
	for (LL n = 0; n < N; n++) {
		cin >> exc[n].first >> exc[n].second;
	}
	WeightedGraph<LL> Gwhole(N * 2501);
	for (LL n = 0; n < N; n++) {
		for (LL c = 0; c <= 2500; c++) {
			LL cur = conv(n, c);
			for (LL e = 0; e < Gcost[n].size(); e++) {
				LL next = Gcost[n][e].to;
				LL cost = Gcost[n][e].cost;
				LL time = Gtime[n][e].cost;
				if (c >= cost) {
					Gwhole[cur].push_back({ cur,conv(next,c - cost),time });
				}
			}
			if (c+exc[n].first <= 2500) {
				Gwhole[cur].push_back({ cur,conv(n,c + exc[n].first),exc[n].second });
			}
		}
	}
	VLL res;
	LL start = conv(0, S);
	dijkstra(Gwhole, start, res);
	for (LL n = 1; n < N; n++) {
		LL ans = res[conv(n, 0)];
		for (LL c = 1; c <= 2500; c++) {
			ans = min(ans, res[conv(n, c)]);
		}
		cout << ans << "\n";
	}
	return 0;
}

Measured memory_bytes: 29424
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  string S;
  cin >> S;
  ll K;
  cin >> K;
  int sum = 0;
  int cnt = 0;
  REP(i,S.size()-1){
    if(S.at(i)==S.at(i+1)){
      cnt++;
    }
    if(cnt>0&&S.at(i)!=S.at(i+1)){
      sum+=(cnt+1)/2;
      cnt=0;
    }
  }
  if(cnt>0){
    sum+=(cnt+1)/2;
  }
  int sum2 = 0;
  int cnt2 = 0;
  string T=S+S;
  REP(i,T.size()-1){
    if(T.at(i)==T.at(i+1)){
      cnt2++;
    }
    if(cnt2>0&&T.at(i)!=T.at(i+1)){
      sum2+=(cnt2+1)/2;
      cnt2=0;
    }
  }
  if(cnt2>0){
    sum2+=(cnt2+1)/2;
  }
  int sum3 = 0;
  int cnt3 = 0;
  string P=S+S+S;
  REP(i,P.size()-1){
    if(P.at(i)==P.at(i+1)){
      cnt3++;
    }
    if(cnt3>0&&P.at(i)!=P.at(i+1)){
      sum3+=(cnt3+1)/2;
      cnt3=0;
    }
  }
  if(cnt3>0){
    sum3+=(cnt3+1)/2;
  }

  if(K%2==1){
    ll y = sum+(sum3-sum)*((K-1)/2);
    cout << y << endl;
  }else{
    ll x = sum+(sum3-sum)*((K-1)/2)+(sum2-sum);
    cout << x << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdint>

template<std::uint_fast64_t Mod>
class ModInt{
    using u64 = uint_fast64_t;
public:
    u64 num;
    constexpr ModInt(const u64 x = 0) noexcept : num(x % Mod) {}
    constexpr u64 &value() noexcept { return num; }
    constexpr const u64 &value() const noexcept { return num; }
    constexpr ModInt operator+(const ModInt rhs) const noexcept {
        return ModInt(*this) += rhs;
    }
    constexpr ModInt operator-(const ModInt rhs) const noexcept {
        return ModInt(*this) -= rhs;
    }
    constexpr ModInt operator*(const ModInt rhs) const noexcept {
        return ModInt(*this) *= rhs;
    }
    constexpr ModInt operator/(const ModInt rhs) const noexcept {
        return ModInt(*this) /= rhs;
    }
    constexpr ModInt &operator+=(const ModInt rhs) noexcept {
        num += rhs.num;
        if (num >= Mod) {
            num -= Mod;
        }
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt rhs) noexcept {
        if (num < rhs.num) {
            num += Mod;
        }
        num -= rhs.num;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt rhs) noexcept {
        num = num * rhs.num % Mod;
        return *this;
    }
    constexpr ModInt &operator/=(ModInt rhs) noexcept {
        u64 exp = Mod - 2;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
    constexpr ModInt &operator=(const u64 num) noexcept {
        this->num = num % Mod;
        return this->num;
    }
};

template<std::uint_fast64_t Mod>
std::ostream &operator<<(std::ostream &out, const ModInt<Mod> &m)
{
    out << m.num;
    return out;
}

template<std::uint_fast64_t Mod>
std::istream &operator>>(std::istream &in, ModInt<Mod> &m)
{
    in >> m.num;
    if(m.num >= Mod){
        m.num %= Mod;
    }
    return in;
}

using namespace std;

int main(){
    static const int INF = 1e9 + 7;
    int n;
    cin >> n;
    string str;
    cin >> str;
    ModInt<INF> ans = 1;
    int cnt = 0;
    for(int i = 0; i < 2 * n; i++){
        if(str[i] == 'W'){
            if((cnt) % 2 == 0){
                ans *= cnt;
                cnt--;
            }else{
                cnt++;
            }
        }else{
            if((cnt) % 2 == 1){
                ans *= cnt;
                cnt--;
            }else{
                cnt++;
            }
        }
        if(cnt < 0){
            cout << "0\n";
            return 0;
        }
    }
    if(cnt){
        cout << "0\n";
        return 0;
    }
    for(int i = 1; i <= n; i++){
        ans *= i;
    }
    cout << ans << "\n";
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll dp[3002][3002];
ll a[3002];
int n;

void search(int start, int delta){
    int end = start + delta;
    int turn = 1;
    if((n - delta) % 2 == 0) turn = -1;
    ll now1 = dp[start + 1][end] + turn * a[start];
    ll now2 = dp[start][end - 1] + turn * a[end];
    if(turn == 1){
        dp[start][end] = max(now1, now2);
    } else {
        dp[start][end] = min(now1, now2);
    }
}

int main() {
    //cout.precision(10);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int delta = 0; delta < n; delta++){
        for(int start = 1; start + delta <= n; start++){
            search(start, delta);
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            //cout << dp[i][j] << " ";
        }
        //cout << endl;
    }
    cout << dp[1][n] << endl;
    return 0;
}


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

typedef long long ll;

int n;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    bool ok = false;
    for (int i = 1; i <= 9; ++i) {
        if (n % i == 0) {
            int a = n / i;
            if (a <= 9) {
                ok = true;
                break;
            }
        }
    }
    if (ok)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 256
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int64 n, m;
  cin >> n >> m;
  n %= m;
  cout << min(n, m - n) << endl;
  return 0;
}


Measured memory_bytes: 256
/*
 * FileName:     binary_search
 * CreatedDate:  2020-06-10 20:06:45 +0900
 * LastModified: 2020-06-10 20:30:43 +0900
 */

#include <stdio.h>
#include <stdlib.h>
void bi_search(int k,int *a,int left,int right){
    if(left+1==right){
        if(a[left]==k){
            printf("1\n");
        }
        else{
            printf("0\n");
        }
        return;
    }
    int middle=(left+right+1)/2;
    if(a[middle]>k){
        bi_search(k,a,left,middle);
    }
    else if(a[middle]<k){
        bi_search(k,a,middle,right);
    }
    else{
        printf("1\n");
        return ;
    }
}
int main(void){
    int n;scanf("%d",&n);
    int *a = malloc(n*sizeof(int));
    for(int i=0;i<n;i++)scanf("%d",a+i);
    int q;scanf("%d",&q);
    for(int i=0;i<q;i++){
        int k;scanf("%d",&k);
        bi_search(k,a,0,n);
    }
    free(a);
    return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long ll;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,r,p=5;
  cin>>n;
  r=n/100;
  n%=100;
  if(n==0){
    cout<<1;
    return 0;
  }
  rep(i,r){
    if(n>p)n-=p;
    else{
      cout<<1;
      return 0;
    }
  }
  cout<<0;
  return 0;
}

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

int main() {

 int n;
cin>>n;
long int ahead=0;
long int my=0;
long int to=0;
for(int i=0;i<n;i++)
{
 cin>>my;
if(ahead>my)
{
to=to+(ahead-my);
my=ahead;
}
ahead=my;
}
cout<<to<<endl;
}

Measured memory_bytes: 3592
#include "bits/stdc++.h"

using namespace std;
using ll = long long;

#define endl '\n'

const int INF = 1e9 + 5;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int& x : h) cin >> x;
    vector<int> dp(n, INF);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        int j = i + 1;
        while (j < n && j <= i + k) {
            dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
            ++j;
        }
    }
    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 3960
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#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 n,m,c;
  cin >> n >> m >> c;
  vector<int> b(m);
  rep(i,m) cin >> b[i];
  int ans = 0;
  rep(ni,n){
    vector<int> a(m);
    rep(i,m) cin >> a[i];
    int res = c;
    rep(i,m) res += a[i]*b[i];
    if(res>0) ++ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in [0]*m]
    q = int(input())
    vdc = [list(map(int, input().split())) for _ in [0]*q]

    g = [[] for _ in [0]*n]
    [g[a-1].append(b-1) for a, b in ab]
    [g[b-1].append(a-1) for a, b in ab]

    dist = [[0]*11 for _ in [0]*n]
    dist2 = [0]*n

    for v, d, c in vdc[::-1]:
        v -= 1
        if dist[v][d] != 0:
            continue
        dist[v][d] = c
        if dist2[v] == 0:
            dist2[v] = c
        if d > 0:
            q = [(v, d, c)]
            while q:
                v, d, c = q.pop()
                for i in g[v]:
                    if dist[i][d-1] == 0:
                        dist[i][d-1] = c
                        if dist2[i] == 0:
                            dist2[i] = c
                        if d > 1:
                            q.append((i, d-1, c))
    for i in dist2:
        print(i)


main()


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

const int N = 1e5 + 10;

int a[N];

int main(){
	int n, k;
	scanf("%d %d",&n,&k);
	for (int i = 1; i <= n; i++) scanf("%d",&a[i]);
	printf("%d\n", (n - 2) / (k - 1) + 1);
	return 0;
} 

Measured memory_bytes: 640
import sys
import math

sys.setrecursionlimit(100000000)

n = int(input())
s = int(input())

def f(b, n):
    if n<b:
        return n
    else:
        return f(b, n//b) + n%b

if s > n:
    print(-1)
elif s==n:
    print(s+1)
else:
    for b in range(2, math.ceil(math.sqrt(n))+1):
        if f(b, n)==s:
            print(b)
            break
    else:
        for d in range(math.floor(math.sqrt(n)), 0, -1):
            if (n-s)%d==0 and f((n-s)//d+1, n)==s:
                print((n-s)//d+1)
                break
        else:
            print(-1)

Measured memory_bytes: 3064
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        x: u64
    }
    let mut x = x;
    let cnt1 = x / 500 * 1000;
    x = x % 500;
    let cnt2 = x / 5 * 5;
    println!("{}", cnt1 + cnt2);
}


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

int main(){
    int n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    string s;
    cin>>s;
    --a;--b;--c;--d;
    bool ok=true;
    for(int i=a+1;i<c-1;i++){
        if(s[i]=='#'&&s[i+1]=='#')ok=false;
    }
    for(int i=b+1;i<d-1;i++){
        if(s[i]=='#'&&s[i+1]=='#')ok=false;
    }
    if(ok&&d<c){
        ok=false;
        for(int i=b;i<=d;i++){
            if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.')ok=true;
        }
    }
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

int main() {
  int n; cin >> n;
  int a[100]; for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, greater<int>()); 
  int Alice = 0;
  int Bob = 0;
  for (int i = 0; i < n; i += 2) Alice += a[i];
  for (int i = 1; i < n; i += 2) Bob += a[i];
  cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
#![allow(unused_macros, unused_imports, dead_code, non_snake_case)]

use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
            assert!(_it.next().is_none());
        }
    };
}

fn runlength(s: &String) -> Vec<(char, usize)> {
    let mut res = Vec::new();
    let mut cur: char = '$';
    let mut cnt = 0;
    for x in s.chars() {
        if x != cur {
            if cnt > 0 {
                res.push((cur, cnt));
            }
            cur = x;
            cnt = 1;
        } else {
            cnt += 1;
        }
    }
    if cnt > 0 {
        res.push((cur, cnt));
    }
    res
}

fn main() {
    loop {
        from_line!(n:String);
        if n == "#" { break; }
        let mut s = String::new();
        for x in n.chars() {
            if "yuiopjklhnm".contains(x) {
                s.push('0');
            } else {
                s.push('1');
            }
        }
        println!("{}", runlength(&s).len() - 1);
    }
}



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

using namespace std;

using int64 = long long;

int main() {
  int N, M, D;
  cin >> N >> M >> D;
  // 小 -> 大
  double ret = 1.0 * (N - D) * (M - 1) / N / N;
  if(D == 0) cout << fixed << setprecision(10) << ret << endl;
  else cout << fixed << setprecision(10) << ret * 2 << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))


int n;
int dat[105];
int main(void){
	scanf("%d",&n);
	rep(i,n)scanf("%d",&dat[i]);
	
	int ans=IINF;
	reg(i,-100,100){
		int s=0;
		rep(j,n){
			int p=dat[j]-i;
			s+=p*p;
		}
		ans=min(ans,s);
	}
	printf("%d\n",ans);
	return 0;
}






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

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

#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 ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    string s;
    cin >> s;
    int ans = s[0]-'0';
    bool flag = true;
    FOR(i,1,s.size()){
        if(s[i]!='9')flag = false;
    }
    if(flag) ans += (s.size()-1)*9;
    else ans += (s.size()-1)*9-1;
    COUT(ans);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<list>
#include<functional>
#define mp make_pair
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define MOD 1000000007LL
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef complex<double> base;
ll POW(ll a, ll b) { if (b == 0)return 1; if (b == 1)return a; if (b & 1)return (a*POW(a, b - 1)) % MOD; ll t = POW(a, b / 2); return (t*t) % MOD; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };//동북남서
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

int a[100000];
set<int> S;
int main()
{
	int n,t;
	scanf("%d%d", &n,&t);
	fup(i, 0, n - 1, 1)
		scanf("%d", a + i);
	int Min = INF;
	int Max = 0;
	fup(i, 0, n - 1, 1)
	{
		Min = min(Min, a[i]);
		Max = max(Max, a[i] - Min);
	}
	int ans = 0;
	fup(i, 0, n - 1, 1)
	{
		if (S.find(a[i] - Max) != S.end())ans++;
		S.insert(a[i]);
	}
	printf("%d", ans);
}

Measured memory_bytes: 5376
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int n, x;
  cin >> n >> x;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long sum = 0;
  int ans = 1;
  for (int i = 0; i < n; i++) {
    sum += arr[i];
    if (sum <= x) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

vector<vector<int> > edges;
vector<map<int, int> > memo;
vector<pair<int, pair<int, int> > > memo2;

int solve(int curr, int prev)
{
    if(memo[curr].find(prev) != memo[curr].end())
        return memo[curr][prev];

    if(memo[curr].empty()){
        pair<int, int> ans(0, 0);
        for(int next : edges[curr]){
            if(next != prev){
                int d = solve(next, curr) + 1;
                if(ans.first < d)
                    swap(ans.first, d);
                if(ans.second < d)
                    swap(ans.second, d);
            }
        }
        memo[curr][prev] = ans.first;
        memo2[curr] = make_pair(prev, ans);
        return ans.first;
    }
    else{
        int prev2 = memo2[curr].first;
        pair<int, int> ans = memo2[curr].second;;
        if(prev2 != -1){
            int d = solve(prev2, curr) + 1;
            if(ans.first < d)
                swap(ans.first, d);
            if(ans.second < d)
                swap(ans.second, d);
        }

        if(prev == -1){
            memo[curr][prev] = ans.first;
            return ans.first;
        }
        else{
            int d = solve(prev, curr) + 1;
            if(ans.first == d){
                memo[curr][prev] = ans.second;
                return ans.second;
            }
            else{
                memo[curr][prev] = ans.first;
                return ans.first;
            }
        }
    }
}

int main()
{
    int n;
    cin >> n;
    edges.resize(n);
    for(int i=0; i<n-1; ++i){
        int u, v;
        cin >> u >> v;
        -- u;
        -- v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }

    memo.resize(n);
    memo2.resize(n);
    for(int i=0; i<n; ++i){
        int ans = 2 * (n - 1) - solve(i, -1);
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 39324
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 303000;
int N, t[4*MAXN],a[MAXN],b[MAXN],k;

void build( int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = a[tl];
    } else {
        int tm = (tl + tr) / 2;
        build(v*2, tl, tm);
        build(v*2+1, tm+1, tr);
        t[v] = max(t[v*2] , t[v*2+1]);
    }
}

int sum(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr) {
        return t[v];
    }
    int tm = (tl + tr) / 2;
    return max(sum(v*2, tl, tm, l, min(r, tm))
           , sum(v*2+1, tm+1, tr, max(l, tm+1), r));
}

void update(int v, int tl, int tr, int pos, int new_val) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2] , t[v*2+1]);
    }
}


signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  cin >> N >> k;
  int n = 300004;
  for(int i=1;i<=N;i++){
    cin >> b[i];
  } 
  build(1,0,n-1);
  int ans = 0;
  for(int i=1;i<=N;i++){
    int l = max(0LL,b[i]-k);
    int r = min(n-1,b[i]+k);
    int cur = sum(1,0,n-1,l,r);
    ans = max(ans,cur+1);
    update(1,0,n-1,b[i],cur+1);
  }
  cout << ans << endl;
  


return 0;
}
///....


Measured memory_bytes: 14168
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# --------------------------------------------

dp = None

def main():
    N, K = [int(_) for _ in input().split()]
    A = [int(_) for _ in input().split()]

    ans = 1
    idx = K - 1
    while idx < N - 1:
        ans += 1
        idx += (K - 1)

    print(ans)

    # min_num_idx = A.index(min(A))

    # ans1 = 0

    # left_idx = min_num_idx
    # while left_idx > 0:
    #     ans += 1
    #     left_idx -= (K - 1)

    # right_idx = min_num_idx
    # while right_idx < (N - 1):
    #     ans += 1
    #     right_idx += (K - 1)

    # print(ans)

main()


Measured memory_bytes: 15380
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

M = INT()
print(48-M)

Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    cout << (m * 1900 + (n - m) * 100) * (1 << m);
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var NM = IO.RSInt;
            var N = NM[0];
            var M = NM[1];

            var Graph = new List<List<int>>();
            for (int i = 0; i < N; i++)
            {
                Graph.Add(new List<int>());
            }
            for (int i = 0; i < M; i++)
            {
                var ab = IO.RSInt;
                Graph[ab[0] - 1].Add(ab[1] - 1);
                Graph[ab[1] - 1].Add(ab[0] - 1);
            }

            var dist = Enumerable.Repeat(-1, N).ToArray();
            var que = new Queue<int>();

            dist[0] = 0;
            que.Enqueue(0);

            while (que.Count != 0)
            {
                int now = que.Dequeue();

                foreach (var around in Graph[now])
                {
                    if (dist[around] != -1) continue;
                    dist[around] = dist[now] + 1;
                    que.Enqueue(around);
                }
            }
            if (dist[N - 1] == 2)
                WriteLine("POSSIBLE");
            else
                WriteLine("IMPOSSIBLE");
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
typedef long long ll;

int main(){
  int h,n;
  cin >> h >> n;
  int a;
  int sum = 0;
  rep(i,n){
    cin >> a;
    sum += a;
  }
  if(sum>=h)cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N, M;
set<string> st;
bool mp;
string s;

int main()
{
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> s;
        st.insert(s);
    }
    cin >> M;
    for (int i = 0; i < M; i++)
    {
        cin >> s;
        if (st.find(s) != st.end())
        {
            mp = !mp;
            cout << (mp ? "Opened " : "Closed ") << "by " + s << endl;
        }
        else
        {
            cout << "Unknown " + s << endl;
        }
    }
}


Measured memory_bytes: 3236
n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if 10000 * i + 5000* j + 1000 * (n-i-j) == y:
            ans = "%s %s %s"%(i, j, n-i-j)
            break
        else:
            continue
try:
    print(ans)
except:
    print("-1 -1 -1")


Measured memory_bytes: 2940
import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    h,w=list(map(int, readline().strip().split()))

    if w==1:
        print(1)
        return

    if h==1:
        print(1)
        return

    ki=(w+1)//2
    gu=w//2

    amari=h%2
    half=h//2
    masu=(amari+half)*ki+half*gu
    #arr=list(map(int, readline().strip().split()))
    #n=int(readline().strip())
    print(masu)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

Measured memory_bytes: 5580
import java.util.Scanner;
public class Main{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner stdIn = new Scanner(System.in);
        
        for(int i = 1;i <= 10000;i++){
            int x = stdIn.nextInt();
            System.out.println("Case "+i+": "+x);
        }
    
}
}

Measured memory_bytes: 44536
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

const double pi = 3.141592653589793;

struct point {
    double x;
    double y;

    point(double x, double y)
        : x(x), y(y) {}
};

point divide(double t, const point& p1, const point& p2) {
    auto x = (1 - t) * p1.x + t * p2.x;
    auto y = (1 - t) * p1.y + t * p2.y;
    return point(x, y);
}

using point_list = vector<point>;

point_list koch_curve(int n) {
    point_list points = {point(0, 0), point(100, 0)};
    for (int i = 0; i < n; ++i) {
        point_list tmp = {points[0]};
        for (auto it = points.begin(); it != points.end()-1; ++it) {
            auto p1 = *it;
            auto p2 = *(it + 1);

            auto s = divide(1/3., p1, p2);
            auto t = divide(2/3., p1, p2);

            auto dx = t.x - s.x;
            auto dy = t.y - s.y;
            auto ux = dx * cos(pi/3) - dy * sin(pi/3) + s.x;
            auto uy = dx * sin(pi/3) + dy * cos(pi/3) + s.y;
            auto u = point(ux, uy);

            tmp.push_back(s);
            tmp.push_back(u);
            tmp.push_back(t);
            tmp.push_back(p2);
        }
        points = tmp;
    }
    return points;
}

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

    auto points = koch_curve(n);
    for (auto it = points.begin(); it != points.end(); ++it) {
        cout << it->x << " " << it->y << endl;
    }

    return 0;
}

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

int isprime(int &num){
	if(num==2)
      return 1;
    else if(num%2==0)
    {
      return 0;
    }
    else{
      for(int i=3;i*i<=num;i=i+2){
        if(num%i==0){
          return 0;
        }
      }
      return 1;
    }
}

int main(){
  int ans = 0, num = 0;
  int flag = 0;
  
  cin >> num;
  while(cin >> num){
    flag = isprime(num);
    if(flag == 1)
      ans++;
  }
  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 2988