akhauriyash/Code-Regression huggingface dataset:
import Foundation

let input_line: String = readLine()!
var num = 0
let a = Int(input_line)!
var c : Int = 0
var b : [Int] = []
let  input: String = readLine()!
let split: [String] = input.components(separatedBy: " ")
split.forEach {
  b.append(Int($0)!)
}
for i in 1...a {
  if ((i % 2 == 1) && (b[i-1] % 2 == 1)) {
    num += 1
  }
}
print(num)



Measured memory_bytes: 14192
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll mod_div(ll a,ll b){
  ll tmp=MOD-2,c=b,ret=1;
  while(tmp>0){
    if(tmp&1){
      ret*=c;ret%=MOD;
    }
    c*=c;c%=MOD;tmp>>=1;
  }
  return a*ret%MOD;
}
 
#define MAX_K 2000100
vector<ll> kaijo(MAX_K);
ll combination(ll n, ll r){
  if(n<r||n<0||r<0)
    return 0;
  if(kaijo[0]!=1){
    kaijo[0]=1;
    for(ll i=1;i<MAX_K;i++)kaijo[i]=(kaijo[i-1]*i)%MOD;
  }
  ll ret=kaijo[n];
  long long tmp = (kaijo[r] * kaijo[n-r]) % MOD;
  return mod_div(ret,tmp);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,k;cin>>n>>m>>k;
  ll kake = combination(n*m-2,k-2);
  ll ans = 0;
  for(ll i=1;i<n;i++){
    ans += kake*(((((m*m%MOD)*i)%MOD)*(n-i))%MOD)%MOD;
    ans %= MOD;
  }
  for(ll i=1;i<m;i++){
    ans += kake*(((((n*n%MOD)*i)%MOD)*(m-i))%MOD)%MOD;
    ans %= MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 15872
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int n;
    int a[100],b[100],c[100];

    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d", &a[i]);
    for(int i=1;i<=n;i++) scanf("%d", &b[i]);
    memset(c,0,sizeof(c));
    for(int i=1;i<=n-1;i++) scanf("%d", &c[i]);

    int res=0;
    int last=-1;    
    for(int i=1;i<=n;i++)
    {
        if(last==a[i]-1) res+=c[a[i]-1];
        res+=b[a[i]];
        last=a[i];

        //printf("%d\n", res);
    }

    printf("%d\n", res);
}

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

using namespace std;

int main(){
    int N;
    long a[200000];
    long b[200000];
    long a_[200000];
    long b_[200000];
    long ans = 0;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    for(int i = 0; i < N; i++){
        cin >> b[i];
    }
    for(int i = 1; i <= 31; i++){
        long n = ((long)1 << i);
        for(int j = 0; j < N; j++){
            a_[j] = a[j]&(n-1);
            b_[j] = b[j]&(n-1);
        }
        sort(a_, a_+N);
        sort(b_, b_+N);
        long total = 0;
        for(int j = 0; j < N; j++){
            total += (lower_bound(b_, b_+N, n-a_[j]) - lower_bound(b_, b_+N, n/2-a_[j]));
            total += (lower_bound(b_, b_+N, 2*n-a_[j]) - lower_bound(b_, b_+N, n+n/2-a_[j]));
        }
        //cout << total << endl;
        if(total%2 == 1) ans += n/2;
    }
    cout << ans << endl;
}

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

int N,M;

int main(){

	cin >> N >> M;
  	
  	int L = 1;
  	for(int i = 0; i < M ; i++) L = L*2;
  	
   	cout << L*(1900 * M + 100*( N - M ))<< endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>

#include<cmath>
#include<iostream>
#include<fstream>

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

using namespace std;


int main(){

    char oper;
    int a,b;

    scanf("%d %c %d",&a, &oper, &b);

        if(oper=='+')
            printf("%d",a+b);
        else if(oper == '-')
            printf("%d",a-b);
}


Measured memory_bytes: 256
/***
*	author  :_shamim
*	created : 05.05.2020
*
***/

#include <iostream>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <list>
#include <set>
#include <queue>
#include <iterator>
#include <bitset>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#define ll             long long
#define _              ios_base::sync_with_stdio(0);cin.tie(0);
#define loop           for(i=0;i<n;i++)
#define pb             push_back
#define tc()           int t;cin>>t;while(t--)          

using namespace std;

ll i,j,temp;

int main()
{_
	
	char name1[4];
	char name2[4];
	char name3[4],x;
	int flag=0;

	cin>>name1>>name2;

	for(i=0,j=2;i<3;i++,j--){
		if(name1[i]!=name2[j]){
			flag = 0;
			break;
		}
		else{
			flag = 1;
		}

	}
	if(flag){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin>>s;
	if(s[s.size()-1]=='s'){
	    cout<<s+"es";
	} else {
	    cout<<s+"s";
	}
	return 0;
}


Measured memory_bytes: 3664
### main

loop do
  a, b, c = gets.split.map(&:to_i)
  break if (a | b | c) == 0
  #p [a, b, c]

  d2 = b * b - 4 * a * c
  #p d2

  if d2 >= 0
    d = Math.sqrt(d2 + 0.5).to_i

    if d * d == d2
      x0 = Rational(-b - d, 2 * a)
      x1 = Rational(-b + d, 2 * a)
      #p [x0, x1]

      p = x0.denominator
      q = -x0.numerator
      r = x1.denominator
      s = -x1.numerator

      if p < r || (p == r && q < s)
        tmp = p; p = r; r = tmp
        tmp = q; q = s; s = tmp
      end

      puts [p, q, r, s].join(' ')
      next
    end
  end

  puts 'Impossible'
end

Measured memory_bytes: 6140
#include <iostream>
#include <algorithm>
using namespace std;
int p[1100];
int main(){
    int N, K;
    scanf("%d%d", &N, &K);
    for(int i = 1; i <= N; i++){
        scanf("%d", &p[i]);
    }
    sort(p + 1, p + N + 1);
    int ans = 0;
    for(int i = 1; i <= K; i++){
        ans += p[i];
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep2(i,n) for (int i = 1; i <= (n); i++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
using ll = long long;
using vi = vector<int>;
template <class T>
using Grid = vector<vector<T>>;

int main(){
    int N, T, A;
    cin >> N >> T >> A;
    double mdif = 1000000000;
    int ans;
    rep(i, N) {
        int h;
        cin >> h;
        double t = T - h * .006;
        if (abs(A-t) < mdif) {
            mdif = abs(A - t);
            ans = i + 1;
        }
    }
    cout << ans << endl;
}

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

int main() {
    string a,b,c;
    cin >> a >> b >> c;
    cout << char(a[0]-32) << char(b[0]-32) << char(c[0]-32) << endl;
}


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

int main() {
    // your code goes here
    ll n;
    char s[100005];
    vector<ll> a,b,all;
    bool ht=false;
    cin >> s;
    n=strlen(s);
    ll q;
    cin >> q;
    rep(qs,1,q){
        ll t;
        cin >> t;
        if(t==1) ht=!ht;
        else{
            ll f;
            char c[5];
            cin >> f >> c;
            if(ht) f=3-f;
            if(f==1) a.push_back(c[0]-'a');
            if(f==2) b.push_back(c[0]-'a');
        }
    }
    reverse(a.begin(),a.end());
    for(ll i=0;i<a.size();i++) all.push_back(a[i]);
    rep(i,0,n-1) all.push_back(s[i]-'a');
    for(ll i=0;i<b.size();i++) all.push_back(b[i]);
    if(ht) reverse(all.begin(),all.end());
    for(ll i=0;i<all.size();i++){
        s[0]='a'+all[i];
        cout << s[0];
    }
    cout << endl;
    return 0;
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

std::vector<int> primes(int n) {
    std::vector<int> primes;
    std::vector<bool> isPrime(n+1, true);
    for (int i = 2; i <= n; i++) {
        if (!isPrime[i]) continue;
        primes.push_back(i);
        long long buf = i * 2;
        while (buf <= n) {
            isPrime[buf] = false;
            buf += i;
        }
    }

    return primes;
}

std::map<int, int> prime_fact(long long n) {
    std::map<int, int> cnt;

    long long m = n;
    for (int i: primes(int(sqrt(n))+1)) {
        if (m % i == 0) {
            cnt[i] = 1;
            m /= i;
        }
        while (m % i == 0) {
            cnt[i]++;
            m /= i;
        }
    }
    if (m != 1) {
        cnt[m] = 1;
    }

    return cnt;
}

int n;
string s;

int main() {
    cin >> n;

    Mii m = prime_fact(n);
    auto iter = m.end();
    iter--;

    printf("%d: ", n);
    FOR(i, m) {
        REP(j, i->second) {
            std::cout << i->first;
            if (j != i->second - 1) {
                std::cout << ' ';
            }
        }
        if (i != iter) {
            std::cout << ' ';
        }
    }
    std::cout << '\n';

    return 0;
}



Measured memory_bytes: 3336
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw_2(62,1);


int main(){
    ll H,W; cin>>H>>W;
    vector<vector<char> > field(H,vector<char>(W));
    rep(i,H){
        string t; cin>>t;
        rep(j,W) field[i][j]=t[j];
    }
    vector<ll> H2;
    vector<ll> W2;
    rep(i,H){
        bool c=false;
        rep(j,W){
            if(field[i][j]=='#') c=true;
        }
        if(c) H2.pb(i);
    }
    rep(j,W){
        bool c=false;
        rep(i,H){
            if(field[i][j]=='#') c=true;
        }
        if(c) W2.pb(j);
    }
    
    rep(i,sz(H2)){
        rep(j,sz(W2)){
            cout<<field[H2[i]][W2[j]];
        }
        cout<<endl;
    }
}



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

int main() { 
    string s;
    cin >> s;
    map<char, int> m;
    for(int i = 0; i < 4; ++i) {
        m[s[i]] = 0;
    }
    for(int i = 0; i < 4; ++i) {
        m[s[i]] += 1;
    }
    bool ok = true;
    if(m.size() == 2) {
        for(auto p : m) {
            if(p.second != 2) {
                ok = false;
                break;
            }
        }
    } else ok = false;
    cout << ((ok) ? "Yes" : "No") << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int main(){
	int n;
	int x[64],y[64];
	for(int T=1; scanf("%d",&n),n; T++){
		rep(i,n)scanf("%d%d",x+i,y+i);
		int sum = 0;
		rep(i,n){
			sum += (x[(i+1)%n]-x[i])*(y[(i+1)%n]+y[i]);
		}
		printf("%d %.1lf\n",T,(double)sum/2.0);
	}
	return 0;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h> 

using namespace std;
 
#define len(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vi vector<int> 
#define vvi vector<vector<int>>
#define pb push_back
 
#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(10);
    solve();    
}

const int INF = 1e18, MAXN = 2e5 + 10, MOD = 1e9 + 7;

int gets(int l, int r, vi &ps) {
	if (l == 0) {
		return ps[r];
	}
	else {
		return ps[r] - ps[l - 1];
	}
}

int getx(int l, int r, vi &px) {
	if (l == 0) {
		return px[r];
	}
	else {
		return px[r] ^ px[l - 1];
	}
}

void solve() {
 	int n; cin >> n;
 	vi a(n);
 	for (int i = 0; i < n; ++i) {
 		cin >> a[i];
 	}

 	vi ps(n), px(n);
 	ps[0] = a[0], px[0] = a[0];

 	int ans = 0;
 	for (int i = 1; i < n; ++i) {
 		ps[i] = ps[i - 1] + a[i];
 		px[i] = px[i - 1] ^ a[i];
 	}

 	for (int i = 0; i < n; ++i) {
 		int l = i, r = n; 
 		while (r - l > 1) {
 			int mid = (r + l) / 2;
 			int asn1 = gets(i, mid, ps);
 			int ans2 = getx(i, mid, px);

 			if (asn1 == ans2) {
 				l = mid;
 			}
 			else {
 				r = mid;
 			}
 		}

 		ans += (l - i + 1);
 	}

 	cout << ans << endl;
}


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

const int MAX=1e5+5;
long long n;
long long a[MAX],b[MAX];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n+1;i++){
		scanf("%lld",&a[i]);
	}
	for(int i=1;i<=n;i++){
		scanf("%lld",&b[i]);
	}
	long long kill=0;
	for(int i=1;i<=n;i++){
		if(b[i]<=a[i]){
			kill=kill+b[i];
		}else{
			if((b[i]-a[i])<=a[i+1]){
				kill=kill+b[i];
				a[i+1]=a[i+1]-b[i]+a[i];
			}else{
				kill=kill+a[i]+a[i+1];
				a[i+1]=0;
			}
		}
	}
	printf("%lld\n",kill);
}

Measured memory_bytes: 1792
// https://atcoder.jp/contests/abc170/tasks/abc170_d
#include<bits/stdc++.h>
using namespace std;

int main(int argc, char* argv[]) {
	int n, nax = 0;
	cin >> n;
	vector<int> a (n);
	for (auto& x:a) {
		cin >> x;
		nax = max(nax, x);
	}
	sort(a.begin(), a.end());
	vector<bool> dp (nax+1); // false means none of divisors
	for (int j = 0; j < n; j++) {
		auto x = a[j];
		for (int i = 2; x*i <= nax; i++) {
			dp[x*i] = true;
		}
		if (j > 0 && x == a[j-1] && !dp[x]) {
			dp[x] = true;
		}
	}
	int ans = 0;
	for (auto x:a) {
		if (!dp[x]) {
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
#define Rep(i,n) for(int i = 0; i < (n); i++)
#define For(i,start,end) for(i64 i = start; i < end; i++)
inline void nl(){std::cout<<std::endl;}
using namespace std;
typedef long long ll;
typedef unsigned long ul;

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ui = uint64_t;

//----------------library in this time--------------------------------
template <class T>
T gcd(const T a,const T b) {
    return (b == 0) ? a : gcd (b, a % b);
}
template <class T>
T lcm(const T a, const T b) {
    return a * b / gcd(a,b);
}
template <class T>
inline T ave(const T a, const T b) {
    return (a + b) / 2.0f;
}

long long squareTwo(const long long a,const long long b) {
    return (b == 1) ? a : squareTwo(a * 2, b - 1);
}

template<class T> inline bool UpdateMin(T& a, T b) {
    if (a > b) { a = b; return 1; } return 0;
}

template<class T> inline bool UpdateMax(T& a, T b) {
    if (a < b) { a = b; return 1; } return 0;
}

//------------------------main function-------------------------------
void Main(){
    int n;
    cin >> n;
    vector<int> L(n);
    Rep(i,n) cin >> L[i];
    sort(L.begin(), L.end());
    //for(int i:L) cout << i << " ";
    //nl();
    int ans = 0;
    Rep(b,n-1){
       // nl();
        Rep(a,b) {
            //cout << "a = "<< a<< "; b = "<<  b <<  endl;
        int ab = L[a]+L[b];
        int r = lower_bound(L.begin(), L.end(), ab)- L.begin();
        int l = b + 1;
            //cout << "ab = " << ab << "; r = "<< r <<"; l = "<< l << endl;
        // c = [l,r)
        ans += max(0,r-l);
    }}
    cout << ans << endl;
    /*
    int n;
    cin >> n;
    vector<int> L(n);
    Rep(i,n) cin >> L[i];
    sort(L.begin(), L.end());
    int ans = 0;
    Rep(b,n) {
        int r = b+1;
        Rep(a,b) {
            int ab = L[a]+L[b];
            while (r < n && L[r] < ab) ++r;
            int l = b+1;
            ans += max(0,r-l);
        }
    }
    cout << ans << endl;
     */
}
//--------------------------------------------------------------------
int main(){
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    
    Main();
    return 0;
}



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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int n, m;
vector< vector<int> > g;
int ans = 0;

void dfs(int now, vector<bool> done){
    done[now] = true;
    for(auto x : g[now]){
        if(!done[x]){
            dfs(x, done);
        }
    }
    bool flag = true;
    rep(i, n){
        flag &= done[i];
    }
    if(flag){
        ++ans;
    }
    return;
}

int main(){
    cin >> n >> m;
    g.resize(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<bool> done(n);
    dfs(0, done);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int ori = 1;
  int A,B,ans = 0;
  scanf("%d %d",&A,&B);
  while(ori<B)
  {
    ori+=(A-1);
    
    ans++;
  }
  printf("%d\n",ans);
  return 0; 
}

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

int main(){
  string a,b;cin >> a >> b;
  int num = stoi(a+b);
  int x = (int)(sqrt(num));
  if(x*x==num) puts("Yes");
  else puts("No");
}


Measured memory_bytes: 256
import math
n=int(input())
a=[list(map(int,input().split())) for i in range(n)]
p=0
for i in range(0,n-1):
  for j in range(i+1,n):
    p+=((a[i][0]-a[j][0])**2+(a[i][1]-a[j][1])**2)**0.5
print(p*2/n)

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

ll a[200000];

int main() {
	ll d, n, m;
	while (scanf("%lld", &d), d) {
		scanf("%lld%lld", &n, &m);
		rep(i, n - 1)scanf("%lld", &a[i]);
		a[n - 1] = 0; a[n] = d;
		sort(a, a + n + 1);
		a[n + 1] = a[n - 1] - d;
		sort(a, a + n + 2);
		ll cnt = 0;
		rep(i, m) {
			ll k; scanf("%lld", &k);
			ll*p = lower_bound(a, a + n + 2, k);
			cnt += min(*p - k, k - *(p - 1));
		}
		printf("%lld\n", cnt);
	}
}

Measured memory_bytes: 3996
import sys
N = int(input())
li = []
if N == 1:
    a = list(map(int,input().split()))
    print(1)
    sys.exit()   
 
for i in range(N):
    a = list(map(int,input().split()))
    li.append(a)
 
cross = []
 
##計算量に余裕があるので全探索します
for i in range(N):
    for j in range (i+1, N):
        a = [li[j][0]-li[i][0],li[j][1]-li[i][1]]
        if a[0] <= 0 and a[1] <= 0:
            b = [abs(li[j][0]-li[i][0]),abs(li[j][1]-li[i][1])]
            cross.append(b)
        elif a[0] < 0 and a[1] >= 0:
            c = li[j][1]-li[i][1]
            b = [abs(li[j][0]-li[i][0]),-c]
            cross.append(b) ####
        else:
            cross.append(a) 
lencross = len(cross)
 
res = 0
ans = []
 
for i in range (lencross):
    res = 0
    for j in range (lencross):
        if cross[i] == cross[j]:
            res += 1
    ans.append(res)
reduce = max(ans)
 
print(N - reduce)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	cin>>n;
	ll a[n];
	for(auto &o : a)cin>>o;
	ll  dp[n+1];
	ll sum=0;
	memset(dp, 0, sizeof dp);
	sum=a[0];
	
	for(int i=2;i<=n;i++)
	{
		if(i&1)
		{
			dp[i]=max(a[i-1]+dp[i-2], dp[i-1]);
			sum+=a[i-1];
		}
		else //choosing odd number of elements
		{
			dp[i]=max(a[i-1]+dp[i-2], sum);
			
		}
		
	}
	cout<<dp[n]<<"\n";
}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    int ans = 0;
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    for(int i = 0; i < K; i++) ans+= A[i];
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 1e18;
long long int mod = 1000000007;
double Pi = 3.1415926535897932384626;
/*
vector<ll> G[500005];
vector<P> tree[500010];

//big priority queue
priority_queue <ll> pql;
priority_queue <P> pqp;

//small priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
*/
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1 , number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1 , number1);
    }
}


ll i,j,k,ii,jj;
ll n,m;
ll a,b,c,d,e,g,h,r;
ll l;
ll num;
ll x[500005],y[500005],z[500005];
ll ans[180000];
bool dame;
char s[500005];

void solve2(){
	a = 0;
	for(i=0;i<m;i++){
		if(x[i] % 2 == 1){
			b = x[a];
			x[a] = x[i];
			x[i] = b;
			if(a == m-1)break;
			a = m-1;
		}
	}
	for(i=0;i<m;i++){
		pe(x[i]);
	}
	el;
	k = m + 1;
	y[0] = x[0] - 1;
	if(y[0] == 0)k--;
	y[1] = 2;
	for(i=1;i<m-1;i++){
		y[i+1] = x[i];
	}
	y[m] = x[m-1]-1;
	if(y[m] == 0)k--;
	p(k);
	for(i=0;i<=m;i++){
		if(y[i] == 0)continue;
		pe(y[i]);
	}
	return;
}
void solve1(){
	for(i=0;i<m;i++){
		if(x[i] % 2 == 1){
			b = x[i];
			x[i] = x[0];
			x[0] = b;
			break;
		}
	}
	for(i=0;i<m;i++){
		pe(x[i]);
	}
	el;
	p(m);
	pe(x[0]+1);
	for(i=1;i<m-1;i++){
		pe(x[i]);
	}
	p(x[m-1]-1);
}

int main(){
    
    cin >> n >> m;
	k = n;
	for(i=0;i<m;i++){
		cin >> x[i];
		a += x[i]/2;
		if(x[i] % 2 == 1)b++;
	}

	if(a + n/2 < n-1){
        p("Impossible");
	}else if(m == 1){
		p(x[0]);
		if(x[0] % 2 == 1){
			p((n+1)/2);
			while(n >= 2){
				pe(2);
				n -= 2;
			}
			p(1);
		}else{
			if(n != 2){
				p(2);
				pe(2);
				p(n-2);
			}else{
				p(2);
				pe(1);p(1);
			}
		}

	}else if(b == 0){
		//assert(n == -1);
		for(i=0;i<m;i++){
			pe(x[i]);
		}
		el;
		p(m);
		pe(x[0] + 1);
		for(i=1;i<m-1;i++)pe(x[i]);
		p(x[m-1]-1);
	}else if(b == 2){
		solve2();
	}else{
		solve1();
	}
    
   
    return 0;
}

Measured memory_bytes: 4480
import java.util.Scanner;

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

        if(r < 1200)
            System.out.println("ABC");
        else if(r < 2800)
            System.out.println("ARC");
        else
            System.out.println("AGC");
    }
}

Measured memory_bytes: 22356
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        
        int x = a - b*2;
        System.out.println(Math.max(x, 0));
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
int main()
{
	int N, x, y, z, n, A[10001];
	scanf("%d", &N);
	for(x = 0;  x <= N; x++)
		A[x] = 0;
	for(x = 1;  x < 100; x++)
		for(y = 1;  y < 100; y++)
			for(z = 1;  z < 100; z++)
			{
				n = x*x + y*y + z*z + x*y + y*z + x*z;
				if(n <= N)
					A[n]++;
			}
	for(x = 1;  x <= N; x++)
		printf("%d\n", A[x]);
	return 0;
}

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

#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}

int main(void){
    int a,b,c,k;
    vector<int> num(3),e={1,0,-1};
    cin>>num[0]>>num[1]>>num[2]>>k;
    ll ans=0;
    rep(i,0,3){
        ans+=e[i]*min(num[i],k);
        k-=min(num[i],k);
        if(k<0)break;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, dp[100005];
vector<int>node[100005];
bool vis[100005];

int solve(int a){
	if(vis[a]){
		return dp[a];
	}
	vis[a]=1;
	int total=0;
	for(auto i:node[a]){
		total=max(total, 1+solve(i));
	}
	return dp[a]=total;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	cin >> n >> m;
	for(int i=1;i<=m;i++){
		cin >> x >> y;
		node[x].push_back(y);
	}
	int ha=0;
	for(int i=1;i<=n;i++){
 	   ha=max(ha, solve(i));
	}
	cout << ha << endl;
}

Measured memory_bytes: 8320
#include<stdio.h>
int main()
{
	int value[11]={0};
	int value2[11]={0};
	int i,j,d,dd=0;;

	for(i=0;i<10;i++)
	{
		scanf("%d",&value[i]);
	}
	for(i=0;i<10;i++)
	{
		for(j=0;j<10;j++)
		{
			if(value[i]<value[j])
			{
				d=value[i];
				value[i]=value[j];
				value[j]=d;
			}
		}
		value2[dd]=value[i];
		value[i]=-1;
		dd++;
	}
	for(i=0;i<3;i++)
	{
		printf("%d\n",value2[i]);
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;



int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  REP(i,n) cin >> h[i];
  int maxh = h[0];
  int cnt = 0;
  REP(i,n){
    if(h[i] >= maxh){
      maxh = h[i];
      cnt++;
    }

  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3628
# include <cstdio>
# include <algorithm>
# include <cstring>
# include <cmath>
# include <climits>
# include <iostream>
# include <string>
# include <queue>
# include <vector>
# include <set>
# include <map>
# include <cstdlib>
# include <stack>
# include <ctime>
using namespace std;

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define mct(a,b) memset(a,b,sizeof(a))
# define gc getchar()
typedef long long ll;
const int N=1e5+5;
const int inf=0x7fffffff;
const double eps=1e-7;
template <typename T> void read(T &x){
	x=0;int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
	x*=f;
}
ll n;

int main()
{
	read(n);
	printf("%lld\n",n*(n-1)/2);
	return 0;
}

Measured memory_bytes: 256
ans = 'Yes'
bef = [0, 0, 0]
gets.to_i.times{
  t, x, y = gets.chomp.split(" ").map(&:to_i)
  next if ans == 'No'
  ans = 'No' if (t + x + y).odd?
  ans = 'No' if (x-bef[1]).abs + (y-bef[2]).abs > (t-bef[0])
  bef = [t, x, y]
}

puts ans


Measured memory_bytes: 1788
def solve(string):
    n, k, q, *a = map(int, string.split())
    t = [0] * n
    for _a in a:
        t[_a - 1] += 1
    return "\n".join(["Yes" if _t > q - k else "No" for _t in t])


if __name__ == '__main__':
    n, m, q = map(int, input().split())
    print(solve('{} {} {}\n'.format(n, m, q) + '\n'.join([input() for _ in range(q)])))


Measured memory_bytes: 14024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

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

  int x; cin >> x;
  cout << (x >= 30 ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 3568
#include <stdio.h>
void printAFrame(int y, int x) {
  int i, j;
  for (i = 0; i < x; i++)
    printf("#");
  puts("");
  for (i = 0; i < y - 2; i++) {
    printf("#");
    for (j = 0; j < x - 2; j++) {
      printf(".");
    }
    printf("#\n");
  }
  for (i = 0; i < x; i++)
    printf("#");
  printf("\n\n");
}

int main(void) {
  int H[100000], W[100000];
  int i, j, k, n = 0;

  do {
    scanf("%d %d", &H[n], &W[n]);
    n++;
  } while (!(H[n - 1] == 0 && W[n - 1] == 0));

  // printAFrame(H[0], W[0]);

  for (i = 0; i < n - 1; i++){
    printAFrame(H[i], W[i]);
  }

  return 0;
}

Measured memory_bytes: 1028
def solve(s):
    ret = [0] * (len(s) + 1)
    size = 0
    tmp = 0
    for i in range(len(s)):
        if s[i] == '>':
            size += 1
            ret[i] = tmp
            tmp = 0
        if s[i] == '<':
            ret[i] = tmp
            tmp += 1
            if size > 0:
                for j in range(size + 1):
                    if ret[i - j] < j:
                        ret[i - j] = j
                tmp = 1
            size = 0

    if size > 0:
        for j in range(size + 1):
            if ret[len(s) - j] < j:
                ret[len(s) - j] = j
    else:
        size += 1
        ret[len(s)] = tmp

    return sum(ret)

_s = input()
print(solve(_s))


Measured memory_bytes: 48460
#include<stdio.h>
#define NILL -1
int n,parent[100000];

int depth(int);
int height(int);
int main()
{
  int i,j,k,m=0,l,r,L[100000],R[100000],id, child; 
  int sib[100000],deg[100000],hei[100000],dep[100000];
  for(i=0; i<100000; i++){
    parent[i] = -1;
    sib[i] = -1;
    deg[i] = 0;
    }
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d %d %d", &id, &l, &r);
     if(l!= -1) {
      parent[l] = id;
      sib[l] = r;
      deg[id]++;
    }
    if(r!= -1) {
      parent[r] = id;
      sib[r] = l;
      deg[id]++;
    }
  }for(i=0; i<n; i++){
    int dep=depth(i);
      printf("node %d: ", i);
      printf("parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", parent[i],sib[i], deg[i], dep, height(i));
      if(parent[i]==NILL)printf("root");
      else if(deg[i]==0)printf("leaf");
      else printf("internal node");
      printf("\n");
    }
  return 0;
}
int depth(int i){
  if(parent[i]==-1)return 0;
  return depth(parent[i]) + 1;
}
  
int height(int i){
  int j, h = 0;
  for(j = 0; j < n; ++j){
    if(parent[j] == i){
      int tmp = height(j) + 1;
      if(tmp > h) h = tmp;
    }
  }
  return h;
}


Measured memory_bytes: 2972
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	int sum =max(a,b);
	if (sum == a) {
		a--;
	}
	else {
		b--;
	}
	sum += max(a,b);

	cout<<sum<<endl;
}

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

int main(void){

  int n,i,j;
  int tmp;
  scanf("%d",&n);
  //printf("%d",n);
  int ans1[n];
  for(i=0;i<n;i++){
    scanf("%d",&ans1[i]);
  }
  int ans2[n];
  int answer;

for(i=0;i<n-1;i++){
  for(j=i+1;j<n;j++){
    if(ans1[i]<ans1[j]){
      tmp=ans1[i];
      ans1[i]=ans1[j];
      ans1[j]=tmp;
    }
  }
}

  for(i=0;i<n;i++){
    ans2[i]=ans1[i];
  }

  for(i=1;i<n;i++){
    answer+=ans1[i];
  }

  if(answer>ans2[0]){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
	int w,h,n,i;
	int xp,yp,x,y;
	int cnt=0;
	scanf("%d %d %d",&w,&h,&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&x,&y);
		if(i==0){
			xp=x;
			yp=y;
		}
		while(xp!=x || yp!=y){
			if(xp<x && yp<y){
				xp++;
				yp++;
			}
			else if(xp>x && yp>y){
				xp--;
				yp--;
			}
			else if(yp<y)yp++;
			else if(yp>y)yp--;
			else if(xp<x)xp++;
			else if(xp>x)xp--;
			cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}



Measured memory_bytes: 2132
#include <bits/stdc++.h>
#define ii pair <int , int>
#define is pair <int, string>
#define ll long long
#define mx 100000
#define sf scanf
#define sf(n) scanf("%d",&n)
#define pf printf
using namespace std;
vector <int> v;

int main(){
    int n;
    sf(n);

    int ans=n%10;
    if(ans==3) pf("bon\n");
    else if(ans==0 || ans==1 || ans==6 || ans==8) pf("pon\n");
    else pf("hon\n");

    return 0;
}



Measured memory_bytes: 3764
// header {{{
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <list>
#include <stack>
#include <tuple>
#include <cstdio>
#include <cmath>
using namespace std;

#define kita            cout << "kita\n"
#define print2(i, n)    cout << (i) << ": " << (n) << endl
#define print3(i, j, n)     cout << "(" << (i) << ", " << (j) << ") : " << (n) << endl
#define print4(i, j, n, m)  cout << "(" << (i) << ", " << (j) << ") : " << (n) << ", " << (m) << endl
#define print_mat(mat, h, w) for(int i=0;i<(h);i++){for(int j=0;j<(w);j++){cout << mat[i][j] << " ";}cout << endl;}

#define EPS (1e-10)
#define EQ(a, b) (fabs((a)-(b)) < eps)

typedef long long ll;
typedef unsigned long long ull;
// }}}
// number {{{
#define SIZE      100005
#define MOD   1000000007

// べき乗
// verified AOJ NTL_1_B
ll pow(ll a, ll b) {
    if(b == 0) return 1;
    ll aa = pow(a, b/2);
    return aa*aa%MOD*(b%2 == 1 ? a : 1)%MOD;
}

ll fact[SIZE] = {1, 1};
ll finv[SIZE] = {1, 1};

void fact_init() {
    // fact
    for(ll i=2;i<SIZE;i++){
        fact[i] = fact[i-1]*i%MOD;
    }

    // finv
    finv[SIZE-1] = pow(fact[SIZE-1], MOD-2);
    for(ll i=SIZE-1;i>=3;i--){
        finv[i-1] = finv[i]*i%MOD;
    }
}

ll comb(int n, int r) {
    if(r > n) return 0;
    return fact[n]*(finv[r]*finv[n-r]%MOD)%MOD;
}

ll gcd(ll x, ll y) {
    return y ? gcd(y, x%y) : x;
}
//}}}

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

    if(n == m){
        cout << fact[n]*fact[m]%MOD*2%MOD << endl;
    }else if(abs(n-m) == 1){
        cout << fact[n]*fact[m]%MOD << endl;
    }else{
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <numeric>
using namespace std;
int main(){
    int h,w;
    cin >> h >> w;
    for(int i=0;i<h;i++){
        string x;
        cin >> x;
        cout << x << endl;
        cout << x << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007

bool isContain(vector<int> &vec, int num) {
    if (find(vec.begin(), vec.end(), num) != vec.end()) {
        // findがvecのlast_iterを返さなければtrue
        return true;
    }
    return false;
}

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

    // input
    int A, B;
    cin >> A >> B;
    vector<int> g1 = {1, 3, 5, 7, 8, 10, 12}, g2 = {4, 6, 9, 11};
    if ((isContain(g1, A) && isContain(g1, B)) || (isContain(g2, A) && isContain(g2, B))) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9+7
#define ll long long
#define f(x) for(ull i=0;i<x;i++)
#define X first
#define Y second
#define M 1000000009
#define N   100005
#define ull unsigned long long
#define sc(n) scanf("%d",&n)
using namespace std;


int main() {
    string s,t;
    cin>>s;
    map<string ,bool> m;
    m["dream"]=1;
    m["dreamer"]=1;
    m["erase"]=1;
    m["eraser"]=1;
    int len=s.size();
    for(int i=0;i<len;i++){
        if(i+4>len){
            t="as";
            break;
        }
        t.append(s,i,5);
        i+=4;
//        cout<<t<<endl;
        if(m[t]){
            if(i+1<len&&s[i+1]=='r'){
                i++;
            }
            else if(i+2<len&&s[i+1]=='e'&&s[i+2]=='r'){
                if(i+3<len&&s[i+3]=='a'){
                    ;
                }
                else
                    i+=2;
            }
            t.clear();
        }
        else
            break;
    }
//    cout<<t<<endl;
    if(t.empty())
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
	return 0;
}



Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
  int h,m,s,ha,ma,sa;
  int a[3];
  for(int i=0;i<3;i++){
    cin>>h>>m>>s>>ha>>ma>>sa;
    a[0]=ha-h;
    a[1]=ma-m;
    a[2]=sa-s;
    for(int j=2;j>0;j--){
      if(a[j]<0){
	a[j-1]--;
	a[j]=a[j]+60;
      }
    }
    cout<<a[0]<<' '<<a[1]<<' '<<a[2]<<endl;
  }
}

      

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <unistd.h>
#define ll long long
#define inf 1000000007
#define inf16 0x3f3f3f3f
#define INF 1000000000000000007LL
#define VI vector<int>
#define VPII vector<pair<int, int> >
#define VLL vector<ll>
#define PII pair<int, int>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
using namespace std;

#define int ll

int h, w, n, k, ans;

int pot[50*50];

int query(int y1, int y2, int x1, int x2)
{
	cout << "? " << y1 << " " << x1 << " " << y2 << " " << x2 << endl;
	int ans;
	cin >> ans;
	return ans;
}

void solve(int y1, int y2, int x1, int x2, int cnt, int split)
{
	if(cnt==0)
		return;

	if(cnt==(y2-y1+1)*(x2-x1+1))
	{
		for(int i = y1; i <= y2; ++i)
		{
			for(int j = x1; j <= x2; ++j)
			{
				ans += pot[i*w+j];
				ans %= k;
			}
		}

		return;
	}

	if(y1!=y2)//split)
	{
		int m = (y1+y2)/2;
		int h = query(y1, m, x1, x2);
		solve(y1, m, x1, x2, h, split^1);
		solve(m+1, y2, x1, x2, cnt-h, split^1);
	}
	else
	{
		int m = (x1+x2)/2;
		int h = query(y1, y2, x1, m);
		solve(y1, y2, x1, m, h, split^1);
		solve(y1, y2, m+1, x2, cnt-h, split^1);
	}
}

int32_t main()
{
	cin >> h >> w >> n >> k;

	pot[0] = 1;

	for(int i = 1; i < 50*50; ++i)
	{
		pot[i] = pot[i-1]*2%k;
	}

	for(int j = 0; j < w; j += 4)
	{
		solve(0, h-1, j, min(j+3, w-1), query(0, w-1, j, min(j+3, w-1)), 1);
	}

	/*for(int i = 0; i < h; i += 5)
	{
		for(int j = 0; j < w; j += 5)
		{
			solve(i, i+4, j, j+4, query(i, i+4, j, j+4), 1);
		}
	}*/

	//solve(0, h-1, 0, w-1, n, 1);

	cout << "! " << ans << endl;
}

Measured memory_bytes: 724
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
	int a, b, c, x, ans = 0;
	cin >> a >> b >> c >> x;
	for (int i = 0; i <= a; i++)
		for (int j = 0; j <= b; j++)
			for (int k = 0; k <= c; k++)
				if (i * 500 + j * 100 + k * 50 == x)
					ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  int p;
  string S;
  vector<int> check(N,0);
  int A = 0;
  vector<int> w(N,0);
  int W = 0;
  for(int i = 0; i < M; i++) {
    cin >> p >> S;
    if (S == "AC" && check.at(p-1) == 0) {
      check.at(p-1) = 1;
      A++;
    } else if (S == "WA" && check.at(p-1) == 0) {
      w.at(p-1)++;
    }
  }
  for(int i = 0; i < N; i++) {
    if (check.at(i) == 1) {
      W += w.at(i);
    }
  }
  cout << A << " " << W << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

bool is_prime(int64_t x) {
  for (int64_t i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return true;
}

int main(void) {
  ios::sync_with_stdio(false);
  int64_t X;
  cin >> X;
  while (1) {
    if (is_prime(X)) break;
    X++;
  }
  cout << X << endl;
  return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i,k,n) for(int i = k; i < n; i++)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define argmax max_element
#define argmin min_element
#define push push_back
#define pop pop_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

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

template<class T = ll> T in() {
    T _in;
    cin >> _in;
    return _in;
}

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

    int N, Q;
    ll a[100000], x[500];

    cin >> N >> Q;
    rep(i, N) {
        cin >> a[i];
    }
    rep(i, Q) {
        cin >> x[i];
    }

    rep(i, Q) {
        ll ans = 0;
        ll lim = x[i];
        // 2重ループベースのしゃくとり [left, right)
        int right = 0;
        ll sum = 0;
        rep(left, N) {
            while(right < N && (sum+a[right] <= lim)) {
                sum += a[right];
                if (sum <= lim) {
                    right++;
                    // cout << left+1 << " " << right+1 << endl; 
                } else break;
            }

            ans += right - left;
            // cout << left + 1 << " " << right + 1 << endl;

            if (right == left)
                right++; // 追いついたらrightを進める
            else
                sum -= a[left];
        }
        cout << ans << endl;
    }


    return 0;
}



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

int main() {

    string s;
    cin >> s;
    int a, b, c, d;
    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';    

    if(a + b + c + d == 7){
        printf("%d+%d+%d+%d=7", a, b, c, d) ;   
    }
    else if(a + b + c - d == 7){
        printf("%d+%d+%d-%d=7", a, b, c, d) ;   
    }
    else if(a + b - c + d == 7){
        printf("%d+%d-%d+%d=7", a, b, c, d) ;   
    }
    else if(a - b + c + d == 7){
        printf("%d-%d+%d+%d=7", a, b, c, d) ;   
    }
    else if(a - b - c + d == 7){
        printf("%d-%d-%d+%d=7", a, b, c, d) ;   
    }
    else if(a + b - c - d == 7){
        printf("%d+%d-%d-%d=7", a, b, c, d) ;   
    }
    else if(a - b + c - d == 7){
        printf("%d-%d+%d-%d=7", a, b, c, d) ;   
    }
    else{
        printf("%d-%d-%d-%d=7", a, b, c, d) ;   
    }

    return 0;
}


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

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

    return 0;
}

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



int main(){
  int N,k;
  cin>>N>>k;
  vector<double> p(N+1);
  for(int i=0;i<N;i++){
    cin>>p[i+1];
    p[i+1]=(p[i+1]+1.0)/2.0;
  }
  
  //vector<double> e(N);
  
  for(int i=1;i<=N;i++)p[i]+=p[i-1];
  
  double ans=0.0;
  for(int i=0;i+k<=N;i++)ans=max(ans,p[i+k]-p[i]);
  
  printf("%.10f\n",ans);
  return 0;
}

Measured memory_bytes: 1792
N = int(input())
x = [26**i for i in range(1, 12)]
sumx = [sum(x[:i]) for i in range(1, 12)]
abc = 'abcdefghijklmnopqrstuvwxyz'
keta = 1

for i in range(0, 11):
    if N > sumx[i]:
        keta += 1

if keta > 1:
    N = N - sumx[keta-2] - 1
else:
    N = N - 1

out = ''
for i in range(keta):
    out = abc[N%26] + out
    N = int(N/26)
    
print(out)

Measured memory_bytes: 9204
<?php
fscanf(STDIN,"%d",$n);
$a=explode(' ',trim(fgets(STDIN)));

if(in_array(0,$a)){
    echo 0;
    exit;
}

$ans = 1;
foreach($a as $value){
    $ans *= $value;
    
    if($ans > 1000000000000000000){
        echo -1;
        exit;
    }
}

echo $ans;
?>


Measured memory_bytes: 25688