akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    int a[100005];
    int n;
    cin>>n;
    int i;
    for(i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+n+1);

    long long j=0,r=0,t=0;
    for(i=n; i>0; i--)
    {
        if(a[i]!=t)
        {
            t=a[i];
        }
        else
        {
            break;
        }
    }

    for(j=i-1; j>0; j--)
    {
        if(a[j]!=r)
        {
            r=a[j];
        }
        else
        {
            break;
        }
    }

    if(i==0||j==0)
    {
        cout<<"0"<<endl;
    }
    else
    {
        printf("%lld",t*r);
    }

    return 0;
}

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

int main() {
    ll int n, ans = 0;
    cin >> n;
    vector<ll int> a(3 * n);
    rep(i, 3 * n) { cin >> a.at(i); }
    sort(a.begin(), a.end());
    for (int i = n; i < 3 * n; i += 2) {
        ans += a.at(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5552
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int r, c, k;
    cin >> r >> c >> k;
    map<P, ll> mp;
    rep(i, k){
        int r, c, v;
        cin >> r >> c >> v;
        r--;
        c--;
        mp[make_pair(r, c)] = v;
    }

    vector<vector<vector<ll>>> dp(r, vector<vector<ll>>(c, vector<ll>(4, 0)));
    dp[0][0][1] = mp[make_pair(0, 0)];
    
    rep(i, r)rep(j, c){
        P p = make_pair(i, j);
        if(i == 0 && j == 0)continue;
        else if(i == 0){
            rep(n, 3){
                dp[i][j][n+1] = max(dp[i][j-1][n+1], dp[i][j-1][n] + mp[p]);
            }
        }else if(j == 0){
            dp[i][j][1] = dp[i-1][j][1] + mp[p];
            dp[i][j][0] = dp[i-1][j][1];
        }else{
            rep(n, 4)dp[i][j][n] = dp[i][j-1][n];
            rep(n, 4){
                dp[i][j][0] = max(dp[i][j][0], dp[i-1][j][n]);
            }
            if(mp.find(p) != mp.end()){
                rep(n, 4){
                    dp[i][j][1] = max(dp[i][j][1], dp[i-1][j][n] + mp[p]);
                }
                rep(n, 3){
                    dp[i][j][n+1] = max({dp[i][j][n+1], dp[i][j-1][n] + mp[p]});
                }
            }
        }
    }
    ll ans = 0;
    rep(i, 4)ans = max(ans, dp[r-1][c-1][i]);
    cout << ans << endl;
}

Measured memory_bytes: 649020
#include<bits/stdc++.h>
 #define inf 0x3f3f3f3f
 #define esp 1e-6
 using namespace std;
 int read(){
	 int x=0,f=1;char ch=getchar();
	 while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	 while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	 return x*f;
 }
 
double n;
struct node{
	int c;
	double v;
	double rate;
}num[10];

bool mmp(node a,node b){return a.rate<b.rate;}

int main(){
	for (int i=1;i<=4;i++)	{
		num[i].c=read();
		num[i].v=1.0/8*(1<<i);
		num[i].rate=num[i].c/num[i].v;
	}
	sort(num+1,num+5,mmp);
	n=read();
	int index=1;
	long long ans=0;
	while(index<=4){
		long long x=(long long)(n/num[index].v);
		ans=ans+x*num[index].c;
		n=n-x*(num[index].v);
		index++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <sstream>

using namespace std;

int main(){
	
	int t;
	cin >> t;
	
	for(int loop = 0; loop < t; loop++){
		
		int n, k;
		
		cin >> n >> k;
		
		vector<int> v;
		
		int pre;
		cin >> pre;
		for(int i = 1; i < n; i++){
			int cur;
			cin >> cur;
			v.push_back(cur - pre);
			pre = cur;
		}
		
		sort(v.begin(), v.end());
		
		int ans = 0;
		
		for(int i = 0; i < n - k; i++){
			ans += v[i];
		}
		
		cout << ans << endl;
		
	}
	
	return 0;
}

Measured memory_bytes: 3616
// The very basic /////////////////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define ALL_H 1

// Print elements of containers using << operator /////////////////////////////
// pair
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
  return s << "(" << p.first << ", " << p.second << ")";}
// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  for (auto &elem : v) {
    s << elem;
    if (&elem != &v.back()) s << " ";
  }
  return s;
}
// 2 dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  for (auto &elem : vv) {
    s << elem;
    if (&elem != &vv.back()) s << endl;
  }
  return s;
}
// map
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
  s << "{" << endl;
  for (auto &elem: m) {
    s << " " << elem.first << " : " << elem.second << endl;
  }
  s << "}";
  return s;
}
//set
template<typename T> ostream& operator<<(ostream& s, const set<T>& m) {
  s << "{ ";
  for (auto &elem: m) {
    s << elem << " ";
  }
  s << "}";
  return s;
}

// Convenient macros //////////////////////////////////////////////////////////

// types
#define ll long long
#define ld long double
#define int ll
#define Pi pair<int, int>
#define Graph vector<vector<int>>
#define WeightGraph vector<vector<Pi>>

// other
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

#define MOD 1000000007
#define INF LLONG_MAX/100

// update max or min //////////////////////////////////////////////////////////

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

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

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


// Debug it by D(x) ///////////////////////////////////////////////////////////
#define DEBUG 1
#if DEBUG
#define D(x) x
#else
#define D(x)
#endif

///////////////////////////////////////////////////////////////////////////////
//                             Start Coding Here                             //
///////////////////////////////////////////////////////////////////////////////

signed main() {
  int N, M; cin >> N >> M;
  cout  << (N == M ? "Yes": "No") << endl;
}


Measured memory_bytes: 256
void main(){
	int n = _scan();
	int[] a = _scanln();
	bool approve = true;
	foreach(elm; a){
		if(elm%2 == 0){
			if( elm%3==0 || elm%5==0 )continue;
			else{
				approve = false;
				break;
			}
		}
	}
	writeln(approve? "APPROVED": "DENIED");
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2716
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <cmath>
typedef long long LL;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  LL N;
  cin >> N;
  vector<LL> A(N);
  vector<LL> Aorg(N);
  rep(i,N){
    cin >> A[i];
    Aorg[i]=A[i];
  }
  sort(A.rbegin(),A.rend());
  
  rep(i,N){
    if(A[0]==Aorg[i]){
      cout <<A[1] << "\n";
    }else{
      cout << A[0] << "\n";
    }
  }
  
  return 0;
}

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

#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define bitcount __builtin_popcount //count no's of ones in a set bit
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
ios_base::sync_with_stdio(false); \
cin.tie(0);                       \
cout.tie(0);
#define test  \
int t;    \
cin >> t; \
while (t--)
#define debug(a)          \
	cerr << #a << ": ";   \
for (auto i : a)      \
	cerr << i << " "; \
cerr << '\n';
#define trace(a) cerr << #a << ": " << a << "\n"
#define print(ar, n)            \
for (int u = 0; u < n; u++) \
	{                           \
		cout << ar[u] << " ";   \
	}                           \
	cout << endl;
#define int long long
#define M 1000000007
	signed main()
	{
		rootdada;
// #ifndef ONLINE_JUDGE
// 		freopen("input.txt", "r", stdin);
// 		freopen("output.txt", "w", stdout);
// 		freopen("error.txt", "w", stderr);
// #endif
		int n;
		cin>>n;
		int x=100;
		int c=0;
		while(true)
		{
			x=x+(0.01)*x;
			c++;
			if(x>=n)
				break;
		}
		cout<<c<<endl;
	}

Measured memory_bytes: 3648
implicit none

integer :: n, m
integer :: i

read *, n

m = 0
do i = 1, n
   if (i < 10) then
      m = m + 1
      cycle
   else if (99 < i .and. i < 1000) then
      m = m + 1
      cycle
   else if (9999 < i .and. i < 100000) then
      m = m + 1
      cycle
   endif
enddo

write(6,'(i0)') m

stop
end

Measured memory_bytes: 768
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	char x, y;
	cin >> x >> y;
	cout << (x < y ? "<" : x == y ? "=" : ">") << endl;
	return 0;
}
 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

typedef long long ll;


const ll MOD=998244353,NMAX=3*1e5+1;

ll n,a,b,k,ans=0,factorielle[NMAX];

ll fast_exp(ll x,ll m){
	if(m==0) return 1;
	if(m%2==0){
		return fast_exp(x*x%MOD,m/2);
	}
	return x*fast_exp(x*x%MOD,m/2)%MOD;
}

ll modInv(ll x){
	return fast_exp(x,MOD-2);
}

ll comb(ll k,ll m){
	if(k>m || k<0 || m<0) return 0;
	if(k==m || k==0) return 1;
	return ((factorielle[m]*modInv(factorielle[k]))%MOD)*modInv(factorielle[m-k])%MOD;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n >> a >> b >> k;
    
    factorielle[0]=1;
    for(int i=1;i<=n;i++){
		factorielle[i]=(i*factorielle[i-1])%MOD;
	}
	
    for(ll u=0;u<=n;u++){
		

		if((k-u*a)%b==0){
			ll v=(k-u*a)/b;
			//cout << u << ' ' << v << endl;
			//cout << comb(u,n) << ' ' << comb(v,n) << endl;
			ans+=comb(u,n)*comb(v,n)%MOD;
			ans%=MOD;
		}
	}
	
	cout << ans << '\n';
    
    return 0;
}

Measured memory_bytes: 2688
#include <iostream>
using namespace std;
int main(void){
    
    //最高気温 「　highTemperature　」と最低気温「　lowTemperature　」置く
    int highTemperature, lowTemperature;
    


    //繰返し：一週間（７回）入力を繰返す
    for(int i = 0; i < 7; i++){
        
        //最高気温 「　highTemperature　」と最低気温「　lowTemperature　」置く
        cin >> highTemperature >> lowTemperature;
        
        //出力：最高気温と最低気温の差を求める
        cout << highTemperature - lowTemperature << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3104
/**
    *Makacha
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

template <typename T> inline void read (T &x) {bool b = 0; char c; while (!isdigit (c = getchar()) && c != '-');
if (c == '-') c = getchar(), b = 1; x = c - 48; while (isdigit(c = getchar())) x = (x<<3) + (x<<1) + c - 48; if (b)x=-x;}
template <typename T> inline void wrip(T x) {if (x > 9) wrip(x / 10); putchar(x%10 + 48); }

template <typename T> inline void write(T x) {if (x < 0) putchar('-'), x = -x; wrip(x); putchar(' ');}
template <typename T> inline void writeln(T x) {if (x < 0) putchar('-'), x = -x; wrip(x); putchar('\n');}
inline char readch() {char c; do c = getchar(); while (c == '\n' || c == ' '); return c;}
inline void reads(string &s) {char c; while((c=getchar())==' '||c =='\n'); s=c; while((c=getchar())!=' '&&c!='\n') s+=c;}
inline void getlines(string &s) {char c; while((c=getchar())=='\n'); s=c; while((c=getchar())!='\n') s+=c;}
typedef const int csint;

#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair <int, int> ii;
typedef vector <int> vi;

const ld pi = acos(-1);
const int inf = 2e9 + 11;
const int mod = 1e9 + 7;
const int N = 1e6 + 11;

int n, m, res, a[N], tg[N];
ii f[N];
#define lastbit(x) (__builtin_ctz(x))
int main() {
    #ifdef makacha
        freopen("m.inp", "r", stdin);
        freopen("m.out", "w", stdout);
    #endif //makacha
    read(m);
    n = 1 << m;
    for (int i = 0; i < n; i++)
        read(a[i]);
    for (int i = 0; i < n; i++)
        f[i].fi = a[i];
    for (int j = 0; j < m; j++)
        for (int i = 0; i < n; i++)
            if ((i >> j & 1)) {
                int k = i ^ (1 << j);
                tg[0] = f[i].fi,
                tg[1] = f[i].se,
                tg[2] = f[k].fi,
                tg[3] = f[k].se,
                sort(tg, tg + 4);
                f[i] = ii(tg[3], tg[2]);
            }
    for (int i = 1; i < n; i++) {
        res = max(res, f[i].fi + f[i].se);
        writeln(res);
    }
}


Measured memory_bytes: 13312
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int a,b;
int main(){
    cin>>a>>b;
    cout<<a-b+1<<endl;
    return 0;
}

Measured memory_bytes: 256
#素因数分解、計算量はO(√N)
from collections import defaultdict
def factorize(n):
  b = 2
  dic = defaultdict(lambda: 0)
  while b * b <= n:
    while n % b == 0:
      n //= b
      dic[b] += 1
    b = b + 1
  if n > 1:
    dic[n] += 1
  return dic
N = int(input())
fct = factorize(2*N)
lis = []
for k,v in fct.items():
  lis.append(pow(k,v))
ans = 10**18
from itertools import groupby, accumulate, product, permutations, combinations
for pro in product([1,0],repeat=len(lis)):
  prod1 = 1
  for i,p in enumerate(pro):
    if p==1:
      prod1 *= lis[i]
  prod2 = (N*2)//prod1
  if prod1<prod2:
    # prod1,prod2 = prod2,prod1
    continue
  for i in range(1,prod2+1):
    if prod1*i>ans:
      break
    if (prod1*i-1)%prod2==0:
      ans = min(ans, prod1*i-1)
      break
    if (prod1*i+1)%prod2==0:
      ans = min(ans, prod1*i)
      break
print(ans)



Measured memory_bytes: 68852
#include <stdio.h>

int main(){
    int n, k, l[50];
    scanf("%d %d", &n, &k);
    
    for(int i=0; i<n; i++){
        scanf("%d" , &l[i]);
        for(int j=i; l[j-1]<l[j] && j>0; j--){
            int t = l[j-1];
            l[j-1] = l[j];
            l[j] = t;
        }
    }
    
    int sum = 0;
    for(int i=0; i<k; i++){
        sum += l[i];
    }

    printf("%d", sum);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()

void dijkstra(
    const vector<map<ll, array<ll, 2>>>& net,
    vector<ll>& out,
    ll start, ll dist_idx
){
    out.resize(net.size(), numeric_limits<ll>::max());
    out.at(start) = 0;
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> q;
    q.push(make_pair(0, start));
    while(!q.empty()){
        auto p = q.top();
        q.pop();
        if(out.at(p.second) < p.first){
            continue;
        }
        for(auto e : net.at(p.second)){
            if(out.at(e.first) > out.at(p.second) + e.second.at(dist_idx)){
                out.at(e.first) = out.at(p.second) + e.second.at(dist_idx);
                q.push(make_pair(out.at(e.first), e.first));
            }
        }
    }
}

int main(){
    ll n, m, s, t;
    cin >> n >> m >> s >> t;
    s--; t--;
    vector<map<ll, array<ll, 2>>> net(n);

    REP(i, m){
        ll ui, vi, ai, bi;
        cin >> ui >> vi >> ai >> bi;
        ui--; vi--;
        net.at(ui)[vi] = {ai, bi};
        net.at(vi)[ui] = {ai, bi};
    }

    vector<ll> dist_s, dist_t;
    dijkstra(net, dist_s, s, 0);
    dijkstra(net, dist_t, t, 1);

    vector<ll> total_cost(n);
    REP(i, n){
        total_cost.at(i) = dist_s.at(i) + dist_t.at(i);
    }

    vector<ll> mincost(n);
    RREP(i, n){
        mincost.at(i) = total_cost.at(i);
        if(i + 1 < n){
            mincost.at(i) = min(mincost.at(i), mincost.at(i + 1));
        }
    }

    REP(i, n){
        cout << 1000000000000000LL - mincost.at(i) << endl;
    }
    return 0;
}


Measured memory_bytes: 22144
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

const ll INF = 1e18;
const int MAX_N = 1e4;

ll g[MAX_N][MAX_N];
ll dist[MAX_N];
int N,M,R;

void wf(){
  REP(k, N){
    REP(i, N){
      REP(j, N){
	g[i][j] = min(g[i][j], g[i][k]+g[k][j]);
      }
    }
  }
}

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

  cin >> N >> M >> R;
  vector<ll> r(R);
  REP(i,R) cin >> r[i], r[i]--;
  sort(r.begin(), r.end());
  //wfで INFにするの 忘れない
  REP(i, N) REP(j, N) g[i][j] = INF;
  REP(i, N) g[i][i] = 0;
  
  REP(i,M){
    ll a,b,c;
    cin >> a >> b >> c;
    a--; b--;
    g[a][b] = c;
    g[b][a] = c;
  }
  
  wf();
  
  ll ans = INF;
  while(next_permutation(r.begin(), r.end())){
    ll res = 0;
    REP(i, R-1) res += g[r[i]][r[i+1]];
    ans = min(ans, res);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;

int main(void) {
	int num, k, i, n;
	ll ans = 1e20;
	cin >> num >> k;
	vector<pair<int, int>> d(num);
	vector<ll> x(num), y(num);
	for (i = 0; i < num; i++) {
		scanf("%d%d", &d[i].first, &d[i].second);
		x[i] = d[i].first;
		y[i] = d[i].second;
	}
	sort(d.begin(), d.end());
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	for (int xl = 0; xl < num; xl++) {
		for (int xr = xl + k - 1; xr < num; xr++) {
			for (int yl = 0; yl < num; yl++) {
				for (int yr = yl + k - 1; yr < num; yr++) {
					n = 0;
					for (i = xl; i <= xr; i++) {
						if (d[i].second >= y[yl] && d[i].second <= y[yr])
							n++;
					}
					if (n >= k)
						ans = min(ans, (x[xr] - x[xl]) * (y[yr] - y[yl]));
				}
			}
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
l = li()

l.sort()

ans = 0
from bisect import bisect_left
for i in range(len(l)-2):
    for j in range(i+1,len(l)-1):
        ab = l[i] + l[j]
        r = bisect_left(l, ab)
        ll = j+1
        ans += max(0, r-ll)

print(ans)


Measured memory_bytes: 3188
N = int(input())
A = list(map(int,input().split()))
count = 1
increase = False
decrease = False
for i in range(1,N):
    if A[i-1] == A[i]:
        continue
    elif increase and A[i-1] < A[i]:
        continue
    elif decrease and A[i-1] > A[i]:
        continue
    elif not increase and not decrease and A[i-1] < A[i]:
        increase = True
    elif not increase and not decrease and A[i-1] > A[i]:
        decrease = True
    else:
        count += 1
        increase = False
        decrease = False
print(count)

Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));


#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl


signed main(){
  int N; cin >> N;
  vector<int> X(N), Y(N);
  REP(x, N) cin >> X.at(x) >> Y.at(x);

  vector<int> v(N);
  REP(x, N) v.at(x) = x;

  double sum = 0.0;

  do {
    FOR(x, 1, N) {
      int i = v.at(x);
      int j = v.at(x-1);
      int dx = (X.at(i) - X.at(j)) * (X.at(i) - X.at(j));
      int dy = (Y.at(i) - Y.at(j)) * (Y.at(i) - Y.at(j));
      sum += pow(dx+dy, 0.5);
    }
  } while(next_permutation(v.begin(), v.end()));

  int f = 1;
  FOR1(x, N){f *= x;}

  printf("%.10f\n", sum / f);
}


Measured memory_bytes: 384
def newton(xn, q)
  if (xn ** 3 - q).abs < q * 10 ** -5
    return xn
  else
    newton(xn - (xn ** 3 - q) / (3 * xn ** 2), q)
  end
end
def main(input = STDIN)
  while (q = input.gets.to_i) != -1
    puts newton(1.0, q)
  end
end
main

Measured memory_bytes: 6192
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr int MOD_TYPE = 1;
constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

#pragma endregion

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

  ll n, k;
  cin >> n >> k;
  ll ans = k;
  rep(i, n - 1) ans *= k - 1;
  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
#define sz(a) int((a).size())

int a, b, k;
set<int> s;

signed main()
{
	IOS;
	cin >> a >> b >> k;
	for (int i = a; i <= b && i < (a+k); i++)
		s.insert(i);
	for (int i = b; i >= a && i > (b-k); i--)
		s.insert(i);
	for (auto i: s)
		cout << i << endl;
	return 0;
}


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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

constexpr static int MOD = 1000000000 + 7;
constexpr static int inf = INT_MAX / 2;
constexpr static llong INF = 1LL << 31;
constexpr static int dx[] = {1, 0, -1, 0};
constexpr static int dy[] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0); 
    ios::sync_with_stdio(false);
    
    int n, k;
    cin >> n >> k;
    if (k == 1) {
        cout << fixed << setprecision(20) << 1.0 << endl;
        return 0;
    }

    long double ans = 0;
    if (k <= n) {
        ans += (long double)(n - (k - 1)) / n;
    }
    // cout << fixed << setprecision(15) << ans << endl;

    long double subans = 0;
    for (int i = 1; i <= min(n, k - 1); ++i) {
        int t = ceil(log2(ceil((long double)k / i)));
        // cout << t << endl;
        subans += pow((long double)0.5, t);
    }
    ans += subans / n;

    cout << fixed << setprecision(20) << ans << endl;
    
    return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 9e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

ll N;
VL a, x;
ll sum;

signed main() {
    cin >> N;
    REP(i, N) {
        a.emplace_back(IN());
        if(i != N - 1) {
            sum += a[i] * (i % 2 ? -1 : 1);
        }
    }
    x.resize(N);
    x[0] = sum + a[N - 1];
    REP(i, N) {
        if(i != 0) {
            x[i] = 2 * a[i - 1] - x[i - 1];
        }
        cout << x[i] << " ";
    }
    cout << "\n";
}


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main(int argc, char *argv[])
{
    string line, res;
    while (getline(cin, line), line != ".") {
        stack<char> st;
        res = "yes";
        for (int i = 0; i < line.size(); ++i) {
            char tmp = line[i];
            if (tmp == '(' || tmp == '[') {
                st.push(tmp);
            } else if (tmp == ')') {
                if (st.empty() || st.top() != '(') {
                    res = "no";
                    break;
                }
                st.pop();
            } else if (tmp == ']') {
                if (st.empty() || st.top() != '[') {
                    res = "no";
                    break;
                }
                st.pop();
            }
        }
        if (!st.empty())
            res = "no";
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
struct edge{
  int u, v, d, c;
  edge(int u, int v, int d, int c) : 
    u(u), v(v), d(d), c(c) {}
  bool operator < (const edge& e) const {
    if(d != e.d) return d > e.d;
    else return c > e.c;
  }
};
typedef vector<edge> edges;

int main(){
  int N, M;
  while(cin>>N>>M && N){
    vector<edges> g(N);
    REP(i, M){
      int u, v, d, c;
      cin>>u>>v>>d>>c;
      u--, v--;
      g[u].push_back(edge(u, v, d, c));
      g[v].push_back(edge(v, u, d, c));
    }
    priority_queue<edge> que;
    int ans = 0;
    vector<bool> used(N);
    used[0] = true;
    FORIT(it, g[0]) que.push(*it);
    while(!que.empty()){
      edge e = que.top(); que.pop();
      if(used[e.v]) continue;
      //printf("edge(%d, %d, %d, %d)\n", e.u, e.v, e.d, e.c);
      ans += e.c;
      used[e.v] = true;
      FORIT(it, g[e.v])if(!used[it->v]) que.push(edge(it->u, it->v, it->d + e.d, it->c));
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i < n;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  int kekka = 0;
  int i = 0;
  while(i < n-1){
    int j = 1;
    while(true){
      if(i < n-1){
        if(a.at(i) == a.at(i+1)){
          j++;
          i++;
        }
        else{
          break;
        }
      }
      else{
        break;
      }
    }
    i++;
    if(j % 2 != 0){
      kekka++;
    }
  }
  if(a.at(n-2) != a.at(n-1)){
    kekka++;
  }
  cout << kekka << endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;
void insertsort(int *A, int N);
void insertsort(int *A, int N) {
	int v, j;
	for (int i = 1; i <= N; i++) {
		cout << A[0];
		for (int k = 1; k < N; k++) {
			cout << " " << A[k];
		}
		cout << endl;
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
	}
}

int main() {
	int N;
	int A[100];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	insertsort(A, N);

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define sset(s) cout<<#s<<":";each(i,s)cout <<" "<<i;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 1300000;

int prime[MAX_N];
bool is_prime[MAX_N];

int sieve(int n)
{
	int p = 0;
	for(int i=0;i<=n;i++){
		is_prime[i] = true;
	}
	is_prime[0] = is_prime[1] = false;
	for(int i=2;i<=n;i++){
		if(is_prime[i]){
			prime[p++] = i;
			for(int j=2*i;j<=n;j+=i){
				is_prime[j] = false;
			}
		}
	}
	return p;
}


int main()
{
    sieve(1299709);
    while(1){
        int n;
        cin >> n;
        if(n == 0){
            break;
        }
        if(is_prime[n]){
            cout << "0\n";
            continue;
        }
        int i = 0;
        while(prime[i] < n){
            i++;
        }
        cout << prime[i] - prime[i-1] << "\n";
    }
}

Measured memory_bytes: 4724
str = gets.chomp.chars
MAXNUM = 1000000

anum = MAXNUM
znum = -MAXNUM

str.each_with_index do |s, i|
  if s == "A" && i < anum
    anum = i 
  end

  if s == "Z" && i > znum
    znum = i
  end
end

puts znum - anum + 1

Measured memory_bytes: 16764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int q = C / B;
  if(C % B >= 1) {
    q++;
  }
  int w = A / D;
  if(A % D >= 1) {
    w++;
  }
  if(w >= q) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3648
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s[s.length()-1]=='s'){
        cout<<s<<"es"<<endl;
    }else{
        cout<<s<<"s"<<endl;
    }
    return 0;
}

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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  int n, m;
  cin >> n >> m;
  int stu_x[n];
  int stu_y[n];
  int check_x[m];
  int check_y[m];

  for (int i = 0; i < n; i++) {
    cin >> stu_x[i] >> stu_y[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> check_x[i] >> check_y[i];
  }
  int min;
  int ans;
  for (int i = 0; i < n; i++) {
    ans = 0;
    min = inf;
    for (int j = 0; j < m; j++) {
      int dis_x = abs(stu_x[i] - check_x[j]);
      int dis_y = abs(stu_y[i] - check_y[j]);
      int DIS = dis_x + dis_y;
      if (DIS < min) {
        ans = j + 1;
        min = DIS;
      }
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long int;
using namespace std;
ll mod=1e9+7;
      
      
int main(){
  int n;
  cin >> n;
  int a[n]={};
  for(int i=0;i<n-1;i++){
    int q;
    cin >> q;
    a[q-1]++;
  }
  for(int i=0;i<n;i++)cout << a[i] << endl;
}

Measured memory_bytes: 4416
#include<stdio.h>
#include<string.h>

#define MAX 100000
#define LEN 15

struct node{
  int right;
  int left;
  int dep;
  int par;
  char type[LEN];
};

struct node T[MAX];

void deps(int a, int b){
  T[a].dep = b;
  if(T[a].right != -1){
    deps(T[a].right,b);
  }
  if(T[a].left != -1){
    deps(T[a].left,b+1);
  }
}


void printC(int a){
  int c;
  c=T[a].left;
  printf("[");
  while(c!= -1){
    printf("%d", c);
    if(T[c].right != -1){
      printf(", ");
    }
      c= T[c].right;
  }
  printf("]\n");
  
}


int main(){

  int i,j,k,c[MAX],id,root,n;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].par = T[i].left = T[i].right = -1;
  }
  
  for(i=0;i<n;i++){
    scanf("%d%d",&id,&k);
    if(k==0){
      c[0] = -1;
    }
    
    for(j=0;j<k;j++){
      scanf("%d", &c[j]);
    }
    
    for(j=0;j<k;j++){
      T[c[j]].par = id;
      if(j != k-1){
	T[c[j]].right = c[j+1];
      }
    }  
    T[id].left = c[0];
  }
  
  for(i=0;i<n;i++){
    if(T[i].par == -1) root = i;
  }

  deps(root, 0);
      
  for(i=0;i<n;i++){
    if(T[i].par == -1){
      strcpy(T[i].type, "root");
    }
    else if(T[i].left == -1){
      strcpy(T[i].type, "leaf");
    }
    else{
      strcpy(T[i].type, "internal node");
    }
    printf("node %d: parent = %d, depth = %d, %s, ", i, T[i].par, T[i].dep, T[i].type);
    printC(i);
  }
  return 0;
}



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

int main(){
    int N;
    cin >> N;
    int a[300000];
    for(int i=0;i<3*N;i++)
        cin >> a[i];
    //降順ソート
    sort(a, a + 3*N, greater<int>());
    long long ans = 0;
    for(int i=1;i<2*N;i+=2){
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String[] args){
		solve();
	}

	public static void solve(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		ArrayList<ArrayList<Integer>> graph = new ArrayList<ArrayList<Integer>>();
		for(int i=0;i<n;i++){
			graph.add(new ArrayList<Integer>());
		}
		//int[] a = new int[m];
		//int[] b = new int[m];
		for(int i=0;i<m;i++){
			//a[i] = sc.nextInt();
			//b[i] = sc.nextInt();
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			ArrayList<Integer> list = graph.get(a);
			list.add(b);
			list = graph.get(b);
			list.add(a);
		}
		boolean judge = true;
		int ans = 0;
		while(judge){
			judge = false;
			for(int i=0;i<n;i++){
				ArrayList<Integer> list = graph.get(i);
				if(list.size()==1){
					judge = true;
					ans++;
					int k = list.get(0);
					list.remove(0);
					list = graph.get(k);
					for(int j=0;j<list.size();j++){
						if(list.get(j)==i){
							list.remove(j);
							break;
						}
					}
				}
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            for (; ; )
            {
                string[] strs = Console.ReadLine().Split(' ');
                int a = int.Parse(strs[0]);
                string op = strs[1];
                int b = int.Parse(strs[2]);
                if (op == "+")
                {
                    Console.WriteLine(a + b);
                }
                else if (op == "-")
                {
                    Console.WriteLine(a - b);
                }
                else if (op == "*")
                {
                    Console.WriteLine(a * b);
                }
                else if (op == "/")
                {
                    Console.WriteLine(a / b);
                }
                else
                {
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 19940
/*
    非負整数 n について、n>1 のときに n/10 を行う回数が求めるそれ
*/

#include <stdio.h>

int main() {
    int a, b, k;
    double c;

    while(scanf("%d%d", &a, &b) != EOF) {
        k=0;
        c = a+b;

        while(c >= 1.0) {
            c = c/10.0;
            k++;
        }

        printf("%d\n", k);
    }

    return 0;
}

Measured memory_bytes: 600
import numpy
h, w, a, b = map(int,input().split())
s = numpy.zeros([h,w],int)
for i in range(h):
    ans = []
    for j in range(w):
        if i < b and j < a:
            ans.append("1")
        elif i < b and a <= j:
            ans.append("0")
        elif b <= i and j < a:
            ans.append("0")
        else:
            ans.append("1")
    print("".join(ans))






Measured memory_bytes: 21296
from collections import defaultdict

def dfs(i, V, E, x):
    S = [i]
    while(len(S) > 0):
        vi = S.pop()
        p = x[vi]
        for j in E[vi]:
            if V[j] == 0:
                V[j] = 1
                x[j] += p
                S.append(j)
    return V, x

n, q = map(int, input().split())
V = [0 for _ in range(n + 1)]
E = [[] for _ in range(n + 1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    E[a].append(b)
    E[b].append(a)

x = [0 for _ in range(n + 1)]
for i in range(q):
    pi, xi = map(int, input().split())
    x[pi] += xi

V[1] = 1
V, x = dfs(1, V, E, x)
print(*x[1:])


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

int main() {
  int a,b,c,d;
  
  cin >> a >> b >> c >> d;
  
  if((c >= a && c <= b) && (d >= a && d <= b)){
    //  A------B
    //    C--D
    cout << d - c;
  }else if((a >= c && a <= d) && (b >= c && b <= d)){
    //    A--B
    //  C------D
    cout << b - a;
  }else if(a <= c && (b >= c && b <= d)){
    //   A----B
    //     C----D
    cout << b - c;
  }else if(c <= a && (d >= a && d <= b)){
    //     A----B
    //   C----D
    cout << d - a;
  }else{
    //          A----B
    //   C----D
    cout << 0;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  ld l; cin >> l;
  ld a = l / 3;
  outl(a * a * a);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int N = 1000 + 5;
int p[N],c[N];
ll dp[200005];

int main(){
	int h,n;
	cin >> h >> n;
	for(int i = 0; i < n; i++)
		cin >> c[i] >> p[i];
	int w = 2e4;
	memset(dp,INF,sizeof(dp));
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = c[i]; j <= w; j++){
			dp[j] = min(dp[j],dp[j-c[i]]+p[i]);
		}
	}
	int ans = dp[h];
	for(int i = h+1; i <= w; i++){
		if(dp[i] <= ans)
			ans = dp[i];
	}
    cout << ans << endl;
    return 0;
}

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

using namespace std;

long long n, ans = 0;

void dfs(long long v, int mask){
    if (n < v) return;
    if (mask == 7) ans++;
    dfs(v*10 + 3, mask | 1);
    dfs(v*10 + 5, mask | 2);
    dfs(v*10 + 7, mask | 4);
}

int main(){
    cin >> n;
    dfs(0, 0);
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
       int k,i,a,b,c=0;
       scanf("%d %d %d",&k,&a,&b);
       i=a;
       while(i <= b)
       {
              if(i % k == 0)
              {
                     c++;
              }
              i++;
       }
       if(c == 0)
       {
           printf("NG\n");
       }
       else
       {
           printf("OK\n");
       }
       return 0;
}


Measured memory_bytes: 1608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    int a,b;
    cin >> a >> b;
    if ((a+b)%2 == 0)
    cout << (a+b)/2 << endl;
    else 
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 256
import itertools as it

n, m = map(int, input().split())
a = list(list(map(int, input().split())) for _ in range(m))

#無向グラフのルート作成（リスト）
for i in range(len(a)):
    a.append([a[i][1],a[i][0]])

lis  = list(it.permutations(range(2, n + 1)))
for i in range(len(lis)):
    lis[i] = (1,) + lis[i]

lis2 = []
for i in range(len(lis)):
    lis[i] = list(lis[i])
    lis2.append(lis[i])

#ルート探索
ans = 0
for i in range(len(lis2)):
    check = True;
    for j in range(len(lis2[i]) - 1):
        if lis2[i][j : j + 2] not in a:
            check = False;
    if(check):
        ans += 1
print(ans)


Measured memory_bytes: 10172
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

int STACK[1000];
int POINT = 0;

void push(int i){
    STACK[POINT] = i;
    POINT++;
}

int pop(void){
    POINT--;
    return STACK[POINT];
}

int main(void){
    char read[10];
    int l=0;
    int r=0;
    while(scanf("%s ", read)== 1){
        if(read[0] == '+') push(pop()+pop());
        else if(read[0] == '-'){
            r = pop();
            l = pop();
            push(l-r);
        }
        else if(read[0] == '*') push(pop()*pop());
        else if(read[0] == '/'){
            r = pop();
            l = pop();
            push(l/r);
        }
        else{
            push(atoi(read));
        }
    }
    printf("%d\n", pop());
    return 0;
}

Measured memory_bytes: 1852