akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main()
{
    int x;
    int i=1;
    while(1){
        cin >> x;
        if( x == 0 ){
            break;
        }

        cout << "Case " << i << ": " << x <<endl;
        ++i;
    }

    return 0;
}


Measured memory_bytes: 3072
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

int N,K;
long long int x[100];
long long int y[100];
long long int z[100];
long long int xbox[100];
long long int ybox[100];
long long int zbox[100];
int sum[100][100][100];
long long int ans;

int main() {
	ios::sync_with_stdio(false);
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> x[i * 2] >> y[i * 2] >> z[i * 2] >> x[i * 2 + 1] >> y[i * 2 + 1] >> z[i * 2 + 1];
		xbox[i * 2] = x[i * 2];
		xbox[i * 2 + 1] = x[i * 2 + 1];
		ybox[i * 2] = y[i * 2];
		ybox[i * 2 + 1] = y[i * 2 + 1];
		zbox[i * 2] = z[i * 2];
		zbox[i * 2 + 1] = z[i * 2 + 1];
	}
	stable_sort(x, x + N * 2);
	stable_sort(y, y + N * 2);
	stable_sort(z, z + N * 2);
	//for (int i = 0; i < N * 2; i++) {
	//	cout << x[i] << " ";
	//}
	//cout << endl;
	//for (int i = 0; i < N * 2; i++) {
	//	cout << y[i] << " ";
	//}
	//cout << endl;
	//for (int i = 0; i < N * 2; i++) {
	//	cout << z[i] << " ";
	//}
	//cout << endl;
	for (int i = 0; i < N; i++) {
		int sx = 0, sy = 0, sz = 0, gx = 0, gy = 0, gz = 0;
		for (int j = 0; j < N * 2; j++) {
			if (xbox[i * 2] == x[j])sx = j;
			if (xbox[i * 2 + 1] == x[j])gx = j;
			if (ybox[i * 2] == y[j])sy = j;
			if (ybox[i * 2 + 1] == y[j])gy = j;
			if (zbox[i * 2] == z[j])sz = j;
			if (zbox[i * 2 + 1] == z[j])gz = j;
		}
	//	cout << sx << " " << gx << " " << sy << " " << gy << " " << sz << " " << gz << endl;
		for (int j = sx; j < gx; j++) {
			for (int k = sy; k < gy; k++) {
				for (int l = sz; l < gz; l++) {
					sum[j][k][l]++;
				}
			}
		}
	}
	for (int i = 0; i < N * 2 - 1; i++) {
		for (int j = 0; j < N * 2 - 1; j++) {
			for (int k = 0; k < N * 2 - 1; k++) {
				if (sum[i][j][k]>=K){
					ans += (x[i + 1] - x[i])*(y[j + 1] - y[j])*(z[k + 1] - z[k]);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6844
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int N=3005;
int a[N];
ll memo[N][N][3];
bool vis[N][N][3];
 
ll dp(int l,int r,int t){
    if(l>r) return 0;
    if(vis[l][r][t]) return memo[l][r][t];
    vis[l][r][t]=true;
    ll ans;
    if(t==0){
        ans=max(a[l] + dp(l+1,r,1),a[r] + dp(l,r-1,1));
    }else{
        ans=min(-a[l] + dp(l+1,r,0),-a[r] + dp(l,r-1,0));
    }
    return memo[l][r][t]=ans;
}
int main() {
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    cout<<dp(0,n-1,0)<<'\n';
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  
  vector<int> a(n);

  rep(i, n){
    cin >> a.at(i);
  }
  
  sort(a.begin(), a.end());
  int count = 0;
  for(int i = 0; i < n - 2; i++){
    
    for(int j = i + 1; j < n - 1; j++){
      
      if(a.at(i) == a.at(j)){
        continue;
      }
      
      for(int k = j + 1; k < n; k++){
        
        if(a.at(i) == a.at(k) || a.at(j) == a.at(k)){
          continue;
        }
        
        if(a.at(j) + a.at(i) > a.at(k) && a.at(j) - a.at(i) < a.at(k)){
          count++;
        }
      }
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 3504
#include <stdio.h>
//sourav
 int main(void){
 int a, b, c;

 scanf("%d%d%d", &a, &b, &c);

 int ispoor = 0;
 if (a == b && b != c) ispoor = 1;
 if (b == c && c != a) ispoor = 1;
 if (c == a && a != b) ispoor = 1;

 if (ispoor) {
 puts("Yes");
 } else {
 puts("No");
 }

 return 0;
}

Measured memory_bytes: 128
// nlather (Nishant Raj Lather)
// Chrollo_Lucifer

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1e9+7
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define rep(i, x, n) for(ll i = x; i < n; i++)
#define rrep(i, x, n) for(ll i = x; i >= n; i--)
#define all(v) v.begin(),v.end()
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define e emplace
#define mp make_pair
double PI=3.14159265358979323846;
typedef long long int ll;
typedef long double ld;
typedef pair< ll, ll > pii;
typedef vector< ll > vi;
typedef vector< vi > vvi;

ll dp[100005];
ll h[100005];

int main()
{
	boost
	ll n;
	cin >> n;
	rep(i, 0, n) cin >> h[i];
	h[n] = h[n - 1];
	rrep(i, n - 2, 0) dp[i] = min(dp[i + 1] + abs(h[i] - h[i + 1]), dp[i + 2] + abs(h[i + 2] - h[i]));
	cout << dp[0];
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class211
    {
        static void Main()
        {
            var S = Console.ReadLine().ToCharArray().Select(x => x == '0' ? true : false).ToArray() ;
            int N = S.Length;
            int count = 0;
            for(int i = 0; i < N-1; i++)
            {
                if (S[i] == S[i + 1])
                {
                    count++;
                    S[i + 1] = !S[i + 1];
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13320
#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("avx,avx2,popcnt")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
const int maxn = 1<<19, mod = 1e9 + 7;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	ll n, p, a = 1, b = 0;
	cin >> n >> p;
	for(int t, i = 0; i < n; i++) {
		cin >> t;
		if(t&1) tie(a, b) = pair<ll, ll>{a+b, b+a};
		else tie(a, b) = pair<ll, ll>{a+a, b+b};
	}
	cout << (p?b:a);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

ll mergecount(vector<int> &a) {
    ll count = 0;
    int n = a.size();
    if (n > 1) {
        vector<int> b(a.begin(), a.begin() + n/2);
        vector<int> c(a.begin() + n/2, a.end());
        count += mergecount(b);
        count += mergecount(c);
        for (int i = 0, j = 0, k = 0; i < n; ++i)
        if (k == c.size())       a[i] = b[j++];
        else if (j == b.size())  a[i] = c[k++];
        else if (b[j] <= c[k])   a[i] = b[j++];
        else                   { a[i] = c[k++]; count += n/2 - j; }
    }
    return count;
}

int main() {
    int n; cin >> n;
    vector<int> a;
    rep(i,n){
        int a_; cin >> a_;
        a.push_back(a_);
    }

    ll ans = mergecount(a); 

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



Measured memory_bytes: 5216
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main()
{
	int h, w;
	cin >> h >> w;
	rep(i, h) {
		string s;
		cin >> s;
		cout << s << endl
			 << s << endl;
	}

	return 0;
}

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

int main(){
  ll n, m;
  cin >> n >> m;
  
  vector<tuple<ll, ll>> ent;
  rep(i,n,0){
    ll a, b;
    cin >> a >> b;
    ent.push_back(tie(a,b));
  }
  sort(ent.begin(), ent.end());
  
  priority_queue<ll> st;
  ll ans = 0, k = 0;
  rep(i,m+1,0){
    rep(j,n,k){
      if(get<0>(ent[j]) == i) st.push(get<1>(ent[j]));
      else{
        k = j;
        break;
      }
    }
    if(st.size() > 0){
      ans += st.top();
      st.pop();
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3568
n = int(input())
while True:#while分は条件がTrueである限り回り続ける＝永遠に回る
  for i in range(2, int(n**0.5)+1):#素数は√nまでで判定できる
    if n % i == 0:
      n += 1
      break
    else:
      continue
  else:
    print(n)
    exit()
  

Measured memory_bytes: 3060
#include <iomanip>
#include <ios>
#include <iostream>

using namespace std;
const double PI = 3.141592653589;

int main(int argc, const char *argv[]) {
  //
  double r;
  cin >> r;
  cout << fixed << setprecision(9) << r * 2 * PI << '\n';
  return 0;
}

Measured memory_bytes: 3788
count = [0 for i in range(4)]
for i in range(3):
    a,b=list(map(int,input().split()))
    count[a-1]+=1
    count[b-1]+=1
    
count.sort()

if count[0]==1 and count[1]==1 and count[2]==2 and count[3]==2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(x) sort(x.begin(),x.end())
#define REVE(x) reverse(x.begin(),x.end())
#define all(x) (x).begin(),(x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define pob pop_back
#define sw swap
using LL = long long;
using ULL = unsigned long long;
#define FOR(i, m, n) for(int i = m;i < n;i++)
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
int main(){
 int sx,sy,tx,ty;
 cin >> sx >> sy >> tx >> ty;
 const int dx=tx-sx,dy=ty-sy;
 //1
 rep(i,dy)cout << "U";
 rep(j,dx)cout << "R";
 //2
 rep(k,dy)cout << "D";
 rep(l,dx)cout<< "L";
 //3
 cout << "L";
 rep(m,dy+1)cout<< "U";
 rep(n,dx+1) cout<< "R";
 cout<< "D";
 //4
 cout << "R";
 rep(o,dy+1)cout << "D"; 
 rep(p,dx+1)cout<< "L";
 cout<<"U";
 cout << endl;
 return 0;
  }

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

int main()
{
	double a, b, f;
	int d, r;

	cin >> a >> b;
	
	d = a / b;
	r = int(a) % int(b);
	f = round(a /b*10e9)/(10e9);
	
	cout << d << " " << r << " " << fixed << setprecision(8) << f << "\n";

    return 0;
}




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

#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

int main(int argc, char const *argv[])
{
    ll a, b;
    cin >> a >> b;
    ll gt = max(a, b);
    ll ls = min(a, b);
    ll i(0);
    while (true)
    {
        ++i;
        ll m = (gt * i);
        if (m % ls == 0)
        {
            cout << m << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 100005
#define INF (ll)1e18
#define pll pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define vv vector
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define repr(i,n) repr2(i,n,0)
#define repr2(i,m,n) for(ll i=m;i>=(n);i--)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); //cout.tie(0);
#define pi 3.1415926535897
#define db long double  /* print with %Lf */
#define EPS 1e-9
#define flu fflush(stdout)
#define imp {cout<<"0\n"; return 0;}
#define yup {cout<<"YES\n"; return 0;}
#define debug_vec(vec,n) {rep(idxi,n) cout<<vec[idxi]<<" "; cout<<"\n";}
#define debug_pvec(vec,n) {rep(idxi,n) cout<<vec[idxi].fi<<"-"<<vec[idxi].se<<"  "; cout<<"\n";}
#define debug_set(seta) {cout<<seta.size()<<"\n"; for(auto idxi:seta) cout<<idxi<<" "; cout<<"\n";}
#define debug_map(mappa) {cout<<mappa.size()<<"\n";for(auto idxi:mappa) cout<<idxi.fi<<"-"<<idxi.se<<"  "; cout<<"\n";}
#define debug_vecvec(vec,n) {rep(idxi,n) {for(auto idxi2:vec[idxi]) cout<<idxi2<<" "; cout<<"\n";}}

int main() {

	get2(k,n);
	fill_nums(A,n);
	A.push_back(A[0]+k);

	ll ans = 0;
	rep(i,n) ans = max(ans, A[i+1]-A[i]);
	printf("%lld\n", k-ans);

	return 0;
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
    ll n;
    cin>>n;
    if( n%2 == 1 ){
	cout<<0<<endl;
    }else{
	n/= 10;
	ll cnt = 0;
	ll k = 1;
	while( n > 0 ){
	    cnt += n;
	    n/=5;
	    //k*=10;
	    //k++;
	}

	cout<<cnt<<endl;
    }
    return 0;
}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

void solve() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    int nums[] = {a, b, c};
    sort(nums, nums+3);

    rep(0, k) nums[2] *= 2;

    int sum = 0;
    rep(0, 3) sum += nums[i];

    cout << sum << endl;
}

int main() {
    solve();

    return 0;
}


Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, x, y = map(int, readline().split())
    mat = []

    for _ in range(n):
        a, b, c = map(int, readline().split())
        mat.append((a, b, c))

    dp = [[[INF] * 401 for _ in range(401)] for __ in range(n + 1)]
    dp[0][0][0] = 0

    for i in range(1, n + 1):
        a, b, c = mat[i - 1]
        for j in range(401):
            for k in range(401):
                dp[i][j][k] = dp[i - 1][j][k]
                if j - a >= 0 and k - b >= 0:
                    dp[i][j][k] = min(dp[i][j][k], dp[i - 1][j - a][k - b] + c)

    ans = INF
    for i, j in zip(range(x, 401, x), range(y, 401, y)):
        ans = min(ans, dp[n][i][j])

    if ans == INF:
        print(-1)
    else:
        print(ans)


if __name__ == '__main__':
    main()


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

long long upper = 10e16 + 1000;

int main()
{
  long long K;
  cin >> K;
  int n = 50;
  vector<long long> res(50);
  for (int i = 0; i < 50; ++ i) {
    res[i] = i;
  }
  for (int i = 0; i < 50; ++ i) {
    res[i] += K / n;
  }
  for (int i = 0; i < K % n; ++ i) {
    res[i] += n;
    for (int j = 0; j < n; ++ j) {
      if (i != j) {
        res[j] --;
      }
    }
  }
  cout << 50 << endl;
  for (int i = 0; i < 50; ++ i) {
    cout << res[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std ;

typedef long long ll ;
#define rep (i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	ll N, x;
	
	cin >> N >> x;

	ll a[N];
	ll count = 0;

	for (int i = 0; i < N; i++)
	{
		cin >> a[i];
		if (a[i] > x)
		{
			count += (a[i] - x);
			a[i] = x;
		}

		if (i > 0)
		{
			if (a[i] + a[i-1] > x)
			{
				ll tmp = a[i] + a[i-1] - x;
				count += tmp;
				a[i] = a[i] - tmp;
			}
		}

		//cout << a[i] <<","<<count << endl;
	}

	cout << count << endl;
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int A,B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B;
	A%=3;
	B%=3;
	if(A==0 || B==0 || A+B==3) _P("Possible\n");
	else _P("Impossible\n");
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256
import Foundation
let input = readLine()!
let inputs: [String] = input.components(separatedBy: " ")
let times = Int(inputs[0])!
let limit = Double(inputs[1])!
var count: Int = 0
for _ in 0..<times {
  let xystr = readLine()!
  let xy: [String] = xystr.components(separatedBy: " ")
  let x = Double(xy[0])!
  let y = Double(xy[1])!
  if(sqrt(x*x+y*y) <= limit){
    count += 1
  }
}
print(count)

Measured memory_bytes: 14376
use std::io::Read;

fn gcd(s: i32, t: i32) -> i32{
    if t == 0 {
        s
    }else {
        gcd (t, s % t)
    }
}

fn main() {
    let mut buf = String::new();

    std::io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let x: i32 = iter.next().unwrap().parse().unwrap();
    let xs: Vec<i32> = (0..n).map(|_| iter.next().unwrap().parse().unwrap()).collect();
    let mut g = 0;
    for a in xs {
        g = gcd(g, (x - a).abs());
    }
    println!("{}", g);
}



Measured memory_bytes: 4352
from heapq import heappush, heappop
s = input()
K = int(input())
N = len(s)
heap = []
cnt = 0
for i in range(N):
	for j in range(i+1, min(i+K+1, N+1)):
		heappush(heap, s[i:j])

l = list(set(heap))
l.sort()
print(l[K-1])

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


int main(){
  int a, b;
  cin >> a >> b;
  if ((a + b) % 2 == 0){
    cout << (a + b) / 2 << endl;
  }else{
    cout << "IMPOSSIBLE" << endl;
  }
}

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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

vector<ll> a(3);
ll ans;
int main() {
    cin>>a[0]>>a[1]>>a[2];
    sort(ALL(a));
    ans = inf;
    do{
        ans=min(ans,abs(a[2]-a[1])+abs(a[1]-a[0]));
    }while(next_permutation(ALL(a)));
    p(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define pi 3.1415926535897932384626433832
#define ll long long
using namespace std;
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / __gcd(a, b); }
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;}

void lok(){

}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n,k;
    cin>>n>>k;
    vector<ll> pak(n);
    for(auto &u:pak){
        cin>>u;
    }
    for(ll i=k;i<n;i++){
        if(pak[i]>pak[i-k]){
            cout<<"Yes"<<endl;
        }
        else cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 4780
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VII;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int N,M;
  cin>>N>>M;
  VI A(M),B(M);
  rep(i,M) cin>>A[i]>>B[i];
  vector<P> C(M);
  rep(i,M) C[i]=make_pair(B[i],A[i]);
  sort(all(C));
  int X=0,ans=0;
  rep(i,M){
    if(C[i].second>=X){
      X=C[i].first;
      ans++;
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 1792
#include <cstdio>

char A[105][105];
int cnt[105];

int main(){
    int N, L;
    scanf("%d%d", &N, &L);

    for (int i=0; i<N; ++i) {
        scanf("%s", &A[i][0]);
    }

    for (int i=0; i<N; ++i) {
        for (int j=0; j<N; ++j) {
            if (i == j)
                continue;

            int diff = 0;
            for (int k=0; k<L; ++k) {
                diff = A[i][k]-A[j][k];
                if (diff != 0)
                    break;
            }

            if (diff > 0)
                cnt[i]++;
        }
    }

    for (int i=0; i<N; ++i) {
        for (int j=0; j<N; ++j) {
            if (cnt[j] == i) {
                printf("%s", &A[j][0]);
            }
        }
    }

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define N 2*10e5
#define precise cout<<fixed<<setprecision(10)
#pragma GCC optimize("O0")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#define rep(i,a,b) for(int i=a;i<b;i++)
#define min3(a,b,c) min(a,min(b,c))
#define nl cout<<"\n";
#define all(v) v.begin(),v.end()
#define F first
#define S second
typedef long long ll;
typedef vector<long long> vl;
typedef vector<pair<long,long>> vp;
void get(ll arr[],ll n){for(ll i=0;i<n;i++) cin>>arr[i];}
ll gcd(ll a,ll b);
ll binpow(ll a,ll b);
void solve()
{
    ll n,x,time;
    cin>>n>>x>>time;
    ll ans=n/x;
    if(n%x!=0) ans++;
    ans= ans*time;
    cout<<ans;nl;
}
int main()
{
 	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t;
	t=1;
	//cin>>t;
	while(t--)
	{
	 	solve();
	}
	//cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}
ll binpow(ll a, ll b) {
   ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

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

int main(){
    int a,b,m;
    cin >> a >> b >> m;
    vector<int> A(a);
    vector<int> B(b);
    rep(i,a) cin >> A[i];
    rep(i,b) cin >> B[i];
    int mina=100100100,minb=100100100;
    rep(i,a) mina=min(mina,A[i]);
    rep(i,b) minb=min(minb,B[i]);
    int ans=mina+minb;
    for(int i=0;i<m;i++){
        int x,y,c;
        cin >> x >> y >> c;
        ans=min(ans,A[x-1]+B[y-1]-c);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
/* {{{ Definitions */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <ios>
#include <utility>
#include <queue>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
/* }}}------------------------------------------- */
int N;
P p[100000];
void solve(){
	sort(p, p + N);
	rep(i, N)
		cout << p[i].second << (i == N - 1 ? "\n" : " ");
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N;
	rep(i, N) {
		cin >> p[i].first;
		p[i].second = i + 1;
	}
		solve();
	return 0;
}


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

int kaibun(int a,int b,string s){
  vector<char> forward(b-a+1);
  vector<char> opposite(b-a+1);
  int number = 0;
  bool p = false;
  
  for(int i=0;i<b-a+1;i++){
	forward.at(i) = s.at(a-1+i);
    opposite.at(i) = s.at(b-1-i);
    if(forward.at(i) == opposite.at(i)){
		number++;
    }    
  }
  if(number==(b-a+1)){
    p = true;
  }
  
  return p;
}

int main() {
  string S;
  cin >> S;
  int N = S.size();
  int N1 = (N-1)/2;
  int N2 = (N+3)/2;
  
  bool a = kaibun(1,N,S);
  bool b = kaibun(1,N1,S);
  bool c = kaibun(N2,N,S);
  
  if(a&&b&&c){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 256
#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>
#include <unordered_map>
#include <unordered_set>
#include  <ctime>
#include <iomanip>
using namespace std;

#define ll                    long long int
#define ull                   unsigned long long int
#define loop(i,a,b)           for(int i=(int)a;i<(int)b;++i)
#define rloop(i,a,b)          for(int i=(int)a;i<=(int)b;++i)
#define loopl(i,a,b)          for(ll i=(ll)a;i<(ll)b;++i)
#define loopr(i,a,b)          for(int i=(int)a;i>=(int)b;--i)
#define count_1(n)            __builtin_popcountll(n)
#define pb                    push_back
#define eb                    emplace_back
#define ab(a)                 (a<0)?(-1*a):a
#define pc                    putchar
#define gc                    getchar
#define mset(a,b,c)           loop(i,0,b) a[i]=c
#define mp                    make_pair
#define itoc(c)               ((char)(((int)'0')+c))
#define all(p)                p.begin(),p.end()
#define max(x,y)              ((x>y)?x:y)
#define min(x,y)              ((x<y)?x:y)
#define mid(s,e)              (s+(e-s)/2)
#define vi                    vector<int>
#define vvi                   vector<vector<int>>
const ll MOD = 1000000007;

ll modpow(ll a, ll b, ll mod) { ll res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a; res%=mod; a = a * a; a%=mod; }return res; }
//ll p(ll a, ll b) { ll res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a;a = a * a; }return res; }

ll fact[300000];
void pre() {
    fact[0] = 1;
    loop(i,1,300000) fact[i] = (i*fact[i-1])%MOD;
}

bool mysort(const pair<ll,ll>& a, const pair<ll,ll>& b) {
    if(a.first == b.first) return(a.second < b.second);
    return(a.first < b.first);
}

ll mdist(pair<ll,ll> a, pair<ll,ll> b) {
    ll ans = abs(a.first - b.first) + abs(a.second - b.second);
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /* code */
    double a,b,h,m; cin >> a >> b >> h >> m;
    double t = 60* h + m;
    double pi = 3.14159265359;
    double vel = (11.0/12.0) * (pi / 30);
    double dist = a*a + b*b - 2 * a * b * cos(vel*t);
    dist = sqrt(dist);
    cout << fixed << setprecision(12) << dist << "\n";
    /* end code */
}

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

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int n, m;
string s;
vector<pair<char, int>> v;

int f(int x) {
	rep(i, 0, m) {
		if (s[x] == v[i].first)
			x += v[i].second;
	}
	return x;
}

template<class T, class U>
T lower_bound_on(T first, T last, const U& value, const function<U(T)>& fn) {
	T it, step, count = last - first;
	while (count > 0) {
		it = first + (step = count / 2);
		if (fn(it) < value)
			first = ++it, count -= step + 1;
		else
			count = step;
	}
	return first;
}

template<class T, class U>
T upper_bound_on(T first, T last, const U& value, const function<U(T)>& fn) {
	T it, step, count = last - first;
	while (count > 0) {
		it = first + (step = count / 2);
		if (!(value < fn(it)))
			first = ++it, count -= step + 1;
		else	
			count = step;
	}
	return first;
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	cin >> skipws;

	read(n, m, s);
	s = ' ' + s + ' ';
	v = vector<pair<char, int>>(m);
	rep(i, 0, m) {
		char c;
		read(v[i].first, c);
		v[i].second = c == 'L' ? -1 : 1;
	}

	int left = upper_bound_on<int, int>(0, n + 2, 1, f);
	int right = lower_bound_on<int, int>(0, n + 2, n + 1, f);

	write(right - left);
}


Measured memory_bytes: 4996
n, m = gets.split.map(&:to_i)

uf = [*0..n]
rank = [0] * (n + 1)

def root uf, i
  uf[i] == i ? i : (uf[i] = root uf, uf[i])
end

m.times do |i|
  x, y  = gets.split.map(&:to_i)
  x = root uf, x
  y = root uf, y

  next if x == y
  if rank[x] > rank[y]
    uf[y] = x
  else
    uf[x] = y
    rank[y] += 1 if rank[x] == rank[y]
  end
end

puts 1.upto(n).count {|i| root(uf, i) == i }

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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);

    int A, B, C;
    cin >> A >> B >> C;

    if(B / C >= A)
        cout << C << "\n";
    else
        cout << B / A << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

    cout << r * r << endl;

    return 0;
}


Measured memory_bytes: 256
using AtCoderBeginnerContest124.Questions;
using AtCoderBeginnerContest124.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest124.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var ab = inputStream.ReadIntArray();

            var coins = 0;
            for (int i = 0; i < 2; i++)
            {
                if (ab[0] > ab[1])
                {
                    coins += ab[0];
                    ab[0] -= 1;
                }
                else
                {
                    coins += ab[1];
                    ab[1] -= 1;
                }
            }

            yield return coins;
        }
    }
}


namespace AtCoderBeginnerContest124
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest124.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest124.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13396
def male_or_female(seat,m_max,m_min,seat_0):
    global seat_check, n_max, n_min
    print(seat)
    s=input()

    if (seat%2==0 and s==seat_0) or (seat%2==1 and s!=seat_0):
        n_min=seat
        seat=int(0.5*(m_max+seat))
        seat_check=seat
            
    else :
        n_max=seat
        seat=int(0.5*(m_min+seat))
        seat_check=seat
            
n_max=int(input())
n_min=0

print(0)
seat_zero=input()
seat_check=int(0.5*n_max)

for i in range(19):
    male_or_female(seat_check, n_max, n_min, seat_zero)


Measured memory_bytes: 3660
#include <iostream>

void ArrayDump(int *A, int N)
{
    for (int i = 0; i < N; i++) {
        std::cout << *(A + i);
        if (i != N - 1) {
            std::cout << " ";
        }
    }
    std::cout << std::endl;
}

int SelectionSort(int *A, int N)
{
    int exchange_num = 0;
    for (int i = 0; i < N; i++) {
        int minj = i;
        for (int j = i; j < N; j++) {
            if (A[j] < A[minj]) {
                minj = j;
            }
        }
        if (i != minj) {
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            exchange_num++;
        }
    }
    return exchange_num;
}

int main(int argc, char* argv[])
{
    int array_size = 0;
    int array[100];

    std::cin >> array_size;
    for (int i = 0; i < array_size; i++) {
        std::cin >> array[i];
    }

    int exchange_num = SelectionSort(array, array_size);
    ArrayDump(array, array_size);
    std::cout << exchange_num << std::endl;
}


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

using namespace std;

int main(){
    int N;
    //cout << "HUI" << endl;
    cin >> N;
    vector<int> A(N);
    for(int i = 0 ; i < N ; i++)
        cin >> A[i];
    A[0]--;
    for(int i = 1 ; i < N ; i++){
        if(A[i] < A[i - 1]) return cout << "No", 0;
        if(A[i] > A[i - 1]) A[i]--;
    }
    cout << "Yes";
    return 0;
}

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

int main() {
  double N;
  cin >> N;
 
  vector<int>M(N);
  for (int i = 0; i < N; i++) {
    cin >> M.at(i);
  }
  
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += M.at(i);
  }
  
  double ave = sum / N + 0.5;
  ave = int(ave);
  
  
  int A = 0;
  for (int i = 0; i < N; i++) {
    A += (M.at(i) - ave)*(M.at(i) - ave);
  }
  cout << A << endl;
}

Measured memory_bytes: 256
var
 i,x,s,s1:longint;
begin
 for i:=1 to 3 do
  begin
   read(x);
   if x=5 then inc(s);
   if x=7 then inc(s1);
  end;
 if (s=2) and (s1=1) then write('YES')
  else write('NO');
end.

Measured memory_bytes: 128
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

from numba import njit


def getInputs():
    D = int(readline())
    CS = np.array(read().split(), np.int32)
    C = CS[:26]
    S = CS[26:].reshape((-1, 26))
    return D, C, S


@njit('(i8, i4[:], i4[:, :], i4[:], )', cache=True)
def _compute_score1(D, C, S, out):
    score = 0
    last = np.zeros(26, np.int32)
    for d in range(len(out)):
        i = out[d]
        score += S[d, i]
        last[i] = d + 1
        score -= np.sum(C * (d + 1 - last))
    return last, score


def step1(D, C, S):
    #out = np.zeros(D, np.int32)
    out = []
    LAST = 0
    for d in range(D):
        max_score = -10000000
        best_i = 0
        
        for i in range(26):
            #out[d] = i
            out.append(i)
            last, score = _compute_score1(D, C, S, np.array(out, np.int32))
            if max_score < score:
                max_score = score
                LAST = last
                best_i = i
            out.pop()

        #out[d] = best_i
        out.append(best_i)

    return np.array(out), LAST, max_score


def output(out):
    out += 1
    print('\n'.join(out.astype(str).tolist()))


D, C, S = getInputs()
out, _, score = step1(D, C, S)
output(out)

Measured memory_bytes: 107364
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int 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;
}

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------


int main(){
ll n,a,b;
cin>>n>>a>>b;
cout<<min(n*a,b)<<endl;
}









Measured memory_bytes: 256
n=gets.to_i
words=gets.chomp.to_s

s=Array.new(300010){{W:0,E:0}}
#p s[1][:E]
for i in 0..n-1
    if words[i]=="W"
        s[i+1][:E]=s[i][:E]
        s[i+1][:W]=s[i][:W]+1
    else
  
        s[i+1][:E]=s[i][:E]+1
        s[i+1][:W]=s[i][:W]
    end
end

count=n-1
#p s[0..n-1]
for i in 0..n-1
    #count=[count,(i-s[i][:E])+all[:E]-s[i][:E]].min
    count=[count,s[i][:W]+s[n][:E]-s[i+1][:E]].min
    
end

#p s[0..10]
  p count



Measured memory_bytes: 94492
/*
 * 0151.cpp
 *
 *  Created on: 2011/07/27
 *      Author: isa
 */

#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>

using namespace std;

int main(void){
	int n;
	while(cin >> n && n){
		bool f[n+2][n+2];
		string str;
		int ans=0,tmp;
		memset(f,false,sizeof(f));
		for(int i=0;i<n;i++){
			cin >> str;
			for(int j=0;j<n;j++){
				f[i+1][j+1] = str[j] - '0';
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(f[i+1][j+1] == true){
					int k=0;
					tmp = 0;
					while(f[i+1+k][j+1]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1-k][j+1]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1][j+1+k]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1][j+1-k]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1-k][j+1-k]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f	[i+1-k][j+1+k]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1+k][j+1-k]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1+k][j+1+k]) k++;
					tmp = max(tmp,k);
					ans = max(ans,tmp);
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 988
#include<bits/stdc++.h>
#include<string>
#define pii pair<int, int>
#define mp make_pair
#define ll long long
#define ld long double
#define pb push_back
#define S second
#define F first
using namespace std;

set<pair<int, pair<int, int> > > st[10003];

int fun(int x, int y, int z) {
	return x * x + y * y + z * z + x * y + x * z + y * z;
}

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

	int n;
	cin >> n;
	for (int i = 1; i <= 100; i++) {
		for (int j = 1; j < 100; j++) {
			for (int k = 1; k <= 100; k++) {
				int t = fun(i, j, k);
				if (t <= n) st[t].insert(mp(i, mp(j, k)));
			}
		}
	}

	for (int i = 1; i <= n; i++) cout << st[i].size() << '\n';

}

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

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;

#define all(a) a.begin(), a.end()
#define pb push_back

void solve() {
    int n; cin >> n;
    vector<pair<string, char>> vec(n);
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        reverse(s.begin() + 1, s.end());
        vec[i].second = s[0];
        vec[i].first = s.substr(1, s.size() - 1);
    }
    sort(all(vec));
    ll M = 999999937;
    ll k = 45;
    vvi hash(n);
    for (int i = 0; i < n; i++) {
        hash[i] = vi(vec[i].first.size() + 1);
        for (int j = 1; j < hash[i].size(); j++) {
            hash[i][j] = hash[i][j - 1] * k + vec[i].first[j - 1];
            hash[i][j] %= M;
        }
    }

    vvi cnt(n, vi(26));
    for (int i = 0; i < n; i++) {
        for (auto c : vec[i].first) {
            cnt[i][c - 'a']++;
        }
    }

    ll res = 0;

    vi st;
    vector<pair<char, int>> query;
    for (int i = 0; i < n; i++) {
        while (!st.empty()) {
            int v = st.back();
            if (!(vec[i].first.size() < vec[v].first.size()) && hash[v].back() == hash[i][vec[v].first.size()]) {
                break;               
            } else {
                st.pop_back();
                query.pop_back();
            }
        }
        for (auto q : query) {
            if (cnt[i][q.first - 'a'] + (q.first == vec[i].second) >= q.second) res++;
        }
        st.push_back(i);
        query.push_back({vec[i].second, cnt[i][vec[i].second - 'a'] + 1});
    }
    cout << res << endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();
}

Measured memory_bytes: 74084
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define INF 10000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> p;

ll modpow(ll x, ll n) {
    ll res=1;
    while(n>0) {
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

int main(void) {
    ll N, C;
    cin >> N >> C;
    ll i, j, D[30][30];
    ll ans=INF;
    ll pre[3][30]={0}, col, c[500][500];
    for(i=0; i<C; i++) {
        for(j=0; j<C; j++) {
            cin >> D[i][j];
        }
    }
    
    for(i=0; i<N; i++) {
        for(j=0; j<N; j++) {
            cin >> c[i][j];
            c[i][j]--;
        }
    }
    
    for(col=0; col<C; col++) {
        for(i=0; i<N; i++) {
            for(j=0; j<N; j++) {
                pre[(i+j)%3][col]+=D[c[i][j]][col];
            }
        }
    }
    ll c0, c1, c2;
    for(c0=0; c0<C; c0++) {
        for(c1=0; c1<C; c1++) {
            for(c2=0; c2<C; c2++) {
                if(c0==c1 || c1==c2 || c2==c0)
                    continue;
                
                ans=min(ans, pre[0][c0]+pre[1][c1]+pre[2][c2]);
                
            }
        }
     }
    
    cout << ans << endl;
}


Measured memory_bytes: 2176
#include <stdio.h>
int main()
{
    int n, max = 0, cnt;
    scanf("%d", &n);
    int H[n];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &H[i]);
    }
    for (int i = 0; i < n - max; i++)
    {
        cnt = 0;
        for (int j = i + 1; j + cnt < n;)
        {
            if (H[j + cnt] <= H[i + cnt])
                cnt++;
            else
                break;
        }
        if (cnt > max)
            max = cnt;
    }

    printf("%d\n", max);
    return 0;
}


Measured memory_bytes: 512