akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef int64_t Int;
#define dump(x) cout << (x) << '\n'
Int mod = 1e9+7;
//Int mod = 998244353; 
Int INF = 1e9+7;

int main() {    
    Int h, w;
    cin >> h >> w;
    vector<vector<Int>> a(h + 1, vector<Int>(w + 1, INF));
    char x[1001][1001] = {};
    for (Int i = 0; i < h; i++) {
        for (Int j = 0; j < w; j++) {
            cin >> x[i][j];
        }
    }
    vector<vector<Int>> b = a;
    Int cnt = INF;
    bool bl = false;
    for (Int i = 0; i < h; i++) {
        for (Int j = 0; j < w; j++) {
            if (bl) cnt++;
            if (x[i][j] == '#') {
                cnt = 0;
                bl = true;
                continue;
            }
            a[i][j] = cnt;
        }
        cnt = INF;
        bl = false;
    }
    for (Int i = 0; i < h; i++) {
        for (Int j = w - 1; j >= 0; j--) {
            if (bl) cnt++;
            if (x[i][j] == '#') {
                cnt = 0;
                bl = true;
                continue;
            }

            b[i][j] = cnt;
            
        }
        cnt = INF;
        bl = false;
    }
    
    vector<vector<Int>> c = a;
    for (Int i = 0; i < h; i++) {
        for (Int j = 0; j < w; j++) {
            if (x[i][j] == '#') {
                c[i][j] = 0;
                continue;
            }
            c[i][j] = min(a[i][j], b[i][j]);
            //cout << c[i][j] << " ";
        }
        //cout << endl;
    }
    vector<vector<Int>> d, e;
    d = e = c;
    
    for (Int i = 0; i < h - 1; i++) {
        for (Int j = 0; j < w; j++) {
            d[i + 1][j] = min(d[i + 1][j], d[i][j] + 1);
        }
    }
  /*   for (Int i = 0; i < h; i++) {
        for (Int j = 0; j < w; j++) {
            cout << d[i][j] << " ";
        }
        cout << endl;
    } */
    for (Int i = h - 1; i > 0; i--) {
        for (Int j = 0; j < w; j++) {
            e[i - 1][j] = min(e[i - 1][j], e[i][j] + 1);
        }
    }
    // dump("PO");
    Int res = 0;
    for (Int i = 0; i < h; i++) {
        for (Int j = 0; j < w; j++) {

            if (x[i][j] == '#') continue;
            res = max(res, min(d[i][j], e[i][j]));
        }
    }
    dump(res);
    return 0;  
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int h, w;
string s[10];

signed main() {
	while (1) {
		cin >> h >> w;
		if (h==0) break;
		rep(i,h) cin >> s[i];
		map<string,int> m;
		rep(i,h) rep(j,w) {
			int ii = i, jj = j;
			rep(k,8) {
				string t;
				t.pb(s[i][j]);
				while (1) {
					ii += ddx[k]+h, jj += ddy[k]+w;
					ii %= h, jj %= w;
					if (ii==i && jj==j) break;
					t.pb(s[ii][jj]);
					m[t]++;
				}
			}
		}
		string res;
		each(i,m) if (i.se>=2 && (res.size()<i.fi.size() || (res.size()==i.fi.size() && res>i.fi))) res = i.fi;
		if (res.empty()) cout << 0 << ln;
		else cout << res << ln;
	}
}


Measured memory_bytes: 37932
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
#define inf 1e9
int solve(vector<int>ar,int n){
    vector<int>dp(n+1);
    dp[1] = 0;
    for(int i=2;i<=n;i++){
        int option1 = abs(ar[i] -ar[i-1])+dp[i-1];
        int option2 =(i==2) ? inf: abs(ar[i] -ar[i-2])+dp[i-2];
        dp[i] = min(option1,option2);
    }
    return dp[n];
}

int main()
{
    int n;
    cin>>n;
    vector<int>ar(n+1);
    for(int i=1;i<=n;i++){
        cin>>ar[i];
    }
    cout<<solve(ar,n);

    return 0;
}


Measured memory_bytes: 1408
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;

int q(int a_, int b_) {
	int a = max(a_, b_);
	int b = min(a_, b_);
	int r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

int main(void) {
	ll a, b;
	cin >> a >> b;
	cout << a * b / q(a, b);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int n,k;
  scanf("%d%d",&n,&k);
  if(k==1){
    printf("%lld\n",(int64)n*n*n);
    return;
  }
  int64 d=n/k;
  int64 e=(k%2==0?(n+k/2)/k:0);
  int64 ans=d*d*d+e*e*e;
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

using ll = long long;

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)

int main()
{
	int n,k;
	cin >> n >> k;
	vector<int> l(n);

	rep(i,n) cin >> l[i];
	sort(l.begin(),l.end(),greater<int>());
/*
rep(i,l.size()){
	cout << l[i] << endl;
}*/

	int ans = 0;
	rep(i,k){
		ans += l[i];
	}
cout << ans << endl;

	return 0;
}

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

using ld = long double;
using ll = unsigned long long;
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1){
            res = (res * a)%mod;
        }
        a = (a * a)%mod;
        b >>= 1;
    }
    return (res%mod);
}

signed main(){
	long double a,b;
    cin >> a >> b;

    ld ans = a*b;

    unsigned long long res = (ll)(ans);
    cout << res << "\n";
	return 0;
}

Measured memory_bytes: 3724
#include <iostream>
using namespace std;
int main(void){
    long long N,M,i,j,ans,count;
    cin>>N>>M;
    long long a[M],b[M],group[N];
    for(i=0;i<M;i++){
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
    }
    ans=0;
    for(i=0;i<M;i++){
        for(j=0;j<N;j++){
            group[j]=0;
        }
        group[a[i]]=1;group[b[i]]=2;
        count=1;
        long long tr;
        while(count>0){
            count=0;
            for(j=0;j<M;j++){
                if(i!=j){
                    if(group[a[j]]==0&&group[b[j]]>0){
                        group[a[j]]=group[b[j]];
                        count++;
                    }
                    if(group[a[j]]>0&&group[b[j]]==0){
                        group[b[j]]=group[a[j]];
                        count++;
                    }
                    if(group[a[j]]*group[b[j]]==2){
                        tr=0;
                        count=0;
                        break;
                    }
                }
                tr=1;
            }
        }
        if(tr==1){
            ans++;
        }
    }
    cout<<ans<<endl;
}


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

#define ll long long int// for 0 to 10^18
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define pb push_back
#define pi 3.141592653589793
#define sll signed long long int // -10^9 to 10^9
#define ull unsigned long long int // for 0 to 10^18
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) x.begin(),x.end()
#define MOD 1000000007
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
template<typename T> T power(T x,T y,ll m=MOD){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
typedef vector<int> vi;
/* 
ll sum_ofGP_modM(ll a , ll n, ll mod)  //// (1 + A^1 +A^2 + A^3 + A^4 + -------+ A^N) % M  usually here n= Total terms in series-1
////and  if series is something for eg 3^2 + 3^4 here a= 9,r=9  our ans can be found out as 
// let a1= first term 3^2 just do ans = a1*sum_ofGP_modM(9 , N-1, ull mod)
	if(n == 0) return 1;
	if(n == 1) return (1 + a) % mod;
	ll res;
	if(n % 2)
		res = (a + 1) * GPSumWithMod((a*a) % mod , (n-1)/2);
	else{ res = (a + 1) * GPSumWithMod((a*a) % mod , n/2 - 1);res %= mod;res = (res * a) + 1;}
    return res % mod;
}
//Whenever we have (a/b)%P == (a * fast_pow(b,P-2))%P
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
} */

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int x;
    cin>>x;
    int sum = 0;
    rep(i,a+1){
        rep(j,b+1){
            rep(k,c+1){
                if(i*500+j*100+k*50==x)sum++;
            }
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N;
    cin >> N;

    ll ans = 0;

    if (N < 10)
    {
        ans = N;
    }
    else if (N < 100)
    {
        ans = 9;
    }
    else if (N < 1000)
    {
        ans = 9 + (N - 99);
    }
    else if (N < 10000)
    {
        ans = 909;
    }
    else if (N < 100000)
    {
        ans = 909 + (N - 9999);
    }
    else
    {
        ans = 90909;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  string s[n];
  int a = 0;
  int b = 0;
  int both = 0;
  for(int i = 0; i < n; i++) {
    string t;
    cin >> t;
    if(t[t.size()-1] == 'A' && t[0] == 'B') {
      both++;
    }else if(t[0] == 'B') {
      b++;
    }else if(t[t.size()-1] == 'A') {
      a++;
    }
    s[i] = t;
  }
  int ans = 0;
  for(int i = 0; i < n; i++) {
    string u = s[i];
    for(int j = 1; j < u.size(); j++) {
      if(u[j-1] == 'A' && u[j] == 'B') {
        ans++;
      }
    }
  }

  if(both == 0) {
    ans += min(a,b);
  }else if(a == 0 && b == 0) {
    ans += both-1;
  }else{
    ans += both + min(a,b);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 768
<?php
list($A, $B, $Q) = array_map("intval", explode(" ", trim(fgets(STDIN))));

$aArray = new SplFixedArray($A+2);
$aArray[0] =-10**18;
for($i = 1; $i <= $A; $i++)$aArray[$i] = intval(fgets(STDIN));
$aArray[$A+1] = 10**18;

$bArray = new SplFixedArray($B+2);
$bArray[0] =-10**18;
for($i = 1; $i <= $B; $i++)$bArray[$i] = intval(fgets(STDIN));
$bArray[$B+1] = 10**18;
 
for($i = 0; $i < $Q; $i++){
    $q = intval(fgets(STDIN));
    $min = 10**18;
    $a = bsl($aArray, $q);
    $b = bsl($bArray, $q);
    $a0 = $aArray[$a];
    $a1 = $aArray[$a+1];
    $b0 = $bArray[$b];
    $b1 = $bArray[$b+1];
    $min = min($min, abs($q - $a0) + abs($a0 - $b0));
    $min = min($min, abs($q - $a0) + abs($a0 - $b1));
    $min = min($min, abs($q - $a1) + abs($a1 - $b0));
    $min = min($min, abs($q - $a1) + abs($a1 - $b1));
    $min = min($min, abs($q - $b0) + abs($b0 - $a0));
    $min = min($min, abs($q - $b0) + abs($b0 - $a1));
    $min = min($min, abs($q - $b1) + abs($b1 - $a0));
    $min = min($min, abs($q - $b1) + abs($b1 - $a1));
    printf("%d\n", $min);
}
 
//二分探索　target以下で最大の値の場所を返す
function bsl($nums, $target) {
    $size = count($nums);
    $min = 0; 
    $max = $size - 1;
    while(true){
        $center = intdiv($min + $max, 2);
        $centerValue = $nums[$center];
        if($target == $centerValue){
            return $center;
        }elseif($target > $centerValue){
            $min = $center + 1;
        }else{
            $max = $center;
        }
        if($min == $max){
            $center = intdiv($min + $max, 2);
            $centerValue = $nums[$center];
            if($centerValue == $target){
                return $center;
            }elseif($centerValue < $target){
                return $center;
            }else{
                return $center - 1;
            }
        }
    }
}

Measured memory_bytes: 9848
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int MAX(int a,int b){return a<b?b:a;}
int ta[100010],to[100010],co[100010],nt[100010],it[100010],l[100010];
int MF(int e,int s,int t,int min){
  if(s==t)return min;
  int i,r;
  for(;it[s]+1;it[s]=nt[it[s]]){
    if(co[it[s]]==0||l[s]>=l[to[it[s]]])continue;
    r=MF(e,to[it[s]],t,MIN(min,co[it[s]]));
    co[it[s]]-=r;
    co[(it[s]+e)%(2*e)]+=r;
    if(r)return r;
  }
  return 0;
}
//呼び出す方
//頂点v、辺eのグラフでsからgに流す
int maxf(int v,int e,int s,int g){
  int i,a=0,q[100010],t,r,c=3;
  while(1){
    for(i=t=0;i<v;i++)l[i]=0;
    for(r=l[q[0]=s]=1;r-t;t++){
      for(i=ta[q[t]];i+1;i=nt[i]){
	if(co[i]&&l[to[i]]==0)l[q[r++]=to[i]]=l[q[t]]+1;
      }
    }
    if(l[g]==0)return a;
    for(i=0;i<v;i++)it[i]=ta[i];
    while(r=MF(e,s,g,1e9))a+=r;
  }
}
void mklsb(int v,int e,int *a,int *b,int *c){
  int i;
  for(i=0;i<v;i++)ta[i]=-1;
  for(i=0;i<e;i++){
    nt[i  ]=ta[to[i+e]=a[i]];
    nt[i+e]=ta[to[i  ]=b[i]];
    co[ta[a[i]]=i  ]=c[i];      
    co[ta[b[i]]=i+e]=0;
  }
}
int main(){
  int n,m,i,j,t,r=0,a[100010],b[100010],c[100010],d;
  char s[100010];
  scanf("%d %d %s",&n,&m,s);
  for(i=0;s[i];i++){
    scanf("%d",&d);
    if(s[i]=='L'){
      a[r]=0;
      b[r]=i+1;
      c[r++]=0;
      a[r]=i+1;
      b[r]=n+1;
      c[r++]=d;
    }
    else{
      a[r]=0;
      b[r]=i+1;
      c[r++]=d;
      a[r]=i+1;
      b[r]=n+1;
      c[r++]=0;
    }
  }
  while(m--){
    scanf("%d %d %d",&i,&j,&t);
    a[r]=MIN(i,j);
    b[r]=MAX(i,j);
    c[r++]=t;
  }
  mklsb(n+2,r,a,b,c);
  printf("%d\n",maxf(n+2,r,0,n+1));
  return 0;
}
    
  



Measured memory_bytes: 2064
#include <stdio.h>

int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	
	if(a<b&&b<c)
	{
		printf("Yes\n");

	}

	else 
	{
		printf("No\n");
	} 


	return 0;
}



Measured memory_bytes: 2096
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<sstream>
#include<cstdio>

using namespace std;
using ll = long long;

const int INF = 1001001001;
const int MOD = 1000000007;


int main() {
	char a;cin >> a;
	if(isupper(a)){
		cout << 'A';
	}else{
		cout << 'a';
	}
	return 0;

	return 0;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//実行部
void Main()
{
  str s; cin >> s;
  ll a = 0, b = 0, c = 0;
  for(ll i = 0;i < s.size();i++)
  {
    if(s[i] == 'a') a++;
    else if(s[i] == 'b') b++;
    else c++;
  }
  ll m = min(a, min(b, c));
  a -= m;
  b -= m;
  c -= m;
  if(a <= 1&&b <= 1&&c <= 1)
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }
}

//前処理
int main()
{
  ifstream in("text.txt");
  cin.rdbuf(in.rdbuf());
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


Measured memory_bytes: 512
from itertools import permutations
N = int(input())
comb = list(permutations([i for i in range(0, N)], N))
xy = []
for _ in range(N):
    x, y = map(int, input().split())
    xy.append([x, y])
ans = 0
for c in comb:
    for i in range(0, N-1):
        x = ((xy[c[i]][0] - xy[c[i+1]][0]) ** 2)
        y = ((xy[c[i]][1] - xy[c[i+1]][1]) ** 2)
        ans += (x + y) ** 0.5
print(ans/len(comb))

Measured memory_bytes: 8052
#include <stdio.h>

int main(void){
  int n,start,end;
  int i;
  int result = 0;
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d %d",&start,&end);
    result += end - (start - 1);
  }
  printf("%d\n",result);
  return 0;
}

Measured memory_bytes: 128
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
int main()
{
  int n;
  cin >> n;
  int maxcnt = 0;
  int cnt = 0;
  rep(i,n){
    int d1, d2;
    cin >> d1 >> d2;
    if(d1 == d2){
      cnt++;
      if(maxcnt < cnt) maxcnt = cnt;
    }else{
      cnt = 0;
    }
  }
  if(maxcnt >= 3) cout << "Yes" << endl;
  else  cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>
void maxheap(int* , int , int);
int main(){
  int num,i,array[500001];
  scanf("%d",&num);
  for(i=1;i<=num;i++) scanf("%d",&array[i]);
  for(i=num/2;i>=1;i--) maxheap(array,i,num);
  for(i=1;i<=num;i++) printf(" %d",array[i]);
  printf("\n");
  return 0;
}
void maxheap(int *array, int i, int num){
  int left,right,max,value;
  left=i*2;
  right=i*2+1;
  if(left<=num &&  array[left]>array[i]) max=left;
  else max=i;
  if(right<=num && array[right]>array[max]) max=right;
  if(max!=i){
    value=array[i];     /* exchange array[i] and array[max] */
    array[i]=array[max];
    array[max]=value;
    maxheap(array,max,num);
  }
}
  



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

class modint {
  public:
    using ll = long long;
    ll num;
    static const ll MOD = 998244353;
    static vector<modint> factorial;

    modint(): num(0) {};
    modint(ll num_) {
        if (num_ < 0) num = num_ + MOD;
        else if (num_ >= MOD) num = num_ % MOD;
        else num = num_;
    }
    modint(const modint &r): num(r.num) {}
    operator ll() const { return num; }
    friend istream& operator>>(istream& is, modint &r){
        ll num_;
        is >> num_;
        r = num_;
        return is;
    }

    template <typename T>
    modint operator+(const T &r) const { return modint(num + r); }
    template <typename T>
    modint operator-(const T &r) const { return modint(num - r); }
    template <typename T>
    modint operator*(const T &r) const { return modint(num * r); }
    template <typename T>
    modint operator/(const T &r) const { return num * pow(r, MOD-2); }

    template <typename T>
    modint operator+=(const T &r) { return *this = *this + r; }
    template <typename T>
    modint operator-=(const T &r) { return *this = *this - r; }
    template <typename T>
    modint operator*=(const T &r) { return *this = *this * r; }
    template <typename T>
    modint operator/=(const T &r) { return *this = *this / r; }

    static modint pow(const modint &x, const ll &r) {
        if(r == 0) return 1;
        return pow(x*x, r/2) * modint(r&1 ? x : modint(1));
    }

    static modint fact(int n){
        if((int)factorial.size() <= n) {
            int size = factorial.size();
            factorial.resize(n+1);
            for (int k = size; k <= n; k++) {
                factorial[k] = factorial[k-1] * k;
            }
        }
        return factorial[n];
    }

    static modint C(int n, int r){
        return n >= r ? fact(n)/(fact(n-r)*fact(r)) : modint(0);
    }
};
vector<modint> modint::factorial = {1};
#define fact(n) modint::fact(n)
#define C(n,r) modint::C(n,r)
#define H(a,b) C(a+b, a)


int main(void){
    int n;
    cin >> n;
    modint sum = 0;
    for (int i = n/2+1; i <= n; i++) {
        sum += C(n,i) * modint::pow(2,n-i) * 2;
    }
    cout << modint::pow(3,n) - sum << endl;
    return 0;
}


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

void get_int3(char *line, int size, int *a1, int *a2, int *a3) {
  if(!fgets(line, size, stdin)) return;
  sscanf(line, "%d %d %d", a1, a2, a3);
}

#define BUF_SIZE 20

void swap(int *a, int *b) {
  int tmp = *a;
  *a = *b;
  *b = tmp;
}

// assume that a <= b
int gcd(int a, int b) {
  if(a == 0) return b;
  return gcd(b%a, a);
}

int main(void) {
  int a, b, k;
  char line[BUF_SIZE];
  get_int3(line, BUF_SIZE, &a, &b, &k);
  if(a > b) swap(&a, &b);
  int m = gcd(a, b);

  int i;
  int idx = 0;
  int ans = m;
  for(i = m; i >=1; i--) {
    idx += (!(m%i));
    if(k == idx) {
      ans = i;
      break;
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
H, W, k = map(int, input().split())
a = [list(input()) for _ in range(H)]
res = [[0] * W for _ in range(H)]
cnt = 0
for h in range(H):
    for w in range(W):
        if a[h][w] == "#":
            cnt += 1
            res[h][w] = cnt

for h in range(H):
    for w in range(W):
        if w > 0 and res[h][w] == 0:
            res[h][w] = res[h][w - 1]

for h in range(H):
    for w in reversed(range(W)):
        if w < W - 1 and res[h][w] == 0:
            res[h][w] = res[h][w + 1]

for h in range(H):
    for w in range(W):
        if h > 0 and res[h][w] == 0:
            res[h][w] = res[h - 1][w]

for h in reversed(range(H)):
    for w in range(W):
        if h < H - 1 and res[h][w] == 0:
            res[h][w] = res[h + 1][w]

for i in res:
    print(*i)


Measured memory_bytes: 8272
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long k = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();


        if(a+1 >= b){
            System.out.println(k+1);
            return;
        }
        if(k-2<a-1){
            System.out.println(k+1);
            return;
        }

        k -= a-1;
        long n = k/2;
        System.out.println(n*(b-a)+a+k%2);
    }
}

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


int main(){
  int64_t N,K;
  long double m=0;
  cin >> N >> K;
  vector<int64_t> P(N),ans(N-K+1);
  for(int64_t i=0;i<N;i++){
    cin >> P.at(i);
  }
  for(int64_t i=0;i<K;i++){
    ans.at(0)+=P.at(i)+1;
  }
  for(int64_t i=K;i<N;i++){
    ans.at(i-K+1)=ans.at(i-K)-P.at(i-K);
    ans.at(i-K+1)+=P.at(i);
  }
  for(int64_t i=0;i<N-K+1;i++){
    m=max(m,(long double)ans.at(i));
  }
  m/=2.0;
  cout << fixed << setprecision(2) << m << endl;
}

Measured memory_bytes: 3328
lo = 1
ro = 100000
n,m=map(int, input().split())
for i in range(m):
    l,r = map(int,input().split())
    if l>lo:
        lo=l
    if r<ro:
        ro=r
if ro>=lo:
    print(ro-lo+1)
else:
    print('0')

Measured memory_bytes: 3060
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var p = new bool[100000];
        GeneratePrime(p);
        var g = new int[100000];
        for (int i = 1; i < 100000; i++)
        {
            if (p[i] && p[(i + 1 )/ 2]) g[i] = g[i - 1] + 1;
            else g[i] = g[i - 1];
        }
        var q = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < q; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var L = int.Parse(line[0]);
            var r = int.Parse(line[1]);
            Console.WriteLine(g[r] - g[L - 1]);
        }
    }
    public static void GeneratePrime(bool[] p)
    {
        int prime;
        var m = p.Length;
        var sqrtMax = Math.Sqrt(m);
        var searchList = Enumerable.Range(2, m - 1).ToList();
        do
        {
            prime = searchList.First();
            p[prime] = true;
            searchList.RemoveAll(n => n % prime == 0);
        }
        while (prime < sqrtMax);
        foreach (var x in searchList)
            p[x] = true;
    }
}


Measured memory_bytes: 17704
#include<stdio.h>

int main(){
	int N;
	int flag=0;
	scanf("%d",&N);
	for(int i=0;i<=14;i++){
		if(N-i*7>=0 && (N-i*7)%4==0)flag=1;
	}
	if(flag==1)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
use std::io::*;
use std::str::FromStr;

type Card = (char, u32, usize);

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn partition(a: &mut Vec<Card>, p: usize, r: usize) -> usize {
    let mut i: i32 = (p as i32) - 1;
    let x: Card = a[r];

    for j in p..r {
        if a[j].1 <= x.1 {
            i += 1;
            a.swap(i as usize, j);
        }
    }
    a.swap((i+1) as usize, r);
    return (i + 1) as usize;
}

fn quicksort(a: &mut Vec<Card>, p: usize, r: usize) {
    if p < r {
        let q: usize = partition(a, p, r);
        if q > 0{
            quicksort(a, p, q-1);
        }
        quicksort(a, q+1, r);
    }
}

fn check_stable(a: &Vec<Card>)-> bool {
    let n = a.len();
    let mut is_bubble_sorted_stable: bool = true;
    for index_i in 0..(n - 2) {
        let mut index_j = index_i + 1;
        while a[index_i].1 == a[index_j].1 && index_j < (n - 1) {
            if a[index_i].2 > a[index_j].2 {
                is_bubble_sorted_stable = false;
            }
            index_j += 1;
        }
    }
    return is_bubble_sorted_stable;
}

fn main() {
    let n: usize = read();
    let mut a: Vec<Card> = (0..n)
        .map(|index| {
            let suit_str: String = read();
            let suit_char: char = suit_str.chars().next().unwrap();
            let number: u32 = read();
            (suit_char, number, index)
        })
        .collect();
    quicksort(&mut a, 0, n-1);

    if check_stable(&a){
        println!("Stable");
    }else{
        println!("Not stable");
    }

    for card in a.clone() {
        println!("{} {}", card.0, card.1);
    }
}



Measured memory_bytes: 9056
A,B,Q = map(int,input().split())
S = [int(input()) for _ in range(A)]

T = [int(input()) for _ in range(B)]

X = [int(input()) for _ in range(Q)]

from bisect import bisect_left

for _ in range(Q):
    ans = 10**12
    x = X[_]
    idxs = bisect_left(S,x)
    idxt = bisect_left(T,x)

    if idxs < A and idxt < B:
        ans = min(ans, max(S[idxs],T[idxt])-x)
    if 0 <= idxs-1 and 0 <= idxt-1:
        ans = min(ans, x-min(S[idxs-1],T[idxt-1]))
    if idxs < A and 0 <= idxt-1:
        ans = min(ans, S[idxs]-T[idxt-1] + min(S[idxs]-x, x-T[idxt-1]))
    if idxt < B and 0 <= idxs-1:
        ans = min(ans, T[idxt]-S[idxs-1] + min(T[idxt]-x, x-S[idxs-1]))

    print(ans)


Measured memory_bytes: 16160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MAXN 100010
int a[MAXN],n,cnt,m,fa[MAXN],visit[MAXN],ans;

inline int read(){
    int f(1),x(0);
    char ch(getchar());
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') {x=x*10+ch-'0';ch=getchar();}
    return f*x;
}

int find(int x){
    while(x!=fa[x])
      	x=fa[x]=fa[fa[x]];
    return x;
}

int main(){
    n=read();m=read();
    for(int i=1;i<=n;++i) 
      	fa[i]=i;
    for(int i=1;i<=m;++i)
    {
        int x(read()),y(read()),z(read());
        fa[find(x)]=find(y);
    }
    for(int i=1;i<=n;++i)
        if(!visit[find(i)])
          	ans++,visit[find(i)]=1;
    cout<<ans<<endl;    
    return 0;
}


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

using namespace std;

const int MAX = 55556;

void Main() {
    int N;
    cin >> N;

    vector<bool> isPrime(MAX, true);
    isPrime[0] = false;
    isPrime[1] = false;
    for (int i = 2; i * i <= MAX; ++i) {
        if (!isPrime[i]) {
            continue;
        }
        for (int j = 2; i * j < MAX; ++j) {
            isPrime[i * j] = false;
        }
    }
    vector<int> primes;
    vector<int> primes1mod5;
    for (int i = 2; i <= 55555; ++i) {
        if (isPrime[i] && i % 5 == 1) {
            primes1mod5.push_back(i);
        }
    }

    for (int i = 0; i < N; ++i) {
        if (i > 0) {
            cout << " ";
        }
        cout << primes1mod5[i];
    }
    cout << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<fstream>
#include<sstream>
#include<queue>
#include<iterator>
using namespace std;

vector<int>g[100001];
int p[100001],cnt[100001],l[100001],n;
void Traverse(int x){
	cnt[x]=1;
	for(int i=0;i<g[x].size();i++){
		if(g[x][i]!=p[x]){
			p[g[x][i]]=x;
			l[g[x][i]]=l[x]+1;
			Traverse(g[x][i]);
			cnt[x]+=cnt[g[x][i]];
		}
	}
}

int main(){
	cin>>n;
	for(int i=1;i<n;i++){
		int a,b;
		cin>>a>>b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	Traverse(1);
	int ver=n;
	for(int i=0;i<(l[n]-1)/2;i++)
	  ver=p[ver];
	if(cnt[ver]>=n-cnt[ver])cout<<"Snuke\n";
	else cout<<"Fennec\n";

  return 0;
}


Measured memory_bytes: 11520
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {
  
  int N;
  string S;
  cin >> N >> S;

  int r = 0,w = 0;

  for(int i = 0;i < N;i++) {
    if(S[i] == 'R') r++;
    else w++;
  }

  int ans = r;
  w = 0;

  for(int i = 0;i < N;i++) {
    if(S[i] == 'R') r--;
    else w++;

    ans = min(ans,max(r,w));
  }

  cout << ans << endl;


}


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

int d;

bool calc(int* y,int*z){
    float dst=0;
    for(int i=0;i<d;i++){
        dst+=powf((float)y[i]-z[i],2.0);
    }
    return fmod(powf(dst,0.5),1.0)<0.00001;
}

int main(){
    int n,counter=0;
    cin >> n >>d;
    int** x = new int*[n];
    for(int i=0;i<n;i++){
        int* xn = new int[d];
        x[i] = xn;
        for(int j=0;j<d;j++){
            cin >> x[i][j];
        }
    }

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(calc(x[i],x[j])) counter++;
        }
    }
    cout <<counter;
    return 0;
}

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

int n, u, v, root, visited[100001], a[100001];
vector <int> adj[100001];

bool dfs(int u) {
    visited[u] = 1;
    if(adj[u].size() == 1) return 1;
    int sum = 0, mx = -1;
    for(auto v : adj[u]) {
        if (!visited[v]) {
            if(!dfs(v)) return 0;
            sum += a[v];
            mx = max(mx, a[v]);
        }
    }
    if(mx <= a[u] && a[u] <= sum && sum <= a[u] << 1) {
        a[u] = (a[u] << 1) - sum;
        if (u == root) return !a[u];
        return 1;
    }
    return 0;
}
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);;
    for (int i = 1; i < n; i++) scanf("%d %d", &u, &v), adj[u].push_back(v), adj[v].push_back(u);
    root = 1;
    for (int i = 1; i <= n; i++) if (adj[i].size() > adj[root].size()) root = i;
    if (adj[root].size() == 1) puts((a[1] == a[2] ? "YES" : "NO"));
    else puts((dfs(root) ? "YES" : "NO"));
}

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

int main() {
  string s;
  int k;
  cin >> s >> k;
  int n = s.size();
  set<string> res;
  int right = 0;
  rep(i, n){
    string tmp = "";
    tmp += s[i];
    res.insert(tmp);
    for (int j = i + 1; j < n; j++){
      tmp += s[j];
      if(tmp.size() > k)break;
      res.insert(tmp);
    }
  }
  int index = 1;
  for(auto itr = res.begin(); itr != res.end(); ++itr) {
    if(index == k){
      cout << *itr << "\n";
      return 0;
    }
    index++;
  }
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<ll> enum_prime(ll N){
	deque<bool> is_prime(N+1,true);
	vector<ll> P;
	for(ll i=2;i<=N;i++){
		if(is_prime[i]){
			for(ll j=i*i;j<=N;j+=i){
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

vector<ll> prime_factor(ll n){
	ll sn = sqrt(n)+1;
	auto prime_list = enum_prime(sn);
	vector<ll> res;
	for(int i=0,ei=prime_list.size();i<ei;i++){
		ll v = prime_list[i];
		if(v*v>n) break;
		while(!(n%v)){
			n /= v;
			res.push_back(v);
		}
	}
	if(n>1){
		res.push_back(n);
	}

	return res;
}

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

	int N=in();
	if(!N){
		out(1);
		return 0;
	}
	map<ll,ll> M;
	for(int i=2;i<=N;i++){
		auto res = prime_factor(i);
		for(auto& x:res){
			M[x]++;
		}
	}
	ll A=1;
	for(auto& x:M){
		A *= (x.second+1LL);
		A %= atcoder_mod;
	}
	out(A);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n , c=0 ;
    cin >> n ;
    int a[n] ;
   for (int i=0 ; i<n ; i++ )
   {
       cin >> a[i];
   }
   for (int i=1 ; i<n-1 ; i++)
   {
       if (a[i]<a[i+1]&&a[i]>a[i-1])
        c++;
       else if (a[i]>a[i+1]&&a[i]<a[i-1])
        c++;
   }
   cout << c ;

    return 0;
}


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

using namespace std;
typedef long long ll;

const ll mod = 1e9 + 7;

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

 ll sumx = 0, sumy = 0;
    for (int i = 1; i <= n; i++) {
     ll x;
        scanf("%lld", &x);
        sumx += (2 * i - n - 1) * x % mod;
    }
    for (int i = 1; i <= m; i++) {
     ll y;
       scanf("%lld", &y);
       sumy += (2 * i - m - 1) * y % mod;
    }
    cout << (sumx % mod) * (sumy % mod) % mod << endl;

    return 0;
}

Measured memory_bytes: 256
#input
N, K = map(int, input().split())
p = list(map(int, input().split()))

#output
import numpy as np
p = np.array(p)
q = np.cumsum(p)

answer = (K + q[K-1])/2
for i in range(K, N):
    answer = max(answer, (K + q[i] - q[i-K])/2)

print(answer)

Measured memory_bytes: 25060
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>
#include <cassert>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
	string s,t;
    int n,a,b,c,d,e,x,y;
    cin >> s;
	int sum = 0;
	rep(i,s.size()){
		sum *= 10;
		sum += s[i] - '0';
		sum %= 9;
	}
	if(sum%9)cout << "No" << endl;
	else cout << "Yes" << endl;
}


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


int main() {

  int A, B, C; cin >> A >> B >> C;
  int K; cin >> K;
  for(int i = 0; i <= K; i++){
    for(int j = 0; j <= K; j++){
      for(int k = 0; k <= K; k++){
        if(i + j + k != K) continue;
        int a = A;
        int b = B;
        int c = C;
        if (i >= 1) for(int x = 1; x <=i; x++) a*= 2;
        if (j >= 1) for(int y = 1; y <=j; y++) b*= 2;
        if (k >= 1) for(int z = 1; z <=k; z++) c*= 2;

        if(a < b && b < c) {
          cout << "Yes" << endl;
          return 0; 
        }

      }
    }
  }


  cout << "No" << endl;
  return 0;
}









Measured memory_bytes: 3508
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

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

int main()
{
        //input->compute->output//

        int A, B, T;
        cin >> A >> B >> T;

        cout << B * (T / A) << endl;

        return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;

vector<int>g[100010];
set<int>color[100010];
bool visited[100010];

int main(void){
    int n;
    cin>>n;
    map<P,int>edge;
    vector<int>a(n),b(n);
    for(int i=0;i<n-1;i++){
        int x,y;
        cin>>x>>y;
        a[i]=x;
        b[i]=y;
        edge[P(x,y)]=0;
        edge[P(y,x)]=0;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    queue<int>que;
    que.push(1);
    while(!que.empty()){
        int now = que.front();
        que.pop();
        visited[now]=true;
        int c =1;
        for(int i=0;i<g[now].size();i++){
            int next = g[now][i];
            if(visited[next])continue;
            if(color[now].count(c)==0){
                color[now].insert(c);
                color[next].insert(c);
                edge[P(now,next)]=c;
                edge[P(next,now)]=c;
                c++;
                que.push(next);
            }
            else{
                c++;
                color[now].insert(c);
                color[next].insert(c);
                edge[P(now,next)]=c;
                edge[P(next,now)]=c;
                c++;
                que.push(next);
            }
        }
    }
    set<int>s;
    for(int i=0;i<n-1;i++){
        s.insert(edge[P(a[i],b[i])]);
    }
    cout<<s.size()<<endl;
    for(int i=0;i<n-1;i++){
        cout<<edge[P(a[i],b[i])]<<endl;
    }
    return 0;
}

Measured memory_bytes: 33408
Sx = input()
T = input()

offset = len(Sx) - len(T)

ans = 'UNRESTORABLE'
if len(Sx) >= len(T):
    for d in range(offset, -1, -1):
        for j in range(len(T)):
            if Sx[d + j] not in ['?', T[j]]:
                break
        else:
            break
    else:
        print('UNRESTORABLE')
        exit()

    ans = ''
    for i in range(len(Sx)):
        if i < d or d + (len(T) - 1) < i:
            c = Sx[i]
        else:
            c = T[i - d]
        c = 'a' if c == '?' else c

        ans += c

print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M; cin >> N >> M;
  int s[11][11];
   int k[11];
  rep(i, M) {
     cin >> k[i];
      rep(j, k[i]) {
          int S; cin >> S; S --;
          s[i][j] = S;
      }
  }
  int p[11];
  rep(i, M) {
      int z; cin >> z; z %= 2;
      p[i] = z;
  }
  int ans = 0;
  for(int bit = 0; bit < (1<<N); bit++) {
    bool t = true;
    rep(i, M) {
        int q = 0;
        rep(j, k[i]) {
             if(bit & (1 << (s[i][j]))) q++;
        }
        q %= 2;
        if(p[i] != q) t = false;
    }
    if(t == true) ans ++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    int cnt=0;
    while(b-a>1){
        if(!(cnt%2)){
            a++;
        }else{
            b--;
        }
        cnt++;
    }
    if(!(cnt%2)){
        cout<<"Borys"<<endl;
    }else{
        cout<<"Alice"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
// 二進数を利用して品物の選択数を全列挙する
#include<iostream>
using namespace std;

int main(){
    int n, W;
    cin >> n >> W;
    int v[n], w[n], m[n];
    for(int i = 0; i < n; i++)  cin >> v[i] >> w[i] >> m[i];

    int dp[10001] = {};
    for(int i = 0; i < n; i++){
        for(int k = 0; m[i] > 0; k++){
            int partial = min(m[i], 1<<k);
            m[i] -= partial;
            for(int j = 10000-partial*w[i]; j >= 0; j--){
                dp[j+partial*w[i]] = max(dp[j+partial*w[i]], dp[j] + partial*v[i]);
            }
        }
    }

    int ans = 0;
    for(int i = W; i >= 0; i--) ans = max(ans, dp[i]);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3140
// AOJ 2898: Prime Number
// 2019.2.19 bal4u
 
//#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

#define MAX  10000000+2
#define SQRT 3162   // = sqrt(MAX)
char noPrime[MAX+1] = { 1, 1, 0, 0 };

void sieve()
{
	int i, j;

	for (i = 3; i <= SQRT; i+=2) {
		if (noPrime[i] == 0) {
			for (j = i*i; j < MAX; j += i) noPrime[j] = 1;
		}
	}
}

int main()
{
	int i, N, ans;

	sieve();
	scanf("%d", &N);
	ans = 0;
	if (N >= 3) ans++;
	for (i = 5; i <= N; i+=6) {
		if (noPrime[i] == 0 && noPrime[i+2] == 0) ans++;
	}
	printf("%d\n", ans << 1);
	return 0;
}


Measured memory_bytes: 11612
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;

main(){
  ll n;
  cin>>n;
  if(n==25)cout<<"Christmas";
  else if(n==24)cout<<"Christmas Eve";
  else if(n==23)cout<<"Christmas Eve Eve";
  else if(n==22)cout<<"Christmas Eve Eve Eve";
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>

using namespace std;
using  ull = unsigned long long int;

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


int main() {

	ull n;
	cin >> n;
	vector<ull>num(n);
	rep(i, 0, n)cin >> num[i];
	vector<ull>sum;

	rep(i, 0, n) {
		sum.push_back(num[i]);
		sum.push_back(num[i]+1);
		if(0<=(int)num[i]-1)sum.push_back(num[i]-1);
	}

	sort(sum.begin(), sum.end());

	vector<ull>cnt(*max_element(sum.begin(), sum.end()) + 1, 0);

	rep(i, 0, sum.size())cnt[sum[i]]++;
		
	cout << *max_element(cnt.begin(), cnt.end()) << endl;

	return 0;
}

Measured memory_bytes: 7152