akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n,m,k;
  cin >> n >> m >> k;
  rep(y, n + 1){
    rep(x, m + 1){
      if((n - y)*x + (m - x)*y == k){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define mod		1000000007
#define inf     1000000000000000000
#define MX1		100005
#define MX2		10000004
#define pi		acos(-1)
#define pb      push_back
#define vlli    vector<lli>
#define plli    vector<pair<lli,lli> >
#define mp      make_pair
#define all(v)  v.begin(),v.end()
#define test    int t;cin>>t;
lli gcd(lli a, lli b){return b?gcd(b,a%b):a;}
lli power(lli a,lli b){lli ans=1;while(b){if(b&1){ans=(ans*a)%mod;}a=(a*a)%mod;b>>=1;}return ans;}
lli fact(lli n)
{
	lli res=1;
	for(lli i=2;i<=n;i++)
	{
		res=res*i;
		res=res%mod;
	}
	return res;
}
int main()
{
	opt;
	lli d,m;
	cin>>d>>m;
	if(abs(d-m)>1)
	{
		cout<<"0\n";
		return 0;
	}
	lli ans1=fact(d);
	lli ans2=fact(m);
	lli ans=((ans1%mod)*(ans2%mod))%mod;
	if(d==m)
	ans=ans*2;
	cout<<ans%mod<<"\n";

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class B
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = Scanner.Scan<string>();
            var n = 0L;
            for (var i = 0; i < N.Length; i++)
            {
                n += N[i] - '0';
            }
            Console.WriteLine(n % 9 == 0 ? "Yes" : "No");
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
        }
    }
}


Measured memory_bytes: 27532
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

/*
*/

ll n,k,a[2010],s=0,ans,mod=1e9+7;

void init(){
	cin>>n>>k;
	rep(i,n)cin>>a[i];
	rep(i,n){
		rep(j,i){
			if(a[j]>a[i])s++;
		}
	}
	s%=mod;
	ans=(k*s)%mod;
	sort(a,a+n);
}

int main(void){
	init();
	ll b=0,t=0,sum=n;
	rep(i,n){
		if(b==0){
			b=a[i];
			t=1;
		}else if(b==a[i]){
			t++;
		}else{
			sum-=t;
			ll c = (k*(k-1)/2)%mod;
			c = (c*t)%mod;
			ans = (ans+(sum*c)%mod)%mod;
			t=1;
			b=a[i];
		}
	}
	// sum-=t;
	// ll c = (k*(k-1)/2)%mod;
	// ans=(ans+(sum*c)%mod)%mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func radian(deg int) float64 {
	return float64(deg) * math.Pi / float64(180)
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	rad := radian(c)
	S := 0.5 * float64(a) * float64(b) * math.Sin(rad)
	h := float64(b) * math.Sin(rad)
	L := float64(a) + float64(b) + math.Sqrt(float64(a*a)+float64(b*b)-float64(2*a*b)*math.Cos(rad))

	fmt.Printf("%f\n", S)
	fmt.Printf("%f\n", L)
	fmt.Printf("%f\n", h)
}



Measured memory_bytes: 1140
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

int solve( VI as, VI bs, int n )
{
	const int m = as.size();

	VVI dp( m + 1, VI( m * 100 * 10 + 1, 0 ) );
	dp[0][0] = 1;

	REP( i, 0, m )
	{
		REP( j, 0, dp[i].size() )
		{
			REP( k, 0, bs[i] + 1 )
			{
				if ( !dp[i][j] )
				{
					continue;
				}

				dp[ i + 1 ][ j + as[i] * k ] += dp[i][j];
			}
		}
	}

	return dp[m][n];
}

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

	while ( true )
	{
		int m;
		cin >> m;

		if ( !m )
		{
			break;
		}

		VI as( m ), bs( m );

		REP( i, 0, m )
		{
			cin >> as[i] >> bs[i];
		}

		int g;
		cin >> g;

		REP( i, 0, g )
		{
			int n;
			cin >> n;

			cout << solve( as, bs, n ) << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1368
#include <bits/stdc++.h>
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
const int INF = 0x3f3f3f3f;
using namespace std;

int a, b;
int main() {
    IOS
    cin >> a >> b;
    cout << max(a+b, max(a-b, a*b)) << endl;

    return 0;


}


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

int n,rt,tot=1,fst[N],pnt[N<<1],len[N<<1],nxt[N<<1],sz[N]; ll ans;
void add(int x,int y,int z){
	pnt[++tot]=y; len[tot]=z; nxt[tot]=fst[x]; fst[x]=tot;
}
void dfs(int x,int p){
	int i,y,tmp=0; sz[x]=1;
	for (i=fst[x]; i; i=nxt[i]) if (i^p^1){
		y=pnt[i]; dfs(y,i);
		sz[x]+=sz[y]; tmp=max(tmp,sz[y]);
	}
	ans+=2ll*len[p]*min(sz[x],n-sz[x]);
	if (!rt && max(tmp,n-sz[x])<=(n>>1)) rt=x;
}
int main(){
	scanf("%d",&n);
	int i,x,y,z;
	for (i=1; i<n; i++){
		scanf("%d%d%d",&x,&y,&z);
		add(x,y,z); add(y,x,z);
	}
	dfs(1,0);
	ans=0; dfs(rt,0);
	for (i=fst[rt]; i; i=nxt[i]){
		x=pnt[i];
		if ((sz[x]<<1)==n) break;
	}
	if (i) ans-=len[i];
	else{
		for (i=fst[rt],x=inf; i; i=nxt[i]) x=min(x,len[i]);
		ans-=x;
	}
	printf("%lld\n",ans);
	return 0;
}


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

using namespace std;

int main(){
  long a,b,c; cin >> a >> b >> c;
  if(c <= (a + b)){
    cout << "No" << '\n';
    return 0;
  }
  c = (c - (a + b)) * (c - (a + b));
  if(c > (4LL * a * b)){
     cout << "Yes" << '\n';
  }else cout << "No" << '\n';
  return 0;
}


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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define vi vector <int>
#define vvi vector <vi>
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define MOD 1000000007
using namespace std;

int main(){

#ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout); 
#endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n,k;
    cin>>n>>k;
    vi num(n);
    for (int i=0; i<n; i++){
        cin>>num[i];
    }    
    int lt = k, st = 0;
    vi ans;
    while (lt<n){
        if (num[lt]>num[st])
            ans.pb(1);
        else ans.pb(0);
        st++; lt++;
    }
    for (int i=0; i<ans.size(); i++){
        if (ans[i]==1) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

    // cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms\n";
    return 0;
}


Measured memory_bytes: 5064
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int a,b,c,d;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>a>>b>>c>>d;
    
    chmax(a,c);
    chmin(b,d);
    
    int ans=max(0,b-a);
    cout1(ans)
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#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 repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<tll,vector<tll>,greater<tll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tuple<ll,ll,ll> tll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
struct edge{ll to,cost,len;};
int main(){
  ll n,m,s;
  cin>>n>>m>>s;
  vector<vector<edge>> t(n,vector<edge>(0));
  rep(i,m){
    ll u,v,a,b;
    cin>>u>>v>>a>>b;
    u--;v--;
    edge e;
    e.to=v;
    e.cost=a;
    e.len=b;
    t[u].pb(e);
    e.to=u;
    t[v].pb(e);
  }
  vll c(n),d(n);
  rep(i,n){
    cin>>c[i]>>d[i];
  }
  chmin(s,2500LL);
  PQR que;
  que.pu(tll(0,0,s));
  vvll dp(n,vll(2505,INF));
  dp[0][s]=0;
  auto push=[&](ll v,ll s,ll x){
    if(s<0)return ;
    if(dp[v][s]<=x)return ;
    dp[v][s]=x;
    que.pu(tll(x,v,s));
  };
  while(sz(que)){
    ll v,time,co;
    tie(time,v,co)=que.top();
    que.pop();
    if(dp[v][co]<time)continue;
    {
      ll ns=min(co+c[v],2500LL);
      push(v,ns,time+d[v]);
    }
    {
      for(auto u:t[v]){
        push(u.to,co-u.cost,time+u.len);
      }
    }
  }
  rep(i,n){
    if(i==0)continue;
    ll ans=INF;
    rep(j,2505){
      chmin(ans,dp[i][j]);
    }
    COUT(ans);
  }
}

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

signed main(){
	int x=read();
	int i=0;
	while(x>0)x-=(++i);
	cout<<i<<endl;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

const int INF = 1001001001;
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};

void solve() {
  int n;
  cin >> n;
  using P = pair<int, int>;
  vector<vector<P>> a(n);
  rep(i, n) {
    int m;
    cin >> m;
    rep(j, m) {
      int x, y;
      cin >> x >> y;
      x--;
      a[i].emplace_back(x, y);
    }
  }
  int ans = 0;
  rep(i, bit32(n)) {
    bool ok = true;
    rep(j, n) if (bit32(j) & i) {
      for (auto p : a[j]) {
        int x, y;
        tie(x, y) = p;
        if (y == 1 && !(bit32(x) & i)) ok = false;
        if (y == 0 && (bit32(x) & i)) ok = false;
      }
    }
    if (ok) {
      amax(ans, __builtin_popcount(i));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
[H,W] = list(map(int,input().split()))

a = []
for i in range(H):
    a.append(list(input()))

line = []
colu = []
for i in range(H):
    for j in range(W):
        if a[i][j] == '#':
            line.append(i)
            colu.append(j)

ans=[]
for i in range(H):
    dammy=[]
    for j in range(W):
        if (i in line) and (j in colu):
            dammy.append(a[i][j])
    if dammy!=[]:
        ans.append(dammy)

for i in range(len(ans)):
    print(''.join(ans[i]))

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

ll n,x;
bool used[200009];

int main(){
    cin>>n>>x;
    if(x==1||x==n*2-1){
        cout<<"No\n";
        return 0;
    }
    cout<<"Yes\n";
    if(n==2){
        cout<<"1\n2\n3\n";
        return 0;
    }
    vector<ll>ans(2*n);
    ans[n]=x;
    used[x]=1;
    if(x==2){
        ans[n+1]=1;
        ans[n-1]=2*n-1;
        ans[n+2]=2*n-2;
        used[1]=used[2*n-1]=used[2*n-2]=1;
    }else{
        ans[n+1]=2*n-1;
        ans[n-1]=1;
        ans[n+2]=2;
        used[1]=used[2*n-1]=used[2]=1;
    }
    int x=1;
    FOR(i,1,2*n){
        if(ans[i])cout<<ans[i]<<endl;
        else{
            while(used[x])x++;
            cout<<x<<endl;
            used[x]=1;
        }
    }
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
//#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define sll                     set<ll>
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define umcl                    um<char,ll>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define test                    ll Testcases;cin>>Testcases;while(Testcases--)
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
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...);
}

void inp_out()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
    #endif
}

int main()
{
	fastIO
//	inp_out();
	ll n;
	cin>>n;
	string s="1";
	ll sz=s.size();
	for(ll i=1;i<n;++i)
	{
		ll flag=0,idx=-1;
		for(ll j=0;j<sz-1;++j)
		{

			if((s[j]-s[j+1]<1)&&(s[j]!='9'))
			{
				idx=j;
				s[j]++;
				flag=1;
				break;
			}		
		}

		for(ll j=idx-1;j>=0;--j)
		{
			s[j]=max('0',char(s[j+1]-1));
		}

		if((flag==0)&&(s[sz-1]=='9'))
		{
			++sz;
			s+='1';
			for(ll i=sz-2;i>=0;--i)
			{
				s[i]='0';
			}
		}

		else if(flag==0)
		{
			s[sz-1]++;
			for(ll i=sz-2;i>=0;--i)
			{
				s[i]=max('0',(char)(s[i+1]-1));
			}
		}

	//	string temp;
	//	temp=s;
	//	reverse(all(temp));

		
	//	db(i,temp,flag);

	}	

	reverse(all(s));
	cout<<s;

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
vector<int> v[1001];
bool usd[1001];
int ki;
int su;
vector<int> dfs(int now,vector<int> w){
    vector<int> rr={};
    if(w.size()==su+1){
        
        return rr;
    }
    vector<int> ret=w;
    rep(j,0,v[now].size()){
        int ne=v[now][j];
        if(ne==ki){
            return ret;
        }
        if(usd[ne])continue;
        usd[ne]=true;
        vector<int> u=w;
        u.push_back(ne);
        vector<int> ee=dfs(ne,u);
        if(ee.size()>0){
            return ee;
        }
        usd[ne]=false;
    }
    return rr;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int n,m;cin>>n>>m;
    
    rep(i,0,m){
        int a,b;cin>>a>>b;
        v[a].push_back(b);
    }
    int mi=1000000000;
    int num=-1;
    rep(i,1,n+1){
        queue<int> q;
        q.push(i);
        bool used[n+1];
        fill(used,used+n+1,false);
        used[i]=true;
        int d[n+1];
        fill(d,d+n+1,1000000000);
        d[i]=1;
        int c=0;
        int dis=-1;
        while(q.size()>0){
            int now=q.front();
            q.pop();
            rep(j,0,v[now].size()){
                int ne=v[now][j];
                if(ne==i){
                    c=1;
                    dis=d[now];
                    break;
                }
                if(used[ne])continue;
                used[ne]=true;
                d[ne]=d[now]+1;
                q.push(ne);
            }
        }
        if(c==0)continue;
        if(mi>dis){
            mi=dis;
            num=i;
        }
    }
    if(num==-1){
        cout<<-1<<endl;
        return 0;
    }
    ki=num;
    su=mi;
    fill(usd,usd+n+1,false);
    usd[num]=true;
    vector<int> cur={num};
    vector<int> ans=dfs(num,cur);
    cout<<ans.size()<<endl;
    rep(i,0,ans.size())cout<<ans[i]<<endl;
}


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

const int MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
    string s, t;
    cin >> s >> t;

    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

    if (s < t) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#define N 1000005
using namespace std;
typedef long long ll;
ll mod = 1000000007;
int n;
int a[102];
int cnt[10];
int main() {
	cin>>n;
	memset(cnt, 0, sizeof(cnt));
	for (int i = 1; i <= n; ++i) {
		cin>>a[i];
		if (a[i]/400 < 8) cnt[a[i]/400]++;
		else cnt[8]++;
	}
	int tot1=0;
	for (int i = 0; i < 8; ++i) {
		if (cnt[i] > 0) tot1++;
	}
	if (tot1==0) {
		cout<<1<<" "<<cnt[8]<<endl;
	} else {
		cout<<tot1<<" "<<tot1+cnt[8]<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
typedef long long ll;

int n,s;
ll Dis[100005];
struct Homeee{int x;ll c;}a[100005];

int main()
{
    scanf("%d%d",&n,&s);
    for(int i=1;i<=n;++i)scanf("%d%lld",&a[i].x,&a[i].c);
    std::sort(a+1,a+n+1,[](const Homeee &x,const Homeee &y){return x.x<y.x;});
    int l=1,r=n,t=2;
    while(a[l].x<s&&a[r].x>s)
        if(a[l].c<a[r].c)a[r].c+=a[l].c,Dis[r]+=Dis[l]+(t?a[r].x-a[l].x:0),t=0,++l;
        else a[l].c+=a[r].c,Dis[l]+=Dis[r]+(t!=1?a[r].x-a[l].x:0),t=1,--r;
    printf("%lld\n",a[l].x>s?Dis[r]+a[r].x-s:Dis[l]+s-a[l].x);
    return 0;
}

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

int main() {
    
	LL n,a,b;
	cin>>n>>a>>b;
	LL d=n/(a+b);
	LL r=n%(a+b);
	LL ans=d*a;
	ans+=min(r,a);
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
    long long int i;
    char ch='A';
    char ch1='a';
    long long int diff;

    char arr[1199];
    scanf("%[^\n]",arr);
    long long int length=strlen(arr);
    

    diff=ch1-ch;
    for(i=0;i<length;i++)
    {
        if(arr[i]>='a' && arr[i]<='z')
        {
            arr[i]=arr[i]-diff;
        }
        else if(arr[i]>='A' && arr[i]<='Z')
        {
            arr[i]=arr[i]+diff;
        }
    }
printf("%s\n",arr);



    return 0;
}



Measured memory_bytes: 2052
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int cti(char c){
  if(c>='2'&&c<='9') return c-'0';
  else if(c=='A') return 11;
  else return 10;
}
int main(void){
  int n;
  cin>>n;
  while(n--){
    char A[2];
    cin>>A[0]>>A[1];
    int count=0;
    int ace=0;
    REP(i,2){
      count+=cti(A[i]);
      if(A[i]=='A') ace++;
    }
    vector<char> eight(8);
    REP(i,8)cin>>eight[i];
    if(count==21) cout<<"blackjack"<<endl;
    else{
      REP(i,8){
        while(count>=22&&ace>0){
          count-=10;
          ace--;
        }
        if(count>17||(count==17&&ace==0)) break;
        count+=cti(eight[i]);
        if(eight[i]=='A') ace++;
      }
      while(count>=22&&ace>0){
        count-=10;
        ace--;
      }
      if(count>=22) cout<<"bust"<<endl;
      else cout<<count<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string.h>

using namespace std;


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

scanf("%d", &k);
 scanf("%d%d", &a, &b);
 int largest = (b / k) * k;
 if (a <= largest) {
 puts("OK");
} else {
 puts("NG");
}

return 0;
 }

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

using namespace std;

void Run() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];
  for (int i = 0; i < n; ++i)
    cin >> b[i];
  vector<int> freqA(n + 1);
  vector<int> freqB(n + 1);
  set<pair<int, int> > cnt;
  for (int i = n - 1; i >= 0; --i) ++freqA[a[i]];
  for (int i = n - 1; i >= 0; --i) ++freqB[b[i]];
  for (int i = 1; i <= n; ++i) {
    if (freqB[i]) {
      cnt.emplace(freqA[i], i);
    }
  }
  vector<int> res(n, -1);
  for (int pos = 0; pos < n; ++pos) {
    if (cnt.empty()) {
      cout << "No\n";
      return;
    }
    auto it = cnt.find(make_pair(freqA[a[pos]], a[pos]));
    bool found = (it != cnt.end());
    if (found) {
      cnt.erase(it);
    }
    if (cnt.empty()) {
      cout << "No\n";
      return;
    }
    auto p = *cnt.rbegin();
    res[pos] = p.second;
    cnt.erase(p);
    if (--freqB[p.second] > 0) {
      cnt.insert(p);
    }
    if (found) {
      cnt.emplace(--freqA[a[pos]], a[pos]);
    }
  }
  for (int i = 1; i <= n; ++i) {
    assert(freqB[i] == 0);
  }
  cout << "Yes\n";
  for (int i = 0; i < n; ++i) {
    cout << res[i] << " ";
  }
  cout << "\n";
}


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

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

int main(){
  int n;
  string s;
  cin>>n>>s;
  int* east = (int*)calloc(n,sizeof(int));
  int e=0;
  for(int i=0;i<n;i++){
    if(s[i]=='E'){
      e++;
    }
    east[i]=e;
  }
  int mn=1001001001;
  for(int i=0;i<n;i++){
    int leader= s[i]=='E'?1:0;
    int leftside=i-(east[i]-leader);
    int rightside=east[n-1]-east[i];
    int a = leftside+rightside;
    
    if(a<mn)mn=a;
  }
  cout<<mn<<endl;
  return 0;
}

Measured memory_bytes: 1916
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

int n,a,b,d;int h[110000];
bool check(int x){//O(N)
  int remAdd = x;
  rep(i,n){
    int r = h[i]-x*b;
    if(r <= 0)continue;
    remAdd -= r/d;
    if(r%d)remAdd--;
  }
  return remAdd >= 0;
}
signed main() {
  cin>>n>>a>>b;rep(i,n)cin>>h[i];
  d = a-b;
  int ng = -1, ok = 1000000000;
  while(abs(ng-ok)>1){
    int mid = (ng+ok)/2;
    (check(mid) ? ok : ng) = mid;
  }
  cout << ok << endl;
}



Measured memory_bytes: 1024
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]int)
	var a int
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		a--
		m[i] = a
	}

	ans := 0
	for i := 0; i < n; i++ {
		if i == m[m[i]] {
			ans++
		}
	}
	fmt.Println(ans / 2)
}


Measured memory_bytes: 7936
n,m = map(int,input().split()); sus = {}
for _ in range(n):
  a,b = map(int,input().split())
  sus[a] = sus[a]+b if a in sus else b
fef = sorted(sus.items()); snaas = 0
for cuc in fef:
  snaas += cuc[1]
  if snaas >= m: print(cuc[0]); exit()

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

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n)
    {
        if(n & 1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return result;
}



int32_t main()
{
    IOS

    int n;
    cin>>n;
    int temp=n%1000;
    if(temp)
    	cout<<1000-temp<<endl;
    else
    	cout<<temp<<endl;
    
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define int long long

signed main(){
    int n; cin >> n;
    using pii = pair<int,int>;
    vector<pii>v,u;
    for(int i = 0; i < n;i++){
        pii t; cin >> t.first >> t.second;
        u.push_back(t);
        v.push_back(pii(t.first + t.second,i));
    }
    sort(v.begin(),v.end(),greater<>());
    int ans = 0;
    for(int i = 0;i < n;i++){
        if(i % 2 == 0) ans += u[v[i].second].first;
        else ans -= u[v[i].second].second;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3564
A, B = map(int, input().split())

ans = [['#'] * 100 for _ in range(50)] + [['.'] * 100 for _ in range(50)]
A -= 1
B -= 1

for h in range(0, 50, 2):
    for w in range(0, 100, 2):
        if A == 0:
            break
        ans[h][w] = '.'
        A -= 1

for h in range(0, 50, 2):
    for w in range(0, 100, 2):
        if B == 0:
            break
        ans[-(h + 1)][w] = '#'
        B -= 1

print(100, 100)
for a in ans:
    print(''.join(a))


Measured memory_bytes: 3188
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

if __name__=="__main__":
    n,k=map(int,input().split())
    ans=Base_10_to_n(n,k)
    print(len(ans))

Measured memory_bytes: 38384
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,P = map(int,input().split())

f = []
x = 2
while x*x <= P:
    if P%x == 0:
        f.append(x)
        P //= x
        continue
    x += 1

if P > 1:
    f.append(P)

from collections import Counter
counter = Counter(f)

answer = 1
for p,k in counter.items():
    answer *= p ** (k//N)
print(answer)

Measured memory_bytes: 3316
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  double a,b,x = 0,y = 0,angle = 90;
  while(scanf("%lf,%lf",&a,&b),a||b){
    x+=a*cos(angle*2*M_PI/360);
    y+=a*sin(angle*2*M_PI/360);
    angle-=b;
  }
  cout <<(int)x<<endl<<(int)y<<endl;
  return 0;
}

Measured memory_bytes: 1236
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int pri[maxn],cnt,ans;
bool is[maxn];

inline void pre()
{
	for(int i=2;i<=(maxn-5);i++)
	{
		if(!is[i]) pri[++cnt]=i;
		for(int j=1;j<=cnt&&pri[j]*i<=(maxn-5);j++)
		{
			is[pri[j]*i]=1;
			if(i%pri[j]==0) break;
		}
	}
}

int main()
{
	ll n=read(); pre();
	for(int i=1;i<=cnt;i++)
	{
		if(n%pri[i]==0)
		{
			int cnt=0;
			while(n%pri[i]==0) n/=pri[i],cnt++;
			int l=1,r=100,p=0;
			while(l<=r)
			{
				int mid=(l+r)>>1;
				if(mid*(mid+1)/2<=cnt) l=mid+1,p=mid;
				else r=mid-1;
			}
			ans+=p;
		}
	}
	if(n!=1) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4916
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
int main(void){
	long long a[100000];
	bool b[100000][30];
	bool c[100000];
	bool k[30];
	int n, m;
	long long s, t;
	long long  x, y, z;

	scanf("%d %lld", &n,&x);
	for (int i = 0; i < 30; i++){
		k[i] = x % 2;
		x = x / 2;
	}
	for (int j = 0; j < n; j++){
		scanf("%lld %lld", &x, &y);
		a[j] = y;
		for (int i = 0; i < 30; i++){
			b[j][i] = x % 2;
			x = x / 2;
		}
		c[j] = 1;
	}
	t = 0;
	for (int i = 29; i >= 0; i--){
		if (k[i] == 0){
			for (int j = 0; j < n; j++){
				if (b[j][i] == 1)c[j] = 0;
			}
		}
		else{
			s = 0;
			for (int j = 0; j < n; j++){
				if (b[j][i] == 0 && c[j] == 1)s = s + a[j];
			}
			if (s > t)t = s;
		}
	}
	s = 0;
	for (int j = 0; j < n; j++){
		if (c[j] == 1)s = s + a[j];
	}
	if (s > t)t = s;
	printf("%lld\n", t);
	
	return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> pii;
int N;

struct Solver{
  vector<pii> _r;
  vector<pii> _b;
  static bool fa_sd(pii A, pii B){
    if(A.first != B.first){
      return A.first < B.first;
    }else{
      A.second > B.second;
    }
  }
  static bool sd_fd(pii A, pii B){
    if(A.second != B.second){
      return A.second > B.second;
    }else{
      A.first > B.first;
    }
  }
  explicit Solver(vector<pii> r, vector<pii> b) : _r(r), _b(b){}
  bool check(pii Blue, pii Red){
    if(Blue.first > Red.first && Blue.second > Red.second){
      return true;
    }else{
      return false;
    }
  }
  int solve(){
    int ans=0;
    sort(_b.begin(), _b.end(), this->fa_sd);
    sort(_r.begin(), _r.end(), this->sd_fd);
    for(int i=0; i<N; i++){
      int M = (int)_r.size();
      for(int j=0; j<M; j++){
        if(check(_b[i], _r[j])){
          ans++;
          _r.erase(_r.begin()+j);
          break;
        }
      }
    }
    return ans;
  }
};

void read_input(int N, vector<pii> &x){
  for(int i=0; i<N; i++){
    pii init; cin >> init.first >> init.second;
    x.push_back(init);
  }
}

int main(){
  cin >> N;
  vector<pii> red,blue;
  
  read_input(N, red);
  read_input(N, blue);
  Solver solver(red,blue);
  cout << solver.solve() << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

ll dp[21000];
int main() {
    ll H, N;
    cin >> H >> N;
    vll a(N), b(N);
    ll maxa = 0;
    rep(i, N) {
        cin >> a[i] >> b[i];
        chmax(maxa, a[i]);
    }
    rep(i, 21000) dp[i] = INF;

    dp[0] = 0;
    for(ll i = 1; i <= H + maxa; i++) {
        rep(j, N) if(i-a[j] >= 0) chmin(dp[i], dp[i-a[j]] + b[j]);
    }

    ll ans = INF;
    rep(i, maxa) chmin(ans, dp[H+i]);
    cout << ans << endl;
}


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

using namespace std;
const long long MOD = 1e18;



int main() {
    int n;
    cin >> n;
    vector<long long> a(n);
    int zeros = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (!a[i]) zeros++;
    }
    if (zeros > 0) {
        cout << 0;
        return 0;
    }

    long long prod = 1;
    for (int i = 0; i < n; i++) {
        if (a[i] <= 1000000000000000000 / prod) {
            prod *= a[i];
        }
        else {
            cout << -1;
            return 0;
        }
    }
    cout << prod;

    return 0;
}

Measured memory_bytes: 4048
#include<stdio.h>
 int main(void)
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
		if(a<b){if(b<c){
				printf("Yes\n");
			}else{
				printf("No\n");
			}
		}else{
			printf("No\n");
		}
			
		
	return 0;
}

Measured memory_bytes: 580
#include <stdio.h>
#include <stdlib.h>

int main(void) {

	int n;
	double a;

	scanf("%d",&n);

	if(n%2 == 0){
		a=(double)(n/2)/n;
		printf("%f",a);
	}else{
		a=(double)(n/2+1)/n;
		printf("%f",a);
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 128
def resolve():
    S = input()
    n = len(S)
    dp = [[0] * 2 for _ in range(n + 1)]
    dp[0][1] = 1
    for i in range(1, n + 1):
        d = int(S[i - 1])
        dp[i][0] = min(dp[i - 1][0] + d, dp[i - 1][1] + (10 - d))
        dp[i][1] = min(dp[i - 1][0] + (d + 1), dp[i - 1][1] + (10 - 1 - d))
    print(dp[n][0])


if __name__ == "__main__":
    resolve()


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

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

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vi vec(n);
  rep(i, n) cin >> vec[i];
  sort(all(vec));
  cout << vec[n / 2] - vec[n / 2 - 1] << '\n';
  return 0;
}

Measured memory_bytes: 640
from collections import Counter
n = int(input())
a = list(map(int, input().split()))

a_sorted = sorted(a)
a_v = list(Counter(a_sorted).values())
a_k = list(Counter(a_sorted).keys())
count_max = a_v[0]
for i in range(1, len(a_v)):
    count = 0
    if a_k[i] - a_k[i - 1] == 1: 
        count += a_v[i - 1]
    if i < (len(a_v) - 1) and a_k[i + 1] - a_k[i] == 1:
        count += a_v[i + 1]
    count += a_v[i]
    if count > count_max:
        count_max = count
print(count_max)

Measured memory_bytes: 15708
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
// #pragma GCC optimize("O2")
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <ll> ms;
typedef multiset <ll> mms;
typedef queue <ll> mq;
typedef deque <ll> mdq;
typedef stack <ll> mst;
typedef priority_queue <ll> mpq;
typedef priority_queue <ll, vector<ll>, greater<ll> > mmh;
typedef complex<double> cd;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define flush cout.flush();
#define all(v) v.begin(),v.end()
#define deb(x) cout << #x << " " << x << endl;
#define ff first
#define ss second
#define pb(v) push_back(v)
#define lb(v) lower_bound(v)
#define ub(v) upper_bound(v)
#define cn continue
#define forl(i,n) for(ll i=0;i<n;i++)
#define forlr(i,n) for(ll i=n-1;i>=0;i--)
#define rev(s) reverse(s.begin(),s.end())
void swap(ll &a,ll &b) {
	ll tmp=a;
	a=b;
	b=tmp;
}
ll atoistring(string s) {
	stringstream lol(s);
	ll x;
	lol>>x;
	return x;
}
void pv(mv v) {
	forl(i,v.size()) cout<<v[i]<<" ";
	cout<<"\n";
}
void pa(ll *v, ll size) {
	forl(i,size) cout<<v[i]<<" ";
	cout<<"\n";
}
void removeDups(mv &v) {
	sort(all(v));
	mv::iterator it = unique(v.begin(), v.end());
	v.resize(distance(v.begin(), it));
}
inline ld kthRoot(ld n, ll k) {
	return pow(k, (1.0 / k) * (log(n) / log(k)));
}
ll power(ll x, ll y, ll p) {
	ll res=1;
	x=x%p;
	while(y>0) {
		if(y&1) res = (res*x)%p;
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void checkmod(ll &x, ll mod) {
	if(x>=mod) x%=mod;
}

ll mod = 1e9 + 7;

ll arr[200005];
void thisIsMain() {
	ll n;
	cin>>n;
	forl(i,n) cin>>arr[i];
	ll s = 0;
	forl(i,n) {
		s += arr[i];
		if(s >= mod) checkmod(s, mod);
	}
	ll ans = (s * s) % mod;
	forl(i,n) {
		ans -= (arr[i] * arr[i]) % mod;
		if(ans < 0) ans += mod;
	}
	ans *= power(2, mod - 2, mod);
	ans %= mod;
	cout<<ans<<"\n";
}

int main(void)
{
	fastio
	ll t = 1;
	// cin>>t;
	while(t--) thisIsMain();
	return 0;
}

Measured memory_bytes: 5180
N = int(input())
A = [-1]
A.extend(list(map(int, input().split()))) # たべた料理
B = [-1]
B.extend(list(map(int, input().split()))) # 料理の満足度
C = [-1]
C.extend(list(map(int, input().split()))) # i -> i+1ボーナス

manzoku = 0

for i in range(1, N+1):
    manzoku += B[A[i]]
    if A[i-1] + 1 == A[i]:
        manzoku += C[A[i-1]]

print(manzoku)


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

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

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	int N = S.size();
	vector<int> X(N + 1, 0);
	vector<int> pref_mn(N + 1, 0);
	vector<int> suff_mn(N + 1, 0);
	vector<int> pref_mx(N + 1, 0);
	vector<int> suff_mx(N + 1, 0);
	for (int i = 0; i < N; i++) {
		X[i + 1] = X[i] + (S[i] == '0' ? -1 : 1);
		pref_mn[i + 1] = min(X[i + 1], pref_mn[i]);
		pref_mx[i + 1] = max(X[i + 1], pref_mx[i]);
		//cerr << X[i] << endl;
	}
	suff_mn[N] = X[N];
	suff_mx[N] = X[N];
	for (int i = N - 1; i >= 0; i--) {
		suff_mn[i] = min(suff_mn[i + 1], X[i]);
		suff_mx[i] = max(suff_mx[i + 1], X[i]);
	}
	vector<int> L(N + 1, -1);
	for (int i = N; i >= 0; i--) {
		if (X[i] >= 0) {
			L[X[i]] = i;
		}
	}
	int res = pref_mx.back() - pref_mn.back();
	for (int j = 0; j < 2; j++) {
		int cur = N;
		int mx = pref_mx.back();
		//cerr << "mx = " << mx << endl;
		int INF = (int)1 << 60;
		int smx = -INF;
		int smn = INF;
		while (mx >= 0) {
			int i = mx;
			if (i % 2 != j) {
				i--;
			}
			if (i >= 0 && L[i] != -1) {
				//cerr << cur << " " << L[i] - 1 << endl;
				int ncur = min(cur - 1, L[i] - 1);
				int tmx = -INF;
				int tmn = INF;
				while (cur > ncur || (cur >= 0 && S[cur] != '?')) {
					if (cur >= 0) {
						tmx = max(tmx, X[cur] - 2);
						tmn = min(tmn, X[cur] - 2);
					}
					cur--;
				}
				smx = max(smx - 2, tmx);
				smn = min(smn - 2, tmn);
				if (cur >= 0) {
					int mn = min(pref_mn[cur], smn);
					mx = max(pref_mx[cur], smx);
					//cerr << mx << " " << mn << endl;
					res = min(res, mx - mn);
				} else {
					break;
				}
			}else{
				break;
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 51268
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)

const string YES = "YES";
const string NO = "NO";

void solve(long long N, long long K){
    cout << ((K <= (N+1)/2)? YES:NO) << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 764
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleContexts #-}

import Data.Bits
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import Data.IntMap.Strict (IntMap)
import qualified Data.IntMap.Strict as IMS
import Data.IntSet (IntSet)
import qualified Data.IntSet as IS
import qualified Data.Sequence as Seq
import Data.Sequence (Seq)
import qualified Data.Array.IArray as A
import qualified Data.Array.MArray.Safe as A
import qualified Data.Array.MArray as A
import Data.Array (Array)
import Data.Array.Unboxed (UArray)
import Data.Array.IArray (IArray)
import Data.Array.MArray.Safe (MArray)
import Data.Array.IO.Safe (IOArray, IOUArray)
import Data.Array.ST.Safe (STArray, STUArray, runSTArray, runSTUArray)
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Control.Monad
import Control.Monad.ST
-- import Control.Monad.ST.Safe
import Control.Applicative
import Data.Maybe
import Data.Tuple
import Data.Ord
import Control.Monad.State.Strict
import Data.Int
import System.IO
import Data.Function
import Control.Monad.Primitive
import qualified Data.Vector.Primitive.Mutable as VPM
import qualified Data.Vector.Generic.Mutable as VGM
import Data.STRef

main :: IO ()
main = do
  [n,k] <- map read . words <$> getLine
  hs <- VU.unfoldrN n (BS.readInt . BS.dropWhile (<'!')) <$> BS.getLine
  print $ query k hs

query :: Int -> VU.Vector Int -> Int
query k hs = dp V.! (VU.length hs - 1)
  where
    dp = V.generate (VU.length hs) $ \i -> if i == 0 then 0 else
      let beg = max (i-k) 0
      in VU.minimum $ VU.zipWith (+)
                     (VU.map (abs . (hs VU.! i-)) $ VU.slice beg (i-beg) hs)
                     $ V.convert $ V.slice beg (i-beg) dp 


Measured memory_bytes: 20860
import std.stdio, std.string, std.algorithm, std.conv, std.range, std.array;

void main(){
  auto input = readln.chomp.split.map!(to!int).array;
  chain(iota(input[0],min(input[0]+input[2],(input[1]+input[0]+1)/2)),iota(max(input[1]-input[2]+1,(input[0]+input[1])/2),input[1]+1)).uniq.each!writeln;
}

Measured memory_bytes: 256