akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

ll X, Y, Z;
ll A[100010];
ll B[100010];
ll C[100010];
typedef tuple<ll, ll, ll> unit;

ll silver[100010];
ll gold[100010];

int main () {
  cin >> X >> Y >> Z;
  ll N = X+Y+Z;
  for (auto i = 0; i < N; ++i) {
    cin >> A[i] >> B[i] >> C[i];
  }
  ll ans = 0;
  for (auto i = 0; i < N; ++i) {
    A[i] -= C[i];
    B[i] -= C[i];
    ans += C[i];
  }
  unit T[100010];
  for (auto i = 0; i < N; ++i) {
    T[i] = unit(A[i]-B[i], A[i], B[i]);
  }
  sort(T, T+N);
  for (auto i = 0; i < N; ++i) {
    A[i] = get<1>(T[i]);
    B[i] = get<2>(T[i]);
    // cerr << "i = " << i << ", (" << A[i] << ", " << B[i] << ")" << endl;
  }
  ll sum = 0;
  priority_queue<ll, vector<ll>, greater<ll> > Q;
  for (auto i = 0; i < N; ++i) {
    sum += B[i];
    Q.push(B[i]);
    while ((ll)Q.size() > Y) {
      sum -= Q.top();
      Q.pop();
    }
    silver[i] = sum;
    // cerr << "silver[" << i << "] = " << silver[i] << endl;
  }
  sum = 0;
  priority_queue<ll, vector<ll>, greater<ll> > QQ;
  for (auto i = N-1; i >= 0; --i) {
    sum += A[i];
    QQ.push(A[i]);
    while ((ll)QQ.size() > X) {
      sum -= QQ.top();
      QQ.pop();
    }
    gold[i] = sum;
    // cerr << "gold[" << i << "] = " << gold[i] << endl;
  }
  ll maxi = -1000000000000000000;
  for (auto i = Y-1; i <= Y+Z-1; ++i) {
    // cerr << "sliver[" << i << "] = " << silver[i]
    //      << ", gold[" << i+1 << "] = " << gold[i+1] << endl;
    maxi = max(maxi, gold[i+1]+silver[i]);
  }
  cout << ans + maxi << endl;
}


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


#define INF 1000000000000


signed main()
 {
   int n;
   cin>>n;
   int a[n],b[n];
   rep(i,n){
     cin>>a[i]>>b[i];
   }
   int ans=0;
   for(int i=n-1;i>=0;i--){
     if((a[i]+ans)%b[i]!=0){
     ans+=(b[i]-((a[i]+ans)%b[i]));
   }
   }
   cout<<ans;

 }


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

int main(){
    ldou x; cin >> x;
    ldou r = 1.01;
    ldou f = 100; int count = 0;
    while(f < x){
        f *= r;
        f = floor(f);
        count ++;
    }
    out(count);
}

Measured memory_bytes: 3728
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <cstring>
#define ll long long

using namespace std;

int main()
{
    ll int i,j,k,m;
    string a;
    cin>>a>>j;
    ll int len = a.size();
    for(i=0;i<len;i+=j)
    {
        cout<<a[i];
    }
    cout<<endl;

    return 0;
}



Measured memory_bytes: 256
s=input()
n=len(s)
if s[0]=="0" or s[-1]=="1":print(-1);exit()
for i in range(n-1):
  if s[i]!=s[-i-2]:print(-1);exit()
b=[]
for i in range(n-1):
  if s[i]=="1":
    for j in b:print(j+1,i+1)
    b=[]
  b.append(i)
for j in b:print(j+1,n)

Measured memory_bytes: 51160
import java.util.Arrays
import java.util.ArrayList

const val MOD: Long = (1e9+7).toLong()
fun Double.format(digits: Int) = String.format("%.${digits}f", this)

fun primes(n: Int) : IntArray {
    /** Return a list of primes not more than n **/
    val primes: ArrayList<Int> = arrayListOf()

    val isPrime = Array(n+1, {true})
    for (i in 2..n) {
        if (isPrime[i]) {
            primes.add(i)
            var buf = i * 2
            while (buf <= n) {
                isPrime[buf] = false
                buf += i
            }
        }
    }
    return primes.toIntArray()
}

fun prime_fact(n: Long) : Map<Long, Int> {
    /** Return a map of the numbers of prime factors **/
    var cntprime: MutableMap<Long, Int> = mutableMapOf()

    var m = n
    for (i in primes(Math.sqrt(n.toDouble()).toInt())) {
        while (m % i == 0L) {
            cntprime[i.toLong()] = cntprime.getOrElse(i.toLong(), {0}) + 1
            m /= i
        }
    }
    if (m != 1L) {
        cntprime[m] = 1
    }

    return cntprime
}

fun main(args: Array<String>) {
    val n = readLine()!!.toLong()

    val facts = prime_fact(n)
    var res = 0L
    var list: ArrayList<Long> = arrayListOf(1)
    for ((k, v) in facts) {
        val list2 = Array(v+1, {Math.pow(k.toDouble(), it.toDouble()).toLong()})
        val list3: ArrayList<Long> = arrayListOf()
        for (e in list2) {
            list.forEach{
                list3.add(e * it)
            }
        }
        list = list3
    }
    for (e in list) {
        if (n/e < e-1) {
            res += e-1
        }
    }
    println(res)
}


Measured memory_bytes: 40708
#include <algorithm>
#include <array>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
#define vint vector<int>

int main() {
    int X, Y;
    cin >> X >> Y;
    vint score(max(X, Y) + 1, 0);
    rep(i, 4) score[i] = 100000 * (4 - i);
    int ans = score[X] + score[Y];
    if (X == 1 && Y == 1)
        ans += 400000;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct face{
  string c[3];
  face(){}
  face(string s[3]){
    for(int i=0;i<3;i++) c[i]=s[i];
  }
};
struct dice{
  face f[6];
  int d;
  dice(){}
  dice(string s[6][3]){
    d=0;
    for(int i=0;i<6;i++)
      f[i]=face(s[i]);
  }
};
 
bool check(dice d){
  bool res=1,f;
  f=0;
  for(int i=0;i<3;i++) f|=d.f[0].c[2][i]=='*';
  res&=f;
  f=0;
  for(int i=0;i<3;i++) f|=d.f[2].c[2][i]=='*';
  res&=f;
  return res;
}
face sr(face f){
  face p=f;
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      p.c[i][j]=f.c[2-j][i];
  return p;
}
face sl(face f){
  face p=f;
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      p.c[i][j]=f.c[j][2-i];
  return p;
}
face re(face f){
  return sr(sr(f));
}
dice rotate1(dice d){
  dice b=d;
  b.d++;
  b.f[0]=d.f[5];
  b.f[1]=sr(d.f[1]);
  b.f[2]=re(d.f[4]);
  b.f[3]=sl(d.f[3]);
  b.f[4]=d.f[0];
  b.f[5]=re(d.f[2]);
  return b;
}
dice rotate2(dice d){
  dice b=d;
  b.d++;
  b.f[0]=d.f[4];
  b.f[1]=sl(d.f[1]);
  b.f[2]=re(d.f[5]);
  b.f[3]=sr(d.f[3]);
  b.f[4]=re(d.f[2]);
  b.f[5]=d.f[0];
  return b;
}
dice rotate3(dice d){
  dice b=d;
  b.d++;
  b.f[0]=sl(d.f[0]);
  b.f[1]=sl(d.f[5]);
  b.f[2]=sr(d.f[2]);
  b.f[3]=sl(d.f[4]);
  b.f[4]=sl(d.f[1]);
  b.f[5]=sl(d.f[3]);
  return b;
}
dice rotate4(dice d){
  dice b=d;
  b.d++;
  b.f[0]=sr(d.f[0]);
  b.f[1]=sr(d.f[4]);
  b.f[2]=sl(d.f[2]);
  b.f[3]=sr(d.f[5]);
  b.f[4]=sr(d.f[3]);
  b.f[5]=sr(d.f[1]);
  return b;
}
signed main(){
  string tmp;
  while(cin>>tmp,tmp!="#"){
    string s[6][3];
    s[0][0]=tmp;
    for(int i=0;i<6;i++){
      for(int j=0;j<3;j++){
	if((i||j)==0) continue;
	cin>>s[i][j];
      }
    }
    dice d(s);
    queue<dice> q;
    q.push(d);
    int ans=-1;
    while(!q.empty()){
      d=q.front();q.pop();
      if(check(d)){
	ans=d.d;
	break;
      }
      q.push(rotate1(d));
      q.push(rotate2(d));
      q.push(rotate3(d));
      q.push(rotate4(d));
    }
    assert(~ans);
    cout<<ans<<endl;
  }
  assert(tmp=="#");
  return 0;
}

Measured memory_bytes: 3212
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 200005
using namespace std;
int n;
char in[M];
int main()
{
    while (~scanf("%s", in+1)) {
        n = strlen(in+1);
        long long ans = 0;

        REP(i,1,n) if(in[i]=='A') {
            int j = i-1;

            vector<int> tmp, tsum;
            while (1) {
                if (j+1<=n && in[j+1]=='A') { j+=1; tmp.push_back(0); }
                else if (j+2<=n && in[j+1]=='B' && in[j+2]=='C') { j+=2; tmp.push_back(1); }
                else break;
            }
            if ((int)tmp.size()==0) continue;

            tsum = vector<int>(tmp.size()+1);
            for (int k=tmp.size()-1; k>=0; k--) tsum[k] = tsum[k+1] + tmp[k];

            REP(k,0,(int)tmp.size()-1) if(tmp[k]==0) {
                ans += tsum[k+1];
            }

            i = j;
            //in[j-1] = 'A';
        }
        printf("%lld\n",ans);
    }
    return 0;
}


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

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)
#define FIN ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main() {
    int n, h, w;
    cin >> n >> h >> w;
    cout << (n - h + 1) * (n - w + 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
/*lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)) = gcd(lcm(N1, ..., Nk), M)
gcd(lcm(N1, M), lcm(N2, M), ..., lcm(Nk, M)) = lcm(gcd(N1, ..., Nk), M).

If gcd(N1, N2) = 1, then
gcd(N1·N2, M) = gcd(N1, M)·gcd(N2, M)
lcm(N1·N2, M) = lcm(N1, M)·lcm(N2, M)/M.

lcm(M, N, P) · gcd(M, N) · gcd(N, P) · gcd(P, M) = NMP · gcd(N, M, P).
*/
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  ll t=1;
  while(t--)
  {
    ll n;
    cin>>n;
    if(n&1)cout<<0;
    else
    {
      ll ans=0;
      for(ll i=10;n/i >=1;i*=5)
      ans+=n/i;
      cout<<ans;
    }
  }  
  return 0;
}
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* special cases (n=1?)
* 1LL<<i and not 1<<i
* overflow (int vs ll?)
* array bounds
* if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
*/

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

int main() {
    int n, l;
    string S;
    cin >> n >> l;
    vector<string> v;

    for(int i = 0; i < n; i++) {
        cin >> S;
        v.push_back(S);
    }

    sort(v.begin(), v.end());
    for(int i = 0; i < n; cout<< v[i], i++);
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//
        string S;
        cin >> S;
        int ans = (int)1e9;
        for (int i = 0; i < S.size() - 2; i++)
        {
                int a = (S[i] - '0') * 100 + (S[i + 1] - '0') * 10 + (S[i + 2] - '0') * 1;
                ans = min(ans, abs(753 - a));
        }
        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>

using namespace std;

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    int N;
    cin >> N;

    vector<int > A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    bitset<24> B(0);
    long long sum = 0;
    long long ans = 0;

    int right = 0;
    for (int left = 0; left < N; left++) {
        if (right <= left) right = left;
        while (right < N && (sum + A[right]) == (B ^ (bitset<24>(A[right]))).to_ullong()) {
            sum += A[right];
            B ^= bitset<24>(A[right]);
            right++;
        }
        ans += (right - left);
        sum -= A[left];
        B ^= A[left];
    }

    cout << ans << endl;

    return 0;
}














































Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int UI;
const int maxn = 1e5+5;

int n;
LL a[maxn],b[maxn];

void solve(){
	LL sum = 0LL;
	for(int i = 1;i <= n;i++) sum += a[i];
	LL T = 1LL*n*(n+1)/(2LL);
	if(sum%T){
		puts("NO");
		return;
	}
	b[n] = a[1]-a[n];
	for(int i = 2;i <= n;i++) b[i-1] = a[i] - a[i-1];
	LL cnt = sum/T;
	for(int i = 1;i <= n;i++){
		b[i] -= cnt;
		if(b[i] > 0 || b[i]%n){
			puts("NO");
			return;
		}
	}
	puts("YES");
}

int main(){
	while(scanf("%d",&n) != EOF){
		for(int i = 1;i <= n;i++) scanf("%I64d",&a[i]);
		solve();
	}
	return 0;
}

/*w*
【题意】


【类型】


【分析】


【时间复杂度】


【数据】

*/


Measured memory_bytes: 1792
from itertools import *
from bisect import bisect_right
n,m,time = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

A = [0]+list(accumulate(a))
B = [0]+list(accumulate(b))

ans = 0
for i in range(bisect_right(A, time)-1,-1,-1):
    ans = max(ans,i+bisect_right(B, time-A[i])-1)
print(ans)


Measured memory_bytes: 129340
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
typedef long long ll;
const int MAX_V=2000;
int V;
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];
void add_edge(int u,int v){
	G[u].push_back(v);
	G[v].push_back(u);
}
bool dfs(int v){
	used[v]=true;
	rep(i,G[v].size()){
		int u=G[v][i],w=match[u];
		if(w<0 || (!used[w] && dfs(w))){
			match[v]=u;
			match[u]=v;
			return true;
		}
	}
	return false;
}
int nibu(){
	int res=0;
	memset(match,-1,sizeof(match));
	rep(v,V){
		if(match[v]<0){
			memset(used,0,sizeof(used));
			if(dfs(v)) res++;
		}
	}
	return res;
}
int N,M,L,INF=1e9;
ll d[100][100];
int p[1000],t[1000];
int main(){
	while(true){
		cin>>N>>M>>L;
		if(N==0) break;
		rep(i,N) rep(j,N) if(i!=j) d[i][j]=INF;
		rep(i,M){
			int u,v,di;
			cin>>u>>v>>di;
			d[u][v]=di;
			d[v][u]=di;
		}
		rep(i,N) rep(j,N) rep(k,N) d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
		rep(i,L) cin>>p[i]>>t[i];
		V=2*L;
		rep(i,V) G[i].clear();
		rep(i,L) rep(j,L) if(i!=j){
			if(t[i]+d[p[i]][p[j]]<=t[j]){
				add_edge(i,j+L);
			}
		}
		cout<<L-nibu()<<endl;
	}
}

Measured memory_bytes: 9776
#include <bits/stdc++.h>
using namespace std;
int n,l;
int main(){
    cin>>n>>l;
vector <string> v(n);
    for(int i=0;i<n;++i)
        cin>>v[i];
    sort(v.begin(),v.end());
    for(int i=0;i<n;++i)
        cout<<v[i];
return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(int argc, char **argv){
	int h = 0;
	int w = 0;

	while(std::cin >> h >> w, (h != 0 || w != 0)){
		for(int y = 0; y < h; y++){
			for(int x = 0; x < w; x++){
				std::cout << "#";
			}
			std::cout << std::endl;
		}
		std::cout << std::endl;
	}
	return 0;
}

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <memory>
#include <sstream>
#include <iomanip>
#include <cstdio>

using namespace std;

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	int H, W, h, w;
	cin >> H >> W;
	cin >> h >> w;

	cout << H * W - h*W - w*H + w*h << endl;

	return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: i64,
        m: i64,
    }
    let mut ans = 1;
    for i in 1..((m as f64).sqrt() as i64 + 1) {
        if m % i != 0 {
            continue;
        }
        let k = m / i;
        if i * n <= m {
            ans = std::cmp::max(i, ans);
        }
        if k * n <= m {
            ans = std::cmp::max(k, ans);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main()
{
    int K;
    cin >> K;
    int s = 7;
    for (int i = 0; i < K + 100; i++)
    {
        s %= K;
        if (s == 0)
        {
            cout << i + 1 << endl;
            return 0;
        }
        s = s * 10 + 7;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3184
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let x: u64 = read();
    let mut n: i32 = 0;
    let mut balance: f64 = 100.0;

    while (balance as u64) < x {
        balance = (balance * 1.01).floor();
        n += 1;
    }

    println!("{}", n);
}


Measured memory_bytes: 2648
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

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


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
























int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    REP(i, n){
        ll a;
        cin >> a;
        if(i % 2 == 0 && a % 2 == 1) ans++;
    }
    cout << ans << endl;
}

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

const ll MOD = 998244353;
const int MAX_N = 2e5 + 10;

long long fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX_N; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COMB(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
    int N, M, K; cin >> N >> M >> K;
    COMBinit();
    vector<ll> MPi(N+10);
    
    MPi[1] = M;
    for (int i = 2; i < N+10; i++) {
        MPi[i] = MPi[i-1] * (M-1);
        MPi[i] %= MOD;
    }
    ll ans = 0;
    for (int i = 0; i <= K; i++) {
        ans += COMB(N-1, i) * MPi[N-i];
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 9540
import java.util.Scanner;

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

        int S = scan.nextInt();
        

        System.out.print(S / 3600);
        System.out.print(":");
        System.out.print(S % 3600 / 60);
        System.out.print(":");
        System.out.println(S % 3600 % 60);
    }   
}


Measured memory_bytes: 26272
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,double> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

ll a[100010],b[100010],c[100010];

ll cnt[100010];

int main() {
    int n;cin>>n;
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];
    rep(i,n) cin>>c[i];
    sort(a,a+n);
    sort(b,b+n);
    sort(c,c+n);
    rep(i,n) {
        auto it = upper_bound(b,b+n,a[i]) - b;
        cnt[it]++;
    }
    rep(i,n) cnt[i+1] += cnt[i];
    ll ans = 0;
    rep(i,n) {
        auto it = upper_bound(c,c+n,b[i]) - c;
        ans += (n - it) * cnt[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6700
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#include <numeric>
#define IINF 1000000000
#define INF 9223372036854775807
#define MOD 998244353
#define mod 998244353
#define INT_MAX_ 2147483647
#define EPS (1e-10)
#define REP(i, a, n) fo-r (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define rep(i,n)for (ll i = 0; i < (ll)(n); i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
#define me memset
#define bit(n,k) ((n>>k)&1)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp1(pair<ll,ll> a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi>b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_t=clock();
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n,k;cin>>n>>k;
    V<int>p(n);
    for(int i=0;i<n;i++)cin>>p[i];
    sort(all(p));
    int ans=0;
    for(int i=0;i<k;i++)ans+=p[i];
        cout<<ans<<Endl;
    //------------------------------
    //fclose(stdin);
    //fclose(stdout);
    //ll end_t=clock();cout<<"time="<<end_t-begin_t<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------






























Measured memory_bytes: 3648
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;

/*----------macros----------*/

//input, output================
#define fastio                          \
std::ios::sync_with_stdio(false);       \
std::cin.tie(nullptr);                  \
std::cout.tie(nullptr)

#define endl '\n'
#define fcout(a)                        \
cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef vector<int>     Vi;
typedef vector<ll>      Vl;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF    = (ll)1e9 + 1;
constexpr ll INFll  = (ll)1e18 + 1;
constexpr ll MOD1   = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define psb push_back
#define epb emplace_back
#define psf push_front
#define mkp make_pair
#define fst first
#define snd second

//others================
#define sz(x)                           \
(int) x.size()

#define all(x)                          \
(x).begin(), (x).end()

#define rall(x)                         \
(x).rbegin(), (x).rend()

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

#define reps(i, n)                      \
for(int i = 1; (i) <= (n); ++(i))

#define rrep(i, n)                      \
for(int i = n - 1; (i) >= 0 ; --(i))

#define repbit(bit, n)                  \
for(int bit = 0; (bit) < (1 << (n)); ++(bit))

#define ifbit(bit, i)                   \
if((bit) & (1 << (i)))

#define CtoI(c)                         \
int((c)) - int('0')

#define ItoC(c)                         \
char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b)
{ return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b)
{ return a > b && (a = b, true); }

// Vi  dx = {1, 0, -1, 0},
//     dy = {0, 1, 0, -1};

// Vi  dx2 = { 1,1,0,-1,-1,-1,0,1 },
//     dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
fastio;

    int a, b, c; cin >> a >> b >> c;
    cout << a * b / 2 << endl;

return 0;
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a, b;
	cin >> a >> b;

	if (a % 3 == 0) {
		cout << "Possible\n";
	} else if (b % 3 == 0) {
		cout << "Possible\n";
	} else if ((a+b) % 3 == 0) {
		cout << "Possible\n";
	} else {
	          cout << "Impossible\n";
	}

	return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

while True:
   m, f, r = map(int, input().split())
   if m == -1 and f == -1 and r == -1:
      break
   
   if m == -1 or f == -1 or m + f < 30:
      print("F")
   elif m + f >= 80:
      print("A")
   elif m + f >= 65 and m + f < 80:
      print("B")
   elif m + f >= 50 and m + f < 65:
      print("C")
   else:
      if r >= 50:
         print("C")
      else:
         print("D")



Measured memory_bytes: 5600
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
using namespace std;

int main(){
  int n, k; cin >> n >> k;
  int ans = 0;
  rep(i, 0, n){
    int tmp;
    cin >> tmp;
    ans += min(k-tmp, tmp)*2;
  }

  cout << ans << endl;
}

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

#define      pb    push_back
#define      ff    first
#define      ss    second
#define      ll    long long int
#define      endl  "\n"
#define      FASTIO        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);


#define      TEST    int t ; cin >> t ; while( t -- )

const ll big = 10e7 + 11 ;

int  main (  ) {

    FASTIO ;

    double n , m ;
    cin >> m ;

    map < int , int > mp ;

    for( int i = 0 ; i < m -1 ; i++ ){
        int x ;
        cin >> x ;

        mp[ x ]++ ;
    }

    for( int i = 1 ; i <= m ; i++ )
        cout << mp[ i ] << endl ;



    return  0 ;
}


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

template <typename T>
class SkewHeap{
    using F = function<bool(T, T)>;

    class _Node{
    public:
        T key;
        _Node *left = nullptr;
        _Node *right = nullptr;

        explicit _Node(const T key) : key(key){}
    };

    _Node* root = nullptr;
    F comp;

    _Node* _merge(_Node* n1, _Node* n2){
        if(n1 == nullptr) swap(n1, n2);
        if(n1 == nullptr || n2 == nullptr) return n1;

        if(not comp(n1->key, n2->key)) swap(n1, n2);
        n1->left = _merge(n1->left, n2);
        swap(n1->left, n1->right);
        return n1;
    }

public:
    explicit  SkewHeap(bool reverse=false){
        comp = reverse ? [](const T &e1, const T &e2){return e1 > e2;} : [](const T &e1, const T &e2){return e1 < e2;};
    }

    explicit  SkewHeap(F comp) : comp(comp){}

    void merge(SkewHeap* h1, SkewHeap* h2){
        if(h1 == nullptr) swap(h1, h2);
        if(h1 == nullptr or h2 == nullptr) return;

        _merge(h1->root, h2->root);
    }

    void merge(SkewHeap& other){
        root = _merge(root, other.root);
    }

    void push(const T e){
        auto* _node = new _Node(e);
        if(root == nullptr){
            root = _node;
            return;
        }
        root = _merge(root, _node);
    }

    T top() const {
        return root->key;
    }

    void pop(){
         _Node* _node = root;
        root = _merge(root->left, root->right);
        delete _node;
    }

    bool empty(){
        return root == nullptr;
    }
};

int main(){
    // test: https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_9_C
    // result: https://onlinejudge.u-aizu.ac.jp/status/users/cherry_57/submissions/1/ALDS1_9_C/judge/4322246/C++14
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    int v;
    string s;
    SkewHeap<int> pq(true);
    //priority_queue<int> pq;
    while(cin>>s, s!="end"){
        if(s=="insert"){
            cin>>v;
            pq.push(v);
        }else{
            cout<<pq.top()<<'\n';
            pq.pop();
        }
    }
}



Measured memory_bytes: 34356
#include <iostream>
#include <bits/stdc++.h>
 
#define rep(i,z) for(int i = 0; i<(int)(z); i++)
#define rep1(i,z) for(int i = 1; i<=(int)(z); i++)
 
using namespace std;
 
typedef long long ll;
const ll mod=1e9+7;
 
using pear = pair<int,int>;
 
int main(){
    int n; cin >>n;
    int ans = 1;
    string s;
    cin >>s;
    rep1(i,n-1){
        if(s[i-1] != s[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MP make_pair
#define PB push_back
typedef long long ll;

int N;
string x, y;
char s[100];

bool q (string a, string b) {
        printf("%s\n%s\n", a.c_str(), b.c_str()); fflush(stdout);
        scanf(" %s", s);
        if (s[0] == 'e') exit(0);
        return s[0] == 'T';
}

int main () {
        scanf("%d", &N);
        while (1) {
                if ((int) x.size() == N) break;
                bool ok = 0;
                fo(i, 0, 4) {
                        char c1 = '.', c2 = '.';
                        if (i&1) c1 = '#';
                        if (i&2) c2 = '#';
                        if (q(x+c1, y+c2)) {
                                ok = 1;
                                x = x + c1;
                                y = y + c2;
                                break;
                        }
                }
                if (!ok) break;
        }
        while (1) {
                if ((int) x.size() == N) break;
                bool ok = 0;
                fo(i, 0, 4) {
                        char c1 = '.', c2 = '.';
                        if (i&1) c1 = '#';
                        if (i&2) c2 = '#';
                        if (q(c1+x, c2+y)) {
                                ok = 1;
                                x = c1 + x;
                                y = c2 + y;
                                break;
                        }
                }
                if (!ok) break;
        }
        printf("%s\n%s\n", x.c_str(), y.c_str()); fflush(stdout);
        scanf(" %s", s);
        assert(s[0] == 'e');
        return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <math.h>
#include <unordered_map>
#include <unordered_set>
//#define local
#ifdef local
#include "dbg-macro/dbg.h"
#endif
//#define hacks
#ifdef hacks
#include <boost/multiprecision/cpp_int.hpp>
#endif
#define p std::pair
#define ll long long
#define ull unsigned long long
#define pi (acos(-1))
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
#define vec std::vector
#define oreq |=

using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
ll extgcd(ll a, ll b, ll &x, ll &y);
ll nCr(ll n, ll r);
void stat();
constexpr ll mod = 1000000000 + 7;
int main()
{
    stat();
    string s;
    cin>>s;
    for(char c:s){
	    if(c=='7'){
		    cout<<"Yes"<<endl;return 0;
	    }
    }
    cout<<"No"<<endl;
    return 0;
}
ll extgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
            P.emplace_back(i);
        }
    }
    return P;
}

void stat() {
#ifdef local
    rep(i, 2) {std::cout << "local enable" << std::endl;
}
#endif
#ifdef hacks
rep(i, 2) { std::cout << "boost enable" << std::endl; }
#endif
}

ll nCr(ll n, ll r)
{
    ll num = 1;
    for (ll i = 1; i <= r; i++) { num = num * (n - i + 1) / i; }
    return num;
}


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

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

using namespace std;

struct UnionFind {
  vector<int> parent;
  UnionFind (int n) { parent.assign(n, -1); }
  int root(int x) { return parent[x] < 0 ? x : parent[x] = root(parent[x]); }
  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (parent[y] < parent[x]) swap(x, y);
    if (parent[x] == parent[y]) --parent[x];
    parent[y] = x;
    return true;
  }
};

const int MOD = 1000000007;

int p2(int n){
  if(n==0) return 1;
  else return (p2(n-1)*2)%MOD;
}

int main() {
  while(1){
    int n,m;
    cin>>n>>m;
    if(!n)break;
    UnionFind uf(n);
    REP(i,m){
      int a,b;
      cin>>a>>b;
      --a;--b;
      uf.merge(a,b);
    }
    set<int> s;
    REP(i,n) s.insert(uf.root(i));
    if(s.size()==n){
      cout<<p2(n)<<endl;
    }else{
      int p=p2(s.size())+1;
      p%=MOD;
      cout<<p<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 7628
# Coding is about expressing your feeling, and
# there is always a better way to express your feeling_feelme
import sys
import math
# sys.stdin=open('input.txt','r')
# sys.stdout=open('output2.txt','w')
from sys import stdin,stdout
from collections import deque,defaultdict
from math import ceil,floor,inf,sqrt,factorial,gcd,log2
from copy import deepcopy
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
mod=int(1e9 + 7)

l,r,d=iia()
count=0
for i in range(l,r+1):
    if i%d==0:
        count+=1
print(count)


Measured memory_bytes: 9560
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

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

    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    multiset<ll> s;

    rep(i, n) {
        ll now = a[i];
        auto itr = s.lower_bound(now);
        if (itr != s.begin()) s.erase(--itr);
        s.insert(now);
    }

    cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 5760
N,K=map(int,input().split())
A=list(map(int,input().split()))

B=[0]*(N+1)
for i in range(0,N):
    B[A[i]]=B[A[i]]+1
C=[]
for i in range(0,N+1):
    if B[i]!=0:
        C.append(B[i])
C.sort()
if K>=len(C):
    print(0)
else:
    s=0
    for i in range(0,len(C)-K):
        s=s+C[i]
    print(s)


Measured memory_bytes: 25716
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

struct Mod {
    static ll BASE;
    ll value = 0;
    static ll residue(ll value) { return (value % BASE + BASE) % BASE; }
    Mod(ll value)
    : value(residue(value)) {}
    Mod operator+(const Mod& rhs) const { return Mod(value + rhs.value); }
    void operator+=(const Mod& rhs) { *this = *this + rhs; }
    Mod operator-(const Mod& rhs) const { return Mod(value - rhs.value); }
    void operator-=(const Mod& rhs) { *this = *this - rhs; }
    Mod operator*(const Mod& rhs) const { return Mod(value * rhs.value); }
    void operator*=(const Mod& rhs) { *this = *this * rhs; }
};
ll Mod::BASE = 1000000007;

int main() {
    ll N;
    ull K;
    cin >> N >> K;
    auto mat = make_vec_nd((Mod)0, N, N);
    for (ll i = 0; i < N; i++) {
        for (ll j = 0; j < N; j++) {
            ll elm;
            cin >> elm;
            mat[i][j] = elm;
        }
    }
    auto ans_mat = make_vec_nd((Mod)0, N, N);
    for (ll i = 0; i < N; i++) {
        ans_mat[i][i] = 1;
    }
    auto mat_mult = [N](vector<vector<Mod>> mat0, vector<vector<Mod>> mat1) -> vector<vector<Mod>> {
        auto res = make_vec_nd((Mod)0, N, N);
        for (ll i = 0; i < N; i++) {
            for (ll j = 0; j < N; j++) {
                for (ll k = 0; k < N; k++) {
                    res[i][j] += mat0[i][k] * mat1[k][j];
                }
            }
        }
        return res;
    };
    for (ll bit = 0; bit < 64; bit++) {
        if (K & ((ull)1 << bit)) {
            ans_mat = mat_mult(ans_mat, mat);
        }
        mat = mat_mult(mat, mat);
    }
    Mod ans = 0;
    for (ll i = 0; i < N; i++) {
        for (ll j = 0; j < N; j++) {
            ans += ans_mat[i][j];
        }
    }
    cout << ans.value << endl;
}


Measured memory_bytes: 384
def bubble_sort(a)
  arr = a.dup
  n = arr.length
  for i in 0..n - 1
    j = n - 1
    while j > i
      if arr[j-1][1] > arr[j][1]
        arr[j-1],arr[j] = arr[j],arr[j-1]
      end
      j -= 1
    end
  end
  arr
end
 
def selection_sort(arr)
  a = arr.clone
  for i in 0..(a.length - 1)
    min = i
    for j in i ..(a.length - 1)
      if a[j][1] < a[min][1]
        min = j
      end
    end
    a[i], a[min] = a[min], a[i]
  end
  a
end
 
gets
x = gets.split.map { |v| [v[0], v[1].to_i] }
b = bubble_sort(x)
s = selection_sort(x)
 
puts b.map(&:join).join(' ')
puts 'Stable'
puts s.map(&:join).join(' ')
puts b == s ? 'Stable' : 'Not stable'

Measured memory_bytes: 8648
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H & b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H & b) const { return x == b.x && y == b.y; }
	bool operator!=(const H & b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T & a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T & a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n;
vector<B>e[200000];
int a[200000];
signed main() {
	cin >> n;
	for (int i = 1; i < n; i++) {
		int u, v, r;
		cin >> u >> v >> r;
		e[u].push_back(B{ v,r });
		e[v].push_back(B{ u,r });
	}
	queue<int>q;
	q.push(1);
	for (int i = 2; i <= n; i++) {
		a[i] = Inf;
	}
	while (!q.empty()) {
		int t = q.front(); q.pop();
		for (int i = 0; i < e[t].size(); i++) {
			if (a[e[t][i].to] == Inf) {
				a[e[t][i].to] = a[t] + e[t][i].cost;
				q.push(e[t][i].to);
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		cout << a[i] % 2 << endl;
	}
}

Measured memory_bytes: 11008