akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;

int main() {
    int n;
    cin >> n;
    int hund = n / 100;
    int ten = (n - hund * 100) / 10;
    int one = (n - hund * 100 - ten * 10);
    string yomi;
    switch(one){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            yomi = "hon";
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            yomi = "pon";
            break;
        case 3:
            yomi = "bon";
            break;
    }
    cout << yomi << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
//#define mod 998244353
//#define mod 1000000009
#define Pi 3.14159265359
#define eps 1e-9
#define all(v) v.begin(),v.end()
#define sz(v) ((int)(v).size())
#define each(x, v) for (auto &x : v)
#define pii         pair<int,int>
#define vi          vector<int>
#define vvi         vector<vi>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define endl        '\n'
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rep0(i,b)   for(int i=0;i<b;++i)
using namespace std;
typedef long long ll;
ll pw(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b & 1)
            ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}
void solve();

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int T = 1;
//    cin>>T;
    while(T--){
        solve();
    }

    return 0;
}
void solve(){
    string a;
    cin>>a;
    cout<<a.substr(0,3);
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b,ans=-1e9;
  cin>>n>>a;
  for(int i=1;i<n;++i){
    cin>>b;
    if(ans<b-a) ans=b-a;
    if(b<a) a=b;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3104
N = int(input())
A = [int(num) for num in input().split()]

S = {-A[0] : 1}
ans = 0
for i in range(1,N):
    ans += S.get(A[i]-i, 0)
    S[-A[i]-i] = S.get(-A[i]-i, 0) + 1
print(ans)

Measured memory_bytes: 40384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;


int seg_tree[1<<18],seg_N;
const int seg_init_num=1<<30;

void seg_init(int n){
	int i;
	for(i=0;(1<<i)<n;i++);
	seg_N=(1<<i)-1;
}

int seg_search(int n,bool first=true){
	if(first)n+=seg_N;
	if(n==0)return seg_tree[0];
	return seg_tree[n]+seg_search((n-1)/2,false);
}

void seg_set(int a,int b,int n=0,int r=0,int l=seg_N){
	if(l<a || b<r)return;
	if(a<=r && l<=b){
		seg_tree[n]++;
		return;
	}
	seg_set(a,b,n*2+1,r,(r+l)/2);
	seg_set(a,b,n*2+2,(r+l)/2+1,l);
}

void array_show(int *a,int n){
	for(int i=0;i<n;i++)printf("%d%c",a[i],(i!=n-1?' ':'\n'));
}
void array_show(LL *a,int n){
	for(int i=0;i<n;i++)printf("%lld%c",a[i],(i!=n-1?' ':'\n'));
}

int t[300005][2];
int s[100005];
priority_queue<P,vector<P>,greater<P> > q1;

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n>>m;
	for(i=0;i<n;i++){
		cin>>t[i][0]>>t[i][1];
		a=t[i][1]-t[i][0];
		s[a]++;
		q1.push(make_pair(a,i));
	}
	for(i=m-1;i>=0;i--){
		s[i]+=s[i+1];
	}
	seg_init(m+1);
	for(i=0;i<m;i++){
		while(!q1.empty() && q1.top().first==i-1){
			a=q1.top().second,q1.pop();
			seg_set(t[a][0],t[a][1]);
		}
		for(j=0;j<=m;j+=i+1){
			s[i]+=seg_search(j);
		}
	}
	for(i=0;i<m;i++){
		cout<<s[i]<<endl;
	}
}


Measured memory_bytes: 8688
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=998244353;
const ll MAX_N=500010;
const ll INF=4448283280358331064;

/*
int main(){
    int n;
    cin>>n;
    ll k;
    cin>>k;
    vector<ll> pos(0), neg(0);
    int zero=0;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        if(a>0) pos.push_back(a);
        if(a==0) zero++;
        if(a<0) neg.push_back(-a);
    }
    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());

    ll ub=INF;
    ll lb=-INF;
    while(ub-lb>1){
        ll m=(ub+lb)/2;
        ll num=0;
        //cout<<m<<endl;
        if(m<=0){
            for(ll u:neg){
                num+=pos.end()-upper_bound(pos.begin(),pos.end(),-m/u);
            }
        }else{
            num+=neg.size()*pos.size();
            num+=zero*(neg.size()+pos.size());
            num+=zero*(zero-1)/2;
            for(int i=0;i<pos.size();i++){
                num+=lower_bound(pos.begin()+i, pos.end(), m/pos[i])-(pos.begin()+i);
            }
            for(int i=0;i<neg.size();i++){
                num+=lower_bound(neg.begin()+i, neg.end(), m/neg[i])-(neg.begin()+i);
            }
        }
        if(num<=k){
            lb=m;
        }else{
            ub=m;
        }
    }
    cout<<ub<<endl;
}

*/

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<int> > G(n);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> ans(n,-1);
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int now=q.front(); q.pop();
        for(int to:G[now]){
            if(ans[to]==-1){
                ans[to]=now;
                q.push(to);
            }
        }
    }
    cout<<"Yes"<<endl;
    for(int i=1;i<n;i++){
        cout<<ans[i]+1<<endl;
    }

}

Measured memory_bytes: 9676
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << ", "
template <typename T> ostream& operator<<(ostream& _o_, const vector<T>& _v_){ \
 if(!_v_.empty()){_o_<<'[';copy(_v_.begin(),_v_.end(),ostream_iterator<T>(_o_,", "));_o_<<"\b\b]";}return _o_;}
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
typedef unsigned int uint;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unsigned char uchar;
struct secure_hash {
 static uint64_t splitmix64(uint64_t x) {
  x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); }
 size_t operator()(uint64_t x) const {
  static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } };
template<typename T> using V = vector<T>;
template<typename T, typename U> using umap = unordered_map<T,U,secure_hash>;
template<typename T> using uset = unordered_set<T,secure_hash>;
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using max_heap = priority_queue<T>;

int n;
int a[21][21];
const ll M = 1e9+7;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    rep(i,0,n) rep(j,0,n) cin >> a[i][j];
    V<ll> dp(1<<n, 0);
    dp[0] = 1;
    for (int mask = 0; mask < (1<<n); ++mask) {
        int i = __builtin_popcount(mask);
        for (int j = 0; j < n; ++j) {
            if (a[i][j] and !(mask & (1<<j))) {
                dp[mask^(1<<j)] += dp[mask];
                dp[mask^(1<<j)] %= M;
            }
        }
    }
    cout << dp[(1<<n)-1] << endl;
}


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

#define sswap(x, y) { x+=y; y=x-y; x-=y; }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  unsigned long long n, a, b;
  cin >> n >> a >> b;
  cout << a*(n/(a+b)) + min(n%(a+b), a) << ende;
  return 0;
}


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

using namespace std;


int main(void)
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    for (int i = 1;;i++)
    {
        c -= b;
        if (c <= 0)
        {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if (a <= 0)
        {
            cout << "No" << endl;
            break;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3608
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut ans: usize = 0;
    for i in 0..n {
        ans += i
    }
    println!("{}", ans)
}
// cited from https://kenkoooo.hatenablog.com/entry/2019/05/07/101033
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+50;
const int mod=1e9+7;
int a[maxn];
int main(){
	int n;scanf("%d",&n);
	for(int i=1;i<n;i++){
		int x;scanf("%d",&x);a[x]++;
	}for(int i=1;i<=n;i++){
		printf("%d\n",a[i]);
	}
}

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

int a[100000];


bool check(int d, int N, int X) {
	int x = X % d;
	for (int i = 0; i < N; i++) {
		if (a[i] % d != x) {
			return false;
		} 
	} 
	return true;
}

int main() {
	int N,X;
	cin >> N >> X;


	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a, a + N);

	int min_a = 999999999;
	for (int i = 1; i < N; i++) {
		min_a = min(min_a, a[i] - a[i -1]);
	}

	for (int i = 1; i < 10000; i ++) {
		if (min_a % i != 0) continue;
		if (min_a / i <= 1) {
			cout << 1 << endl;
			return 0;			
		}
		if (check(min_a / i, N, X)) {
			cout << min_a / i << endl;
			return 0;
		}

	}

	for (int d = (min_a + 1) / 10000; d >= 2; d --) {
		if (check(d, N, X)) {
			cout << d << endl;
			return 0;
		}
	}

	cout << 1 << endl;

	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
#define hhh printf("hhh\n")
#define see(x) (cerr<<(#x)<<'='<<(x)<<endl)
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const int maxn = 3e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

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

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

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

int main(){
  int X,Y,Z,K;cin >> X >> Y >> Z >> K;
  vector<ll> A(X);
  vector<ll> B(Y);
  vector<ll> C(Z);
  for(int i=0;i<X;i++){
    cin >> A[i];
  }
  for(int i=0;i<Y;i++){
    cin >> B[i];
  }
  for(int i=0;i<Z;i++){
    cin >> C[i];
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  sort(B.begin(),B.end());
  reverse(B.begin(),B.end());
  sort(C.begin(),C.end());
  reverse(C.begin(),C.end());
  vector<ll> D;
  for(int i=0;i<min(K,X);i++){
    for(int j=0;j<min(K,Y);j++){
      D.push_back(A[i]+B[j]);
    }
  }
  sort(D.begin(),D.end());
  reverse(D.begin(),D.end());
  vector<ll> E;
  int W = D.size();
  for(int i=0;i<min(K,Z);i++){
    for(int j=0;j<min(K,W);j++){
      E.push_back(C[i]+D[j]);
    }
  }
  sort(E.begin(),E.end());
  reverse(E.begin(),E.end());
  for(int i=0;i<K;i++){
    cout << E[i] << endl;
  }
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

typedef long long ll;

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

    // 整数で処理するために √a + √b < √c の両辺を2乗して展開・移項
    ll d = c - a - b;
    if(d > 0 && 4 * a * b < d * d){
        OP("Yes");
    }else{
        OP("No");
    }
}



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

int main() {
    int n, m, x, num, sum = 0, sum2 = 0;
    cin >> n >> m >> x;

    int A[n+1];

    for(int i=0; i<=n; i++) {
        A[i] = 0;
    }

    for(int i=0; i<m; i++) {
        cin >> num;
        A[num] = 1;
    }

    for(int i=0; i<x; i++) {
        sum += A[i];
    }
    for(int i=x+1; i<=n; i++) {
        sum2 += A[i];
    }
    if(sum<=sum2) {
        cout << sum << endl;
    }
    else {
        cout << sum2 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int n;
    cin>>n;
    long long int loop=1, m=n,result=0;
    while((n - loop) / loop>loop){
       
        result += ((n - loop) / loop)*(0==(n - loop) % loop);
        loop++;
    }

    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES":"NO");}
void Yn(bool z){cout<<(z?"Yes":"No");}
void yn(bool z){cout<<(z?"yes":"no");}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 998244353;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 4001;
ll fac[N], rfac[N], s[N], p2[N];
int n, k;
ll comb(int a, int b){
  if(b<0||a<b) return 0;
  return fac[a] * rfac[b] % mod * rfac[a-b] % mod;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  fac[0] = 1;
  rfac[0] = 1;
  p2[0] = 1;
  FOR(i, 1, N){
    fac[i] = fac[i-1]*i%mod;
    rfac[i] = modpow(fac[i], mod-2, mod);
    p2[i] = p2[i-1]*2%mod;
  }
  cin >> k >> n;
  FOR(i, 2, k+2){
    ll ans = 0;
    int p = i/2;
    if(i%2){
      FOR(j, 0, p+1) ans += comb(p, j) * p2[j] % mod * comb(n+k-2*p-1, k-2*p+j-1) % mod;
    }else{
      p--;
      FOR(j, 0, p+1) ans += comb(p, j) * p2[j] % mod * (comb(n+k-2*p-2, k-2*p+j-2) + comb(n+k-2*p-3, k-2*p+j-2)) % mod;
    }
    s[i] = ans%mod;
    printf("%d\n", s[i]);
  }
  FOR(i, k+2, k*2+1) printf("%d\n", s[k*2+2-i]);
  return 0;
}

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

using namespace std;

struct P {
    int a;
    int b;
};
int main(void){
    // Your code here!
    int n, h; cin >> n >> h;
    vector<P> katana(n);
    int maxnum = 0;
    for(int i = 0; i < n; i++) {
        cin >> katana[i].a >> katana[i].b;
        maxnum = max(maxnum,katana[i].a);
    }
    sort(katana.begin(),katana.end(),[](P a, P b){return a.b>b.b;});
    int cnt = 0;
    for(int i = 0; i < n; i++) {
        if(maxnum>=katana[i].b) break;
        else h -= katana[i].b;
        cnt++;
        if(h<=0) {
            h = 0;
            break;
        }
    }
    if(h!=0) cnt += (h-1)/maxnum + 1;
    cout << cnt << endl;
    
}

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

using namespace std;

typedef long long ll;

const int MAXN = 20;
const int MAXS = 100005;
const int MOD = 1e9 + 7;

ll f[MAXN][MAXS];

int A[MAXN], num[MAXS];

ll fac[MAXS], inv[MAXS], invf[MAXS];

int n, m;

void init()
{
	fac[0] = 1;
	for (int i = 1; i <= (1 << n); i++)
		fac[i] = fac[i - 1] * i % MOD;
	inv[1] = 1;
	for (int i = 2; i <= (1 << n); i++)
		inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
	invf[0] = invf[1] = 1;
	for (int i = 2; i <= (1 << n); i++)
		invf[i] = invf[i - 1] * inv[i] % MOD;
	for (int i = 1; i < (1 << n); i++)
		num[i] = num[i >> 1] + (i & 1 ? 1 : 0);
}

inline ll C(int n, int m)
{
	if (n < m)
		return 0;
	return fac[n] * invf[m] % MOD * invf[n - m] % MOD;	
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
		cin >> A[i];
	sort(A + 1, A + m + 1);
	reverse(A + 1, A + m + 1);
	init();
	f[0][0] = 1;
	for (int i = 0; i < m; i++)
	{
		for (int j = 0; j < (1 << n); j++)
		{
			if (f[i][j])
			{
				(f[i + 1][j] += f[i][j]) %= MOD;
				for (int k = 0; k < n; k++)
					if (!(j & (1 << k)))
						(f[i + 1][j | (1 << k)] += f[i][j] * C((1 << n) - A[i + 1] - j, (1 << k) - 1) % MOD * fac[(1 << k)] % MOD) %= MOD;
			}
		}
	}
	ll res = 0;
	for (int S = 0; S < (1 << n); S++)
	{
		if (num[S] % 2 == 1)
			(res += (MOD - 1) * f[m][S] % MOD * fac[(1 << n) - S - 1] % MOD) %= MOD;
		else
			(res += f[m][S] * fac[(1 << n) - S - 1] % MOD) %= MOD;
	}
	cout << res * (1 << n) % MOD << endl;
	return 0;
}


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


int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int delx=c-a;
    int dely=d-b;
    for(int i=0;i< delx;i++){
        cout << 'R';
    }
    for(int i=0;i< dely;i++){
        cout << 'U';
    }
    for(int i=0;i<delx;i++){
        cout << 'L';
    }    for(int i=0;i<dely;i++){
        cout << 'D';
    }

    cout << 'D' << 'R';
    for(int i=0;i< delx;i++){
        cout << 'R';
    }
    for(int i=0;i< dely;i++){
        cout << 'U';
    }
    cout << 'U';
        cout << 'L';
    cout << 'U';
    for(int i=0;i<delx;i++){
        cout << 'L';
    }
    cout << 'L';
    
    for(int i=0;i<dely;i++){
        cout << 'D';
    }
        cout << 'D';
        cout << 'R';
    
    cout << endl;
}

Measured memory_bytes: 256
import numpy as np
import math

def solve(num):
  table = np.zeros((9,9))

  for n in range(1, num+1):
    order = len(str(n))
    upper = n // 10**(order-1)
    lower = int(str(n)[-1])
    if lower == 0:
      continue
    table[lower-1][upper-1] += 1

  ans = 0
  for n in range(1, num+1):
    order = len(str(n))
    upper = n // 10**(order-1)
    lower = int(str(n)[-1])
    if lower == 0:
      continue
    ans += table[upper-1][lower-1]
  return int(ans)

if __name__ == "__main__":
  _n = int(input())
  ans = solve(_n)
  print(ans)


Measured memory_bytes: 12508
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) {}
    bool unionSet(int x, int y) {
        x = root(x);
        y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
};

int main() {
    int w, h;
    cin >> w >> h;

    vector<int> p(w), q(h);

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

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

    vector<pair<int, int>> all(w + h);
    for (int i = 0; i < w; ++i) {
        all[i].first = p[i];
        all[i].second = 0;
    }

    for (int i = 0; i < h; ++i) {
        all[i + w].first = q[i];
        all[i + w].second = 1;
    }

    ll ans = 0;

    int x = 0, y = 0;
    sort(all.begin(), all.end());

    for (int i = 0; i < all.size(); ++i) {
        if (all[i].second == 0) {
            ans += (ll)(all[i].first) * (h + 1 - y);
            x++;
        } else {
            ans += ll(all[i].first) * (w + 1 - x);
            y++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 2560
N = int(input())
W = [int(i) for i in input().split()] 
S = [0] * N

for i in range(N):
	C1 = 0
	C2 = 0
	for j in range(N):
		if i <= j:
			C1 += W[j]
		else:
			C2 += W[j]
	S[i] = abs(C1-C2)
print(min(S))

Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#if defined(_MSC_VER)
#pragma warning(disable : 4996)  // VSでscanfを使う．
#endif

signed main() {
  double w, h, x, y;
  cin >> w >> h >> x >> y;

  bool ison = (x == w) || (y == h) || (x == 0) || (y == 0);
  double s = w * h;
  double ans = s / 2;
  bool dup = ((x == (w / 2))) && ((y == (h / 2)));

  printf("%.15f %d\n", ans, dup);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <map>
#include <queue>
#include <stack>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int r;
    cin >> r;
    if (r < 1200) {
        cout << "ABC" <<endl;
    }
    else if (r < 2800) {
        cout << "ARC" <<endl;
    }
    else {
        cout << "AGC" <<endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    ll n, tmpa;
    vector<ll> a;

    cin >> n;
    rep(i, n){
        cin >> tmpa;
        a.push_back(tmpa);
    }

    rep(i, n){
        a[i] -= i+1;
    }

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

    ll b = 0;
    if(n%2==1){
        b = a[n/2];
    }else{
        ll v1 = a[n/2-1];
        ll v2 = a[n/2];
        b = (v2-v1)/2 + v1;
    }

    ll sum = 0;
    rep(i, n){
        sum += abs(a[i]-b);
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#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(v) v.begin(), v.end()
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
const int MOD = 1e9+7;


int main(){
  
  int n,y; cin>>n>>y;
  ll sum=0;
  bool check=false;
  REP(i,n+1){
    REP(j,n-i+1){
      sum=i*10000+j*5000+(n-i-j)*1000;
      if(y==sum){
        check=1;
        cout<<i<<' '<<j<<' '<<n-i-j<<endl;
        break;
      }
    }
      if(check)break;
  }
  if(!check)cout<<"-1 -1 -1"<<endl;
}

Measured memory_bytes: 256
import sys
import copy
import math
import itertools
import numpy as np
l = [int(input()) for c in range(5)]
#10で割った余りが1以上で最も小さいものを探す
tmp = 0
cnt = 5
for i in range(5):
    if tmp < 10 - l[i]%10 and l[i]%10!=0:
        tmp = 10 - l[i]%10
        cnt = i
res = 0
for i in range(5):
    if cnt == i:
        res+=l[i]
    else:
        if l[i]%10==0:
            res+=l[i]
        else:
            res+=l[i]+10-l[i]%10

print(res)

Measured memory_bytes: 27164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 998244353;
string S;
int K, M;
int memo[400][400][400];
bool visited[400][400][400];
map<int,int> memo_g;
int g(int q) {
	if (memo_g.count(q)) return memo_g[q];
	int r = 0, qq = q;
	while (qq >= 0 && S[qq] == '1') { -- qq; ++ r; }
	return memo_g[q] = r;
}
int f(int p, int r, int s) {
	if (r > K) return 0;
	if (p == (int)S.length()) {
		return 1;
	}
	if (visited[p][r][s]) return memo[p][r][s];
	visited[p][r][s] = true;
	int q = M-p-s;
	int res = 0;
	if (q >= 0 && S[q] == '0') {
		res += f(p+1, r, s);
	} else {
		int x = g(q);
		int qq = q-x;
		if (qq >= 0 && S[qq] == '0') {
			res += f(p+1, r+x, s+x);
		}
	}
	if (q >= 0 && S[q] == '1') {
		res += f(p+1, r, s);
	} else if (s > 0) {
		res += f(p+1, r, s-1);
	}
	return memo[p][r][s] = res % mod;
}
int main() {
	cin >> S >> K;
	M = (int)S.length()-1;
	cout << f(0, 0, 0) << endl;
}


Measured memory_bytes: 109056
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
int n,k,now,cnt;
vector<int>E[105];
void solve()
{
	now=(n-1)*(n-2)/2;
	if(k>now)
	{
		puts("-1");
		return;
	}
	for(int i=2;i<=n;++i)
	E[1].pb(i),cnt++;
	bool ok=1;
	if(now==k)ok=0;
	for(int i=2;i<=n&&ok;++i)
	{
		for(int j=i+1;j<=n&&ok;++j)
		{
			E[i].pb(j),now--,cnt++;
			if(now==k)ok=0;
		}
	}
	printf("%d\n",cnt);
	for(int i=1;i<=n;++i)
	{
		int len=E[i].size();
		for(int j=0;j<len;++j)
		printf("%d %d\n",i,E[i][j]);
	}
} 
int main()
{
	scanf("%d%d",&n,&k);
	solve(); 
	return 0;
} 

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int dp[3001][3001];

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

    rep(i, 3001) dp[i][0] = 0;
    rep(j, 3001) dp[0][j] = 0;

    rep(i, s.size())
    {
        rep(j, t.size())
        {
            if (s[i] == t[j])
                dp[i + 1][j + 1] = dp[i][j] + 1;
            else
                dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
        }
    }

    string ans = "";

    int i = s.size(), j = t.size();

    while (i > 0 && j > 0)
    {
        if (dp[i][j] == dp[i - 1][j])
            i--;
        else if (dp[i][j] == dp[i][j - 1])
            j--;
        else
        {
            ans = s[i - 1] + ans;
            i--, j--;
        }
    }

    OP(ans);
    return 0;
}

Measured memory_bytes: 35456
#include <stdio.h>

int main(void){
	int month,day,i;
	
	while(1){
		scanf("%d %d",&month,&day);
		if(month == 0) break;
		
		// 前の月の分、日を足す
		for(i=month;i > 1;i--){
			switch(i){
				case 3:
					day += 29;
					break;
				case 5:
				case 7:
				case 10:
				case 12:
					day += 30;
					break;
				case 2:
				case 4:
				case 6:
				case 8:
				case 9:
				case 11:
					day += 31;
					break;
			}
		}
		
		// 7で割った余り
		switch(day % 7){
			case 1:
				printf("Thursday\n");
				break;
			case 2:
				printf("Friday\n");
				break;
			case 3:
				printf("Saturday\n");
				break;
			case 4:
				printf("Sunday\n");
				break;
			case 5:
				printf("Monday\n");
				break;
			case 6:
				printf("Tuesday\n");
				break;
			case 0:
				printf("Wednesday\n");
		}
	}
	return 0;
}

Measured memory_bytes: 584
//******\\
||udc321||	 
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<queue>
#include<map>
#include<set>
#include<fstream>
#include<cstring>
#define ll long long
#define fr(e,r,v) for(int e=r;e<v;e++)
#define bc(e,r,v) for(int e=r;e>v;e--)
#define all(n) (n.begin(),n.end())
#define ft first
#define sd second
#define pb push_back
#define lb lower_bound
#define mpr make_pair
#define db  double
using namespace std;
ll mod=1000000007;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main()
{
	ll n;
	cin>>n;
	ll h[n];
	fr(j,0,n)
	{
		cin>>h[j];
	}
	vector<ll> dp(n,mod);
	dp[0]=0;dp[1]=abs(h[1]-h[0]);
	fr(j,2,n)
	{
		dp[j]=min(dp[j-1]+abs(h[j-1]-h[j]),dp[j-2]+
			abs(h[j-2]-h[j]));
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 4808
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define _for(i,a,b) for(int i = (a);i<(b);i++)
#define endl  '\n'
#define inf 0x3f3f3f3f
#define ull unsigned long long  
using namespace std;
const int mod=1e9+7;
const int MAX=2e5+7;
const double pi=6.28318530717958623200;
//ll a[MAX];
int main()
{
 	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	double r;
 	cin>>r;
 	cout<<fixed<<setprecision(25)<<r*pi;
 	
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}

void solve()
{
	int n, k;
	cin >> n >> k;
	double a[n];
	for(int i = 0; i < n; ++i){
		cin >> a[i];
		a[i] = (a[i] + 1) / 2.0;
	}
	double sum = 0;
	double mx = 0;
	for(int i = 0; i < k; ++i){
		sum += a[i];
	}
	mx = sum;
	for(int i = k; i < n; ++i){
		sum -= a[i - k];
		sum += a[i];
		mx = max(mx, sum);
	}
	cout << fixed << setprecision(7) << mx << endl;
}


 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}

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

int main()
{
    long long i, num,j,l,count=0,k=0;



    scanf("%lld", &num);


    for(i=1; i<=sqrt(num); i++)
    {

        if(num % i == 0)
        {
           j=i;
        }
    }
    j=max(j,num/j);
        while(j!= 0)
         {
            j /= 10;
            ++count;
         }
      printf("%lld",count);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);++i)
#include <math.h>
using namespace std;

double distance(vector<int> data1,vector<int> data2){
    double sum = 0.0;
    for(int i=0;i<data1.size();i++){
        double deltai = data2[i] - data1[i];
        sum += deltai*deltai;
    }
    return (double)sqrt(sum);
}

int main(){
    int n,d;
    cin >> n >> d;
    vector< vector<int> > data(n,vector<int>(d));
    rep(i,n){
        for(int j=0;j<d;j++){
            cin >> data.at(i).at(j);
        }
    }
    int num = 0;
    for(int i=0;i<data.size()-1;i++){
        for(int j=i+1;j<data.size();j++){
            double dis;
            dis = distance(data.at(i),data.at(j));
            if(ceil(dis) == floor(dis)) num += 1;
        }
    }
    cout << num << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]"):
    xsum = 0
    for x in a:
        xsum = xsum ^ x
    print(" ".join(str(xsum ^ x) for x in a))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


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

int main(){
  int N;
  long int a[100];
  cin >> N;
  a[0] = 2;
  a[1] = 1;
  for(int i = 2; i <= N; i++){
    a[i] = a[i-1] + a[i-2];
  }
  cout << a[N] << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k,ans=1;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
    	if(ans>k)
    	ans+=k;
    	else
    	ans+=ans;
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int n;
  cin >> n;
  vector<int> l(n),r(n);
  rep(i,n){
    cin >> l.at(i) >> r.at(i);
  }
  vector<bool> sitting(100000);
  rep(i,n){
    for(int j=l.at(i)-1;j<=r.at(i)-1;j++){
      sitting.at(j) = true;
    }
  }
  int cnt = 0;
  rep(i,100000){
    if(sitting.at(i)){
      cnt++;
    }
  }
  cout << cnt << endl;
      
    
  
      
    
  
  
}

Measured memory_bytes: 256
import collections

# 入力 : N
# 入力 : A1 A2 ... AN
N = int(input())
A = list(map(int, input().split()))

C = collections.Counter(A)

Total = sum([i*(i-1)/2 for i in C.values()])

for Ak in A:
    print(int(Total - C[Ak]+1))



Measured memory_bytes: 26780
#include<iostream>
#include<array>

using namespace std;

int main(){
    int a[3][3];
    int b[10];
    bool x[3][3],answer = false;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin>>a[i][j];
            x[i][j] = false;
        }
    }
    int n;
    cin>>n;
    for(int i = 0; i < n; i++){
        cin>>b[i];
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(b[i] == a[j][k]){x[j][k] = true;}
            }
        }
    }
    for(int i = 0; i < 3; i++){
        if(x[i][0] && x[i][1] && x[i][2]){
            answer = true;
        }else if(x[0][i] && x[1][i] && x[2][i]){
            answer = true;
        }
    }
    if(x[0][0] && x[1][1] && x[2][2]){
        answer = true;
    }else if(x[0][2] && x[1][1] && x[2][0]){
        answer = true;
    }
    if(answer){
        cout<<"Yes"<<endl;
      }else{                                                                           
      cout<<"No"<<endl;
    }                                                                                                                                                     }

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    ll n;
    cin >> n;
    if (n % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }

    ll d = 5, ans = 0;
    while (d <= n) {
        ll k = n / d;
        ans += k / 2;
        d *= 5;
    }
    cout << ans << endl;
}

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

     string s;
     cin >> s;


     int n;

    if(s == "SUN")
        n = 7;
    else if(s == "MON")
        n = 6;
    else if(s == "TUE")
        n = 5;
    else if(s == "WED")
        n = 4;
    else if(s == "THU")
        n = 3;
    else if(s == "FRI")
        n = 2;
    else if(s == "SAT")
        n = 1;


    cout<<n<<endl;



    return 0;
}


Measured memory_bytes: 3432
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

class state{
public:
  int x, y;
  int time;
  state(int x, int y, int time){
    this->x = x;
    this->y = y;
    this->time = time;
  }
};

int main(){
  int h, w; cin >> h >> w;
  char grid[h+1][w+1];
  bool visited[h+1][w+1];
  bool goaled=false;

  int wcount=0;
  int dx[]={-1, 0, 1, 0}, dy[]={0, -1, 0, 1};

  for(int i=1; i<=h; i++){
    for(int j=1; j<=w; j++){
      cin >> grid[i][j];
      if(grid[i][j]=='.') wcount++;
      visited[i][j]=false;
    }
  }

  queue<state> q;
  state start(1,1,1);  q.push(start);
  visited[1][1]=true;

  int ans;
  while(!q.empty()){
    state now=q.front(); q.pop();
    if(now.x==w && now.y==h){
      ans = now.time;
      goaled=true;
      break;
    }

    for(int i=0; i<4; i++){
      int nx=now.x+dx[i], ny=now.y+dy[i];
      if(nx<1 || nx>w || ny<1 || ny>h || grid[ny][nx]=='#' || visited[ny][nx]) continue;
      state next(nx, ny, now.time+1);
      visited[ny][nx]=true;
      q.push(next);
    }
  }

  if(goaled) cout << wcount-ans << endl;
  else cout << -1 << endl;


  return 0;

}


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

int main(){
    string s;
    cin >> s;
    
    vector<char> ans;
    rep(i,s.size()){
        if(s[i]=='0') ans.push_back('0');
        if(s[i]=='1') ans.push_back('1');
        if(s[i]=='B'&&ans.size()>0) ans.pop_back();
    }
    
    rep(i,ans.size()) cout << ans[i];
}


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

int main()
{
  int N;
  cin >> N;
  string result = "No";
  int keta = 100;
  for (int i = 0; i < 3; i++) {
  	int k = N / (keta * 7);
    int amari = N % (keta * 7);
    if (k == 1 && amari < keta) {
    	result = "Yes";
      	break;
    }
    N -= N / keta * keta;
    keta /= 10;
  }
  cout << result << endl;
}


Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <cassert>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

struct UF{
  vector<int> par, dep, sz;
  UF(int n){
		n++;
    par.resize(n), dep.resize(n, 0), sz.resize(n, 1);
    re(i, n) par[i] = i;
  }
  int find(int xu){
    if(par[xu] == xu) return xu;
    return par[xu] = find(par[xu]);
  }
  void unite(int xu, int yu){
    xu=find(xu), yu=find(yu);
    if(xu == yu) return;
    if(dep[xu] < dep[yu]) sz[yu] += sz[xu], par[xu] = yu;
    else par[yu] = xu, sz[xu] += sz[yu];
    if(dep[xu] == dep[yu]) dep[xu]++;
  }
  bool same(int xu, int yu){ return find(xu) == find(yu);}
};

struct segtree{
  ll M=1, INIT;
  vector<ll> dat;
  segtree(ll N, ll num):INIT(num){
    while(M<N) M*=2;
    dat.resize(M*2-1, INIT);
  }
  void update(ll x, ll k){
    k+=M-1;
    dat[k] += x;
    while(k>0) k = (k-1)/2, dat[k] = dat[k*2+1] + dat[k*2+2];
  }
  ll query(ll a, ll b=-1, ll k=0, ll l=0, ll r=-1){
    if(r==-1) r = M;
    if(b==-1) b = M;
    if(r<=a || b<=l) return INIT;
    if(a<=l && r<=b) return dat[k];
    ll A = query(a, b, k*2+1, l, (l+r)/2);
    ll B = query(a, b, k*2+2, (l+r)/2, r);
    return A + B;
  }
};

int main(){
  ll n;std::cin >> n;
  UF uf(n+1);
  vvl d = VV(n, 4, 0, ll);
  vll y(n);
  for(int i=0;i<n;i++){
    std::cin >> d[i][0] >> d[i][1];
    d[i][0]--, d[i][1]--;
    d[i][2] = i;
  }

  sort(all(d));
  segtree seg(n, 0);

  ll max_idx = -1;
  ll max_ok_idx = -1;
  for(int i=0;i<n;i++) {
    y[d[i][1]] = i;
    d[i][3] = i;
  }
  auto pre = d;
  sort(all(d), [&](vll l, vll r){return l[1] < r[1];});
  reverse(all(d));

  for(int i=0;i<n;i++){
    //yをどこまでみたか
    //max_idx以下ならcontinue
    ll idx = y[d[i][1]];
    seg.update(1, idx);
    if(idx<max_idx) continue;
    ll q = seg.query(0, idx);

    if(q == idx) {
      max_idx = max(max_idx, idx);
      continue;//no_ok
    }

    //max_ok_idxとマージ、max_idx~iまでマージ
    if(max_ok_idx!=-1&&seg.query(0, max_ok_idx)!=max_ok_idx) {
      uf.unite(pre[max_ok_idx][2], d[i][2]);
    }

    for(int j=max_idx+1;j<idx;j++){
      if(pre[j][1]>d[i][1]) continue;
      uf.unite(pre[j][2], d[i][2]);
    }

    max_ok_idx = max(max_ok_idx, idx);
    max_idx = max(max_idx, idx);
  }

  for(int i=0;i<n;i++){
    ll p = uf.find(i);
    std::cout << uf.sz[p] << '\n';
  }
}


Measured memory_bytes: 39348
import sys

readline = sys.stdin.buffer.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from copy import copy
    n, k = map(int, readline().split())
    a = list(map(int, readline().split()))
    cur = copy(a)

    for cnt in range(k):
        cum = [0] * (n + 1)
        for i, x in enumerate(cur):
            left = max(0, i - x)
            cum[left] += 1
            right = min(i + x + 1, n)
            cum[right] -= 1

        cur[0] = cum[0]
        for i in range(n-1):
            cur[i + 1] = cur[i] + cum[i + 1]

        if all([j == n for j in cur]):
            break

    print(*cur[:n])

if __name__ == '__main__':
    main()


Measured memory_bytes: 168592
N, K = map(int, input().split())
x = list(map(int, input().split()))

min_t = 10e9
for i in range(N - K + 1):
    e = i + K - 1
    l = min(x[i], 0)
    r = max(x[e], 0)

    t = min(-l, r) * 2 + max(-l, r)
    min_t = min(min_t, t)

print(min_t)


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

int main(){
  string s; cin >> s;
  map<char,int> mp;
  for(int i = 0;i < s.size();i++){
    mp[s[i]]++;
  }

  for(auto itr = mp.begin();itr != mp.end();itr++){
    if(itr->second != 1){
      cout << "no" << endl;
      return 0;
    }
  }

  cout << "yes" << endl;
}

Measured memory_bytes: 256
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

mod = 1000000007

"""
# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    L = list(map(int, sys.stdin.readline().split()))
    L.sort()
    print((L[2] - L[1]) + (L[1] - L[0]))


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

int main() {
    int n,m;
    cin >> n >> m;
    vector<int>a(n);
    vector<int>b(n);
    vector<int>c(m);
    vector<int>d(m);
    for(int i=0;i<n;i++){
        cin >> a.at(i) >> b.at(i);
    }
    for(int i=0;i<m;i++){
        cin >> c.at(i) >> d.at(i);
    }
    for(int i=0;i<n;i++){
        int ans=0;
        int com=1e9+7;
        for(int j=0;j<m;j++){
            if(abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j))<com){
                ans=j;
                com=abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j));
            }
        }
        cout << ans+1 << endl;
    }
}

Measured memory_bytes: 256