akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch IntegerProduct | diff IntegerProduct.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address IntegerProduct.cpp && ./a.out

/*

 8/9/2020

 5:00-

 */

const int MAX_N=1e6+1;
LL A[MAX_N];
int N;

void solve() {
  vector<II> X(N);
  REP(i,N) {
    LL a=A[i];
    //dump(i,a);
    LL x=a;
    II p;
    while(x>0&&x%2==0)x/=2,p.first++;
    LL y=a;
    while(y>0&&y%5==0)y/=5,p.second++;
    X[i]=p;
  }
  //dumpc(X);

  LL res=0;
  map<II,LL> cnt;
  REP(i,N) {
    FORR(kvp,cnt) {
      LL p2=kvp.first.first,p5=kvp.first.second;
      if(X[i].first+p2>=18&&X[i].second+p5>=18) res+=kvp.second;
    }
    cnt[X[i]]++;
  }

  cout<<res<<endl;
}

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

  vector<LL> p10(11,1);
  REP(i,10) p10[i+1]=p10[i]*10;

  cin>>N;
  REP(i,N) {
    string S; cin>>S;
    int p=-1;
    REP(i,SZ(S)) if(S[i]=='.') p=i;
    if(p==-1) {
      A[i]=stoll(S);
      A[i]*=p10[9];
      continue;
    }
    int l=SZ(S)-p-1;
    //dump(S,l);
    REP(j,SZ(S)) if(isdigit(S[j])) {
      A[i]=10LL*A[i]+(S[j]-'0');
    }
    A[i]*=p10[9-l];
  }
  solve();

  return 0;
}


Measured memory_bytes: 6388
#include <iostream>
#include <deque>
#include <algorithm>
#include <string>

int main() {
    std::string input_string;
    std::cin >> input_string;
    std::deque<char> str_deque(input_string.begin(), input_string.end());
    input_string.clear();
    unsigned Q;
    std::cin >> Q;
    bool flag = false;
    while (Q != 0) {
        static int T;
        std::cin >> T;
        if (T == 1) {
            flag = !flag;
        }
        else if (T == 2) {
            static int F;
            static char C;
            std::cin >> F;
            std::cin >> C;
            if (F == 1) {
                if (flag) {
                    str_deque.push_back(C);
                }
                else {
                    str_deque.push_front(C);
                }
            }
            else if (F == 2) {
                if (flag) {
                    str_deque.push_front(C);
                }
                else {
                    str_deque.push_back(C);
                }
            }
        }
        Q--;
    }
    if (flag) {
        std::reverse(str_deque.begin(), str_deque.end());
    }
    input_string.assign(str_deque.begin(), str_deque.end());
    str_deque.clear();
    std::cout << input_string;
    input_string.clear();
    return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int N, M;
int main() {
    while (cin >> N >> M) {
        vector<long long> X(M);
        for (int i = 0; i < M; ++i) cin >> X[i];
        sort(X.begin(), X.end());
        
        vector<long long> diffs;
        for (int i = 1; i < X.size(); ++i) diffs.push_back(X[i] - X[i-1]);
        sort(diffs.begin(), diffs.end(), greater<long long>());
        
        long long res = X.back() - X[0];
        for (int i = 0; i < min((int)diffs.size(), N-1); ++i) res -= diffs[i];
        
        cout << res << endl;
    }
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
typedef map<string,ll> mapstl;
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define inf 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll a;string s;
	cin>>a>>s;
	if(a<3200)cout<<"red\n";
	else cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 3596
n = int(input())
s = input()

ans = 0
for i in range(1,n-1):
    mae = s[:i]
    ato = s[i:]
    temp = []
    for j in mae:
        if j in ato:
            temp.append(j)
    temp = set(temp)
    ans = max(ans,len(temp))

print(ans)

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

long long n,m,p,k=1,t,a[200001],a1[200001];
int main() {
  cin >> n >> m;
  for(int i=1;i<=n;++i) {
    cin >> a[i];
  }
  while(!a1[k]) {
    a1[k]=t+1;
    if(t==m){
      cout << k;
      return 0;
    }
    k=a[k];
    t++;
  }
  p=(m-a1[k]+1)%(t+1-a1[k]);
  for(int i=0;i<p;++i)
    k=a[k];
  cout << k;

  return 0;
}

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

#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;
  cin >> n >> m;
  vector<int> l(m);
  vector<int> r(m);
  rep(i, m) {
    cin >> l[i];
    cin >> r[i];
    l[i]--;
    r[i]--;
  }
  // 最大のlと最小のrを求める
  int lMax = INT_MIN;
  int rMin = INT_MAX;
  rep(i, m) {
    lMax = max(lMax, l[i]);
    rMin = min(rMin, r[i]);
  }
  int res = max(rMin - lMax + 1, 0);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys
from bisect import bisect_left
from itertools import accumulate

INF = float("inf")


def solve(N: int, M: int, A: "List[int]"):
    A.sort()

    # 幸福度X以上を得られる握手をカウントし、M以上となる境界を探す
    # Xが小さい方が握手の個数は多く、Xが大きい方が握手の個数は少ない
    left = 0
    right = 3*(10**5)
    while right - left > 1:
        X = (right + left)//2

        # 握手の個数は、左手を固定した上で、右手をにぶたんする。
        tot = 0
        for left_hand in A:
            tot += N-bisect_left(A, X-left_hand)

        if tot < M:
            right = X
        else:
            left = X

    # print(left, right)
    # 幸福度rightを得られる握手はM個未満
    # 幸福度leftを得られる握手はM個以上

    # 幸福度rightを得られる握手をすべてカウントした上で、
    # 不足する個数だけ、幸福度leftを加える
    happy = 0

    acc = [0]+list(accumulate(A))
    tot = 0
    for left_hand in A:
        i = bisect_left(A, right-left_hand)
        tot += N-i
        happy += (acc[N]-acc[i]) + left_hand*(N-i)

    happy += (M-tot)*left
    print(happy)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)


if __name__ == '__main__':
    main()


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

int main(){
  int N;  cin >> N;
  vector<long long>L(N);
  for(int i=0;i<N;i++){
    long long a;
    cin >> a;
    L.at(i) = a;
  }
  long long ans = 0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      for(int k=j+1;k<N;k++){
        if(L.at(i) == L.at(j) || L.at(j) == L.at(k) || L.at(k) == L.at(i)){
          continue;
        }
        long long MAX = max(L.at(i),max(L.at(j),L.at(k)));
        long long wa = L.at(i) + L.at(j) + L.at(k) - MAX;
        if(MAX < wa)  ans++;
      }
    }
  }
  cout << ans << endl;
}


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

int main() {
	int N;
	cin >> N;
	vector<int>A;
	A.push_back(500);
	A.push_back(100);
	A.push_back(50);
	A.push_back(10);
	A.push_back(5);
	A.push_back(1);
	while (N != 0) {
		int ans = 0;
		int num = 1000 - N;
		for (int i = 0; i < 6; i++) {
			while (num >= A.at(i)) {
				ans++;
				num -= A.at(i);
			}
		}
		cout << ans << endl;
		cin >> N;
	}
}


Measured memory_bytes: 3092
N=int(input())
h=list(map(int,input().split()))

dp=[0]*(N)
dp[1]=abs(h[1]-h[0])

for i in range(2,N):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]) , dp[i-2]+abs(h[i]-h[i-2]))
    
print(dp[-1])
    

Measured memory_bytes: 52208
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;// 998244353;// ;
constexpr long long INF = numeric_limits<LL>::max() / 2;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<vector<LL>>g;
vector<edge>edges;
vector<LL>v;
map<LL, LL>ma;
set<Pll>st;
LL h, w, n, m, k, t, s, p, q, last, cnt, sum[210000], ans, dp1[210000],dp2[210000], a[210000], b[210000];
string str, ss;
bool f;
char c; 
LL dep[2100];
void dfs(LL cur, LL par) {
	vector<LL>dpdp[2];
	rep(i, 2)dpdp[i].resize(g[cur].size());
	b[cur] = 0;
	LL sum = 0;
	LL ret = -INF+1;
	if (a[cur])b[cur] = 1;
	rep(i, g[cur].size()) {
		LL u = g[cur][i];
		if (u == par)continue;
		dep[u] = dep[cur] + 1;
		dfs(u, cur);
		b[cur] += b[u];
		dpdp[0][i] = (dp1[u]);
		dpdp[1][i] = (dp2[u]);
		sum += dp2[u] + b[u];
		dp2[cur] += dp2[u] + b[u];
	}
	rep(i, g[cur].size()) {
		LL u = g[cur][i];
		if (u == par)continue;
		ret = max(ret, dpdp[0][i] + dpdp[1][i] + b[u] * 2 - sum);
	}
	if (ret < 0)dp1[cur] = (ret & 1);
	else dp1[cur] = ret;
}
void solve(LL root) {
	rep(i, n)dp1[i] = INF, dp2[i] = 0;
	dfs(root, -1);
	if (dp1[root] == 0)
		ans = min(ans, dp2[root] / 2);
}
int main() {
	cin >> n;
	cin >> str;
	rep(i, n) {
		a[i] = str[i] - '0';
	}
	g.resize(n);
	rep(i, n - 1) {
		LL x, y;
		cin >> x >> y;
		x--, y--;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	ans = INF;
	rep(i, n)solve(i);
	cout << (ans==INF?-1:ans) << endl;
	return 0;
}

Measured memory_bytes: 6912
#include <stdio.h>

#define N_MAX 25

typedef struct _Node {
	int parent;
	int degree;
	int depth;
	int height;
	int kind;
	int left;
	int right;
} Node;

Node Tree[N_MAX];

const char Kind[3][14] = { "root","leaf","internal node" };

int setting(int pos, int depth) {
	int lh, rh;
	Tree[pos].depth = depth;
	lh = rh = 0;
	if (Tree[pos].left != -1) lh = setting(Tree[pos].left, depth + 1);
	if (Tree[pos].right != -1) rh = setting(Tree[pos].right, depth + 1);
	Tree[pos].height = lh > rh ? lh : rh;
	if (Tree[pos].parent == -1) Tree[pos].kind = 0;
	else if (Tree[pos].degree == 0) Tree[pos].kind = 1;
	else Tree[pos].kind = 2;

	return Tree[pos].height + 1;
}

void dump(int n) {
	int i, sibling;
	Node *parent;
	for (i = 0; i < n; i++) {
		printf("node %d: ", i);
		printf("parent = %d, ", Tree[i].parent);
		sibling = Tree[i].parent == -1 ? -1
			: Tree[Tree[i].parent].left == i ? Tree[Tree[i].parent].right
			: Tree[Tree[i].parent].left;
		printf("sibling = %d, ", sibling);
		printf("degree = %d, ", Tree[i].degree);
		printf("depth = %d, ", Tree[i].depth);
	printf("height = %d, ", Tree[i].height);
		printf("%s\n", Kind[Tree[i].kind]);
	}
}

int main() {
	int i, n, pos;

	scanf("%d", &n);
	for (i = 0; i < n; i++) Tree[i].parent = -1;

	for (i = 0; i < n; i++) {
		scanf("%d", &pos);
		scanf("%d", &Tree[pos].left);
		scanf("%d", &Tree[pos].right);
		Tree[pos].degree = 0;
		if (Tree[pos].left != -1) {
			Tree[Tree[pos].left].parent = pos;
			Tree[pos].degree++;
		}
		if (Tree[pos].right != -1) {
			Tree[Tree[pos].right].parent = pos;
			Tree[pos].degree++;
		}
	}

	i = 0;
	while (Tree[i].parent != -1) i++;

	setting(i, 0);

	dump(n);

	return 0;
}


Measured memory_bytes: 1808
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(ll i=0;i<n;++i){
        cin>>a[i];
    }

    ll ans = 0;
    bool flag = true;
    while(flag){
        flag = false;
        for(ll i=1;i<n;++i){
            if(a[i-1] > a[i]){
                swap(a[i-1], a[i]);
                ans++;
                flag = true;
            }
        }
    }

    for(ll i=0;i<n;++i){
        if(i != 0){
            cout<<' ';
        }
        cout<<a[i];
    }
    cout<<endl;
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using i128 = boost::multiprecision::int128_t;
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  ll n; cin >> n;
  V a(n); cin >> a;

  int x = 0;
  rep(i, n) x ^= a[i];
  rep(i, n) a[i] ^= x;

  cout << a << "\n";
  return 0;
}


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

/**
 * 最大公約数 
 */
ll gcd(ll numA, ll numB)
{
    return numB ? gcd(numB, numA % numB) : numA;
}

/** 
 * 最小公倍数
 */
ll lcm(ll x, ll y)
{
    return x / gcd(x, y) * y;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    vector<ll> nums(N);
    for(int i = 0; i < N; i++)
    {
        int A;
        cin >> A;
        nums.at(i) = A;
    }
    int prevCount = -1;
    for(int i = 0; i < N; i++)
    {
        int count = 0;
        ll num = nums.at(i);
        while (num % 2 == 0){
            count++;
            num /= 2;
        }
        if(i == 0){
            prevCount = count;
            continue;
        }
        if(prevCount != count){
            cout << 0 << endl;
            return 0;
        }
        prevCount = count;
    }
    ll lcmNum = nums.at(0);
    for(int i = 1; i < N; i++)
    {
        lcmNum = lcm(lcmNum, nums.at(i));
    }
    ll answer = 0;
    answer = (M * 2 / lcmNum + 1) / 2;
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int m, n, sum = 0;
  cin >> n;
  int t[n];
  for (int i = 0; i < n; i++) {
    cin >> t[i];
    sum += t[i];
  }
  cin >> m;
  int p[m], x[m];
  for (int i = 0; i < m; i++) {
    cin >> p[i];
    cin >> x[i];
  }
  for (int i = 0; i < m; i++) {
    int ans = sum;
    // cout << t[p[i - 1]] << endl;
    ans -= t[p[i] - 1] - x[i];
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
#define ttttyyyy ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fo(i,n,m) for(int i=n;i<m;i++)
#define pb(x) push_back(x)
#define mk(a,b) make_pair(a,b)
#define all(x) x.begin(),x.end()
#define ft first
#define se second
#define ci(x) int x; cin>>x
int a[1000001];
int main(){
    ttttyyyy
    ci(n);
    ci(m);
    ll sum=0;
    fo(i,0,m){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>n)cout<<-1<<endl;
    else cout<<n-sum<<endl;
    return 0;
}


Measured memory_bytes: 3692
N = int(input())
S = [input() for _ in range(N)]

C = [0] * 4
for s in S:
    if s == "AC":
        C[0] += 1
    elif s == "WA":
        C[1] += 1
    elif s == "TLE":
        C[2] += 1
    elif s == "RE":
        C[3] += 1

print("AC x " + str(C[0]))
print("WA x " + str(C[1]))
print("TLE x " + str(C[2]))
print("RE x " + str(C[3]))

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

a_list= [[0 for i in range(10)] for j in range(10)]
b_list= [[0 for i in range(10)] for j in range(10)]
for i in range(N+1):
    a=int(str(i)[0])
    b=int(str(i)[-1])
    a_list[a][b]+=1
    b_list[b][a]+=1

count=0
for i in range(1,10):
    for j in range(1,10):
        count+=a_list[i][j]*b_list[i][j]

print(count)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>

int main() {
  long long a, b, c;
  std::cin >> a >> b >> c;
  if (a % 2 == 1 && b % 2 == 1 && c % 2 == 1) {
    std::cout << std::min({b * c, c * a, a * b}) << std::endl;
  } else {
    std::cout << 0 << std::endl;
  }
}

Measured memory_bytes: 256
a = [int(i) for i in input().split()]
a.sort()
if a[0] == a[1] and a[1] == a[2] and a[2] == a[3] and a[4] == a[5] and a[5] == a[6] and a[6] == a[7] and a[8] == a[9] and a[9] == a[10] and a[10] == a[11]:
    print("yes")
else:
    print("no") 
    



Measured memory_bytes: 5604
from collections import Counter

n, k, q = map(int,input().split())      
A = []
for i in range(q):
    A.append(int(input()))
As = list(set(A))
S=Counter(A)
B = [k-q]*n
for k,v in S.items():
  B[k-1]+=v

for i in B:
  if(i>0):
    print('Yes')
  else:
    print('No')
  

Measured memory_bytes: 16240
import java.util.Scanner;

public class Main {
	static int[] subTreeSize;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final long D = (long) (5 * Math.pow(10, 15));
		String s = sc.next();
		long k = sc.nextLong();
		long sum = 0;
		
		for (int i = 0; i < s.length(); i++) {
			int n = Integer.parseInt(s.substring(i, i + 1));
			sum += Math.pow(n, D);
			if (k <= sum) {
				System.out.println(n);
				sc.close();
				return;
			}
		}
		
		sc.close();
	}
}


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

using namespace std;

int main(){
    
	string s;
	cin >> s;
	if (s == "SUN") {
		cout << "7" << endl;
	}
	if (s == "MON") {
		cout << "6" << endl;
	}
	if (s == "TUE") {
		cout << "5" << endl;
	}
	if (s == "WED") {
		cout << "4" << endl;
	}
	if (s == "THU") {
		cout << "3" << endl;
	}
	if (s == "FRI") {
		cout << "2" << endl;
	}
	if (s == "SAT") {
		cout << "1" << endl;
	}
	return 0;
}

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

using namespace std;

//#define FILE_IO

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    int N, K;
    cin >> N >> K;
    cout << N - K + 1;

    return 0;
}


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

using namespace std;
typedef long long ll;
int main() {
  int n;
  cin >> n;
  ll oddCost = 0;
  ll evenCost = 0;
  ll oddSum = 0;
  ll evenSum = 0;
  ll a;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    oddSum += a;
    evenSum += a;

    if (i % 2 == 0 && evenSum <= 0) {
      evenCost += 1LL - evenSum;
      evenSum = 1LL;      
    } else if (i % 2 == 1 && evenSum >= 0) {
      evenCost += 1LL + evenSum;
      evenSum = -1LL;
    }

    if (i % 2 == 1 && oddSum <= 0) {
      oddCost += 1LL - oddSum;
      oddSum = 1;
    } else if (i % 2 == 0 && oddSum >= 0) {
      oddCost += 1LL + oddSum;
      oddSum = -1;
    }
  }

  cout << min(oddCost, evenCost) << endl;
  return 0;
}



Measured memory_bytes: 256
import Data.Char

main :: IO ()
main = do
    n <- readLn 
    let res = stack n []
    putStrLn res
        where
            numToChar n = chr $ n + (ord 'a') - 1
            stack n xs
                | n == 0 = xs
                | n <= 26 = (numToChar n) : xs
                | otherwise = 
                    let q = (n - 1) `div` 26
                        r = n `mod` 26
                        c = numToChar $ if r == 0 then 26 else r
                    in  stack q (c : xs)

Measured memory_bytes: 3884
/*
			   ___ _   _ _   _ _____ 
			  |_  | | | | \ | |  _  |
			    | | | | |  \| | | | |
			    | | | | | . ` | | | |
			/\__/ / |_| | |\  \ \_/ /
			\____/ \___/\_| \_/\___/                       
		 
 		* Copyright (C) - juno
  		* 2020-08-15
*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma") 
using namespace std;
 
typedef long long int ll;
typedef long double ld;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef stack<int> si;
typedef pair<int,int> pi;
typedef vector<pair<long int,int>> vpi;
 
#define li(i, a, b) for (int i=a; i<(b); i++)
#define fl(i, a) for (int i=0; i<(a); i++)
#define ln(i,a,b) for (int i = (b)-1; i >= a; i--)
#define bl(i,a) for (int i = (a)-1; i >0; i--)
#define blm(i,a) for (int i = (a)-1; i >= 0; i--)
#define el "\n"
#define sp " "
#define pb push_back
#define m0(array,n) memset(array,0,n)
#define mem(array,data,n) memset(array,data,n)

void fast(){
	ios::sync_with_stdio(0);
	cin.tie(0);
}
int main(){
	fast();
	int n;
	cin>>n;
	long long int a[n];
	int c=0;
	fl(i,n)cin>>a[i];
	for(int i=0;i<n-2;i++){
		for(int j=i+1;j<n-1;j++){
			for(int k=j+1;k<n;k++){
				if((max({a[i],a[j],a[k]})<a[i]+a[j]+a[k]-max({a[i],a[j],a[k]}))&&(a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i]))
					c++;
			}
		}
	}		
	cout<<c;
	return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0; i<N; i++){
    cin >> d[i];
  }
  sort(d.begin(), d.end());
  int pivot = d[N/2];
  int ans = 0;
  if(d[(N/2) -1] == pivot){
    // do nothing
  }else{
    if(N % 2 == 0){
      ans += pivot - d[(N/2) - 1];
    }else{
      ans += 1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if((a+b)%2==0){
	cout<<(a+b)/2<<endl;
    }
    else if((a+b)%2!=0){
    	cout<<(a+b)/2+1<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD (10e9+7)
 
using namespace std;
 
 
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); 
    
    long long a, b, c, k;
    cin >> a >> b >> c >> k;

    if(k <= a + b) cout << min(a, k);
    else cout << a - (k-(a+b));

    return 0;
}

Measured memory_bytes: 3652
n=int(input())
if n == 1:
    print(1)
elif n == 2:
    print(2)
else:
    p=n+1 
    a=((1+5**(1/2))/2)**p
    b=((1-5**(1/2))/2)**p
    c=1/(5**(1/2))
    print(int(c*(a-b)))


Measured memory_bytes: 5628
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int A,B,C,D;
      cin >> A >> B >>C>>D;
     
      if (A+B==C+D) {
        cout << "Balanced" << endl;
      }
      else if(A+B>C+D){
        cout << "Left" << endl;
      }
            else if(A+B<C+D){
        cout << "Right" << endl;
      }
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mid ((l+r)/2)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define drep(i,a,b) for(int i=(a);i>=(b);--i)
#define file(a) freopen(#a".in","r",stdin),freopen(#a".out","w",stdout);
const int maxn=5e5+5,mod=1e9+7,inf=0x3f3f3f3f;
int n,m,Q,K,T;
int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}
char c[maxn];
int a[maxn];
signed main(){
    //file(a);
    n=read();
    scanf("%s",c+1);
    int x=0,y=0,z=0,d=0,ans=inf;
    rep(i,1,n)a[i]=(c[i]=='W'),d+=a[i];
    y=d;
    drep(i,n,1){
        int yy=y;if(a[i])--yy;
        ans=min(ans,max(yy,z-x));
        if(a[i])++x,--y;
        ++z;
    }
    if(ans!=inf)printf("%d\n",ans);
    else puts("0");

    return 0;
}


Measured memory_bytes: 4792
#include<array>
#include<iostream>
#include<algorithm>

using namespace std;
array<int, 1000000> buf;

typedef array<int, 1000000>::iterator it_type;
int get_longest_steps_0(it_type first, it_type last) {
	it_type it = ++first;
	it_type it_temp = first;
	int result = 0;
	while (it != last) {
		auto it_duration = it - first;
		auto sub = *it - *first;
		if (it_temp	> first) {
			// 整数列の間に白紙があるケース
			if (it_duration + 1 != sub) {
				result = max(result, static_cast<int>(it_duration + 1));
				if (it_duration + 2 == sub) {
					// 次の整数列と白紙で連結できるケース
					first = it_temp;
					it_temp = it;
				}
				else {
					// 白紙で連結できない
					first = it;
				}
			}
		}
		else {
			if (it_duration != sub){
				if (it_duration + 1 == sub) {
					// 白紙で連結可能なので戻り値にしない。
					it_temp = it;
				}
				else {
					// 連結不可能なの白紙の分を+1する
					result = max(result, static_cast<int>(it_duration + 1));
					first = it;
				}
			}
		}
		++it;
	}
	result = max(result, static_cast<int>(it - first + 1));
	return result;
}

int get_longest_steps_non_0(it_type first, it_type last) {
	it_type it = first;
	int result = 0;
	while (it != last) {
		if (it - first != *it - *first) {
			result = max(result, static_cast<int>(it - first));
			first = it;
		}
		++it;
	}
	return result;
}

//template<typename T>
int get_longest_steps(it_type first, it_type last) {
	int result;
	if (*first == 0) {
		result = get_longest_steps_0(first, last);
	}
	else {
		result = get_longest_steps_non_0(first, last);
	}
	return result;
}


int main() {

	while (true) {
		int n, k;
		cin >> n >> k;

		if (n == 0 && k == 0) {
			break;
		}

		for (int i = 0; i < k; i++) {
			cin >> buf[i];
		}
		
		it_type end = buf.begin() + k;

		sort(buf.begin(), end);

		cout << get_longest_steps(buf.begin(), end) << endl;

	}

	return 0;
}

Measured memory_bytes: 3312
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

const long long MOD = 1000000007;

int main(){
  string s;
  cin>>s;
  if(s=="SUN")
    std::cout << 7 << std::endl;
  else if(s=="MON")
    std::cout << 6 << std::endl;
  else if(s=="TUE")
    std::cout << 5 << std::endl;
  else if(s=="WED")
    std::cout << 4 << std::endl;
  else if(s=="THU")
    std::cout << 3 << std::endl;
  else if(s=="FRI")
    std::cout << 2 << std::endl;
  else
    std::cout << 1 << std::endl;
  return 0;
}


Measured memory_bytes: 256
n = (int)(input())
s = sorted([sorted(list(input())) for i in range(n)])
 
ans = 0
temp = 1
for i in range(n - 1):
  if s[i] == s[i + 1]:
    temp += 1
  else:
    if temp != 1:
      ans += temp * (temp - 1) // 2
      temp = 1
else:
  if temp != 1:
    ans += temp * (temp - 1) // 2
    temp = 1
print(ans)

Measured memory_bytes: 100092
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
 
using namespace std;
//using namespace __gnu_pbds;

//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;                         

const int N = (int)5e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;

void solve () {
	int a, b;
	cin >> a >> b;
	if (a <= 0 && 0 <= b) {
		cout << "Zero";
		return;
	}
	if (a >= 1) {
		cout << "Positive";
		return;
	}
	if ((abs (a) - abs(min (-1, b)) + 1) % 2 == 0) {
		cout << "Positive";
		return;
	}
	cout << "Negative";
}   	
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//    cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

Measured memory_bytes: 3580
using System;

class Program
    {
        static void Main(string[] args)
        {
            // 入力
            var N = long.Parse(Console.ReadLine());

            var min = Math.Max((long)(N / 4), 1);

            // h <= n <= w としてよい。ただし、 h = den/num
            var den = 1l;
            var num = 1l;

            for (long w = min;w <= 3500; w++)
            {
                for (long n = min; n <= w; n++)
                {
                    den = 4 * n * w - N * n - N * w;
                    num = N * n * w;
                    
                    if (den > 0 && num % den == 0)
                    {
                        Console.WriteLine("{0} {1} {2}", ((int)(num / den)).ToString(), n.ToString(), w.ToString());
                        return;
                    }
                }
            }
        }
    }

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

using namespace std;

int main()
{
	int N, count = 0;

	string S, T;

	cin >> N >> S;

	for (int repeat = 1; repeat <= N; repeat++)
	{
		cin >> T;

		for (int startpos = 0; startpos < T.size(); startpos++)
		{
			for (int interval = 1; interval <= T.size(); interval++)
			{
				bool found = true;

				for (int i = 0; i < S.size(); i++)
				{
					if (startpos + interval * i < T.size())
					{
						if (T[startpos + interval * i] != S[i])
						{
							found = false;
						}
					}
					else
					{
						found = false;
					}
				}

				if (found == true)
				{
					count++; goto Exit;
				}
			}
		}

	Exit:;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 1208
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  ll n, d; cin >> n >> d;
  vector<ll> x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];

  int ans = 0;
  rep(i, n){
    if(x[i]*x[i] + y[i] * y[i] <= d * d) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 6360
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();    
        int K = stdIn.nextInt();    
        stdIn.close();
        long mod = (long)(Math.pow(10, 9) + 7);
        long cnt = 0;

        for (int i = K; i <= N + 1; i++) {
            long l = sum(0, i - 1);
            long r = sum(N - i + 1, N);
            cnt += r - l + 1;
        }
        System.out.println(cnt % mod);        
    }

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

Measured memory_bytes: 27176
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N=scan.nextInt();
		String S = scan.next();
		String ans="";

		int cnt=0;
		for(int i=0;i<S.length();i++){
			String s=S.substring(i,i+1);
			if(s.equals("(")){
				cnt++;
			}else{
				cnt--;
			}
			if(cnt<0){
				ans +="(";
				cnt++;
			}
		}
		ans +=S;
		for(int i=0;i<cnt;i++){
			ans+=")";
		}
		System.out.println(ans);


	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main()
{
    string s;
    int k;
    cin >> k >> s;
    if (s.size() <= k)
        cout << s << endl;
    else
    {
        cout << s.substr(0, k) + "..." << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
typedef vector<ll> vl;
#define rp(i, f, t) for (int i = f; i < t; i++)
#define pr(i, f, t) for (int i = t - 1; i >= f; i--)
#define ca(n, a) rp(ca_i, 0, n) cout << a[ca_i] << ((ca_i == n - 1) ? "\n" : " ")
#define za(n, a) rp(za_i, 0, n) a[za_i] = 0
#define be(a) a.begin(), a.end()
#define ce(a) cout << (a) << endl
int main()
{
    double pi = 3.141592;
    ll n;
    cin >> n;
    cout << 2 * n * pi << endl;
}

Measured memory_bytes: 3788
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define ll long long int

ll mod=1e9+7;

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    vector<int> can_win(k+1,0);
    for(int i=1;i<=k;i++){
        for(int j=0;j<n;j++){
            if(a[j]<=i){
                if(can_win[i-a[j]]%2==0){
                    can_win[i]=can_win[i-a[j]]+1;
                    break;
                }
                else{
                    can_win[i]=can_win[i-a[j]]+1;
                }
            }
        }
    }
    if(can_win[k]%2!=0){
        cout<<"First\n";
    }
    else{
        cout<<"Second\n";
    }
    return 0;
}

Measured memory_bytes: 3796
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    ll a;
    cin >> a;
    cout << (a/2)*(a/2+(a%2)) << endl;
    return 0;
}


Measured memory_bytes: 256
n,a,b = map(int,input().split())
def get_sum(a):
    sum = 0
    while(a != 0):
        sum = sum + a%10
        a = a//10
    return sum

res = 0
for i in range(n+1):
    t = get_sum(i)
    if(a <= t and t <= b):
        res = res + i

print(res)

Measured memory_bytes: 3060
N = int(input())
Lines = list(map(int, input().split(" ")))
Lines.sort()
answer = 0
 
import bisect
 
for lineI in range(N):
    for lineJ in range(lineI+1,N):
    	answer += bisect.bisect_left(Lines,Lines[lineI]+Lines[lineJ])-lineJ-1
print(answer)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define int long long
using namespace std;
int aa[12345678], cost[12345678];
signed main() {
	int n, m, a = 0, x, y, ans = 0; cin >> n >> m; cost[1]++;
	for (int h = 1; h <= n; h++) { aa[h]++; }
	for (int h = 0; h < m; h++) {
		cin >> x >> y;
		if (cost[x] == 1) { cost[y] = 1; }
		if (aa[x] == 1) { cost[x] = 0; }
		aa[x]--; aa[y]++;
	}
	for (int h = 1; h <= n; h++) { if (cost[h] == 1) { ans++; } }
	cout << ans << endl; return 0;
}

Measured memory_bytes: 3072
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let v:Vec<usize> = (0..n).map(|_| read()).collect();
    let mut y = v.clone();
    y.sort();
    for i in 0..n {
        if v[i] < y[n/2] {
            println!("{}", y[n/2]);
        } else {
            println!("{}", y[n/2-1]);
        }
    }
}


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

using namespace std;

int Q;
int a,b,c,d;
int as,k;

bool chk(int pos)
{
	int ca = 0,cb = 0;
	ca += (pos - 1) / (k + 1) * k;
	cb += (pos - 1) / (k + 1);
	ca += (pos - 1) % (k + 1);
	cb += (a + b - pos + 1) / (k + 1) * k;
	ca += (a + b - pos + 1) / (k + 1);
	cb += (a + b - pos + 1) % (k + 1);
	if(cb == b)
		as = pos;
	return cb >= b;
}

int main()
{
	scanf("%d",&Q);
	while(Q --)
	{
		scanf("%d%d%d%d",&a,&b,&c,&d);
		k = ceil(max(a,b) * 1.0 / (min(a,b) + 1));
		int l = 1,r = a + b + 1;
		while(l <= r)
		{
			int mid = (l + r) >> 1;
			if((mid - 1) % (k + 1) == 0)
			{
				if(a + b - mid + 2 <= k) ;
				else if(mid > 1)
				{
					mid ++;
				}
			}
			if(chk(mid)) l = mid + 1;
			else r = mid - 1;
			if((l - 1) % (k + 1) == 0)
			{
				if(a + b - l + 2 <= k) ;
				else if(l > 1)
				{
					l ++;
				}
			}
			if((r - 1) % (k + 1) == 0)
			{
				if(a + b - r + 2 <= k) ;
				else if(r > 1)
				{
					r --;
				}
			}
		}
		if(c < as && d >= as)
		{
			for(int i = c;i < as; ++ i)
				printf("%c",i % (k + 1) == 0 ? 'B' : 'A');
			for(int i = as;i <= d; ++ i)
				printf("%c",(a + b - i + 1) % (k + 1) == 0 ? 'A' : 'B');
		}
		if(d < as)
			for(int i = c;i <= d; ++ i)
				printf("%c",i % (k + 1) == 0 ? 'B' : 'A');
		if(c >= as)
			for(int i = c;i <= d; ++ i)
				printf("%c",(a + b - i + 1) % (k + 1) == 0 ? 'A' : 'B');
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 384
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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 ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int h,w,n;
vector<int> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h>>w>>n;
    for (int i = 0; i < n; i++)
    {
        int temp;
        cin >> temp;
        a.push_back(temp);
    }
    vector<vector<int> > ans(h,vector<int>(w));
    int hc=0;
    int wc=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<a[i];j++){
            ans[hc][wc]=i+1;
            wc++;
            if(wc==w){
                wc=0;
                hc++;
            }
        }
    }
    for(int i=0;i<h;i++){
        if(i%2==1){
            reverse(ALL(ans[i]));
        }
        for(int j=0;j<w;j++){
        cout << ans[i][j] << " ";
        }
        cout<<"\n";
    }
}



Measured memory_bytes: 384
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 04/05/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  vector<vector<double>> dp(n+1, vector<double>(n+1));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    double p; cin>>p;
    auto q = double(1)-p;
    for (int k = 0; k <= i; k++) {
      dp[i+1][k] += dp[i][k] * q;
      dp[i+1][k+1] += dp[i][k] * p;
    }
  }
  cout << fixed << setprecision(10) << accumulate(dp[n].begin()+n/2+1, dp[n].begin()+n+1, double(0)) << endl;

  return 0;
}


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

signed main(){
    int L,R;
    cin >> L >> R;
    int ans = 2018;
    for(int i = L; i < R; i++) {
        for(int j = i+1; j <= R; j++) {
            ans = min(ans, i*j%2019);
            if(ans == 0)break;
        }
        if(ans == 0)break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int r, D;
int x[11];

int main(){
    scanf("%d %d %d", &r, &D, x);
        for(int i=0; i<10; i++){
        x[i+1] = x[i] * r - D;
        printf("%d\n", x[i+1]);
    }
    return 0;
}











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

Int MOD = 1e9+7;

//---------- べき乗 ----------
Int power(Int a, Int n){
    if(a == 0) return 0;
    if(n == 0) return 1;
    
    Int res = 1;
    while(n > 0){
        if(n % 2 == 1) res = res * a % MOD;
        a = a * a % MOD; n /= 2;
    }
    return res;
}

//---------- 逆元 ----------
Int inv(Int a){
    return power(a, MOD-2);
}

int main(){
    int N, M; cin >> N >> M;
    vector<int> S(2010,0), T(2010,0);
    rep1(i,N) cin >> S[i];
    rep1(i,M) cin >> T[i];

    // dp[i][j]: S[i],T[j]までで，かつこれらをペアにする共通部分列の個数
    vector<vector<Int>> dp(2010,vector<Int>(2010,0));
    vector<vector<Int>> sum(2010,vector<Int>(2010,1));
    dp[0][0] = 1;

    rep1(i,N){
        rep1(j,M){
            if(S[i] == T[j]) dp[i][j] = (sum[i-1][j-1] + 1) % MOD;
            sum[i][j] = (sum[i-1][j] + sum[i][j-1] + MOD - sum[i-1][j-1] + dp[i][j]) % MOD;
        }
    }

    cout << (sum[N][M]-1) * inv(2) % MOD + 1 << endl;
}


Measured memory_bytes: 63616