akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    static int h;
    static int w;

    static bool isOdd(int x)
    {
	return (x&1) == 1;
    }
    
    static Tuple<int, int> nextPos(int hh, int ww)
    {
	int nh=0, nw=0;
	
	if (isOdd(hh))
	{
	    if (ww < w)
	    {
		nh = hh;
		nw = ww+1;
	    }
	    else
	    {
		nh = hh + 1;
		nw = ww;
	    }
	}
	else
	{
	    if (ww > 1)
	    {
		nh = hh;
		nw = ww - 1;
	    }
	    else
	    {
		nh = hh + 1;
		nw = ww;
	    }
	}

	return Tuple.Create(nh, nw);
    }

    public static void Main()
    {
	var tmp = ReadIntArray();
	h = tmp[0]; w = tmp[1];
	int[][] d = new int[h][];
	for (int i = 0; i < h; i++)
	    d[i] = ReadIntArray();

	var ls = new List<Tuple<int, int, int, int>>();
	
	int hh = 1, ww = 1;
	while (hh <= h)
	{
	    var t = nextPos(hh, ww);
	    int nh = t.Item1, nw = t.Item2;
	    if (nh <= h && isOdd(d[hh-1][ww-1]))
	    {
		ls.Add(Tuple.Create(hh, ww, nh, nw));
		d[hh-1][ww-1]--;
		d[nh-1][nw-1]++;
	    }
	    hh = nh; ww = nw;
	}


	WriteLine(ls.Count());
	foreach (var t in ls)
	{
	    WriteLine($"{t.Item1} {t.Item2} {t.Item3} {t.Item4}");
	}
    }
}


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

using namespace std;
using ld= long double;
using ll = long long;
const int maxn = 6e5 + 1;
using pt = array<ld, 3>;
const ld EPS = 1e-9;
const int MOD = 998244353;
ll dp[maxn];
ll res_dp[maxn];
ll val[maxn];

int main() {
#ifdef zxc
    freopen("../kolya_input.txt", "r", stdin);
#else
    //    freopen("damage.in", "r", stdin);
    //    freopen("damage.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(5);
    cout << fixed;
    int n;
    cin >> n;
    string s;
    cin >> s;
    string rev_s = s;
    for (char &c:rev_s) {
        if (c == '1') {
            c = '0';
        } else {
            c = '1';
        }
    }
    for (int i = 0; i < n; ++i) {
        val[i + 1] = val[i] * 2 + s[i] - '0';
        val[i + 1] %= MOD;
    }
    for (int k = 1; k <= 2 * n; ++k) {
        if (2 * n % k != 0 || 2 * n / k % 2 == 0) {
            continue;
        }

        dp[k] = val[k / 2];
        string t = s.substr(0, k / 2);
        string rev_t = t;
        for (char &c:rev_t) {
            if (c == '1') {
                c = '0';
            } else {
                c = '1';
            }
        }
        string z;
        for (int i = 0; i < 2 * n / k; ++i) {
            if (i & 1) {
                z += rev_t;
            } else {
                z += t;
            };
        }
        if (z <= s) {
            dp[k]++;
            if (dp[k] >= MOD) {
                dp[k] -= MOD;
            }
        }
    }
//    for (int i = 1; i <= 2 * n; ++i) {
//        cout << i << " " << dp[i] << endl;
//    }
    ll ans = 0;
    for (int i = 1; i <= 2 * n; ++i) {
        if (2 * n % i != 0 || 2 * n / i % 2 == 0) {
            continue;
        }
        res_dp[i] = dp[i];

        for (int d = 1; d < i; d++) {
            if (i % d != 0) {
                continue;
            }
            res_dp[i] += MOD - res_dp[d];
            if (res_dp[i] >= MOD) {
                res_dp[i] -= MOD;
            }
        }
        ans += res_dp[i] * i % MOD;
        if (ans >= MOD) {
            ans -= MOD;
        }
    }
    cout << ans;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,x; cin>>n>>x;
	vector<int>v(n);
	int64_t ans=0;
	for(auto&i:v){
		cin>>i;
		if(i>x)ans+=i-x,i=x;
	}
	for(int i=1;i<n;++i){
		int l=v.at(i-1),r=v.at(i);
		if(l+r>x){
			ans+=l+r-x;
			v.at(i)=x-l;
		}
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 640
// finish date: 2018/12/22

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>>
        vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    //入力と変数宣言
    int N;
    cin >> N;
    vi a(N);
    rep(i, N) cin >> a[i];
    sort(a.begin(), a.end());

    map<int, int> mp;
    rep(i, N) {
        mp[a[i]]++;
    }
    vi stk;
    vi stk_val;
    for (auto e = mp.rbegin(); e != mp.rend(); e++) {
        stk.push_back(e->second);
        stk_val.push_back(e->first);
    }

    vi tower(N + 1, 0);
    int tmp = 0;
    rep(i, stk.size() - 1) {
        tmp += stk[i];
        tower[tmp] = stk_val[i] - stk_val[i + 1];
    }
    tower[N] = stk_val[stk_val.size() - 1];

    int nim = 0;
    rep(i, N + 1) {
        if (tower[i] % 2 == 1) {
            nim ^= i;
        }
    }
    if (nim != 0) cout << "first" << endl;
    else cout << "second" << endl;

    return 0;
}



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

//.define
//#define FILE_IN_OUT
#define RET(_x)                       return std::cout << (_x), 0;
#define all(_obj)                     (_obj).begin(), (_obj).end()
#define fori(_iterator, _begin, _end) for (int _iterator = (_begin); _iterator < (_end); ++_iterator)
#define forr(_iterator, _begin, _end) for (int _iterator = (_begin); _iterator >= (_end); --_iterator)
#define loop(_n)                      for (int i = 0; i < (_n); ++i)
#define divCeil(_dividend, _divider)  (((_dividend) - 1LL + (_divider)) / (_divider))
#define sz(_obj)                      static_cast<int>((_obj).size())
#define endl                          "\n"
template<typename Tp>
inline void outarr(Tp _array, const std::size_t _N, const char* _delim = " ") {
    Tp end = _array + _N;
    for (Tp current = _array; current != end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = std::int64_t;
using pii = std::pair<int, int>;
constexpr int INF = INT_MAX;
constexpr int MOD = 1e9 + 7;

//.data

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream сin  ("input.txt",  std::ios::in);
    std::ofstream сout ("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    char a, b;
    cin >> a >> b;

    if (a < b) {
        RET('<');
    } else if (a > b) {
        RET('>');
    }

    cout << '=';

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n;
    int num;
    int i;
    int mult4,mult2;
    while (cin>>n)
    {
        mult4=mult2=0;
        for (i=0;i<n;i++)
        {
            cin>>num;
            if (num%4==0)
                mult4++;
            else if (num%2==0)
                mult2++;
        }
        if (mult2)
            n-=mult2-1;
        if(mult4>=n/2)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 384
n, q = gets.split.map &:to_i
prev = nil
sum = 0
sums = gets.chomp.each_char.map { |c|
  sum += 1 if prev == 'A' and c == 'C'
  prev = c
  sum
}

q.times do
  a, b = gets.split.map &:to_i
  count = sums[b-1] - sums[a-1]
  #count -= 1 if sums[a-2] < sums[a-1]
  p count
end

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

using namespace std;

struct edge {
    int f, t, c;
    edge(int f = 0, int t = 0, int c = 0): f(f), t(t), c(c) {}
};

const int INF = 1e9;
const int MAX_V = 1010;
const int MAX_E = 2010;
int V, E, r, d[MAX_V];
edge es[MAX_E];

bool bellmanFord(int s) {
    fill(d, d + V, INF);
    d[s] = 0;

    for (int i = 0; i < V; i++) {
        bool update = false;
        for (int j = 0; j < E; j++) {
            edge e = es[j];
            if (d[e.f] != INF && d[e.t] > d[e.f] + e.c) {
                if (i == V - 1) return false;
                d[e.t] = d[e.f] + e.c;
                update = true;
            }
        }
        if (!update) break;
    }
    return true;
}

int main(void) {
    cin >> V >> E >> r;
    for (int i = 0; i < E; i++)
        cin >> es[i].f >> es[i].t >> es[i].c;
    
    if (!bellmanFord(r)) cout << "NEGATIVE CYCLE\n";
    else {
        for (int i = 0; i < V; i++) {
            if (d[i] == INF) cout << "INF\n";
            else cout << d[i] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3136
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0,1,0,-1 };
const ll dy[4] = { -1, 0, 1,0 };
const ll INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////

//DAG(有向無閉路グラフ)<=>トポロジカルソートができる
//方法１
//入次数が0の頂点があればその頂点をソート後の結果に追加しその頂点と隣接した頂点の
//入次数を-1するこれを入次数が0の頂点がなくなるまで繰り返すO(V+E)
//方法２
//すべての点から深さ優先探索を行いその帰りかけ順がトポロジカルソートの結果
vector<int>g[100010];//グラフの隣接リスト
int h[100010];//頂点の入次数を管理
int main() {
	int v, e; cin >> v >> e;
	REP(i, e) {
		int s, t;
		cin >> s >> t;
		g[s].push_back(t);
		h[t]++;
	}
	stack<int>st;
	REP(i, v)if (h[i] == 0)st.push(i);
	//ソートされた後のグラフ
	vector<int>ans;
	while (st.size()) {
		int i = st.top(); st.pop();
		ans.push_back(i);
		for (auto j : g[i]) {
			h[j]--;
			if (h[j] == 0)st.push(j);
		}
	}
	for (int i : ans)cout << i << endl;
	return 0;
}



Measured memory_bytes: 6048
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//abc129A
int main(void) {
  int n, k, i, cou=0, tmp, p, q, r;
  scanf("%d %d %d", &p, &q, &r);
  if(p > q){
    if(p > r) printf("%d", r + q);
    else printf("%d", p + q);
  }else{
    if(q > r) printf("%d", r + p);
    else printf("%d", p + q);
  }

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    LL a,ans1=0,ans2=0;
    map<LL,int> mp;
    vector<LL> v,v2;
    rep(i,N){
        cin>>a;
        mp[a]++;
    }
    for(auto itr : mp){
        if(itr.second >= 4){
            v2.push_back(itr.first);
        }
        if(itr.second >= 2){
            v.push_back(itr.first);
        }
        // cout<< itr.first << " " << itr.second << endl;
    }

    if(v2.size() && v.size()>=2){
        if(v[v.size()-1] <= v2[v2.size()-1]){
            cout << v2[v2.size()-1] * v2[v2.size()-1] << endl;
        }else{
            cout << v[v.size()-1] * v[v.size()-2] << endl;
        }
    }else if(v2.size()){
        cout << v2[v2.size() - 1] * v2[v2.size() - 1] << endl;
    }else if(v.size()>=2){
        cout << v[v.size() - 1] * v[v.size() - 2] << endl;
    }else{
        cout << 0 << endl;
    }
}


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

int main() {
	int h,w;
	while(true)
	{
		cin >> h >> w;
		if(h==0&&w==0)
			break;
		
		for(int i=0;i<h;i++){
			for(int t=0;t<w;t++){
					if(((i%2)+(t%2))%2==0)
						cout << "#";
					else
						cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}

int main(){
  string s,t;
  cin >> s >> t;
  map<char,char> m1,m2;
  rep(i,s.size()){
    if(m1.count(s.at(i))){
      if(m1[s.at(i)]!=t.at(i)){
        cout << "No" << endl;
        return 0;
      }
    }
    else
      m1[s.at(i)]=t.at(i);
  }
  rep(i,s.size()){
    if(m2.count(t.at(i))){
      if(m2[t.at(i)]!=s.at(i)){
        cout << "No" << endl;
        return 0;
      }
    }
    else
      m2[t.at(i)]=s.at(i);
  }
  cout << "Yes" << endl;
}

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll) 1e9 + 7;
constexpr long long MOD = 998244353LL;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
	ll l,r;
	cin>>l>>r;
	ll ans=INF;
	for(ll i=l;i<=min(r,l+2020);i++){
		for(ll j=i+1;j<=min(r,i+1+2020);j++){
			chmin(ans,i*j%2019);
		}
	}
	cout<<ans<<en;
}

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

    solve();
    //ll t;cin>>t;REP(i,t) solve();

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\b\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  ll N;
  IN(N);
  ll ans = (N*(N+1))/2;
  cout << ans << "\n";
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll>>
#define vvll vector<vector<ll>>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
using namespace std;

//

//

void solve()
{
	ll n,m;
	cin>>n>>m;
	ll a[m], sum=0;
	for(ll i=0;i<m;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}

	if(sum>n)
		cout<<-1<<endl;
	else
		cout<<n-sum<<endl;


}


int main()
{
        solve();
        return 0;
}


Measured memory_bytes: 3672
#include<iostream>
using namespace std;
int main(){
  char c[100002];
  bool animal[100002];
  int N;
  cin >> N >> c;
  bool init[4][2] = {
    {true,true},{true,false},{false,true},{false,false}
  };
  c[N] = c[0]; c[N+1] = c[1];
  for(int pat = 0; pat<4; pat++){
    animal[0] = init[pat][0];
    animal[1] = init[pat][1];
    for(int a = 2; a <= N+1; a++){
      if(c[a-1] == 'o'){
         if(animal[a-1]) animal[a] = animal[a-2];
         else animal[a] = !animal[a-2];
      }
      else{
         if(animal[a-1]) animal[a] = !animal[a-2];
         else animal[a] = animal[a-2];
      }
    }
    
    if(animal[0] == animal[N] && animal[1] == animal[N+1]){
      for(int a = 0; a < N; a++){
        cout << ((animal[a]) ? 'S':'W');
      }
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define F first
#define S second
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sortv(X) sort(X.begin() , X.end()) ; 
#define ll long long 
#define ld long double
#define pii pair <int ,int >
#define bug(x)  cout<<"passed "<<x<<endl;
#define ashar(x , y , z) cout<<setprecision(x)<<fixed<<y ; if (z==1) cout<<"\n" ;
#define ppi pair <pair <int, int > , int > 
#define ordered_set tree<pair <long long  ,long long >, null_type,less<pair <long long ,long long > >, rb_tree_tag,tree_order_statistics_node_update> 
  
long long const inf = 3e18, linf = 2e9, mod = 1e9+7 , inf2 = 1e12;
int const mxn = 5e5 + 10 ;
ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}




int main(){
	int d , t , s; 
	cin>>d>>t>>s ; 
	if (d / s + (d%s > 0) <= t)
		cout<<"Yes" ; 
	else
		cout<<"No" ; 
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <algorithm>
int main(void){
    int n,m;
    scanf("%d%d",&n,&m);
    unsigned long long p[m],y[m];
    unsigned long long x[m];
    for(int i=0;i<m;i++){
        scanf("%lu%lu",&p[i],&y[i]);
        x[i]=(p[i]<<47)+(y[i]<<17)+i;
    }
    std::sort(x,x+m);
    int c=1;
    y[(x[0]<<47)>>47]=c;
    for(int i=1;i<m;i++){
        if(x[i]>>47==x[i-1]>>47)c++;
        else c=1;
        y[(x[i]<<47)>>47]=c;
    }
    for(int i=0;i<m;i++){
        x[i]=p[i]*1000000+y[i];
        printf("%012lu\n",x[i]);
    }
}


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

namespace HABIT{
    #define f(a,b,c,d) for(register int a=b,c=d;a<=c;a++)
    #define g(a,b,c,d) for(register int a=b,c=d;a>=c;a--)
    #define LOCAL
    typedef int i32;
    typedef unsigned int u32;
    typedef long long int i64;
    typedef unsigned long long int u64;
    typedef pair<i32,i32> pii;
    const i32 MAXN=1024;
    typedef i32 ar[MAXN];
    
    template<typename T> inline T Max(T a) { return a; }
    template<typename T,typename... Args> inline T Max(T a,Args... args){
        T b=Max(args...);
        return (a>b)?a:b;
    }
    template<typename T> inline T Min(T a) { return a; }
    template<typename T,typename... Args> inline T Min(T a,Args... args){
        T b=Min(args...);
        return (a<b)?a:b;
    }

    #ifdef LOCAL
        inline char gc() { return getchar(); }
    #else
        inline char gc() {
            static char s[1<<20|1]={0},*p1=s,*p2=s;
            return (p1==p2)&&(p2=(p1=s)+fread(s,1,1<<20,stdin),p1==p2)?EOF:*(p1++);
        }
    #endif
    inline i64 read(){
        register i64 ans=0;register char c=gc();register bool neg=0;
        while(c<48||c>57) neg^=!(c^'-'),c=gc();
        while(c>=48&&c<=57) ans=(ans<<3)+(ans<<1)+(c^48),c=gc();
        return neg?-ans:ans;
    }

    char Output_Ans[1<<20|1],*Output_Cur=Output_Ans;
    inline void output() { Output_Cur-=fwrite(Output_Ans,1,Output_Cur-Output_Ans,stdout); }
    inline void print(char c){
        if(Output_Cur-Output_Ans+1>>20) output();
        *(Output_Cur++)=c;
    }
    inline void print(char *s) { while(*s) print( *(s++) ); }
    inline void print(u64 x){
        if(!x) { print('0'); return ; }
        char buf[30]={0},*p=buf+28;
        while(x) *(p--)=x%10+48,x/=10;
        print(p+1);
    }
    inline void print(u32 x) { print( (u64)x ); }
    inline void print(i64 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
    inline void print(i32 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
}
using namespace HABIT;

set<string> s;

int main(){
    string str;
    f(i,1,I,read()){
        getline(cin,str);
        s.insert(str);
    }
    print( i32(s.size()) );
    output();
    return 0;
}

Measured memory_bytes: 19224
#include <iostream>
  #include <algorithm>
  #include <string>
  using namespace std;
  int i;
  int main(){
    string s,t;
    cin>>s>>t;
   	int sl = s.length();
    bool ans = false;
    for(i=0;i<sl;++i){
      if(s==t)ans=true;
  	  s=s.back()+s.substr(0,sl-1);
    }
    cout<<(ans?"Yes":"No")<<endl;
    return 0;
  }

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int e = a / d + (a % d != 0);
  int f = c / b + (c % b != 0);
  cout << (f <= e ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<math.h>
using namespace std;

int main ()
{
  int n,m,i,sum=0;
  cin>>n>>m;

  int a[m];

  for(i=0; i<m; i++)
  {
      scanf("%d",&a[i]);
  }
   for(i=0; i<m; i++)
  {
      sum=sum+a[i];
  }

  if(n>=sum){cout<<(n-sum)<<endl;}
   else{cout<<"-1"<<endl;}

   return 0;


}


Measured memory_bytes: 3244
#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 300007
#define ar array
#define mod 1000000007
#define ld long double
#define pb push_back
#define ar array
#define fi first
#define se second
typedef long long int ll;
using namespace std;
int main(void){
	fast;
	ll n,i;
	cin>>n;
	ll a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
	ll sum=1000,stocks=0;
	for(i=0;i<n-1;i++){
		if(a[i+1]>a[i]){
		stocks=sum/a[i];
		sum+=(a[i+1]-a[i])*stocks;
		}
	}
	cout<<sum;
}


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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(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 VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

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

ll N;
VL A, S;

ll sign(ll A) { return (A > 0) - (A < 0); }

int main() {
    cin >> N;
    A.resize(N);
    VECCIN(A);
    S.resize(N + 1);
    REP(i, N) { S[i + 1] = S[i] + A[i]; }
    sort(All(S));
    ll num = 0;
    REP(i, N + 1) {
        ll s = S[i];
        num +=
            distance(lower_bound(All(S), S[i]), upper_bound(All(S), S[i])) - 1;
    }
    cout << num / 2 << "\n";
    return 0;
}

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

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

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

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


using namespace std;
using ll = long long;

const ll MOD = 998244353;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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




int n;
string s;

void input(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    cin >> n >> s;
     
}


 

void solve(){
    
    bool isAns = true;
    if(n%2==1) isAns = false;
    
    string S;
    for (int i = 0; i < n/2; i++) {
        S += s[i];
    }
    
    S += S;
    
    if(isAns && s==S) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    
}





signed main() {
    
    input();
    solve();
    return 0;
}



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

unsigned gcd(unsigned a, unsigned b){
    return (b==0)?a:gcd(b,a%b);
}

int main(){
    unsigned a,b;
    while(cin>>a>>b){
        unsigned g = gcd(a,b);
        cout << g << " " << a/g*b << endl;
    }
    return 0;
}


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

int main() {
  string a,b;
  
  cin >> a;
 
  cin >> b;
  
  sort(a.begin(),a.end());
  
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());
  
  
    if(a<b){
      cout << "Yes" << endl;
      
    }
  else{
  cout << "No" <<endl;
}
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
#ARC091C
import copy
import sys
import math

#n = int(input())
tmp = input().split()
n,m = list(map(lambda a: int(a), tmp))

if(n==1)and(m==1):
	print(1)
elif(n>=2)and(m>=2):
	print((n-2)*(m-2))
else:
	print(max(n,m)-2)



Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,r;
	cin>>n>>r;
	int tmp=10-n;
	if (n>=10)
	{
		cout<<r<<endl;
	}
	else
	{
		int out=r+100*tmp;
		cout<<out<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
     int W,H,x,y,r;
     cin >> W;
     cin >> H;
     cin >> x;
     cin >> y;
     cin >> r;
     if (r<=x&&x<=W-r&&r<=y&&y<=H-r){
         cout << "Yes";
     }
     else cout << "No";
     
     cout << endl;
     
    
}


Measured memory_bytes: 3108
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public class AtCoder
{
    public static void Main()
    {
        var abck = Console.ReadLine().Trim().Split().Select(e=>int.Parse(e)).ToArray();
        var a = abck[0];
        var b = abck[1];
        var c = abck[2];
        var k = abck[3];

        int xa = Math.Min(a, k);
        k -= xa;
        int xb = Math.Min(b, k);
        k -= xb;
        int xc = k;
        
        var ans  = xa - xc;
        Console.WriteLine(ans);
   }
}

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

using ll = long long;


int main() {
    int D, N;
    cin >> D >> N;
    if (N == 100) N++;
    cout << N;
    rep(i, D) cout << "00";
    cout << "\n";
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define chmin(x,y) x = min(x, y)
#define chmax(x,y) x = max(x, y)
#define V vector
vector<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
vector<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

int main () {
    ll x, y; cin >> x >> y;
    int ans = 0;
    while (x <= y) {
        x *= 2;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3556
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll ans = (n-1)*n/2;
    cout << ans << endl;

    return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	for (int i = 0;i<N;++i) {
		cin >> A[i];
		A[i]--;
	}
	int now = 0;
	for (int i = 0;i<N;++i) {
		if (now == 1) {
			cout <<i <<endl;
			return 0;
		}
		now = A[now];
	}
	cout << -1<<endl;
	return 0;
}

Measured memory_bytes: 3780
#include <stdio.h>

int main(){
 int P,Q,R;
  scanf("%d %d %d", &P, &Q, &R);
  
  printf("%d", (P+Q+R)-max(P,Q,R));
}

int max(int p, int q, int r){
  int max = p;
  if(q>=max) max = q;
  if(r>=max) max = r;
  return max;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
 
int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    ll c=a+b;
    ll d=(n-(n%c))/c;
    if(n%c >= a){
        cout << (d+1)*a << endl;
    }
    else{
        cout << (d*a)+(n%c) << endl;
    }
 
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

template <typename QvQ> inline QvQ Min(QvQ a,QvQ b){if(a<b) return a;return b;}
template <typename QvQ> inline QvQ Max(QvQ a,QvQ b){if(a>b) return a;return b;}

#define inf 2147483647
#define dinf 0x3f3f3f3f
#define llinf 0x7f7f7f7f7f7f7f7f

#define ll long long
#define rei register int
#define inv inline void
#define ull unsigned long long
#define il inline

#define bl putchar(' ')
#define ed putchar('\n')
#define test cout<<"this:" 

#define read2(a,b) read(a),read(b)
#define write2(a,b) write(a),bl,write(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define write3(a,b,c) write(a),bl,write(b),bl,write(c)

template <typename QvQ>inv read(QvQ &x){
	x=0;int f=1;
	char c=getchar();
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	x=x*f;
}
template <typename QvQ>inv write(QvQ x){
	if(x<0) x=-x,putchar('-');
	if(x>9) write(x/10);
	putchar(x%10+48);
}
using namespace std;
int n;
int a[100005];
int main()
{
	read(n);
	for(rei i=1;i<=n;++i) read(a[i]);
	sort(a+1,a+n+1); ll ans=0;
	for(rei i=1;i<=n;++i)
	{
		for(rei j=i+1;j<n;++j)
		{
			//找到一个小于a+b的 
			int need=a[i]+a[j];
			int pos=lower_bound(a+j+1,a+n+1,need)-a-1;
			ans+=pos-j;
		}
	}
	write(ans);
	return 0;
}

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

int main(void){
  int n;
  cin >> n;
  ll ans = 0;
  for(int i=1; i<=n; i++){
    if(i%3 != 0 && i%5 != 0){
      ans += i;
    }
  }
  cout << ans << endl;
}

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

int main() {
  int A;
  cin >> A;
  string op;
  cin >> op;
  int B;
  cin >> B;
  
  if (op == "+") {
    cout << A + B << endl;
  } else {
    cout << A - B << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdlib>

using namespace std;

char ToUpper(char cX) { return toupper(cX); }

int main()
{
    string str;

    while (getline(cin, str, '\n')) {
        transform(str.begin(), str.end(), str.begin(), ToUpper);
        cout << str << endl;
    }

    return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N, K;
	cin >> N >> K;

	vector<lint> data(N);
	vector<lint> cum(N + 1);
	for (int i = 0; i < N; i++)
	{
		cin >> data[i];
	}

	cum[0] = 0;
	for (int i = 0; i < N; i++)
	{
		cum[i + 1] = cum[i] + data[i];
	}

	lint max_num = 0;

	for (int i = 0; i < N + 1 - K; i++)
	{
		max_num = max(max_num, cum[i + K] - cum[i]);
		//cout << cum[i + K] << " " << cum[i] << endl;
	}
	//cout << max_num << endl;
	cout << (max_num + K) / 2.0 << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 3456
H,W=map(int,input().split())
S=[]
for i in range(H):
    s=input()
    S.append(s)
T=[[0]*W for i in range(H)]
for i in range(H):
    for j in range(W):
        t=False
        for k in [0,-1,1]:
            if t:
                break
            for l in [0,-1,1]:
                if k==0 and l==0 and S[i][j]=="#":
                    T[i][j]="#"
                    t=True
                    break
                if i+k<0 or i+k>=H or j+l<0 or j+l>=W :
                    continue
                if S[i+k][j+l]=="#":
                    T[i][j]+=1
for i in range(H):
    for j in range(W):
        print(T[i][j],end="")
    print()


Measured memory_bytes: 46060
use std::io;
use std::cmp;
use std::collections::VecDeque;


fn main() {
    let n = read_one::<usize>();
    let mut an = Vec::new();
    for _ in 0..n {
        an.push(read_one::<isize>());
    }

    an.sort();

    let a = diff(an.clone());
    an.reverse();
    let b = diff(an.clone());
    println!("{}", cmp::max(a, b));
}


fn diff(mut an: Vec<isize>) -> usize {

    let mut n = an.len();
    let mut vd = VecDeque::new();
    vd.push_front(an[0]);
    an.remove(0);
    n -= 1;
    for i in 0..n {
        match i % 4 {
            0 => {
                vd.push_back(an[n - i / 2 - 1]);
            },
            1 => {
                vd.push_front(an[n - i / 2 - 2]);
            },
            2 => {
                vd.push_back(an[i / 2 - 1]);
            },
            3 => {
                vd.push_front(an[i / 2]);
            },
            _ => unreachable!(),
        }
    }
    let mut ans = 0;
    for i in 0..n {
        ans += (vd[i] - vd[i + 1]).abs();
    }

    ans as usize
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

//Dinic法による最大流

class MaximumFlow {
  struct Edge {
    int to;
    long long capacity;
    Edge(int to, long long cap)
        : to(to), capacity(cap){};
    Edge() { Edge(0, 0); }
  };
  using Graph = vector<vector<Edge>>;
  using Flow = vector<unordered_map<int, long long>>;
  //typedef vector<vector<LL>> Flow;
  int n;
  Graph graph;
  Flow flow;

 public:
  MaximumFlow(int n) : n(n), graph(n), flow(n) {}
  //MaximumFlow(int n) : n(n), graph(n), flow(n, vector<long long>(n)) {}
  void addEdge(int a, int b, long long cap) {
    graph[a].emplace_back(b, cap);
    graph[b].emplace_back(a, 0);
  }
  long long maximumFlow(int s, int t) {
    const long long INF = 1 << 30;
    long long total = 0;
    for (bool cont = true; cont;) {
      cont = false;
      vector<int> level(n, -1);
      level[s] = 0;
      queue<int> Q;
      Q.push(s);
      for (int d = n; !Q.empty() && level[Q.front()] < d;) {
        int u = Q.front();
        Q.pop();
        if (u == t) d = level[u];
        for (auto e : graph[u]) {
          if (e.capacity > flow[u][e.to] && level[e.to] == -1) {
            Q.push(e.to);
            level[e.to] = level[u] + 1;
          }
        }
      }
      vector<int> iter(n);
      while (true) {
        long long f = add_flow(level, iter, s, t, INF);
        if (f == 0) break;
        total += f;
        cont = true;
      }
    }
    return total;
  }

 private:
  long long add_flow(const vector<int> &level, vector<int> &iter, int u, int t, long long cur) {
    if (u == t || cur == 0) return cur;
    for (int &i = iter[u]; i < graph[u].size(); ++i) {
      auto e = graph[u][i];
      if (level[e.to] > level[u]) {
        long long f = add_flow(level, iter, e.to, t, min(cur, e.capacity - flow[u][e.to]));
        if (f > 0) {
          flow[u][e.to] += f;
          flow[e.to][u] -= f;
          return f;
        }
      }
    }
    return 0;
  }
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;  //vertex,edge
  cin >> n >> m;
  MaximumFlow mf(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    LL cap;
    cin >> a >> b >> cap;
    mf.addEdge(a, b, cap);
  }
  cout << mf.maximumFlow(0, n - 1) << endl;

  return 0;
}


Measured memory_bytes: 3264
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<pair<int,int>> A(N);
    for(int i = 0; i < N; i++){
        int tmp;
        cin >> tmp;
        A[i] = pair<int,int>(tmp,i);
    }
    sort(A.begin(),A.end());
    for(int i = 0; i < N; i++){
        cout << A[i].second + 1 << endl;
    }

}

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

int main(){
    
    long long int N,K;cin>>N>>K;
    long long int ans=0;
    if(K!=0){
    for(long long int i=K+1;i<=N;i++){
        ans+=(N/i)*(i-K);
        if(N%i-K+1>0) ans+=N%i-K+1;
    }
    cout<<ans<<endl;
    }
    else cout<<N*N<<endl;
}



Measured memory_bytes: 384
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(a,b);
  int dif = b-a;
  REP(i,dif){
    x += i + 1;
  }
  OUT(x-b);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin>>N;
  vector<vector<int>>A(N,vector<int>(3));
  vector<vector<int>>DP(N+1,vector<int>(3));
  for(int i=0;i<N;i++)for(int j=0;j<3;j++)cin>>A[i][j];
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      if(j==0){DP[i+1][1]=max(DP[i+1][1],DP[i][0]+A[i][1]);DP[i+1][2]=max(DP[i+1][2],DP[i][0]+A[i][2]);}
      if(j==1){DP[i+1][0]=max(DP[i+1][0],DP[i][1]+A[i][0]);DP[i+1][2]=max(DP[i+1][2],DP[i][1]+A[i][2]);}
      if(j==2){DP[i+1][0]=max(DP[i+1][0],DP[i][2]+A[i][0]);DP[i+1][1]=max(DP[i+1][1],DP[i][2]+A[i][1]);}
    }
  }
  cout<<max(DP[N][0],max(DP[N][1],DP[N][2]))<<endl;
}

Measured memory_bytes: 14076
import javax.sound.midi.Soundbank;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author rizhiy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        PrintWriter out;
        InputReader in;
        int n;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            this.out = out;
            this.in = in;
            int l = 0;
            int r = n-1;
            System.out.println(r);
            System.out.flush();
            String pls = in.next();
            if (pls.equals("Vacant")) return;
            System.out.println(l);
            System.out.flush();
            pls = in.next();
            if (pls.equals("Vacant")) return;
            while (l < r){
                System.out.println((l+r)/2);
                System.out.flush();
                String s = in.next();
                if (s.equals("Vacant")) break;
                if (((l+r)/2 - l) % 2 == 0){
                    if (pls.equals(s)){
                        l = (l + r) /2 ;
                        pls = s;
                    } else {
                        r = (l + r) /2 ;
                    }
                } else {
                    if (pls.equals(s)){
                        r = (l + r) /2 ;
                    } else {
                        l = (l + r) /2 ;
                        pls = s;
                    }
                }
            }

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

Measured memory_bytes: 25248
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int n,k;
    cin >> n >> k;
    n-=2;
    
    int list_add = 0;
    int portion_add = 0;
    
    for(int i = 1; i <= 110; i++){
        for(int j = 1; j <= 5; j++){
            if(i <= n % 110) portion_add += ((63 * i + 9 * j + 9) % 11 == k);
            list_add += ((63 * i + 9 * j + 9) % 11 == k);
        }
    }
    
    cout << list_add*(n / 110) + portion_add << endl;
    
    
}


Measured memory_bytes: 256