akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define printvector(v,n) for(int i=1;i<=n;i++) cout<<v[i]<<" "; cout<<ln;
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for int64)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define RFOR(i,b,a) for(int i=b; i>=a; i--)
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define setPresent(x,s) (s.find(x)!=s.end())
#define flush() fflush(stdout)
typedef long long int64;
typedef pair<int,int> p32;
typedef pair<int64,int64> p64;
typedef pair<double,double> pdd;
typedef vector<int64> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
template<class T> using min_heap = priority_queue<T, std::vector<T>, std::greater<T> >;
const int lim=1e5+5;
int64 x,y,n,t,p[lim],c[lim];
vp64 vx,vy;
vector<pair<int64,p64> > e;

int64 find(int64 x){
	return p[x]==x ? x : find(p[x]); 
}
void unite(int64 a,int64 b){
	a=find(a);b=find(b);
	if(c[a]<c[b]) swap(a,b);
	p[b]=a; c[a]+=c[b];	
}
int main(){
	cin>>n;
	FOR(i,1,n) p[i]=i;
	FOR(i,1,n) c[i]=1;
	FOR(i,1,n){
		cin>>x>>y;
		vx.pb(mp(x,i)); vy.pb(mp(y,i));
	}
	sort(vx.begin(),vx.end());
	sort(vy.begin(),vy.end());
	FOR(i,0,n-2){
		e.pb(mp(abs(vx[i].fi-vx[i+1].fi),mp(vx[i].se,vx[i+1].se)));
	}
	FOR(i,0,n-2){
		e.pb(mp(abs(vy[i].fi-vy[i+1].fi),mp(vy[i].se,vy[i+1].se)));
	}
	sort(e.begin(),e.end());
	for(auto & ed:e){
		if(find(ed.se.fi)!=find(ed.se.se)){
			unite(ed.se.fi,ed.se.se);
			t+=ed.fi;
		} 	
	}
	cout<<t<<endl;
}


Measured memory_bytes: 14176
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if (a - b * 2 > 0){
    cout << a - b * 2 << '\n';
  }
  else{
    cout << "0\n";
  }
  return 0; 
}

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

int main(){
	int n,m;
	cin>>n>>m;
	vector<string> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	vector<string> b(m);
	for(int i=0;i<m;i++){
		cin>>b[i];
	}
	bool res=false;
	for(int i=0;i<=n-m;i++){
		for(int j=0;j<=n-m;j++){
			bool ismatch=true;
			for(int ii=0;ii<m;ii++){
				for(int jj=0;jj<m;jj++){
					if(a[i+ii][j+jj]!=b[ii][jj]) ismatch=false;
				}
			}
			res=res|ismatch;
		}

	}
	cout<<(res?"Yes":"No")<<endl;
	return 0;
}


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

int main(){
	int n,k;
	cin >> n >> k;
	ll ans(0);
	ans += pow(n/k,3);
	if(k%2 == 0){
		int cnt(0);
		for(int i(1);i<=n;++i){
			if(i%k == k/2) cnt++;
		}
		ans += pow(cnt,3);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// In The Name Of Allah
// Mehrkish Makuei

#include <bits/stdc++.h>

#define pb push_back
#define debug1(x) cerr << #x << " : " << x << endl;
#define debug2(x, y ) cerr << #x << " : " << x << "  " << #y << " : " << y << endl;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef vector <ll> vll;
typedef set <char> sch;
typedef set <ll> sll;

const ll MOD = 1e9 + 7;
const ll MAXN = 1e3 + 19;

ll n, a[3];
vll v[MAXN];

int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	for ( int i = 0; i < 3; i++ )
		cin >> a[i];
	sort( a, a + 3 );
	cout << a[0] + a[1] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  int n, m;
  int city[51] = {0};
  int i;
  scanf("%d %d", &n, &m);
  for(i=0;i<m;++i){
    int a, b;
    scanf("%d %d", &a, &b);
    ++city[a];
    ++city[b];
  }
  for(i=1;i<=n;++i){
    printf("%d\n", city[i]);
  }
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    int K,X;
    cin >> K >> X;
    if(K*500>=X) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
/*  /$$                                     /$$
      | $$                                    | $$
  /$$$$$$$  /$$$$$$   /$$$$$$$  /$$$$$$   /$$$$$$$  /$$$$$$   /$$$$$$
 /$$__  $$ /$$__  $$ /$$_____/ /$$__  $$ /$$__  $$ /$$__  $$ /$$__  $$
| $$  | $$| $$$$$$$$| $$      | $$  \ $$| $$  | $$| $$$$$$$$| $$  \__/
| $$  | $$| $$_____/| $$      | $$  | $$| $$  | $$| $$_____/| $$
|  $$$$$$$|  $$$$$$$|  $$$$$$$|  $$$$$$/|  $$$$$$$|  $$$$$$$| $$
 \_______/ \_______/ \_______/ \______/  \_______/ \_______/|__//$$$$$$ /$$$$$$
                                                               |______/|______/

*/
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#define fastio        ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ln            cout << endl;
#define vi            vector<int>
#define vll           vector<long long>
#define sortl(vec)    sort(vec.begin(), vec.end());
#define sortr(vec)    sort(vec.rbegin(), vec.rend());
#define forn(i, x, n) for(long long i = x; i < n; i++)
#define revn(i, n, x) for(long long i = n; i >= x; i--)
#define in(vec)       for(auto &it : vec) cin >> it;
#define loop(vec)     for(auto &it : vec)
#define	out(vec)      for(auto &it : vec) cout << it << " "; ln
#define ll            long long
#define mod           1000000007
#define pb            emplace_back
#define mp            make_pair
#define um            unordered_map
#define pii           pair<int, int>
#define pll           pair<ll, ll>
#define f             first
#define s             second
#define pi            3.14159265359
#define o(x)		  cout << x << endl;
#define CLOCK         cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
using namespace std;

ll bS(ll l, ll r, ll x, vll arr) {
	while (l <= r) {
		ll m = l + (r - l) / 2;

		if (arr[m] == x)
			return m;

		if (arr[m] < x)
			l = m + 1;

		else
			r = m - 1;
	}

	return -1;
}

void primeFactors(ll n) {
	while (n % 2 == 0) {
		//cout << 2 << " ";
		n = n / 2;
	}

	for (ll i = 3; i <= sqrt(n); i += 2) {
		while (n % i == 0) {
			//cout << i << " ";
			n = n / i;
		}
	}

	if (n > 2)
		cout << n << " ";
}

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;
}

ll modulo(ll a, ll b) {
	ll c = a % b;
	return (c < 0) ? c + b : c;
}

int main() {
// in(vec) works for size-defined type vectors

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input1.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output1.txt", "w", stdout);
#endif

	fastio
	ll t = 1;
	//cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll sum = 0;
		forn(i, 1, n + 1) {

			ll c = n / i;
			sum += (i * c * (c + 1)) / 2;

		}
		o(sum)

	}
	CLOCK
	return 0;
}



Measured memory_bytes: 3840
#include <iostream>
using namespace std;
int main(void){
  int d;
  cin>>d;
  switch(d){
  case 25:
    cout<<"Christmas\n"<<endl;
    break;
  case 24:
    cout<<"Christmas Eve\n"<<endl;
    break;
  case 23:
    cout<<"Christmas Eve Eve\n"<<endl;
    break;
  case 22:
    cout<<"Christmas Eve Eve Eve\n"<<endl;
    break;
  }
}

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

int main() {

    if(fopen("input_muntu.in", "r")) {
        freopen("input_muntu.in", "r", stdin);
        freopen("output_muntu.out", "w", stdout);
    }

    int a, b, c; cin >> a >> b >> c;
    if(a + b + c < 22) cout << "win" << endl;
    else cout << "bust" << endl;

    return 0;
}

// compile and run : g++ wtf.cpp -o wtf -std=c++11 && wtf

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
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;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

const int MAX = 1001001;
const ll MOD = 998244353;
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i % MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i) % MOD;
        finv[i]=finv[i-1]*inv[i] % MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
}
signed main(){
    COMinit();
    ll n,a,b,k;
    cin >> n >> a >> b >> k;
    ll ans=0;
    rep(p,n+1){
        if((k-a*p)%b==0){
            ll q=(k-a*p)/b;
            ans+=(COM(n,p)*COM(n,q))%MOD;
            ans%=MOD;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 23680
from sys import stdin
def main():
    readline=stdin.readline
    K,N=map(int,readline().split())
    A=list(map(int,readline().split()))
    B=list()
    for i in range(N):
        if A[i]==0 or A[i]==K//2:
            B.append(A[i])
        else:
            B.append(A[i])
            B.append(A[i]-K)
    B.sort()
    mi=0
    ma=0
    res=K
    for i in range(len(B)):
        if i+N-1<=len(B)-1:
            mi=B[i]
            ma=B[i+N-1]
            res=min(res,ma-mi)
        else:
            break
    print(res)
if __name__=="__main__":
    main()

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

using ll = long long;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif

	int n,m,a,b; cin>>n>>m>>a>>b;
	int ans[n][m];
	for (int i = 0; i < n; i += a) 
	for (int j = 0; j < m; j += b) {
		for (int p = 0; p < a && i+p < n; p++)	
			for (int q = 0; q < b && j+q < m; q++)
				ans[i+p][j+q] = 4000;
		if (i+a-1<n && j+b-1<m)
			ans[i+a-1][j+b-1] = -((a*b-1)*4000+1);
	}	
	stringstream ss;
	ll cnt = 0;
	for (int i = 0; i < n; i++) 
		for (int j = 0; j < m; j++) {
			ss << ans[i][j] << " \n"[j==m-1];
			cnt += ans[i][j];
		}
	if (cnt > 0) cout << "Yes" << endl << ss.str();
	else cout << "No" << endl;

#ifdef LOCAL
	cout << setprecision(12) << (long double)(clock()-start) / CLOCKS_PER_SEC << endl;
#endif
	
	return 0;
}



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


int main() {
  int n;
  cin >> n;
  vector<int> b(n-1);

  for(int i=0; i<n-1; i++){
    cin >> b.at(i);
  }

  int ans = 0;

  ans += b.at(0);

  for(int i=0; i<n-2; i++){
    ans += min(b.at(i), b.at(i+1));
  }

  ans += b.at(n-2);

  cout << ans << endl;
  
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<long, long, int> f = (x, y) => Max(x.ToString().Count(), y.ToString().Count());

            var n = long.Parse(Console.ReadLine());
            var sqrtN = Sqrt(n);

            var minF = int.MaxValue;

            //nが素数の場合、処理を中断
            // if (isPrime(n))
            // {
            //     var a = n.ToString().Count();
            //     Console.WriteLine(f(1, n));
            // }
            // else
            // {
                for (int i = 1; i <= sqrtN; i++)
                {
                    var a = i;
                    if (n % a == 0)
                    {
                        var b = n / a;
                        minF = Min(minF, f(a, b));
                    }
                }
                Console.WriteLine(minF);
            // }

        }

        static bool isPrime(long x)
        {
            if (x < 2) return false;
            else if (x == 2) return true;
            else if (x % 2 == 0) return false;

            double sqrtX = Math.Sqrt(x);

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

    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln =  '\n';

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<ld> a(n);
  rep(i,n){
    cin >> a[i];
  }
  vector<ld> dp(3010,0);
  dp[0]=1;
  rep(i,n){
    vector<ld> dpn(3010,0);
    rep(j,i+1){
      dpn[j+1] += dp[j]*a[i];
      dpn[j] += dp[j]*(1-a[i]);
    }
    swap(dp,dpn);
  }
  ld ans = 0.0;
  rep(i,(n+1)/2){
    ans += dp[n-i];
  }
  cout << fixed << setprecision(10) << ans << ln;
  return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<vector>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;
const double EPS=1e-7;

ll N,A,B;
ll v[100];
ll nCk(ll n, ll k) {
  ll ans = 1;
  for (ll i = n, j = 1; j <= k; i--, j++) ans = (ans * i/j) ;
  return ans;
}
ll C[100][100];
void nCkInit(){
    for(int i=0;i<=N;++i){
        for(int j=0;j<=i;++j){
            if(j==0 || j==i){
                C[i][j]=1LL;
            }else{
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }   
    }
}
int main(){
    cin>>N>>A>>B;
    for(ll i=0;i<N;i++){
        cin>>v[i];
    }
    sort(v,v+N,greater<ll>());
    ll allCnt=0;
    for(ll i=0;i<N;i++){
        if(v[i]==v[A-1]){
            allCnt++;
        }
    }
    double ave=0;
    ll innerCnt=0;
    for(ll i=0;i<A;i++){
        ave+=v[i];
        if(v[i]==v[A-1]){
            innerCnt++;
        }
    }
    ave/=A;
    cout<<setprecision(10)<<ave<<endl;

    if(v[0]==v[A-1]){
        ll ans=0;
        for(ll i=A;i<=B;i++){
            ans+=nCk(allCnt,i);
            //ans+=C[allCnt][i];
        }
        cout<<ans<<endl;
    }else{
        cout<<nCk(allCnt,innerCnt)<<endl;
        //cout<<C[allCnt][innerCnt]<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=100010,M=110;
int a[M];
int main(){
	int n=ni,m=ni,cnt=0;
	for(int i=1;i<=m;i++){
		a[i]=ni;
		cnt+=a[i]&1;
	}
	if(cnt>2){
		puts("Impossible");
		return 0;
	}
	if(m==1){
		if(a[1]==1){
			puts("1\n1\n1");
		}else{
			printf("%d\n2\n%d 1\n",a[1],a[1]-1);
		}
		return 0;
	}
	cnt=0;
	for(int i=1;i<=m;i++){
		if(a[i]&1){
			if(cnt==0){
				swap(a[i],a[1]);
			}else{
				swap(a[i],a[m]);
			}
			cnt++;
		}
	}
	for(int i=1;i<=m;i++){
		printf("%d ",a[i]);
	}
	putchar('\n');
	a[1]++,a[m]--;
	if(a[m]==0){
		m--;
	}
	printf("%d\n",m);
	for(int i=1;i<=m;i++){
		printf("%d ",a[i]);
	}
	putchar('\n');
	return 0;
}

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

vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end(), greater<long long>());
    return ret;
}

int main(){
    long long n, m;
    cin >> n >> m;

    vector<long long> ret;
    ret = divisor(m);
    long long ans = 1;
    for(long long i = 0; i < ret.size(); i++){
        if(m/ret[i] >= n){
            ans = ret[i];
            break;
        }
    }

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

Measured memory_bytes: 3640
#include<iostream>

using namespace std;

int min(int a, int b){
  if(a <= b) return a;
  else return b;
}
  
int main(){
  int N;
  cin >> N;
  int B[N-1];
  for(int i = 0; i < N-1; i++) cin >> B[i];
  int sum = B[0];
  for(int i = 1; i < N-1; i++){
    sum += min(B[i-1],B[i]);
  }
  sum += B[N-2];
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int h,n;
	cin >>h>>n;
	vector<pair<int,int>>data(n);
	rep(i,n){
		cin>>data[i].F>>data[i].S;
	}
	vector<vector<int>>dp(n+2,vector<int>(h+2,INF));
	dp[0][0]=0;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=h;j++){
		//	clog<<dp[i][j]<<" ";
			chmin(dp[i+1][j],dp[i][j]);
			if(i!=n){
			chmin(dp[i+1][min(j+data[i].F,h)],dp[i][j]+data[i].S);
			}
			if (i != 0)
			{
				chmin(dp[i][min(h,j + data[i - 1].F)], dp[i][j] + data[i - 1].S);
			}
		}
	//	clog<<endl;
	}
	cout<<dp[n][h]<<endl;
}

Measured memory_bytes: 39552
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MT make_tuple
#define PB push_back
typedef long long ll;

ll get (ll a, ll b) {
        if (b%a) {
                return (b/a + 1) * a * 2 + get(b%a, a - (b%a));
        }
        return (b/a) * a * 2 + a;
}

int main () {
        ll n, x;
        cin >> n >> x;
        cout << get(n-x, x) - (n-x) + x << endl;
        return 0;
}


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

using namespace std;

long long h;

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

    string r = "zabcdefghijklmnopqrstuvwxy";

    cin >> h;
    string rere = "";
    while(h != 0){
                if(h % 26 != 0){
                    rere += (h % 26) + 'a' - 1;
                    h /= 26;
                } else {
                    rere += 'z';
                    h /= 26;
                    h--;
                }
            }
    reverse(rere.begin(), rere.end());
    cout << rere << '\n';
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
#define ll long long 

int main(){
  int n;cin>>n;
  ll a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]==0){
      cout<<0<<endl;
      return 0;
    }
  }
  ll s=1;
  for(int i=0;i<n;i++){
    if(a[i]<=(ll)1e18/s) s*=a[i];
    else{
      cout<<-1<<endl;
      return 0;
    }
  }
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 3908
use proconio::input;
use std::cmp::max;

fn main()
{
    input! {
    n:i32,
    h:[i32;n],
    }

    let mut ans = 0;
    let mut mx = 0;

    for &i in h.iter() {
        mx = max(mx, i);
        if mx <= i { ans += 1; }
    }
    
    println!("{}", ans);
}

Measured memory_bytes: 2120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxN = 1e5+7;
const int maxM = 1e5+7;
const int maxV = 90010;
//const int INF = 1e9+9;
const ll INF = (1ll)<<60;
//const int INF = 2e9+9;
const int MOD = 1e9+7;

int n,d;
int a[110][110];

int main()
{
    scanf("%d%d",&n,&d);
 	for(int i=1;i<=n;i++)
 	{
 		for(int j=1;j<=d;j++)
 		{
 			scanf("%d",&a[i][j]);	
		}
	}
	int cnt = 0;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			int tmp = 0;
			for(int k=1;k<=d;k++)
			{
				tmp += abs(a[i][k] - a[j][k])*abs(a[i][k] - a[j][k]);
			}
			int x = sqrt(tmp);
			if(x * x == tmp)
				cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
int sum=a+b+c;
int Max=max({a,b,c});
int Min=min({a,b,c});
int mid=sum-Max-Min;
int ans=Max-mid;
Min+=ans;
if(((Max-Min)%2)==0)
ans+=(Max-Min)/2;
else
ans+=(Max-Min)/2+2;
cout<<ans<<endl;
return 0;
}


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

int main(){
  int x1,y1,x2,y2,x3,y3,x4,y4,rx,ry;
  cin >> x1 >> y1 >> x2 >> y2;
  rx = x2 - x1;
  ry = y2 - y1;
  
  x3 = x2 - ry;
  y3 = y2 + rx;
  x4 = x1 - ry;
  y4 = y1 + rx;

  cout << x3 <<" "<< y3 <<" "<< x4 <<" "<< y4 << endl;
  return 0;
}

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

#define Rep(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) Rep(i, 0, n)

int movX[8] = {-1, 0, 1,-1, 1,-1, 0, 1};
int movY[8] = {-1,-1,-1, 0, 0, 1, 1, 1};
typedef pair<int, int> pii;

template<class T> T read() {
	T t;
	cin >> t;
	return t;
}

int main(){
	int h=read<int>(),w=read<int>();
	int mp[h][w];
	rep(i,h) rep(j,w){
		char c=read<char>();
		if(c=='.'){
			mp[i][j]=0;
		}else{
			mp[i][j]=c-'0';
		}
	}
	int around[h][w];
	Rep(i, 1, h-1){
		Rep(j, 1, w-1){
			int a = 0;
			rep(k,8) {
				int x = i+movX[k];
				int y = j+movY[k];
				if(!mp[x][y]){
					a++;
				}
			}
			around[i][j]=a;
		}
	}
	
	
	vector<pii> list;
	Rep(i, 1, h-1){
		Rep(j, 1, w-1){
			if(mp[i][j]>0 && around[i][j]>=mp[i][j]){
				list.push_back(pii(i,j)); 
			}
		}
	}
	if(list.size()==0){
		cout << 0 << endl;
		return 0;
	}
	for(vector<pii>::iterator it=list.begin();it!=list.end();it++){
		int i = it->first, j = it->second;
		mp[i][j] = 0;
		rep(k,8) {
			int x = i+movX[k];
			int y = j+movY[k];
			around[x][y]++;
		}
		// printf("(%d, %d)\n",i,j);
	}
	// printf("=============\n");
	
	int count = 1;
	while(true){
		vector<pii> list2;
		for(vector<pii>::iterator it=list.begin();it!=list.end();it++){
			int i = it->first, j = it->second;
			// cout << i << " " << j << endl;
			rep(k,8) {
				int x = i+movX[k];
				int y = j+movY[k];
				if(mp[x][y]>0 && around[x][y]>=mp[x][y]){
					list2.push_back(pii(x,y));
					// cout << "    " <<  i << " " << j << endl;
				}
			}
		}
		if(list2.size()==0){
			cout << count << endl;
			return 0;
		}
//		cout << list2.size() << endl;
		count++;
		vector<pii> list3;
		for(vector<pii>::iterator it=list2.begin();it!=list2.end();it++){
			int i = it->first, j = it->second;
			if(mp[i][j]){
				list3.push_back(*it);
				mp[i][j] = 0;
				rep(k,8) {
					int x = i+movX[k];
					int y = j+movY[k];
					around[x][y]++;
				}
				// printf("(%d, %d)\n",i,j);
			}
		}
		// printf("=============\n");
		std::vector<pii>().swap(list);
		std::vector<pii>().swap(list2);
		list = list3;
	}
}

Measured memory_bytes: 9012
#include <iostream>
#include <string>

using namespace std;

string a, b, c;
char res;

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

	int i, j, k;
	int sa, sb, sc;
	char ch;

	i = j = k = 0;
	sa = a.length();
	sb = b.length();
	sc = c.length();

	ch = a[i++];
	while (i <= sa && j <= sb && k <= sc)
	{
		if (ch == 'a')
		{
			if (i == sa)
			{
				res = 'A';
				break;
			}
			ch = a[i++];
			continue;
		}

		if (ch == 'b')
		{
			if (j == sb)
			{
				res = 'B';
				break;
			}
			ch = b[j++];
			continue;
		}

		if (ch == 'c')
		{
			if (k == sc)
			{
				res = 'C';
				break;
			}
			ch = c[k++];
			continue;
		}
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long x;
long long ans[5000];

int main(){
  cin >> x;
  ans[0] = 100;
  for(int i = 1; i < 5000; i++){
    ans[i] = ans[i-1]*1.01;
  }
  for(int i = 1; i < 5000; i++){
    if(x <= ans[i]){
      cout << i << endl;
      break;
    }
  }
}

Measured memory_bytes: 3672
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define m_p make_pair
#define sz(x) (int)x.size()
#define out(x) cerr<<#x<<" = "<<x<<" "
#define outln(x) cerr<<#x<<" = "<<x<<endl
#define outarr(x,l,r) cerr<<#x"["<<l<<"-"<<r<<"] = "; for (int _i=l;_i<=r;++_i) cerr<<x[_i]<<" ";cerr<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define gc() getchar()
//char buf[1<<23],*p1=buf,*p2=buf;
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <class T> void read(T &x)
{
    x=0; char c=gc(); int flag=0;
    while (c<'0'||c>'9') flag|=(c=='-'),c=gc();
    while (c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=gc();
    if (flag) x=-x;
}
template <class T> T _max(T a,T b){return a>b ? a : b;}
template <class T> T _min(T a,T b){return a<b ? a : b;}
template <class T> bool checkmax(T &a,T b){return b>a ? a=b,1 : 0;}
template <class T> bool checkmin(T &a,T b){return b<a ? a=b,1 : 0;}
const int N=5005;
const ll inf=1e18;
int n;
ll dp[N];
struct node
{
	int h,p;
	bool operator < (const node &rhs) const
	{
		if (h+p==rhs.h+rhs.p) return h>rhs.h;
		else return h+p<rhs.h+rhs.p;
	}
}a[N];
void init()
{
	read(n);
	for (int i=1;i<=n;++i)
	{
		read(a[i].h); read(a[i].p);
	}
	sort(a+1,a+n+1);
}

void solve()
{
	for (int i=1;i<=n;++i)
	{
		dp[i]=inf;
	}
	dp[0]=0;
	for (int i=1;i<=n;++i)
	{
		for (int j=i;j>=1;--j)
		{
			if (dp[j-1]<=a[i].h)
			{
				checkmin(dp[j],dp[j-1]+a[i].p);
			}
		}
	}
	//outarr(dp,1,n);
	int ans=0;
	for (int i=1;i<=n;++i)
	{
		if (dp[i]==inf) continue;
		ans=i;
	}
	printf("%d\n",ans);
}

int main()
{
	init();
	solve();
    return 0;
}


Measured memory_bytes: 3844
#include <iostream>
#include <cstdint>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
#include <iomanip>
#include <sstream>

int main(void)
{
    int64_t N;
    std::cin >> N;

    std::map<std::string, int64_t> polls;
    int64_t max = 0;
    for (int64_t i = 0; i < N; ++i) {
        std::string S;
        std::cin >> S;
        polls[S]++;
        if (polls[S] > max) max = polls[S];
    }

    for (const auto& poll : polls) {
        if (max > poll.second) continue;
        std::cout << poll.first << std::endl;
    }

    return 0;
}

Measured memory_bytes: 25216
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int MAXN = 5e5 + 10;
char s[MAXN];
int nt[MAXN] , l;
bool f[MAXN] , e[MAXN];
int main(){
	memset(f , 0 , sizeof f);
	cin >> s + 1;
	l = strlen(s + 1);
	bool same = 1;
	for(int i = 2 ; i <= l ; ++ i)
		if(s[i] != s[1]){
			same = 0;
			break;
		}
	if(same){
		cout << l << endl << 1 << endl;
		return 0;
	}
	nt[1] = 0;
	for(int i = 2 ; i <= l ; ++ i){
		int tmp = nt[i - 1];
		while(tmp && s[tmp + 1] != s[i])
			tmp = nt[tmp];
		if(s[tmp + 1] == s[i])
			tmp ++;
		nt[i] = tmp;
		int ll = i - nt[i];
		if(nt[i] && i % ll == 0)
			f[i] = 1;
	}
	nt[l] = 0;
	for(int i = l - 1 ; i >= 1 ; -- i){
		int tmp = nt[i + 1];
		while(tmp && s[l - tmp] != s[i])
			tmp = nt[l - tmp + 1];
		if(s[l - tmp] == s[i])
			tmp ++;
		nt[i] = tmp;
		int ll = l - i + 1 - nt[i];
		if(nt[i] && (l - i + 1) % ll == 0)
			e[i] = 1;
	}
	if(!f[l]){
		cout << 1 << endl << 1 << endl;
		return 0;
	}
	int ans = 0;
	for(int i = 1 ; i < l ; ++ i)
		if(!f[i] && !e[i + 1])
			ans ++;
	cout << 2 << endl << ans << endl;
	return 0;
}

Measured memory_bytes: 3712
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<int> vec, int number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

int dx[4] = {-1,0,1,0};
int dy[4] = {0,1,0,-1};
int dist[52][52];
char maze[52][52];

int main(){


    rep(i,52){
        rep(j,52){
            dist[i][j] = -1;
        }
    }

    int H,W;
    cin >> H >> W;
    int cnt=0;
    rep(i,H){
		rep(j,W){
            cin >> maze[i][j];
			if (maze[i][j] == '.') cnt ++;
        }
    }

	queue<Point> Q;
    Point s = {0, 0};
	Q.push(s);
	dist[0][0] = 0;
	while(!Q.empty()){
		Point now = Q.front();
		Q.pop();
		rep(i, 4){
			Point next = {now.x+dx[i],now.y+dy[i]};
            if( next.x < 0 || next.x >= H || next.y < 0 || next.y >= W ) continue;
			if( maze[next.x][next.y] == '#' ) continue; // 壁
			if( dist[next.x][next.y] != -1 ) continue; // visited
			dist[next.x][next.y] = dist[now.x][now.y] + 1;
			Q.push(next);
		}
	}
    if (dist[H-1][W-1]==-1) cout << -1 << endl;
    else cout << cnt - (dist[H-1][W-1]+1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <math.h>
#define ll long long
ll gcd(ll a,ll b){
    ll s=1,c;
    while(a&&b){
        if((~a&1)&&(~b&1))
            a>>=1,b>>=1,s<<=1;
        else if(~a&1)a>>=1;
        else if(~b&1)b>>=1;
        else if(a>b)a=a-b;
        else c=b-a,b=a,a=c;
    }
    if(!a)return b*s;
    if(!b)return a*s;
}
using namespace std;
int main(){
	int a[10001]={0};
	int x,y,z;
	for(x=1;x<=100;x++)
		for(y=1;y<=100;y++)
			for(z=1;z<=100;z++)
	if(x*x+y*y+z*z+x*y+x*z+y*z<=10000)
		a[x*x+y*y+z*z+x*y+x*z+y*z]++;
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	cout<<a[i]<<endl;
	return 0;
}



Measured memory_bytes: 3632
#![allow(
  non_snake_case,
  unused_variables,
  unused_assignments,
  unused_mut,
  unused_imports,
  dead_code
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
  input! {
    S:Chars,T:Chars
  }
  let mut ans = 1000;
  for i in 0..=(S.len() - T.len()) {
    let mut t = 0;
    for j in 0..T.len() {
      if T[j] != S[i + j] {
        t += 1;
      }
    }
    ans = min(ans, t);
  }
  println!("{}", ans);
}


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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0; i<N; i++){
    cin >> d.at(i);
  }
  
  sort(d.begin(),d.end());
  reverse(d.begin(),d.end());
  int cnt = 1;
  for(int i=0; i<N-1; i++){
    if(d.at(i) != d.at(i+1))
      cnt++;
  }
  cout << cnt << endl;
}


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

using namespace std;

int main() {
	long long A,B,C,K,res = 0;
	cin >> A >> B >> C >> K;
	res = min(A,K);
	K-= res;
	if (!K) cout << res;
	else {
		K -= min(K,B);
		if (!K) cout << res;
		else {
			res -= K;
			cout << res;
		}
	}
	
	cout << endl;
	return 0;
}


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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define fff ff
#define sss ss.ff
#define ttt ss.ss
#define INF (1 << 30)
#define LLF (1ll << 60)
#define PRIME (1000000007)
#define FASTIO std::ios::sync_with_stdio(false)
#ifdef DEBUG
#define debug(x) cerr << #x << " = " << x << endl
#else
#define debug(x)
#endif
#define rep(i, begin, end)                            \
  for (__typeof(end) i = (begin) - ((begin) > (end)); \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define FILE_INPUT                  \
  freopen("input.txt", "r", stdin); \
  freopen("output.txt", "w", stdout)

#define all(x) x.begin(), x.end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ll, ii> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<string> vs;

/*-----------------END TEMPLATE-----------------*/

int main() {
  FASTIO;
  ll n;
  cin >> n;
  pair<double, ii> a[3 * n];
  rep(i, 1, n + 1) {
    cin >> a[i].ss.ff >> a[i].ss.ss;
    a[i].ff = atan2((double)a[i].ss.ss, (double)a[i].ss.ff);
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    a[n + i] = a[i];
    a[n + i].ff += 2 * M_PI;
  }
  double ans = 0;
  ll x = 0, y = 0;
  ll r = 0, m = n;
  n *= 2;
  for (int l = 1; l <= n; l++) {
    while (r <= n && (r - l) < m && (a[r].ff - a[l].ff) <= M_PI) {
      x += a[r].ss.ff;
      y += a[r].ss.ss;
      r++;
      ans = max(ans, sqrt(x * x + y * y));
    }
    x -= a[l].ss.ff;
    y -= a[l].ss.ss;
    ans = max(ans, sqrt(x * x + y * y));
  }
  cout << setprecision(20) << ans << endl;
}


Measured memory_bytes: 256
function Main(input)
{
	input = input.split("\n")

  var a = parseInt(input[0], 10)

  var b = 0
  var result = 0

  while(a > result)
  {
    b = b + 1

    result = b * b
  }

  if (result > a)
  {
    b = b - 1
    result = b * b
  }


  console.log(result);

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 11468
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

LL mul(LL a, LL b) { return (a * b) % kMod; }

LL dfs(int i, int parent, const vector<vector<int>>& G, int K) {
  int num_color = (parent < 0) ? K - 1 : K - 2;
  LL total = 1;
  for (int v : G[i]) {
    if (v == parent) continue;

    total = mul(total, num_color);
    --num_color;

    total = mul(total, dfs(v, i, G, K));
  }
  return total;
}

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

  for (int i = 0; i < N; ++i) {
    if (G[i].size() > K) {
      cout << 0 << endl;
      return 0;
    }
  }

  LL total = mul(K, dfs(0, -1, G, K));
  cout << total << endl;
}


Measured memory_bytes: 14528
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,sum=0,cnt=0;
	cin >> n >> m ;
    int a[m],b[m],c[n+1]={},d[n]={};
    for(int i=0;i<m;i++){
      cin >> a[i] >> b[i];
    }
    for(int i=0;i<m;i++){
      c[a[i]-1]++;
      c[b[i]]--;
    }
    for(int i=0;i<n;i++){
      sum += c[i];
      d[i] = sum;
      if(d[i]==m)
      	cnt++;
    }
  cout << cnt << endl;
}

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

int main() {
    int H, W, d;
    cin >> H >> W >> d;

    char color[2][2] = {{'R', 'G'}, {'B', 'Y'}};
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << color[(i + j) / d % 2][(i - j + 10000) / d % 2];
        }
        cout << endl;
    }

    return 0;
}

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

namespace Atcoder
{
    class AtCodeeeeeeeeeeeeeeeeeeeer
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string ans = "None";
            for (char i = 'a'; i <= 'z'; i++)
            {
                if (s.Contains(i)==false)
                {
                    ans = i.ToString();
                    break;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

int main ()
{
int A1,A2,A3;
cin>>A1>>A2>>A3;
if(A1!=0&&A2!=0&&A3!=0&&A1<=13&&A2<=13&&A3<=13){
if(A1+A2+A3>=22){
    cout<<"bust";
}
else{
    cout<<"win";
}
}
  return 0;
}

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

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

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



int main()
{
	int H, W;
	cin >> H >> W;
	vector<string> S(H);
	REP(i, H)cin >> S[i];

	vector<vector<int>> score(H, vector<int>(W, 0));
	// lr
	REP(i, H) {
		int cnt = 0;
		REP(j, W) {
			if (S[i][j] == '.')score[i][j] += (cnt++);
			else cnt = 0;
		}
		cnt = 0;
		for (int j = W - 1; j >= 0; j--) {
			if (S[i][j] == '.')score[i][j] += (cnt++);
			else cnt = 0;
		}
	}

	// ud
	REP(j, W) {
		int cnt = 0;
		REP(i, H) {
			if (S[i][j] == '.')score[i][j] += (cnt++);
			else cnt = 0;
		}
		cnt = 0;
		for (int i = H - 1; i >= 0; i--) {
			if (S[i][j] == '.')score[i][j] += (cnt++);
			else cnt = 0;
		}
	}
	REP(i, H)REP(j, W)if (S[i][j] == '.')score[i][j]++;

	int res = 0;
	for (auto& row : score)res = max(res, *max_element(row.begin(), row.end()));
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 20096
#include <bits/stdc++.h>
using namespace std;
int main(){

    //int t;cin>>t;
  
        double a,b,c;
        cin>>a>>b>>c;
       // cout<<float(a/c)<<endl;
        if(b>=float(a/c))cout<<"Yes\n";
        else cout<<"No\n";
    
}

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

#define for_(i,a,b) for(int i=(a); i<(b); ++i)
typedef long long lint;
template<typename T > void modMul(T& a, T b, T m) { a = (a*b)%m; }
template<typename T > void modAdd(T& a, T b, T m) { a = (a+b)%m; }

const lint MOD = (lint)1e9 + 7;

lint power(lint x, int k) {
	lint res = 1;
	while (k) {
		if (k & 1) modMul(res, x, MOD);
		modMul(x, x, MOD);
		k >>= 1;
	}
	return res;
}

int main() {
	int H, W, A, B;
	cin >> H >> W >> A >> B;
	
	int S = H+W+10;
	vector< lint > fact(S, 0);
	fact[0] = fact[1] = 1;
	for_(i,2,S) fact[i] = (fact[i-1] * i) % MOD;
	
	vector< lint > inv(S, 0);
	for_(i,0,S) inv[i] = power(fact[i], MOD-2);
	
	auto nCk = [&](int n, int k) {
		lint res = fact[n];
		modMul(res, inv[n-k], MOD);
		modMul(res, inv[k], MOD);
		return res;
	};
	
	lint ans = 0;
	for_(i,B,W) {
		lint add = nCk(H-A-1+i, i);
		modMul(add, nCk(A-1+W-1-i, W-1-i), MOD);
		modAdd(ans, add, MOD);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
n,k=map(int,input().split())
x=list(map(int,input().split()))

import bisect
c=bisect.bisect_left(x,0)
mt=2*10**8

for i in range(n-k+1):
  if i+k<c:continue
  mt=min(mt,2*abs(x[i])+abs(x[i+k-1]),abs(x[i])+2*abs(x[i+k-1]))
  if i+k-1 ==c-1:mt=min(mt,abs(x[i]))
  if i==c:mt=min(mt,x[i+k-1])
if n==k:
  if c!=n and c!=0:
    mt=min(2*abs(x[0])+x[-1],2*x[-1]+abs(x[0]))
  else:
    mt=max(abs(x[0]),abs(x[-1]))
print(mt)
    
  

Measured memory_bytes: 20144
#include<stdio.h>
#include<map>
#include<algorithm>
using namespace std;
map<int,int> mp;
int data[200005];
long long sum=0;
int main()
{
	int n,k;
	scanf("%d %d",&n,&k);
	for(int i=0;i<n;i++)
	{
		long long temp;
		scanf("%lld",&data[i]);
	}
	sort(data,data+n);
    long long sum=0;
    for(int i=0;i<n-k;i++)
    sum+=data[i];
    printf("%lld\n",sum);
	return 0;
} 


Measured memory_bytes: 1024
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    int t,e;
    cin >> n >> t >> e;
    double ans = t;
    int res = 0;
    vector<int> a(n);
    rep(i,n){
      cin >> a[i];
    }    
    vector<double> b(n);
    rep(i,n){
        b[i] = (double) t -a[i]*0.006;
    }
    rep(i,n){
        if(abs(e-b[res])>abs(e-b[i])){
            res = i;
        }
    }
    cout << res+1;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

int IN_A, IN_B, OUT_A, OUT_B;
double OUT_C;

scanf("%d %d", &IN_A, &IN_B);

OUT_A = IN_A / IN_B;
OUT_B = IN_A % IN_B;
OUT_C = (double)IN_A / IN_B;

printf("%d %d %f\n", OUT_A, OUT_B, OUT_C);

return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef long long ll;
typedef pair<ll,ll> PP;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false

signed main(void){
    int X;
    cin >> X;
    int now=100,year=0;
    
    while(now<X){
        now+=now/100;
        year++;
    }
    
    cout << year << endl;
    return 0;
}




Measured memory_bytes: 3648
import java.util.Scanner;
import java.util.Arrays;
import java.util.HashMap;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    while (in.hasNext()) {
      int N = in.nextInt();
      char[][] s = new char[N][10];
      
      for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      }
      
      HashMap<String, Integer> appearTimes = new HashMap<String, Integer>();
      long count = 0;
      for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      }
      
      System.out.println(count);
    }
  }
}

Measured memory_bytes: 57620
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(max(a,b) < c || min(a,b) > c){
        cout << "No" << endl;
    } else{
        cout << "Yes" << endl;
    } 
    
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}
inline int getintA() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return tmp;
}
char dn[1300000], *di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}
int N;
int A[200001];
int E[400001], ne[400001], he[200001], it[200001];
int V[200001], v;
int S[200001], s;

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

	N = getint();
	rep1(i, N) A[i] = getintA();
	int k = 1;
	rep(i, N - 1) {
		int u = getint(), v = getint();
		E[k] = v;
		ne[k] = he[u];
		he[u] = k++;
		E[k] = u;
		ne[k] = he[v];
		he[v] = k++;
	}

	V[v++] = 2000000000;
	S[s++] = 1;
	while (s) {
		int p = S[s - 1];
		if (p > 0) {
			S[s - 1] = -p;
			if (V[v - 1] < A[p]) {
				it[p] = v;
				swap(V[v++], A[p]);
				for (auto to = he[p]; to; to = ne[to]) {
					if (he[E[to]] > 0) {
						S[s++] = E[to];
					}
				}
			}
			else {
				it[p] = lower_bound(V, V + v, A[p]) - V;
				swap(V[it[p]], A[p]);
				for (auto to = he[p]; to; to = ne[to]) {
					if (he[E[to]] > 0) {
						S[s++] = E[to];
					}
				}
			}
			he[p] = -v;
		}
		else {
			s--;
			p = -p;
			V[it[p]] = A[p];
			v -= !A[p];
		}
	}

	rep1(i, N) putint(-he[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 8784