akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937 mt32(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt32);
}
/*--------Library Zone!--------*/


signed main() {
	priority_queue<int>le;
	prique(int)ri;
	int q; cin >> q;
	int add = 0, dif = 0;
	while (q--) {
		int type; cin >> type;
		if (type == 1) {
			int a, b; cin >> a >> b;
			if (le.empty())le.push(a);
			else if (le.size() == ri.size()) {
				if (le.top() <= a && a <= ri.top()) {
					dif += le.size() * (a - le.top());
					dif -= ri.size() * (a - le.top());
					le.push(a);
				}
				else if (a < le.top()) {
					dif += le.top() - a;
					le.push(a);
				}
				else {
					dif += a - le.top();
					ri.push(a);
					int c = ri.top();
					dif -= ri.size() * (c - le.top());
					dif += le.size() * (c - le.top());
					le.push(c); ri.pop();
				}
			}
			else {
				if (le.top() <= a) {
					ri.push(a);
					dif += a - le.top();
				}
				else {
					int c = le.top(); le.pop();
					ri.push(c);
					if (le.empty()) {
						le.push(a);
						dif += c - a;
					}
					else {
						if (le.top() < a) {
							dif -= le.size() * (c - a);
							dif += ri.size() * (c - a);
						}
						else {
							dif -= le.size() * (c - le.top());
							dif += le.top() - a;
							dif += ri.size() * (c - le.top());
						}
						le.push(a);
					}
				}
			}
			add += b;
		}
		else {
			cout << le.top() << " " << dif + add << endl;
		}
	}
}


Measured memory_bytes: 3828
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()

mt19937 ran;

int D;
int c[26];
int s[365][26];

int ans[365];


void greedy(int min, int max) {
	int last[26] = {};
	rep(i, 26)last[i] = -1;

	rep(i, D) {
		int ma = -INF;
		int con = -1;

		int pena[26];
		rep(j, 26) {
			pena[j] = c[j] * (i - last[j]);
		}

		rep(j,26) {
			//int score = s[i][j] + pena[j];
			//int score = s[i][j] + 5 * pena[j];
			int score = s[i][j] + pena[j] * (min + ran() % (max - min));
			if (ma < score) {
				ma = score;
				con = j;
			}
		}
		assert(con != -1);

		last[con] = i;
		ans[i] = con;
	}
}


int calc() {
	int last[26] = {};
	rep(i, 26)last[i] = -1;
	int score = 0;
	rep(i, D) {
		score += s[i][ans[i]];
		last[ans[i]] = i;
		rep(j, 26) {
			score -= c[j] * (i - last[j]);
		}
	}
	return score;
}

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

#if defined(_MSC_VER)
	D = 365;
	mt19937 mt;
	rep(i, 26)c[i] = mt() % 100;
	rep(i, 365)rep(j, 26) s[i][j] = mt() % 20000;
#else
	cin >> D;
	rep(i, 26)cin >> c[i];
	rep(i, 365)rep(j, 26)cin >> s[i][j];
#endif // #if defined(_MSC_VER)




	int ma = -INF;
	vector<int> best;

	rep(i, 10000) {
		greedy(4, 7);
		int sc = calc();
		if (ma < sc) {
			ma = sc;
			best = vector<int>(ans, ans + D);
		}
	}

	rep(i, D) {
		cout << best[i] + 1 << endl;
	}
	cerr << ma << endl;


	return 0;
}


Measured memory_bytes: 3684
n = gets.to_i
nums = Array.new(n)
nums = gets.split(" ").map(&:to_i)
is_even_only = true
divide_cnt = 0
while is_even_only do
  nums.map! do |num|
    is_even_only = false if num % 2 != 0
    num / 2
  end
  divide_cnt += 1 if is_even_only
end
puts divide_cnt

Measured memory_bytes: 1788
#include <iostream>
#include <cmath>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)

int main(){
  int n, d;
  cin >> n >> d;
  int a[n][d];
  REP(i, n) REP(j, d){
    cin >> a[i][j];
  }
  int r = 0;
  REP(i, n) REP(j, i){
    int s = 0;
    REP(k, d){
      s += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
    }
    int p = static_cast<int>(sqrt(s));
    if(p * p == s){
      r += 1;
    }
  }
  cout << r << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <cctype>
#define rgi register int
#define rgl register long long
#define il inline
#define ll long long

using namespace std;

const int N = 1e6 + 10;
const int M = 1e6 + 10;

int n, m, last = 1;
int a[N], vis[N], c[N], out[M];

struct node
{
	int l, r, id;
} ask[M];

il int read()
{
	rgi x = 0, f = 0, ch;
	while(!isdigit(ch = getchar())) f |= ch == '-';
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

bool cmp(struct node a, struct node b)
{
	return a.r < b.r;
}

void Add(int x, int val)
{
	for(; x < N; x += x & -x)
		c[x] += val;
}

int Query(int x)
{
	int res = 0;
	for(; x; x -= x & -x)
		res += c[x];
	return res;
}

int main()
{
	n = read(), m = read();
	for(rgi i = 1; i <= n; ++i)
		a[i] = read();
	for(rgi i = 1; i <= m; ++i)
	{
		ask[i].l = read();
		ask[i].r = read();
		ask[i].id = i;
	}
	sort(ask + 1, ask + m + 1, cmp);
	for(rgi i = 1; i <= m; ++i)
	{
		for(rgi j = last; j <= ask[i].r; ++j)
		{
			if(vis[a[j]])
				Add(vis[a[j]], -1);
			Add(j, 1);
			vis[a[j]] = j;
		}
		last = ask[i].r + 1;
		out[ask[i].id] = Query(ask[i].r) - Query(ask[i].l - 1);
	}
	for(rgi i = 1; i <= m; ++i)
		printf("%d\n", out[i]);
	return 0;
}


Measured memory_bytes: 17260
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
int main()
{
	SPEED
	string s;
	cin >> s;
	bool flag = false;
	bool flag2 = false;
	for (int i = 0; i < s.size(); i+=2)
	{
		if (s[i]=='L')
		{
			flag=true;
			break;
		}
	}
	for (int i = 1; i < s.size(); i+=2)
	{
		if (s[i]=='R')
		{
			flag2=true;
			break;
		}
	}
	if (flag || flag2)
	{
		cout << "No";
	}
	else
	{
		cout << "Yes";
	}
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
   
//#include <x86intrin.h>
#include <bits/stdc++.h>   
 
using namespace std;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, m, x[N], y[N], mx = -1, p[N], is[N];
vector <int> order, ans, g[N];
bool used[N];
int was[N];

void dfs (int v) {
   used[v] = 1;
   for (auto to : g[v])
      if (!used[to])
         dfs (to);
   order.pb (v);
}

void calc (int v, int pr) {
   was[v] = 1;
   p[v] = pr;
   for (auto to : g[v]) {
      if (!was[to]) calc (to, v);
      else if (was[to] == 1) {
         int x = v;
         ans.clear ();
         while (x != to) {
            is[x] = 1;
            ans.pb (x);
            x = p[x];
         }
         ans.pb (to);
         reverse (all (ans));
         is[to] = 1;
         bool ok = 1;
         for (auto it : ans) {
            int cur = 0;
            for (auto to : g[it])
               if (is[to])
                  cur ++;
            if (cur > 1) ok = 0;
         }
         if (ok) {
            cout << sz (ans) << endl;
            for (auto it : ans) cout << it << endl;
            exit (0);
         }
         for (auto it : ans) is[it] = 0;
      }
   }
   was[v] = 2;
}

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n >> m;
   for (int i = 1; i <= m; i ++) {
      cin >> x[i] >> y[i];
      g[x[i]].pb (y[i]);
   }
   for (int i = 1; i <= n; i ++)
      if (!used[i])
         dfs (i);
   reverse (all (order));
   for (auto v : order) {
      if (!was[v])
         calc (v, 0);
   }
   cout << -1;
}

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                          

Measured memory_bytes: 11264
using System;

namespace Testcode
{
    class Program
    {
        
        static void Main(string[] args)
        {         
         
                string[] d = Console.ReadLine().Split();
                var a = double.Parse(d[0]);
                double pi = Math.PI;

            Console.WriteLine((pi * a * a) + " " + (2 * pi * a));

            
        }
       
    }
}


Measured memory_bytes: 15912
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define ll long long 
#define pb push_back
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
constexpr long long  MOD=1000000007;
ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll lcm(ll x, ll y) {ll res = (x * y) / __gcd(x, y); return res;}
ll power(ll x, ll y) {if (y < 0) return 1; ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}

void iofoj(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
// bool visi[300004];
// vector<ll>v[300004];
// ll a[300004],b[300004],c[300004],d[300004];



void solution()
{
    ll q,n,m,i,j,k;
    ll l,r,d;
    cin>>l>>r>>d;
    ll ans=0;
    for(i=l;i<=r;i++)
    if(i%d==0)ans++;
    cout<<ans;
}

int main(){
    fio
    //iofoj();
    // ll t;
    // cin>>t;
    // while(t--)
    solution();
    return 0; 
}

Measured memory_bytes: 3648
a,b,c,d,e,f = [int(n) for n in input().split(" ")]
dp = [-1 for n in range(f + 1)]
dp[0] = 0
for i in range(1530):
    next_dp = dp[:]
    for i,sugar in enumerate(dp):
        if sugar >= 0:
            if i + 100 * a <= f:
                next_dp[i + 100 * a] = sugar
            if i + 100 * b <= f:
                next_dp[i + 100 * b] = sugar
            if i + c <= f and ((i - sugar) * e) / 100 >= sugar + c:
                next_dp[i + c] = max(dp[i + c], sugar + c)
            if i + d <= f and ((i - sugar) * e) / 100 >= sugar + d:
                next_dp[i + d] = max(dp[i + d], sugar + d)
    dp = next_dp
answer = [0,0]
for i,d in enumerate(dp):
    if i != 0 and answer[1] <= d / i:
        answer = [i,d / i]
print(answer[0],round(answer[0] * answer[1] ))

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

//typedefs
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef map<int, int> mii;
typedef priority_queue<pii, vpii, greater<pii> > pq;
typedef tuple<int, int, int> tp;

//Constants
const int INF = (int)2 * 1e9;
const ll MOD = 1000000007;
const long double PI = 3.1415926;
const long double EPS = 1e-6;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define what(x) cerr << #x << " => " << x << endl;
#define print_r(x) for(auto i = 0; i < x.size(); i++) what(x[i]);
#define print_grid(x) for(auto i = 0; i < x.size(); i++){for(auto j = 0; j < x[0].size(); j++){cout << x[i][j];}cout << endl;}
#define gridM(type, n, m) vector<vector<type>> grid(n, vector<type>(m))

template <typename T>vector<T> prefix_sum(vector<T> nums){vector<T> pre_sum(nums.size());partial_sum(nums.begin(), nums.end(), pre_sum.begin());return pre_sum;}
vector<string> split(string s, char sep){int prev_index = 0;int i = 0;vector<string> words;for(i = 0; i < s.size(); i++){if(s[i] == sep){words.push_back(s.substr(prev_index, i - prev_index));prev_index = i + 1;}}words.push_back(s.substr(prev_index, (s.size() - prev_index )));return words;}

void read(){
  //stime = clock();
  #ifdef DEBUG
    freopen("in.txt", "r", stdin);
   #endif // DEBUG
   cin.sync_with_stdio(false);
   cin.tie(0);
}


int main(){
 read();
 ull x; cin >> x;
 ull p = 100;
 for(int i = 1; true; i++){
  p += (0.01 * p);
  if(p >= x){
    cout <<  i;
    return 0;
  }
 }
 return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long mod_pow(long long x, long long y){
    if(y == 0) return 1;
    long long res = 1;
    while(y != 0){
        if(y & 1) res = res*x%MOD;
        x = x * x % MOD;
        y >>= 1;
    }
    return res;
}
int main(){
    long long N, K;
    cin >> N >> K;
    long long ans = 0;
    vector<long long> cnt(K + 1, 0);
    for(long long i = K; i >= 1; i--){
        long long cnttemp = mod_pow(K / i, N);
        long long t = i + i;
        while(t <= K){
            cnttemp = (cnttemp - cnt[t] + MOD) % MOD;
            t += i;
        }
        ans = (ans + cnttemp * i % MOD) % MOD;
        cnt[i] = cnttemp;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4004
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<s.size();++i)
        if(s[i]=='+')
            ans++;
        else
            ans--;
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for(int i=0; i<N; i++){
    cin >> H[i];
  }
  sort(H.begin(), H.end());
  long ans=0;
  for(int i=0; i<N-K; i++){
    ans+=H[i];
  }
  cout << ans << endl;
  return 0;
}

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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int N; cin >> N;
    vector<int> A(N), B(N), C(N);
    REP(i,N) cin >> A[i];
    REP(i,N) cin >> B[i];
    REP(i,N) cin >> C[i];

    sort(ALL(A));
    sort(ALL(B));
    sort(ALL(C));

    ll ans = 0;
    REP(i,N){
        ans += (lower_bound(ALL(A), B[i])-A.begin()) * (C.end()-upper_bound(ALL(C),B[i]));
    }

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

Measured memory_bytes: 4568
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<complex>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
typedef long double ld;
int X,Y,n,a[500010];
ld fac[500010],ans;
ld C(int x,int y){
	return fac[x]-fac[y]-fac[x-y];
}
int main(){
	cin>>n;
	FOR(i,1,n) getint(a[i]);
	sort(a+1,a+n+1);
	int l=1,r=n;
	while (l<r && a[l+1]<=a[r]/2.0) ++l;
	if (l+1<r && fabs(a[r]/2.0-a[l])>fabs(a[r]/2.0-a[l+1])) ++l;
	cout<<a[r]<<' '<<a[l]<<endl;
	return 0;
}

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

typedef long long ll;

ll DP[200001][5];

int main() {
	int L; cin >> L;
	vector<ll>A(L);
	for (int i = 0; i < L; i++)cin >> A[i];

	for (int i = 0; i <= L; i++)
	{
		for (int j = 0; j < 5; j++)
		{
			DP[i][j] = 1e18;
		}
	}

	DP[0][0] = 0;
	for (int i = 0; i < L; i++)
	{
		for (int j = 0; j < 5; j++)
		{
			if (DP[i][j] == 1e18)continue;

			if (j == 0)
			{
				DP[i + 1][0] = min(DP[i + 1][0], DP[i][j] + A[i]);
				DP[i + 1][1] = min(DP[i + 1][1], DP[i][j] + A[i] % 2 + 2 * (A[i] == 0));
				DP[i + 1][2] = min(DP[i + 1][2], DP[i][j] + (A[i] + 1) % 2);
				DP[i + 1][3] = min(DP[i + 1][3], DP[i][j] + A[i] % 2 + 2 * (A[i] == 0));
				DP[i + 1][4] = min(DP[i + 1][4], DP[i][j] + A[i]);
			}
			else if (j == 1)
			{
				DP[i + 1][1] = min(DP[i + 1][1], DP[i][j] + A[i] % 2 + 2 * (A[i] == 0));
				DP[i + 1][2] = min(DP[i + 1][2], DP[i][j] + (A[i] + 1) % 2);
				DP[i + 1][3] = min(DP[i + 1][3], DP[i][j] + A[i] % 2 + 2 * (A[i] == 0));
				DP[i + 1][4] = min(DP[i + 1][4], DP[i][j] + A[i]);
			}
			else if (j == 2)
			{
				DP[i + 1][2] = min(DP[i + 1][2], DP[i][j] + (A[i] + 1) % 2);
				DP[i + 1][3] = min(DP[i + 1][3], DP[i][j] + A[i] % 2 + 2 * (A[i] == 0));
				DP[i + 1][4] = min(DP[i + 1][4], DP[i][j] + A[i]);
			}
			else if (j == 3)
			{
				DP[i + 1][3] = min(DP[i + 1][3], DP[i][j] + A[i] % 2 + 2 * (A[i] == 0));
				DP[i + 1][4] = min(DP[i + 1][4], DP[i][j] + A[i]);
			}
			else if (j == 4)
			{
				DP[i + 1][4] = min(DP[i + 1][4], DP[i][j] + A[i]);
			}
		}
	}

	ll ans = 1e18;
	for (int j = 0; j < 5; j++)
	{
		ans = min(ans, DP[L][j]);
	}

	cout<<ans<<endl;

	return 0;
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N,M,C;
    Scd3(N,M,C);
  
    int b[1000];
    int a;
  int ans = 0;
    Rep(i,M)
    Scd(b[i]);
    Rep(ii,N){
      int t = C;
      Rep(i,M){
        Scd(a);
        t += a*b[i];
      }
      ans+=(t>0);
    }
      
  
    

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


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n, m; cin >> n >> m;
    VI liked(m);
    FOR(i, 0, n) {
        int k; cin >> k;
        FOR(j, 0, k) {
            int a; cin >> a;
            --a;
            ++liked[a];
        }
    }

    int ans = 0;
    FOR(i, 0, m)if (liked[i] == n)++ans;
    cout << ans << "\n";
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Set<Integer> set = new HashSet<>();
		set.add(sc.nextInt());
		set.add(sc.nextInt());
		set.add(sc.nextInt());
		sc.close();
		System.out.println(set.size());
	}
}

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

	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		HashMap<Integer,Integer>A=new HashMap<Integer,Integer>();
		int N=stdIn.nextInt();
		int a[]=new int[N];
		int z=0,y=0,x=0,v=0,ans=0;
		while(z<N){
			y=stdIn.nextInt();
			if(A.containsKey(y))
				x=A.get(y);
			else{
				a[v]=y;
				v++;
			}
			A.put(y,x+1);
			x=0;
			z++;
		}z=0;
		while(z<v){
			if(A.containsKey(a[z])){
				x=A.get(a[z]);
				if(x!=0&&x!=a[z])
					if(x>a[z])
						ans+=x-a[z];
					else
						ans+=x;
			}
			z++;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 64864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
typedef map<int, int> MI;
typedef set<int> SI;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COUT(x) cout << (x) << endl

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


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

    int n; cin >> n;
    vector<int> a(n);
    deque<int> ans;
    rep(i, n) cin >> a[i];
    rep(i, n) {
        if(n % 2 == 0){
            if(i % 2 == 0) ans.push_back(a[i]);
            else ans.push_front(a[i]);
        } else {
            if(i % 2 == 1) ans.push_back(a[i]);
            else ans.push_front(a[i]);
        }
    }
    rep(i, n) {
        if(i) cout << " ";
        cout << ans.front();
        ans.pop_front();
    }
    cout << endl;
}

Measured memory_bytes: 3840
#include <stdio.h>
#include <limits.h>
#include <math.h>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
typedef double D;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
//typedef pair<int, int> P;

/** Problem0545 : Party **/
int main()
{
	int N;
	while (cin>>N, N) {
		bool frnd[N][N];
		fill(frnd[0], frnd[0]+N*N, false);
		int M; cin>>M;
		rep(i, M) {
			int x, y;
			cin>>x>>y;
			frnd[x-1][y-1] = frnd[y-1][x-1] = true;
		}
		
		set<int> ans;
		
		REP(i, 1, N) {
			if (frnd[0][i]) {
				ans.insert(i);
				REP(j, 1, N) {
					if (i!=j && frnd[i][j]) {
						ans.insert(j);
					}
				}
			}
		}
		
		cout << ans.size() << endl;
	}
}

Measured memory_bytes: 1452
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = iN + (int)Math.Pow(iN, 2) + (int)Math.Pow(iN, 3);

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 27684
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;

typedef long long LL;

const int N = 2000010;

int n;

void get_min(char a[N])
{
    static char b[N];
    
    for(int i = 0; i < n; i ++)  b[i] = b[i + n] = a[i];
    
    int i = 0, j = 1, k = 0;
    while(i < n and j < n)
    {
        for(k = 0; k < n and a[i + k] == a[j + k]; k ++);
        if(k == n)  break;
        
        if(a[i + k] < a[j + k])
        {
            i += k + 1;
            if(i == j)  i ++;
        }
        else
        {
            j += k + 1;
            if(i == j)  j ++;
        }
    }
    k = min(i, j);
    
    for(int i = 0; i < n; i ++)  a[i] = b[k + i];
    a[i + n] = 0;
}

char a[N], b[N];

int main()
{
    scanf("%s%s", a, b);
    n = strlen(a);
    get_min(a), get_min(b);
    if(!strcmp(a, b))  puts("Yes");
    else  puts("No");
    return 0;
}


Measured memory_bytes: 2304
//    package com.company;

    import java.io.*;
    import java.util.*;

    public class Main {

        public static void main(String[] args) throws IOException{
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            Program solver = new Program();
            solver.solve(in, out);
            out.close();
        }

        static class Program{

            static void solve(InputReader in, PrintWriter out) throws IOException{
               int n = in.nextInt();
               long s = 0;
               for(int i = 0;i < n;i ++){
                   int l = in.nextInt();
                   int r = in.nextInt();
                   s += (r - l + 1);
               }
               out.print(s);
            }

        }

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

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

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

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

            public String nextLine(){
                try {
                    return reader.readLine();
                }catch(IOException e){
                    return null;
                }
            }

        }
    }


Measured memory_bytes: 23252
n,m = map(int,input().split())
mask = [0]*m
ans = 0
#maskbitとして使う
for i in range(m):
  for j in [int(w) for w in input().split()][1:]:
    mask[i] += (1 << j-1)
p = [1 ^ int(i) for i in input().split()]
#maskbitと論理積を取ってからpとxorで判定
for i in range(1 << n):
  cnt = 0
  for j in range(m):
    temp = i & mask[j]
    flag = p[j]
    for k in range(n):
      flag ^= (temp >> k) & 1
    if flag:
      cnt += 1
  if cnt == m:
    ans += 1
print(ans)

Measured memory_bytes: 3064
import itertools

n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
L = list(itertools.permutations(list(range(1,n+1))))
p_a = 1
p_b = 1

for i,l in enumerate(L):
    if p == list(l):
        p_a = i+1
    if q == list(l):
        p_b = i+1

print(abs(p_a-p_b))

Measured memory_bytes: 13844
data=map(int,raw_input().split())
l=raw_input()
rank=0
ran=0
for i in range(len(l)):
    if(l[i]=="a" and ran<data[1]+data[2]):
        print "Yes"
        ran+=1
    elif(l[i]=="b" and ran<data[1]+data[2] and rank<data[2]):
        print "Yes"
        rank+=1
        ran+=1
    else:
        print "No"


Measured memory_bytes: 6276
while True:
    l = input().split()
    a = int(l[0])
    b = int(l[2])
    op = l[1]
    if op == '?':
        break
    if op == '+':
        ans = a + b
        print(ans)
    elif op == '-':
        ans = a - b
        print(ans)
    elif op == '*':
        ans = a * b
        print(ans)
    elif op == '/':
        ans = a // b
        print(ans)

Measured memory_bytes: 7624
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int h = scanner.nextInt();
        final int w = scanner.nextInt();
        final boolean[][] table = new boolean[h][w];

        for (int i = 0; i < h; i++) {
            final char[] line = scanner.next().toCharArray();
            int j = 0;
            for (final char c : line) {
                if (c == '#') {
                    table[i][j] = true;
                }
                j++;
            }
        }

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (!table[i][j] || check(table, j, i)) {
                    continue;
                }
                
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }

    private static boolean check(final boolean[][] table, final int x, final int y) {
        final int h = table.length;
        final int w = table[0].length;
        return check(h, w, table, x, y - 1)
                || check(h, w, table, x, y + 1)
                || check(h, w, table, x + 1, y)
                || check(h, w, table, x - 1, y);
    }

    private static boolean check(final int h, final int w, final boolean[][] table, final int x, final int y) {
        if (x < 0 || x >= w) {
            return false;
        }

        if (y < 0 || y >= h) {
            return false;
        }

        return table[y][x];
    }
}


Measured memory_bytes: 21844
H, N = map(int, input().split())
M = [tuple(map(int, input().split())) for i in range(N)]

dp = [(j + M[0][0] - 1) // M[0][0] * M[0][1] for j in range(H + 1)]
for i in range(1, N):
    Ai, Bi = M[i]
    ndp = [0] * (H + 1)
    if Ai >= H:
        ndp[0:H + 1] = [min(dp[j], Bi) for j in range(H + 1)]
    else:
        ndp[0:Ai + 1] = [min(dp[j], Bi) for j in range(Ai + 1)]
        for j in range(Ai + 1, H + 1):
            ndp[j] = min(dp[j], ndp[j - Ai] + Bi)
    dp = ndp
print(dp[H])


Measured memory_bytes: 47540
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <deque>
#include <bitset>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i) = 0; (i) <= (n); (i)++)
using namespace std;

int N, K;
int A[100001];

signed main()
{
	cin >> N >> K;
	REP(i, N) cin >> A[i];

	for (int i = 0; i < N; i++)
	{
		if ((((i + 1) * K) - i) >= N)
		{
			cout << (i + 1) << endl;
			return 0;
		}
	}
}


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

const int maxn=1005;

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	bool flag=0;
	if(s[0]==s[1]&&s[1]==s[2]) flag=1;
	if(s[1]==s[2]&&s[2]==s[3]) flag=1;
	if(flag) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;

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

int main(){
    int n;
    while(cin >> n,n!=0){
        vector<int> count(26);
        int M=0,m=0;
        char winner;
        bool can=true;
        rep(i,n){
            char a;
            cin >> a;
            count[a-'A']++;
            int b=M;
            if (chmax(M,count[a-'A'])){
                if (winner!=a){
                  m=b;
                  winner=a;
                }
            }
            else {
                chmax(m,count[a-'A']);
            }
            if (M-m>n-i-1&&can){
                cout << winner << ' ' << i+1 << endl;
                can=false;
            }
        }
        if (can){
            cout << "TIE" << endl;
        }
    }
}


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

using namespace std;

typedef long long int ll;
typedef unsigned long long ull;

int main()
{
    ll X, K;
    cin >> K >> X;
    if(K * 500 >= X) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
    
}

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

typedef struct stack{
	int *a;
	int top;
}stack;

int main(){
	int n,q,i,x,y;
	int com;
	stack S[N];
	
	scanf("%d %d",&n,&q);
	
	for(i=0;i<n;i++){
		S[i].top=0;
		S[i].a=malloc(sizeof(int)*q);
	}
	
	for(i=0;i<q;i++){
		scanf("%d",&com);
		
		if(com==0){
			scanf("%d %d",&x,&y);
			S[x].a[(S[x].top)++]=y;
		}
		
		else if(com==1){
			scanf("%d",&x);
			if(S[x].top!=0)printf("%d\n",S[x].a[S[x].top-1]);
		}
		
		else if(com==2){
			scanf("%d",&x);
			if(S[x].top!=0)S[x].top--;
		}
	}
	
	return 0;
	
}


Measured memory_bytes: 6576
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int n;
int v[1<<18|1],w[1<<18|1];
typedef struct pair{ll v,w;}P;
P a[513][513];

#define N 512
int cmp(const void*p,const void*q){
	if((*(P*)p).w<(*(P*)q).w)return -1;
	if((*(P*)p).w>(*(P*)q).w)return 1;
	if((*(P*)p).v<(*(P*)q).v)return -1;
	if((*(P*)p).v>(*(P*)q).v)return 1;
	return 0;
}

int main(){
	scanf("%d",&n);
	rep(i,1,n+1)scanf("%d%d",v+i,w+i);
	rep(i,1,N){
		a[i][0].v=0;
		a[i][0].w=0;
		int cnt=1;
		int idx=i;
		rep(k,0,9){
			rep(j,0,cnt){
				a[i][cnt+j].v=a[i][j].v+v[idx];
				a[i][cnt+j].w=a[i][j].w+w[idx];
			}
			idx/=2;
			cnt*=2;
		}
		qsort(a[i],N,sizeof(P),cmp);
		rep(j,1,N)a[i][j].v=max(a[i][j].v,a[i][j-1].v);
	}
	//rep(x,0,512)printf("%d %d\n",a[9][x].v,a[9][x].w);
	
	int q;
	scanf("%d",&q);
	while(q--){
		int vvvv,L;
		scanf("%d%d",&vvvv,&L);
		if(vvvv<N){
			int l=0,r=N;
			while(r-l>1){
				int m=(l+r)/2;
				if(a[vvvv][m].w<=L)l=m;
				else r=m;
			}
			printf("%lld\n",a[vvvv][l].v);
		}else{
			P hoge[N];
			hoge[0].v=0;
			hoge[0].w=0;
			int cnt=1;
			int idx=vvvv;
			while(idx>=N){
				rep(j,0,cnt){
					hoge[cnt+j].v=hoge[j].v+v[idx];
					hoge[cnt+j].w=hoge[j].w+w[idx];
				}
				idx/=2;
				cnt*=2;			
			}
			//rep(x,0,cnt)printf("%lld %lld\n",hoge[x].v,hoge[x].w);
			//hogeとa[idx]をマージ
			//にぶたん
			ll ans=0;
			rep(i,0,cnt)if(hoge[i].w<=L){
				int l=0,r=N;
				int LL=L-hoge[i].w;
				while(r-l>1){
					int m=(l+r)/2;
					if(a[idx][m].w<=LL)l=m;
					else r=m;
				}
				ans=max(ans,hoge[i].v+a[idx][l].v);
			}
			printf("%lld\n",ans);
		}
		
	}
	
}

Measured memory_bytes: 7908
#include<cstdio>

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

//i%mod = [0,k]
int getNumber(int l,int r,int mod,int k){
    if(k<0) return 0;
    int res = 0;
    int cur = l%mod;
    if(cur<=k){ 
        int upGrade = min(l+k-cur,r);
        res += upGrade-l+1;
    }
    l = l-cur+mod;
    if(l>r) return res;
    res += (r-l+1)/mod*(k+1);
    l += (r-l+1)/mod*mod;
    if(l>r) return res;
    int upGrade = min(l+k,r);
    res += upGrade-l+1;
    return res;
}

int bfSolve(int n,int k){
    int ans = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++) if((i%j)>=k) ans++;
    }
    return ans;
}

int main(){
    /*int x = -1, y = -1;
    for(int n = 3; n <= 3; n++){
        for(int k = 1; k <= 1; k++){
            long long ans = 0;
            for(int i = k+1; i <= n; i++){
                int add = n-getNumber(1,n,i,k-1);
                printf("i = %d: %d\n",i,add);
                ans += (long long)add;
            }
            int bfRes = bfSolve(n,k);
            printf("%d %lld\n",bfRes,ans);
        }
    }
    printf("x = %d, y = %d\n",x,y);
    printf("%d\n",getNumber(1,3,2,0));*/
    int n,k;
    scanf("%d%d",&n,&k);
    long long ans = 0;
    for(int i = k+1; i <= n; i++){
        int add = n-getNumber(1,n,i,k-1);
        ans += (long long)add;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1732
n = int(input())
l = len(str(n))

if l == 1:
    print(n)
    exit()
ans = 9
if l % 2 == 1:
    ans += n + 1 - 10 ** (l - 1)

for i in range(3,l):
    if i % 2 == 1:
       ans += 10 ** i - 10 ** (i - 1)
print(ans)


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

using namespace std;

typedef long long LL;

#define fin "\n"


#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

template <typename T>
inline void chmin(T &l,T r){l=min(l,r);}

template <typename T>
inline void chmax(T &l,T r){l=max(l,r);}

template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
typedef vector<int> V;
typedef vector<V> VV;

int main(){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    int Y=ty-sy;
    int X=tx-sx;
    cout<<'U';REP(i,Y-1)cout<<'U';REP(i,X-1)cout<<'R';cout<<'R';
    cout<<'U';REP(i,X+1)cout<<'L';REP(i,Y+1)cout<<'D';cout<<'R';
    cout<<'D';REP(i,X+1)cout<<'R';REP(i,Y+1)cout<<'U';cout<<'L';
    cout<<'D';REP(i,Y-1)cout<<'D';REP(i,X)cout<<'L';;
    cout<<endl;
   
    return 0;
}


Measured memory_bytes: 256
n = int(input())
H = [int(h) for h in input().split()]
ans = 1
isView = False
for i in range(1,n):
    tmp = H[i]
    for j in H[:i]:
        if j > tmp:
            isView = False
            break
        else:
            isView = True
    if isView:
        ans += 1
print(ans)


Measured memory_bytes: 2940
def main():  
    x,y = map(int,input().split())
    ans = 0
    if x <= 3:
        ans += 100000*(4-x)
    if y <= 3:
        ans += 100000*(4-y)
    if x == 1 and y == 1:
        ans += 400000
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
  int N;
  cin >> N;
  int a, b, c;
  for(int i = N; i <= 999; i++){
    a = i / 100;
    c = (i % 10);
    b = (i % 100)-c;
    b /= 10;

    if(a == b && b == c){
      cout << a << b << c << endl;
      return 0;
    }
  }
  return 0;

}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using std::min; using std::max;
using std::swap; using std::sort;
typedef long long ll;

template<typename T>
void read(T &x) {
	int flag = 1; x = 0; char ch = getchar();
	while(ch < '0' || ch > '9') { if(ch == '-') flag = -flag; ch = getchar(); }
	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= flag;
}

const int _ = 42, __ = 1.5e5 + 10, P = 1e9 + 7;
int n, x, y, z, f[_][__], lim, Q;

int main () {
	read(n), read(x), read(y), read(z);
	lim = (1 << (x + y + z)) - 1;
	Q = 1 << (z - 1) | 1 << (y + z - 1) | 1 << (x + y + z - 1);
	f[0][0] = 1; int ret = 1;
	for(int i = 0; i < n; ++i) {
		ret = 1ll * ret * 10 % P;
		for(int s = 0; s <= lim; ++s)
			for(int j = 1; j <= 10; ++j) {
				int t = (s << j | (1 << (j - 1))) & lim;
				if(!f[i][s] || (t & Q) == Q) continue;
				(f[i + 1][t] += f[i][s]) %= P;
			}
	}
	for(int s = 0; s <= lim; ++s) (ret += P - f[n][s]) %= P;
	printf("%d\n", ret);
	return 0;
} 


Measured memory_bytes: 22912
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <stdio.h>
#include <cmath>

using namespace std;



int main(){
  int k, s;
  cin >> k >> s;
  int z;
  int ans=0;
  for(z=0; z<k+1; z++){
    if(s-z <= 2*k && z <= s){
      if(s-z < k) ans += s-z+1;
      else ans += 2*k - s +z +1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  
  int N, M, ans;
  cin >> N >> M;
  
  if (N >= M)
    cout << 0 << endl;
  else{
  
  	vector<int> X(M);
  	for (int i = 0 ; i < X.size() ; i++)
    	cin >> X.at(i);
  
  	sort(X.begin(),X.end());
    
  	vector<int> difX (M - 1); 
  
  
  	for (int i = 0; i < M - 1 ; i++)
    	difX.at(i) = X.at(i + 1) - X.at(i);
  
  	sort (difX.begin(),difX.end());
  
  	for (int i = 0; i < M - N ; i++)
      ans += difX.at(i);
      
    cout << ans << endl;
  }
}

Measured memory_bytes: 1024
a,b,c = map(int,input().split())
if a == b == c and a%2 == 0:
    print(-1)
elif a%2 or b%2 or c%2:
    print(0)
else:
    ans = 0
    while a%2 != 1 and b%2 !=1 and c%2 !=1:
        aa = a
        bb = b
        cc = c
        a = bb//2+cc//2
        b = aa//2+cc//2
        c = bb//2+aa//2
        ans += 1
    print(ans)

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

const int size = 3;

bool check ( char hyo[size][size], char mark )
{
  for (int y = 0; y < size; ++y)
    for (int x = 0; x < size; ++x)
    {
       if (x+2 < size && hyo[y][x] == mark && hyo[y][x+1] == mark && hyo[y][x+2] == mark) { return true; }
       if (y+2 < size && hyo[y][x] == mark && hyo[y+1][x] == mark && hyo[y+2][x] == mark) { return true; }
       if (x+2 < size && y+2 < size && hyo[y][x] == mark && hyo[y+1][x+1] == mark && hyo[y+2][x+2] == mark) { return true; }
       if (x-2 >= 0 && y+2 < size && hyo[y][x] == mark && hyo[y+1][x-1] == mark && hyo[y+2][x-2] == mark) { return true; }
    }
    return false;
}

int main ( void )
{
  string str;
  while (cin >> str)
  {
     char hyo[size][size];

     for (int y = 0; y < size; ++y)
       for (int x = 0; x < size; ++x)
         hyo[y][x] = str[y*size + x];

     char judge = 'd';
     char mark[] = { 'o', 'x' };

     for (int i = 0; i < 2; ++i)
     {
        if (check(hyo, mark[i])) { judge = mark[i]; }
     }

     cout << judge << endl;
  }
  return 0;
}

Measured memory_bytes: 1172
package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var w, h, x, y float64
	fmt.Fscan(read, &w, &h, &x, &y)
	ans := 0
	if w == x*2 && h == y*2 {
		ans = 1
	}
	fmt.Fprintln(write, w*h/2, ans)
}


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

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)

typedef long long ll;
typedef pair<int, int> P;

int main(int argc, char const *argv[]){
  ll r0,w0,c,r;
  while(cin>>r0>>w0>>c>>r, r0) {
    ll x=0;
    while(1){
      if(r0+x*r-c*w0>=0){
        cout<<x<<endl;
        break;
      }
      x++;
    }
  }
  return 0;
}

Measured memory_bytes: 3076