akhauriyash/Code-Regression huggingface dataset:
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll w,h,x,y;
  cin>>w>>h>>x>>y;
  ll an=0;
  if(x*2==w&&y*2==h)an=1;
  double ans=double(w*h)/2;
  cout<<std::setprecision(12)<<ans;
  cout<<" "<<an<<endl;
}


Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
l = factorization(n)
ans = 0
for c in l:
    if c[0]==1:
        break
    lim = c[1]
    num = 1
    while lim >= num:
        lim -= num
        num += 1
    ans += num-1

print(ans)

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

template <typename T>
inline void read(T &x)
{
    T data = 0, f = 1;
    char ch = getchar();
    while (!isdigit(ch))
    {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (isdigit(ch))
    {
        data = (data << 3) + (data << 1) + ch - '0';
        ch = getchar();
    }
    x = f * data;
}

const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int maxn = 2e5 + 9;
int fa[maxn], a[maxn];
int findfa(int x)
{
    return fa[x] == x ? x : fa[x] = findfa(fa[x]);
}
void join(int x, int y)
{
    int fx = findfa(x), fy = findfa(y);
    if (fx != fy)
        fa[fx] = fy;
}
map<int, int> mp;
signed main()
{
    //freopen("in.txt","r",stdin);
    //freopen("data.txt","w",stdout);
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    //std::cout.tie(0);
    int m, n;
    read(m), read(n);
    for (int i = 1; i <= m; ++i)
    {
        fa[i] = i;
    }
    for (int i = 1; i <= n; ++i)
    {
        int u, v;
        read(u), read(v);
        join(u, v);
    }
    int ans = 0;
    for (int i = 1; i <= m; ++i)
    {
        findfa(i);
        mp[fa[i]]++;
        ans = max(ans, mp[fa[i]]);
    }
    cout << ans << endl;
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

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

using namespace std;

const int N = 50;

int a[N], b[N];

int main() {
	int len;
	scanf("%d", &len);
	string str;
	cin >> str;
	int ans = -1;
	for (int i = 0; i < len; i++) {
		memset(a, 0, sizeof a);
		memset(b, 0, sizeof b);
		int cnt = 0;
		for (int j = 0; j <= i; j++) {
			a[str[j] - 'a']++;			
		}
		for (int j = i + 1; j < len; j++) {
			b[str[j] - 'a']++;		
		}
		for (int j = 0; j < 26; j++) {
			if (a[j] == 0 && b[j] == 0) continue;
			if (a[j] > 0 && b[j] > 0) cnt++;
		}
		ans = max(ans, cnt);
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){
  int N; cin>>N;
  int sum=0;
  set<int> s;
  rep(i,N){
    int a; cin>>a;
    sum^=a;
    // a^(a-1)=111・・・111
    s.insert(__builtin_popcount(a^(a-1)));
  }
  int cnt=0;
  while(sum){
    // __builtin_clz：2進で表した場合いくつ０を埋めるか
    int x=32-__builtin_clz(sum);
    if(!s.count(x)){
      cout<<-1<<endl;
      return 0;
    }
    cnt++;
    sum^=(1LL<<x)-1;
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
N = gets.chomp.to_i
T, A = gets.chomp.split(' ').map(&:to_i)
heights = gets.chomp.split(' ').map(&:to_i)
ans = heights.map do |height|
  ((T - height * 0.006) - A).abs
end
puts ans.index(ans.min) + 1


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

int ans ;
int N ;
bool prime[1000200] ;

void SE ( ) ;

int main ( ) 
{
	memset ( prime , false , sizeof ( prime ) ) ;
	SE ( ) ;
	while ( scanf ( "%d" , &N ) == 1 ) {
		ans = 0 ;
		if ( N >= 2 ) {
			ans++ ;
		}
		for ( int i = 3 ; i <= N ; i += 2 ) {
			if ( prime[i] == false ) {
				ans++ ;
			}
		}
		printf ( "%d\n" , ans ) ;
	}
	return 0 ;
}

void SE ( )
{
	prime[0] = prime[1] = true ;
	for ( int i = 3 ; i < 1004 ; i += 2 ) {
		if ( prime[i] == false ) {
			for ( int j = i * i ; j < 1000200 ; j += i * 2 ) {
				prime[j] = true ;
			}
		}
	}
}

Measured memory_bytes: 2008
# -*- coding: utf-8 -*-
import math

errerN=1

while errerN:
    try:
        r=int(input())
        p=0
        for a in range(10):
            for b in range(10):
                for c in range(10):
                    for d in range(10):
                        if a+b+c+d==r:
                            p+=1
        print(p)
    except :
        errerN=0


Measured memory_bytes: 5656
#include<iostream>
#include<string>
using namespace std;
int main(void){
    string str;
    int ab[26]={};
    int i;
    while(getline(cin,str)){
        for(i=0;i<str.size();i++){
            if(str[i]>='a'&&str[i]<='z') ab[str[i]-'a']++;
            else if(str[i]>='A'&&str[i]<='Z') ab[str[i]-'A']++;
        }
    }
    for(i=0;i<26;i++){
        cout << (char)('a'+i) << " : " << ab[i] << endl;
    }
}


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

int abs(int a, int b){
  if(a>=b){ return a-b;}
  else return b-a;
}

int main(){
  int N; cin >> N;
  vector<int> MY(N);
  for(int i=0;i<N;i++){
    cin >> MY.at(i);
  }
  for(int i=0;i<N;i++){
    MY.at(i)-=i+1;
  }
  sort(MY.begin(), MY.end());
  int x=MY.at(N/2);
  int64_t count=0;
  for (int i=0;i<N;i++){
    count+=abs(MY.at(i), x);
  }
  cout << count << endl;
}
  
  

Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DTriangles solver = new DTriangles();
        solver.solve(1, in, out);
        out.close();
    }

    static class DTriangles {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            long[] L = new long[n];
            for (int i = 0; i < n; i++) {
                L[i] = Integer.parseInt(in.next());
            }
            long ans = 0;

            // O(N^2logN)
            Arrays.sort(L);
            for (int a = 0; a < n; a++) {
                for (int b = a + 1; b < n; b++) {
                    long tmp = lowerBound(n, L, L[a] + L[b]);
                    ans += Math.max(tmp - (b + 1), 0);
                }
            }

            // 出力
            out.println(ans);

        }

        private static long lowerBound(int end, long[] arr, long key) {
            int left = 0;
            int right = end;
            while (left < right) {
                int mid = (left + right) / 2;
                if (arr[mid] < key) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            }
            return left;
        }

    }
}



Measured memory_bytes: 39400
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
  
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    if (count(s.begin(), s.end(), 'R') == 3) {
        cout << "3";
    } else if (count(s.begin(), s.end(), 'R') == 0) {
        cout << "0";
    } else if ((s[1] == s[0] && s[0] == 'R') || (s[1] == s[2] && s[1]== 'R')) {
        cout << "2";
    } else {
        cout << "1" << endl;
    }
}

Measured memory_bytes: 3600
#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<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<array>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
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++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acosl(-1.0);

ll mod_pow(ll x, ll n, ll m = mod) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x % m;
		x = x * x % m; n >>= 1;
	}
	return res;
}
struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n % mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint& a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint& a, modint b) { a.n = ((ll)a.n * b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, ll n) {
	if (n == 0)return modint(1);
	modint res = (a * a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 21;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

int d[100][2];
void solve() {
	int n; cin >> n;
	rep(i, n)rep(j, 2)cin >> d[i][j];
	vector<bool> b(n); rep(i, n)if (d[i][0] == d[i][1])b[i] = true;
	rep1(i, n - 2) {
		if (b[i - 1] && b[i] && b[i + 1]) {
			cout << "Yes\n"; return;
		}
	}
	cout << "No\n";
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(15);
	//init_f();
	//init();
	//expr();
	//int t; cin >> t; rep(i, t)
	solve();
	return 0;
}




Measured memory_bytes: 36420
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FL          freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
int dx[] = {1, 0}, dy[] = {0, 1};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int add(int a, int b){return  a + b > mod ? a + b - mod : a + b;}
int mul(int a, int b){return a * b > mod ? a * b % mod : a * b;}
int main(){
    //FL;
    FIN;
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < s.size(); i++)
        if(s[i] != t[i])
            ans++;
    cout << ans <<  '\n';
    EjecuteTime;
    return 0;
}       


Measured memory_bytes: 3920
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  int n,k;
  cin>>n>>k;
  vector<int>l(n);
  rep(i,n)cin>>l[i];
  sort(l.begin(),l.end());
  reverse(l.begin(),l.end());
  int sum=0;
  rep(i,k)sum+=l[i];
  cout<<sum<<endl;
}

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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define loop(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }

int main(){
  int n,T,a; cin >> n >> T >> a;
  vint h(n); vin(h);

  T*=1000;a*=1000;
  vint t(n);rep(i,n) t[i]=abs(T-h[i]*6-a);
  int ans,m=INF;
  rep(i,n){
    if(m>t[i]){
      m=t[i];
      ans=i+1;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N = gets.chomp.to_i
S = gets.chomp.split('')
ans = 'No'
first = nil
last = nil
if S.size % 2 == 0
  first = S.slice(0..(S.size/2 - 1))
  last = S.slice(S.size/2..-1)
  ans = 'Yes' if first === last
end
puts ans

Measured memory_bytes: 1788
import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto hwk = input.front.split.to!( long[] );
	auto sss = new dchar[][]( hwk[ 0 ], hwk[ 1 ] );
	foreach( ref ss; sss )
	{
		input.popFront;
		ss = input.front.to!( dchar[] );
	}
	return tuple( sss );
}

auto solve( dchar[][] sss )
{
	// 行ごとにイチゴの数を集計
	auto cs = sss.map!( ( ss ) => ss.count( '#' ) );
	
	// 最初にイチゴがある行を検索
	auto f = sss.length.signed - cs.find!( ( a, b ) => b < a )( 0 ).length.signed;
	
	// イチゴが一つだけになるように分割
	auto ansss = new long[][]( sss.length, sss[ 0 ].length );
	auto p = 0L;
	for( auto i = f; i < sss.length; i++ )
	{
		if( 0 < cs[ i ] )
		{
			p++;
			auto d = 0L;
			foreach( ref ans, s; lockstep( ansss[ i ], sss[ i ] ) )
			{
				if( s == '#' )
				{
					p += ( 0 < d );
					d++;
				}
				ans = p;
			}
		}
		else
		{
			ansss[ i ][] = ansss[ i - 1 ][];
		}
	}
	for( auto i = 0L; i < f; i++ )
	{
		ansss[ i ][] = ansss[ f ][];
	}
	return ansss.map!( ( anss ) => anss.to!( string[] ).join( " " ) ).join( "\n" );
}


Measured memory_bytes: 10620
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int f(int b[][501],int xb,int xe,int y,int m,int c){
  int i,j;
  for(i=xb;i<xe;i++){
    for(;i<xe&&b[i][y]==1;i++);
    for(j=i;j<xe&&b[j][y]==0;j++);
    if(c*(j-i)>m)
      m=c*(j-i);
    m=f(b,i,j,y+1,m,c+1);
    i=j;
  }
  return m;
}
int main(){
  int i,j;
  int b[501][501],h,w,m;
  string s;
  for(;;){
    cin>>h>>w;
    if(h+w==0)
      break;
    memset(b,1,sizeof(b));
    for(i=0;i<h;i++){
      cin>>s;
      for(j=0;j<w;j++){
	if(s[j]=='.')
	  b[j][i]=0;
      }
    }
    m=0;
    for(i=0;i<h;i++)
      m=f(b,0,w,i,m,1);
    cout<<m<<endl;
  }
  return 0;
}

Measured memory_bytes: 1924
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>
#include<queue>
#include<deque>
#include<fstream>
#include<random>

#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vp vector<pair<ll, ll> >
#define vvp vector<vector<pair<ll, ll> > >
#define First first
#define Second second.first
#define Third second.second
//#define MOD 998244353
#define MAX 100000

typedef long long int ll;
typedef unsigned long long int ull;

using namespace std;

template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return true; } return false; }

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


	ll N;
	cin >> N;
	vl P(N);

	rep(i, N) {
		cin >> P[i];
	}

	ll count = 0;

	rep(i, N) {
		if (P[i] != (i + 1))count++;
	}

	if (count <= 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}



Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  int h, w;
  cin >> h >> w;
  int c[10][10];
  REP(i, 10) {
    REP(j, 10) {
      int x;
      cin >> x;
      c[i][j] = x;
    }
  }
  int short_one[10];
  REP(i, 10) short_one[i] = INT_MAX;
  short_one[1] = 0;

  REP(i, 10) {
    if (i == 1) continue;
    vector<int> perm;
    REP(j, 10) {
      if (j != i) perm.push_back(j);
    }

    do {
      int tmp = 0;
      int from = i;
      REP(k, 9) {
        tmp += c[from][perm[k]];
        if (perm[k] == 1) break;
        from = perm[k];
      }
      short_one[i] = min(short_one[i], tmp);
    } while (next_permutation(ALL(perm)));
  }

  int ans = 0;
  REP(i, h) {
    REP(j, w) {
      int x;
      cin >> x;
      if (x == -1) continue;
      ans += short_one[x];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
S = input()
cnt = 0

for i in range(1000):
    num = str(i).zfill(3)
    check1 = S.find(num[0])
    check2 = S.find(num[1],check1+1)
    check3 = S.find(num[2],check2+1)
    if check1 != -1 and check2 != -1 and check3 != -1:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <deque>
using namespace std;

bool check(string s) {
	for (int i = 0; i < (s.length() / 2); ++i) {
		if (s[i] != s[s.length() - 1 - i]) {
			return false;
		}
	}
	return true;
}

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

	string s;
	cin >> s;
	string s1, s2;
	for (int i = 0; i < (s.length() - 1) / 2; ++i) {
		s1.push_back(s[i]);
	}
	for (int i = (s.length() + 3) / 2 - 1; i < s.length(); ++i) {
		s2.push_back(s[i]);
	}
	bool ok = check(s);
	if (ok) {
		bool ok = check(s1);
	}
	if (ok) {
		ok = check(s2);
	}
	if (ok) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <math.h>
#include<algorithm>
using namespace std;
#define MAX 100000
#define NIL -1

struct node{
  int p,l,r;
};

node A[MAX];

int D[MAX];

void setDepth(int v,int d){
  if(v==NIL) return;
  D[v]=d;
  setDepth(A[v].l,d+1);
  setDepth(A[v].r,d);
}



int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    A[i].p=A[i].l=A[i].r=NIL;
  }
  int v,k,temp,l,root;
  for(int i=0;i<n;i++){
    cin>>v>>k;
    for(int j=0;j<k;j++){
      scanf("%d",&temp);
      if(j==0) A[v].l=temp;
      else A[l].r=temp;
      l=temp;
      A[l].p=v;
    }
  }
  for(int i=0;i<n;i++){
    if(A[i].p==NIL) root=i;
  }
  setDepth(root,0);
  for(int i=0;i<n;i++){
    cout<<"node "<<i<<": parent = "<<A[i].p<<", depth = "<<D[i]<<", ";
    if(D[i]==0) cout<<"root";
    else if(A[i].l==NIL) cout<<"leaf";
    else cout<<"internal node";
    cout<<", [";
    v=A[i].l;
    int count=0;
    while(v!=NIL){
      if(count) cout<<", ";
      cout<<v;
      count++;
      v=A[v].r;
    }
    cout<<"]"<<endl;
  }
}



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

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

    if(a<=b){
        for(int i=0;i<b;i++){
            cout << a ;
        } 
        cout << endl;  
    }
    if(b<a){
        for(int i=0;i<a;i++){
            cout << b ;
        } 
        cout << endl;  
    }
}

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

class _Class
{
	void _()
	{
		var _ABC = _Ns();

		var a = new HashSet<int>();
		a.Add(_ABC[0]);
		a.Add(_ABC[1]);
		a.Add(_ABC[2]);
		Console.WriteLine(a.Count);

	}

	static void Main(string[] args)
  {
    new _Class()._();
  }

  #region

  string _S()
  {
    return Console.ReadLine();
  }

  string[] _Ss()
  {
    return Console.ReadLine().Split();
  }

  int[] _N(int n)
  {
    var x = new int[n];
    for (var i = 0; i < n; i++)
    {
      x[i] = int.Parse(Console.ReadLine());
    }
    return x;
  }

  int[] _Ns()
  {
    var ss = Console.ReadLine().Split();

    var x = new int[ss.Length];
    for (var i = 0; i < ss.Length; i++)
      x[i] = int.Parse(ss[i]);

    return x;
  }
  #endregion
}


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

int main()
{
  int N, M, i, j;
  cin >> N >> M;
  vector<int> city_a(M, 0);
  vector<int> city_b(M, 0);
  vector<int> vec(N, 0);
  
  i = 0;
  while (i < M)
  {
    int	a, b;
    cin >> a >> b;
    
    city_a.at(i) = a;
    city_b.at(i) = b;
    
    vec.at(a - 1) = vec.at(a - 1) + 1;
    vec.at(b - 1) = vec.at(b - 1) + 1;
    //cout << city_a.at(i) << ' ' << city_b.at(i) << endl;
    i++; 
  }
  
  j = 0;
  while (j < N)
  {
    cout << vec.at(j) << endl;
    j++;
  }
  return (0);
}


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

int cut_times(int* logs, int n, int min_length) {
  int ans = 0;
  for(int i=0; i<n; i++) {
    ans += (logs[i]-1)/min_length;
  }

  return ans;
}

int main() {
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0; i<n; i++) cin>>a[i];

  // sort(a, a+n, greater<int>());

  int left = 1;
  int right = 1000000000;

  while(left<right) {
    int mid = (left+right)/2;
    if(cut_times(a,n,mid) > k) {
      left = mid+1;
    }
    else if(cut_times(a,n,mid) <= k) {
      right = mid;
    }
  }

  cout<<left<<endl;

  return 0;
}

Measured memory_bytes: 4368
#![allow(unused_imports)]

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::fmt;
use std::io::{self, BufWriter, Read, StdinLock, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};

fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock().bytes());
    let l1 = sc.next::<String>();
    let l2 = sc.next::<String>();
    let l3 = sc.next::<String>();
    let (l1, l2, l3) = (l1.as_bytes(), l2.as_bytes(), l3.as_bytes());
    println!("{}{}{}", l1[0] as char, l2[1] as char, l3[2] as char);
}

struct Scanner<R: Read> {
    buf: Vec<u8>,
    bytes: io::Bytes<R>,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(bytes: io::Bytes<R>) -> Self {
        Scanner {
            buf: Vec::with_capacity(1024),
            bytes: bytes,
        }
    }

    fn next<T: FromStr>(&mut self) -> T
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        let buf = &mut self.buf;
        buf.clear();
        self.bytes
            .by_ref()
            .map(Result::unwrap)
            .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
            .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
            .foreach(|c| buf.push(c));
        str::from_utf8(&buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        <T1 as FromStr>::Err: fmt::Debug,
        <T2 as FromStr>::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        <T1 as FromStr>::Err: fmt::Debug,
        <T2 as FromStr>::Err: fmt::Debug,
        <T3 as FromStr>::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }

    fn strings_as_mat<T, F: FnMut(u8) -> T>(&mut self, h: usize, mut f: F) -> Vec<Vec<T>> {
        (0..h)
            .map(|_| {
                self.bytes
                    .by_ref()
                    .map(Result::unwrap)
                    .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
                    .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
                    .map(&mut f)
                    .collect()
            })
            .collect()
    }
}

trait Foreach {
    type Item;
    fn foreach<F: FnMut(Self::Item)>(self, f: F);
}

impl<T, I: Iterator<Item = T>> Foreach for I {
    type Item = T;

    fn foreach<F: FnMut(T)>(self, mut f: F) {
        self.fold((), move |(), x| f(x));
    }
}


Measured memory_bytes: 4352
#include <stdio.h>


int main(){
	int a, b, c, k, x=0, y=0, z=0, i, aux;
	scanf("%i %i %i", &a, &b, &c);
	scanf("%i", &k);
	aux=a;
	for(i=k; i>0; i--){
		aux=aux*2;
	}
	x=aux+b+c;
	aux=b;
	for(i=k; i>0; i--){
		aux=aux*2;
	}
	y=aux+a+c;
	aux=c;
	for(i=k; i>0; i--){
		aux=aux*2;
	}
	z=aux+a+b;
	if(x>=y&&x>=z){
		printf("%i\n", x);
	}
	else if(y>=z){
		printf("%i\n", y);
	}
	else{
		printf("%i\n", z);
	}
	

}


Measured memory_bytes: 128
#include<iostream>
#include <string>
#include <sstream>
using namespace std;
int main(){
	int num;
	string res;
	stringstream s;
	cin>>num;
	s<<num;
	s>>res;
	int i=0;
	for(i=0;i<res.length();i++){
		if(res[i]=='7'){
			cout<<"Yes";
			break;	
		}
	}
	if(i==res.length())
	cout<<"No";
	return 0;
} 

Measured memory_bytes: 3632
package main

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

func main() {
	n := readi()
	k := readi()
	p := make([]int, n)
	for i := 0; i < n; i++ {
		p[i] = readi()
	}
	sort.Ints(p)

	ans := 0
	for i := 0; i < k; i++ {
		ans = ans + p[i]
	}

	fmt.Println(ans)
}

/*-------------------utilities-------------------*/

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

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

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

func lcm(a, b int) int {
	return (a * b) / gcd(a, b)
}

func permutations(arr []int) [][]int {
	var helper func([]int, int)
	res := [][]int{}

	helper = func(arr []int, n int) {
		if n == 1 {
			tmp := make([]int, len(arr))
			copy(tmp, arr)
			res = append(res, tmp)
		} else {
			for i := 0; i < n; i++ {
				helper(arr, n-1)
				if n%2 == 1 {
					tmp := arr[i]
					arr[i] = arr[n-1]
					arr[n-1] = tmp
				} else {
					tmp := arr[0]
					arr[0] = arr[n-1]
					arr[n-1] = tmp
				}
			}
		}
	}
	helper(arr, len(arr))
	return res
}

func isPrime(n int) bool {
	if n == 1 {
		return false
	}
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return true
}

func divisor(n int) (res []int) {
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i*i != n {
				res = append(res, n/i)
			}
		}
	}
	sort.Ints(res)
	return
}

// func searchInts(a []int, k int) int {
// 	return binarySearch(len(a), func(i int) bool {
// 		return a[i] >= k
// 	})
// }

func binarySearch(n int, f func(int) bool) int {
	i, j := 0, n
	for i < j {
		h := int(uint(i+j) >> 1)
		if !f(h) {
			i = h + 1
		} else {
			j = h
		}
	}
	return i
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7
)

var (
	readString func() string
)

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

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

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

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

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

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


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

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

    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll ans = 0;

    if (a < k)
    {
        ans += a;
        k = k - a;

        if (b <= k)
        {
            k = k - b;
            if (c >= k && k != 0)
                ans -= k;
        }
    }
    else if (a >= k)
        ans = k;

    cout << ans << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int a, b;
  while(cin >>a >>b && !(a == 0 && b == 0)){
    int c = b - a;
    cout <<(c % 500) / 100 <<" ";
    cout <<(c % 1000) / 500 <<" ";
    cout <<c / 1000 <<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   vector<bool> i;
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   int a=0,b=0,ab=0,o=0;
   int n;
   char c;
   string s;
   while(cin >> n >> c >> s){
      if(s=="A") a++;
      if(s=="B") b++;
      if(s=="AB") ab++;
      if(s=="O") o++;
   }
   cout << a << endl;
   cout << b << endl;
   cout << ab << endl;
   cout << o << endl;
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
#define int long long 
using namespace std;
const int ms =3e4+9;
int vet[ms];
int n;
main(){
	cin >> n;
	int maxi = 0;
	int val;
	vet[0] = 1;
	for(int i= 0;i<n;i++){
		cin >> val;
		for(int j = ms-1;j>=0;j--){
			if(vet[j])
				vet[j+val] = 1;
		}
	}	
	for(int i= 0;i<ms;i++)
		if(vet[i] and i%10)
			maxi = max(maxi,i);
	cout<<maxi;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdio>
#include <list>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecstr vector<string>
#define vecch vector<char>
#define vecpii vector<pii>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}

int main(){
    int n=in(),x=in();
    if(x==1||x==2*n-1)cout<<"No"<<endl;
    else{
        cout<<"Yes"<<endl;
        rep(i,2*n-1)cout<<(x+n+i-1)%(2*n-1)+1<<endl;
    }
}

Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>

using namespace std;

string s;
int q, n;
char t[200000];
char d[200000];

int Serch(int check) {
	for (int i = 0; i < q; i++) {
		if (t[i] == s[check]) {
			if (d[i] == 'L') {
				check--;
			}
			else {
				check++;
			}
		}
		if (check < 0) { return -1; }
		if (check >= n) {
			return -2;
		}
	}
	return -3;
}


int main() {
	cin >> n >> q;
	cin >> s;
	for (int i = 0; i < q; i++) {
		cin >> t[i] >> d[i];
	}


	int high = n;
	int low = 0;
	int left;
	int left_max = 0;
	//左側から落ちるものを二分探索,そのうち一番右を探す
	while (high - low > 1) {
		left = (high + low) / 2;
		if (Serch(left) == -1) {
			low = left;
			left_max = max(left_max, left);
		}
		else {
			high = left;
		}
	}


	high = n;
	low = 0;
	int right;
	int right_min = n;
	//右側から落ちるものを二分探索,そのうち一番左を探す
	while (abs(high - low) > 1) {
		right = (high + low) / 2;
		if (Serch(right) == -2) {
			high = right;
			right_min = min(right_min, right);
		}
		else {
			low = right;
		}
	}

	//cout << right_min << " " << left_max << endl;

	cout << right_min - left_max - 1 << endl;

}

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a[n],m=0,count=0;
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
    }
    for(int i=n-2;i>=0;i--)
    {
        if(a[i] >= a[i+1])
        {
            m++;
        }
        else
        {
            m=0;
        }
        count = max(count,m);
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 100001
#define dmp make_pair
#define dpb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

int a[10000];
int solve(int p, int n){
	int l = p-1, r = p+1, t;
	int s1, s2, ans = 0, f = 1;
	while(0 <= l){
		t = a[l];
		s1 = s2 = 0;
		if(f)s1 = 1, f = 0;
		//if(p == 5)printf("%d %d %d\n", l, r, t);
		while(0 <= l && a[l] == t){
			s1++;l--;
		}
		while(r < n && a[r] == t){
			s2++;r++;
		}
		if(s1+s2 >= 4){
			ans += s1+s2;
		}else break;
	}
	return n-ans;
}

int main(){
	int n, ans;
	while(1){
	scanf("%d", &n);
		ans = INF;
		rep(i,n)scanf("%d", &a[i]);
		if(!n)break;
		for(int i = 1;i < n-1;i++){
			ans = min(ans, solve(i, n));
		}
		if(ans == INF)printf("%d\n", n-1);
		else printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3236
n = int(input())
dish = [tuple(map(int, input().split())) for i in range(n)]
dishNum = [[i, sum(dish[i])] for i in range(n)]
dishNum.sort(key=lambda x: x[1])
ans = 0
for i in range(n):
    w = dishNum.pop()
    y = w[0]
    if i % 2 == 0:
        ans += dish[y][0]
    else:
        ans -= dish[y][1]
print(ans)

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

int main(){
  int x, a, b;
  cin >> x >> a >> b;
  string ans = "safe";
  if(a >= b) ans = "delicious";
  if(b - a > x) ans = "dangerous";
  cout << ans << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N, C, K = map(int, input().split())
T = sorted([int(input()) for _ in range(N)])

tmp, cnt, ans = 0, 0, 0
for t in T:
  if not tmp:
    tmp = t + K
    cnt += 1
    ans += 1
  elif tmp < t or cnt == C:
    tmp = t + K
    cnt = 1
    ans += 1
  else:
    cnt += 1
    
print(ans)


Measured memory_bytes: 14088
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int extgcd(int a,int b,int &x,int &y){
	int g=a;
	x=1,y=0;
	if(b!=0){
		g=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}
	return g;
}
 
// 逆元
int mod_inverse(int a,int m){
	int x, y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}
 
// 階乗
std::vector<int>fact;
void mod_fact(int n, int m){
	fact.resize(n+1);
	fact[0]=1;
	for(int i=1;i<=n;i++){
		fact[i]=fact[i-1]*i%m;
	}
}
 
// nCk mod p
int mod_nCr(int n, int k, int m){
	if(n<k)return 0;
	return fact[n]*mod_inverse(fact[k]*fact[n-k]%m,m)%m;
}

int N,K;

signed main(){
	cin>>N>>K;
	mod_fact(N+1000,MOD);
	int R=N-K;
	cout<<N-K+1<<endl;
	for(int i=1;i<=K-1;i++){
		int E=mod_nCr(K-1,i,MOD);
		E=E*mod_nCr(N-K+1,i+1,MOD);
		E%=MOD;
		cout<<E<<endl;
	}
	return 0;
}


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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;


int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int A, B, X;
	cin >> A >> B >> X;
	if(X >= A && X <= (A+B)){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N = sc.nextInt();
		long[] A = new long[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
		}

		long res = 0;
		int right = 0;
		int sum = 0;
		for (int left = 0; left < N; left++) {
			while (right < N && (sum ^ A[right]) == (sum + A[right])) {
				sum += A[right];
				right++;
			}

			res += right - left;
			if (left == right) {
				right++;
			} else {
				sum -= A[left];
			}
		}

		System.out.println(res);
	}
}

Measured memory_bytes: 84860
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a, b) a = (((a)<(b))?(b):(a))

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


signed main(){
  int n; cin>>n;
  // VI x(n), y(n), h(n); rep(i,n) cin>>x[i]>>y[i]>>h[i];
  vector<pair<int,PII>> p;
  rep(i,n){
    int x,y,h; cin>>x>>y>>h;
    PII z = MP(x,y); p.PB(MP(h,z));
  }
  sort(RALL(p));
  rep(cx,101){
    rep(cy,101){
      // int H = abs(x[0]-cx)+abs(y[0]-cy)+h[0];
      int H = abs(p[0].second.first-cx)+abs(p[0].second.second-cy)+p[0].first;
      reps(i,n-1){
        if(p[i].first!=max(H-abs(p[i].second.first-cx)-abs(p[i].second.second-cy),0)) break;
        if(i==n-1) return cout<<cx SP cy SP H <<endl,0;
      }
    }
  }


  return 0;
}


Measured memory_bytes: 256
import numpy
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]
p = numpy.full(N, K)
for i in A:
  p -= 1
  p[i-1] += 1
for i in range(N):
  print('Yes' if p[i] > 0 else 'No')

Measured memory_bytes: 31820
#include<iostream>
using namespace std;
int main()
{int s=0,n,i,m;
cin>>n>>m;
int a[m];
for(i=0;i<m;i++)
{cin>>a[i];
s+=a[i];}
if((n-s)>=0){cout<<n-s;}
else{cout<<"-1";}}


Measured memory_bytes: 3624
from collections import defaultdict
N = int(input())
dic = defaultdict(list)
ls = []
for i in range(N-1):
  a, b = map(int, input().split())
  dic[a-1] += [(b-1, i)]
  dic[b-1] += [(a-1, i)]
  ls += [(a-1,b-1)]
K = 0
for k in dic.keys():
  if K<len(dic[k]):
    K = len(dic[k])

print(K)
log = [1]*N
ls = [0]*N
stuck = [(0, 0)]
log[0] = 0
ls[0] = 1
ans = [0]*(N-1)
while stuck:
  e, i = stuck.pop()
  b = 1
  for j in range(len(dic[e])):
    ce, h = dic[e][j]
    if log[ce]:
      log[ce] = 0
      ans[h] = (ls[e]+b)%K
      ls[ce] = (ls[e]+b)%K
#      print(h, ls[e], b)
      b += 1
      stuck += [(ce,h)]
      
for x in ans:
  if x==0:
    print(K)
  else:
    print(x)

Measured memory_bytes: 93528
#include <bits/stdc++.h>
using namespace std;
int dfs1(vector<int> &dp, vector<vector<int>> &ch, int v = 0){
  for (int w : ch[v]){
    dp[v] += dfs1(dp, ch, w);
  }
  return dp[v];
}
void dfs2(vector<long long> &ans, list<map<int, int>> &dp2, vector<int> &dp, vector<int> &c, vector<vector<int>> &ch, int v = 0){
  map<int, int> mp;
  dp2.push_back(mp);
  for (int w : ch[v]){
    dfs2(ans, dp2, dp, c, ch, w);
    long long tmp;
    if (dp2.back().count(c[v])){
      tmp = dp[w] - dp2.back()[c[v]];
    } else {
      tmp = dp[w];
    }
    ans[c[v]] -= tmp * (tmp + 1) / 2;
    auto itr1 = prev(dp2.end());
    auto itr2 = prev(dp2.end(), 2);
    if ((*itr1).size() < (*itr2).size()){
      for (auto P : (*itr1)){
        (*itr2)[P.first] += P.second;
      }
      dp2.erase(itr1);
    } else {
      for (auto P : (*itr2)){
        (*itr1)[P.first] += P.second;
      }
      dp2.erase(itr2);
    }
  }
  dp2.back()[c[v]] = dp[v];
  return;
}
int main(){
  int N;
  cin >> N;
  vector<int> c(N);
  for (int i = 0; i < N; i++){
    cin >> c[i];
    c[i]--;
  }
  vector<vector<int>> E(N);
  for (int i = 0; i < N - 1; i++){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    E[a].push_back(b);
    E[b].push_back(a);
  }
  vector<int> p(N, -1);
  vector<vector<int>> ch(N);
  queue<int> Q;
  Q.push(0);
  while (!Q.empty()){
    int v = Q.front();
    Q.pop();
    for (int w : E[v]){
      if (w != p[v]){
        p[w] = v;
        ch[v].push_back(w);
        Q.push(w);
      }
    }
  }
  vector<int> dp(N, 1);
  dfs1(dp, ch);
  list<map<int, int>> dp2;
  vector<long long> ans(N, (long long) N * (N + 1) / 2);
  dfs2(ans, dp2, dp, c, ch);
  for (int i = 0; i < N; i++){
    int tmp = N - dp2.back()[i];
    ans[i] -= (long long) tmp * (tmp + 1) / 2;
  }
  for (int i = 0; i < N; i++){
    cout << ans[i] << endl;
  }
}

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

int main(){
    ll n,m,ans = 0;
    cin >> n >> m;
    vector<ll> s(n);
    for(int i = 0;i < n;i ++){
        ll a;
        cin >> a;
        if(!i) s[i] = a%m;
        else s[i] = (s[i-1] + a)%m; 
    }
    sort(s.begin(),s.end());
    for(int i = 0;i < n;i ++){
        if(s[i]==0) ans ++;
    }
    for(int i = 1;i < n;i ++){
        ll cnt = 1;
        while(i<n&&s[i]==s[i-1]){
            cnt ++;
            i ++;
        }
        ans += cnt*(cnt-1)/2;
    }
    cout << ans << endl;
    return 0;
}

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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var imp = Console.ReadLine().Split(' ');
            int A = int.Parse(imp[0]);
            int B = int.Parse(imp[1]);
            int[] whitch = new int[3];
            whitch[0] = A + B;
            whitch[1] = A - B;
            whitch[2] = A * B;

            Array.Sort(whitch);
            Console.Write(whitch[2]);
        }
    }
}


Measured memory_bytes: 11092