akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
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)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
Graph G;
int n;
int d[100010];

// <最短距離, 頂点の番号>
using P = pair<int, int>;

void dijkstra2(int s)
{
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d, d + n, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty())
    {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;

        for (int i = 0; i < G[v].size(); ++i)
        {
            Edge e = G[v][i];
            if (d[e.first] > d[v] + e.second)
            {
                d[e.first] = d[v] + e.second;
                que.push(P(d[e.first], e.first));
            }
        }
    }
}

void dijkstra(int s)
{
    for (int i = 0; i < 100010; i++)
    {
        d[i] = INF;
    }
    d[s] = 0;
    priority_queue<pair<int, int>, vector<pair<int,int>> , greater<pair<int,int>>> pq;
    pq.push({0, s});
    while(!pq.empty()){
        pair<int, int> p = pq.top();
        pq.pop();
        int v = p.second;
        int dis=p.first;
        if(d[v] < dis){
            continue;
        }
        for (auto u : G[v]){
            if(d[v] + u.second < d[u.first]){
                d[u.first] = d[v] + u.second;
                pq.push({d[u.first], u.first});
            }
        }
    }
}

signed main(){
   int m;
   cin>>n>>m;
   G.assign(n, vector<Edge>());
   REP(i, m)
   {
       int l, r, c;
       cin >> l >> r >> c;
       l--, r--;
       G[l].push_back(Edge(r, c));
       G[r].push_back(Edge(l, c));
   }
   for (int i = 1; i < n; i++)
   {
       G[i].push_back(Edge(i - 1, 0));
   }
   dijkstra(0);
   if(d[n-1]==INF){
       cout << -1 << endl;
   }
   else{
       cout << d[n - 1] << endl;
   }
   return 0;
}

Measured memory_bytes: 12664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    while(N--) {
        char a;
        cin >> a;
        if(a == 'Y') {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define N 105
using namespace std;

int n, a[N], ans[N];
int main()
{
	int i, j, k;
	cin >> n;
	for (i = 1; i <= n; i++) scanf("%d", &a[i]);
	for (i = n; i > 0; i--) {
		for (j = n, k = i; j > 0; j--) {
			if (a[j]) {
				if (a[j] == k) {ans[i] = k; a[j] = 0; break;}
				k--;
			}
		}
		if (j == 0) {puts("-1"); return 0;}
	}
	for (i = 1; i <= n; i++) printf("%d\n", ans[i]);
    return 0;
}

Measured memory_bytes: 256
a,b = map(int, input().split())
num = [2,3,4,5,6,7,8,9,10,11,12,13,1]
for i in range(1,14):
    if a == i:
        x = num.index(a)
    if b == i:
        y = num.index(b)
if x < y:
    print('Bob')
elif x > y:
    print('Alice')
else:
    print('Draw')

Measured memory_bytes: 9024
#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;
    cin >> n;
    vector<pair<pair<string, int>, int>> g(n);
    rep(i, n)
    {
        string s;
        int p;
        cin >> s >> p;
        g[i] = make_pair(make_pair(s, -p), i + 1);
    }
    sort(g.begin(), g.end());
    rep(i, n)
    {
        // cout << g[i].first.first << " " << g[i].first.second << " " << endl;
        cout << g[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
alphabet_set={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
s=input()
s_set=set(s)
ans_set=alphabet_set-s_set
ans_l=list(ans_set)
ans_l.sort()

if ans_l==[]:
    print("None")
else:
    print(ans_l[0])

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

using namespace std;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define all(x) begin(x),end(x)

#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;


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

    ll ans = 0;

    int n; cin >> n;
    ll H, A, D, S;
    cin >> H >> A >> D >> S;
    vll t, b, u;
    REP(i, n) {
        int h, a, d, s;
        cin >> h >> a >> d >> s;
        int dam2p = max(a - D, 0LL);
        if (dam2p == 0) continue;
        int dam2this = max(A - d, 0LL);
        if (dam2this == 0) {
            ans = -1;
            continue;
        }

        t.push_back((h-1) / dam2this + 1);
        b.push_back(dam2p);
        u.push_back(S > s);
    }
    if (ans == -1) {
        cout << -1 << endl;
        return 0;
    }

    n = t.size();

    vi ord(n); iota(all(ord), 0);
    sort(all(ord), [&](int i,int j){
        return (double)t[i] / b[i] < (double)t[j] / b[j];
    });

    ll tsum = 0;
    for (int i : ord) {
        tsum += t[i];
        ans += (tsum - u[i]) * b[i];
        if (ans >= H) {
            ans = -1;
            break;
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int n, k;
    cin >> n >> k;
    if(k == 1)
    {
      cout << 0 << endl;
      return 0;
    }
    vector<ll> a(n);
    vector<ll> sum(n+1);
    vector<ll> rest(n+1);
    sum[0] = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum[i+1] = sum[i] + a[i];
        rest[i+1] = (sum[i+1] - (i+1)) % k;
        if(rest[i+1] < 0) rest[i+1] += k;
    }
    ll num = min(k-2, n);
    map<ll, ll> m;
    m[rest[0]]++;
    for(int i = 0; i < num; i++)
    {
        ll cand = rest[i+1];
        m[cand]++;
    }

    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        m[rest[i]]--;
        if(i < n-num)
        {
            m[rest[k-1+i]]++;
        }
        if(m.find(rest[i]) != m.end()) ans += m[rest[i]];
    }
    cout << ans << endl;
}


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

int main()
{
long long N,A,B;scanf("%lld %lld %lld",&N,&A,&B);
long long ans=N/(A+B)*A;
if(N%(A+B)<A)ans+=N%(A+B);
else ans+=A;
printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int h, w;
    cin >> h >> w;
    vector <vector<char>> board(h, vector<char>(w));
    rep(i, h) rep(j, w) {
        char a;
        cin >> a;
        if(a == '.') board[i][j] = '0';
        else board[i][j] = a;
    }
    int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
    int dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
    
    
    rep(i, h){
        rep (j, w){
            if (board[i][j] == '#') continue;
            int num=0;
            for (int d=0; d<8; d++){
                int ni = i+dx[d];
                int nj = j+dy[d];
                if (ni < 0 || h <= ni) continue;
                if (nj < 0 || w <= nj) continue;
                if (board[ni][nj] == '#') num++;
            }
            board[i][j] = (char)(num + '0');
        }
    }
    rep (i, h){
        rep(j, w){
            cout << board[i][j];
        }
        cout << endl;
    }

}

Measured memory_bytes: 256
n,m=map(int,input().split())
a=list(map(int,input().split()))
aa=sum(a)
count=0
for i in range(len(a)):
    if a[i]>=aa*(1/(4*m)):
        count+=1
    else:
        pass
if count>=m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9188
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


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


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


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


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


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


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


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


def mt(f):
    import time

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

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

    return wrap


@mt
def slv(N, S1, S2):
    ans = 0
    MOD = 1000000007

    if S1[0] == S2[0]:
        ans = 3
        i = 1
        p = 0
    else:
        ans = 6
        i = 2
        p = 1

    while i < N:
        if p == 0:
            if S1[i] == S2[i]:
                ans *= 2
                i += 1
                p = 0
            else:
                ans *= 2
                i += 2
                p = 1
        else:
            if S1[i] == S2[i]:
                p = 0
                i += 1
            else:
                ans *= 3
                i += 2
                p = 1
        ans %= MOD

    return ans


def main():
    N = read_int()
    S1 = read_str()
    S2 = read_str()

    print(slv(N, S1, S2))


if __name__ == '__main__':
    main()


Measured memory_bytes: 60396
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
using namespace std;
#define ll long long

int main(){
	string S;
	cin>>S;
	if(S[0]=='S'){
		S="Cloudy";
	}else if(S[0]=='C'){
		S="Rainy";
	}else{
		S="Sunny";
	}
	cout<<S;
	return 0;
}

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

struct SuffixArray {
    const int L;
    string s;
    vector<vector<int> > P;
    vector<pair<pair<int,int>,int> > M;

    SuffixArray(const string &s) : L(s.length()), s(s), P(1, vector<int>(L, 0)), M(L) {
        for (int i = 0; i < L; i++) P[0][i] = int(s[i]);
        for (int skip = 1, level = 1; skip < L; skip *= 2, level++) {
            P.push_back(vector<int>(L, 0));
            for (int i = 0; i < L; i++) 
            M[i] = make_pair(make_pair(P[level-1][i], i + skip < L ? P[level-1][i + skip] : -1000), i);
            sort(M.begin(), M.end());
            for (int i = 0; i < L; i++) 
            P[level][M[i].second] = (i > 0 && M[i].first == M[i-1].first) ? P[level][M[i-1].second] : i;
        }    
    }

    vector<int> GetSuffixArray() { return P.back(); }

    int LongestCommonPrefix(int i, int j) {
        int len = 0;
        if (i == j) return L - i;
        for (int k = P.size() - 1; k >= 0 && i < L && j < L; k--) {
            if (P[k][i] == P[k][j]) {
                i += 1 << k;
                j += 1 << k;
                len += 1 << k;
            }
        }
        return len;
    }
};

int main(){
    string s;
    int n;
    cin >> n >> s;
    SuffixArray suffix(s);
    vector<int> v = suffix.GetSuffixArray();
    vector<int> t;
    t.resize(v.size());
    for(int i=0;i<v.size();i++) t[v[i]] = i;

    int ans = 0;
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v.size();j++){
            if(i == j) continue;
            int mx = max(t[i], t[j]);
            int mn = min(t[i], t[j]);
            ans = max(ans, min(mx-mn, suffix.LongestCommonPrefix(t[i], t[j])));
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 768
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
template <typename T>
T pow(T a, ll n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}
 
template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
 
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
 
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};
 
using mint = ModInt<1000000007>;
using Graph = vector<vector<int>>;
Graph G;
/*------------------------------------------------------------------*/
int main(){
  ll n; cin >> n;
  ll c[n + 1][10][10];
  rep(j, 10)rep(k, 10) c[0][j][k] = 0;
  _rep(i, 1, n + 1){
    string s = to_string(i);
    rep(j, 10)rep(k, 10){
      if(s[0] - '0' == j and s[s.size() - 1] - '0' == k){
        c[i][j][k] = c[i - 1][j][k] + 1;
      }else c[i][j][k] = c[i - 1][j][k]; 
    }
  }
  ll ans = 0;
  rep(j, 10)rep(k, 10) ans += c[n][j][k] * c[n][k][j];
  cout << ans << endl;
}

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

typedef long long int ll;
typedef string str;

int main ()
{
	ll t,n,m,k,i,j,a,b;
	cin >> n >> a >> b;
	ll hash[n+2]={0};
	ll hasha[n+2]={0};
	ll hashb[n+2]={0};
	m=b+1-a;
	for(i=1;i<=m/2;i++)
	{
		hash[i]=m;
		// cout << hash[i] << endl;
	}
	if(!(m%2))
	{
		hash[i-1]-=m/2;
	}
	for(i=1;i<a;i++)
	{
		hash[i]+=a-i;
		hasha[i+1]+=2;
		hasha[i+m/2+1]-=2;
	}
	if(!(m%2))
	{
		for(i=1;i<a;i++)
		{
			hash[i+m/2]-=1;
		}
	}
	k=n-b+1;
	// cout << "k=" << k << endl;
	for(i=1;i<k;i++)
	{
		hash[i]+=k-i;
		hashb[i+1]+=2;
		hashb[i+m/2+1]-=2;
	}
	if(!(m%2))
	{
		for(i=1;i<k;i++)
		{
			hash[i+m/2]-=1;
		}
	}
	for(i=1;i<k;i++)
	{
		hashb[i+2]+=1;
		hashb[i+1+a]-=1;
	}
	for(i=1;i<n;i++)
	{
		hasha[i]+=hasha[i-1];
		hashb[i]+=hashb[i-1];
		hash[i]+=(hasha[i]+hashb[i]);
	}
	for(i=1;i<n;i++)
	{
		cout << hash[i] << endl;
	}
	return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int h, w, kk;
    cin >> h >> w >> kk;

    vector<vector<char>> a(h, vector<char>(w));
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            cin >> a[i][j];
    
    int ans = 0;
    for (int i = 0; i < (1 << h); i++){
        for (int j = 0; j < (1 << w); j++){
            set<int> r, c;
            for (int k = 0; k < h; k++){
                if (i & (1 << k))
                    r.insert(k);
            }
            for (int k = 0; k < w; k++){
                if (j & (1 << k))
                    c.insert(k);
            }
            
            int cnt = 0;
            for (int rr = 0; rr < h; rr++){
                if (r.find(rr) == r.end())
                    continue;
                for (int cc = 0; cc < w; cc++){
                    if (c.find(cc) != c.end() && a[rr][cc] == '#')
                        cnt += 1;
                }
            }

            if (cnt == kk)
                ans += 1;

        }
    }

    cout << ans << endl;

    return 0;
}


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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1000000000;
const LL MOD = 1000000007;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int D = B/A;
  if(C < D) D = C;
  cout << D << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<string> s(n);
    for(int i=0;i<n;i++){
        cin>>s[i];
        sort(s[i].begin(),s[i].end());
    }
    map<string,long long> mp;
    for(int i=0;i<n;i++){
        if(mp.find(s[i])!=mp.end()){
            mp[s[i]]++;
        }else{
            mp[s[i]]=1;
        }
    }
    long long ans=0;
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        ans+=(itr->second*(itr->second-1))/2;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 18176
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
//#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=100005;
//i_am_noob
int n,m,h[maxn],x,y,ans=0;
bool good[maxn];

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n >> m;
	rep(n) cin >> h[i];
	rep(n) good[i]=true;
	while(m--){
		cin >> x >> y;
		x--,y--;
		if(h[x]<=h[y]) good[x]=false;
		if(h[x]>=h[y]) good[y]=false;
	}
	rep(n) ans+=good[i];
	print1(ans);
	return 0;
}

Measured memory_bytes: 4116
def slove():
    import sys
    input = sys.stdin.readline
    N = int(input().rstrip('\n'))
    A = [int(input().rstrip('\n')) for _ in range(N)]
    t = 0
    cnt = 0
    for a in A:
        t += a
        if a == 0:
            cnt += (t // 2)
            t = 0
    cnt += (t // 2)
    print(cnt)


if __name__ == '__main__':
    slove()


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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

template<typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}


int main(int, char**)
{
	double A;
	double B;
	double C;
	double D;
	cin >> A >> B >> C >> D;

	cout << (ceil(A / D) >= ceil(C / B) ? "Yes" : "No") << endl;;

	return 0;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793


   
int main(){
  int h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >>m2 >>k;
  int t=(h2-h1)*60+m2-m1;
  cout << t-k << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <set>
#include <queue>

using namespace std;
using PII = pair<int, int>;

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

	vector<set<int>> connect(n);
	vector<int> a(n - 1), b(n - 1);

	for (int i = 0; i < n - 1; i++) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;

		connect[a[i]].insert(b[i]);
		connect[b[i]].insert(a[i]);
	}
	vector<int> c(n);
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	sort(c.begin(), c.end());

	priority_queue<PII, vector<PII>, greater<PII>> que;
	for (int i = 0; i < n; i++) {
		que.push(make_pair((int)connect[i].size(), i));
	}

	vector<int> d(n, -1);
	int c_idx = 0;
	while (!que.empty()) {
		auto p = que.top();
		que.pop();
		// printf("%3d %3d\n", p.first, p.second);

		int pos = p.second;
		if (d[pos] != -1) {
			continue;
		}
		d[pos] = c[c_idx];
		c_idx++;

		for (auto x: connect[pos]) {
			connect[x].erase(pos);
			que.push(make_pair(connect[x].size(), x));
			// printf("push %3d %3d\n", connect[x].size(), x);
		}

		connect[pos].clear();
	}

	int score = 0;
	for (int i = 0; i < n - 1; i++) {
		score += min(d[a[i]], d[b[i]]);
		// printf("%d: %d %d -> %d\n", i, d[a[i]], d[b[i]], min(d[a[i]], d[b[i]]));
	}

	cout << score << endl;
	for (int i = 0; i < n; i++) {
		if (i != 0) {
			cout << " ";
		}
		cout << d[i];
	}
	cout << endl;
	return 0;
}


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

using namespace std;

int N, M, ap[100009];
bool dp[20];
vector < int > h, v[100009];

int cnt2 = 0, ever6 = 0;
void dfs (int nod)
{
    ap[nod] = 1;
    ever6 |= (v[nod].size () > 4);
    if (v[nod].size () > 2) cnt2 ++;
    for (auto it : v[nod])
        if (ap[it] == 0)
            dfs (it);
}

void delEdge (int x, int y)
{
    for (auto it = v[x].begin (); it != v[x].end (); it ++)
        if (*it == y)
        {
            v[x].erase (it);
            break;
        }
    for (auto it = v[y].begin (); it != v[y].end (); it ++)
        if (*it == x)
        {
            v[y].erase (it);
            break;
        }
}

void addEdge (int x, int y)
{
    v[x].push_back (y);
    v[y].push_back (x);
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d", &N, &M);
while (M --)
{
    int x, y;
    scanf ("%d %d", &x, &y);
    addEdge (x, y);
}
for (int i=1; i<=N; i++)
    if (v[i].size () & 1)
    {
        printf ("No\n");
        return 0;
    }
dfs (1);
bool ok = 0;
if (ever6) ok = 1;
else
if (cnt2 >= 3) ok = 1;
else
if (cnt2 == 2)
{
    int A = -1, B = -1;
    for (int i=1; i<=N; i++)
        if (v[i].size () > 2)
        {
            if (A == -1) A = i;
            else B = i;
        }
    vector < int > curr = v[A];
    for (int i=0; i<4; i++)
        for (int j=i + 1; j<4; j++)
        {
            delEdge (A, curr[i]), delEdge (A, curr[j]);
            memset (ap, 0, sizeof (ap));
            dfs (A);
            if (ap[B] == 0)
            {
                ok = 1;
                i = j = 4;
                break;
            }
            addEdge (A, curr[i]), addEdge (A, curr[j]);
        }
}
if (ok) printf ("Yes\n");
else printf ("No\n");
return 0;
}


Measured memory_bytes: 8192
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            String str = sc.next();
            if(str.equals("-")) break;
            int m = sc.nextInt();
            for(int i=0;i<m;i++){
                int h = sc.nextInt();
                str = str.substring(h) + str.substring(0,h);
            }
            System.out.println(str);
        }
        sc.close();    
    }
}


Measured memory_bytes: 26388
#include <stdio.h>

int main(){
  int val;
  int result;
  scanf("%d",&val);
  if(val <= 999){
    result = 999;
    if(val <= 888){
      result = 888;
      if(val <= 777){
	result = 777;
	if(val <= 666){
	  result = 666;
	  if(val <= 555){
	    result = 555;
	    if(val <= 444){
	      result = 444;
	      if(val <= 333){
		result = 333;
		if(val <= 222){
		  result = 222;
		  if(val <= 111){
		    result = 111;
		  }
		}
	      }
	    }
	  }
	}
      }
    }
  }
  printf("%d",result);
  return 0;
}
	
	          
		 


Measured memory_bytes: 128
#include <iostream>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++)
 
ll i,j,ii,jj;
ll n,m,ans=0,sum;
ll x,y,k;
ll a[100005];
ll hidari,migi,mid;
bool dp[5105][5105];
int dd[5100];
 
 
 
bool solve(ll x){
	if(dd[x]==2){
		return true;
	}else if(dd[x]==1){
		return false;
	}
    //x番目を除いたらどうなるか
    for(i=0;i<n+2;i++){
        for(j=0;j<k+2;j++){
            dp[i][j]=false;
        }
    }
    ll z=1;
	dp[0][0]=true;
    for(i=0;i<n;i++){
        if(i==x)continue;
        for(j=0;j<k;j++){
            if(dp[z-1][j] && j+a[i]<=k)dp[z][j+a[i]]=true;
            if(dp[z-1][j])dp[z][j]=true;
        }
        z++;
    }
	bool flag=false;
	y = max(0ll,k-a[x]);
    for(j=y;j<k;j++){
        if(j>=0 && dp[n-1][j])flag=true;
    }
	if(flag){
		dd[x] = 2;
		return true;//必要
	}else{
		dd[x] = 1;
		return false;//不必要
	}
}
 
 // huhitu huhitu huhitu huhitu hitu hitu って並ぶ
 // 1 1 1 1 2 2 2 2 2
int main(){
    cin>>n>>k;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    hidari=0;
    migi=n-1;
    while(migi-hidari>10){
        mid=(migi+hidari)/2;
        if(solve(mid)){
            migi=mid;
        }else{
            hidari=mid;
        }
    }
	/*for(int i=0;i<n;i++){
		if(solve(i)){
			pe(i);p("は必要");
		}else{
			pe(i);p("は不必要");
		}
	}*/
    for(ii=hidari-20;ii<=hidari+20;ii++){
        if(ii<0 || ii>=n)continue;
        if(!solve(ii)){
			ans=ii;
		}else{
			ans = ii-1;
			break;
		}
        
    }
	p(ans+1);
    return 0;
}

Measured memory_bytes: 31232
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n;
    cin >> n;
    vector<ll> x(n), y(n);
    rep(i, n){
        cin >> x[i] >> y[i];
    }

    ll m1 = -INF;
    ll m2 = -INF;
    ll m3 = -INF;
    ll m4 = -INF;
    rep(i, n){
        m1 = max(m1, x[i] + y[i]);
        m2 = max(m2, -x[i] + y[i]);
        m3 = max(m3, (-x[i]) - y[i]);
        m4 = max(m4, x[i] - y[i]);
    }
    cout << max(m1+m3, m4+m2) << endl;
}


Measured memory_bytes: 6400
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        int l = S.length();
        char[] s = new char[l];
        String a = "01";
        int ans = 0;

        for(int i=0; i<l; i++){
            s[i] = S.charAt(i);
        }

        for(int i=1; i<l; i++){
            if(s[i]==s[i-1]){
                if(s[i-1]==a.charAt(0)){
                    s[i] = a.charAt(1);
                }
                else if(s[i-1]==a.charAt(1)){
                    s[i] = a.charAt(0);
                }
                ans += 1;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 26788
/*
 
*/ 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define LSOne(S) (S & (-S))
#define EPS 1e-9
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pd;
typedef tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAXNUM = 1e6;

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0); // FOR QUERY PROBLEM DON'T FORGET TO UNCOMMENT THIS
    int n;
    cin >> n;
    vector<int> vec(n);
    vector<int> freq(MAXNUM);
    int allg = 0;
    for(auto& v : vec)
    {
        cin >> v;
        ++freq[v];
        allg = __gcd(allg, v);
    }

    for(int g = MAXNUM; g > 1; --g)
    {
        int cnt = 0;
        for(int num = g; num <= MAXNUM; num += g)
        {
            cnt += freq[num];
            if(cnt > 1)
            {
                if(allg == 1)
                {
                    cout << "setwise coprime\n";
                }
                else
                {
                    cout << "not coprime\n";
                }
                return 0;
            }
        }
    }
    assert(allg == 1);
    cout << "pairwise coprime\n";
    return 0;
}
 
/*
 
*/  

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

#define debug(x) cout << #x" = " << x;

#define st first
#define nd second

using namespace std;
using namespace placeholders;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

const int MAXN = 2E5 + 10;
const int MOD = 1E9 + 7;

ll inv[MAXN];
ll fac[MAXN], facinv[MAXN];

void getInv(int n = MAXN - 1, ll m = MOD){
	inv[0] = 0, inv[1] = 1;
	fac[0] = fac[1] = 1;
	facinv[0] = facinv[1] = 1;
	for (int i = 2; i <= n; ++i){
		inv[i] = inv[m % i] * (m - m / i) % m;
		fac[i] = fac[i - 1] * i % m;
		facinv[i] = facinv[i - 1] * inv[i] % m;
	}
}

ll C(int n, int m){
	return n < m || m < 0 ? 0 : fac[n] * facinv[m] % MOD * facinv[n - m] % MOD;
}

int n;
ll X, Y;
int color[MAXN];
vector<PII> a[MAXN];

int fa[MAXN];

int find(int x){
	return fa[x] < 0 ? x : (fa[x] = find(fa[x]));
}

void merge(int u, int v){
//	printf("link %d %d\n", u, v);
	u = find(u), v = find(v);
	if (u != v)
		fa[u] += fa[v], fa[v] = u;
}

int main(){
	getInv();

	scanf("%d%lld%lld", &n, &X, &Y);
	for (int i = 1; i <= n; ++i){
		int c, w;
		scanf("%d%d", &c, &w);
		a[c].push_back(PII(w, i));
		color[i] = c;
	}

	int m = 0;
	for (int i = 0; i <= n; ++i)
		if (!a[i].empty())
			a[m++].swap(a[i]);

	for (int i = 1; i <= n; ++i)
		fa[i] = -1;

	vector<PII> val;
	for (int i = 0; i < m; ++i){
		sort(a[i].begin(), a[i].end());
		int r = lower_bound(a[i].begin(), a[i].end(), PII(X - a[i][0].st, INT_MAX)) - a[i].begin();
//		printf("%d %d %d\n", i, a[i][0].st, a[i][0].nd);
		for (int j = 1; j < r; ++j)
			merge(a[i][0].nd, a[i][j].nd);

		val.push_back(PII(a[i][0].st, i));
	}

	sort(val.begin(), val.end());
	int u = val[0].nd;
	for (int i = 0; i < m; ++i){
		if (u == i)
			continue;
		int r = lower_bound(a[i].begin(), a[i].end(), PII(Y - a[u][0].st, INT_MAX)) - a[i].begin();
		for (int j = 0; j < r; ++j)
			merge(a[u][0].nd, a[i][j].nd);
	}

	if (val.size() > 1){
		int v = val[1].nd;
		int r = lower_bound(a[u].begin(), a[u].end(), PII(Y - a[v][0].st, INT_MAX)) - a[u].begin();
		for (int j = 0; j < r; ++j)
			merge(a[v][0].nd, a[u][j].nd);
	}

	ll ans = 1;
	vector<PII> lst;
	for (int i = 1; i <= n; ++i){
		if (fa[i] < 0)
			ans = ans * fac[-fa[i]] % MOD;
		lst.push_back(PII(find(i), color[i]));
	}

	sort(lst.begin(), lst.end());
	for (int j, i = 0; i < lst.size(); i = j){
		for (j = i + 1; j < lst.size() && lst[i] == lst[j]; ++j);
		ans = ans * facinv[j - i] % MOD;
	}
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 19828
n,k = map(int,input().split())
s = list(input())

d = []
p = 0
for i in range(1,n):
    if s[i] == s[i-1]:
        p += 1
        
    else:
        d.append(p)
        p = 0
d.append(p)
res = sum(d)

n = len(d)


for i in range(k):
    if n >= 3:
        res += 2
        n -= 2
    elif n == 2:
        res += 1
        n -= 1
    else:
        break
print(res)

Measured memory_bytes: 4652
N = int(input())
S = list(input())
 
list = []
 
for i in range(len(S)):
  if len(list) == 0:
    list.append(S[i])
  else:
    if list[-1] == S[i]:
      continue
    else:
      list.append(S[i])


print(len(list))

Measured memory_bytes: 4648
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String[] s = sc.next().split("");

        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < s.length; i++) {
            builder.append(i % 2 == 0 ? 0 : 1);
        }
        String[] pattern1 = builder.toString().split("");
        builder = new StringBuilder();
        for (int i = 0; i < s.length; i++) {
            builder.append(i % 2 == 0 ? 1 : 0);
        }
        String[] pattern2 = builder.toString().split("");

        int count1 = 0;
        int count2 = 0;

        for (int i = 0; i < s.length; i++) {
            if (!s[i].equals(pattern1[i])) {
                count1++;
            }
            if (!s[i].equals(pattern2[i])) {
                count2++;
            }
        }

        System.out.println(Math.min(count1, count2));
    }
}

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

int main(){
    ll n, k; cin >> n >> k;
    vector<ll> lis(200001, 0);
    for(int i = 0; i < n; i++){
        int a, b; cin >> a >> b;
        lis[a] += b;
    }
    ll mid = 0;
    for(int i = 0; i < 200000; i++){
        mid += lis[i];
        if(mid >= k){cout << i << endl; return 0;}
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, m, n) for(ll i = m; i > n; i--)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};


int main(){
    ll n; cin >> n;
    ll ans = 0, doub = 0;
    for(ll a=1; a<=(n-1); a++){
        ans += (n-1)/a;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3608
m, n = list(map(int, input().split()))
c = [list(map(int, input().split())) for _ in range(m)]


val = 0
temp_list = []

for i in range(2**3):
    temp_list = []
    op = [-1] * 3
    for j in range(3):
        if ((i >> j) & 1):
            op[3 - 1 - j] = 1

    for k in range(m):
        temp_list.append((op[0]*c[k][0])+(op[1]*c[k][1])+(op[2]*c[k][2]))
        temp_list.sort(reverse=True)
    val = max(val, sum(temp_list[:n]))
print(val)


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

int main(){
    int n;
    cin >> n;
    int F[n][10];
    rep(i,n)rep(j,10) cin >> F[i][j];
    int P[n][11];
    rep(i,n)rep(j,11) cin >> P[i][j];

    int ans = -1e9;
    for (int i=1; i<(1<<10); i++){
        int index = 0;
        rep(j,n){
            int cnt = 0;
            rep(k,10){
                if (F[j][9-k] & (i>>k)) cnt++;
            }
            index += P[j][cnt];
            //printf("ans:%d index:%d cnt:%d\n", ans, index, cnt);
        }
        ans = max(ans, index);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>

#define int long long
#define rr register

#define MAXN 1010
#define MAXM 10010
#define inf 1e18

using namespace std;

inline int read() {
	int s = 0, f = 0;
	char ch = getchar();
	while (!isdigit(ch)) {f |= ch == '-'; ch = getchar();}
	while (isdigit(ch)) {s = s * 10 + (ch ^ 48); ch = getchar();}
	return f ? -s : s;
}

int n, k, ans;

int a[MAXN];

signed main() {
    n = read();
    k = read();
    for (rr int i = 1; i <= k; i++) {
        int x = read();
        for (rr int j = 1; j <= x; j++) {
            int y = read();
            a[y]++;
        }
    }
    for (rr int i = 1; i <= n; i++)
        if (!a[i])
            ans++;
    cout << ans << "\n";
}

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

int main() {
  int a,b;cin>>a>>b;
  if(a+b==15)cout<<"+"<<endl;
  else if(a*b==15)cout<<"*"<<endl;
  else cout<<"x"<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    int x;
    while(scanf("%d",&x)!=EOF)
    {
        int i,j;
        for(i=j=0;i<x;j++)
        {
            i=i+j;
        }
            printf("%d\n",--j);
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		String[] splitedStr;
		List<BigInteger> a = new ArrayList<BigInteger>();
		List<BigInteger> b = new ArrayList<BigInteger>();
		BigInteger gcd;

		while((str = br.readLine()) != null) {
			splitedStr = str.split(" ");
			a.add(new BigInteger(splitedStr[0]));
			b.add(new BigInteger(splitedStr[1]));
		}

		for(int i = 0; i < a.size(); i++) {
			gcd = a.get(i).gcd(b.get(i));
			System.out.print(gcd + " ");
			System.out.println(a.get(i).multiply(b.get(i)).divide(gcd));
		}
	}
}

Measured memory_bytes: 24444
object Main extends App {
  val Array(a, b, c, x) = Iterator.continually(io.StdIn.readLine.toInt)
    .take(4).toArray

  val ans = {
    for {
      i <- 0 to a
      c500 = 500*i
      if c500 <= x
      j <- 0 to b
      rem = x - c500 - 100*j
      if rem >= 0 && rem / 50 <= c
    } yield true
  }.size

  println(ans)
}

Measured memory_bytes: 27460
N=int(input())
SyoMax=0
syo=[set() for i in range(N)]
hus=[set() for i in range(N)]
for i in range(N):
  A=int(input())
  for j in range(A):
    x,y=map(int, input().split())
    if y==0:
      hus[i].add(x)
    else:
      syo[i].add(x)
syoflag=[0]*N
syomax=0
for i in range(2**N):
  I=i
  SYO=set()
  HUS=set()
  for j in range(N):
    if I%2==1:
      syoflag[j]=1
      SYO.add(j+1)
      SYO|=syo[j]
      HUS|=hus[j]
    else:
      HUS.add(j+1)
      syoflag[j]=0
    I=I//2
  if len(SYO&HUS)==0:
    syomax=max(syomax,sum(syoflag))
print(syomax)

Measured memory_bytes: 3064
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=scanner.nextInt();
        }
        printList(A,N);
        insertionSort(A,N);
    }
     
    static void insertionSort(int[] A,int N){
        for(int i=1;i<N;i++){
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        }
    }
    static void printList(int[] A,int N){
        StringBuilder builder = new StringBuilder();
        for(int i=0;i<N;i++){
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        }
        System.out.println(builder);
    }
}

Measured memory_bytes: 29308