akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>`

#define slld(longvalue) scanf("%lld", &longvalue)
#define plld(longvalue) printf("%lld\n", longvalue)

#define slf(longvalue) scanf("%lf", &longvalue)
#define plf(longvalue) printf("%lf\n", longvalue)
#define sc(letter) scanf("%c", &letter)
#define pc(letter) printf("%c", letter)

#define ss(name) scanf("%s", name)
#define ps(name) printf("%s", name)

#define pnew printf("\n")

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >
#define pii pair < int, int >

#define printcase(indexing,ans) printf("Case %lld: %lld\n", indexing, ans)

#define pb(x) push_back(x)

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

#define mod 1000000009


using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> n >> m)
    {
        input = n / m;

        if(n % m) input++;
        cout << input << endl;
    }


}




Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a=n/1.08;
	for(int i=a-1;i<=a+1;i++)
	{
		if((int)(i*1.08)==n)
		{
			cout<<i<<endl;
			return 0;
		}
	}
	
		cout<<":("<<endl;
	
	return 0;
}

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

using namespace std;

int main()
{
    int a,b,x;
    cin >> a >>b >>x;
    int ka=a;
    int kb=b*2;
    int sum=0;
    int ans=0;
    if(ka<kb){
        sum+=(x/1000)*1000;
        ans+=(x/1000)*a;
    }
    else{
        sum+=(x/500)*500;
        ans+=(x/500)*b;
    }
    int f=x-sum;
    if(f&&f<=500){
        ans+=min(a,b);
    }
    if(f&&f>500){
        ans+=min(a,b*2);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
 
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = 1e4+1;
const ll inf = 1e9+7;

int main() {
	fastio;
	ll a,b,d,cont=0;
	cin>>a>>b>>d;
	f(i,a,b+1){
		if(i%d==0) cont++;
	}
	cout<<cont<<"\n";
	return 0;
}

Measured memory_bytes: 3588
#include<iostream>
#include<cmath>
using namespace std;
 
const int MAX_N=1005;
int n,m;
int a,b;
 
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>a>>b){
    	if(a*b%2)	cout<<"Yes"<<endl;
    	else	cout<<"No"<<endl;
	}
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define eps 1e-9
#define oo 1e7+5
#define mod 1000000000+7

using namespace std;

typedef unsigned long long ull;
typedef vector<pair<int,pair<int,int>>> dirgraph;
typedef vector<vector<int>> graph;

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);

	int h,w;
	cin>>h>>w;
	
	vector<vector<char>> grid(h,vector<char>(w));
	
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			cin>>grid[i][j];
		}
	}
	
	vector<vector<int>> dp(h+1,vector<int>(w+1,0));
	dp[1][1]=1;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{	
			if(i==0 && j==0)j++;
			
			if(grid[i][j]!='#')
				dp[i+1][j+1]=dp[i+1][j]+dp[i][j+1];
				
			if(dp[i+1][j+1]>mod)dp[i+1][j+1]-=mod;
		}
		
	}
	
	cout<<dp[h][w]<<endl;

	return 0;
}


Measured memory_bytes: 9088
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    ll n;cin>>n;
    ll ans=0;
    rep1(i,n){
        if(i%3==0||i%5==0)continue;
        ans+=i;
    }
    cout<<ans<<endl;
}

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

int main() {
	// your code goes here
	string s;
	cin >> s;
	string f,se;
	f = s.substr(0,2);
	se = s.substr(2,2);
	int first = stoi(f);
	int sec = stoi(se);
	if((first > 0 && first <= 12) && ((sec > 12 && sec <= 99)||sec == 0))
	{
		cout << "MMYY";//break;
	}
	else if((first > 0 && first <= 12) && (sec > 0 && sec <= 12))
	{
		cout << "AMBIGUOUS";//break;
	}
	else if((sec > 0 && sec <= 12) && ((first > 12 && first <= 99)|| first == 0))
	{
		cout << "YYMM";//break;
	}

	else cout << "NA";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int x, y, z;
  cin>>x>>y>>z;
  using __int128_t = long long;
  __int128_t a = x;
  __int128_t b = y;
  __int128_t c = z;

  Double s = abs(Double(a) + 2 * sqrt(Double(a * b)) + Double(b) - Double(c));
  Int ans2 = (Double(a) + 2 * sqrt(Double(a * b)) + Double(b) < Double(c));
  Int ans = 4 * a * b < (c - a - b) * (c - a - b);
  pr(4 * a * b, (c - a - b) * (c - a - b), s, ans, ans2);

  if(s > 1e-3) cout<<(ans2? "Yes":"No")<<endl;
  else cout<<(ans? "Yes":"No")<<endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

func main() {
	defer stdout.Flush()

	N := readInt()
	A := make([]int, N)
	for i := range A {
		A[i] = readInt()
	}

	var x0 int
	s := 1
	for _, v := range A {
		x0 += s * v
		s *= -1
	}

	x := x0
	printf("%d", x)
	for i := 0; i+1 < N; i++ {
		x = (A[i] - (x / 2)) * 2
		printf(" %d", x)
	}
	println()
}

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


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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define read(x) int x; cin>>x;
#define print(x) for(int i=0; i<(int) x.size(); i++) cout<<x[i]<<" "; cout<<endl;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;

const ll INFLL = (ll) 1e16;
const int INF = (int) 1e8;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll a, b, c, k;
	cin>>a>>b>>c>>k;
	
	if(k<=a) cout<<k<<endl;
	else if(k<=a+b) cout<<a<<endl;
	else {
		ll temp = k-a-b;
		cout<<a-temp<<endl;
	}
	return 0;
}


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

using namespace std;
#define int long long
const int MOD = 1000000007;
template <typename Int, Int MOD, int N>
struct comb_util {
	std::array<Int, N + 1> fc, ifc;

	comb_util() {
		fc[0] = 1;
		for (int i = 1; i <= N; i++) fc[i] = fc[i - 1] * i % MOD;
		ifc[N] = inv(fc[N]);
		for (int i = N - 1; i >= 0; i--) ifc[i] = ifc[i + 1] * (i + 1) % MOD;
	}

	Int fact(Int n) { return fc[n]; }

	Int inv_fact(Int n) { return ifc[n]; }

	Int inv(Int n) { return pow(n, MOD - 2); }

	Int pow(Int n, Int a) {
		Int res = 1, exp = n;
		for (; a; a /= 2) {
			if (a & 1) res = res * exp % MOD;
			exp = exp * exp % MOD;
		}
		return res;
	}

	Int perm(Int n, Int r) {
		if (r < 0 || n < r)
			return 0;
		else
			return fc[n] * ifc[n - r] % MOD;
	}

	Int binom(Int n, Int r) {
		if (n < 0 || r < 0 || n < r) return 0;
		return fc[n] * ifc[r] % MOD * ifc[n - r] % MOD;
	}

	Int homo(Int n, Int r) {
		if (n < 0 || r < 0) return 0;
		return r == 0 ? 1 : binom(n + r - 1, r);
	}
};

using comb = comb_util<long long, 1000000007, 300000>;
comb cb;

int N, K;
vector<int> A;
vector<vector<int> > dp;
int rec(const int day, const int sum) {
	//cerr << day<<" "<<sum<<endl;
	if (dp[day][sum] == -1) {
		dp[day][sum] = 0;
		int mx = min(A[day], N - sum);
		for (int i = 0; i <= mx; i++) {
			int coef = cb.binom(N - i, A[day] - i);
			//coef = (coef * i) % MOD;
			coef = (coef * cb.binom(N - sum, i)) % MOD;
			dp[day][sum] = (dp[day][sum] + coef * rec(day + 1, sum + i)) % MOD;
		}
		//cerr << day << " " << sum << " " << dp[day][sum] << endl;
	}
	return dp[day][sum];
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N >> K;
	A.resize(K);
	dp.resize(K + 1, vector<int>(N + 1, -1));
	for (int i = 0; i < N; i++) {
		dp[K][i] = 0;
	}
	dp[K][N] = 1;
	for (int i = 0; i < K; i++) {
		cin >> A[i];
	}
	cout << rec(0, 0) << endl;
}

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

using namespace std;
typedef long long ll;
const int N = 200'010, INF = 2e9;
int n, a[N], d[N], ans[N];
vector<int> g[N];

void dfs(int v, int p = -1) {
    int j = upper_bound(d, d + N, a[v]) - d;
    int tmp = d[j];
    if (d[j - 1] < a[v] && a[v] < d[j])
        d[j] = a[v];
    ans[v] = lower_bound(d, d + N, INF) - d - 1;
    for (auto to : g[v]) {
        if (to != p) dfs(to, v);
    }
    d[j] = tmp;
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    for (int i = 0; i < n - 1; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        u--, v--;
        g[u].push_back(v), g[v].push_back(u);
    }
    fill(d, d + N, INF);
    d[0] = -INF;
    dfs(0);
    for (int i = 0; i < n; i++) printf("%d\n", ans[i]);
}


Measured memory_bytes: 31360
#include <stdio.h>

int main(void)
{
	int menber[31];
	int n, m, j;
	
	m = 28;
	
	while (m--){
		scanf("%d", &n);
		menber[n] = n;
	}
	
	j = 0;
	
	while (j++ != 30){
		if (j != menber[j]){
			printf("%d\n", j);
		}
	}
	return (0);
}

Measured memory_bytes: 596
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var n int
var ans, nodex []int
var amat [][]int

func main() {
	n = readInt()
	q := readInt()

	ans = make([]int, n)
	for i := range ans {
		ans[i] = -1
	}
	amat = make([][]int, n)
	for i := range amat {
		amat[i] = make([]int, 0)
	}

	for i := 0; i < n-1; i++ {
		a, b := readInt(), readInt()
		amat[a-1] = append(amat[a-1], b-1)
		amat[b-1] = append(amat[b-1], a-1)
	}

	nodex = make([]int, n)
	for i := 0; i < q; i++ {
		p, x := readInt(), readInt()
		nodex[p-1] += x
	}

	dfs(0, 0)

	for i := range ans {
		fmt.Println(ans[i])
	}
}

func dfs(i, x int) {
	if i == n {
		return
	}
	x += nodex[i]
	ans[i] = x
	for j := range amat[i] {
		if ans[amat[i][j]] == -1 {
			dfs(amat[i][j], x)
		}
	}
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 47104
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    ld r;
    cin >> r;
    cout << 3 * r * r << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  char x[1001];
  int i=0,sum=0;

  while(1){  
    while(1){
      scanf("%c",&x[i]);
      if(x[i]=='\n') break;
      sum+=x[i]-'0';
      i++;
    }
    if(x[0]=='0') break;
    printf("%d\n",sum);
    i=0; sum=0;
  }
  
  return 0;
}

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

int min(int a, int b) {
	return a < b ? a : b;
}

int time(int a, int b) {
	return (b - a) + min(abs(a), abs(b));
}

int main() {
	int i, n, k, x[100000], r, l, t, min_t, flg = 1;
	scanf("%d%d", &n, &k);
	for (i = 0; i < n; i++) scanf("%d", &x[i]);

	for (i = 0; i < n - k + 1; i++) {
		r = i + k - 1;
		if (x[r] < 0) continue;
		if (x[r] >= 0) {
			flg = 0;
			if (i == 0) l = 0;
			else l = i - 1;
		}
	}
	if (flg) l = n - k - 1;

	for (i = 0; i < n - k + 1; i++) {
		l = i; r = i + k - 1;
		t = time(x[l], x[r]);
		if (i == 0) min_t = t;
		if (min_t > t) min_t = t;
		if (x[l] >= 0) break;
	}
	printf("%d\n", min_t);
	return 0;
}

Measured memory_bytes: 512
from itertools import groupby

N,K = map(int,input().split())
S = list(input())

if N == 1:
    print(1)
    exit()

# nums[i]: iが偶数なら1の個数 奇数なら0の個数
nums = []
if S[0] == "0":
    nums.append(0)
left = 0
while left < N:
    right = left
    while right < N and S[right] == S[left]:
        right += 1
    nums.append(right - left)
    left = right
if S[-1] == "0":
    nums.append(0)

from itertools import accumulate
# 累積和(1-indexed)
nums = [0] + list(accumulate(nums))

answer = 0
for left in range(0,len(nums),2):
    right = min(len(nums)-1, left + 2*K+1)
    answer = max(answer, nums[right] - nums[left])

print(answer)

Measured memory_bytes: 9384
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

int main(void) {
  int n;
  scanf("%d", &n);

  int active = 0;
  int ret = 0;
  
  REP(i, n) {
    int x;
    scanf("%d", &x);

    int pw = (x & (x - 1)) == 0;
    int k = 0;
    while (x > 1) {
      x = (x + 1) / 2;
      k++;
    }
    
    if (pw) {
      if (k > active) {
        ret += k - active;
      }
      active = k;
    } else {
      if (active >= k) {
        active = k - 1;
      } else {
        ret += k - active;
        active = k;
      }
    }
  }
  
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 256
/***************************************************************
	File name: D.cpp
	Author: ljfcnyali
	Create time: 2020年01月12日 星期日 20时12分00秒
***************************************************************/
#include<bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for ( int i = (a), _end_ = (b); i <= _end_; ++ i ) 
#define mem(a) memset ( (a), 0, sizeof ( a ) ) 
#define str(a) strlen ( a ) 
#define pii pair<int, int>
typedef long long LL;

const int maxn = 30;

int n, m, a[maxn][maxn], dt[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}, ans, p[maxn][maxn];
bool vis[maxn][maxn];
char s[maxn];

inline void DFS(int x, int y)
{
    REP(i, 0, 3)
    {
        int u = dt[i][0] + x;
        int v = dt[i][1] + y;
        if ( a[u][v] && p[u][v] > p[x][y] + 1 && !vis[u][v] )
        {
            p[u][v] = p[x][y] + 1;
            vis[u][v] = true;
            DFS(u, v);
            vis[u][v] = false;
        }
    }
}

int main()
{
    scanf("%d%d", &n, &m);
    REP(i, 1, n) 
    {
        scanf("%s", s + 1);
        REP(j, 1, m) if ( s[j] == '.' ) a[i][j] = 1;
    }
    REP(i, 1, n) REP(j, 1, m) if ( a[i][j] ) 
    { 
        mem(vis); memset(p, 0x3f, sizeof(p));
        p[i][j] = 0; vis[i][j] = true;
        DFS(i, j);
        REP(k, 1, n) REP(o, 1, m) if ( p[k][o] != 0x3f3f3f3f ) ans = max(ans, p[k][o]);
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}

ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}

int main() {
  cout << fixed << setprecision(30);
  ll h,n;
  cin>>h>>n;
  vec a(n);
  vec b(n);
  loop(i,n)cin>>a[i]>>b[i];
  ll dp[10*h+1];
  loop(j,10*h+1)dp[j]=1000000000;
  dp[0]=0;
for (int i = 0; i < n; ++i) {
        for (int w = a[i]; w <= 10*h+1; ++w) {
            dp[w] = min(dp[w], dp[w - a[i]] + b[i]);
        }
    }
  ll ans=1000000000;
  Loop(i,h,10*h+1)ans=min(ans,dp[i]);
  putout(ans);
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	vector<int> a(3);
	int k;
	rep(i, 3) cin >> a[i];
	cin >> k;
	sort(a.begin(), a.end());
	int ans = a[2] * pow(2, k) + a[1] + a[0];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long x[1000010],y[1000010];
#define int long long
signed main(){
  
  cin.tie(0);
  ios::sync_with_stdio(false);

  int a,b;
  cin>>a>>b;

  if(a==1) a=14;
  if(b==1) b=14;
 
  if(a>b) cout<<"Alice"<<'\n';
  else if(a<b) cout<<"Bob"<<'\n';
  else cout<<"Draw"<<'\n';
}


Measured memory_bytes: 256
import itertools
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))

pcnt = 0
qcnt = 0
cnt=1

for l in itertools.permutations(range(1,n+1)):
    if p == l:
        pcnt = cnt
        break
    else:
        cnt += 1

cnt=1
for l in itertools.permutations(range(1,n+1)):
    if q == l:
        qcnt = cnt
        break
    else:
        cnt += 1
        
    #print(l)

print(abs(qcnt-pcnt))


Measured memory_bytes: 73360
N,C,K=gets.split.map(&:to_i)
count = 0
busFree = 0
busTime = 0
ts = STDIN.read.split.map(&:to_i).sort
ts.each{|t|
    #puts "1:t=#{t}, busFree=#{busFree}, busTime=#{busTime}"
    if busFree == 0 || t > busTime
        busTime = t + K
        busFree = C
        count += 1
        #puts "2:t=#{t}, busFree=#{busFree}, busTime=#{busTime}"
    end
    busFree -= 1
}
puts count

Measured memory_bytes: 10104
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

#define MAX_V 100000

struct edge{
    int to,weight;
};

vector<edge> G[MAX_V];

pii dfs(int prev, int v){   //searching farthest node
    pii r(0,v);
    
    rep(i,G[v].size()){
        struct edge e = G[v][i];
        if(e.to == prev) continue;
        pii tmp = dfs(v,e.to);
        tmp.first += e.weight;
        if(r.first < tmp.first) r = tmp;
    }
    return r;
}


int diameter() {
    pii r = dfs(-1, 0);
    pii t = dfs(-1, r.second);
    return t.first; // (r.second, t.second) is farthest pair
}

int main(){
    int n;
    cin>>n;
    rep(i,n-1){
        int s,t,w;
        cin>>s>>t>>w;
        G[s].pb(edge{t,w});
        G[t].pb(edge{s,w});
    }
    cout<<diameter()<<endl;
}

Measured memory_bytes: 14484
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> list = new ArrayList<>();
    int sum = 0;

    for(int i = 0 ; i < n - 1 ; i++){
        list.add(sc.nextInt());
    }

    if(n == 2){
        System.out.println(list.get(0)*2);
        System.exit(0);
    }
    for(int i = 0 ; i < n - 2; i++){
        if(i == 0){
            if(list.get(i) > list.get(i + 1)){
                sum += list.get(i)+list.get(i+1);
            }else{
                sum += list.get(i)*2; 
            }
        }else{
            if(list.get(i) > list.get(i+1)){
                sum += list.get(i+1);
            }else{
                sum += list.get(i);
            }
        }

        if(i == n - 3){
            sum += list.get(i+1);
        }
    }

    System.out.println(sum);
    



    





}
}

Measured memory_bytes: 36532
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<utility>
#include<bitset>
#include<complex>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=a; i<=b; ++i)
#define FOR(i,a,b) for(int i=a; i<b; ++i)
#define MP make_pair
typedef long long LL;
typedef pair<int,int> pii;

const int MAXN = 100 * 100 * 2 + 10;
const int INF = 1000000000;

struct Edge {
	int from, to, cap, flow;
};

struct Dinic {
	int n, m, s, t;
	vector<Edge> edges;
	vector<int> G[MAXN];
	bool vis[MAXN];
	int d[MAXN];
	void AddEdge(int from, int to, int cap) {
		edges.push_back((Edge) {
			from, to, cap, 0
		});
		edges.push_back((Edge) {
			to, from, 0, 0
		});
		m = edges.size();
		G[from].push_back(m - 2);
		G[to].push_back(m - 1);
	}
	bool BFS() {
		mem(vis, 0);
		queue<int> Q;
		Q.push(s);
		vis[s] = 1;
		d[s] = 0;
		while(!Q.empty())  {
			int x = Q.front();
			Q.pop();
			for(int i = 0; i < G[x].size(); ++i) {
				Edge& e = edges[G[x][i]];
				if(!vis[e.to] && e.cap > e.flow) {
					vis[e.to] = 1;
					d[e.to] = d[x] + 1;
					Q.push(e.to);
				}
			}
		}
		return vis[t];
	}
	int DFS(int x, int a) {
		if(x == t || a == 0) return a;
		int flow = 0, f;
		for(int i = 0; i < G[x].size(); ++i) {
			Edge&e = edges[G[x][i]];
			if(d[x] + 1 == d[e.to] && (f = DFS(e.to, min(a, e.cap - e.flow))) > 0) {
				e.flow += f;
				edges[G[x][i] ^ 1].flow -= f;
				flow += f;
				a -= f;
				if(a == 0) break;
			}
		}
		return flow;
	}
	int Maxflow(int s, int t) {
		this->s = s;
		this->t = t;
		int flow = 0;
		while(BFS()) {
			flow += DFS(s, INF);
		}
		return flow;
	}
};
Dinic g;

int n, m;
char mmp[105][105];
vector<pii> nd;

int main() {
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i)
		scanf("%s", mmp[i] + 1);

	int tot = 0, ss, tt;
	for(int i = 1; i <= n; ++i)
		for(int k = 1; k <= m; ++k) {
			if(mmp[i][k] == '.') continue;
			nd.push_back( MP(i, k) );
		}

	for(int i = 0; i < nd.size(); ++i) {
		if(mmp[nd[i].first][nd[i].second] == 'S')
			ss = i*2+1;
		else if(mmp[nd[i].first][nd[i].second] == 'T')
			tt = i*2;
		else
			g.AddEdge(i*2, i*2 + 1, 1);
	}

	for(int i = 0; i < nd.size(); ++i) {
		for(int k = 0; k < nd.size(); ++k) {
			if(i == k) continue;
			if(nd[i].first == nd[k].first || nd[i].second == nd[k].second)
				g.AddEdge(i*2 + 1, k*2, INF);
		}
	}

	int ans = g.Maxflow(ss, tt);
	if(ans > 100000)
		printf("-1\n");
	else printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 85468
n=int(input())
li=[]
for i in range(n):
    d1,d2=map(int,input().split())
    li.append([d1,d2])
cnt=0
for i in range(n):
    if li[i][0]==li[i][1]:
        cnt+=1
        if cnt>=3:
            print("Yes")
            exit()
    else:
        cnt=0
print("No")

Measured memory_bytes: 9192
<?php
while (true) {
    list($height, $width) = getSpacesByExplodeTrimInput();
    $lines = array(); 

    if ($height == 0 && $width == 0) {
        break;
    }
 
    for ($i = 0; $i < $height; $i++) {
        if ($i % 2 !== 0) {
                $lines[] = setEvenNumLine($width);
        } else {
                $lines[] = setOddNumLine($width);
        }
    }

    echo implode($lines), PHP_EOL;
}
 
function getSpacesByExplodeTrimInput()
{
    return explode(' ', trim(fgets(STDIN)));
}
 
function setEvenNumLine($width)
{
    $line = "";
    for ($i = 0; $i < $width; $i++) {
        $line .= $i % 2 ? "#" : ".";
    }
    return $line.PHP_EOL;
}
 
function setOddNumLine($width)
{
    $line = "";
    for ($i = 0; $i < $width; $i++) {
        $line .= $i % 2 ? "." : "#";
    }
    return $line.PHP_EOL;
}

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 100010, mod = 1e9 + 7;

string s;
bool f[N];

int main()
{
    cin >> s;

    f[0] = true;
    for(int i = 0; i < s.size(); i++)
    {
        if(!f[i]) continue;

        if(i + 5 <= s.size() && s.substr(i, 5) == "dream") f[i + 5] = true;
        if(i + 5 <= s.size() && s.substr(i, 5) == "erase") f[i + 5] = true;
        if(i + 6 <= s.size() && s.substr(i, 6) == "eraser") f[i + 6] = true;
        if(i + 7 <= s.size() && s.substr(i, 7) == "dreamer") f[i + 7] = true;
    }

    if(f[s.size()]) puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

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

        int h = stdIn.nextInt();
        int n = stdIn.nextInt();

        int totalAttack = 0;
        for (int i = 0; i < n; i++) {
            totalAttack += stdIn.nextInt();
        }

        if (totalAttack >= h) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}


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

using namespace std;

int main(void)
{
    int length;
    vector<int> perm;

    cin >> length;
    for(int i = 0; i < length; i++){
        int p;
        cin >> p;
        perm.push_back(p);
    }

    int current_min = length + 1;
    int valid_count = 0;
    for(int i = 0; i < length; i++){
        if(current_min > perm[i]){
            current_min = perm[i];
            valid_count += 1;
        }
    }

    cout << valid_count << endl;

    return 0;
}

Measured memory_bytes: 1400
import sys
# import math

N = int(input())
A = list(map(int, input().split()))
kari = [0] * (N+1)

ans = 0
nokori = 1

for i in range(N+1):
    if (nokori == 0)or(A[i] > nokori):
        print(-1)
        sys.exit()

    nokori -= A[i]
    ans += A[i]
    # dump((i,ans,nokori))
    kari[i] = nokori
    nokori *= 2

mx = A[N]

for i in reversed(range(N)):
    mx = min(kari[i], mx)
    ans += mx
    mx += A[i]

print(ans)

Measured memory_bytes: 668708
#include <bits/stdc++.h>
using namespace std;
int n,a,b,c,d;
string s;
bool ck(int pos)
{
	return (pos >= 1 && pos <= n && s[pos] == '.');

}
bool jump(int pos1,int pos2)
{
	while(pos2 - pos1 > 2)
	{
		if(ck(pos1 + 2) == true)
			pos1 += 2;
		else if(ck(pos1 + 1) == true)
			pos1 += 1;

		else
			return false;
	}

	return true;
}

int main()
{
	cin>>n>>a>>b>>c>>d;
	cin>>s;
	s = "1" + s;
	int sai = 0;
	if(c < d)
	{
		sai += jump(b,d);
		sai += jump(a,c);

		if(sai != 2)
			cout<<"No";

		else
			cout<<"Yes";

		return 0;
	}
	
	while(a+2 < b)
	{
		if(ck(a+1) == true && a+1 <= c)
			a++;

		else if(ck(a+2) == true && a+2 <= c)
			a += 2;
		
		else
		{
			cout<<"No";
			return 0;
		}
	}

	while(a < b)
	{
		// cout<<a<<' '<<b<<'\n';
 
		if(ck(a+2) == true && a+2 > b && a+2 <= c)
		{
			a += 2;
			break;
		}
 
		if(ck(b+1) == true && b+1 <= d)
			b++;
 
		else if(ck(b+2) == true && b+2 <= d)
			b+=2;
 
		else
		{
			cout<<"No";
			return 0;
		}
 
		if(ck(a+2) == true && a+2 != b && a+2 <= c)
			a += 2;
 
		else if(ck(a+1) == true && a+1 != b && a+1 <= c)
			a++;
 
		else
		{
			cout<<"No";
			return 0;
		}
 
	}

	if(a > c || b > d)
	{
		cout<<"No";
		return 0;
	}

	sai += jump(a,c);
	sai += jump(b,d);

	if(sai != 2)
		cout<<"No";

	else
		cout<<"Yes";

	return 0;

}

Measured memory_bytes: 772
a, b, x = map(int,input().split())
import math
def angle(a,b,x):
    if x < (a ** 2) * b/2:
        c = a * (b ** 2)/(2 * x)
        return math.degrees(math.atan(c))
    else:
        y = (a ** 2) * b - x
        d = 2 * y / (a ** 3)
        return math.degrees(math.atan(d))
print(angle(a,b,x))

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

using namespace std;

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

int main(){
   string S;
   cin>>S;
   string Odd="RUD",Even="LUD";
   bool check[100];
   for(int i=0;i<S.length();i++)
       check[i]=false;

   for(int i=0;i<(int)(S.length());i++){
       if(i%2==0){
           for(int j=0;j<3;j++){
               if(Odd.at(j)==S.at(i)){
                  check[i]=true;
               }
           }
       }
       if(i%2==1){
           for(int j=0;j<3;j++){
               if(Even.at(j)==S.at(i)){
                  check[i]=true;
               }
           }
       }
   }
   for(int i=0;i<(int)(S.length());i++)
       if(check[i]==false){
           cout<<"No"<<endl;
           return 0;
       }
       cout<<"Yes"<<endl;
    return 0; 
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    double l;
    cin>>l;
    cout<<fixed<<setprecision(15)<<(l/3.)*(l/3.)*(l/3.)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
constexpr array<int, 4> dx = {1, 0, -1, 0};
constexpr array<int, 4> dy = {0, 1, 0, -1};
constexpr int MOD = 100000000 + 7;

// constexpr int MOD = 998244353;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int factorial(int n)
{
    int rtn = 1;
    for (int i = 2; i <= n; i++)
    {
        rtn *= i;
    }
    return rtn;
}
int modpow(int a, int n)
{
    int res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

constexpr double getDist(pair<int, int> a, pair<int, int> b)
{
    return sqrt(pow(a.first - b.first, 2) + pow(a.second - b.second, 2));
}

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

    int n;
    cin >> n;
    vector<pair<int, int>> town(n);
    vector<vector<double>> dist(n, vector<double>(n, 0));
    for (auto &&t : town)
    {
        int x, y;
        cin >> x >> y;
        t = make_pair(x, y);
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            dist[i][j] = dist[j][i] = getDist(town[i], town[j]);
        }
    }

    double sum_dist = 0;

    vector<int> order(n);
    iota(order.begin(), order.end(), 0);
    do
    {
        for (int i = 0; i < n - 1; i++)
        {
            int from = order[i], to = order[i + 1];
            sum_dist += dist[from][to];
        }
    } while (next_permutation(order.begin(), order.end()));

    cout << sum_dist / (double)factorial(n) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define KK 500
#define N 100005
#define MXN 200005
int main(){
    int n,x;
    scanf("%d %d",&n,&x);
    int a[2005];
    for(int i = 0;i<n;i++)
        scanf("%d",&a[i]);
    LL ans=0;
    int b[2005];
    for(int i =0;i<n;i++)
        b[i]=a[i],ans+=a[i];
    for(int i = 1;i<n;i++){
        for(int j=0;j<n;j++){
            b[j]=min(b[j],a[(j-i+n)%n]);
        }
        LL sum=(LL)i*x;
        for(int j =0;j<n;j++)
            sum+=b[j];
        ans=min(ans,sum);
    }
    
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
signed main(){
    string s;
    cin>>s;
    rep(i,(s.size()+1)/2){
        cout<<s[i*2];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 512
n = int(input())
h = list(map(int,input().split()))
h.append(0)
flag = 1
for i in range(n):
  if h[i] < h[i-1]:
    flag = 0
    break
  elif h[i] == h[i-1]:
    pass
  else:
    h[i] -= 1
if flag == 1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 14252
#include<stdio.h>
int main(){
    int i,a,b,c,count=0;
    scanf("%d %d %d",&a,&b,&c);
    for(i=a;i<=b;i++){
        if(c%i==0){
            count++;
        }
    }
    
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 2104
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,A,B;
	scan(N);scan(A);scan(B);
	if((B-A)%2) prin("Borys");
	else prin("Alice");
	return 0;
}


Measured memory_bytes: 256
//----------------------------おまじない
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")
//----------------------------
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REPN(i,n) for (int i=(n);i>=0;i--)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#include <bits/stdc++.h>
using namespace std;

//------------------------------typedef集
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<vvi> vvvi;
typedef long long ll;

int sx,sy,tx,ty,x,y;
int table[3000][3000];

void bfs(){
    deque<pi> q;
    table[sx][sy] = -1;
    q.pb(mp(sx,sy));

    while(!q.empty()){
        pi v = q.front();
        q.pop_front();
        x = v.first;
        y = v.second;
        if (x==tx && y==ty) break;
        if (x > 0 && !table[x-1][y]){
            table[x-1][y] = 1;
            q.pb(mp(x-1,y));
        }
        if ( x < 2999 && !table[x+1][y]){
            table[x+1][y] = 2;
            q.pb(mp(x+1,y));
        }
        if (y > 0 && !table[x][y-1]){
            table[x][y-1] = 3;
            q.pb(mp(x,y-1));
        }
        if ( y < 2999 && !table[x][y+1]){
            table[x][y+1] = 4;
            q.pb(mp(x,y+1));
        }
    }
    table[sx][sy] = 0;

    deque<char> s;
    while (x!=sx or y!=sy){
        int tmp = table[x][y];
        table[x][y] = -1;
        switch (tmp) {
            case 1:
                x++;
                s.push_front('L');
                break;
            case 2:
                x--;
                s.push_front('R');
                break;
            case 3:
                y++;
                s.push_front('D');
                break;
            case 4:
                y--;
                s.push_front('U');
                break;
        }
    }
    for (auto i: s) printf("%c",i);


    table[tx][ty] = 0;
    REP(i,3000) REP(j,3000) if (table[i][j] > 0) table[i][j] = 0;
}

int main(){
    I(sx); sx += 1500;
    I(sy); sy += 1500;
    I(tx); tx += 1500;
    I(ty); ty += 1500;

    bfs();
    swap(sx,tx); swap(sy,ty);
    bfs();
    swap(sx,tx); swap(sy,ty);
    bfs();
    swap(sx,tx); swap(sy,ty);
    bfs();
    cout << endl;
}


Measured memory_bytes: 35456
#include <iostream>
using namespace std;
int main(){
  int sum = 0;
  int min = 0;
  int x;
  cin >> min;
  for(int k=0; k < 4; k++){
    cin >> x;
    if(x%10 == 0)
      sum += x;
    else if(x%10 >=  min%10)
      sum += x + 10 - x%10;
    else{
      sum += min + 10 - min%10;
      min = x;
    }
  }
  cout << sum+min << endl;
  return 0;
}


Measured memory_bytes: 256
m = 998244353

gets # drop N

d = gets.split.map(&:to_i)

grouped = d.group_by { |i| i }
sorted_keys = grouped.keys.sort

unless sorted_keys.each_with_index.all? { |a, b| a == b }
  puts 0
  exit
end

if grouped[0].size != 1 || d[0] != 0
  puts 0
  exit
end

answer = 1

sorted_keys.drop(1).each do |key|
  answer *= (grouped[key - 1].size ** grouped[key].size)
  answer %= m
end

puts answer


Measured memory_bytes: 21128
//#pragma GCC optimize("Ofast")

#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,fma")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define M 998244353
#define all(x) x.begin(),x.end()
using namespace std;
// From Geeksforgeeks
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
// Power function took from geeksforgeeks
ll power(ll x, ll y)
{
	ll res = 1;

	x = x%N;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x)%N;
		y = y >> 1;
		x = (x * x)%N;
	}
	return res;
}
double dist(ll x1,ll y1, ll x2,ll y2)
{
	double ans = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string s;
	cin >> s;
	string flag = "Yes";
	f(i, 0, s.length())
	{
		if (i % 2 == 0)
		{
			if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
				flag = "Yes";
			else
			{
				flag = "No";
				break;
			}
		}
		else
		{
			if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
				flag = "Yes";
			else
			{
				flag = "No";
				break;
			}
		}
	}
	cout << flag;
	return 0;
}


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

vector<ll> adj[100001];

ll dp[100005][2];

ll solve(ll node, bool constrall, ll pr)
{
	ll ans = 0;

	if (dp[node][constrall] != -1)
		return dp[node][constrall];

	ll w1 = 1;
	//If I pall node white, no constralls on children
	for (ll child : adj[node])
	{
		if (child != pr)
			w1 = (w1 * solve(child, 0, node)) % mod;
	}
	ans = (ans + w1) % mod;

	//If I can pall it black, children have constrall, can't be black
	if (!constrall) {
		ll w2 = 1;
		for (ll child : adj[node])
		{
			if (child != pr)
				w2 = (w2 * solve(child, 1, node)) % mod;
		}
		ans = (ans + w2) % mod;
	}

	return dp[node][constrall] = ans;
}

int main()
{

	memset(dp, -1, sizeof(dp));

	ll n;
	cin >> n;

	ll e = n - 1;
	while (e--)
	{
		ll a, b;
		cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}

	cout << solve(1, 0, -1); //root, constrall, parent
}

Measured memory_bytes: 17420