akhauriyash/Code-Regression huggingface dataset:
#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>;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll two(ll n){
    ll x=1;
    for(int i=0; i<n; ++i){
        x *= 2;
    }
    return x;
}

int main(){
    fastio;
    ll h;
    cin >> h;
    ll n=0, c=0;
    while(h!=0){
        h /= 2;
        ++c;
    }
    cout << two(c)-1 << "\n";
    #ifdef TIMER_
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
	int X,Y;
	cin >> X >> Y;
	int v[300]={0,300000,200000,100000};
	int s=v[X]+v[Y];
	if(X==1&&Y==1){
		s+=400000;
	}
	cout << s << endl;

	return 0;
}



Measured memory_bytes: 888
import math

n, d = map(int, input().split(" "))
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

cnt = 0

for i in range(n):
    z = math.sqrt(x[i]*x[i] + y[i]*y[i])
    if z <= d:
       cnt += 1

print(cnt)



Measured memory_bytes: 116752
w,h,n = map(int,input().split())
xya = [list(map(int,input().split())) for i in range(n)]
x = [0,w]
y = [0,h]
for i in xya:
  if i[2] == 1:
    if x[0] < i[0]:
      x[0] = i[0]
  if i[2] == 2:
    if x[1] > i[0]:
      x[1] = i[0]
  if i[2] == 3:
    if y[0] < i[1]:
      y[0] = i[1]
  if i[2] == 4:
    if y[1] > i[1]:
      y[1] = i[1]
if x[0] < x[1] and y[0] < y[1]:
  print((x[1]-x[0])*(y[1]-y[0]))
else:
  print(0)

Measured memory_bytes: 3064
#include <stdio.h>

int main() {
	int a, b;
	int temp;

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

	if (b > a) {
		temp = a;
		a = b;
		b = temp;
	}

	while (a % b != 0) {
		a = a%b;

		if (b > a) {
			temp = a;
			a = b;
			b = temp;
		}
	}

	printf("%d\n", b);
	return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if (a == b)
    {
        cout << "Draw\n";
        return 0;
    }
    if (a == 1 || b != 1 && a > b)
    {
        cout << "Alice\n";
        return 0;
    }
    cout << "Bob\n";
    return 0;
}


Measured memory_bytes: 384
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    h, k = gets.chomp.split.map(&:to_i)
    hary = gets.chomp.split.map(&:to_i).sort

    if h <= k
      puts "0"
      return
    end


    sum = 0
    (h - k).times do |i|
      sum += hary[i]
    end

    puts sum
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 21608
from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]

Acnt = Counter(A)

SUM = sum(A)

Q = int(input())
for _ in range(Q):
    B,C = map(int, input().split())

    cnt = Acnt[B]
    SUM -= B * cnt
    
    del Acnt[B]

    SUM += C * cnt
    Acnt[C] += cnt

    print(SUM)

Measured memory_bytes: 89156
/*#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
*/

#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define fi first
#define se second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(x) cerr<<#x<<": "<<(x)<<'\n'
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9+7;
const ll inf = 0x3f3f3f3f;
const ll nax = 0;
int n, arr[15], ganjil=0;

int main(){
	IOS
	cin >> n;
	for(int i=0;i<n;++i){
		cin >> arr[i];
		if(arr[i]&1) ++ganjil;
	}
	cout << pow(3, n)-pow(2, (n-ganjil));
	cout << '\n';
}


Measured memory_bytes: 4184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main() {
  int N; cin >> N;
  int count = 0;
  for (int i = 0; i < N; i++) {
    int a; cin >> a;
    while (a % 2 == 0) {
      a /= 2;
      count++;
    }
  }
  
  cout << count << endl;
}

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

using namespace std;


int main() {

    long A = 1000000000 + 7;

    long N;
    cin >> N;

    long result = 1;

    for (long i = 1; i <= N; i++) {

        result *= i;
        result %= A;
    }

    cout << result << "\n";


    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,m[601][3],i,j,k,x,flg;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(j=0;j<3;j++){
			scanf("%d",&m[i][j]);
		}
	}
	for(j=0;j<3;j++){
		for(k=0;k<n;k++){
			flg=0;
			for(i=k+1;i<n;i++){
				if(m[k][j]==m[i][j]){
					m[i][j]=0;
					flg=1;
				}
			}
			if(flg==1)	m[k][j]=0;
		}
	}
	for(i=0;i<n;i++){
		x=0;
		for(j=0;j<3;j++){
			x+=m[i][j];
		}
		printf("%d\n",x);
	}
	return 0;
}
			
			


Measured memory_bytes: 2100
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void angshuGod()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){    

    int n;
    cin>>n;

    int temp = n;
    vii primeFactors;
    for(int i = 2;i*i<=temp;i++){
        int cnt = 0;
        if(temp%i==0){
            while(temp%i==0){
                cnt++;
                temp /= i;
            }
        }
        primeFactors.pb({i,cnt});
    }
    if(temp != 1) primeFactors.pb({temp,1});
    int ans = 0;
    rep(i,0,primeFactors.size()){
        int cnt = 0;
        while(true){
            cnt++;
            if(primeFactors[i].ss-cnt<0) break;
            primeFactors[i].ss -= cnt;
            ans++;
        }
    }
    cout<<ans;
}

 
int32_t main()
{
    angshuGod();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 19720
/*
 * atcoder/abc139_2nd/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

/*
 * 13
 * 1 2 3 4 5 6 7 8 9 10 11 12 13
 * 2 3 4 5 6 7 8 9 10 11 12 13 1
 */
ll N;
void solve() {
  cin >> N;
  if (N==1) cout << 0 << endl;
  else cout << (N-1)*N/2 << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
namespace mp = boost::multiprecision;
// 任意長整数型
using bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;
// ついでに有理数型
using rat = boost::rational<bint>;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()

void solve(std::string S){
  cout << S[0] << S[1] << S[2] << endl;
}

int main(){
    std::string S;
				std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3628
int main(void){
	int a,b;
	int sum;
	sum=0;
	scanf("%d%d",&a,&b);
	if(a==b)
		sum=a*2;
	else if(a<b)
		sum=b+b-1;
  	else
      	sum=a*2-1;
	printf("%d",sum);
	return 0;
}

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

using namespace std;
const long long MOD = 998244353;
const long long MAXN = 300;
pair<long long,long long> arr[MAXN];
long long pw[MAXN];
int main(){
    long long n;
    cin>>n;
    pw[0] = 1;
    for(long long i=1;i<=n;i++){
        pw[i] = pw[i-1]*2;
        pw[i]%=MOD;
        cin>>arr[i].first>>arr[i].second;
    }
    long long ans = (pw[n]-n-1+MOD)%MOD;
    
    for(long long i=1;i<=n;i++){
        for(long long j=i+1;j<=n;j++){
            long long cnt = 0;
            for(long long k=j+1;k<=n;k++){
                if((arr[k].second-arr[i].second)*(arr[j].first-arr[i].first) == (arr[j].second-arr[i].second)*(arr[k].first-arr[i].first)){
                    cnt++;
                }
            }
            ans-=(pw[cnt]-MOD);
            ans%=MOD;
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
  
typedef pair<double,double> P;
typedef pair<P,double> P2;
  
P rot(P p, double a){
  a=a*M_PI/180.0;
  return P(p.first*cos(a)+p.second*(-sin(a)),
  p.first*sin(a)+p.second*cos(a));
}
  
double abss(P a,P b){
  return (a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second);
}
  
double x,y,r;int tt;
vector<P>v;
int main(){
  
  int n;
  cin>>n;
  
    double ans=1e13;
      
    v.clear();
    
    r(i,n){
      cin>>x>>y;
      v.push_back(P(x,y));
    }
  
    r(i,10){
      sort(v.begin(),v.end());
      r(j,n){
        for(int k=j+1,c=0;k<n;k++,c++){
          if(c>50)break;
          ans=min(ans,abss(v[k],v[j]));
        }
      }
      r(j,n)v[i]=rot(v[i],0.5);
    }
  
    printf("%d\n",(int)ans);
      
}


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

int main() {
    long long n;
    cin >> n;
    vector<int> nums;
    int end = sqrtl(n) + 1;
    for (int now = 2; now <= end; ++now) {
        int cnt = 0;
        while (n % now == 0) {
            cnt++; n /= now;
        }
        nums.push_back(cnt);
    }
    int ans = 0;
    if (n != 1) ans++;
    for (int i: nums) {
        int sum = i;
        int now = 1;
        while (now <= sum) {
            sum -= now;
            ans++;
            now++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 7476
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	arr := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&arr[i])
	}

	sort.Ints(arr)
	l := len(arr) - 1

	var sum int
	for i := l; i >= 0; i-- {
		if K > 0 {
			K--
			continue
		}
		sum += arr[i]
	}
	fmt.Println(sum)
}


Measured memory_bytes: 6400
#pragma region template 2.2
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, K);
    ll ans = 0;
    REP1(a, K)
    {
        REP1(b, K)
        {
            REP1(c, K)
            {
                ans += gcd(a, gcd(b, c));
            }
        }
    }
    OUT(ans);
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define int long long
using namespace std;

typedef pair<int,int> P;

int cnt = 1;
vector<P> vec;

signed main(){
	int a,b,c;
	cin >> a >> b >> c;
	cout << max({a,b,c}) * 9 + a + b + c << endl;
}

Measured memory_bytes: 256
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
inline int readint(){
    register int x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), Isdigit(ch = getchar()));
	return x * flag;
}

inline long long readlong() {
	register long long x = 0, flag = 1;
	register char ch;
	while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), Isdigit(ch = getchar()));
	return x * flag;
}
template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define For(i, x, y) for (int i = (x); i <= (y); i++) 
#define Rep(i, x, y) for (int i = (x); i >= (y); i--) 
#define ri readint
#define rl readlong

const int maxn = 101010;
int n, m;
int a[maxn];
int cmp(int x, int y) {
	return x > y;
}
int main() {
	n = ri();
	for (int i = 1; i <= n; i++) {
		a[i] = ri();
	}
	sort(a + 1, a + 1 + n, cmp);
	for (int i = 1; i <= n; i++) {
		if (i + 1 > a[i + 1]) {
			int j = 0;
			while (a[j + i + 1] >= i) j++;
			if ((a[i] - i) & 1 || (j & 1)) {
				printf("First\n");
			}
			else printf("Second\n");
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 4032
#include<stdio.h>
int main()
{
    long int i,a,b,result=0;
    char st[2];
    scanf("%ld%s%ld",&a,st,&b);
    if(1<=a,b<=1000000000 && (st[0]=='+' || st[0]=='-'))
    {

    if(st[0]=='+')
        result=a+b;
    else
        result=a-b;
        printf("%ld\n",result);
    }
    return 0;

}


Measured memory_bytes: 128
//
// Created on 2020/07/25.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int n,k;
    deque<int>point;
    cin>>n>>k;
    for (int i = 0; i < k; ++i) {
        ll temp;
        cin>>temp;
        point.push_back(temp);
    }
    for (int j = k; j < n; ++j) {
        ll b;
        cin>>b;
        if(point[0] < b){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
        point.pop_front();
        point.push_back(b);
    }
    return 0;
}


Measured memory_bytes: 4448
n, h =map(int, input().split())
A=[]
B=[]
w=0
sub=0
for i in range(n):
	a,b=map(int, input().split())
	A.append(a)
	B.append(b)
	w=max(a,w)

ans=0
B.sort(reverse=True)
for i in range(n):
	if B[i]>w:
		h-=B[i]
		ans+=1
		if 1>h:
			print(ans)
			exit()
ans+=h//w
if h%w==0:
	print(ans)
else:
	print(ans+1)


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

int main(){
  int n;
  cin >> n;
  int entry = 1;
  for(int i = 0; i < n; i++){
    int t;
    cin >> t;
    if(t % 2 == 0){
      if(t % 3 == 0 || t % 5 == 0){
      }else{
        entry = 0;
        break;
      }
    }
  }
  if(entry){
    cout << "APPROVED";
  }else{
    cout << "DENIED";
  }
}

Measured memory_bytes: 256
A,B,C= map(int,input().split())
if A==B and B==C and A%2==0:
  print(-1)
else:
  ans = 0
  while A%2==0 and B%2==0 and C%2==0:
    tmpA = A//2
    tmpB = B//2
    tmpC = C//2
    A = tmpB + tmpC
    B = tmpA + tmpC
    C = tmpA + tmpB
    ans += 1
  print(ans)

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

int main()
{
    double w,h,x,y;
    scanf("%lf%lf%lf%lf",&w,&h,&x,&y);
    double k=w*h;
    printf("%f ",k/2);
    if(x==w/2 && y==h/2)
        printf("1");
    else
        printf("0");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int i;
  int t;
  int n;
  int m = 0;
  cin >> N;
  for (i = 1; i <= N; i = i + 2){
    n = 2;
    for (t = 2; t < i; t++){
      if (i % t == 0) n++;
    }
    if (n == 8) m++;

  }
  cout << m <<endl;
}	

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }


signed main()
{
    int N; cin>>N;
    vector<vector<int> > a(N,vector<int>(3));
    for(int i=0;i<N;i++){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    
    vector<vector<int> > dp(N+1,vector<int>(3));
    for(int i=0;i<N;i++){
        dp[i+1][0]=a[i][0]+max(dp[i][1],dp[i][2]);
        dp[i+1][1]=a[i][1]+max(dp[i][0],dp[i][2]);
        dp[i+1][2]=a[i][2]+max(dp[i][0],dp[i][1]);
    }
    cout<<max({dp[N][0],dp[N][1],dp[N][2]})<<endl;
}


Measured memory_bytes: 11136
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

h, w = MAP()
a = [STR() for _ in range(h)]
b = [[inf for _ in range(w)] for _ in range(h)]
ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            b[i][j] = 0
        else:
            for k in range(4):
                ny = i + dy[k]
                nx = j + dx[k]
                if 0 <= ny < h and 0 <= nx < w:
                    b[i][j] = min(b[ny][nx] + 1, b[i][j])
for i in reversed(range(h)):
    for j in reversed(range(w)):
        if a[i][j] == '#':
            b[i][j] = 0
        else:
            for k in range(4):
                ny = i + dy[k]
                nx = j + dx[k]
                if 0 <= ny < h and 0 <= nx < w:
                    b[i][j] = min(b[ny][nx] + 1, b[i][j])
ans = 0
for i in range(h):
    ans = max(ans, max(b[i]))
print(ans)


Measured memory_bytes: 82648
package main

import "fmt"

func main() {
	// Code for B - Beautiful Strings
	var w string
	fmt.Scanf("%s", &w)

	flag := make(map[string]int, len(w))

	for i := 0; i < len(w); i++ {
		flag[string(w[i])]++
	}

	var flag2 int = 0
	for _, v := range flag {
		if v%2 != 0 {
			flag2 = 1
		}
	}

	if flag2 == 1 {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}


Measured memory_bytes: 1832
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#include <stack>
#include <bitset>
//#include <unordered_set>
#define mkp make_pair
#define err cout<<"here"<<endl
using namespace std;
const double EPS=1e-12;
typedef long long lon;
typedef unsigned long long ull;
typedef set<int>::iterator IT;
const lon SZ=100010,SSZ=30,APB=52,mod=97,one=1;
const lon INF=0x7FFFFFFF;
int n,m;
struct nd{
	int to,wt;
	nd(int a=0,int b=0):to(a),wt(b){}
};
bool vst[SZ];
vector<int> mp[SZ];

void dfs(int x,int p)
{
	vst[x]=1;
	for(int i=0;i<mp[x].size();++i)
	{
		int t=mp[x][i];
		if(!vst[t])
		{
			dfs(t,x);
		}
	}
}

void init()
{
	cin>>n>>m;
	int res=0;
	for(int i=1;i<=m;++i)
	{
		int a,b,c;
		cin>>a>>b>>c;
		mp[a].push_back(b);
		mp[b].push_back(a);
	}
	for(int i=1;i<=n;++i)
	{
		if(!vst[i])
		{
			dfs(i,-1);
			++res;
		}
	}
	cout<<res<<endl;
}


void work()
{
	
}

void release()
{
	
}

int main()
{
	std::ios::sync_with_stdio(0);
	//freopen("d:\\1.txt","r",stdin);
	int casenum;
	//cin>>casenum;
	//cout<<casenum<<endl;
	//for(int time=1;time<=casenum;++time)
	//for(int time=1;cin>>n>>m;++time)
	{
		//cout<<"Case #"<<time<<": ";
		init();
		work();
		release();
	}
	return 0;
}

Measured memory_bytes: 10496
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<queue>

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)

using namespace std;

typedef long long int lli;
typedef vector<int> vi;
stack< pair<int, vector<bool> > > s;
vector< ipair > a;

int main() {
	int n, m, i, j, k;
	pair<int, vector<bool> > x, y;
	vector<bool>c;

	cin >> n >> m;

	c.resize(n);
	a.resize(2 * m);

	rep(i, n) {
		c[i] = false;
	}
	c[0] = true;

	rep(i, m) {
		cin >> j >> k;
		a[i].first = j;
		a[i].second = k;
		a[i + m].first = k;
		a[i + m].second = j;
	}
	sort(a.begin(), a.end());

	x.first = 1;
	x.second = c;

	s.push(x);
	k = 0;
	while (s.empty()!=1) {
		y = x = s.top();
		s.pop();

		rep(i, n) {
			if (!x.second[i])
				break;
		}
		if (i == n)
			k++;
		else {
			rep(i, 2 * m) {
				if (a[i].first == x.first && !x.second[a[i].second - 1]) {
					y = x;
					y.first = a[i].second;
					y.second[a[i].second - 1] = true;
					s.push(y);
				}
			}
		}
	}

	cout << k;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
#define ld long double
int inf=100000000;
ll INF=4000000000000000000;
ll MOD=1000000007;



int main() {
  int n,d;
  cin >> n >> d;
  int a=1+2*d;
  if (n%a==0) cout << n/a << endl;
  else cout << n/a+1 << endl;
  }

Measured memory_bytes: 256
S = input()
cands = ["dream", "dreamer", "erase", "eraser"]
cands = [cand[::-1] for cand in cands]

S = S[::-1]
check = True
i = 0
while i < len(S):
  if S[i:i+7] == cands[1]:
    i += 7
  elif S[i:i+6] == cands[3]:
    i += 6
  elif S[i:i+5] in cands:
    i += 5
  else:
    check = False
    break   
  

print("YES") if check else print("NO")

Measured memory_bytes: 3188
#include <stdio.h>
#include <string.h>
int main(void){
    char s[100000+5];
    int alph[30]={0};
    scanf("%s", s);
    for(int i=0; i<strlen(s); i++)alph[(int)s[i]-'a']++;
    for(int i=0; i<26; i++){
        if(alph[i]==0){
            printf("%c\n", 'a'+i);
            return 0;
        }
    }
    printf("None\n");
    return 0;
}


Measured memory_bytes: 1808
n, k = map(int, input().split())
s = list(input())

if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B':
    s[k-1] = 'b'
else:
    s[k-1] = 'c'

print(''.join(s))

Measured memory_bytes: 61880
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
ll a[200005];
ll sum[200005];

bool C(ll v){
	
	return false;
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
		sum[i+1]+=sum[i];
		sum[i+1]+=a[i];
	}
	ll r=1LL<<60;
	for(int i=2;i<=n-2;i++){
		ll mid=sum[i];
		int v1=lower_bound(sum,sum+i+1,sum[i]/2LL)-sum;
		ll d1=sum[v1];
		if(v1>1 && labs((d1)-(mid-d1))>labs(sum[v1-1]-(mid-sum[v1-1]))){
			d1=sum[v1-1];
		}
		ll mn1=min(d1,mid-d1),mx1=max(d1,mid-d1);
		
		mid=sum[n]-sum[i];
		v1=lower_bound(sum,sum+n+1,sum[i]+mid/2LL)-sum;
		d1=sum[v1]-sum[i];
		if(v1>i+1 && labs((d1)-(mid-d1))>labs(sum[v1-1]-sum[i]-(mid-(sum[v1-1]-sum[i])))){
			d1=sum[v1-1]-sum[i];
		}
		ll mn2=min(d1,mid-d1),mx2=max(d1,mid-d1);
		ll mn=min(mn1,mn2),mx=max(mx1,mx2);
		r=min(r,mx-mn);
	}
	printf("%lld\n",r);
	return 0;
}

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

     
int main() {
	long long s;
	cin >> s;
       long long n = (long long)(sqrt(s));
    	while (n*n < s) n++;
    	int a, b, c, d;
    	if (n * (n-1) < s) { a = n; d = n; b = 1; c = (long long)a*d - s; }
    	else { a = n; d = n-1; b = 1; c = (long long)a*d - s; }
    	cout << 0 << ' ' << 0 << ' ' << a << ' ' << b << ' ' << c << ' ' << d << endl;
}

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

long long int ans[222], N;

int main(){
    scanf("%lld", &N);
    ans[105] = ans[135] = ans[165] = ans[195] = ans[189] = 1;
    partial_sum(ans, ans + 222, ans);
    cout << ans[N] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
char mas[22][22];
char str[110];
int MUKI,x,y,H,W;
int tx[]={-1,1,0,0},ty[]={0,0,-1,1}; //上下左右 (tx * ty)
void JUMP(char);
void SHOOT(int,int);
void UGOKU(char);
int main(){
  int T,l;
  map<char,int> hoge;
  hoge['^']=0;
  hoge['v']=1;
  hoge['<']=2;
  hoge['>']=3;

  cin >> T;
  for(int i=0;i<T;i++){
    scanf("%d %d",&H,&W);
    for(int j=0;j<H;j++){
      scanf("%s",mas[j]);
    }
    scanf("%d",&l);
    scanf("%s",str);

    for(int j=0;j<H;j++){
      for(int k=0;k<W;k++){
	if(mas[j][k]=='^'||mas[j][k]=='v'||mas[j][k]=='<'||mas[j][k]=='>'){
	  MUKI=hoge[mas[j][k]];
	  x=j; y=k;
	  k=W,j=H;
	}
      }
    }
    for(int j=0;j<l;j++){
      JUMP(str[j]);
    }
    for(int j=0;j<H;j++){
      printf("%s\n",mas[j]);
    }
    if(i!=T-1)puts("");
  }
}

void JUMP(char s){
  if(s=='S'){
    int ax=x,ay=y; //ax,ay 弾座標
    SHOOT(ax,ay);
  }
  else UGOKU(s);
  return;
}
void SHOOT(int ax,int ay){
  if(!(ax>=0 && ax<H && ay>=0 && ay<W))return;
  else if(mas[ax][ay]=='*'){
    mas[ax][ay]='.';
    return;
  }else if(mas[ax][ay]=='#'){
    return;
  }else{
    SHOOT(ax+tx[MUKI],ay+ty[MUKI]);
  }
}
void UGOKU(char ss){
  map<char,int> hoge; map<int,char> hogehoge;
  hoge['U']=0;hogehoge[0]='^';
  hoge['D']=1;hogehoge[1]='v';
  hoge['L']=2;hogehoge[2]='<';
  hoge['R']=3;hogehoge[3]='>';
  MUKI=hoge[ss];
  mas[x][y]=hogehoge[MUKI];
  int dx=x+tx[MUKI];
  int dy=y+ty[MUKI];
  if(dx>=0&&dx<H&&dy>=0&&dy<W){
    if(mas[dx][dy]=='.'){
      mas[x][y]='.';
      x+=tx[MUKI];
      y+=ty[MUKI];
      mas[x][y]=hogehoge[MUKI];
    }
  }
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
   int n, m = 0;
   int a[101];
   vector<int> ans;
 
   for(int i=1 ; i <= 100 ; i++){
       a[i] = 0;
   }
   while( cin >> n ){
       a[n]++;
   }
   for(int i=1 ; i <= 100 ; i++){
       m = max( a[i] , m );
   }
   for(int i=1 ; i <= 100 ; i++){
       if( m == a[i] ) ans.push_back(i);
   }
   sort( ans.begin() , ans.end() );
   for(int i=0 ; i < ans.size() ; i++ ){
       cout << ans[i] << endl;
   }
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	char C = getcha();
	int A = C - '0';
	while ((C = getcha()) >= '0') A = A * 10 + C - '0';
	return A;
}

const int dm = 1 << 20;
char dn[dm], * di = dn;
inline void putint(ll X) {
	int keta = 0;
	char C[20];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = ' ';
}

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


	int N = getint();
	int A[100001];
	rep1(i, N) A[getint()] = i;
	rep1(i, N) putint(A[i]);

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

dp0 = list2d(N+1, 4, -INF)
dp1 = list2d(N+1, 4, -INF)
dp0[0][2] = 0
for i, a in enumerate(A):
    for j in range(4):
        if j != 0:
            dp0[i+1][j-1] = max(dp0[i+1][j-1], dp0[i][j])
            dp0[i+1][j-1] = max(dp0[i+1][j-1], dp1[i][j])
        if j != 3:
            dp1[i+1][j+1] = max(dp1[i+1][j+1], dp0[i][j] + a)
if N % 2 == 0:
    ans = max(dp0[N][2], dp1[N][2])
else:
    ans = max(dp0[N][1], dp1[N][1])
print(ans)


Measured memory_bytes: 138160
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

string S;
int N;

ll dp[100010][2];

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

int main(){
  cin>>S;
  int N=S.size();

  dp[0][0]=1;
  rep(i,N){
    int lb=S[i]-'0';
    rep(j,2){

      rep(a,2)rep(b,2){
        int nj=j;
        if(a==1&&b==1) continue;

        if(j==0&&lb==0&&(a==1||b==1)) continue;

        if(a==0&&b==0){
          if(j==0&&lb==1) nj=1;
        }

        if(a!=b);

        add(dp[i+1][nj],dp[i][j]);
      }
    }
  }

  ll ans=0;
  rep(i,2) add(ans,dp[N][i]);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 2048
#include <stdio.h>
int isprime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0)  return 0;
    }
    return 1;
}

int main(){
    int n, p1 = 0,i;
    while (1) {
        scanf("%d", &n);
        if(n==0) break;
        for(i = n; i >=2; i--){
            if(isprime(i - 2)&& isprime(i)/*&&p1<i*/){
                printf("%d %d\n", i - 2, i);
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1708
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, *ABC = map(int, rl().split())
    s = [rl().rstrip() for _ in range(N)]
    
    if sum(ABC) == 0:
        print('No')
    elif sum(ABC) == 1:
        ans = ['Yes']
        for si in s:
            idx0 = ord(si[0]) - ord('A')
            idx1 = ord(si[1]) - ord('A')
            if ABC[idx0] == 0 and ABC[idx1] == 0:
                print('No')
                return
            if ABC[idx0] == 0:
                ABC[idx0] += 1
                ABC[idx1] -= 1
                ans.append(si[0])
            else:
                ABC[idx0] -= 1
                ABC[idx1] += 1
                ans.append(si[1])
        print(*ans, sep='\n')
    else:
        if ABC[ord(s[0][0]) - ord('A')] == 0 and ABC[ord(s[0][1]) - ord('A')] == 0:
            print('No')
        else:
            ans = ['Yes']
            for i, si in enumerate(s):
                if any(num < 0 for num in ABC):
                    raise Exception
                idx0 = ord(si[0]) - ord('A')
                idx1 = ord(si[1]) - ord('A')
                if ABC[idx0] == 0:
                    ABC[idx0] += 1
                    ABC[idx1] -= 1
                    ans.append(si[0])
                elif ABC[idx1] == 0:
                    ABC[idx0] -= 1
                    ABC[idx1] += 1
                    ans.append(si[1])
                elif sum(ABC) == 2 and ABC[idx0] == 1 and ABC[idx1] == 1 and i != N - 1 and si != s[i + 1]:
                    if si[0] in s[i + 1]:
                        ABC[idx0] += 1
                        ABC[idx1] -= 1
                        ans.append(si[0])
                    else:
                        ABC[idx0] -= 1
                        ABC[idx1] += 1
                        ans.append(si[1])
                else:
                    if ABC[idx0] <= ABC[idx1]:
                        ABC[idx0] += 1
                        ABC[idx1] -= 1
                        ans.append(si[0])
                    else:
                        ABC[idx0] -= 1
                        ABC[idx1] += 1
                        ans.append(si[1])
            print(*ans, sep='\n')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 93620
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using ld = long double;

#define mp make_pair

typedef tree<
        pair<int, int>,
        null_type,
        less<pair<int, int>>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;


int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}


mt19937 rnd(time(0));

/*
const int N = 1200000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

vector<ll> primes;

ll phi(ll n)
{
    ll res = n;
    for (auto it: primes) if (n%it==0)
    {
        res/=it;
        res*=(it-1);
    }
    return res;
}

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

    ll minn = 1e18;

    ll n;
    cin>>n;

    if (n==1) {cout<<1; return 0;}
    n*=2;

    ll n1 = n;
    for (ll i = 2; i*i<=n1; i++) if (n1%i==0)
    {
        primes.push_back(i);
        while (n1%i==0) n1/=i;
    }

    if (n1>1) primes.push_back(n1);

    /*for (auto it: primes) cout<<it<<' ';
    cout<<endl;

    cout<<phi(48);*/



    for (ll i = 1; i*i<=n; i++) if (n%i==0)
    {
        //cout<<endl;
        ll x = i; ll y = n/x;
        if (__gcd(x, y)>1) continue;

        if (x==1) {minn = min(minn, y-1);
            continue;}

        //cout<<x<<' '<<y<<endl;


        p = x;
        //cout<<"PHI: "<<phi(p)-1<<endl;
        ll t = po(y%p, phi(p)-1);
        //cout<<"t: "<<t<<endl;
        minn = min(minn, t*y - 1);

        //cout<<minn<<endl;

        t = x - t;
        minn = min(minn, t*y);

        //cout<<minn<<endl;
    }

    cout<<minn;

}



Measured memory_bytes: 3660
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main() {
	speed;
	int a, b,k;
	cin >> a >> b >> b >> b >> b >> k;
	cout << (b - a <= k ? "Yay!" : ":(");
	ed;
	return 0;
}


Measured memory_bytes: 256
// A - Mahmoud and Ehab and the MEX: http://codeforces.com/contest/862/problem/A
// 0から順に操作が要るかどうかを考える

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define _D(p) std::cout<<"L"<<__LINE__<<" : " #p " = "<<(p)<<std::endl;
#define _D2(p,q) std::cout<<"L"<<__LINE__<<" : " #p " = "<<(p) << ", " #q " = "<<(q)<<std::endl;
#define _DN(v) std::cout<<"L"<<__LINE__<<" : " #v " = ["; rep(i,(v).size()) {std::cout<<v[i]<<(i==v.size()-1?"":", ");}std::cout<<"]"<<std::endl;
#define _DNN(v) std::cout<<"L"<<__LINE__<<" : " #v " = [" << std::endl; rep(i,(v).size()) {std::cout<<"    [";rep(j,(v)[0].size()){std::cout<<v[i][j]<<(j==v[0].size()-1?"":", ");}std::cout<<"],"<<std::endl;}std::cout<<"]"<<std::endl;
 
using namespace std;
 
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
 
const int INF=1<<29;
const double EPS=1e-9;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
const int mod = 1000000007;

bool ok(int *cnt, int H, int W) {
    int ok2 = 0, ok1 = 0;
    if (H % 2 == 1 && W % 2 == 1) {
        ok2 = (H + W - 2) / 2;
        ok1 = 1;
    } else if (H % 2 == 1) {
        ok2 = W / 2;
    } else if (W % 2 == 1) {
        ok2 = H / 2;
    }
    int cnt1 = 0, cnt2 = 0, cnt4 = 0;
    for (int i = 0; i < 256; ++i) {
        if (cnt[i] % 4 == 0) cnt4++;
        else if (cnt[i] % 2 == 0) cnt2++;
        else cnt1++;
    }
    if (cnt2 <= ok2 && cnt1 <= ok1) {
        return true;
    }
    return false;
}

int main(int argc, char const *argv[]) {
    int H, W;
    cin >> H >> W;
    vector<string> A;
    for (int i = 0; i < H; ++i) {
        string s;
        cin >> s;
        A.push_back(s);
    }

    int cnt[256] = {0};
    for(int i = 0; i < H; i++) {
        for (int j = 0; j < W; ++j) {
            cnt[A[i][j]]++;
        }
    }
    if (ok(cnt, H, W)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
h,w = map(int,input().split())

s = []

for i in range(h):
    s.append(list(input()))

flag = True

for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            if i==0:
                f = s[i+1][j]=='#'
            elif i==h-1:
                f = s[i-1][j]=='#'
            else:
                f = s[i-1][j]=='#' or s[i+1][j]=='#'
            if j==0:
                f = f or s[i][j+1]=='#'
            elif j==w-1:
                f = f or s[i][j-1]=='#'
            else:
                f = f or s[i][j-1]=='#' or s[i][j+1]=='#'

            flag = flag and f

if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 39152
n = int(input())
s = list(map(int,input().split()))
count = 0

def merge(a, left, mid, right):
    global count
    l = a[left:mid] + [float("inf")]
    r = a[mid:right] + [float("inf")]
    i = j = 0
    for k in range(left, right):
        if l[i] <= r[j]:
            a[k] = l[i]
            i += 1
        else:
            a[k] = r[j]
            j += 1
    count += right - left

def mergeSort(a, left, right):
    if left + 1 < right:
        mid = right + (left - right)//2
        mergeSort(a, left, mid)
        mergeSort(a, mid, right)
        merge(a, left, mid, right)

mergeSort(s, 0, n)

print(*s)
print(count)

Measured memory_bytes: 63744
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
using namespace std;
const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        vector<double> x(n), r(n);
        for(int i=0; i<n; i++){
            cin >> x[i] >> r[i];
        }

        double lb=0, ub=4e5;
        for(int rep=0; rep<50; rep++){
            double mid = (lb +ub)/2;
            vector<pair<double, double> > range;
            for(int i=0; i<n; i++){
                if(mid +EPS > r[i]) continue;
                double diff = sqrt(r[i]*r[i] -mid*mid);
                range.push_back(make_pair(x[i]-diff, x[i]+diff));
            }
            sort(range.begin(), range.end());
            range.push_back(make_pair(INF, INF));

            double maxrange = 0;
            double b=-INF, e=-INF;
            for(int i=0; i<(int)range.size(); i++){
                if(range[i].first < e +EPS){
                    e = max(e, range[i].second);
                }else{
                    maxrange = max(maxrange, e-b);
                    b = range[i].first;
                    e = range[i].second;
                }
            }
            if(maxrange > 2*mid){
                lb = mid;
            }else{
                ub = mid;
            }
        }
        cout << fixed << setprecision(10);
        cout << 2*lb << endl;
    }
    return 0;
}


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

int main() {
	int n; cin >> n;
	deque<int>a;
	for (int i = 0; i < n; i++) {
		int tmp; cin >> tmp;
		if (n % 2 == 0) {
			if (i % 2 == 0)a.push_back(tmp);
			else a.push_front(tmp);
		}
		else {
			if (i % 2 == 0)a.push_front(tmp);
			else a.push_back(tmp);
		}
	}

	for (int i = 0; i < n; i++) {
		cout << a[i] << ' ';
	}
	cout << endl;

	return 0;
}

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

using lli = int64_t;

int main()
{
    lli n, k; cin >> n >> k;

    lli ans = LLONG_MAX;

    for(lli i = 0; i < 1024; i++)
    {
        lli x = 1;

        for(lli j = 0; j < n; j++)
        {
            lli b = lli(1) << j;

            if(i & b) x *= 2;
            else x += k;
        }

        ans = min(ans, x);
    }

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

Measured memory_bytes: 256
n,m = map(int,input().split())

lmax = 0
rmin = 100000
for i in range(m):
    l,r = map(int,input().split())
    if l > lmax:
        lmax = l
    if r < rmin:
        rmin = r
if rmin >= lmax:
    print(rmin+1-lmax)
else:
    print(0)


Measured memory_bytes: 3060
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        ArrayList<Integer> sides = new ArrayList<>();

        for (int i = 0; i < N; i++) {
            sides.add(sc.nextInt());
        }

        Collections.sort(sides, Collections.reverseOrder());

        int max = sides.get(0);
        int sumOfremains = 0;

        for (int i = 1; i < sides.size(); i++) {
            sumOfremains += sides.get(i);
        }

        System.out.println(max < sumOfremains ? "Yes" : "No");
    }
}




Measured memory_bytes: 23764
import java.util.*;
import java.math.*;
import java.awt.geom.*;
import java.io.*;
    
    
public class Main {
	static int INF = 2 << 27;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int S = sc.nextInt();
			if(n == 0 && S == 0) break;
			int[] r = new int[n];
			for(int i = 0; i < n; i++) {
				r[i] = sc.nextInt();
			}
			int ans = 0;
			for(int i = 0; i < n; i++) {
				for(int j = i+1; j < n; j++) {
					if(r[i] + r[j] > S) ans++;
				}
			}
			System.out.println(ans);
 		}
	}
}

Measured memory_bytes: 71124
n,m,x=map(int,input().split())

ab_list=[]
for i in range(n):
    a_list=list(map(int,input().split()))
    ab_list.append(a_list)

min_val=-1

for i in range(2 ** n):
    tmp = [False] * n
    for j in range(n):
        if i >> j & 1:
            tmp[j] = True
    
    ss=[0]*m
    val=0
    for j,f in enumerate(tmp):
        if f:
            for k in range(m):
                ss[k]+=ab_list[j][1+k]

            val+=ab_list[j][0]
        
    if min(ss) >=x:
        if min_val==-1:
            min_val=val
        elif min_val>val:
            min_val=val

print(min_val)



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

int main() {
  int n;
  cin >> n;
  int l=0;
  vector<int>a(n);
  vector<int>b(n);
  vector<int>c(n-1); 
  for(int i=0;i<n;i++){
  cin >> a.at(i);
  } 
  for(int i=0;i<n;i++){
  cin >> b.at(i);
  l+=b.at(i);  
  }  
  for(int i=0;i<n-1;i++){
  cin >> c.at(i); 
  }
 for(int i=0;i<n-1;i++){
    if(a.at(i)+1==a.at(i+1)){
    l+=c.at(a.at(i)-1);
    }  
  } 
  
  cout << l << endl;; 
}

Measured memory_bytes: 256