akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
#define F first
#define S second

const int mxn = 2e5+5;
int n, ps[mxn], pb[mxn];
string s;

int sim(int a){
    int ans = 0;
    //int t = a;
    while(a > 0){
        //cout << a << '\n';
        a = a%__builtin_popcount(a);
        ++ans;
    }
    //cout << t << ": " << ans << '\n';
    return ans;
}

void solve(){
    cin >> n >> s;

    int pc = 0;
    for(int i = 0; i < n; ++i) pc += s[i]=='1';

    int modsmall = pc-1, modbig = pc+1;
    int anss, ansb;

    if(modsmall >= 1){
            ps[0] = 1%modsmall;
        for(int i = 1; i <= n; ++i){
            ps[i] = (2*ps[i-1])%modsmall;
        }

        anss = 0;
        for(int i = 0; i < n; ++i){
            if(s[n-1-i] == '1'){
                anss = (anss + ps[i])%modsmall;
            }
        }
    }

    pb[0] = 1%modbig;
    for(int i = 1; i <= n; ++i){
        pb[i] = (2*pb[i-1])%modbig;
    }

    ansb = 0;
    for(int i = 0; i < n; ++i){
        if(s[n-1-i] == '1'){
            ansb = (ansb + pb[i])%modbig;
        }
    }

    // cout << modsmall << " " << modbig << '\n';
    // cout << anss << " " << ansb << '\n';
    
    //int test = 0b00110111001011011001110;
    //cout << anss << " " << test%modsmall << '\n';
    for(int i = 0; i < n; ++i){
        if(s[i] == '1'){
            //small
            if(modsmall < 1){
                cout << "0\n";
            }
            else{
                int ansn = ((anss - ps[n-1-i]) % modsmall + modsmall) % modsmall;
            // cout << ansn << '\n';
            //int temp = test ^ (1<<(n-1-i));
            //cout << temp%modsmall << " " << ansn%modsmall << '\n';
            //assert(temp%modsmall == ansn%modsmall);
            cout << sim(ansn)+1 << '\n';
            //cout << "-1\n";
            }
        }
        else{
            //big
            int ansn = (ansb + pb[n-1-i]) % modbig;
            // int temp = test ^ (1<<(n-1-i));
            // assert(temp%modbig == ansn%modbig);
            //cout << ansn << '\n';
            cout << sim(ansn)+1 << '\n';
            //cout << "-1\n";
        }
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 5340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1001001001;

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	ll inf = ll(1e18) + 1;
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());

	ll ok = -inf;
	ll ng = inf;
	while (1 < abs(ng - ok)) {
		ll x = ok + abs(ng - ok) / 2;

		// k番目の値となり得るかどうかを判定
		auto is_k = [&] {
			ll total = 0;
			for (int i = 0; i < n; i++) {
				if (a[i] < 0) {
					ll l = -1;  // ng
					ll r = n;   // ok
					while (1 < abs(r - l)) {
						ll c = l + abs(r - l) / 2;
						if (a[i] * a[c] < x) r = c;
						else l = c;
					}
					total += n - r;
				}
				else {
					ll l = -1;  // ok
					ll r = n;   // ng
					while (1 < abs(r - l)) {
						ll c = l + abs(r - l) / 2;
						if (a[i] * a[c] < x) l = c;
						else r = c;
					}
					total += r;
				}
				if (a[i] * a[i] < x) total--;
			}
			total /= 2;
			return total < k;
		}();

		if (is_k) ok = x;
		else ng = x;
	}
	cout << ok << endl;
}

Measured memory_bytes: 1920
fun main(args: Array<String>) {
    val c = mutableListOf<IntArray>();
    (0..2).forEach {
        c.add(readLine()!!.split(" ").map { it.toInt() }.toIntArray())
    }


    /*
        b0 - b1 = c00 - c01
        b0 - b1 = c10 - c11
        b0 - b1 = c20 - c21

        <=> c00 - c01 = c10 - c11 = c20 - c21

        b0 - b2 = c00 - c02
        b0 - b2 = c10 - c12
        b0 - b2 = c20 - c22

        <=> c00 - c02 = c10 - c12 = c20 - c22
     */

    if (
            c[0][0] - c[0][1] == c[1][0] - c[1][1]
            && c[1][0] - c[1][1] == c[2][0] - c[2][1]
            && c[0][0] - c[0][2] == c[1][0] - c[1][2]
            && c[1][0] - c[1][2] == c[2][0] - c[2][2]
    )  {
        println("Yes")
    } else {
        println("No")
    }
}


Measured memory_bytes: 37908
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	int m;	scanf("%d ",&m);
	char field[5][5];
	int memo[5][5];
	while(m--){
		for(int i=0;i<5;i++)for(int j=0;j<5;j++){
			scanf("%c ",field[i]+j);
			if(i==0)	memo[i][j]=(field[i][j]=='1'?1:0);
			else		memo[i][j]=(field[i][j]=='1'?memo[i-1][j]+1:0);
		}

		int amax=0;
		for(int i=0;i<5;i++)for(int j=0;j<5;j++){
			int h=10000;
			for(int w=0;w<5-j;w++){
				h=min(h,memo[i][j+w]);
				amax=max(amax,(w+1)*h);
			}
		}

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

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

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

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int n = in();
  vector<pii> line(n);
  foreach(i,line)i=in<pii>();
  sort(all(line));
  foreach(i,line){
    cout << i.first << " " << i.second << endl;
  }
}



Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int ht[n+1]={0};
	for(int i=1;i<=n;i++)
		cin>>ht[i];
	int dp[n+2]={0};
	dp[1]=0;
	dp[2]=abs(ht[2]-ht[1]);
	for(int i=3;i<=n;i++)
	{
		dp[i]=min(abs(ht[i]-ht[i-1])+dp[i-1],abs(ht[i]-ht[i-2])+dp[i-2]);
	}
	cout<<dp[n];
}

Measured memory_bytes: 4384
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstring>
#include<vector>

using namespace std;

#define long long long
#define ft(i, a, b) for (int i = (long)a ; i <= (long)b ; i++)
#define fd(i, a, b) for (int i = (long)a ; i >= (long)b ; i--)

const int MAXN = 1e5 + 5;
const long oo = 1e15;

long k , ans;
void Solve() {
    ft(i , 1 , k) 
        ft(j , 1 , k)
            ft(l , 1 , k) ans += __gcd(i , __gcd(j , l));
    cout << ans;
}

void FastInput() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen(".inp", "r", stdin);
    //freopen(".out", "w", stdout);
}

void Input() {
    cin >> k;
}

int main() {
    FastInput();
    Input();
    Solve();
}

Measured memory_bytes: 3648
#include<stdio.h>

int main(void)

{

int a,b,c,x;

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

if(a>b){

x=a;

a=b;

b=x;

}

if(a>c){

x=a;

a=c;

c=x;

}

if(b>c){

x=b;

b=c;

c=x;

}

printf("%d %d %d\n",a,b,c);

return 0;

}

Measured memory_bytes: 596
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
template<class _Tp>_Tp max(_Tp a,_Tp b){if(a>b) return a;return b;}
template<class _Tp>_Tp min(_Tp a,_Tp b){if(a<b) return a;return b;}
template<class _Tp>void ckmax(_Tp &a,_Tp b){if(a<b) a=b;}
template<class _Tp>void ckmin(_Tp &a,_Tp b){if(a>b) a=b;}
template<class _Tp>void sswap(_Tp &a,_Tp &b){_Tp c=a;a=b;b=c;}
template<class _Tp>_Tp gcd(_Tp a,_Tp b){return (b==0)?(a):(gcd(b,a%b));}
template<class _Tp>_Tp abs(_Tp a){if(a<0)return-a;return a;}
int read(){
	char ch=getchar();bool f=1;int x=0;
	while((ch<'0' || ch>'9') && ch!='-') ch=getchar();
	if(ch=='-') f=0,ch=getchar();
	while(ch>='0' && ch<='9'){x=x*10+(ch&15);ch=getchar();}
	return f?x:-x;
}
ll readll(){
	char ch=getchar();bool f=1;ll x=0ll;
	while((ch<'0' || ch>'9') && ch!='-') ch=getchar();
	if(ch=='-') f=0,ch=getchar();
	while(ch>='0' && ch<='9'){x=x*10+(ch&15ll);ch=getchar();}
	return f?x:-x;
}
const int inf=1000000000;
const ll mod=1000000007;
ll s,ans;
ll qpow(ll b,ll p){
	ll res=1;
	while(p>0){
		if(p&1)res=res*b%mod;
		b=b*b%mod;
		p>>=1;
	}
	return res;
}
ll calc(ll x){
	if(x==0)return 0;
	return calc(x/10)+1;
}
int main(){
	s=read();
	ll r=1,now=0;
	for(ll l=1;l<1e7;++l){
		while(now+calc(r)<=s){now+=calc(r);++r;}
		if(now==s)ans++;
		now-=calc(l);
	}
	for(ll dig=8;dig<=s;++dig){
		ll r=s%dig;
		if(r==0){
			ans=(ans+qpow(10,dig)-qpow(10,dig-1)-s/dig+1+mod)%mod;
			r=dig;
		}
		ll val=r*(dig+1);
		ll c=dig*(dig+1);
		if(val<s)ans=(ans+(s-val)/c+((s-val)%c>0))%mod;
	}
	printf("%lld\n",ans%mod);
	return 0;
}


Measured memory_bytes: 1604
#include <iostream>
#include <vector>

using namespace std;

int cnt[20][20];

int main(){
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    
    for(int i = 0; i < h; i++){
        for(int j = 0; j < W; j++){
            cnt[i][j] = 1;
        }
    }
    for(int i = 0; i < w; i++){
        for(int j = 0; j < H; j++){
            cnt[j][i] = 1;
        }
    }
    
    int ans = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(!cnt[i][j])      ans++;
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n, m = map(int, input().strip().split())
  ss = []
  for im in range(m):
    x = 0
    for s in map(int, input().strip().split()[1:]):
      x += 2**(s-1)
    ss.append(x)
  ps = list(map(int, input().strip().split()))
      
  count = 0
  for i in range(2**n):
    flag = True
    for j in range(m):
      if bin(i & ss[j]).count('1')%2 != ps[j]:
        flag = False
        break
      
    if flag:
      count += 1
  print(count)

if __name__=='__main__':
  main()



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

using ll = long long;
using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(false)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YN(x)         cout << ((x) ? "YES" : "NO") << endl
#define Yn(x)         cout << ((x) ? "Yes" : "No") << endl
#define yn(x)         cout << ((x) ? "yes" : "no") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;

ll gcd(ll a, ll b) { return __gcd(a, b); }
ll lcm(ll a, ll b) { return (a == 0 || b == 0) ? 0 : (a / __gcd(a, b) * b); }

ll log10_(const ll n) {
	if(n < 1) {
		return -1;
	}

	ll ret = 0;
	ll tmp = n;
	while(tmp / 10 > 0) {
		tmp /= 10;
		++ret;
	}

	return ret;
}

ll pow10(ll n) {
	ll ret = 1;
	rep(i, n) {
		ret *= 10;
	}

	return ret;
}

int main(int argc, const char* argv[]) {
	ll n;
	cin >> n;

	if(n < 10) {
		cout << n << endl;
		return 0;
	}

	ll ret = 0;
	if(log10_(n) % 2 == 0) {
		ret += n - pow10(log10_(n));
		if(log10_(n) != 0) {
			ret++;
		}
	}

	for(ll i = log10_(n) - 1; i >= 0; --i) {
		if(i % 2 == 0) {
			ret += pow10(i+1) - pow10(i);
		}
	}
	
	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#define rep(i,a,b)  for (int i=a; i<(b); ++i)
#define per(i,a,b)  for (int i=(b)-1; i>=(a); --i)
#define fore(c,...) for (auto __VA_ARGS__:(c))
using namespace std;
typedef long long ll;



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

	int N,M,S;
	cin>>N>>M>>S;
	vector<vector<array<int,3>>> adj(N);
	rep(i,0,M) {
		int u,v,a,b;
		cin>>u>>v>>a>>b;
		u--,v--;
		adj[u].push_back({v,a,b});
		adj[v].push_back({u,a,b});
	}

	vector<int> C(N),D(N);
	rep(i,0,N) cin>>C[i]>>D[i];

	const int maxs=2500;
	const ll inf=(ll)1e18;
	vector<array<ll,maxs+1>> dist(N);
	rep(i,0,N) fill(dist[i].begin(),dist[i].end(),inf);
	S=min(S,maxs);
	dist[0][S]=0;
	using state=tuple<ll,int,int>;
	priority_queue<state,vector<state>,greater<state>> q;
	q.emplace(0,0,S);
	vector<ll> res(N,inf);
	while (!q.empty()) {
		ll d;
		int v,s;
		tie(d,v,s)=q.top();
		q.pop();
		if (d!=dist[v][s]) continue;
		res[v]=min(res[v],d);

		// buy silver coins
		for (ll i=1; s+i*C[v]<=maxs; ++i) {
			int ns=(int)(s+i*C[v]);
			ll nd=d+i*D[v];
			if (dist[v][ns]>nd) {
				dist[v][ns]=nd;
				q.emplace(nd,v,ns);
			}
		}

		// go to other city
		fore(adj[v],[u,a,b]) {
			int ns=s-a;
			ll nd=d+b;
			if (ns>=0 && dist[u][ns]>nd) {
				dist[u][ns]=nd;
				q.emplace(nd,u,ns);
			}
		}
	}

	rep(i,1,N) cout<<res[i]<<'\n';
}


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

int main(){
  int a, b; cin >> a >> b;

  if(a < 0){
    if(b < 0){
      if((b-a+1)%2){
        cout << "Negative" << endl;
      }
      else{
        cout << "Positive" << endl;
      }
    }
    else{
      cout << "Zero" << endl;
    }
  }
  else if(a == 0){
    cout << "Zero" << endl;
  }
  else{
    cout << "Positive" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
using namespace std;

int main(){
    while(1){
        int A[5];

        cin >> A[0];
        if(A[0] == 0)   break;

        set<int> appear;
        appear.insert(A[0]);
        for(int i = 1; i < 5; i++){
            cin >> A[i];
            appear.insert(A[i]);
        }

        if(appear.size() != 2){
            for(int i = 0; i < 5; i++)  cout << 3 << endl;
        }else{
            int win, lose;
            bool b[4] = {};
            for(int x : appear) b[x] = true;
            if(b[1] && b[2]){
                win = 1;
                lose = 2;
            }else if(b[2] && b[3]){
                win = 2;
                lose = 3;
            }else if(b[3] && b[1]){
                win = 3;
                lose = 1;
            }

            for(int i = 0; i < 5; i++){
                if(A[i] == win)         cout << 1 << endl;
                else if(A[i] == lose)   cout << 2 << endl;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3096
// Coordinate compression

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
 
#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;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
 
//#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(int i=a;i<b;i++)



int solve()
{

string s;
cin>>s;
if(s[2]==s[3]&&s[4]==s[5])
{
  cout<<"Yes";
}
else cout<<"No";


  return 0;
}


 
signed main()
{  int t=1;

 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
  
   cin.exceptions(cin.failbit);                                                                    
     
                                 
 
  clock_t time_req;
                                                                                                                   
//cin>>t;
 
    int k=1;
     
   while(t--)
     {
      solve();
     }
        exit(0);
 
 
         time_req = clock() - time_req;
    cout <<endl<< "Processor time taken is "
      << (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;
 
    return 0;
 
}

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

#define ll    long long
#define endl  "\n"
#define fast  ios_base :: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int arr[1000];
int main(){

    fast;
    int n;
    cin>>n;

    for(int i=0;i<n;i++){
        cin>>arr[i];
    }

    int count = 0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(arr[i]!=arr[j] && arr[i]!=arr[k] && arr[j]!=arr[k]){
                    if(arr[i]+arr[j]>arr[k] && arr[i]+arr[k]>arr[j] && arr[j]+arr[k]>arr[i]){
                        count++;
                    }
                }

            }
        }
    }

    cout<<count;


    return 0;
}


Measured memory_bytes: 3644
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>

using namespace std;
using pii = pair<int, int>;
using ll = long long;

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

	int n;
	cin >> n;
	vector<int> h(n);
	for (int i = 0; i < n; i++) cin >> h[i];
	int maxp = max_element(h.begin(), h.end()) - h.begin();
	int answer = 0;
	int nowanswer = 0;
	for (int i = 0; i < n - 1; i++) {
		if (h[i] >= h[i + 1]) nowanswer += 1;
		else nowanswer = 0;
		answer = max(answer, nowanswer);
	}
	cout << answer;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;
#define dump(a) cout << (a) << endl;
typedef long long ll;

ll fac[1000000], finv[1000000], inv[1000000];
ll mod = 1e9+7;

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

ll COM(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return fac[n] * (finv[k]*finv[n-k]%mod ) % mod;
}

int main() {
    int n, m;
    cin >> n >> m;
    map<int, int> mp;
    int i = 2;
    while( i <= m ) {
        while( m%i == 0 ) {
            mp[i]++;
            m /= i;
        }
        i++;
    } 
    COMinit();
    ll res = 1;
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        res *= COM(itr->second+n-1, itr->second);
        res %= mod;
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 23680
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  long long q, h, s, d, n;
  cin >> q >> h >> s >> d >> n;
  cout << n / 2 * min({q * 8, h * 4, s * 2, d}) + n % 2 * min({q * 4, h * 2, s}) << endl;
  return 0;	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef vector<int>         vi;
const int mod = 1000000007;






int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int a=s[0]-48,b=s[1]-48,c=s[2]-48,d=s[3]-48;
    int ans=a;
    for(int i =43;i <=45;i=i+2){
        int te=ans;
        if(i==43){
            ans+=b;
        }
        else{
            ans-=b;
        }
        for(int j=43;j<=45;j=j+2){
            int temp = ans;
            if(j==43){
                ans+=c;
            }
            else{
                ans-=c;
            }
                for(int k=43;k<=45;k=k+2){
                    int cpy=ans;
                    if(k==43){
                    ans+=d;
                    }
                    else{
                    ans-=d;
                    }
                    if(ans==7){
                        cout<<a <<char(i)<<b<<char(j)<<c<<char(k)<<d<<"="<<7<<endl;
                        return 0;
                    }
                    else{
                        ans=cpy;
                    }


                }
        ans=temp;
        }
    ans=te;
    }









}






























































Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String... args) {        
        int N = IN.nextInt();
        int K = IN.nextInt();
        if (N % K == 0) {
            System.out.println(0);
        } else {
            System.out.println(1);
        }
    }
    final static Scanner IN = new Scanner(System.in);
}

Measured memory_bytes: 23764
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
// 標準入力からデータを読み込む準備
		Scanner sc = new Scanner(System.in);
// 最初の文字の固まりを整数値と想定して読み込む
 		for (int i = 1; ; i++) {
			int x = sc.nextInt();
// xが0の時を考慮した上で、 Case i: x の形式で出力しよう!
			if(x==0){
				break;
			}else{
				System.out.println("Case "+i+": "+x);
			}
		} 
	}
}


Measured memory_bytes: 42264
n = int(raw_input())
s = raw_input()
l = [(0,0)]
for i,c in enumerate(s):
    if c == 'E':
        l.append((l[i][0]+1, l[i][1]))
    else:
        l.append((l[i][0], l[i][1]+1))
mn = n
for i in range(1,n+1):
    mn = min(mn, l[i-1][1]+l[-1][0]-l[i][0])
print mn


Measured memory_bytes: 43368
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
ll N, M;
string S, T;

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

ll calc_lcm(ll a, ll b) {
    ll g = calc_gcd(a, b);
    return a / g * b;
}

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

  cin >> N >> M;
  cin >> S >> T; 

  ll lcm = calc_lcm(N, M);
  ll gcd = calc_gcd(N, M);
  ll s = N/gcd;
  ll t = M/gcd; 

  bool flag = false;
  rep(i, gcd){
    if (S[s*i] != T[t*i]){
      flag = true;
      break;
    }
  }

  ll ans = flag?-1:lcm;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


map<int,int> prime_factor(int n){
  map<int,int> ret;
  for(int i=2;i*i<=n;i++){
    while(n%i==0){
      ret[i]++;
      n/=i;
    }
  }
  if(n!=1) ret[n]=1;

  return ret;
}

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

  int n;
  cin>>n;
  map<int,int> mp=prime_factor(n);
  cout<<n<<':';
  for(auto m:mp){
    rep(_,m.S) cout<<' '<<m.F;
  }
  cout<<endl;


}


Measured memory_bytes: 3216
#include<iostream>
#include<algorithm>
#include<cmath>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<23)
using namespace std;
typedef long long ll;

ll GetDigit(ll num)
{
    return log10(num)+1;
}

ll F(ll A,ll B)
{
    ll a_n=GetDigit(A);
    ll b_n=GetDigit(B);
    return max(a_n,b_n);
}

int main()
{
    ll n;
    ll m=INF;
    cin>>n;
    for (ll a = 1; a*a <=n; a++)
    {
        if(n%a==0)
        {
            ll b=n/a;
            ll d=F(a,b);
            m=min(m,d);
        }
    }
    cout<<m<<endl;

    return 0;
}

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

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

  ll n,h,w;
  cin>>n>>h>>w;
  cout<<(n-h+1)*(n-w+1)<<'\n';

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
const int L=128,N=65;
namespace grader
{
const int N=1005;
const int INF=1e9;
int dp[N][N];
int EditDis(const string &a,const string &b="Atcod3rIsGreat")
{
    int len1=a.size(),len2=b.size();
    for(int i=1;i<=len1;i++)
        for(int j=1;j<=len2;j++)
            dp[i][j]=INF;
    for(int i=1;i<=len1;i++)
        dp[i][0]=i;
    for(int j=1;j<=len2;j++)
        dp[0][j]=j;
    for(int i=1;i<=len1;i++)
        for(int j=1;j<=len2;j++)
            dp[i][j]=min(dp[i-1][j]+1,min(dp[i][j-1]+1,dp[i-1][j-1]+(a[i-1]!=b[j-1])));
    return dp[len1][len2];
}
}
const char ch[]={"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"};
int len;
int cnt[N];
int query(const string &s)
{
	cout<<"? "<<s<<endl; 
	int ans;
//	ans=grader::EditDis(s);
//	cerr<<"ans:"<<ans<<"\n";
	cin>>ans;
	return ans;
}
bool check(const string &s)
{
	return query(s)==len-s.size();
}
string merge(int l,int r)
{
	if(l==r) return string(cnt[l],ch[l]);
	int mid=(l+r)/2;
	string a=merge(l,mid),b=merge(mid+1,r);
//	cerr<<"merge:"<<a<<" "<<b<<"\n";
	string t;
	int i=0,j=0;
	while(i<a.size()&&j<b.size())
	{
		if(check(t+a[i]+b.substr(j)))
		{
			t+=a[i],i++;
		}
		else
		{
			t+=b[j],j++;
		}
	}
	while(i<a.size())
		t+=a[i],i++;
	while(j<b.size())
		t+=b[j],j++;
//	cerr<<"res:"<<t<<"\n";
	return t;
}
int main()
{
	for(int i=0;i<62;i++)
		cnt[i]=L-query(string(L,ch[i])),len+=cnt[i],cerr<<"cnt"<<i<<" "<<cnt[i]<<"\n";
	string ans=merge(0,62);
	cout<<"! "<<ans<<endl;
	return 0;
}

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

int main() {
  int N;
  cin>>N;
  vector<tuple<string,int,int>> res;
  for(int i=0;i<N;i++){
    string S;
    int P;
    cin>>S>>P;
    res.push_back(make_tuple(S,100-P,i+1));
  }
  sort(res.begin(),res.end());
  for(tuple<string,int,int> t:res){
    cout<<get<2>(t)<<endl;
  }
}


Measured memory_bytes: 3668
#include <iostream>
using namespace std;
int main() {
	long long a, b, c;
	cin >> a >> b >> c;
	if (a == 0) {
		cout << b / c + 1 << endl;
	}
	else {
		cout << -((a - 1) / c) + b / c << endl;
	}
}


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

int main() {
    string s = "";
    cin >> s;

    vector<string> weeks;
    weeks = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    for (int i = 0; i < weeks.size(); i++) {
        if (weeks.at(i) == s) {
            cout << weeks.size() - i << endl;
            break;
        }
    }
}

Measured memory_bytes: 3576
// kayseekay :)
#include<bits/stdc++.h>
using namespace std;	
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;	i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;	
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n ,l ,r;
		cin >> l >> r >> n ;
		int ans = r/n - l/n + (l%n==0);
		cout << ans<<endl;

	
	}
	return 0;
}

Measured memory_bytes: 3608
int main()
{
  	char s[3];
	int n,i;
  	double p,sum;
	scanf("%d",&n);
	for(i=0;i<n;++i){
		scanf("%lf%s",&p,s);
		if(s[0]=='J'){
			sum+=p;
			continue;
		}
		sum+=p*380000;
	}
	printf("%lf",sum);
	return 0;
}

Measured memory_bytes: 128
A, B, C, X, Y = [int(i) for i in input().split()]

T = abs(X-Y)*B if X < Y else abs(X-Y)*A
T1 = A*X + B*Y
T2 = max(X, Y)*2*C
T3 = min(X, Y)*2*C + T

print(min(T1, T2, T3))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
 
int main(){
  int N,K;
  cin>>N>>K;
  VI D(K);
  rep(i,K) cin>>D[i];
  rep(i,N*9+1){
    int X=N+i;
    int F=1;
    while(X){
      int Y=X%10;
      rep(j,K){
        if(Y==D[j]){
          F=0;
          break;
        }
      }
      if(F==0) break;
      X/=10;
    }
    if(F){
      cout<<N+i<<endl;
      return 0;
    }
  }
  
}

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

int main(){
    int r,c;
    cin>>r>>c;
    int s[102][102];
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++) {
            cin>>s[i][j];
        }
    }

    for(int i=0;i<r;i++){
        int sum=0;
        for(int j=0;j<c;j++){
            sum+=s[i][j];
        }
        s[i][c]=sum;
    }
    for(int i=0;i<c+1;i++){
        int sum=0;
        for(int j=0;j<r;j++){
            sum+=s[j][i];
        }
        s[r][i]=sum;
    }

    for(int i=0;i<r+1;i++){
        for(int j=0;j<c+1;j++) {
            cout<<s[i][j];
            if(j!=c) cout<<" ";
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3132
n,m=map(int,input('').split(' '))
s=input('')
s=s.split(' ')
h=[]
for i in range(n):
    h.append(int(s[i]))

c=[]
for i in range(n):
    c.append(1)

for i in range(m):
    a,b=map(int,input('').split(' '))
    if h[a-1]==h[b-1]:
        c[a-1]=0
        c[b-1]=0
    elif h[a-1]>h[b-1]:
        c[b-1]=0
    elif h[a-1]<h[b-1]:
        c[a-1]=0

m=0
for i in range(n):
    m=m+c[i]

print(m)

Measured memory_bytes: 21136
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main() {
   int a;
   cin>>a;
   cout<<3*a*a<<endl;






    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, x, N) for (long long i = x; i < (N); i++)
using namespace std;
int main()
{
	int N, M;
	cin >> N >> M;
	if (N <= M)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


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

using namespace std;

typedef long long ll;

const int MAX_N = 1e5+10;

int main(int argc, char const *argv[])
{
    ll n, a[MAX_N], sa = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
        sa += a[i];
    }

    for (int i = 1; i < n-1; i+=2) {
        sa -= 2*a[i];
    }
    ll r[MAX_N];
    r[0] = sa;
    for (int i = 1; i < n; ++i) {
        r[i] = 2*a[i-1] - r[i-1];
    }

    for (int i = 0; i < n; ++i) {
        cout << r[i] << ' ';
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2816
#include <stdio.h>
#include <math.h>

#define PI 3.14159265358979323846

int main(void)
{
	int a, b, c;

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

	printf("%f %f %f\n", (double)(a * b * sin(c * PI / 180)) / 2, (double)(a + b + sqrt((a * a) + (b * b) - (2 * a * b * cos(c * PI / 180)))), (double)b * sin(c * PI / 180));
}


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

using namespace std;

using ll = long long;
using ld = long double;

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

    int n;
    cin >> n;

    vector<vector<int>> adj(n);
    for (int i = 0, a, b; i + 1 < n; ++i) {
        cin >> a >> b;
        adj[a - 1].push_back(b - 1);
        adj[b - 1].push_back(a - 1);
    }

    vector<int> c(n);
    for (auto &c_i : c) cin >> c_i;
    sort(c.begin(), c.end(), greater<int>());

    int v = 0;
    for (int u = 0; u < n; ++u) {
        if (adj[v].size() < adj[u].size()) v = u;
    }

    ll max_sum = 0, idx = 0;
    vector<int> max_w(n, -1);
    queue<int> que; que.push(v);
    max_w[v] = c[idx++];

    while (!que.empty()) {
        int cur = que.front(); que.pop();
        for (auto u : adj[cur]) {
            if (max_w[u] != -1) continue;
            max_w[u] = c[idx++];
            max_sum += min(max_w[cur], max_w[u]);
            que.push(u);
        }
    }

    cout << max_sum << endl;
    for (int v = 0; v < n; ++v) {
        cout << max_w[v] << " \n"[v == n - 1];
    }


    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc093/tasks/abc093_b

int main() {
    int A, B, K; cin >> A >> B >> K;
    set<int> s;
    for (int i = A; i < A+K; i++) {
        if (i <= B) s.insert(i);
    }
    for (int i = B; i > B-K; i--) {
        if (i >= A) s.insert(i);
    }
    for (int t : s) {
        cout << t << "\n";
    }

    return 0;
}

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

int main() {
  int k,n;
  cin >> k >> n;
  int A[n]; //家の地点
  int d[n]; //ある地点からの最短距離
  int way = k; //最短距離
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    if(i > 0){
      d[i-1] = k - (A[i] - A[i-1]);
    }
  }
   d[n-1] = A[n-1] - A[0];
   for (int i = 0; i < n; i++) {
  if(way > d[i]){
    way = d[i];
     }
   }
  cout << way;
 return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n;
	cin >> n;
	vector<int>stick(n);
	rep(i, n)cin >> stick[i];
	sort(all(stick));
	int c,ans=0;
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			c = stick[i] + stick[j];
			for (int k = j + 1; k < n; k++) {
				if (stick[k] < c)ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}



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

const int INF=1001001001;
const int di[]={-1,0,1,0};
const int dj[]={0,-1,0,1};

int main(){
    int h,w;
    cin>>h>>w;
    vector<string>s(h);
    rep(i,h)cin>>s[i];
    int ans=0;
    rep(si,h)rep(sj,w){
        if(s[si][sj]=='#')continue;
        vector<vector<int>>dist(h,vector<int>(w,INF));
        queue<p>q;
        auto update=[&](int i,int j, int x){
           if(dist[i][j]!=INF)return;
           dist[i][j]=x;
           q.push(p(i,j));
        };
        update(si,sj,0);
        while(!q.empty()){
            int i=q.front().first;
            int j=q.front().second; q.pop();
            rep(dir,4){
                int ni=i+di[dir], nj=j+dj[dir];
                if(ni<0||ni>=h||nj<0||nj>=w)continue;
                if(s[ni][nj]=='#')continue;
                update(ni,nj,dist[i][j]+1);
            }
        }
        rep(i,h)rep(j,w){
            if(dist[i][j]==INF)continue;
            ans=max(ans,dist[i][j]);
        }

    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int t,r,b,c,m,n,o,p,q;(t=s.nextInt())>0;System.out.println(r))for(m=5,n=4,o=r=1,p=3,q=2;t-->0;r+=o){b=n;c=s.next().charAt(0);if(c==69){p=o;o=n;n=7-p;}if(c==76){n=m;m=p;p=q;q=b;}if(c==78){m=o;o=q;q=7-m;}if(c==82){n=q;q=p;p=m;m=b;}if(c==83){q=o;o=m;m=7-q;}if(c==87){n=o;o=p;p=7-n;}}}}

Measured memory_bytes: 12000
# include <bits/stdc++.h>
using namespace std;
int main() {
   // freopen("input.txt","r",stdin);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<n;i++){
        while(i<n-1 &&s[i] == s[i+1]){
            i++;
        }
        ans++;
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 512
n,k=map(int,input().split())
*h,=map(int,input().split())

dp=[0]*n
for i in range(1,n):
      dpmin=[]
      for j in range(max(0,i-k),i):
            dpmin.append(dp[j]+abs(h[i]-h[j]))
      dp[i]=min(dpmin)
print(dp[-1])


Measured memory_bytes: 56032
# include<iostream>
using namespace std;

int main(void)
{
	int a;
	scanf("%d",&a);
	for (int i=1;i<=9;i++)
	for (int j=1;j<=9;j++)
	if (j*i==a)
	{
		printf("Yes");
		return 0;
	}
	printf("No");
//	if (a>=1&&a<=9&&b>=1&&b<=9) printf("%d",a*b);
//	else
//	printf("-1"); 
	return 0;
 } 

Measured memory_bytes: 256
import itertools

N, M, X = map(int, input().split())
data = [[*map(int, input().split())] for _ in range(N)]

min_price = 10**10
for bit in itertools.product([0, 1], repeat=N):
    temp = [0] * M
    price = 0
    for idx, b in enumerate(bit):
        if b:
            for i, d in enumerate(data[idx][1:]): temp[i] += d
            price += data[idx][0]

    is_valid = True
    for t in temp:
        if t < X:
            is_valid = False
    if is_valid and min_price > price:
        min_price = price

if min_price != 10**10:
    print(min_price)
else:
    print(-1)

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

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;

#define deb(x) cerr<<#x<<":"<<x<<"\n";
#define dvi(x) for(ll i=0;i<x.size();i++)cerr<<#x<<"["<<i<<"]:"<<x[i]<<" ";
#define iter(v) for(auto it:v)
#define wt ll t;cin>>t;while(t--)
#define rl(x) ll x;cin>>x;
#define rvi(x,n) vi x(n);for(ll i=0;i<n;i++) cin>>x[i];
#define rs(x) string x;cin>>x;
#define wvi(x) for(ll i=0;i<x.size();i++) cout<<x[i]<<" ";cout<<endl;
#define ws(x) cout<<x<<endl;
#define all(v) v.begin(),v.end()
#define pb push_back
#define ppb pop_back
#define pll pair<ll, ll>
#define fo(i,n) for(ll i=0;i<n;i++)
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define decsort(b) sort(all(b),greater<ll>())
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
const ll N = pow(2,32);

map<long long, long long> factorize(long long n) {	//returns map containing factor and multiplicity, Eg: 60 = {{2,2},{3,1},{5,1}}
	map<long long, long long> ans;
	for (long long i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ans[i]++;
			n /= i;
		}
	}
	if (n > 1) {
		ans[n]++;
		n = 1;
	}
	return ans;
}

void FAST() {	//FAST Input Output, DONT use both scnaf,prllf / cin,cout , Use any ONE system
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll answer(ll sum,vvi a,ll n,ll m)
{
	ll cnt1=0,cnt0=0;
	for(ll i=0;i<n;i++)
		{
			for(ll j=0;j<m;j++)
			{
				if(i+j==sum || i+j==n+m-2-sum)
				{
					if(a[i][j])cnt1++;
					else cnt0++;
				}
			}
		}
	return min(cnt0,cnt1);
}

int main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
	FAST();
 	rs(s) rs(t)
	ll n=s.size();
	ll m=t.size();
	ll mx=0;
	for(ll i=0;i<=n-m;i++)
	{
		ll cnt=0;
		for(ll j=0;j<m;j++)
		{
			if(s[i+j]==t[j])cnt++;
		}
		mx=max(cnt,mx);
	}
	cout<<m-mx;
}

Measured memory_bytes: 3644
import java.io.*;
 
class Main
{
       public static void main (String[] args) throws IOException
       {
 
       BufferedReader br =
        new BufferedReader(new InputStreamReader(System.in));
 
       String str = br.readLine();
       int x =Integer.parseInt(str);
 
    System.out.println(x*x*x);
    }
}

Measured memory_bytes: 24180
package main

import "fmt"

func main()  {
	var A,B,C,X int
	fmt.Scanf("%d", &A)
	fmt.Scanf("%d", &B)
	fmt.Scanf("%d", &C)
	fmt.Scanf("%d", &X)
	ans := 0
	for a:= 0; a <= A; a++ {
		for b:=0 ; b <= B ; b++ {
			for c:=0; c <= C ; c++ {
				if a * 500 + b * 100 + c * 50 == X {
					ans += 1
				}
			}
		}
	}
	fmt.Println(ans)
}


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

int main()
{
	int n;
	string st;
	set<string>s;
	cin>>n;
	for(int i=0; i<n; i++)
	{
		cin>>st;
		s.insert(st);
	}
	cout<<s.size()<<endl;
	return 0;
}

Measured memory_bytes: 19116
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = b - a;
        int d = 0;
        for (int i = 1; i <= c; i++) {
            d += i;
        }
        System.out.println(d - b);
    }
}


Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int N, sum = 0;
    cin >> N;

    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N);


    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    for (int i = 0; i < N; i++){
        cin >> B[i];
        sum += B[i];
    }
    for (int i = 0; i < N; i++){
        cin >> C[i];
    }

    for (int i = 0; i < N-1; i++){
        if (A[i] + 1 == A[i+1]){
            sum += C[A[i]-1];
        }
    }

    cout << sum <<endl;

    return 0;
}

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

int selection_sort(int A[], int n){
    int i,j,minj,sw=0;
    for (i=0; i<n-1; i++){
        minj = i;
        for (j=i+1; j<n; j++){
            if (A[j] < A[minj]) minj = j;
        }
        swap(A[i],A[minj]);
        if (i!=minj) sw++;
    }
    return sw;
}
int main(){
    int A[100], n, i, sw;
    cin >> n;
    for (i=0; i<n; i++) cin >> A[i];

    sw = selection_sort(A,n);

    for (i=0; i<n; i++){
        if (i>0) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;
}


Measured memory_bytes: 3092
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


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);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    for(int i=1; i<=5; i++){
        int x; cin >>x;
        if(x == 0) cout << i;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3568